Skip to content

feat(amr): phase 6 CLI group, commitAmrEdits and createAmrTools - #335

Merged
danielsimonjr merged 3 commits into
masterfrom
feat/amr-cli
Nov 12, 2026
Merged

danielsimonjr merged 3 commits into
masterfrom
feat/amr-cli

Conversation

@danielsimonjr

Copy link
Copy Markdown
Owner

Phase 6 of docs/roadmap/AGENT_MEMORY_REPO_PLAN.md.

What

  • memory amr context|check|export|import|commit (src/cli/commands/amr.ts). One JSON report per command; process.exitCode = 1 on an issue, refusal or failure. Export and import are dry runs until --apply; export passes the whole graph and filters only through types (Phase 4 F17).
  • commitAmrEdits (AmrWriter.ts): the guarded commit of hand-edited .md files (plan rule R14). Refuses the whole commit, staging nothing, on deletion, rename, merge conflict (AA), staged-plus-edited (MM, AM), non-Markdown, bad path or secret (text, path and message). GitRunner allows status --untracked-files=all so a new note in a new folder is seen as a file.
  • createAmrTools(ctx, { root, allowWrite, namespace, maxBytes }): five tools, fixed root, strict schemas (no root or path argument), write_disabled before any git or fs call, budgets above the reader defaults refused, results bounded like the Recursa tools.
  • defineTool and makeToolSet move to recursaToolSupport.ts, shared by both adapters.
  • ExportFormat docs: AMR is not an export format; see exportAmr.

Fixed

  • boundResult could exceed maxBytes (79,754 vs 65,536 bytes): separators, keys and escapes now count, and the final size is checked.

Route

Haiku builder (tests first) -> Haiku challenger (critiqued the builder diff, proposed alternatives) -> Sonnet reviewer (selected and combined per point, with probes; found that a merge conflict was committed with its markers) -> Opus fixer.

Deferred (todo rows)

GitRunner stdout cap; quadratic planTarget readdir; the repo-wide process.exit pattern; the scan-vs-git add window; AMR tools ignore AbortSignal after start; a bad --storage path gives an unhandled rejection and exit 0.

Gates (local)

Full suite 13227 passed, 0 failed. Node 22.16 focused suites 600 passed. Built CLI amr check on a dangling link: exit 1, JSON parses. typecheck, lint, build + check-exports, check-duplicates, check-census, repo-tools docs check src (2167/2167), architecture docs (30 claims).

junior chain run: yes, 5 of 16 accepted (deepseek-v4.1-flash:cloud). Worker (Haiku): full first pass. Challenger (Haiku): 13 disputes. Reviewer (Sonnet): 7-item fix list, all applied, plus F8 (bounded results).

🤖 Generated with Claude Code

danielsimonjr and others added 3 commits November 11, 2026 23:02
- `memory amr context|check|export|import|commit`: one JSON report per
  command; exit code 1 on an issue, refusal or failure (exitCode, not
  process.exit, so piped JSON is not cut). Export/import dry-run by default.
- commitAmrEdits: guarded commit of hand-edited .md files; refuses the
  whole commit on deletion, rename, merge conflict, staged-plus-edited,
  non-Markdown, bad path or secret; the size check comes before the read.
- createAmrTools: fixed root, strict schemas, allowWrite gate, budgets
  refused above the reader defaults, results bounded like Recursa.
- Shared tool scaffolding (defineTool, makeToolSet) moves to
  recursaToolSupport.ts.
- Fix: boundResult could exceed maxBytes (79,754 vs 65,536 bytes).

Relay: Haiku builder, Haiku challenger (critiqued the builder diff),
Sonnet reviewer (selected and combined, found the committed merge
conflict), Opus fixer.

junior chain run: yes, 5 of 16 accepted (deepseek-v4.1-flash:cloud)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checkAmrLink refused ':' and '\' but allowed '"', '<', '>', '|', '?' and
'*'. Windows cannot create such a file, so a note committed on Linux broke
a Windows checkout; the commitAmrEdits test for 'q"uote.md' (skipped on
win32) failed on the ubuntu and macos CI legs. New reason: windows-char.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danielsimonjr
danielsimonjr merged commit 2c2119c into master Nov 12, 2026
9 checks passed
@danielsimonjr
danielsimonjr deleted the feat/amr-cli branch November 12, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant