Repository navigation
docs: slim AGENTS.md layout block and move detail to configuration docs - #7
Merged
Merged
Conversation
…facts AGENTS.md section 2's 73-line per-file layout inventory duplicated docs/configuration.md's declared single ownership of the top-level operational-home layout. Compact section 2 to the never-touch, safe-to-delete, gitignored/captain-private, and symlink facts that must survive with no doc loaded, and move the two categories genuinely missing an owner (dispatch restrictions, PR-poll/check-trust records) into docs/configuration.md's "Operational home layout and state" section instead of re-listing them.
…les, fix check wording
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Slim the directory-layout code block in AGENTS.md section 2 (Layout and state) by moving its detail to that layout's declared single owner, docs/configuration.md 'Operational home layout and state', while keeping every safety-critical fact inline.
AGENTS.md is loaded into every session of every fleet member; its section 2 layout code block was 73 lines / ~11.5k characters, duplicating detail already declared owned by docs/configuration.md.
What must stay inline in AGENTS.md (the inline-stub test - what must survive with no doc loaded): every never-touch/never/read-only/only-<script>-writes-it/safe-to-delete prohibition or ownership rule from the block; the captain-private and gitignored status of .env, data/, state/, config/, projects/, and .no-mistakes/ (and that projects/ is read-only to firstmate except under hard rule 1); the CLAUDE.md -> AGENTS.md and .claude/skills -> .agents/skills symlinks, and that public skills/ is not loaded by firstmate; any fact another always-loaded AGENTS.md section (3, 7, 8, 10, 13, 14) depends on without naming a doc.
Everything else (per-file descriptions, inheritance details, generated-artifact explanations, pointers already owned by a docs/configuration.md subsection or a script header) was verified to already have an owner elsewhere (docs/configuration.md's Pi Calm/Backlog backend/Runtime backend/Harness support/Crew dispatch profiles/Startup memory budget/Trace context/Away-mode wedge alarm/Secondmate routes/Captain Preferences/Operational learnings sections, the secondmate-provisioning and process-event-sources skills, docs/architecture.md, docs/turnend-guard.md, or the relevant script's own header) and was dropped from AGENTS.md rather than re-copied.
Two categories had no existing owner and were merged into docs/configuration.md's existing 'Operational home layout and state' section (not a new list/owner): durable per-task dispatch restrictions under data/dispatch-restrictions/ (bin/fm-dispatch-restrict.sh), and validated PR-merge-poll bindings plus custom-check trust records under state/ (bin/fm-pr-check.sh, bin/fm-check-register.sh, bin/fm-watch.sh).
Result: AGENTS.md dropped from 68,683 to 58,517 characters (about 2,900 fewer estimated tokens); docs/configuration.md grew by only 247 characters (two sentences extended, no new section). Verified via grep that no other skill, doc, bin/ header, README.md, or CONTRIBUTING.md quotes or depends on the removed block's exact wording. bin/fm-doc-audience-check.sh and bin/fm-lint.sh both pass.
What Changed
docs/configuration.md"Operational home layout and state" as the single owner of the layout.CLAUDE.mdand.claude/skillssymlinksstate/procevent/,state/when/, and the open-decisions cursor, plus which files are safe to deletedata/captain-shared.mdis read-only in secondmate homesdocs/configuration.md(+247 characters, no new section) to cover the only two layout entries that had no other owner: per-task dispatch restrictions underdata/dispatch-restrictions/(bin/fm-dispatch-restrict.sh), and PR merge poll bindings plus custom-check trust records understate/(bin/fm-pr-check.sh,bin/fm-check-register.sh,bin/fm-watch.sh).🤖 Generated with Claude Code
Risk Assessment
✅ Low: This is a docs-only change: the round-1 fixes match the captain's instructions exactly, and the restored claims (single writers for
state/procevent/,state/when/and the open-decisions cursor, the watcher's three check paths, and the scripts named as owners) were each checked againstbin/. Every fact the intent requires inline is still in AGENTS.md: the gitignored folders in section 1, the symlinks in section 2, and publicskills/not being loaded in section 12.Testing
No baseline commands had run before this step. I reviewed the diff and wrote a checker (kept in the evidence directory, not the repo) that tests the rules against the base and target commits. All 20 required safety facts from the removed layout block are still inline in AGENTS.md at the target commit. I also confirmed each dropped detail has an owner doc, skill or script, that the always-loaded sections lose nothing they rely on, and that nothing else in the repo quotes the removed wording. The targeted
tests/fm-documentation-audiences.test.shpassed. This is a docs-only change with no rendered UI, so the evidence is the checker transcript, the test log and the saved diff. Overall result: pass, with no actionable findings.Evidence: Inline safety-fact check transcript (20/20 PASS)
Old section-2 layout block: 74 lines, 11453 chars; new section 2 has no code block. AGENTS.md chars: 68683 -> 58723 (delta -9960) PASS CLAUDE.md -> AGENTS.md symlink PASS .claude/skills -> .agents/skills symlink PASS public skills/ not loaded by firstmate PASS .env/data/state/config/projects/.no-mistakes captain-private+gitignored PASS projects/ read-only except hard rule 1 PASS state/.watcher-down never touch PASS claude autoarm + turnend-claude-blocks never touch PASS cursor park owner + turnend-cursor-blocks never touch PASS watcher internals never touch (all 10 globs) PASS sub-supervisor internals never touch PASS state/procevent/ written only by fm-procevent.sh; presence keeps supervision PASS state/when/ written only by fm-procevent-when.sh PASS open-decisions-cursor written only by fm-classify-lib.sh + safe to delete PASS watch-triage.log safe to delete PASS check.sh: reject every other state check without execution PASS captain-shared.md read-only in secondmate homes PASS dispatch restrictions set/lift only via fm-dispatch-restrict.sh, survive completion/teardown/re-queue PASS captain.md canonical regardless of harness memory; inspect-then-update PASS docs/configuration.md named as single layout owner PASS state/<id>.status is a wake event, not current-state truth RESULT: ALL SAFETY FACTS INLINEEvidence: Inline safety-fact checker script
Evidence: Documentation audience regression test output
Evidence: AGENTS.md / docs/configuration.md before-after diff
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 4 issues found → auto-fixed ✅
AGENTS.md:59- The change breaks one of its own acceptance rules. The intent says AGENTS.md must keep inline "every never-touch/never/read-only/only-<script>-writes-it/safe-to-delete prohibition or ownership rule from the block". Several of those rules were in the deleted code block and now appear nowhere in AGENTS.md: (1)state/procevent/is "written only by bin/fm-procevent.sh"; (2)state/when/is "written only by bin/fm-procevent-when.sh"; (3)state/.<id>.open-decisions-cursoris "written only by fm-classify-lib.sh's status_open_decisions_incremental" (only the safe-to-delete part survives, line 59); (4).status-presentation-cursor/.status-presentation-lockare "owned by fm-classify-lib.sh, with each task's row retired by teardown"; (5)state/<id>.herdr-presentationis "never task or endpoint authority"; (6)state/procevent-inbox/source output lives there and "never in an event line"; (7)data/dispatch-restrictions/<id>is "created, listed, and removed only by bin/fm-dispatch-restrict.sh" (section 10 covers set/lift but never says hand edits are forbidden). Most of these have owners elsewhere: docs/herdr-backend.md:92,116 for (5), docs/configuration.md "Process-to-event sources", and script headers. The related fact that registered procevent sources keep supervision required is enforced by bin/fm-supervision-lib.sh:48-56 and documented in docs/turnend-guard.md:30. So the practical risk is small, but the text no longer matches the stated criterion. Decide whether to add a short inline sentence with these single-writer and never rules (e.g. next to the line-58 never-touch list), or to narrow the criterion.AGENTS.md:60- The new line 60 saysstate/<id>.check.sh"runs only hash-validated, registered custom checks and rejects every other state check without execution". The watcher does more than that. bin/fm-watch.sh:890-908 also runs the byte-identified Relay shimstate/x-watch.check.shthrough bin/fm-x-poll.sh, and the static PR merge poll set up bybin/fm-pr-check.shthroughfm-pr-poll.sh --validated. Neither goes throughfm-check-register.sh. The deleted block described all three paths; the new sentence drops two. This file is loaded every session, so an agent could conclude that a PR merge poll will be rejected unless registered, or that it must runfm-check-register.shon a PR poll, which contradicts section 7 (lines 287-290). Suggested fix: "The watcher dispatches validated PR merge polls and the Relay shim only through trusted repository scripts, runs customstate/<id>.check.shfiles only from hash-validated registered snapshots, and rejects every other state check without execution."AGENTS.md:58- Line 58 points todocs/architecture.mdanddocs/turnend-guard.md"for their mechanics", but most of the listed records aren't in either doc. A grep finds no mention of.turnend-claude-blocks*,.turnend-cursor-blocks,.hash-*,.count-*,.stale-*,.paused-*,.wedge-escalations-*,.seen-*,.hb-surfaced-*, or.heartbeat-streak. Their real owners are bin/fm-watch.sh, bin/fm-turnend-guard.sh, bin/fm-turnend-guard-cursor.sh, bin/fm-wake-lib.sh, and bin/fm-supervise-daemon.sh. The added phrase "repair them only through the home-scoped path the emitted supervision protocol names" also doesn't fitstate/.subsuper-*/.supervise-daemon.*, whose procedure section 8's away-mode stub gives to the/afkskill. The never-touch rule itself is intact. Only the pointer and repair wording should be corrected, e.g. "see the owning script headers (bin/fm-watch.sh, the turn-end guards, bin/fm-supervise-daemon.sh) and/afkfor the away-mode family".AGENTS.md:55- Line 55 (".env,data/,state/,config/,projects/, and.no-mistakes/are captain-private and gitignored.") repeats section 1's line 43 almost word for word. Line 56's "publicskills/... is not loaded by firstmate" also repeats line 450, and line 41 already lists publicskills/. The goal of the change is to trim an always-loaded file, and the intent only requires these facts to stay somewhere in AGENTS.md, which section 1 already does. Dropping line 55 and theskills/clause would save a bit more text with no loss. It is kept as ask-user because the author placed these facts in section 2 on purpose.🔧 Fix: docs(agents): restore section 2 single-writer rules, fix check wording
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
AGENTS.md:63- AGENTS.md no longer says data/captain-shared.md is read-only in secondmate homes. The intent requires every read-only rule from the old block to stay inline. The old block said 'main-authoritative shared captain preferences propagated read-only to secondmate homes'. Now line 63 only calls it 'main-authoritative ... for secondmate inheritance' and line 173 points to the secondmate-provisioning contract. The explicit rule is only in .agents/skills/secondmate-provisioning/SKILL.md:115 and docs/configuration.md:161, and neither is loaded in every session. A secondmate reading only AGENTS.md is never told not to edit its inherited captain-shared.md. Suggested fix: add 'and read-only in secondmate homes' after 'main-authoritative' on line 63, about 30 bytes.bin/fm-doc-audience-check.sh->fm-doc-audience-check: ok surfaces=70 local_links=264bin/fm-test-run.sh tests/fm-documentation-audiences.test.sh(4/4 ok)Before/after measurement of AGENTS.md, section 2, and docs/configuration.md at 4a2fc09 and 69b68c3, usingfm_startup_memory_estimated_tokens_for_bytesfrombin/fm-startup-memory-budget-lib.shInline-stub checklist: 20 grep checks on the target AGENTS.md, one per required fact (captain-private/gitignored paths, projects/ read-only, symlinks, skills/ not loaded, each never-touch family, rules that one script alone writes a record, safe-to-delete rules, the check-register binding, dispatch-restriction lifecycle, /afk routing, inspect-then-update, captain-shared read-only)Walked every line of the removed 73-line block that says never, read-only, only, safe-to-delete, or names an owner, and matched each to an inline AGENTS.md line or an owner (docs/herdr-backend.md:92, process-event-sources SKILL.md:107, docs/configuration.md:459, bin/fm-classify-lib.sh:822, bin/fm-supervision-instructions.sh:93 for x-mode.env)Checked that layout paths referenced from sections 1, 3, 4, 6, 7, 8, 10, 12, 13, and 14 still resolve to an inline fact or a named ownerls -l CLAUDE.md .claude/skillsconfirms both symlinks exist on diskgit diff 4a2fc09 69b68c3 -- docs/configuration.mdconfirms only the two layout sentences changed and no heading was added🔧 Fix: Restore captain-shared read-only rule inline in AGENTS.md
✅ Re-checked - no issues remain.
git diff 4a2fc09..30f402creviewed; the before/after diff is saved as evidencepython3 inline-stub-check.py 4a2fc09 30f402c: a checker I wrote in the evidence directory. It confirms the section 2 code block is gone and that 20 required inline facts (never-touch families, single-writer and safe-to-delete rules, captain-private and gitignored dirs,projects/read-only, both symlinks, publicskills/not loaded,captain-shared.mdread-only, dispatch-restriction lifecycle, status wake-event rule, single layout owner) all match in AGENTS.md at the target commitCharacter counts viagit show <rev>:AGENTS.mdandgit show <rev>:docs/configuration.md: AGENTS.md 68,683 → 58,723; configuration.md 92,854 → 93,101 (+247)ls -la CLAUDE.md .claude/skills: both symlinks exist and point to AGENTS.md and ../.agents/skillsScanned sections 3, 7, 8, 10, 13 and 14 for layout paths and names: each is still defined inline or routed to a named skill or docOwner checks: configuration.md has the headings the intent names, and its layout section now citesdata/dispatch-restrictions/,fm-dispatch-restrict.sh,fm-pr-check.sh,fm-check-register.shandfm-watch.sh;docs/herdr-backend.md:92,116owns the presentation-journal authority rule;docs/scripts.md:4owns 'read the header before first use';bin/fm-supervision-instructions.sh:133renders 'source x-mode.env first';.agents/skills/updatefirstmate/SKILL.md:16and CONTRIBUTING.md cover skills/ loadingRepo-wide grep for 'section 2' and for distinctive wording from the removed block: nothing depends on itbash tests/fm-documentation-audiences.test.sh: all 4 checks ok, exit 0git status --porcelain: worktree clean, no transient files✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.