Skip to content

protocol import: detect and split Claude / OpenCode / Codex instruction files #10

Description

@pizofreude

For users with an existing `CLAUDE.md` or `AGENTS.md` (the typical multi-CLI setup), the migration path to daimon's typed `protocol` records is manual: read the file, hand-curate the discipline, then `daimon protocol import` it. This is friction.

Proposed change

A `daimon protocol import --from-claude-md ` (and `--from-agents-md`, `--from-gemini-md`) that:

  1. Parses the file's H1/H2 sections (`#`, `##`).
  2. Suggests a default mapping:
    • Sections matching `/identity|persona|role/i` → `persona.fields.identity`
    • Sections matching `/voice|tone|communication/i` → `persona.fields.voice`
    • Sections matching `/boundaries|must not|never do/i` → `persona.fields.boundaries`
    • Sections matching `/rules|discipline|protocol/i` → `protocol.fields.rules`
    • Sections matching `/on .* do .*|from now on|convention/i` → `project_convention.fields.rule`
    • Sections matching `/decision|chose|why/i` → `decision.fields.context` + `decision.fields.rationale`
  3. Emits a draft YAML the user can edit:

```yaml

draft.yaml — generated by 'daimon protocol import --from-claude-md CLAUDE.md'

persona:
title: Ame
fields:
identity: "<extracted from # Identity>"
voice: "<extracted from # Voice>"
boundaries: "<extracted from # Boundaries>"
protocols:

  • title: Behavioral Discipline
    fields:
    scope: agent
    rules: |
    <extracted from # Rules>
  • title: Save Discipline
    fields:
    scope: agent
    rules: |
    <extracted from # Save Discipline>
    conventions:
  • title: Uses 💚 not 💜
    fields:
    rule: "Always use the green heart emoji, never the purple heart"
    ```
  1. `daimon protocol import draft.yaml` posts them all in order.

Why this matters for a second user

Pizo's `master-memory.md` is ~15 KB of dense identity + decision + protocol content. The cost of hand-curating that into daimon's 12-kind taxonomy is high. A migration tool would let them pilot daimon with their real content from day one, not a stripped-down placeholder.

Acceptance

  • A single command can import a typical `CLAUDE.md` (or `AGENTS.md`) and produce a working persona + 1–2 protocols with editable YAML drafts.
  • The draft is reviewable: `--dry-run` prints the draft YAML and exits without writing.
  • The generated records are tagged with `migration:from=claude-md` (or similar) so users can find and clean them up later.
  • The 12-kind mapping is documented in a `MIGRATION.md` reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions