Repository navigation
feat(bin): add checkpoint-commit discipline to briefs and an opt-in evidence write-through - #2
Merged
Merged
Conversation
* 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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
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:
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.shnow renders one shared# Commit disciplinesection 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, leavingbrief.mdintact for respawn.bin/fm-evidence.shprovides an opt-in custodian write-through: absent the local, gitignoredconfig/evidence-repoit is a silent no-op, and when set it copiesdata/<task-id>/into<evidence-repo>/<home-tag>/<task-id>/, committing artifacts at or below 64 MiB whole (overridable viaconfig/evidence-max-direct-bytes) and recording anything larger, plus symlinks, inEVIDENCE-MANIFEST.txtby size and SHA-256. The best-effort push is skipped unless every URL the push would reach is agithub.1485827954.workers.devhost (including thegithub.1485827954.workers.dev-<alias>form) and resolves to a private repository, since artifacts are copied unredacted.bin/fm-teardown.shinvokes 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, anddocs/scripts.mddocument the two new config keys and the scout-written evidence beside its report, with new coverage intests/fm-brief.test.sh,tests/fm-evidence.test.sh, andtests/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)
Evidence: Generated scout brief (evidence to the report directory, widened write boundary)
Evidence: Evidence write-through CLI transcript (opt-in, layout, size boundary, privacy precondition)
Evidence: Teardown custody gate CLI transcript (refuse, proceed offline, opted out, --force)
Evidence: Rendered commit-discipline sections from both generated briefs
Evidence: Evidence manifest from a real preserve run (64 MiB default limit)
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/mainbin/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 isgit@gitlab.company.com:acme/evidence.git(or a GHE host, or a nested group likehttps://gitlab.com/group/sub/evidence.git, which yieldssub/evidence). The slugacme/evidenceis queried against github.com - I verifiedgh-axi repo view --repo <slug>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 thegithub.1485827954.workers.dev-<alias>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 -- "$dest"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(ortmp/,*.bin,data/) receives a task whose artifacts includeprobe.log. The manifest at EVIDENCE-MANIFEST.txt is still added and changed, sogit diff --cached --quietat 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. Usegit add --force -- "$dest"so the custody claim matches what was actually committed.bin/fm-evidence.sh:275-cp -ppreserves 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. Usecp -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'sgit add(line 330) orgit 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--helpoutput - 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 identicalawk -F: '/visibility:/ ...'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 "$source" -type fmatches 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 lentries 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 "$remote"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 actualgit push --quiet "$(evidence_remote "$repo")" HEADpublishes to every configured pushurl. Concrete path: the captain mirrors the evidence clone withgit remote set-url --add --push origin ssh://git@github.com/owner/evidence.gitandgit 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: readgit remote get-url --push --all "$remote"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-joinedstagedstring and then runs acase "$nl$staged$nl" in *"$nl$rel$nl"*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 sortand git's index order), socomm -23over the two sorted lists is linear and removes the hand-rolled membership test entirely. Note also that the|| return 1on line 321 guards the pipeline's exit status, which istr's and not git's - a git failure yields an emptystaged, 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 tocomm -23are produced withLC_ALL=C sort(lines 341-342) butcommitself 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 containingEVIDENCE-MANIFEST.txtandevidence.logis correctly C-sorted (E= 0x45 beforee= 0x65) yet reads as descending to comm (evidencelogbeforeevidencemanifesttxt). 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 reportscannot verify the staged evidence for <id>, 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'srm -fsucceeded but itscpfailed. 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 inls-files --cached, so comm finds nothing whilegit add --forcedeclines 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-coverageand--list --lane portable-parallel-1|portable-serialto confirm the new suites run in CI lanesManual:FM_HOME=<scratch> bin/fm-brief.sh measure-latency demo-projand... probe-cache demo-proj --scout, then read the rendered# Commit disciplinesection and scout rule 2 out of each brief.mdManual: grep of both generated briefs forevidence-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-latencyandbin/fm-evidence.sh preserve measure-latencyagainst a real destination clone, with a 65 MiB artifact, a symlink, an opted-out home, and a second home reusing the same task idManual: push precondition against the realgh-axiwith the destination remote set to a public github.com repo, then to a gitlab.com URLManual:bin/fm-teardown.sh probe-cacheover 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.