Skip to content

feat(bin): add checkpoint-commit discipline to briefs and an opt-in evidence write-through - #2

Merged
mattadams-dev merged 22 commits into
mainfrom
fm/fm-brief-checkpoint-discipline
Jul 31, 2026
Merged

mattadams-dev merged 22 commits into
mainfrom
fm/fm-brief-checkpoint-discipline

Conversation

@mattadams-dev

Copy link
Copy Markdown
Owner

Intent

Put checkpoint-commit discipline into firstmate's brief scaffold (bin/fm-brief.sh), and route scout evidence through an opt-in write-through to a separate private evidence repository.

Background the diff will not show. The scaffold's generated definition of done said a task is complete only when committed, which reads as 'commit at the end'. That is fine for accumulating code and wrong for anything expensive to reproduce, where the moment of maximum value is the moment of maximum exposure. The motivating near-miss: roughly two hours of measurement compute sat as untracked files while its harness was already committed, and other workers exited with many uncommitted files. So the generated contract now says: preserve expensive-to-reproduce evidence the moment it exists, ahead of any analysis drawn from it; never exceed about 15 minutes of changed files without a checkpoint commit; and the distinction that matters is cost to reproduce, not task size, because 'commit often' alone does not carry that.

Deliberate decisions a reviewer should not re-litigate:

  • The destination sentence differs by task kind on purpose. A ship task's branch outlives the task; a scout's worktree and every commit in it are discarded at cleanup, so telling a scout to 'commit' raw evidence would lose exactly the irreplaceable output the contract protects. The scout is routed to its report directory instead, and the scout write boundary was widened to permit that write.
  • The write-through is an opt-in LOCAL config key (config/evidence-repo) and never scaffold text. bin/fm-brief.sh ships to every firstmate user while the evidence repository is one captain's private repo, so no repository may ever be named in shared tracked material or a generated brief. A home without the key behaves exactly as before.
  • Firstmate pushes as custodian at teardown; scouts never push, so the scout contract 'never push to any remote' is unchanged.
  • The local commit is the custody guarantee and the push is best-effort, and teardown gates on the commit and NOT on the push. This asymmetry is required, not an oversight: gating cleanup on a push would make preserving evidence and reclaiming a worktree block each other. Please do not suggest collapsing it into one success path.
  • No redaction pass, because the destination is private. The push therefore verifies visibility first and refuses to publish into a repository that is not private, which is where that precondition fails loudly if it ever stops holding.
  • Layout is ///, keyed on FM_HOME rather than reusing fm-backend-hometag-lib.sh, because that library hashes FM_ROOT and several homes can share one code root. Derivable from the task alone, with no registry by decision.
  • Size policy is a named constant: artifacts at or below 64 MiB commit whole, anything larger is recorded by size and SHA-256 only so corpus-scale material is described rather than committed.

Explicitly out of scope: a separate queued item fixes the inconsistent placement of [key=...] in this same file's keyed-decision examples. Those lines were left exactly as they are so the two changes do not collide.

Existing scaffold safety contracts were preserved without reflowing: the worktree-isolation assertion, the Herdr lifecycle declaration, the status protocol, and the delivery-mode definitions of done.

What Changed

  • bin/fm-brief.sh now renders one shared # Commit discipline section into both the ship and scout scaffolds: preserve expensive-to-reproduce evidence the moment it exists and ahead of any analysis drawn from it, never exceed about 15 minutes of changed files without a checkpoint commit, and judge by cost to reproduce rather than task size. Only the destination sentence varies, since a ship task commits to its surviving branch while a scout's worktree is discarded at cleanup, so a scout copies raw evidence into its report directory instead; scout rule 2 was widened to permit exactly the files the scout puts there itself, leaving brief.md intact for respawn.
  • New bin/fm-evidence.sh provides an opt-in custodian write-through: absent the local, gitignored config/evidence-repo it is a silent no-op, and when set it copies data/<task-id>/ into <evidence-repo>/<home-tag>/<task-id>/, committing artifacts at or below 64 MiB whole (overridable via config/evidence-max-direct-bytes) and recording anything larger, plus symlinks, in EVIDENCE-MANIFEST.txt by size and SHA-256. The best-effort push is skipped unless every URL the push would reach is a github.com host (including the github.1485827954.workers.dev-<alias> form) and resolves to a private repository, since artifacts are copied unredacted.
  • bin/fm-teardown.sh invokes that custodian before destructive cleanup for non-secondmate homes, refusing cleanup when the local commit fails and warning instead under --force; the gate is on the commit and never on the push, so an unreachable remote cannot block reclaiming a worktree. AGENTS.md, docs/configuration.md, and docs/scripts.md document the two new config keys and the scout-written evidence beside its report, with new coverage in tests/fm-brief.test.sh, tests/fm-evidence.test.sh, and tests/fm-teardown-evidence.test.sh.

Risk Assessment

✅ Low: Every substantive finding from the previous two rounds is now closed with behavioral tests that exercise the executable, the feature remains opt-in and off by default, and the only item left is a locale nit in a verification helper whose failure direction is already safe.

Testing

I ran the three targeted suites (fm-brief, fm-evidence, fm-teardown-evidence) with no failures and confirmed they are picked up by CI lanes rather than only locally, then produced product-level evidence for the intent itself: real briefs generated by bin/fm-brief.sh showing the ship-versus-scout destination sentences and the widened scout write boundary alongside the untouched isolation, Herdr, status and done contracts; a real bin/fm-evidence.sh run showing the silent opted-out no-op, the committed layout, the 65 MiB manifest-only record with a matching SHA-256, the unfollowed symlink, per-home separation of a shared task id, and refusals to push into a genuinely public GitHub repo and an unverifiable host with the real gh-axi; and bin/fm-teardown.sh transcripts showing cleanup refused with the worktree kept when evidence could not be preserved, cleanup proceeding over committed evidence with an unreachable remote, an opted-out home unchanged, and --force warning instead of blocking. No UI surface is involved, so the evidence is CLI transcripts and generated brief markdown rather than screenshots. All scratch fixtures were removed and the worktree is clean.

Evidence: Generated ship brief (checkpoint discipline, evidence to the surviving branch)
You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
{TASK}

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of demo-proj, at a detached HEAD on a clean default branch.

**Verify isolation before anything else.** Run `pwd -P` and `git rev-parse --show-toplevel`; both must resolve to the disposable task worktree you were launched in, such as a treehouse pool path or an Orca-managed worktree, not the primary checkout firstmate operates from.
The path check is authoritative: `git rev-parse --git-dir` and `git rev-parse --git-common-dir` can help inspect the repo, but they do not prove you are outside the primary checkout.
If the top-level path is the primary checkout or not the worktree you were launched in, STOP - do not branch or commit here - append `blocked: launched in primary checkout, not an isolated worktree` to the status file and stop.

1. First action: create your branch: `git checkout -b fm/measure-latency`

# Rules
1. Never push to the default branch (push only your `fm/measure-latency` branch). Never merge a PR.
2. Stay inside this worktree; modify nothing outside it.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> '/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/home/state/measure-latency.status'`
   States: working, needs-decision, blocked, paused, done, failed.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on (setup done, bug reproduced, fix implemented, validation passed) and the
   needs-decision/blocked/paused/done/failed states. No step-by-step FYI progress lines;
   firstmate reads your pane for that.
   A mid-task `working:` line (including setup complete) is nonterminal: do not end the
   turn after it; continue the same stage until a defined `done:` gate under Definition of done.
   Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset,
   a scheduled window): firstmate then leaves your idle pane alone and rechecks it on a long
   cadence instead of treating it as a possible wedge. Use `blocked:` when you are stuck and need help.
5. If you hit the same obstacle twice, append `blocked: {why}` and stop; firstmate will help.
6. If a decision belongs above the implementation worker (product choices, destructive actions, ask-user findings),
   append `needs-decision: {summary of options}` and stop. Firstmate will apply the configured authority and reply with the decision.
   When firstmate replies or a blocker clears and you resume, append `resolved: {how it was decided or unblocked}` (add the same `[key=<slug>]` if you opened it with one) so the decision or blocker is durably closed and does not keep resurfacing.
7. Never stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting it kills other lanes' in-flight pipeline runs. On ANY no-mistakes
   daemon error, append `blocked: {the daemon error}` and stop; only firstmate manages the daemon.

# Commit discipline
Preserve value the moment it appears, not only at completion.
Anything expensive to reproduce - a long measurement, a captured fixture, probe output, hours of compute - is raw evidence: preserve it the moment it exists, in a place that outlives this task, before any analysis or polishing drawn from it.
Your task branch is that place, so give raw evidence its own commit ahead of any analysis drawn from it.
Never go more than about 15 minutes of changed files without a checkpoint commit; a `wip` commit is fine, and you can amend or squash it later.
The distinction that matters is cost to reproduce, not task size: a 30-second script fed by two hours of compute is expensive, while a 400-line refactor is not.
The reason is handoff, not just crashes: loose output survives a crash but dies at handoff, because a successor will not trust material it does not remember producing, while a preserved artifact carries provenance.
The one exception is an active automated validation run: while a pipeline owns your branch, follow Definition of done and do not commit into the run.

# Project memory
If `AGENTS.md` or `CLAUDE.md` already exists, or if this task produced durable project-intrinsic knowledge, run `/home/jamada/.no-mistakes/worktrees/c5e834eacdf2/01KYWN2FCE47WZ4RX4Y3B8A8NS/bin/fm-ensure-agents-md.sh .` in the worktree.
Record only project knowledge useful to almost every future session.
For anything the codebase already shows, prefer a pointer to the authoritative file, command, or doc over copying the detail.
If you touch a project `AGENTS.md` that lacks `## Maintaining this file`, add that short self-governance section from `/home/jamada/.no-mistakes/worktrees/c5e834eacdf2/01KYWN2FCE47WZ4RX4Y3B8A8NS/bin/fm-ensure-agents-md.sh` in the same pass.
Keep it proportionate: skip `AGENTS.md` edits for trivial tasks that produced no durable project knowledge.

# Definition of done
This project ships **direct-PR**: you raise the PR yourself, without the no-mistakes pipeline.
The task is complete only when committed on your branch.
When it is implemented and committed, push your branch and open a PR with `gh-axi`, then append `done: PR {url}` to the status file and stop.
Do NOT run /no-mistakes. The configured merge authority decides whether to merge the PR; firstmate relays the outcome.
Evidence: Generated scout brief (evidence to the report directory, widened write boundary)
You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
{TASK}

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of demo-proj, at a detached HEAD on a clean default branch.
This is a SCOUT task: the deliverable is a written report, not a PR.
The worktree is your laboratory - install, run, edit, and make scratch commits freely; all of it is discarded at teardown.
The report is the only thing that survives, so anything worth keeping must be in it.

