Skip to content

docs: slim AGENTS.md layout block and move detail to configuration docs - #7

Merged
Hozzy02 merged 3 commits into
mainfrom
fm/fm-agents-layout-slim
Sep 13, 2026
Merged

Hozzy02 merged 3 commits into
mainfrom
fm/fm-agents-layout-slim

Conversation

@Hozzy02

@Hozzy02 Hozzy02 commented Sep 13, 2026

Copy link
Copy Markdown
Owner

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

  • Removed the 73-line directory-layout code block from AGENTS.md section 2 (Layout and state). AGENTS.md drops from 68,683 to 58,723 characters. Section 2 now points to docs/configuration.md "Operational home layout and state" as the single owner of the layout.
  • Kept the safety-critical rules inline in AGENTS.md as short sentences:
    • the CLAUDE.md and .claude/skills symlinks
    • one never-touch list for watcher, turn-end guard, Claude auto-arm, Cursor park, and sub-supervisor internals, pointing to the scripts that own them
    • the single-writer rules for state/procevent/, state/when/, and the open-decisions cursor, plus which files are safe to delete
    • corrected wording on how the watcher handles PR merge polls, the Relay shim, and registered custom checks
    • an explicit note that data/captain-shared.md is read-only in secondmate homes
  • Extended two existing sentences in docs/configuration.md (+247 characters, no new section) to cover the only two layout entries that had no other owner: per-task dispatch restrictions under data/dispatch-restrictions/ (bin/fm-dispatch-restrict.sh), and 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).

🤖 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 against bin/. Every fact the intent requires inline is still in AGENTS.md: the gitignored folders in section 1, the symlinks in section 2, and public skills/ 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.sh passed. 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 INLINE

Old section-2 layout block: 74 lines, 11453 chars; new section 2 has no code block.
AGENTS.md chars: 68683 -> 58723 (delta -9960)

Old block lines carrying safety keywords: 35
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 INLINE
exit=0
5:`data/` holds durable private fleet records such as the project and secondmate registries, captain preferences, option
6:`state/` holds runtime records such as task metadata, append-only status events, endpoint signals, watcher and wake-qu
Evidence: Inline safety-fact checker script
#!/usr/bin/env python3
"""Inline-stub check: every safety-critical fact from the removed AGENTS.md section-2
layout block must still be stated inline in AGENTS.md (no doc loaded)."""
import re, subprocess, sys
BASE, TARGET = sys.argv[1], sys.argv[2]
show = lambda c, p: subprocess.run(["git", "show", f"{c}:{p}"], capture_output=True, text=True, check=True).stdout
old, new = show(BASE, "AGENTS.md"), show(TARGET, "AGENTS.md")
sec2 = lambda t: re.search(r"(?ms)^## 2\. Layout and state\n(.*?)(?=^## 3\.)", t).group(1)
old2, new2, new_all = sec2(old), sec2(new), new
block = re.search(r"(?ms)^`` `\n(.*?)^`` `", old2).group(1)
assert "`` `" not in new2, "layout code block still present"

# (a) every block line carrying a safety keyword, and the inline evidence required for it
kw = re.compile(r"never touch|never|read-only|written only|only by|created, listed, and removed only|safe to delete|gitignored|symlink|not loaded", re.I)
flagged = [l.strip() for l in block.splitlines() if kw.search(l)]

# (b) required inline facts: (label, list of regexes that must ALL match AGENTS.md)
R = [
 ("CLAUDE.md -> AGENTS.md symlink",               [r"`CLAUDE\.md` is a symlink to this file"]),
 (".claude/skills -> .agents/skills symlink",      [r"`\.claude/skills` is a symlink to `\.agents/skills`"]),
 ("public skills/ not loaded by firstmate",        [r"Only `AGENTS\.md`, `bin/`, and `\.agents/skills/` are loaded by a running firstmate; public `skills/` is an installer-facing surface"]),
 (".env/data/state/config/projects/.no-mistakes captain-private+gitignored",
                                                   [r"`\.env`, `data/`, `state/`, `config/`, `projects/`, and `\.no-mistakes/` are captain-private and gitignored"]),
 ("projects/ read-only except hard rule 1",        [r"`projects/` contains clones that are read-only to firstmate except under hard rule 1"]),
 ("state/.watcher-down never touch",               [r"Never touch these internal coordination records", r"`state/\.watcher-down`"]),
 ("claude autoarm + turnend-claude-blocks never touch", [r"`state/\.claude-autoarm\*`", r"`state/\.turnend-claude-blocks\*`"]),
 ("cursor park owner + turnend-cursor-blocks never touch", [r"`state/\.cursor-park-owner\*`", r"`state/\.turnend-cursor-blocks`"]),
 ("watcher internals never touch (all 10 globs)",  [re.escape(f"`state/{g}`") for g in [".hash-*",".count-*",".stale-*",".stale-since-*",".paused-*",".wedge-escalations-*",".seen-*",".hb-surfaced-*",".last-*",".heartbeat-streak"]]),
 ("sub-supervisor internals never touch",          [r"`state/\.subsuper-\*`", r"`state/\.supervise-daemon\.\*`"]),
 ("state/procevent/ written only by fm-procevent.sh; presence keeps supervision", [r"`state/procevent/` is written only by `bin/fm-procevent\.sh`", r"presence alone keeps supervision required"]),
 ("state/when/ written only by fm-procevent-when.sh", [r"`state/when/` is written only by `bin/fm-procevent-when\.sh`"]),
 ("open-decisions-cursor written only by fm-classify-lib.sh + safe to delete", [r"`state/\.<id>\.open-decisions-cursor` is written only by `bin/fm-classify-lib\.sh`", r"safe to delete"]),
 ("watch-triage.log safe to delete",               [r"`state/\.watch-triage\.log` are safe to delete"]),
 ("check.sh: reject every other state check without execution", [r"rejects every other state check without execution", r"hash-validated registered snapshots"]),
 ("captain-shared.md read-only in secondmate homes", [r"`data/captain-shared\.md`[^\n]*read-only in secondmate homes"]),
 ("dispatch restrictions set/lift only via fm-dispatch-restrict.sh, survive completion/teardown/re-queue", [r"use `bin/fm-dispatch-restrict\.sh set`", r"explicit `bin/fm-dispatch-restrict\.sh lift` removes it", r"independent of the backlog backend and of task completion, teardown, or re-queueing"]),
 ("captain.md canonical regardless of harness memory; inspect-then-update", [r"`data/captain\.md` as the domain-local record[^\n]*regardless of harness memory", r"`data/captain\.md` after inspect-then-update"]),
 ("docs/configuration.md named as single layout owner", [r"`docs/configuration\.md` \"Operational home layout and state\" is the single owner"]),
 ("state/<id>.status is a wake event, not current-state truth", [r"`state/<id>\.status` line is a wake event, not current-state truth"]),
]
fail = 0
print(f"Old section-2 layout block: {len(block.splitlines())} lines, {len(block)} chars; new section 2 has no code block.")
print(f"AGENTS.md chars: {len(old)} -> {len(new)} (delta {len(new)-len(old)})")
print(f"\nOld block lines carrying safety keywords: {len(flagged)}")
for label, pats in R:
    miss = [p for p in pats if not re.search(p, new_all)]
    print(("PASS " if not miss else "FAIL ") + label + ("" if not miss else f"  missing={miss}"))
    fail += bool(miss)
print("\nRESULT:", "ALL SAFETY FACTS INLINE" if not fail else f"{fail} FACT(S) MISSING")
sys.exit(1 if fail else 0)
Evidence: Documentation audience regression test output
ok - documentation inventory classifies every maintained prose surface exactly once
ok - classification, setup routing, and maintained-prose scope fail safely
ok - required documentation owner pointers cannot silently disappear
ok - local links resolve while dates, versions, commands, and incident prose remain semantically reviewed
exit=0
Evidence: AGENTS.md / docs/configuration.md before-after diff
diff --git a/AGENTS.md b/AGENTS.md
index d87e205..ab0fe46 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -46,92 +46,21 @@ Never add an agent name as a commit co-author.
 
 ## 2. Layout and state
 
-`docs/configuration.md` is the single owner of the top-level operational-home layout and configuration schemas; each producing script's header and help own exact child fields and mutation mechanics.
+`docs/configuration.md` "Operational home layout and state" is the single owner of the top-level operational-home layout and configuration schemas; each producing script's header and help own exact child fields and mutation mechanics.
 `FM_HOME` selects an instance's private `data/`, `state/`, `config/`, and `projects/`, while scripts continue to come from their tracked code root.
 Each secondmate has a persistent isolated `FM_HOME`, including its own state, backlog, projects, and session lock.
 `bin/fm-send.sh` fails closed unless `FM_HOME` is explicit, so a steer cannot silently resolve against another home.
 
 Tracked files hold shared instructions and tooling; `data/` holds durable private fleet records; `state/` holds runtime records and append-only status events; `config/` holds local operating choices; and `projects/` contains clones that are read-only to firstmate except under hard rule 1's concrete captain-approved project operation exception.