# Rules
1. Never push to any remote and never open a PR.
2. Stay inside this worktree; the only files you may write outside it are the status file below and the contents of your report directory `/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/home/data/probe-cache/`, which holds the report and any raw evidence you preserve.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> '/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/home/state/probe-cache.status'`
   States: working, needs-decision, blocked, paused, done, failed.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on and the needs-decision/blocked/paused/done/failed states. No step-by-step
   FYI progress lines; firstmate reads your pane for that.
   Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset):
   firstmate then leaves your idle pane alone and rechecks it on a long cadence instead of
   treating it as a possible wedge. Use `blocked:` when you are stuck and need help.
5. If you hit the same obstacle twice, append `blocked: {why}` and stop; firstmate will help.
6. If a decision belongs to a human (product choices, destructive actions),
   append `needs-decision: {summary of options}` and stop. Firstmate will reply with the decision.
   When firstmate replies or a blocker clears and you resume, append `resolved: {how it was decided or unblocked}` (add the same `[key=<slug>]` if you opened it with one) so the decision or blocker is durably closed and does not keep resurfacing.
7. Never stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting it kills other lanes' in-flight pipeline runs. On ANY no-mistakes
   daemon error, append `blocked: {the daemon error}` and stop; only firstmate manages the daemon.

# Commit discipline
Preserve value the moment it appears, not only at completion.
Anything expensive to reproduce - a long measurement, a captured fixture, probe output, hours of compute - is raw evidence: preserve it the moment it exists, in a place that outlives this task, before any analysis or polishing drawn from it.
Your worktree is not that place, because it and every commit in it are discarded at cleanup, so copy raw evidence into `/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/home/data/probe-cache/` and have the report cite it by name.
Never go more than about 15 minutes of changed files without a checkpoint commit; a `wip` commit is fine, and you can amend or squash it later.
The distinction that matters is cost to reproduce, not task size: a 30-second script fed by two hours of compute is expensive, while a 400-line refactor is not.
The reason is handoff, not just crashes: loose output survives a crash but dies at handoff, because a successor will not trust material it does not remember producing, while a preserved artifact carries provenance.
The one exception is an active automated validation run: while a pipeline owns your branch, follow Definition of done and do not commit into the run.

# Definition of done
Write your findings to `/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/home/data/probe-cache/report.md`.
The report must stand alone: what you did, what you found, the evidence (commands run, output, file:line references), and what you recommend.
Before reporting done, read and follow `/home/jamada/.no-mistakes/worktrees/c5e834eacdf2/01KYWN2FCE47WZ4RX4Y3B8A8NS/.agents/skills/decision-hold-lifecycle/SKILL.md` and pass its shared completion gate for the report and any visual review.
When the report is complete, append `done: {one-line conclusion}` to the status file and stop.
If your findings reveal work that should ship (e.g. you reproduced a bug and the fix is clear), say so in the report; firstmate may promote this task in place, and you would then receive mode-specific ship instructions as a follow-up message.
Evidence: Evidence write-through CLI transcript (opt-in, layout, size boundary, privacy precondition)

$ # a home that never opted in: config/evidence-repo absent

$ FM_HOME=plain-home fm-evidence.sh preserve measure-latency
(no output) exit=0

$ # the captain opts in: config/evidence-repo -> /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence

$ FM_HOME=captain-home fm-evidence.sh path measure-latency
/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence/firstmate-f5257a21/measure-latency

$ FM_HOME=captain-home fm-evidence.sh preserve measure-latency
fm-evidence: committed 4 artifact(s) for measure-latency in /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence
fm-evidence: evidence for measure-latency is committed locally; skipped the push because the destination's visibility could not be verified
exit=0

$ git -C fleet-evidence log --stat --oneline
17728c1 evidence(firstmate-f5257a21/measure-latency): preserve 4 artifact(s)
 firstmate-f5257a21/measure-latency/EVIDENCE-MANIFEST.txt   | 10 ++++++++++
 firstmate-f5257a21/measure-latency/raw/latency-samples.csv |  3 +++
 firstmate-f5257a21/measure-latency/report.md               |  2 ++
 3 files changed, 15 insertions(+)

$ cat firstmate-*/measure-latency/EVIDENCE-MANIFEST.txt
# firstmate evidence manifest
# task: measure-latency
# home: firstmate-f5257a21
# direct-commit limit: 67108864 bytes
# columns: disposition sha256 bytes path
# a symlink row carries "-" for sha256 and bytes and records "path -> target"
symlink - - raw/corpus-dir -> /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/big-corpus
manifest-only fae4d1657665a93e9cae5db5ac3db26e045383f8d19d4a892c867bdccc7843d7 68157440 raw/corpus.bin
committed c9164d2c347b7f529fb937c03941683cd44a03cee7b379a5d776ab037c219b90 19 raw/latency-samples.csv
committed 1c8864f2a0b1f7b39cb72090863544041252138d9310be843de5fe6c7bf98d8e 28 report.md

$ # the 65 MiB artifact is described, not committed - manifest hash matches the source
fae4d1657665a93e9cae5db5ac3db26e045383f8d19d4a892c867bdccc7843d7  /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/captain-home/data/measure-latency/raw/corpus.bin

$ # push precondition: point the destination at a real PUBLIC github repo (real gh-axi)
fm-evidence: committed 5 artifact(s) for measure-latency in /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence
fm-evidence: REFUSED to push evidence for measure-latency: a push destination of /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence is public, and unredacted evidence may only be published to a private repository
exit=0

$ git -C fleet-evidence branch -r   # nothing was published

$ # push precondition: a destination whose visibility cannot be established at all
fm-evidence: committed 6 artifact(s) for measure-latency in /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence
fm-evidence: the destination pushes to gitlab.com, whose visibility this cannot establish
fm-evidence: evidence for measure-latency is committed locally; skipped the push because the destination's visibility could not be verified
exit=0

$ # two homes, one task id: the layout keys on the home
/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence/firstmate-f5257a21/measure-latency
/tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/writethrough/fleet-evidence/firstmate-6a5908ad/measure-latency

$ git -C fleet-evidence ls-files
firstmate-6a5908ad/measure-latency/EVIDENCE-MANIFEST.txt
firstmate-6a5908ad/measure-latency/report.md
firstmate-f5257a21/measure-latency/EVIDENCE-MANIFEST.txt
firstmate-f5257a21/measure-latency/raw/latency-samples.csv
firstmate-f5257a21/measure-latency/raw/notes.txt
firstmate-f5257a21/measure-latency/raw/notes2.txt
firstmate-f5257a21/measure-latency/report.md
Evidence: Teardown custody gate CLI transcript (refuse, proceed offline, opted out, --force)
# A scout task holding two hours of measurement in data/probe-cache/, evidence destination broken.
$ fm-teardown.sh probe-cache
fm-evidence: config/evidence-repo names no directory: /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/teardown/no-such-destination
REFUSED: could not preserve task probe-cache's evidence before cleanup.
Cleanup destroys the worktree, so fix the evidence destination or clear config/evidence-repo first.
exit=1
worktree kept: yes; task state kept: probe-cache.meta probe-cache.status 

# Same task, working destination, unreachable remote: the commit is custody, the push is best-effort.
$ fm-teardown.sh probe-cache
fm-evidence: committed 2 artifact(s) for probe-cache in /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/teardown/offline/evidence
fm-evidence: the destination pushes to github.invalid, whose visibility this cannot establish
fm-evidence: evidence for probe-cache is committed locally; skipped the push because the destination's visibility could not be verified
teardown probe-cache complete (window firstmate:fm-probe-cache, worktree /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/teardown/offline/worktree)
Backlog: probe-cache just finished. Run tasks-axi done probe-cache --report data/probe-cache/report.md, then run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
exit=0
task metadata cleared: yes
$ git -C evidence log --stat --oneline
da1ded9 evidence(firstmate-65113691/probe-cache): preserve 2 artifact(s)
 firstmate-65113691/probe-cache/EVIDENCE-MANIFEST.txt | 8 ++++++++
 firstmate-65113691/probe-cache/raw-measurement.txt   | 3 +++
 firstmate-65113691/probe-cache/report.md             | 2 ++
 3 files changed, 13 insertions(+)

# A home that never opted in: teardown behaves exactly as before, with no mention of evidence.
$ fm-teardown.sh probe-cache
teardown probe-cache complete (window firstmate:fm-probe-cache, worktree /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/teardown/optout/worktree)
Backlog: probe-cache just finished. Run tasks-axi done probe-cache --report data/probe-cache/report.md, then run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
exit=0

# --force is the approved discard path: it warns instead of refusing.
$ fm-teardown.sh probe-cache --force
fm-evidence: config/evidence-repo names no directory: /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/teardown/no-such-destination
WARNING: could not preserve task probe-cache's evidence; continuing because --force authorizes discard.
teardown probe-cache complete (window firstmate:fm-probe-cache, worktree /tmp/no-mistakes-evidence/01KYWN2FCE47WZ4RX4Y3B8A8NS/workspace/teardown/forced/worktree)
Backlog: probe-cache just finished. Run tasks-axi done probe-cache --report data/probe-cache/report.md, then run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
exit=0
Evidence: Rendered commit-discipline sections from both generated briefs
--- SHIP BRIEF ---
# Commit discipline
Preserve value the moment it appears, not only at completion.
Anything expensive to reproduce - a long measurement, a captured fixture, probe output, hours of compute - is raw evidence: preserve it the moment it exists, in a place that outlives this task, before any analysis or polishing drawn from it.
Your task branch is that place, so give raw evidence its own commit ahead of any analysis drawn from it.
Never go more than about 15 minutes of changed files without a checkpoint commit; a `wip` commit is fine, and you can amend or squash it later.
The distinction that matters is cost to reproduce, not task size: a 30-second script fed by two hours of compute is expensive, while a 400-line refactor is not.

--- SCOUT BRIEF ---
2. Stay inside this worktree; the only files you may write outside it are the status file below and the contents of your report directory `<data>/probe-cache/`, which holds the report and any raw evidence you preserve.
# Commit discipline
...
Your worktree is not that place, because it and every commit in it are discarded at cleanup, so copy raw evidence into `<data>/probe-cache/` and have the report cite it by name.
Evidence: Evidence manifest from a real preserve run (64 MiB default limit)
# firstmate evidence manifest
# task: measure-latency
# home: firstmate-15b8634b
# direct-commit limit: 67108864 bytes
# columns: disposition sha256 bytes path
# a symlink row carries "-" for sha256 and bytes and records "path -> target"
symlink - - raw/corpus-dir -> .../big-corpus
manifest-only 03632dae0429ef6263643485a49281343181e0b6874d1d65c53cf55b029e10a0 68157440 raw/corpus.bin
committed c9164d2c347b7f529fb937c03941683cd44a03cee7b379a5d776ab037c219b90 19 raw/latency-samples.csv
committed 1c8864f2a0b1f7b39cb72090863544041252138d9310be843de5fe6c7bf98d8e 28 report.md

$ sha256sum .../raw/corpus.bin
03632dae0429ef6263643485a49281343181e0b6874d1d65c53cf55b029e10a0 (matches the manifest record)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped
  • ⚠️ tests/fm-secondmate-harness.test.sh - merge conflict rebasing onto origin/main
⚠️ **Review** - 1 info
  • ⚠️ bin/fm-evidence.sh:234 - The private-visibility precondition - the only guard protecting unredacted evidence - can validate a different repository than the one being pushed to. remote_owner_name() (line 206) reduces any remote URL to its last two path segments with no host check, and remote_visibility() looks that slug up on github.com. Concrete path: config/evidence-repo points at a clone whose origin is git@gitlab.company.com:acme/evidence.git (or a GHE host, or a nested group like https://gitlab.com/group/sub/evidence.git, which yields sub/evidence). The slug acme/evidence is queried against github.com - I verified gh-axi repo view --repo &lt;slug&gt; resolves arbitrary slugs. If any private github.com repo with that slug is visible to the captain, remote_visibility returns "private" and line 353 pushes unredacted evidence to the actual non-GitHub remote whose visibility was never established. The header comment claims a deeper host path "simply yields a slug the GitHub lookup will not resolve", which only covers depth, not a same-depth non-GitHub host. Fix: require the remote host to be github.com (accepting the github.1485827954.workers.dev-&lt;alias&gt; form the header deliberately preserves) and return non-zero otherwise, so the push is skipped rather than authorized by an unrelated repository.
  • ⚠️ bin/fm-evidence.sh:330 - git add -- &#34;$dest&#34; on a directory pathspec silently skips files matched by the destination repo's .gitignore or a global core.excludesFile, so custody is falsely claimed. Concrete path: an evidence clone created from a template whose .gitignore contains *.log (or tmp/, *.bin, data/) receives a task whose artifacts include probe.log. The manifest at EVIDENCE-MANIFEST.txt is still added and changed, so git diff --cached --quiet at line 333 is false, the commit at line 335 succeeds, and line 336 prints "committed N artifact(s)" - while probe.log was never tracked. Teardown then destroys the worktree on the strength of that success. Use git add --force -- &#34;$dest&#34; so the custody claim matches what was actually committed.
  • ⚠️ bin/fm-evidence.sh:275 - cp -p preserves the source mode into the destination, so a read-only artifact breaks the repeat-preserve path that tests/fm-evidence.test.sh:test_repeat_preserve_is_idempotent pins. Concrete sequence: a task's data/<id>/ contains a captured fixture at mode 444 (extracted from an archive, or chmod'ed to protect it). First preserve copies it and the destination file is also 444. Teardown is re-run (the header notes teardown runs this repeatedly across a fleet); cp cannot open the existing 444 destination for writing and fails with Permission denied, set -e aborts copy_artifacts, and line 328 reports CUSTODY_FAILED. bin/fm-teardown.sh:1228 then REFUSES cleanup, and the operator's only escape is --force. Use cp -pf (or unlink the destination first) so an unchanged re-copy cannot fail.
  • ⚠️ bin/fm-evidence.sh:335 - Nothing serializes the git index operations, yet the header explicitly designs for concurrent multi-home use of one destination ("concurrent tasks in different homes - two secondmates ... never collide"). The layout prevents path collision but not index contention. Concrete path: a captain points two secondmate homes at the same evidence clone; two teardowns overlap while one is staging a large tree, and the second's git add (line 330) or git commit (line 335) fails with "Unable to create '.git/index.lock': File exists". That is CUSTODY_FAILED, so bin/fm-teardown.sh:1228 refuses cleanup even though the evidence is perfectly preservable. It fails safe (no data loss), but it produces a spurious hard refusal that only a manual re-run clears. Guard the add/commit pair with a mutex or retry on index.lock contention.
  • ℹ️ bin/fm-evidence.sh:43 - The header - which usage() prints verbatim as --help output - says "an artifact at or below FM_EVIDENCE_MAX_DIRECT_BYTES is committed whole", but no such variable is read anywhere. The constant is FM_EVIDENCE_MAX_DIRECT_BYTES_DEFAULT (line 92) and the only operator control is config/evidence-max-direct-bytes. An operator following the help text would export FM_EVIDENCE_MAX_DIRECT_BYTES, see no effect, and get no diagnostic. Name the config key in the SIZE POLICY paragraph instead, as docs/configuration.md already does correctly.
  • ℹ️ bin/fm-evidence.sh:236 - remote_visibility() pipes the already-captured $view through the identical awk -F: &#39;/visibility:/ ...&#39; program twice - once at line 236 only to test emptiness via grep -q, then again at line 239 to emit it. Parse once into a local, then test and print that value; it removes the risk of the two copies drifting apart.
  • ℹ️ bin/fm-evidence.sh:283 - find &#34;$source&#34; -type f matches neither symlinks nor their targets, so a symlinked artifact in data/<id>/ (a common way to reference a large corpus without duplicating it) is absent from the copy AND from EVIDENCE-MANIFEST.txt. That contradicts the header's stated guarantee that "Every artifact is listed in the manifest either way": the omission is completely silent, so nothing signals that the evidence record is incomplete. Either follow symlinks (find -L) or record -type l entries in the manifest with an explicit disposition.

🔧 Fix: bind evidence push to a verified github destination
2 issues (1 warning, 1 info) still open:

  • ⚠️ bin/fm-evidence.sh:216 - The newly bound visibility precondition still validates only one of the destinations a push can reach. git remote get-url --push &#34;$remote&#34; documents "By default, only the first URL is listed", while git-config documents remote.<name>.pushurl as "A configured remote can have multiple push URLs; in this case a push goes to all of them" - I confirmed both in the local man pages. So remote_push_url returns URL test: gate real-Herdr tests on a provisionable lab and assert resolver contracts, not host identity #1, remote_host/evidence_host_is_github/remote_owner_name all describe URL test: gate real-Herdr tests on a provisionable lab and assert resolver contracts, not host identity #1, and the actual git push --quiet &#34;$(evidence_remote &#34;$repo&#34;)&#34; HEAD publishes to every configured pushurl. Concrete path: the captain mirrors the evidence clone with git remote set-url --add --push origin ssh://git@github.com/owner/evidence.git and git remote set-url --add --push origin ssh://git@gitlab.company.example/acme/evidence.git. The check reads the github.com URL, gh-axi confirms private, and unredacted evidence is published to gitlab.company.example whose visibility was never established - the exact failure the round-1 fix set out to close, through a different door. Fix: read git remote get-url --push --all &#34;$remote&#34; and require EVERY returned URL to pass both evidence_host_is_github and the gh-axi private lookup; any URL that fails skips the push, keeping the commit-is-custody contract intact. Worth a test alongside test_non_github_remote_skips_the_push that adds a second, non-GitHub pushurl and asserts the push is skipped.
  • ℹ️ bin/fm-evidence.sh:318 - unstaged_artifacts() builds one newline-joined staged string and then runs a case &#34;$nl$staged$nl&#34; in *&#34;$nl$rel$nl&#34;* substring scan once per artifact, which is O(artifacts x index-listing-length) inside the teardown path. The size policy deliberately keeps small files on the committed side, so a frame dump or fixture set of several thousand small artifacts is exactly the case that lands here, and that is millions of shell pattern comparisons on every preserve. Both halves are already sorted (find ... | LC_ALL=C sort and git's index order), so comm -23 over the two sorted lists is linear and removes the hand-rolled membership test entirely. Note also that the || return 1 on line 321 guards the pipeline's exit status, which is tr's and not git's - a git failure yields an empty staged, which reports every artifact as unstaged; that still fails toward custody failure, but the diagnostic then names every file instead of the real cause.

🔧 Fix: verify every push destination is private
1 info still open:

  • ℹ️ bin/fm-evidence.sh:340 - Both inputs to comm -23 are produced with LC_ALL=C sort (lines 341-342) but comm itself runs under the ambient locale, so its own comparison can disagree with the order its inputs were built in. Under a full locale such as en_US.UTF-8 - common on a macOS captain's shell, though this container runs C.UTF-8 where the two happen to agree - glibc ignores -, _, . and space at the primary collation level and folds case, so a dest containing EVIDENCE-MANIFEST.txt and evidence.log is correctly C-sorted (E = 0x45 before e = 0x65) yet reads as descending to comm (evidencelog before evidencemanifesttxt). GNU comm's default order check is fatal once disorder is detected AND an unpairable line has been seen, so it exits 1 with "file 1 is not in sorted order"; unstaged_artifacts then returns non-zero and cmd_preserve reports cannot verify the staged evidence for &lt;id&gt;, refusing teardown for a task whose evidence was in fact fully committed. The unpairable line can come from a stale index entry - for example a path left in the index after a prior run's rm -f succeeded but its cp failed. The direction is safe: comm only consumes a file-1 line without emitting it on exact string equality, so no genuinely unstaged artifact can be silently skipped, and the all-staged happy path compares two identical lists and is unaffected. Fix is one word: LC_ALL=C comm -23 ... so the comparison matches the sort. Separately, the helper's comment claims a skip-worktree entry is caught, but such a path is present in ls-files --cached, so comm finds nothing while git add --force declines to update its content - the check detects "absent from the index", not "stale in the index", and the comment overstates it.
✅ **Test** - passed

✅ No issues found.

  • bin/fm-test-run.sh tests/fm-brief.test.sh tests/fm-evidence.test.sh tests/fm-teardown-evidence.test.sh (43 checks, 0 failures)
  • bin/fm-test-run.sh --check-coverage and --list --lane portable-parallel-1|portable-serial to confirm the new suites run in CI lanes
  • Manual: FM_HOME=&lt;scratch&gt; bin/fm-brief.sh measure-latency demo-proj and ... probe-cache demo-proj --scout, then read the rendered # Commit discipline section and scout rule 2 out of each brief.md
  • Manual: grep of both generated briefs for evidence-repo|fm-evidence|github.com/ (absent) and of the diff for added [key=...] lines (none) and any concrete repository name in AGENTS.md/docs/bin (none)
  • Manual: bin/fm-evidence.sh path measure-latency and bin/fm-evidence.sh preserve measure-latency against a real destination clone, with a 65 MiB artifact, a symlink, an opted-out home, and a second home reusing the same task id
  • Manual: push precondition against the real gh-axi with the destination remote set to a public github.com repo, then to a gitlab.com URL
  • Manual: bin/fm-teardown.sh probe-cache over a scout fixture for four cases (broken destination, unreachable remote, opted-out home, --force)
🔧 **Document** - 1 issue found → auto-fixed ✅
  • ℹ️ docs/scripts.md:7 - docs/scripts.md is not exhaustive and nothing enforces coverage: nine other bin scripts are already absent from the toolbelt table (fm-cd-pretool-check.sh, fm-doc-audience-check.sh, fm-herdr-session-cleanup.sh, fm-install-shellcheck.sh, fm-lint.sh, fm-push-transition-lib.sh, fm-startup-memory-budget.sh, fm-startup-memory-budget-lib.sh, fm-transition-lib.sh). That predates this change, so I only added the row this change made stale. A follow-up should either backfill the missing rows or make the inventory generated/drift-checked from bin/ so the table cannot silently rot.

🔧 Fix: narrow scout evidence write grant to self-created files
✅ Re-checked - no issues remain.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

kunchenguid and others added 22 commits July 30, 2026 09:49
)

* Add bounded startup memory curation

* no-mistakes(review): Record reproducible stow verification evidence

* no-mistakes(review): Validate inherited secondmate stow evidence

* no-mistakes(document): Document editable startup-memory budget propagation
* fix(herdr): place workers in the launching agent's exact workspace

Herdr enforces no workspace-label uniqueness, and spawn resolved its
container by taking the FIRST workspace whose label matched the home
label. With two workspaces both labeled "firstmate", a worker launched
from the second one was created in the first, so it appeared in a
different space than the Firstmate the captain was watching.

Reproduced end to end on Herdr 0.7.5 protocol 17 by running the real
bin/fm-spawn.sh inside a launcher pane in the second "firstmate"
workspace: the worker landed in w1 while its launcher was in w2, with an
unrelated third workspace focused throughout, which also rules out any
dependence on the focused workspace.

Placement now binds to the launching process's own Herdr identity. Herdr
injects HERDR_PANE_ID, HERDR_SESSION, and HERDR_SOCKET_PATH into every
process it manages a pane for, and fm_backend_herdr_launcher_identity
resolves that pane's current owning tab and workspace live from Herdr,
cross-checking the pane against its tab and confirming the workspace
exists exactly once in the session. The injected HERDR_TAB_ID and
HERDR_WORKSPACE_ID are creation-time snapshots and are deliberately not
read as current identity. Labels are no longer placement authority.

A claimed parent identity that is unreadable, contradictory, stale, or
from another named session or Herdr server stops the spawn before any
worker endpoint exists, rather than degrading to a label search. A
launcher with no Herdr ancestry has no workspace to inherit and keeps
the per-home labeled container, which must now resolve to exactly one
workspace; two same-labeled candidates refuse instead of adopting
either. A --secondmate launch keeps standing up that home's own
workspace by design.

With presentation spaces enabled, the projected child is created and
bound under that same exact parent and anchors its ordering on it, so a
duplicated home label no longer makes the layout ambiguous. Projection,
focus restoration, restart binding, and quarantine rules are unchanged,
and children are never collapsed into the parent. tmux, Zellij, cmux,
Orca, and the away-mode daemon terminal were each inspected and are not
affected: none resolves a container by searching mutable labels.

tests/fm-backend-herdr-launcher-workspace-e2e.test.sh drives the real
spawn and teardown against an isolated Herdr lab, with its headline case
running fm-spawn.sh inside a real Herdr pane so the identity comes from
Herdr's own injection. The refusal matrix and the ordering anchor are
covered deterministically in tests/fm-backend-herdr.test.sh.

Eight existing real-Herdr suites inherited the developer terminal's own
Herdr pane into their isolated lab sessions, which the new cross-session
check correctly refuses. tests/herdr-test-safety.sh now owns
herdr_forget_inherited_pane and those suites call it, so what they assert
no longer depends on where they were launched from.

Two unrelated fixes found along the way. tests/fm-secondmate-harness.test.sh
had the same class of environment leak through CLAUDECODE, which outranks
PI_CODING_AGENT in bin/fm-harness.sh and made its pi-signed ancestry case
resolve "claude" whenever the suite ran inside Claude Code. And
fm-spawn.sh's usage() printed a fixed line range that had already been
truncating its own help mid-sentence.

* no-mistakes(review): Enforce exact Herdr launcher and projection identity

* no-mistakes(document): Document exact Herdr launcher workspace placement
* feat(calm): replace Pi's working row with an animated ship while Calm is on

While Calm is active and one logical agent run is under way, Calm now hides
Pi's built-in working row and renders a small two-row SSHHIP-derived boat in
its place. When Calm is off, Pi's stock working row is left untouched.

The presentation uses only public Pi extension API: setWorkingVisible(false)
plus a temporary setWidget() component whose render(width) owns the responsive
geometry and whose timer requests a TUI render. Visibility follows agent_start
through agent_settled, so the boat does not flicker between tool calls,
automatic continuations, retries, or compaction inside the same run, and
settle, abort, and failure all reach the same cleanup.

fm-calm.ts stays the sole owner of the presentation choice and the only caller
of setWorkingVisible(); the new lib owns the sprite geometry and widget.

* no-mistakes(review): Guarded Calm-off lifecycle visibility writes; focused tests pass

* no-mistakes(test): Fixed Calm E2E wait to include tmux scrollback

* no-mistakes(document): Document Calm working boat behavior

* no-mistakes: apply CI fixes

* feat(calm): slow the Calm boat, animate blue water, and make the sail directional

The boat now moves one column every 880ms while a bounded fixed-cell water phase
advances every 220ms, so the water ripples several times between boat steps and
the presentation reads as calm. One scheduler drives both clocks and disposing
the widget stops them together; ticks rather than wall-clock timestamps drive
every state change, so tests seek animation time exactly.

Colors are standard ANSI foreground codes instead of theme lookups: blue for
every water cell and yellow for the complete boat, each run closed with a
default-foreground reset so nothing bleeds into padding or later frames. ANSI
bytes never enter geometry, so visible width stays exact.

The mainsail is directional and trails aft of the mast: <| travelling right and
|> travelling left. Direction reverses the moment the boat lands on an endpoint,
so the endpoint frame already shows the new heading and no frame at or after a
bounce shows the previous sail.

* test(calm): wait for the Ctrl+O expansion redraw this block asserts

* docs(calm): record the revised working-presentation verification evidence

* no-mistakes(document): Fix Calm feasibility document EOF whitespace
…henguid#1349)

* fix(dispatch): scope candidate authentication to its own surface

A locally expired timestamp in one credential store was reported to the
captain as a sign-out, including for dispatch candidates that never read
that store. A `harness=pi, model=xai/grok-*` candidate authenticates
through Pi's own xAI credential, but the only Grok quota reading
available was gated on the standalone Grok CLI's separate token, whose
expiry clock drifts independently. The always-loaded intake rule then
turned that unreadable quota into a mandatory captain escalation.

Add `bin/fm-auth-preflight.sh` as the deterministic owner of the parts
that must not depend on agent memory: it resolves a tuple's
authentication surface from quota-axi's own emitted auth sources rather
than from a harness or model name, so another harness's CLI can never
gate a candidate that does not use it. A vendor CLI is launched only
when the tuple's own harness owns the credential store under test and a
non-destructive discovery command is registered for it, which today is
`grok models` alone. That probe runs at most once with stdin closed and
a hard timeout, reads its verdict from the first stdout line because the
command exits 0 either way, treats unrecognized output as indeterminate,
and never invokes login, logout, or the interactive TUI. Quota is read
at most twice, and unknown headroom never makes a candidate ineligible
on its own.

Update the dispatch procedure to match: usable authentication with
unmeasurable headroom stays eligible at lower preference with the
unknown disclosed, and stop-and-report is reserved for unresolved
authentication, an unresolved relationship, or malformed configuration.
Record that Grok's `credits.remaining` is a prepaid balance rather than
window headroom.

Gate quota-axi at 0.1.16 in bootstrap, the first build reporting
per-credential auth sources. A stale install previously passed the
presence check silently, which is why a fix published two days earlier
was still not in effect.

Replace the orphaned quota-array-dispatch fixtures, which encoded a
`provider: "xai"` shape the tool never emits and had no consumer, with
fixtures shaped like real 0.1.16 output that the new suite drives the
script against. The suite asserts the verdict and, separately, which
vendor CLIs were launched, so a Pi/xAI candidate reaching the Grok CLI
fails. Map `tests/fixtures/<dir>` to its consuming suite so a fixture
change selects the right tests instead of refusing.

* refactor(bootstrap): give the quota-axi floor one owner

The floor was stated twice - once in bootstrap's gate and once inline in
the auth preflight - so bumping it needed two edits that could drift.
Move it to bin/fm-quota-axi-lib.sh alongside its rationale, matching the
existing tasks-axi library, and derive the comparison from the constant
so the number appears exactly once. Bootstrap turns a failing check into
the operator diagnostic; the preflight refuses to emit an unscoped
verdict. Map the new library to both consuming suites so a bump re-runs
them, and record that any usable source means the surface authenticates.

* no-mistakes(review): Captain: bound quota checks and removed Python dependency

* no-mistakes(review): Captain: enforce conservative headroom and exact preflight retry

* no-mistakes(review): Captain: preserve OpenCode eligibility without auth-surface guessing

* no-mistakes(review): Captain: reject malformed OpenCode model relationships

* no-mistakes(review): Captain: exempt verified unmodeled tuples from intake escalation

* no-mistakes(document): Updated dispatch authentication documentation

* no-mistakes: apply CI fixes
…nchenguid#1350)

* feat(x-mode): reconcile promised public replies deterministically

A promised final reply in an X or Discord thread was only kept while the
primary remembered it. Compaction or restart erased that memory, so a typed
public-followup obligation could sit at pending-work after its PR merged and
the original thread never got its reply.

Make the promise durable state instead:

- bin/fm-public-followup-emit.sh reports a typed terminal work result (source
  home, work id, generation, outcome, safe deliverables, bounded public-safe
  text) into the owning home's private inbox. The event id is derived from
  that identity tuple, so duplicate reports and restart replay converge with
  no coordination, and nothing ever parses a free-form done: sentence.
- bin/fm-public-followup.sh registers a commitment, reconciles events through
  tasks-axi public-followup, and runs the idempotent delivery sequence
  (begin-delivery with the payload hash, post, record the posted receipt or a
  typed error) against the stored platform and opaque thread binding. A
  delivery interrupted between post and receipt refuses rather than risk a
  second public reply.
- Session start surfaces unresolved commitments from disk, the existing relay
  poll surfaces a new terminal-result set once, and teardown refuses while
  this home still owes a public reply for that exact work.

tasks-axi public-followup remains the only owner of the obligation state
machine, state/x-context/ the only owner of the private request context, and
fm-x-reply.sh the only thing that posts. Its new optional --receipt-file is
the one addition there, so a caller can record how many messages were sent.

A home that never opted into the myfirstmate relay gates out on a single
[ -f "$FM_HOME/.env" ] test: no tasks-axi call, no backlog or context scan,
no output, and no artifact. Evidence in docs/verification/public-followup.md.

* no-mistakes(review): Hardened public-followup reconciliation and ownership guards

* no-mistakes(review): Hardened typed terminal cleanup and receipt reconciliation

* no-mistakes(review): Automated typed-delivery cleanup and strict backlog validation

* no-mistakes(review): Fail-closed parent resolution and registration-safe delivery

* no-mistakes(review): Harden relay gating and validate secondmate bindings

* no-mistakes(review): Use owner-aware single-gate teardown protection

* no-mistakes(document): Correct public-followup documentation drift

* no-mistakes(lint): Quote done literals to fix ShellCheck warnings

* no-mistakes: apply CI fixes
…chenguid#1327)

* feat: add semantic busy-state contract owner and event writer

One owner (bin/fm-busy-lib.sh) for the captain-approved semantic
busy-state redesign: a per-task gen-bound record written only by
bin/fm-busy-event.sh, per-harness trusted-source classification with
explicit source attribution, busy/idle/unknown/dead semantics where
missing, malformed, stale, or untrusted semantic data is unknown -
never idle - and endpoint death is the only process-level override.
The Grok-only rendered-tail fallback and the standalone-Kimi
verification gate live behind the same classifier.

* feat: arm busy-state at spawn and convert Pi to the semantic extension path

fm-spawn arms the busy-state contract for converted adapters and seeds
busy/fm-spawn (the launch brief is a submitted turn). The Pi/pi-signed
per-task extension now reports agent_start -> busy and agent_settled ->
idle confirmed by ctx.isIdle(), covering auto-retries, compaction
retries, tool loops, and queued continuations, while turn_end stays a
wake notification touch. Teardown removes the new record, gen sidecar,
and lock. Live-verified on Pi 0.82.0: seed -> agent-start busy ->
agent-settled idle with the marker still touched.

* feat: convert OpenCode to the semantic session.status plugin path

The per-task plugin (renamed .opencode/plugins/fm-busy-state.js) now
classifies from OpenCode's semantic session.status events - busy and
retry are active, idle is inactive - latched to the worker's own
session so a subagent child session can never clear the worker's busy
state. The session.idle marker touch stays a wake notification.
Teardown removes both the new and the legacy plugin filenames.
Live-verified on OpenCode 1.17.18 in a real TUI pane: seed ->
session-busy -> session-status-idle.

* feat: convert Claude to the full lifecycle hooks path

The per-task settings.local.json now wires UserPromptSubmit -> busy
and Stop, StopFailure, and SessionEnd -> idle, so API-error and
shutdown turn ends can never strand a busy record; Stop keeps the
turn-ended notification touch. A refused (stale-gen) event exits 0 and
stays silent so Claude's own lifecycle is never broken. Live-verified
on Claude Code 2.1.220: UserPromptSubmit fires for the argv launch
prompt, Stop closes each turn, a mid-stream Escape interrupt fires no
closing hook, and the firstmate-controlled idle/fm-interrupt clear
resolves it.

* feat: gate Codex busy state behind verified semantic sources

The approved contract prefers Codex's app-server turn lifecycle with
capability negotiation and sanctions its lifecycle hooks as the
intermediate. Live probes on codex-cli 0.145.0 show neither is usable
for a pane worker: the app-server daemon is unreachable for a TUI
thread and refuses to start outside the managed standalone install,
and firstmate-written project hooks never fired (interactive with
directory trust granted, and exec, both with
--dangerously-bypass-hook-trust) while global hooks fired in the same
runs. Codex therefore classifies unknown codex-unverified behind an
explicit probe rather than falling back to idle or footer text, and
fm-spawn installs no unverified Codex wiring.

* feat: gate standalone Kimi busy state on live verification

Standalone Kimi has no installed binary here, so per the approved
contract its semantic path stays guarded and it classifies unknown
kimi-unverified rather than idle - and never from its locale-sensitive
moon-phase spinner, which the redesign forbids inventing as a state
source. The gate records the preferred source order (Wire prompt
request lifetime, which brackets a turn and reports cancellation, then
the documented hooks including Interrupt because Stop does not fire on
interrupts) and the exact evidence required to open it. Arming without
wiring would seed a busy record nothing could clear, so both land
together behind the same gate.

* feat: route busy consumers through the contract and drop the global OR

The watcher, crew-state reader, and away-mode daemon now decide busy
state through bin/fm-busy-lib.sh: only an exact busy verdict counts as
working, and unknown never becomes working or a silent idle, so a crew
whose semantic state is missing, malformed, stale, or unverified
surfaces instead of being absorbed. Crew-state reports the producing
source in its detail. The watcher's global OR regex default is gone;
Grok keeps its isolated fallback inside the contract. The daemon's
supervisor-pane reader stays rendered-text - that pane is not a
recorded task - but is now scoped to firstmate's own detected harness
instead of every vendor signature. Secondmate pending-reply
observation is deliberately unchanged and documented as a
delivery-confirmation signal, not task state.

* docs: point busy-state documentation at the single contract owner

Adds a maintainer-architecture section naming bin/fm-busy-lib.sh as
the owner of what busy means, with per-adapter sources, the
unknown-never-idle rule, the endpoint-death override, and the two
rendered-text readers that deliberately stay outside the contract.
Replaces the stale regex-first prose in architecture, tmux-backend,
herdr-backend, and configuration; converts the harness-adapters
per-harness rows from UI signatures to the semantic source each
harness uses; and records the live verification evidence, including
why Codex and standalone Kimi stay unknown.

* fix: arm away-launch signal handlers before acquiring the lifecycle lock

fm_afk_launch_main acquired its lock and only then installed the EXIT,
INT, and TERM traps. A signal arriving in that window terminated the
process by default action and left the lock directory behind, which
blocks the next away-mode launch until the stale-owner reclaim path
clears it. The release helper only removes a lock this process owns,
so the handlers are now armed first. The accompanying test also killed
the child whether or not the lock had appeared and sampled cleanup the
instant wait returned; it now requires the lock, then allows a bounded
settle, so it proves the guarantee instead of racing it.

* test: align fleet, Kimi, lifecycle, and detection suites with the contract

The fleet snapshot and wake-daemon lifecycle fixtures now prove a
working crew through its own semantic busy-state record instead of
rendered pane text, which is what those consumers read. The Kimi
watcher test asserts the approved contract directly: a standalone Kimi
task classifies unknown rather than matching its moon-phase spinner,
while Grok's isolated fallback still classifies only Grok. The
pi-signed detection cases clear ambient harness markers, fixing a
pre-existing failure where the running session's own CLAUDECODE
outranked the fixture's marker.

* fix: stop teardown from deleting a project's own Codex hooks file

An intermediate revision wired Codex through a firstmate-written
<worktree>/.codex/hooks.json, and teardown removed it alongside the
other generated wiring. The Codex wiring was dropped when its probes
came back unverified, so that removal now targets a file firstmate
never creates - and a project may legitimately track its own
.codex/hooks.json, which teardown would then delete from a pooled
worktree.

* fix: keep busy-record parsing from disturbing its sourcing caller

The record parser split fields with set -- under a temporary noglob,
which clobbers a sourcing caller's positional parameters and restores
glob expansion even when the caller had disabled it. The watcher, the
daemon, and the crew-state reader all source this library, so it now
reads fields with read -a, which never globs and never touches caller
state.

* docs: state exactly which Claude hook paths were reproduced live

The busy-state record listed all four wired Claude hooks in the source
column, which could read as a claim that every one fired during the
pass. UserPromptSubmit and Stop did; StopFailure and SessionEnd are
wired from hook names confirmed present in the installed binary, but
the abnormal turn ends they cover were not reproduced.

* test: let reset_fakes own the crew-state busy-text fixture lifecycle

The Grok fallback case set FM_FAKE_BUSY_TEXT and cleared it inline, so
the variable's lifetime was owned by one test rather than by the
shared reset that every other fake already uses.

* no-mistakes(review): Fix semantic busy-state lifecycle races

* no-mistakes(review): Make busy-state retirement idempotent

* no-mistakes(review): Enforce semantic state boundaries for status and injection

* no-mistakes(review): Restore harness-scoped away-mode busy guard

* no-mistakes(document): Refresh semantic busy-state documentation

* no-mistakes: apply CI fixes
…d#1356)

* fix(calm): resume working boat from frozen column across runs

Keep one extension-owned boat animation for the Pi session so settling
freezes column and direction, the next working period resumes there
without hidden-time jumps, and only a fresh session resets to the left edge.

* no-mistakes(review): Freeze Calm boat from last rendered state

* no-mistakes(document): Document Calm boat continuity contract
* fix(dispatch): judge candidate provider relations instead of rejecting them

Firstmate deterministically dropped supported Pi candidates in the
openai-codex family. bin/fm-auth-preflight.sh resolved a harness=pi tuple's
credential surface by constructing the source id `pi:<model-prefix>`, so
`pi + openai-codex/gpt-5.6-terra` looked for a `pi:openai-codex` source. That
source does not exist, because Pi's Codex family authenticates through the
Codex store quota-axi already lists as `auth-json`/`cli-rpc`. The tuple
returned `eligible=no reason=surface-unresolved` while the Pi catalog listed
the model and the Codex provider reported fresh, usable credentials with 64
effective percent remaining on its all-model scope.

The prefix construction was only ever valid where Pi holds its own credential
(`pi:xai`, `pi:kimi-coding`), which is why every previously configured Pi tuple
resolved and the defect stayed hidden until a Codex-family Pi model was
configured.

Retire dispatch eligibility from deterministic shell. The dispatching first
mate now establishes model support and provider family from each harness's
authoritative catalog, applies quota at the granularity the vendor supplies,
and shows that reasoning. Provider-level and all-model evidence bounds every
model established in that family; a named-model window bounds only its own
model. Missing model-level quota, a missing auth source, unmeasurable headroom,
and unmodeled authentication are disclosed uncertainty. Only concrete
contradictory evidence blocks a candidate.

Replace the preflight with bin/fm-vendor-auth-probe.sh, which keeps the
captain's approved bounded probe envelope without any routing knowledge: it
takes no harness, model, or provider, reads no quota, renders no verdict, and
holds only a fixed-argv safety allowlist. Its behavior suite proves the absent
identity surface, the untouched quota, the uniform exit status, the fixed argv
with stdin closed, and a real bound even when the configured bound is zero.

Also fixed along the way: a zero FM_*_TIMEOUT silently removed the hard bound,
the pinned Grok version had drifted to 0.2.117, and --changed selection refused
outright on any deleted bin/ script.

AGENTS.md section 4 and quota-array-dispatch own the corrected policy,
harness-adapters gets the catalog-responsibility correction, and
docs/verification/dispatch-auth.md records the 2026-07-30 evidence on
Pi 0.82.0, quota-axi 0.1.16, and grok 0.2.117.

* no-mistakes(review): Reject all-zero vendor probe timeouts
The commit-discipline section told every worker to preserve expensive
evidence "in its own commit". For a scout that is actively wrong: the
same generated brief states twenty lines earlier that the worktree and
every commit in it are discarded at teardown and that the report is the
only thing that survives, so a scout following the instruction would
lose exactly the irreplaceable output the section exists to protect.

Preservation now names a place that outlives the task, and only that
destination sentence varies by kind: a ship task commits to its branch,
while a scout copies raw evidence into its report directory and has the
report cite it. The scout write boundary is widened to match, since the
previous rule permitted writing only the report itself.
Covers both directions: a ship brief sends raw evidence to its task
branch, and a scout brief warns that its worktree and commits are
discarded, routes the evidence to the report directory, and widens the
write boundary to permit it.

The scout side is also pinned negatively, because the defect was a scout
being told to preserve irreplaceable output in a commit that teardown
throws away. Verified by mutation: giving scouts the ship destination
fails the new assertion.
…ed paths

The two destination assertions grep for the rendered report directory as a
fixed string, but fm-brief.sh renders it physically resolved through
resolve_directory_input. On macOS the test root is created under /var/folders,
a symlink into /private/var, so the unresolved pattern could never match and
both assertions would fail on a supported platform.

Resolve the home with pwd -P after write_registry creates it, matching the
convention already used by the relative-directory test.
A task's data/<task-id>/ directory already outlives cleanup on this machine,
which is custody against a crash but not against a lost machine or a lost
handoff. This copies that directory into a separate evidence repository, where
git history supplies provenance and a remote supplies off-machine durability.

The destination is named only by the gitignored config/evidence-repo file, so a
home that has not opted in behaves exactly as before and no repository is ever
named in shared tracked material.

The local commit is the custody guarantee and the push is best-effort, so a
caller gates cleanup on committed evidence rather than on a reachable network.
Artifacts are copied unredacted, which is safe only while the destination is
private, so the push verifies visibility first and refuses to publish into a
repository that is not private.

Artifacts at or below a named byte limit are committed whole; anything larger is
recorded by size and SHA-256 only, so a corpus is described rather than
committed. The layout keys on home tag then task id, so it is derivable from the
task alone and cannot collide across homes.
Firstmate, not a crewmate, is the custodian for a work item's evidence, and
teardown is where it acts, before anything is destroyed. The call is a silent
no-op unless the home opted in with config/evidence-repo.

The gate is on the local commit and never on the push: an unreachable remote
must not block reclaiming a worktree, and cleanup must not proceed over evidence
that was never committed. --force warns and continues, matching how it treats
every other teardown refusal. Secondmate homes are not work items and are
skipped.
…condition

Pins the commit/push asymmetry from both sides, since collapsing it would
reintroduce the deadlock it exists to prevent: an unreachable remote still
succeeds with evidence committed, while a failed commit reports custody failure
so the caller keeps the source.

Two defects the tests exposed are fixed here.

resolve_evidence_repo exited on a bad destination while callers read it through
a command substitution, so the exit only left the subshell and a configured but
unusable destination degraded into the silent not-opted-in path - the exact
silent evidence loss the design forbids. It now reports through a distinct
return code and callers separate the two cases.

The home segment reused the backend home tag, which hashes the code root, but
FM_HOME exists so several homes can share one root; two such homes derived the
same path for one task id. It now keys on the resolved home.

The push also names its remote and ref explicitly rather than depending on the
clone having an upstream configured for its current branch.
Covers both halves where they actually decide whether cleanup stops: an
unpreservable destination refuses and keeps the worktree, while an unreachable
remote preserves the evidence and cleans up normally. Also covers a home that
never opted in behaving exactly as before, and --force warning rather than
blocking.
Records the opt-in key, the custody-versus-push split that teardown gates on,
the privacy precondition the unredacted copy depends on, the derivable layout,
and the size boundary. Adds the two config keys to the operational-home layout
listing and leaves the exact verbs and exit codes to the script's own help.
@mattadams-dev

Copy link
Copy Markdown
Owner Author

Closing and reopening to fire the pull_request workflow triggers - no CI run was created when this PR was opened. No content change.

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.

2 participants