+`CLAUDE.md` is a symlink to this file, and `.claude/skills` is a symlink to `.agents/skills`.
 
-`` `
-AGENTS.md            this file (CLAUDE.md is a symlink to it)
-CONTRIBUTING.md      contributor workflow and repo conventions
-README.md            public overview and development notes
-.github/workflows/   shared CI and PR enforcement, committed
-.tasks.toml          tracked tasks-axi markdown backend config for the default backlog backend (section 10)
-.agents/skills/      firstmate-loaded internal skills, committed; each carries metadata.internal=true for installers
-.claude/skills       symlink to .agents/skills for claude compatibility
-skills/              standalone public installer-facing skills, committed; not loaded by firstmate
-bin/                 helper scripts, committed; read each script's header before first use
-.env                 optional Relay pairing token; LOCAL, gitignored; presence-gates section 14
-config/crew-harness  crewmate harness override; LOCAL, gitignored; absent or "default" = same as firstmate. Inherited as the literal file: a concrete primary adapter value also controls a secondmate home's own crewmates (section 4)
-config/crew-dispatch.json  optional crewmate dispatch profiles; LOCAL, gitignored; firstmate-maintained but human-editable natural-language rules that choose a per-task harness/model/effort profile (section 4). Inherited by secondmate homes
-config/secondmate-harness  harness the PRIMARY uses to launch SECONDMATE agents, optionally followed by a model and effort token on the same line ("<harness> [<model>] [<effort>]"; section 4); LOCAL, gitignored; absent or "default" harness falls back to config/crew-harness then firstmate's own. The primary's own setting; NOT inherited into secondmate homes (secondmates do not spawn secondmates)
-config/backlog-backend  backlog backend override; LOCAL, gitignored; absent or "tasks-axi" = default tasks-axi backend, "manual" = force routine backlog updates to hand-editing; inherited by secondmate homes (section 10)
-config/backend  runtime session-provider backend override for new tasks; LOCAL, gitignored, and inherited by secondmate homes under the primary-authoritative contract in secondmate-provisioning; docs/configuration.md "Runtime backend" owns selection, defaults, notices, and recorded-metadata compatibility
-config/calm     Pi Calm presentation preference; LOCAL, gitignored, and not inherited; see docs/configuration.md "Pi Calm preference"
-config/startup-memory-budget     primary-authoritative per-home startup-memory budget; LOCAL, gitignored, materialized as 7,500 estimated tokens by locked primary bootstrap and inherited into secondmate homes; see docs/configuration.md "Startup memory budget"
-config/herdr-presentation-spaces  optional "off" opt-out from, or "on" opt-in to, Herdr's default-on disposable single-task visual projection, which is unconfigured-default-on only at or above a Herdr version floor; LOCAL, gitignored; inherited by secondmate homes; see docs/herdr-backend.md "Presentation spaces"
-config/trace-context  optional presence flag enabling default-off native W3C trace-context propagation to spawned agents; LOCAL, gitignored; inherited by secondmate homes; see docs/configuration.md "Trace context propagation" and docs/trace-context.md
-config/cmux-socket-password  optional cmux control-socket password; LOCAL, gitignored; read fresh on every cmux CLI call and passed through without ever overriding an operator's own ambient CMUX_SOCKET_PASSWORD when absent (docs/cmux-backend.md "Setup")
-config/wedge-alarm  optional away-mode wedge-alarm active-alert directives; LOCAL, gitignored; absent means auto (macOS Notification Center when available); see docs/wedge-alarm.md
-config/x-mode.env    generated Relay watcher cadence; LOCAL, gitignored; source before arming watcher when present
-data/                personal fleet records; LOCAL, gitignored as a whole
-  backlog.md         task queue, dependencies, history
-  captain.md         this home's domain-local captain preferences and working style; LOCAL, gitignored, canonical even if harness memory mirrors it, and updated with inspect-then-update
-  captain-shared.md  main-authoritative shared captain preferences propagated read-only to secondmate homes; LOCAL, gitignored, owned by secondmate-provisioning
-  learnings.md       fleet-local operational facts and gotchas; LOCAL, gitignored; dated, evidence-backed, curated, and updated with inspect-then-update - rewrite and prune rather than append forever, the same contract as captain.md; created lazily, absent until this home has a learning to store
-  projects.md        thin fleet navigation registry recording each project's standing delivery posture; firstmate-private, parsed for mechanical sync and seeding by fm-project-mode.sh (section 6)
-  secondmates.md      local and remote secondmate routing table; firstmate-private, maintained by the secondmate seed helpers (section 6)
-  <id>/brief.md      per-task crewmate brief, or per-secondmate charter brief when kind=secondmate
-  <id>/report.md     scout task deliverable, written by the crewmate; survives teardown
-  dispatch-restrictions/<id>  durable captain dispatch restriction for one task id; created, listed, and removed only by bin/fm-dispatch-restrict.sh (section 10); untouched by task completion, teardown, or re-queueing
-projects/            cloned repos; gitignored; read-only except under hard rule 1's concrete captain-approved project operation exception
-state/               runtime records and signals; gitignored
-  <id>.status        appended by crewmates: "<state>: <note>" wake-event lines, not current-state truth
-  <id>.turn-ended    touched by turn-end hooks
-  <id>.grok-turnend-token   firstmate-owned grok hook registry token for the task; removed by teardown
-  <id>.kimi-turnend-token   firstmate-owned Kimi hook registry token for the task; removed by teardown
-  <id>.muse-session  muse busy-source binding (sessions root plus task worktree) written by fm-spawn; removed by teardown
-  <id>.cursor-session  cursor busy-source binding (projects root, task worktree, prior conversations) written by fm-spawn; removed by teardown
-  <id>.meta          task metadata; each producer script's header owns its exact fields and mutation contract, with docs/configuration.md routing operator-facing backend and trace-context details
-  <id>.herdr-presentation  quarantinable attempt and restart-binding journal for Herdr's optional visual projection; never task or endpoint authority; see docs/herdr-backend.md "Presentation spaces"
-  <id>.check.sh      authenticated slow poll; the watcher dispatches validated PR data and the byte-identified Relay shim through trusted repository scripts, runs registered custom checks from hash-validated private snapsho

... [1257 bytes truncated] ...

ply-lib.sh
-  procevent/         registered process-to-event sources, one private record per canonical source id; written only by bin/fm-procevent.sh, and their presence alone keeps supervision required (section 13)
-  procevent-inbox/   private captured results and their durable handled-acknowledgement markers; source output lives here and never in an event line
-  when/              private condition->action watch specs, their trust bindings, and single-fire markers; written only by bin/fm-procevent-when.sh (section 13's process-event-sources trigger)
-  x-inbox/           generated Relay pending mention payloads; fmx-respond drains it (section 14)
-  x-context/         generated Relay durable per-request reply context and one-wake offer markers, keyed by request_id; survives inbox cleanup and expires within seven days (section 14; bin/fm-x-lib.sh)
-  x-outbox/          generated Relay dry-run reply and dismiss previews; inspect it when FMX_DRY_RUN is set (section 14)
-  public-followup/   generated private transport for promised public replies: commitment registrations, typed terminal-result inbox, accepted/rejected ledgers (section 14; bin/fm-public-followup.sh)
-  x-poll.error x-poll.claim-error  generated Relay and offer-claim diagnostic dedupe markers
-  .startup-network.*  status, report, per-step elapsed timings, inline-print claim, and lock for the deferred network stage session start runs off its blocking path; bin/fm-startup-network.sh
-  .wake-queue        durable queued wakes retained until post-handling acknowledgement: epoch<TAB>seq<TAB>kind<TAB>key<TAB>payload
-  .watcher-down      private generation-bound recovery state coupling watcher downtime, durable wake presentation, and post-handling acknowledgement; never touch
-  .<id>.open-decisions-cursor  per-task byte cursor and folded open-decision set bounding the OPEN DECISIONS scan's cost to new status-log appends; written only by fm-classify-lib.sh's status_open_decisions_incremental, removed by teardown, safe to delete (forces one full re-fold)
-  .status-presentation-cursor .status-presentation-lock  fleet-wide per-task status identity/byte-offset manifest and serialization lock preventing already-presented status lines from being replayed as new; owned by fm-classify-lib.sh, with each task's row retired by teardown
-  .afk               durable away-mode flag; present = sub-supervisor may inject escalations (set by /afk, cleared on user return)
-  .watch.lock .wake-queue.lock watcher singleton and queue serialization locks
-  .claude-autoarm.lock .claude-autoarm-epoch .claude-autoarm-failure-notified .claude-autoarm-failure-alarmed .turnend-claude-blocks .turnend-claude-blocks.lock   Claude Stop auto-arm single-flight, epoch, failure-episode, attended-alarm, guard-budget, and budget-lock records; never touch
-  .cursor-park-owner .cursor-park-owner.lock .turnend-cursor-blocks   Cursor stop-hook owner record, publication and commit lock, and bounded repair-nag budget; never touch
-  .hash-* .count-* .stale-* .stale-since-* .paused-* .wedge-escalations-* .seen-* .hb-surfaced-* .last-* .heartbeat-streak   watcher internals; never touch
-  .watch-triage.log  watcher's absorbed-wake debug log (size-capped); never relied on, safe to delete
-  .last-watcher-beat watcher liveness beacon, touched every poll (including while absorbing benign wakes); guard scripts read it
-  .subsuper-* .supervise-daemon.*   sub-supervisor internals; never touch
-.no-mistakes/        local validation state and evidence; gitignored
-`` `
-
+Never touch these internal coordination records directly; see the owning script headers (`bin/fm-watch.sh`, the turn-end guards, `bin/fm-supervise-daemon.sh`) for their mechanics and `/afk` for the away-mode family: `state/.watcher-down`; the `state/.claude-autoarm*` and `state/.turnend-claude-blocks*` family; the `state/.cursor-park-owner*` and `state/.turnend-cursor-blocks` family; the watcher-internal `state/.hash-*`, `state/.count-*`, `state/.stale-*`, `state/.stale-since-*`, `state/.paused-*`, `state/.wedge-escalations-*`, `state/.seen-*`, `state/.hb-surfaced-*`, `state/.last-*`, and `state/.heartbeat-streak` family; and the `state/.subsuper-*` / `state/.supervise-daemon.*` family.
+`state/procevent/` is written only by `bin/fm-procevent.sh`, and a registered source's presence alone keeps supervision required.
+`state/when/` is written only by `bin/fm-procevent-when.sh`.
+Each task's `state/.<id>.open-decisions-cursor` is written only by `bin/fm-classify-lib.sh`; it and `state/.watch-triage.log` are safe to delete, forcing a rebuild rather than losing anything durable.
+The watcher dispatches validated PR merge polls and the Relay shim only through trusted repository scripts, runs custom `state/<id>.check.sh` files only from hash-validated registered snapshots, and rejects every other state check without execution.
 A `state/<id>.status` line is a wake event, not current-state truth; `bin/fm-crew-state.sh` owns current-state reconciliation.
-Treat `data/captain.md` as the domain-local record of captain preferences, optional `data/captain-shared.md` as the main-authoritative shared captain-preference file for secondmate inheritance, and `data/learnings.md` as curated home-local knowledge, regardless of harness memory.
+Treat `data/captain.md` as the domain-local record of captain preferences, optional `data/captain-shared.md` as the main-authoritative shared captain-preference file for secondmate inheritance and read-only in secondmate homes, and `data/learnings.md` as curated home-local knowledge, regardless of harness memory.
 
 ## 3. Session start (run once at every session start)
 
diff --git a/docs/configuration.md b/docs/configuration.md
index cf85522..3958b2f 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -10,8 +10,8 @@ The shared orchestrator behavior lives in [`AGENTS.md`](../AGENTS.md) - edit it
 
 This section is the single owner of the top-level operational-home layout; producer script headers and their help own exact child-file fields and mutation contracts.
 The tracked code root contains the shared instruction, skill, documentation, workflow, and `bin/` surfaces, while each effective `FM_HOME` contains private operational directories.
-`data/` holds durable private fleet records such as the project and secondmate registries, captain preferences, optional shared captain preferences, learnings, backlog, briefs, and scout reports.
-`state/` holds runtime records such as task metadata, append-only status events, endpoint signals, watcher and wake-queue coordination, inactive terminal-outcome receipts under `state/terminal-outcomes/`, away-mode state, generated Relay artifacts, private secondmate config-reread generations with their retry and quarantine state, and parent-owned secondmate pending-reply records under `state/pending-replies/` (`bin/fm-pending-reply-lib.sh`).
+`data/` holds durable private fleet records such as the project and secondmate registries, captain preferences, optional shared captain preferences, learnings, backlog, briefs, scout reports, and durable per-task dispatch restrictions under `data/dispatch-restrictions/` (`bin/fm-dispatch-restrict.sh`).
+`state/` holds runtime records such as task metadata, append-only status events, endpoint signals, watcher and wake-queue coordination, validated PR-merge poll bindings and custom-check trust records (`bin/fm-pr-check.sh`, `bin/fm-check-register.sh`, and `bin/fm-watch.sh`), inactive terminal-outcome receipts under `state/terminal-outcomes/`, away-mode state, generated Relay artifacts, private secondmate config-reread generations with their retry and quarantine state, and parent-owned secondmate pending-reply records under `state/pending-replies/` (`bin/fm-pending-reply-lib.sh`).
 `config/` holds local gitignored operating choices, and `projects/` holds the local project clones that Firstmate reads but changes only through the narrow guarded and concrete captain-approved exceptions in `AGENTS.md`.
 
 `bin/fm-spawn.sh` owns the base task-metadata fields it emits, while the runtime-backend section below owns backend-specific fields and selector interpretation.
- Outcome: 🔧 1 issue found → auto-fixed ✅ across 2 runs (10m58s)

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/.&lt;id&gt;.open-decisions-cursor is "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-lock are "owned by fm-classify-lib.sh, with each task's row retired by teardown"; (5) state/&lt;id&gt;.herdr-presentation is "never task or endpoint authority"; (6) state/procevent-inbox/ source output lives there and "never in an event line"; (7) data/dispatch-restrictions/&lt;id&gt; 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 says state/&lt;id&gt;.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 shim state/x-watch.check.sh through bin/fm-x-poll.sh, and the static PR merge poll set up by bin/fm-pr-check.sh through fm-pr-poll.sh --validated. Neither goes through fm-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 run fm-check-register.sh on 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 custom state/&lt;id&gt;.check.sh files only from hash-validated registered snapshots, and rejects every other state check without execution."
  • ℹ️ AGENTS.md:58 - Line 58 points to docs/architecture.md and docs/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 fit state/.subsuper-* / .supervise-daemon.*, whose procedure section 8's away-mode stub gives to the /afk skill. 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 /afk for 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 "public skills/ ... is not loaded by firstmate" also repeats line 450, and line 41 already lists public skills/. 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 the skills/ 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=264
  • bin/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, using fm_startup_memory_estimated_tokens_for_bytes from bin/fm-startup-memory-budget-lib.sh
  • Inline-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 owner
  • ls -l CLAUDE.md .claude/skills confirms both symlinks exist on disk
  • git diff 4a2fc09 69b68c3 -- docs/configuration.md confirms 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..30f402c reviewed; the before/after diff is saved as evidence
  • python3 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, public skills/ not loaded, captain-shared.md read-only, dispatch-restriction lifecycle, status wake-event rule, single layout owner) all match in AGENTS.md at the target commit
  • Character counts via git show &lt;rev&gt;:AGENTS.md and git show &lt;rev&gt;: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/skills
  • Scanned 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 doc
  • Owner checks: configuration.md has the headings the intent names, and its layout section now cites data/dispatch-restrictions/, fm-dispatch-restrict.sh, fm-pr-check.sh, fm-check-register.sh and fm-watch.sh; docs/herdr-backend.md:92,116 owns the presentation-journal authority rule; docs/scripts.md:4 owns 'read the header before first use'; bin/fm-supervision-instructions.sh:133 renders 'source x-mode.env first'; .agents/skills/updatefirstmate/SKILL.md:16 and CONTRIBUTING.md cover skills/ loading
  • Repo-wide grep for 'section 2' and for distinctive wording from the removed block: nothing depends on it
  • bash tests/fm-documentation-audiences.test.sh: all 4 checks ok, exit 0
  • git status --porcelain: worktree clean, no transient files
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…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.
@Hozzy02
Hozzy02 merged commit d033765 into main Sep 13, 2026
24 of 25 checks passed
@Hozzy02
Hozzy02 deleted the fm/fm-agents-layout-slim branch September 26, 2026 00:41
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