Skip to content

feat(bin): make a task's pull request venue follow its contribution target - #79

Closed
sbracewell64 wants to merge 130 commits into
mainfrom
fm/nomistakes-pr-venue-fork-target
Closed

sbracewell64 wants to merge 130 commits into
mainfrom
fm/nomistakes-pr-venue-fork-target

Conversation

@sbracewell64

Copy link
Copy Markdown
Owner

What this changes

A task's contribution target names a commit; it also implicitly names the repository that commit's trunk belongs to, and that repository is where the task's pull request has to be raised.
On a fork layout that is not a per-project constant: work cut from the upstream trunk belongs upstream, and work cut from the fork trunk belongs at the fork.
Nothing recorded which one a task meant, so a fork-targeted task's pull request could be raised upstream, contributing every commit the two trunks do not share.

  • bin/fm-task-base-lib.sh gains task_base_venue, deriving the venue from the contribution target's trunk, and task_base_venue_identity, reducing a remote URL to a comparable host/owner/repo across transport, port, case, .git and nested forge paths.
    Upstream is tested first, and that ordering is the safety property: fork-only commits are unreachable from the upstream trunk, so no fork-only target can ever be assigned the upstream venue.
    Both fork layouts are handled - a separate upstream remote, and an origin whose fetch and push URLs differ - and the fork trunk is recognised through its landing ref when the local branch lags.
    A target on neither trunk is refused rather than guessed.
  • bin/fm-spawn.sh records contribution_venue= and contribution_venue_url= for every ship, resolved after any base override so a task retargeted onto fork-only material records the venue it was actually retargeted to.
  • bin/fm-pr-check.sh refuses a pull request whose venue contradicts that record, before anything is armed, naming both venues.

The venue is derived from the contribution target's value rather than from the resolved base state, because the target can be overridden after resolution and the venue has to move with it.

Three-valued, on purpose

Only a contradiction refuses.
A task with no recorded venue, or one whose venue could not be derived, is reported as unchecked rather than read as agreement, and nothing infers a venue from the pull request itself.

Scope

Opening the pull request is the validation pipeline's own step, and that tool holds one venue per repository.
So this decides, records and guards the venue rather than selecting it at creation time.

Tests

Both venue directions are proven in one fixture repository, for each of the two fork layouts, so what is demonstrated is that the venue follows the task rather than that it merely moved.
Each new test was run against the unfixed code and observed red before being trusted green.

kunchenguid and others added 30 commits August 2, 2026 22:06
…d#1563)

* feat(bin): require an explicit ship delivery mode in fm-brief

A ship brief's definition of done was shaped by a silent per-project registry
lookup, so an adjusted brief and the task's recorded delivery could disagree and
no one had to decide anything per task.

fm-brief now requires --mode on ship scaffolds, validates it against the closed
set, refuses the conditional no-mistakes-prod-only registry policy as a task
mode, and records the choice as a fixed machine-readable "Delivery contract:
mode=<mode>" line that fm-spawn can check. --mode is refused on scout and
secondmate scaffolds, and --yolo is refused outright because the worker never
owns approval decisions.

* feat(bin): require an explicit ship delivery contract at spawn and promotion

fm-spawn resolved every ship and scout task's mode and yolo from the project
registry, so the delivery posture was never a per-task decision and could
contradict the brief the worker was about to follow.

fm-spawn now requires --mode and --yolo on ship spawns, validates both against
their closed sets, and reads the brief's recorded delivery contract line and
refuses a mismatch before any endpoint exists; a brief scaffolded before that
line existed warns once and launches on the flag. A batch carries one shared
contract that each pair still checks against its own brief. Scout and secondmate
spawns refuse the flags, and a scout now records no mode or yolo at all, which
teardown and the snapshot already tolerate. When the explicit mode carries less
rigor than the project's standing posture, a deviation notice is printed and the
spawn continues, so the registry stays advisory rather than an enforced default.

fm-promote requires the same two flags, because a scout carries no posture to
inherit, and writes them into the task record with the kind flip.

fm-project-mode keeps its one registry parser for the mechanical consumers that
have no task in hand, accepts the conditional no-mistakes-prod-only annotation
and maps it to its most rigorous leg for them, and grows --raw so the deviation
notice can tell a conditional policy apart from a flat mode.

* docs: record the explicit per-task delivery contract

AGENTS.md section 7 now owns how each ship task's mode and yolo are resolved at
intake, including the surface classification for a no-mistakes-prod-only project
and the unregistered-project fallback, and the project-management skill defines
that conditional policy as a registration-time posture with its defaults and
initialization consequences. The registry blurb, script table, and architecture
section follow: the registry records the captain's standing posture, and task
delivery is decided per task and passed explicitly.

* test: pass ship delivery flags per call site in the Herdr launcher e2e

The shared spawn helper also launches a secondmate, which refuses the flags, so
the contract belongs at each ship call site rather than inside the helper.

* test: pass the ship delivery contract in the secondmate suites

Both suites scaffold or spawn an ordinary ship task as the control case for a
secondmate assertion, so each needs the explicit contract the ship path now
requires.
* Add generic remote secondmate transport

* Add routed remote secondmate replies

* Add remote outbox backlog handoff

* Integrate remote secondmate lifecycle

* no-mistakes(review): Fix remote snapshot and handoff races

* no-mistakes(review): Serialize remote home provisioning transactions

* no-mistakes(review): Harden remote lifecycle transaction boundaries

* no-mistakes(review): Serialize remote lifecycle mutations and fail closed

* no-mistakes(review): Close remote lifecycle and file race windows

* no-mistakes(review): Serialize remote reply retirement and inheritance

* no-mistakes(review): Harden remote transfer integrity and recovery

* no-mistakes(review): Serialize remote respawn with registry retirement

* no-mistakes(document): Document remote bootstrap convergence accurately

* no-mistakes(document): Clarify skipped remote secondmate mutations

* no-mistakes(lint): Resolve remote script ShellCheck warnings

* no-mistakes: apply CI fixes
* feat(spawn): propagate a native W3C traceparent to spawned agents

Add a default-off capability that resolves one W3C traceparent for a task,
injects it into the agent's pane shell as the TRACEPARENT environment
variable immediately before launch, and records the identical value as
traceparent= in state/<id>.meta, so an external observer that explicitly
reads that env value or meta field can correlate a worker, a Secondmate, and
their nested children into one trace with no collector, storage, UI, or
vendor coupling.

TRACEPARENT as an environment variable is a firstmate convention carrying a
W3C-formatted value: W3C Trace Context standardizes the header, not an env
var, and OpenTelemetry SDKs do not read it automatically, so a downstream
must consume it deliberately; this feature parents no SDK span by itself.

Identity is per task, not per spawn: the carrier is minted with random ids on
the first spawn, adopted as a child (fresh span, same trace) for a nested
spawn whose parent already holds one, and reused verbatim from the meta on
relaunch, so a task keeps one stable logical identity across restarts. A
malformed or all-zero inherited value is treated as absent and roots a fresh
trace. A new root is sampled (01) - a sampling decision a downstream
parent-based sampler honors, not a guarantee that any collector stores a
span, and firstmate emits no spans; a child preserves the inherited flag.

Trust boundary: a firstmate-minted root is random and reads no prompt, path,
task prose, credential, or arbitrary environment key. An inherited
TRACEPARENT is opaque caller-controlled data - up to 24 bytes of id passed
through after syntax validation - so whoever set it controls those bytes, a
bounded fixed-width channel rather than a general content or secret channel.
The feature adds no OTEL_* variable, no tracestate, and no arbitrary
environment injection; it runs no configurable or arbitrary command, only the
fixed local od and tr (resolved from PATH) to read a few bytes of entropy - a
small local pipeline with no network or watchdog and no hard latency
guarantee. Any entropy or validation failure that returns omits the carrier
without aborting the spawn. A default-off spawn leaves the generated meta and
launch environment unchanged.

Enablement is default-off (config/trace-context, or FM_TRACE_CONTEXT where a
non-empty value overrides and unset or empty defers to the file) and is
propagated into secondmate homes, taking effect at each agent's next launch:
a Secondmate launched or relaunched after enablement carries the primary
trace into its nested workers, while an already-running Secondmate roots new
traces for its own workers until relaunched. Injection reuses the existing
GOTMPDIR channel, so all spawn backends and harnesses and the ship, scout,
and secondmate paths are covered.

Covered by a pure-library suite and a spawn-path integration test (fake tmux
plus a real worktree, hermetic against ambient FM_TRACE_CONTEXT) proving the
recorded and injected carriers are identical and sent before launch, that
default-off writes and injects neither, that a relaunch reuses the recorded
carrier, and that an explicit FM_TRACE_CONTEXT overrides the file both ways;
plus a source-owner inheritance test proving trace-context propagates and
absence-mirrors through propagate_inheritable_config.

Documentation follows the repository documentation-audiences contract:
docs/trace-context.md is maintainer-architecture rationale, the configuration
schema lives in docs/configuration.md, and the repeatable test evidence is
separated into docs/verification/trace-context.md (maintainer-verification),
registered in docs/documentation-audiences.json.

* fix(spawn): propagate the effective trace-context decision to secondmates

FM_TRACE_CONTEXT overrode trace context only in the process that read it. A
newly launched secondmate decided enablement from the inherited
config/trace-context file alone, so the override did not cross the
primary-to-secondmate boundary: FM_TRACE_CONTEXT=off with the file present left
the secondmate's nested workers traced (a broken kill switch), and
FM_TRACE_CONTEXT=on with the file absent left them untraced despite the
inherited carrier.

Deliver the primary's effective decision to a newly launched secondmate as a
normalized on/off FM_TRACE_CONTEXT in the launch prefix, so a FM_TRACE_CONTEXT
override governs the nested primary -> secondmate -> worker chain both ways, not
just the copied file. The value is bounded to the literal on/off and does not
broaden environment injection; the already-running secondmate boundary is
unchanged.

Add a genuine two-level spawn regression that drives fm-spawn twice with the
exact environment the primary injects into the secondmate and proves both
divergent directions end to end. Correct the documentation that implied
secondmate coverage on every backend, since orca and cmux reject secondmate
spawns, and refresh the verification evidence for the new assertion count.

* no-mistakes(review): Clarify Secondmate trace-context launch snapshots

* no-mistakes(document): Correct trace-context documentation ownership and relaunch semantics

* fix(spawn): resolve the trace-context decision once for carrier and snapshot

The effective trace-context decision was read twice per spawn: once inside
fm_trace_context_resolve for the recorded carrier, and again for the secondmate
FM_TRACE_CONTEXT launch snapshot. A config-file change between the two reads
could pair a carrier with the opposite enable state - an injected carrier with
an off snapshot, or no carrier with an on snapshot.

Freeze the effective on/off decision once, drive the carrier resolution under
that frozen FM_TRACE_CONTEXT so it cannot independently re-read the file, and
reuse the same frozen decision for the secondmate launch snapshot. Add a
spawn-path regression that drives the file-decided path and proves the recorded
carrier and the delivered snapshot always agree, and refresh the verification
evidence for the new assertion count.

* no-mistakes(review): Preserve legacy Secondmate trace boundary

* no-mistakes(document): Correct trace-context verification comparison base

* no-mistakes(review): Captain, prevent failed trace delivery metadata claims

* no-mistakes(review): Captain, align trace-context tests and verification evidence

* no-mistakes(document): Correct trace-context verification evidence

* no-mistakes(lint): Suppress intentional ShellCheck literal-dollar warnings

* no-mistakes(review): Captain: freeze trace context at session start

* no-mistakes(test): Captain: stabilize scheduler test and document Kimi trace coverage

* no-mistakes(document): Document trace-context safety boundaries

* fix(trace): fail off on stale session snapshots

Publish each home session decision atomically through a same-directory temporary file and bind it to the current session lock. A replacement failure can no longer leave an earlier on decision active in a later session; missing, stale, malformed, or unpublishable state defaults safely to off.

Add regressions for read-only replacement and failed publication, update spawn and session-start fixtures for the lock-bound format, and refresh the architecture and verification records.

* no-mistakes(review): Fix trace spawn failure independence and duplicate safety

* no-mistakes(document): Refresh trace-context documentation and verification

* no-mistakes(review): Clear partial backend input after failed trace submission

* no-mistakes(review): Stop unsafe trace delivery before launch append

* no-mistakes(document): Document unsafe trace delivery handling

* fix(trace): bound each trace to one routed task, never the routing agent

A persistent Secondmate holds its launch-time TRACEPARENT in the process
environment for its whole life, and routed requests never replace it, so
resolving new-task carriers from the ambient environment chained every
routed task into one ever-growing trace per Secondmate with distinct
parent ids. Resolve now reuses the task's recorded carrier or mints a
fresh sampled root, never reading ambient TRACEPARENT, so each routed
task is its own trace boundary while relaunch, recovery, and
scout-to-ship promotion keep one stable per-task identity.

The spawn regression models the reviewed scenario exactly: two unrelated
tasks spawned sequentially through one persistent Secondmate environment
record and inject distinct trace ids, adopt nothing from the Secondmate's
carrier, and a relaunch of the first task reuses its original carrier
verbatim.

* docs(trace): define the per-task trace boundary

The design contract is one task per trace: a persistent Secondmate is
routing infrastructure with its own agent identity, never a shared trace
root for the unrelated tasks routed through it. Root/recovery semantics
replace the removed child-inheritance path, the sampling and safety
sections drop inherited-carrier language because ambient TRACEPARENT is
never read, and the verification page records the refreshed suite
inventories including the two-task Secondmate boundary regression.

* test(trace): adopt the explicit per-task delivery contract in spawn fixtures

Rebasing onto current main brings the explicit per-task delivery contract:
ship spawns now require --mode and --yolo instead of resolving them from the
project registry. The trace spawn fixtures pass the same explicit contract
canonical spawn tests use, preserving the per-task trace boundary coverage
unchanged, and the verification page records the refreshed comparison base.
* fix(bin): classify tmux agent liveness independent of process titles

`fm_backend_tmux_agent_state` attributed a pane solely from
`#{pane_current_command}`, which is a process TITLE a harness can rewrite,
not a structural fact. Claude Code 2.1.220 reports its version string there,
so a live Claude endpoint classified `ambiguous`: the session-start secondmate
liveness sweep could no longer see it, and any consumer that gates on a
positive classification refuses outright.

Read a second, independent name source: the kernel `comm` of every process in
the pane tty's foreground process group. Either source naming a verified
harness yields `alive`, because a false `dead` is the one verdict that can
start a duplicate agent on a live worktree. Scoping to the foreground process
group rather than the pane's descendants keeps a harness-named background
process from faking an agent, and covers multi-process launchers (the Pi
Launcher path) without a special case.

Verified on 2026-08-03 against all seven adapters running for real on tmux
3.6a / macOS 26.5.2 arm64: claude 2.1.220, codex-cli 0.146.0, opencode
1.18.11, pi 0.82.0, pi-signed 0.82.0, grok 0.2.118, kimi 0.31.1 all classify
`alive`, each attributed by a source independent of its title.

Two tests, because they fail for different reasons:
- tests/fm-tmux-agent-liveness.test.sh pins the logic with real processes and
  no harness, so it runs everywhere CI runs tmux. It drives the two name
  sources apart on purpose and asserts the divergence, so no case can go
  quietly vacuous.
- tests/fm-harness-liveness-drift-live-e2e.test.sh relaunches every installed
  harness and fails naming the harness and version when one stops being
  attributed by a title-independent source.

AGENTS.md section 4 carries the resulting standing rule, and
firstmate-coding-guidelines owns how to satisfy it.

* no-mistakes: apply CI fixes

* docs: move the harness-dependent-check policy out of AGENTS.md

The standing rule was stated in AGENTS.md section 4 with the mechanics in
firstmate-coding-guidelines, which split one contract across two owners and
charged every session for a rule that only fires when firstmate's own
harness-dependent code is being changed.

firstmate-coding-guidelines is now the single owner of both the rule and how
to satisfy it: real-harness proof required, that proof authorized to spend
tokens, structural signals preferred over vendor-rendered surfaces, and a
guard that fails loudly naming the harness and version where a surface signal
is unavoidable. No inline stub is left behind, because AGENTS.md already
carries the load trigger for that skill in sections 7 and 13, so it is read
before any change to firstmate's shared tracked material.

Also records the cross-platform lesson the pipeline caught in the portable
regression, and corrects that file's header: the divergence assertion lives
on the version-string case, which diverges on both supported platforms,
rather than on every case.

* no-mistakes(review): Harden tmux liveness identity and drift validation

* no-mistakes(document): Clarify cross-platform tmux liveness documentation
…#1609)

* feat(bin): trace remote secondmate routes and unify the inherit allowlist

Per-task W3C trace context (kunchenguid#995) resolved and injected its carrier only at
the local spawn path. A remote secondmate is routed through
spawn_remote_secondmate, which returns long before that site and wrote its own
metadata block, so a remote secondmate stayed silently untraced even with the
capability enabled.

The parent home still owns that task's identity, because it holds the metadata
an observer reads. It now resolves the carrier against the task's own meta
under its own frozen decision - reused verbatim on relaunch, freshly rooted
otherwise, never adopting the parent process's ambient TRACEPARENT - and hands
it to the configured host through a new fm-spawn --traceparent argument,
accepted only for a secondmate launch and only as a strict W3C value. The
remote host exports it at the same unconditional pre-launch site and reports
back the carrier its endpoint actually holds, which the parent records, so an
already-alive endpoint reports the identity its agent really received rather
than one the parent merely intended. Disabled remains byte-identical and off.

The remote inherit path also carried its own hardcoded copy of the inheritable
config set, already drifted from FM_INHERITABLE_CONFIG by trace-context. Both
remote ends now derive from that one declaration, so a future item cannot be
sent by one side and refused by the other, and session-scoped enablement items
are skipped on live convergence exactly as the local path skips them.

Also fixes a latent stderr leak: an absent session lock printed a raw redirect
failure, which the new remote resolve site made visible.

Adds tests/fm-remote-secondmate-trace-context.test.sh, driving the real
parent -> fm-on -> remote entrypoint -> control -> remote fm-spawn chain over
the deterministic SSH boundary and reading the carrier back from the remote
pane's own log.

* no-mistakes(document): Clarify remote trace and allowlist contracts
* feat(bin): widen the remote runtime PATH and add a remote doctor preflight

The fixed remote entrypoint hard-coded a four-directory PATH, so a remote
account whose tools live under nix or a per-user profile could not run basic
Firstmate work without a login shell. The entrypoint now composes its child
PATH from the code root's bin, the account's ~/.local/bin, the common
package-manager directories that actually exist on the host, and the portable
system tail, deduplicated and in a fixed order, still under env -i with the
same variable allowlist and no shell command string.

fm-remote-doctor.sh reports that exact PATH by inheriting it from its own
entrypoint launch rather than recomposing it, so the ordering keeps one owner.
It is read-only, reports where each required and optional tool resolved, and
exits non-zero naming every required tool that did not. Remote seeding runs it
as a preflight before anything is created on the host and restores the registry
when it fails.

* no-mistakes(review): Harden remote git authorization and missing-tool diagnostics

* no-mistakes(document): Document remote PATH doctor and safe shims

* no-mistakes(lint): Fix ShellCheck findings in remote path tests

* no-mistakes(lint): Suppress exported fixture's false-positive ShellCheck warning
* feat(bin): gate remote second mates on herdr readiness

A remote second mate now always runs on the Herdr backend, whose server
belongs to the host's GUI login session and therefore outlives the SSH
connections that supervise it. fm-spawn's remote route forces that backend
and the host-local control script refuses any other, so the requirement
cannot be dropped from either side.

fm-remote-doctor.sh becomes the single owner of what "ready" means. It keeps
its PATH and tool reporting from kunchenguid#1623 and adds the Herdr, Aqua LaunchAgent,
GUI-session, server-reachability, and entrypoint-symlink checks, tagging each
gap fixable: or human: with the exact operator step. --fix closes only the
automatable gaps - writing and loading the Aqua-scoped dev.firstmate.herdr
launch agent, starting the server where no launch agent applies, and
recreating the entrypoint symlink - then re-derives every check from the host,
so a human gap is never presented as fixed. It never creates a login session,
writes an auto-login password, or touches FileVault.

Remote seed, remote spawn, and the startup liveness relaunch all run the same
check, repair, re-check sequence through one shared library and fail closed
with the doctor's own gap text. Recovery inherits the gate because it respawns
through the same route.

Tests drive the real doctor against a controlled account fixture with a
private HOME, a state-backed launchctl, and a fake herdr, and prove the
dangerous actions are never attempted. The remote lifecycle suites gain a
stateful Herdr CLI fixture and answer the readiness gate at the SSH boundary,
so they never inspect or repair the runner's own account.

* no-mistakes(review): Validate launch-agent contract and confirm Herdr startup

* no-mistakes(review): Validate loaded launch-agent contract before readiness

* no-mistakes(review): Refuse legacy remote backends without altering routes

* no-mistakes(review): Clarify conditional remote readiness repair sequence

* no-mistakes(review): Repair remote readiness before liveness probing

* no-mistakes(review): Preserve unknown seeds and reject legacy liveness

* no-mistakes(document): docs: clarify remote Herdr backend ownership
…1659)

* Pin remote secondmates to fm-remote

* no-mistakes(review): Fail closed on legacy remote Herdr endpoints

* no-mistakes(review): Isolate fm-remote launch agent from interactive default

* no-mistakes(document): Document shared remote Herdr retirement safety
)

* feat: run remote commands through Aqua job worker

* no-mistakes(review): Enforce remote job deadlines and safe worker shutdown

* no-mistakes(review): Refresh stale workers and harden dependency-free supervision

* no-mistakes(review): Harden worker ownership recovery and shutdown quarantine

* no-mistakes(review): Fix doctor bootstrap, harness repair, and output draining

* no-mistakes(review): Probe doctor tools through authenticated worker bootstrap

* no-mistakes(review): Refresh stale workers before doctor tool probes

* no-mistakes(review): Recover stopped quarantines and extend job deadlines

* no-mistakes(review): Separate queue and execution timeout windows

* no-mistakes(review): Supervise Linux worker crashes and bind root identity

* no-mistakes(review): Resolve authorized Nix profile bin links

* no-mistakes(review): Clarify Nix path resolution documentation

* no-mistakes(review): Harden PATH safety and nvm selection

* no-mistakes(review): Honor nvm system defaults and refresh doctor digest

* no-mistakes(review): Keep workers ready during active jobs

* no-mistakes(review): Bound pre-execution validation by job timeout

* no-mistakes(document): Clarify remote worker documentation

* no-mistakes(lint): Fix remote worker ShellCheck diagnostics

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes
* fix(remote): arm SSH dead-peer detection in fm-on.sh

A vanished remote host mid-poll (a reboot, a dropped link) left ssh
blocked indefinitely on a half-open TCP connection, because fm-on.sh's
ssh invocation had no ServerAliveInterval/ServerAliveCountMax. This
wedged the remote-reply ferry: fm-procevent.sh's runner blocked inside
the ssh child and never reached its own no-result -> claim-release ->
reconcile re-arm self-healing path, which otherwise already handles a
nonzero exit with empty output correctly. Recovery required a manual
retire and re-arm.

Arm ServerAliveInterval=15 and ServerAliveCountMax=3 by default
(bounded ~45s detection window), both overridable via
FM_SSH_ALIVE_INTERVAL and FM_SSH_ALIVE_COUNT_MAX. This is a transport-
level fix in fm-on.sh, so it covers every remote command routed
through it, not just the reply ferry. The remote sshd answers
keepalive probes independently of whatever the remote command is
doing, so a legitimately long-but-alive command (a 55s poll, a clone,
the doctor) is never falsely killed - only a truly vanished peer trips
it, turning that case into a bounded, detectable ssh failure (exit
255) instead of an indefinite hang.

Extends tests/fm-on.test.sh with a behavioral regression asserting a
bounded, positive ServerAliveInterval/ServerAliveCountMax on the real
ssh argv captured through the FM_SSH_BIN process seam, plus coverage
that both are env-overridable.

* no-mistakes(document): Document SSH dead-peer detection ownership
* feat(bootstrap): gate stale axi CLIs at the floors firstmate actually uses

Add gh-axi 0.1.29 floor so bare --squash PR merges stop failing quietly on
older builds. Raise tasks-axi to FM_TASKS_AXI_MIN=0.2.2 (multi-id mv) while
keeping feature probes. Keep quota-axi at 0.1.16 after verifying schema 3
and per-model availability already ship there; runway remains optional.

* no-mistakes(document): Clarify AXI compatibility documentation ownership
…d#1661)

* fix(guard): stop false watcher-down alarm mid-turn under Claude auto-arm

bin/fm-guard.sh derived its watcher-health verdict from fm_watcher_healthy,
which requires a live watcher process holding the home lock. Under the Claude
Stop-hook auto-arm supervision model the watcher is armed at each turn end and
exits on its wake, so it runs only between turns. Every guarded command run
mid-turn therefore found no live watcher and printed the "WATCHER DOWN -
SUPERVISION IS OFF" banner even though supervision was healthy. Because the
episode key was derived from the beacon mtime (which the between-turns watcher
advances every poll), the full banner re-printed on essentially every command,
and the message always blamed a "fresh beacon" that was in fact fresh.

Make the pull guard's health check model-aware via a new
fm_watcher_supervision_verdict in bin/fm-wake-lib.sh:

- Under the auto-arm model a beacon fresh within FM_GUARD_GRACE is healthy even
  with no live watcher process; only a beacon stale beyond grace (or absent) is
  a genuine lapse and alarms.
- Under every persistent-watcher harness (codex foreground checkpoint,
  opencode/pi/grok background arm, tmux, unknown) a live identity-matched
  watcher with a fresh beacon is still required, unchanged.

The banner now names the true failing condition, a missing live watcher process
versus a genuinely stale beacon, instead of always blaming the beacon, and the
once-per-episode dedup keys on that condition rather than the beacon mtime so a
genuine lapse announces once and does not re-print each turn.

The turn-end guard keeps the strict fm_watcher_healthy check because it fires at
the turn boundary, where the auto-arm brings a fresh watcher up and it
cooperates with that arm. fm_watcher_healthy itself is unchanged, so the arm
layer's start/attach/replace decisions are unaffected.

Tests in tests/fm-guard-stale-banner.test.sh cover the auto-arm healthy
fresh-beacon-without-a-watcher case, the auto-arm stale-beacon alarm and its
stable episode, the true-reason banner wording, and the reason-keyed episode
surviving a beacon mtime change; existing persistent-model cases are pinned to
that model.

* no-mistakes(review): Pin secondmate supervision model to launched harness

* no-mistakes(document): Align watcher documentation with model-aware supervision health
* fix(tests): stop fixture-tempdir helper from self-deleting under command substitution

fm_test_tmproot is almost always called as `TMP_ROOT=$(fm_test_tmproot prefix)`,
which forks a subshell to capture its stdout. The old implementation set its
EXIT cleanup trap inside that call, so the trap fired - and deleted the fixture
root - the instant the subshell exited, before the real caller's own EXIT trap
was ever installed. Every test using the documented call pattern leaked its
fixture root on every run; two suites had already independently discovered and
worked around this with ad-hoc mktemp calls.

Registration now goes through a $$-keyed registry file instead of in-process
state, since $$ resolves to the invoking shell's PID even inside the
subshell. The real cleanup trap is armed once at source time (always the real
caller, never a subshell) for EXIT, INT, and TERM. A best-effort orphan sweep
on next source reaps marked fixture roots old enough to be from a killed prior
run.

Simplifies the two existing ad-hoc workarounds (fm-procevent.test.sh,
wake-helpers.sh) back onto the shared helper now that it works correctly.

* no-mistakes(review): Preserve live fixtures during orphan reaping

* no-mistakes(review): Harden fixture ownership against PID reuse

* no-mistakes(review): Secure cleanup registry against path precreation

* no-mistakes(review): Make fixture registration transactional

* no-mistakes(document): Documentation already matches fixture cleanup behavior

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes
* feat(herdr): default presentation spaces on with an explicit opt-out

Herdr's disposable one-task presentation workspace was opt-in through the
presence of local config/herdr-presentation-spaces. It is now on by default,
and a home opts out by writing "off" into that same file.

Values are read with the whole-file whitespace-stripped convention the other
scalar config items already use, plus case folding. An absent file, an empty
file, and "on" all resolve on; only "off" opts out; an unrecognized value warns
and keeps the default rather than failing a spawn over a purely visual setting.
The empty file is exactly the historical opt-in form, so every home that had
already enabled the projection stays enabled with no migration step, and no
previously enabled home can be turned off by the flip.

Because absence now means on at both ends, secondmate inheritance needs no
item-specific convergence: mirroring an absent primary file converges a
secondmate to the same default-on rather than turning its projection off, and
only an explicit primary opt-out propagates the opt-out.

The gate itself moves into fm_backend_herdr_presentation_enabled in the Herdr
adapter so the semantics have one owner that regressions can exercise directly.

* no-mistakes(document): Document Herdr default-on presentation safety

---------

Co-authored-by: kunchenguid <kun-1@kunchenguid.com>
…henguid#1711)

* fix: surface consolidated open decisions on every wake-drain

A needs-decision or blocked event buried under later, unrelated status
appends was only ever shown via the last-line wake annotation, so a
still-open captain decision could go silently missed even though
status_open_decisions (fm-classify-lib.sh) already folds the whole
status stream correctly and fleet-snapshot/bearings already reuse it.

Wire that same fold into bin/fm-wake-drain.sh: a new fleet-wide
scan_open_decisions wrapper scans every state/<id>.status, and
fm-wake-drain.sh prints a separate, bounded OPEN DECISIONS section on
every drain (including the empty-queue fast path), so session-start
and every wake-handling turn surface it for free without duplicating
the open/resolved fold itself. Heartbeat wakes drain through the same
script, so this covers that surface too.

Also tighten status_open_decisions' file guard to skip an unreadable
status file instead of leaking a bash redirection error, now that a
fleet-wide directory scan can reach files a single targeted read
would not.

* no-mistakes(review): Prevent status symlinks leaking open decisions

* fix: drop unbounded perl subprocess from status symlink guard

The review step's own symlink-safety auto-fix (O_NOFOLLOW read via a
perl subprocess) forked one perl process per status file scanned by
the new fleet-wide open-decisions scan, with no cap - inflating
fm-wake-drain.sh's total external-read cost from 8 (the existing
annotation read_cap) to 18 in the enrichment-caps regression test.

The plain [ -L "$f" ] check already rejects any status file that is
itself a symlink before any read happens, which is exactly what the
new regression test exercises and is the same defense level the
sibling scan_captain_relevant_statuses/last_status_line already rely
on elsewhere in this file (no O_NOFOLLOW). Drop the subprocess-based
nofollow read and keep the cheap builtin guard.

* no-mistakes(document): Document actionable fleet-wide open decision drains
…kunchenguid#1710)

* fix(bin): abort orphaned no-mistakes runs and reap leaked processes at teardown

Teardown could remove a task's worker while its no-mistakes pipeline run was
still parked at a gate, leaving an orphaned run holding a fleet slot
indefinitely (observed 2026-08-03: runs parked 7h39m and parked at a
post-CI approval gate). It could also leave backgrounded/disowned
descendant processes rooted under the worktree or tasktmp surviving
reparented to init (observed: two `go test` binaries pinning CPU for
hours with no live task meta to attribute them to).

Add two coupled pre-teardown steps, both scoped to this task's exact
branch/head or worktree/tasktmp so they can never touch another task's
run or processes:
- conclude_task_no_mistakes_run aborts a run parked at a gate via
  `no-mistakes axi abort`, cd'd into the exact worktree so the daemon
  resolves the run itself rather than teardown naming a --run id.
- reap_task_worktree_processes sweeps for processes whose cwd is under
  the worktree or tasktmp (via `lsof -a -d cwd`) and TERM/KILLs them.

Both run before any worktree return, branch delete, or backend kill,
and are idempotent on a retried teardown. The branch+head attribution
logic is factored out of bin/fm-crew-state.sh into the new shared
bin/fm-nm-run-lib.sh so both scripts use the same ownership contract.

* no-mistakes(review): Fail closed on incomplete teardown cleanup

* no-mistakes(review): Bind teardown cleanup to verified run and process identities

* no-mistakes(review): Require confirmed aborts and convergent identity-safe process reaping

* no-mistakes(review): Handle process exits during teardown identity checks

* no-mistakes(review): Restore teardown library in hermetic gotmp fixtures

* no-mistakes(document): Document teardown run attribution and timeout

* no-mistakes(lint): Rename shell variable conflicting with done keyword

* no-mistakes: apply CI fixes
kunchenguid#1709)

The script installs as a symlink under ~/.local/bin. Taking dirname of
the symlink itself (instead of its real target) pointed SCRIPT_DIR at
~/.local/bin, breaking sourcing of the sibling fm-remote-job-lib.sh.
Resolve the real path first, preferring python3's os.path.realpath,
then realpath, falling back to the raw BASH_SOURCE on hosts with
neither.
…d#1724)

* fix(pi): stop Calm claiming a built-in tool name another extension owns

fm-calm.ts claimed bash/read/edit/write/grep/find/ls unconditionally at
extension load, regardless of whether Calm was on. Pi resolves two
extensions registering the same built-in name by first-registered-wins
with no merge and no unregister call, and Calm's project-local
.pi/extensions/ position beats any global or CLI-configured extension,
so a user who never even enabled Calm could have their own bash/read/etc
override silently replaced.

Captain-approved plan implemented:

- Registration is now gated on config/calm already being "on" at load
  time. A Calm-off session or reload registers nothing, so a non-Calm
  user never contests a name. This stays synchronous during the
  factory's own load, not deferred to session_start: /reload (and
  ctx.newSession/fork/switchSession) render the restored transcript from
  a pre-session_start snapshot of the tool registry, so a deferred claim
  would miss that render - confirmed by tests/fm-calm-pi-extension
  .test.sh's hidden-block-geometry E2E when trialed.
- The first time Calm turns on in a session that started off
  (activateBuiltInsIfNeeded, from the /calm command handler), Calm calls
  pi.getAllTools() - safe only once every extension has finished loading,
  unlike the load-time path above - to see whether a different extension
  already owns a name, and skips claiming only that one, leaving it and
  its owning extension fully intact and callable.
- A contested name found this way prints a prominent ctx.ui.notify()
  warning naming the tool, plus a console diagnostic.
- reportBuiltInLosses() remains the backstop for the one case neither of
  the above can reach: a session that starts or reloads with Calm already
  on, where the registry snapshot is taken before Calm gets any chance to
  check ownership. A symlink-safe realpath comparison avoids misreporting
  Calm's own registration as foreign when its path crosses a symlink
  (macOS /tmp, /var).

Confirmed, bounded trade-off: the very first time a session that started
Calm-off turns Calm on, tool-call rows already on screen from before that
toggle do not retroactively collapse, because Pi never lets an extension
re-point an already-rendered row at a definition registered later. Every
session after that first toggle starts with the preference already on and
takes the synchronous load-time path, so the guarantee is intact from
then on. docs/calm.md and the file's own header document this in full.

tests/fm-calm-pi-extension.test.sh gains test_builtin_gate_load_time
(config/calm off registers nothing, on registers all 7 synchronously at
load) and test_calm_activation_collision_and_regression_bound (first
activation claims every uncontested built-in, leaves a foreign bash tool
fully intact and callable, warns and logs the contested name, and locks
in the documented pre-activation bound against real ToolExecutionComponent
rendering). test_rendering_and_session_lifecycle and the live interactive
E2E are updated for the new gate-at-load and first-activation-bound
contract.

* no-mistakes(document): Document Calm tool collision boundaries

* no-mistakes: apply CI fixes
…#1727)

* fix(bin): give secondmate homes a durable parent binding record

Finished-worker cleanup on a remote second mate refused forever with
"cannot resolve the primary home ... durable parent binding". The
remote launch hands the child the remote code checkout as its parent
home (fm-spawn.sh's sole writer of FM_PUBLIC_FOLLOWUP_PRIMARY_HOME
receives FM_HOME=$FM_ROOT from fm-remote-secondmate-control.sh's
host-local launch), and that path can never carry the parent's real
records, so the guard refused unconditionally once relay looked active
anywhere on that host.

fm-home-seed.sh and fm-remote-home-provision.sh now write a durable
.fm-secondmate-parent record next to the .fm-secondmate-home identity
marker, naming the home's route to its parent as local (with the real
parent path) or remote (with the parent's SSH alias for diagnostics
only). fm-teardown.sh's cleanup gate reads it: a remote parent is out
of scope for the delegated-promise check (the whole promised-public-
reply subsystem is same-filesystem by construction, so a remote parent
can never hold one), while a token committed directly to the child's
own .env file - never the process environment - still refuses, so an
unrelated export in the remote host's login shell can no longer mask
in. For a local secondmate, the durable parent_home now also backs up
the launch-time env var, closing a silent fail-open where a restart
that dropped the launch prefix made the guard treat a genuinely active
parent relay as off.

Regression coverage drives the real remote route (SSH boundary + Herdr
fixture) and real fm-home-seed.sh seeding rather than hand-crafted
markers.

* no-mistakes(review): Captain: fail closed on unsafe durable parent records

* no-mistakes(review): Captain: enforce durable parent binding commit protocol

* no-mistakes(review): Captain: publish local parent binding before identity

* no-mistakes(review): Captain: refuse conflicting local parent bindings

* no-mistakes(review): Captain: reject non-regular secondmate seed leaves

* no-mistakes(review): Captain: enforce unique durable parent bindings

* no-mistakes(review): Captain: reject route-incompatible durable parent fields

* no-mistakes(document): Document durable secondmate parent bindings

* no-mistakes(lint): Fix secondmate parent parser ShellCheck warnings

* no-mistakes: apply CI fixes
* feat(bin): gate lavish-axi at its session_ended floor in bootstrap

bin/fm-procevent-lavish.sh decides that a human "Send & End" review is
terminal by reading session_ended from the poll response's leading session
block. That field first shipped in lavish-axi 0.1.35, so an older installed
build silently leaves every ended review source armed forever and captures
an empty ended result on each later cycle. The same release is what makes a
plain reopen refuse a session the human deliberately ended.

Add LAVISH_AXI_MIN=0.1.35 to the existing axi-family floor structure in
bin/fm-bootstrap.sh, reusing tool_version_at_least and the same MISSING
diagnostic gh-axi already emits, so an incompatible build is reported as an
upgrade request before any review surface is armed. Later lavish-axi
releases only add artifact-authoring surface the adapter never reads, so
the floor is the feature-introduction point rather than latest.

Fixtures that stubbed lavish-axi as a bare exit-0 tool would now be read as
unparseable builds, so tests/lib.sh gains fm_fake_version_tool and every
bootstrap-running suite uses it for lavish-axi.

* no-mistakes(review): Clarify lavish-axi version floor rationale

* no-mistakes: apply CI fixes

* feat(bin): set axi-family floors to current latest under the bump policy

The axi-family bootstrap floors are the CURRENT LATEST published version of
each tool, captain-bumped periodically to move the whole fleet onto the
newest axi tools. They are not the minimum feature-introduced version. The
earlier lavish-axi work set a feature-minimum floor, which is the opposite
of this policy, so replace it along with the older feature-minimum rationale
carried by tasks-axi and quota-axi.

State the policy explicitly in bin/fm-bootstrap.sh's header, which owns it,
and in each per-tool floor owner, so no future change argues a floor back
down to the earliest release that happens to satisfy some behavior. Remove
the lavish-axi session_ended and upstream-PR citation, the tasks-axi
multi-ID-mv minimum argument, and the quota-axi credential-source argument
as floor rationale; the tasks-axi feature probes remain as a separate
defense-in-depth concern.

Floors: lavish-axi 0.1.45 (was 0.1.35), tasks-axi 0.2.4 (was 0.2.2),
quota-axi 0.1.17 (was 0.1.16), gh-axi 0.1.29 unchanged and already latest.
Each was verified against the tool's current published version.

The mechanism is unchanged: the same shared version helper and the same
MISSING diagnostic path. The below-fires and at-or-above-silent regression
rows move to the new floors, keeping each boundary genuine by pinning the
patch immediately below each floor rather than a version that was only
below the old one. Fleet fixtures move to the new floors so a bootstrap-
running suite is not reported as an out-of-date build.

Three operator-facing backlog handoff and receipt errors named "0.2.2+"
while the enforced floor moved, so they now point at the floor's owner
instead of duplicating a version number that drifts.

* no-mistakes(review): Centralize AXI floor policy beside constants

* no-mistakes(review): Clarify bootstrap boundary test comment

* no-mistakes(document): Centralize AXI floor policy rationale
…guid#1737)

* fix(bin): bound OPEN DECISIONS scan cost with a per-status-file cursor

The fleet-wide OPEN DECISIONS scan added in kunchenguid#1711 re-reads and refolds
every task's entire lifetime status log on every drain, so its cost
grows unbounded with total log size. Add status_open_decisions_incremental
and scan_open_decisions_incremental to fm-classify-lib.sh: they persist a
per-status-file byte cursor plus the folded open-decision set, and fold
only newly appended bytes on each call, reusing status_open_decisions'
exact fold-line rule (extracted into _fm_decision_fold_line) so the two
strategies can never disagree on what is open. A missing or invalidated
cursor (new task, truncated/rewritten/shrunk log) falls back to a full
re-fold. bin/fm-wake-drain.sh now calls the incremental wrapper instead
of the whole-file scan.

* fix(bin): add O(1) rotation detection and read-failure guarding to the cursor fold

Add the two pieces the incremental open-decisions cursor was missing,
scoped to this repo's actual status-file usage (create-once, append-only,
never replaced or rewritten in place):

- An O(1) device+inode identity check (one stat call) alongside the
  existing size-shrink check, so a status file replaced/rotated/recreated
  at the same path is detected and falls back to a full re-fold, even
  when the replacement is the same size. A same-inode, same-size,
  in-place byte edit is a deliberately accepted gap: no code path in
  this repo ever does that to a status file.
- Checked reads: a stat/wc/tail failure is a genuine I/O error, not
  "the file is empty" - it now reports the already-trusted persisted
  open set unchanged instead of risking a silent invalidation.

Both stay O(1) plus new bytes per call, matching the cursor's bounded-
cost design; no content hashing or pending-fragment machinery.

* no-mistakes(review): Preserve cursor state across failed incremental reads

* no-mistakes(review): Refold status when cursor cache reads fail

* no-mistakes(document): Document cursor-backed open-decision scanning

* no-mistakes: apply CI fixes
…guid#1754)

* fix(bin): preempt remote reply long-polls for queued short jobs

Session start on a home with live remote second mates could stall silently
for many minutes: the single serial remote job worker ran each armed
fm-remote-delta-read.sh reply poll to its full 55s window while bootstrap's
short sync, inherit, state, and route commands sat queued behind it, and
non-FIFO queue pickup let re-armed polls keep winning the lane. Measured
end to end, a trivial short job took 31s behind one 30s poll window.

The worker now preempts a running preemptible job (the read-only, cursor-
anchored delta read is the only member of that class) as soon as a
non-preemptible job is queued, publishing exit 75 with emptied output -
byte-identical to the poll's own elapsed-window-with-no-data result - so
the parent runner takes its existing no-result path and the watcher re-arms
from the same cursor with nothing lost. The delta read translates SIGTERM
into that same exit after removing its staging directory. Sibling polls
never preempt each other, so two armed monitors cannot churn. The same
measured scenario now completes in 1s.

* no-mistakes(document): Clarify remote poll preemption documentation
…#1778)

Discord mentions already ride the same pairing-token opt-in, relay poll,
and platform-aware reply path as X mentions, but the docs still read as
X-only, so a stranger could not self-serve the Discord path.

Add the numbered turn-on steps to the X mode configuration reference,
pointing at the myfirstmate dashboard for account creation, bot install,
and token issuance rather than duplicating operator setup here, and drop
the X-only framing from the README bullet, the documentation index, and
the architecture overview.
…#1781)

* feat(bin): run session start deterministically on hook-capable harnesses

Session start relied on a native nudge that only asked the agent to run
bin/fm-session-start.sh, and an agent can defer that. Observed 2026-08-01:
an /ahoy-first session followed the recap path and did not take the helm
until a later request forced it.

Claude, Codex, and Pi now RUN the digest in their session-open hook through
the new bin/fm-sessionstart-run.sh, so the full ordered digest is in model
context before the first turn. That wrapper is the single owner of what a
session-open source means: startup and Pi's "new" take the helm, clear and
compact re-emit, resume/reload/fork delegate to the nudge, and an unreadable
source takes the helm because doing that redundantly is idempotent while
skipping it is the bug. Grok and OpenCode keep the nudge as the floor, since
neither can carry hook stdout into a model turn.

Because the hook now blocks session initialization, fm-session-start.sh
bounds itself first. Its steps are not all individually bounded - bootstrap's
gh auth probe, tool version probes, the backlog listing and per-task endpoint
reads are unbounded - so the whole digest runs as one bounded child (default
120s). Whatever it emitted before the bound survives, and the parent adds a
loud STARTUP TRUNCATED banner naming the stage that stalled and every stage
that never ran, still exiting 0.

--reemit skips only the sweeps startup already reconciled. It still re-verifies
lock ownership and still drains queued wakes, which arrived after startup and
are the turn's work. fm-bootstrap.sh gains FM_BOOTSTRAP_LOCKED so a re-emit
keeps repair ownership instead of deferring to a lock holder that is itself.

Also adds bin/fm-timeout-lib.sh as the single owner of bounded execution,
replacing three near-identical copies, and gives the ahoy skill a helm check
so a nudge-tier harness cannot recap before taking the helm.

Verified live on 2026-08-05 against Claude 2.1.222, Codex 0.146.0, and Pi
0.82.0; docs/verification/supervision.md records the per-harness source
vocabulary, the two named gaps, and the refresh command.

* no-mistakes(review): Harden session-start completion, timeout, and Pi delivery

* no-mistakes(review): Harden completion ownership and portable timeout escalation

* no-mistakes(review): Normalize watchdog KILL exits without masking command status

* no-mistakes(review): Guarantee startup bounds and align harness delivery tiers

* no-mistakes(test): Fix Pi session-start live verification fixture

* no-mistakes(document): Align session-start documentation with deterministic hooks

* no-mistakes(lint): Silence intentional child-shell expansion lint warning

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes
* docs: rename the user-facing product name to Relay

The public-mention integration gated by the `.env` pairing token is now
called Relay across user-facing prose, covering X and Discord alike
instead of implying a single network.

Renames the product-name strings only: README, docs, the captain-facing
skill descriptions, and the AGENTS.md operating prose, including the
`X mode (.env)` and `Optional X mode` headings and every link anchor
that pointed at them. AGENTS.md section 14 carries a one-line bridge
note so the older name and the unchanged identifier spellings stay
discoverable.

Internal identifiers are untouched: `FMX_*`, `config/x-mode.env`,
`state/x-*`, `bin/fm-x-*`, the `fmx-respond` skill path,
`__FM_X_MODE_ENV__`, and `x-mode-error`. Platform references to X and
Discord as networks stay as they are, and the bootstrap-diagnostics
entry still quotes bootstrap's emitted `FMX: X mode on/off` line
verbatim because `bin/` output is out of scope for this pass.

* no-mistakes(review): Complete Relay prose rename in maintained docs

* no-mistakes: apply CI fixes
* feat(harness): add a verified muse crewmate adapter

Muse Code joins the fleet as a crewmate/scout adapter, verified live against
Muse Code 0.1.0-R708.1 in an isolated lab.

Detection matches the anchored prefix muse-bin*, because the installed launcher
execs a version-suffixed binary whose name changes on every auto-update and
whose install path carries no muse component to fall back on. The same identity
is taught to the tmux liveness classifier, without which a healthy muse pane
would have read as a dead endpoint.

Busy state folds muse's own durable session event log, bound per task by a
sessions-root/worktree sidecar. It is a pull source with no writer, so nothing
is armed and no record is ever seeded. The fold is anchored on the full run
lifecycle prefix so muse's nested cleanup "terminal" payloads cannot settle an
in-flight run, and it is depth-bounded so muse's native sub-agent logs cannot be
mistaken for the parent's. The idle half stays gated: an open run proves busy,
but a settled log reads unknown until a credentialed multi-step run proves one
turn stays inside one run.

Two findings corrected the scout report. The exec-only
--no-foreign-personal-context flag is rejected by the interactive TUI, so the
privacy control that actually reaches a pane worker is
MUSE_EXPERIMENTAL_FOREIGN_PERSONAL_CONTEXT_KILL, verified to drop the operator's
foreign personal rules while keeping the project's own AGENTS.md. And an
unauthenticated muse pane never exits, it waits on a device-code prompt, so
credentials are a spawn preflight rather than a screen check.

muse is refused for secondmates: it has no primary supervision protocol and its
hook dialect rejects the reawakening handlers that protocol needs.

Per the captain's decision, auto-update is not pinned, and the credentialed
multi-step smoke is deferred with an explicit checklist in
docs/verification/muse.md.

* no-mistakes(review): Accept Muse dispatch profiles and shared efforts

* no-mistakes(review): Bind Muse busy state to current session

* no-mistakes(review): Compare Muse workspace bindings literally

* no-mistakes(review): Harden Muse worker credentials and live signal verification

* no-mistakes(review): Cache Muse session bindings and clarify worker credentials

* no-mistakes(review): Clear Muse marker inheritance and normalize interrupt aliases

* no-mistakes(review): Verify Muse glyph effective foreground color

* no-mistakes(review): Harden Muse XDG paths, session cache, and glyph parsing

* no-mistakes(document): Document Muse adapter boundaries
…d#1787)

* fix(herdr): floor default-on presentation spaces at Herdr 0.8.0

Default-on presentation projection turns every crewmate teardown into a
workspace-emptying removal. The focus-safe removal plan avoids Herdr's
focus-stealing explicit close only while the doomed pane's shell can be proved
lone, childless, and idle; a persistent child of that shell (gitstatusd, a
zsh-async worker, direnv) fails that proof permanently and forces the plain
close, which on every release before Herdr 0.8.0 moves the captain's active
workspace for ~140ms on each teardown.

Gate the unconfigured default behind a Herdr 0.8.0 floor. At or above it,
project as before; below it, fall back to the flat per-home layout with one
warning per home per detected release naming the version and the upgrade. An
explicit "on" - including the historical empty opt-in file - is still honored
below the floor, so a deliberate opt-in is never silently downgraded.

The floor reads two independent signals from the client's own status, either of
which can establish a supported release: the protocol number and the release
core of the version string. Measured against the real release binaries, no build
lacking both upstream focus fixes reaches protocol 19 and every pre-fix build
tops out at 17, so protocol 19 is a safe structural expression of the floor. A
release that reports neither signal readably is treated as unsupported rather
than guessed at.

Also:
- Correct the adapter comment claiming the mitigation "stays safe without any
  version gate". That holds for the pane-death route only; the plain-close
  fallback is reachable precisely on the releases where it is unsafe.
- Stop discarding the projected-close helper's stderr at teardown, so a refused
  or failed focus restore is visible instead of silent. The close stays
  non-fatal; the presence gate still decides record removal.
- Add Part C to the focus-flash regression: a doomed pane whose shell holds a
  persistent child, in the geometry where the closing workspace's right
  neighbour is not the anchor. That is the fallback branch the suite could not
  structurally reach. On 0.7.5 it observes a bounded four-sample wrong-focus
  window restored exactly; on 0.8.0 it observes none. It also cross-checks its
  own measurement against the floor classifier, so a drifted protocol mapping
  fails loudly.
- Make the projection suite's unconfigured-home case release-aware, so the whole
  real-Herdr lane passes on both the CI-pinned 0.7.4 and 0.8.0.
- Add an opt-in live guard that re-measures the release-to-protocol mapping
  against the pinned upstream binaries.

The immediate no-code mitigation for a home that cannot upgrade remains writing
"off" into config/herdr-presentation-spaces.

* no-mistakes(review): Pin Herdr live-guard digests across supported platforms

* no-mistakes(review): Document authorized Herdr cleanup containment

* no-mistakes(review): Harden Herdr warning marker publication

* no-mistakes(review): Honor running Herdr server presentation floor

* no-mistakes(review): Recheck Herdr floor after server ensure

* no-mistakes(review): Refresh 0.7.5 and 0.8.0 focus transcripts

* no-mistakes(review): Route Herdr floor probe through lab session

* no-mistakes(document): Align Herdr floor documentation and comments

* no-mistakes(lint): Document Herdr presentation out-parameter consumer
* fix(muse): trust the settled session log as idle

The credentialed multi-step smoke on Muse Code 0.1.0-R708.1 answered the one
question the idle half was held back for: one real 75-second tool-loop turn with
23 tool batches stays inside exactly one run started/terminal pair, and an
Escape mid tool loop closes that run as cancelled rather than leaving the turn to
continue in another run. A settled log is therefore a finished turn, not a pause
between the runs of one turn.

Remove fm_busy_muse_idle_verified and FM_BUSY_MUSE_IDLE_VERIFIED_VERSIONS
outright rather than pinning them to a version: the session log's own metadata
carries only semver 0.1.0 and a build sha, so a version allowlist could not
actually match the running build and would be false precision. A settled log now
classifies idle, an open run still classifies busy, and only a resolution
failure - no binding, no matching log, an unreadable or run-free log - stays
unknown.

Record the evidence in docs/verification/muse.md, including the run-scoped grep
the counts must use, and keep the post-upgrade re-check guidance.

* no-mistakes(review): Document Muse idle trust and remove stale gate reference

* no-mistakes(document): Clarify Muse idle verification ownership
* fix(tests): bound the blocked-worker waits by wall clock, not poll count

The remote secondmate lifecycle suite failed on the fork trunk itself, so every
open fork PR inherited a red required check. The config-push inheritance barrier
waited 250 poll iterations for its deliberately blocked write; on the CI runner
those iterations elapse in 5.3 seconds, while the transaction needs longer than
that to traverse its SSH-boundary jobs - the sibling spawn barrier in the same
job took about 16 seconds. Upstream raised exactly this bound to 1500 in kunchenguid#1727
on 2026-08-04; the fork reconciliation a day later landed 250 at that one site
while keeping 1500 at its sibling.

A poll count is not a duration. It shrinks precisely when the work it waits for
is slowest, so restoring a larger count would leave the same defect one loaded
runner away. tests/lib.sh now owns fm_test_wait_file, which bounds the wait by
wall clock the way bin/fm-remote-job-lib.sh already bounds its own polls, and
distinguishes a producer that died from a bound that expired. Every blocked
worker wait in the suite uses it: 90 seconds for a remote transaction, 30 for a
local marker, both hang tripwires with margin over a measured 26-second worst
case rather than expected durations - a healthy wait ends when its marker
appears and costs nothing extra.

Measured on the base: the transaction reaches its blocked write after 297-319
iterations (23-26 seconds) on a loaded runner, and every serialization assertion
after it passes, which is the disconfirming evidence against a code-side defect.

tests/fm-test-lib-wait.test.sh pins the helper's contract. Each of its three
guarantees was witnessed red under a matching defect: a fixed poll count fails
the wall-clock case, a wait that ignores a dead producer fails the exit case,
and a wait that refuses to poll fails the completion case.

* fix(bin): stop a retired secondmate home from being rebuilt by its own teardown

With the wait bound fixed, the same suite reached its final case and failed
there: a remote secondmate retirement completed, reported success, and left the
retired home behind as a stray tree containing data/.parent-route/wake-ledger.tsv.

A remote secondmate is retired by a host-local teardown whose DATA is a private
directory INSIDE the home being removed (bin/fm-remote-secondmate-control.sh).
The terminal wake-ledger line is written after that removal, and
bin/fm-wake-ledger.sh creates its ledger's directory, so the telemetry write
rebuilt the tree the retirement had just deleted. The line was unreachable
evidence there in any case: it lived only inside the deleted home, and the
parent home never reaches its own ledger write for a remote retirement.

The write now skips a destination inside a home this teardown just removed, by
path and by the vanished directory, so neither spelling of the path resurrects
it. Its position is unchanged, so a teardown that refuses after the removal
still records no terminal line.

Both directions are covered and were witnessed red: without the guard the
retirement rebuilds the home, and with the guard applied too broadly a
retirement whose ledger lives outside that home loses its terminal line.

* fix(bin): decide ledger containment before the home is removed

The first guard asked whether the ledger belonged to the removed home partly by
testing whether its directory had vanished. That over-reached: any secondmate
retirement whose ledger directory did not exist yet took the skip path, so its
terminal line was dropped - and silently, because the skip bypassed the
"wake ledger terminal line not recorded" warning as well. Only the ledger that
lives inside the removed home should ever be skipped.

The question is now answered before the removal, while both paths still resolve,
and the answer is carried as a verdict. Both paths resolve through their nearest
existing ancestor, so a destination that does not exist yet still compares
correctly and two spellings of the same home still compare equal. Every other
destination keeps its previous behavior, including creating a directory that is
not there yet and warning when the write fails.

The new case pins exactly the regression: a retirement whose ledger lives
outside the removed home in a directory that does not exist yet must still
create it and record the line. It was witnessed red against the previous guard
while the other two cases stayed green.

* fix(tests): let the handoff suite's worker die before removing its temp root

This suite's EXIT trap signalled the remote job worker and removed the temp root
in the same breath. Signalling is not stopping: the worker can still be writing
job state under that root while the removal walks it, and `rm -rf` then fails
with "Directory not empty". Because that removal is the trap's last command, its
status becomes the script's, so a run whose every assertion passed still reports
failure - which is exactly how it presented, printing ALL TESTS PASSED and then
exiting 1.

The race is pre-existing on the trunk rather than new: the CI run for base
ed376cf logged the identical "Directory not empty" failure twice for the sibling
remote fixture, where it happened to be harmless because that suite's trap does
not end on the removal. What changed is only exposure - this script moved
between serial shards, and so onto a different runner.

The trap now waits for the worker to actually die before removing, the same
bounded wait tests/fm-remote-secondmate-lifecycle-e2e.test.sh already uses.

Witnessed red through a control that models the real condition, a worker that
keeps writing and does not die the instant it is signalled: removing immediately
after the signal failed 5 of 5 times with the identical message, and waiting for
the worker to die first failed 0 of 5.
… (land of upstream kunchenguid#1855) (#54)

* fix(bin): answer "cannot resolve this run head" instead of "not mine"

`fm_nm_head_matches_worktree` resolved the run head THROUGH THE WORKTREE and
treated a failed lookup as "no match". During validation no-mistakes commits
its fix rounds in its own gate-repo clone and does not push until the push
step, so the live run's tip is routinely an object the crew's worktree has
never seen. Measured 2026-08-06 on a lane actively running its lint step:
worktree HEAD d4032f0, live run head 5152b3a, `git cat-file -t 5152b3a` in
the worktree "Not a valid object name". The helper's own header said the
descendant case MUST match because pipeline fix commits advance the run tip
past local HEAD - the implementation could not see those commits, so the
documented normal case was structurally unmatchable during every fix round.

The rejected run then fell through to the coarse runs-list scan, which applied
the same rule per row: the live running row was skipped as unresolvable and an
OLDER, genuinely failed run sitting at the worktree's own head matched and won.
The answer was not "unknown" but confidently wrong, in the direction that makes
a working lane look dead: `state: failed - source: run-step - run failed`.

The rule is now three-valued - match, no match, unresolvable - and stays the
single owner shared by both consumers:

- fm-crew-state.sh: an active run on this crew's own branch whose tip cannot
  be resolved is attributed and reads as working, since bare `axi status`
  answers for the queried branch whenever that branch has a run. A TERMINAL run
  whose head cannot be bound is not attributed at all, because binding its head
  was the only thing that could tie its verdict to this worktree. The coarse
  scan now binds the branch's newest row and stops, rather than walking past
  the live row to an older one whose sha happens to match; an unresolvable
  newest row answers only "a run is active on this branch", never a terminal
  status.
- fm-teardown.sh: the direction is unchanged and deliberate. Only a positive
  code-identity MATCH authorizes aborting a parked run; both non-zero verdicts
  DECLINE, so teardown never aborts a run it cannot positively attribute. The
  cost of declining is a run left parked for firstmate to see; the cost of
  guessing is killing another crew's live validation.

Upstream PR 1816 does not fix this class: it owns current-run selection and
applies the same visibility test, so it rejects the same live rows.

Tests: new tests/fm-nm-run-lib.test.sh pins all three verdicts, including a
descendant commit created in a SEPARATE clone so it is genuinely absent from
the worktree's object store - the condition that produced this defect and the
one no existing test covered. Four reader cases and one teardown case cover the
consumers. Every case was witnessed red against the pre-fix logic or a targeted
mutation before green; the two coarse/reader regressions reproduce the measured
`state: failed - source: run-step - run failed` verbatim.

The test fixture rules added to firstmate-coding-guidelines are not incidental:
an earlier draft of these fixtures resolved a repo path to empty and ran
`git -C "" reset --hard` against the checkout the tests live in.

* no-mistakes(review): guard unresolvable heads from terminal verdicts; harden fixtures
AGENTS.md section 1 forbids naming an agent as a commit co-author, and bars
the fleet's captain-address and nautical conventions from commits, PRs, and
anything other tools read. Neither rule reached a worker: bin/fm-brief.sh
stated neither, so a generated brief carried the co-author rule only on
firstmate-repo tasks, and then only because those briefs separately name the
firstmate-coding-guidelines skill, which carries it. Every worker on every
other project was silently missed.

Both are structurally the same gap. A crewmate does not read this repo's
AGENTS.md for another project, and its own harness instructions may actively
tell it to append a Co-Authored-By trailer, so the brief is the only place
either rule can arrive. Commit 53932fb on fm/platform-landing-battery-windows-reds
shipped a Co-Authored-By trailer for exactly this reason, and a separate
incident leaked captain address into a commit subject the same way.

Render a "# Commit conventions" section from one shared value into all three
scaffolds that can reach a commit - ship for all three delivery modes, scout,
and the secondmate charter - placed beside each one's delivery instructions
rather than in the preamble. In the ship scaffold it is the last thing before
"the task is complete only when committed on your branch". The scout copy adds
that scratch commits are held to the same bar because a scout can be promoted
in place. Rule numbering is untouched, so no cross-reference moves.

test_every_committing_variant_carries_commit_conventions generates all five
variants and asserts both rules plus the placement constraint. Witnessed red
against the unfixed scaffold first: all five generated variants contained zero
occurrences of either rule.
…of upstream kunchenguid#1611) (#50)

* feat(bin): surface the shared validation daemon's liveness at session start

Every shipping task depends on one shared no-mistakes validation daemon, and
nothing ever asked whether it was running. It died silently three times and
stayed down 2.5 days, 2.9 days and 8 hours before anything restarted it; nobody
noticed on any occasion, because a silent outage is indistinguishable from a
quiet fleet.

Bootstrap now reads the daemon's pid file and sends signal 0 once per run, and
reports the result alongside the existing diagnostics: a VALIDATION_DAEMON line
when the daemon is down or unmeasurable, silence when it is healthy, and its
uptime as a BOOTSTRAP_INFO fact only under FM_BOOTSTRAP_VERBOSE_FACTS=1. A down
report carries how long the daemon has been down, taken from the last moment it
demonstrably wrote anything, so a 2.9-day outage reads as a 2.9-day outage.

The check observes only. It never starts, stops, restarts or reconfigures the
daemon, and it never invokes the no-mistakes CLI, whose ordinary commands
auto-start a daemon as a side effect. Starting a down daemon stays firstmate's
decision.

Three outcomes stay distinct rather than collapsing into two. The pid file is
JSON, not a bare integer, so piping it into a signal check reports a live daemon
as down; an unreadable pid file is therefore reported as unknown, because
calling it down manufactures false alarms and calling it alive recreates the
silence this check exists to end. A recorded pid of 0 is unknown for the same
reason: kill -0 0 signals the caller's own process group.

Tests cover alive, down, missing pid file, and four malformed pid files, and
construct the dead pid positively rather than inferring down from a live daemon.
tests/lib.sh pins NM_HOME at a nonexistent root so the machine's real daemon
cannot leak into any suite that asserts exact bootstrap output.

(cherry picked from commit ad100b8)

* no-mistakes(review): Captain: parse validation daemon PID files as JSON

(cherry picked from commit 404838f)

* no-mistakes(document): Document validation daemon startup diagnostics

(cherry picked from commit ab0ad0c)
…olds (land of upstream kunchenguid#1819) (#51)

Ports upstream PR kunchenguid#1819 onto this fork's trunk. Nothing here is redesigned:
bin/fm-ruling-reconcile.sh, the closure-authority enforcement in
fm-decision-hold.sh's `resolve --from-ruling`, the session-start
RULING_RECONCILE line, the documentation, and the tests are upstream's as
written.

What it does: a decision hold may be closed only when the ruling names the
hold identifier verbatim AND carries an explicit structured verdict.
Everything else escalates. There is no bulk close.

Provenance:
  upstream PR   kunchenguid#1819 (open, untouched)
  head commit   5311209e91d14d877fe3451a4569642cbe4b2ee8
  its base      2cf0283
  landed onto   ed376cf (sbracewell64/firstmate main)

The dispatch brief named 41d2e5e as the source. That is the contribution's
first commit; the delivered contribution head is 5311209, which adds the
pipeline-review hardening - including the forged-provenance guard and its
test. This carries the full PR head so that guard lands with the feature.

The trunks have diverged, so the diff did not apply cleanly. Three
resolutions, all fork-versus-upstream divergence rather than changes to what

AGENTS.md - upstream has renamed X-mode to Relay and has dropped the
research-index/ state entry; this fork has neither change. The trunk's
wording and its research-index/ line are kept, and only kunchenguid#1819's own three
additions are applied: the ruling-index/ entry, the RULING_RECONCILE line in
the fleet-state digest, and the extra decision-hold-lifecycle load trigger.

bin/fm-session-start.sh header - upstream numbers the digest steps one higher
than this fork does, and this fork's read-only paragraph says "five"
bootstrap mutating sweeps where upstream says "six". The trunk's numbering
and its sweep count are kept; only kunchenguid#1819's substantive additions are applied
(the RULING_RECONCILE description and the ruling-index rebuild in the
skipped-when-read-only list). The five-versus-six wording is a pre-existing
trunk inconsistency with the same file's own step 2 comment, and is
deliberately left as trunk work rather than swept in here.

bin/fm-session-start.sh fleet-state digest - this fork emits a fleet-admission
block at exactly the point kunchenguid#1819 inserts its RULING_RECONCILE block. Both are
kept, admission first, each with its own `fi`.
…ons (#53)

* feat(loopspec): bind verifiers executably and actuate lawful transitions

LoopSpec validated specs nobody could run. Measured at HEAD: one spec
registered, zero callers of bin/fm-loopspec.sh anywhere in bin/, zero
entries in state/loopspec/, and execution_path_implemented false on all
sixteen triggers, so assert_runnable could never pass.

Two defects kept it inert.

The verifier was a bare name. verification.verifier was a slug the
machinery never executed, and finish took the verdict from its caller.
A spec naming a verifier that did not exist validated, claimed, and
reached a success terminal on an asserted pass - the named-but-
unreachable case, which looks bound and verifies nothing. Now
verifier_command names a repository-owned executable, an enabled spec
must have one that resolves and runs, `verify` executes it, and a
success terminal requires a recorded run bound to that spec version,
event key and iteration. NO_VERIFIER_RAN is never success, and the
party doing the work no longer certifies the work.

Nothing actuated. bin/fm-loop-actuate.sh is the governed wake-to-action
table: when one lawful transition follows from the recorded state, code
executes it instead of spending a coordinator turn. It is not a runtime
- no loop, no poll, no daemon, no storage of its own. Arming appends an
ordinary check record to the existing durable queue, and every execution
leaves loop=<spec>@<version> with its canonical verifier, without which
adoption cannot be demonstrated at all.

Selection keeps its ruled shape: the deterministic filter narrows over
tiny typed applicability headers, never spec bodies, and hands a genuine
two-or-three tie back as a decision rather than inventing a tie-break.

Also generalizes required_terminal_states, which hard-coded the first
spec's own vocabulary and made a second spec unauthorable, to the
universal safety stops plus required kinds.

Adds fork-landing as the first enabled production spec. It terminates at
a carried pull request whose checks have run, never a merged one, and
forbids merging outright: a loop that merged would convert a delivery
mechanism into an authority expansion.

* fix(loopspec): name an unregistered check set as unavailable, not unparsable

Production run against a freshly opened fork pull request exposed a
second shape from the forge: a pull request whose checks have not been
registered reports "no CI checks configured" rather than a summary line.

The verdict was already correct - unavailable, never a resolved empty
set, because a pull request nothing has examined must not read as
verified - but the diagnostic blamed an unparsable summary for what is
actually a pull request too young to have checks. The distinction
matters when reading why a loop did not advance.
firstmate.bat launches `wsl.exe --exec /bin/bash` so the launch never depends
on the login shell, but that session's PATH carries only the system directories
plus Windows interop. The menu probes each harness with `command -v`, so every
harness installed under the account's private bin directories rendered as "not
installed" and the Enter default fell through to whatever happened to resolve.

bin/fm-wsl-entry.sh now prepends ~/.local/bin and ~/bin when they exist, before
handing off to the launcher. Those are exactly the two directories the stock
~/.profile prepends and the ones every supported harness installer targets, so
this restores interactive parity as a filesystem fact rather than by evaluating
a login profile in a non-interactive launch. Only existing directories are
added, only once, and nothing already on the inherited PATH is removed or
reordered. firstmate.bat's --exec choice is unchanged.

Verified through the real bridge command: `wsl.exe --cd <repo> --exec /bin/bash
./bin/fm-wsl-entry.sh --print-menu` now renders a menu byte-identical to the
interactive `bin/fm-launch.sh --print-menu`, for every harness the menu lists.
…ers (#57)

Resolving CFVC Lane A residual uncertainty 4: whether the four
uninstalled adapters (opencode, pi-signed, grok, kimi) still work.

Measured: no CI job installs a harness binary, so all nine members of
the live-harness-optin family execute on every CI run and gate-skip on
an opt-in environment variable, exiting 0 without testing anything
(FM_TEST_SUMMARY total=9 failed=0 skipped_gate=9, 2026-08-07). With the
switch on and the binary absent they fail loudly instead, so the exit-0
seen in CI is a real gate skip rather than a vacuous pass.

The record stated the CI-versus-opt-in split without stating its
consequence: every per-harness row rests on the dated operator runs
alone. It now says so, and carries bounded output from a Linux run
carrying three of the seven, showing how the guard accounts for the
adapters it could not check.
… chokepoint (land of upstream kunchenguid#1830) (#58)

* feat(bin): record why every agent dispatch was necessary at the spawn chokepoint

CFVC-08. bin/fm-spawn.sh is the last gate before an agent turn exists and it
already writes state/<id>.meta, so it is where the justification record belongs.
Every ship and scout dispatch now records four fields:

  reasoning_required  derived from the reason code
  reason_code         a closed nine-token enum; an unknown value is refused
  capability_floor    verbatim from config/crew-dispatch.json
  escalation_policy   derived from kind plus the delivery contract

bin/fm-reasoning-lib.sh is the single owner of the enum, the derivations and the
stable refusal tokens. It records; it does not enforce - no dispatch is blocked
for reasoning too little. The vocabulary is closed because a free-text reason
cannot be counted, and the two derived fields are never caller-supplied so they
cannot disagree with the record they summarize.

TOOLING_GAP is the one code that is NOT a reasoning code. It names a turn taken
only because a deterministic reader is broken or absent. It records
reasoning_required=no so it can never be counted as justified reasoning, and it
requires --tooling-gap-item naming a work item that is currently OPEN in this
home's data/backlog.md. Without that check the code would launder every unfixed
tool into a permanent "necessary agent turn" - the single failure mode that
would make this record worse than no record at all.

SCOPE, and a documented replacement of completion criterion (a). The spec says
every new spawn record carries all four fields. A --secondmate spawn is excluded
and refuses all three flags: it provisions a standing home rather than
dispatching a task - AGENTS.md section 10 keeps a secondmate out of the backlog
for the same reason - and Lane B derived the enum entirely from task
invocations, so demanding one of its codes for a provisioning action would
manufacture exactly the rubber-stamp answer the enum exists to prevent. Absent
fields read as unknown and never as justified, so a secondmate record cannot be
miscounted either way. The criterion is replaced by a stronger tested pair:
every TASK dispatch carries all four fields, AND a secondmate spawn that passes
one is refused with a stable token rather than silently defaulted.

bin/fm-promote.sh recomputes escalation_policy, because promotion changes the
delivery contract that field is derived from. Leaving it would keep a scout's
report-only posture on a task that can now reach a merge gate.

RETIREMENT. The record was ABSENT, so no mechanism is replaced in code. What
retires is the untracked category of agent turns taken because a reader is
broken: before this, such a turn was indistinguishable in the record from
justified reasoning, and TOOLING_GAP plus its refusing filing check is what ends
that. No transitional second path is left alive - --reason-code is the only way
to record a reason, and it is required rather than optional.

CERTIFICATION. tests/fm-reasoning-required.test.sh, eight cases. Every case was
witnessed RED against the pre-change bin/fm-spawn.sh and bin/fm-promote.sh
before being accepted green. Three further targeted negative controls were run
and witnessed red: loosening the open-item match (the already-closed and prefix
rows go red), making reasoning_required always yes (the TOOLING_GAP row goes
red), and degrading an unreadable dispatch config to "unconfigured" (the
unverifiable-floor row goes red). The published-codes case asserts the recorded
value positively rather than the absence of a refusal, because the
absence-only version of it was vacuously green against the reverted
implementation and so proved nothing. The lint gate was also shown able to
reject (exit 1 on a deliberate violation) rather than trusted for being quiet.

Existing spawn call sites in 18 test files carry the new required flag.

Three failures remain in the touched set and were each proven PRE-EXISTING on the
unmodified contribution base by a stashed baseline run, not asserted: two scout
teardown decision gates refused because this environment has tasks-axi 0.2.3
against the required 0.2.4 floor, and one Pi extension case fails on a Node ESM
loader error. All three reproduce identically with these changes reverted.

* no-mistakes(review): fix array-form floor read, literal gap-item match, meta injection

* no-mistakes(document): document capability-floor dispatch axis in architecture.md

* test: declare a reason code at the fork's own spawn call sites

The landed contribution makes --reason-code required for every ship and
scout dispatch. Five suites that exist only on the fork trunk, or that
grew fork-only spawn call sites since the contribution was cut upstream,
still spawned without it and were refused before reaching the behavior
they pin.

Each call site now declares NL_RULE_CLASSIFICATION, matching how the
contribution adapted the suites it could see upstream. The Herdr launcher
helper picks the flag conditionally: a --secondmate spawn provisions a
standing home and refuses --reason-code outright, so passing it to every
spawn the helper drives would break the secondmate case instead.

No product behavior changes here; this is the fork-side half of the same
mechanical adaptation.
…(land of upstream kunchenguid#1828) (#67)

Lands upstream PR kunchenguid#1828 (head `5152b3ab`) onto this fork's
trunk so the running fleet gets it. Nothing was redesigned and nothing was
re-reviewed; the change was already validated upstream, the upstream
contribution stays open and untouched, and only that contribution's own changes
are carried here.

At the one point an aged wedge marker is about to escalate, a crew that is
provably working has its marker refreshed instead of escalated, so a worker whose
progress lives off the pane stops re-alarming every threshold. Refreshing rather
than dropping keeps the silence conditional: the verdict must be re-earned every
threshold, so a crew that freezes still ages out and escalates. Detection after a
freeze takes at most two thresholds instead of one; the bound is preserved, only
the constant changes. The gate's crew-state reads are capped per housekeeping
pass by FM_STALE_WORKING_GATE_READS, and a marker past the budget stays aged for
the next pass rather than being escalated or dropped.

Reconciled against this trunk, which advanced past the upstream base:

- The trunk's settled-terminal absorb and this contribution's provably-working
  refresh both consult crew_absorb_class at the same escalation point, so they
  now share one bounded read: settled drops the marker, working refreshes it,
  anything else escalates. Deferring past the read budget leaves the marker aged,
  so an absorb is delayed by a pass and never becomes a false wedge.
- The trunk's `settled` classifier action, its captain-gated pause-recheck skip,
  and its FM_CHILD_CPU_* and FM_PR_DIRTY_RESURFACE_SECS documentation are kept as
  the trunk has them; this contribution's wording is reapplied only where it
  deliberately changed something.
- `tests/fm-daemon.test.sh` asserted the per-wake path never reads crew state.
  That was true at the upstream base but is not true here: this trunk's
  settled-terminal absorb deliberately reads once per stale wake, before the
  status-line tests. The case now pins what this contribution actually owns - the
  gate does not run on the wake path, and the reader is consulted exactly once
  per wake rather than once per gate. This is the one substantive reconciliation
  in this landing and is called out for review.
- The suite now defaults FM_CREW_STATE_BIN to a shared inert fake, and the two
  cases that unset it restore that default instead. The trunk's per-wake read
  reaches crew_absorb_class from cases written before this contribution's
  fixture guard existed, and an unset stripped the default for every later case.

Verified on this branch: `bin/fm-test-run.sh tests/fm-daemon.test.sh` passes, and
two negative controls confirm both merged behaviours are live - disabling the
provably-working refresh fails with "a provably-working crew escalated a possible
wedge", and disabling the settled absorb fails with "a settled terminal state
escalated a possible wedge".
… mapping (#60)

* feat(loopspecs): unify the terminal-state vocabulary behind one owned mapping

Two vocabularies named the same terminal facts twice. A LoopSpec finalising on
no_progress_stalled and the platform execution node finalising on
iteration-cap-failed are one fact under two names, and the LoopSpec side's
maps_to was a free-form string carrying a third, unvalidated set of names.

loopspecs/terminal-states.json now owns a single unified terminal-state
vocabulary of nine members and the total mapping onto it from both source
vocabularies: eight LoopSpec terminal states and the eight FINALIZE_MATRIX
outcomes of the platform's scripts/runtime_execution_node.py, read at platform
commit 5d86b7e. Sixteen source names resolve to nine unified names, every
unified name is reachable, and no platform file is changed by this record - the
platform-side rename is a follow-on task there.

The map is enforced rather than documented. bin/fm-loopspec.sh checks it before
any spec is read against it and refuses a map that is not total, that leaves a
unified state unreachable, that is not a reduction, or that collapses two source
names of differing consequence without declaring where the difference still
lives. schema.json makes maps_to required and resolves it against the map
through an external_enums pointer, so a spec terminal state that is unmapped,
invented, disagreeing with the map or contradicting its unified kind is refused
rather than defaulted onto whatever looks closest.

no_delta's certification survives as a machine-checked property: exactly one
unified state may be reached without spending a model turn, it must be no_delta,
and it must stay neutral so reaching it can never demand a verifier verdict. The
test proves that behaviourally as well as declaratively, with a success terminal
under the same conditions as the negative control.

New subcommand: fm-loopspec.sh terminal-map, with --unified, --source,
--resolve and --json. Resolving an unmapped state refuses with the new stable
token refuse_unmapped_terminal.

* no-mistakes(review): guard jq null keys and refuse unknown terminal-map source

* fix(loopspecs): carry the fork-landing spec onto the unified vocabulary

The fork trunk gained loopspecs/fork-landing.json after this branch was cut.
It still declared the free-form maps_to names this change retires, and two of
its terminal states had no row in the unified map at all, so the new
terminal_mapped invariant refused the whole registry.

Record already_carried and carried_and_checks_resolved as loopspec source rows
- no_delta for the one whose description already forbids a model turn, goal_met
for the carry success - and move the spec's own maps_to values onto the unified
names.

tests/fm-loop-actuate.test.sh builds its own registry directory, so it now
copies terminal-states.json alongside schema.json; without it every fixture
registry is missing a file the interpreter requires.
…kunchenguid#1978) (#62)

* feat(bin): let the terminal record say a task failed

The fleet's terminal outcome was a constant. Teardown set outcome=landed
and only --force changed it, so nothing anywhere produced failed: a record
reading "40 terminal (landed 40)" was not a success rate, because the
numerator could not move.

Definition first. bin/fm-wake-ledger.sh now owns what a terminal outcome
means and what evidence stands behind it. The enum stays three members
pinned to the v1 line schema; every terminal record gains outcome_source
naming where its outcome came from - declared, discarded, unreleased, or
assumed. A record written before the field existed reads as assumed, which
is exactly what those records were, so the append-only file needs no
rewrite.

Field second. Teardown derives the outcome from the task's own last
declaration instead of a constant, and a --force discard still outranks it.
A second producer covers the case teardown never sees: a task that fails and
is never released was silent in the ledger, and silence there is
indistinguishable from a task that never failed. `sweep` records those once,
receipt-guarded, and a locked session start runs it.

Diagnostic only, deliberately. The report breaks outcomes down by evidence
and refuses to print a rate: this ledger counts released tasks while the
no-mistakes pipeline counts validation runs, and until that divergence is
reconciled any ratio would describe neither. The report names that gap on
every run.

The attempt counter and the unified terminal vocabulary are separate
increments and are not absorbed here.

* no-mistakes(review): count terminal sweep records from durable appends, add coverage

* no-mistakes(review): remove terminal-recorded receipt in remote-secondmate teardown

* no-mistakes(document): point AGENTS.md mutating-sweep list at bootstrap header owner
…3) (#63)

* feat(bin): count task attempts against a durable retry budget

Nothing counted attempts before this: no state field, no metadata field, and
brief rule 5's "if you hit the same obstacle twice, stop" made the worker the
arbiter of its own retry budget, evaluated from a context that resets on every
relaunch. "Should this be retried?" is now arithmetic over a number on disk.

bin/fm-attempt.sh owns state/<id>.attempt (attempt=, attempt_budget=,
terminal=). Every ship or scout spawn checks the budget before it creates
anything and commits the increment when it publishes task metadata, which also
carries the count as attempt=/attempt_budget=. An absent field reads as attempt
1, so a task dispatched before this retries at 2 rather than restarting its
budget. Secondmates are exempt: their relaunch is unattended liveness recovery,
not a retry.

Exhaustion is a named stop, not a silent one. It records the terminal state and
declares the failure on the task's own status log. Teardown retires the count on
an ordinary release, which is only reachable once the work landed, and keeps it
under --force, so discarding between attempts cannot make the budget unbounded.

Compatibility with the two delivered dependencies, neither of which is on the
trunk yet, and neither of whose producers this duplicates:

- CFVC-11 (fm/cfvc-11-terminal-vocabulary, loopspecs/terminal-states.json):
  exhaustion terminates in that unified vocabulary's budget_exhausted rather
  than a third name. The regression asserts membership whenever that file is
  present and says plainly when it is not.
- CFVC-12 (fm/cfvc-12-task-outcome-failure): the status declaration uses the
  failed: verb that its terminal-outcome derivation reads, so exhaustion books
  outcome=failed through that owner instead of a second ledger producer. The
  three-member v1 outcome enum is untouched.

Brief rule 5's prose is deleted in the same change and the rule list renumbered,
with its numbered cross-reference updated.

* no-mistakes(review): validate default budget env, fix retire premise, document fm-attempt.sh

* no-mistakes(document): document tooling status-line producers in AGENTS.md state inventory

* test(herdr): normalize the per-run attempt count in the projection meta parity check

The projection parity case spawns ONE task id twice - opted out, then
projected - and byte-compares the two metadata files after normalizing the
fields that legitimately differ per run. The durable attempt counter adds
another such field: the second spawn of that id is attempt 2 by construction,
so the comparison failed on a real per-run fact rather than on a projection
difference.

Only attempt= is normalized. attempt_budget= stays compared, because the budget
is a property of the task rather than of the run, and projection must not
change it - normalizing both would have retired real coverage to silence one
line.

Caught by fork CI, not locally: this suite is real-herdr-gated and the task
brief carries no Herdr lab guard, so CI is its verification path here.

* fix(bin): spend an attempt on a recorded failure, not on a launch

CI proved the increment semantics wrong. The Herdr suite drives a same-identity
reclaim: a task whose session dies leaves an agent-free husk, and fm-spawn is
re-run with the same id to replace the dead endpoint while the worktree, branch
and work are preserved. Counting every launch charged that recovery against the
retry budget, so a task could not be brought back after two session restarts -
"fm-hibit-resume-r1 has spent its retry budget: 2 of 2 attempts used". That is
the same harm already avoided for secondmates and not applied to crewmates.

The contract now reads the spec literally: an attempt increments ONLY when the
prior attempt has a recorded FAILED terminal outcome. A spawn following no
recorded failure - dead runtime, husk, freeze, any recovery reclaim - is a
CONTINUATION: the count persists, does not move, and is never refused. The
outcome record draws the line, not the spawn event, which is exactly why this
increment depends on the terminal outcome that can say the prior attempt failed.
A wedged worker is no exception; relaunching one continues unless the wedge was
recorded as a failure first.

The failure signal is the `failed:` verb on the task's own status log - the same
declaration the ledger derives outcome=failed from, so this reads CFVC-12's
evidence rather than a private second signal. failures= records how many were
seen when the count last moved, so only a failure newer than the last counted
attempt spends the next one. This script's own budget-exhaustion declaration is
excluded from that tally, or one refusal would manufacture its own successor. A
refusal preserves the tally it found: it opens nothing, so it must not consume
the pending failure.

A forced teardown needs its own record. The discard ends the attempt AND deletes
the status log carrying the declaration, so teardown --force now calls
`fm-attempt.sh end`, which marks the attempt ended (ended=1). Without it a
re-dispatch after a discard would read as a continuation and discarding between
attempts would make the budget unbounded - the hole keeping the record closed.

Witnessed red first, as instructed: tests/fm-backend-herdr-presentation-e2e.sh
reproduces the exact CI refusal against the pre-correction tree and passes
after, 23 cases, with the default-session tripwire intact. The suite drives
Herdr only through the guarded lab helper, which refuses the default session by
construction.

* test(attempt): give the spawn cases the reason code trunk now requires

Trunk began requiring --reason-code on every ship and scout spawn after this
branch was cut, so the attempt suite's six ship spawns were refused before they
could publish a count. Each now passes NL_RULE_CLASSIFICATION, matching the
other spawn-driving suites.

The secondmate case is deliberately left alone: the reason code is refused on
--secondmate, which provisions a standing home rather than dispatching a task.
…ename promote to reflag (#65)

* docs: open the fleet's vocabulary-collision registry

The fleet resolved name collisions wherever they surfaced, so a ruling was
only ever findable by whoever remembered making it, and the platform's own
Register 3 had no counterpart on this side.

Open docs/vocabulary-collisions.md as the single owner of every word carrying
more than one meaning across the fleet, the platform, and the vendor tools both
depend on. It ships seeded with the ruled dispositions rather than empty: axi
and execution keep their names with the evidence recorded, skill and watch and
lifecycle take mandated qualified forms, promotion splits with the fleet verb
becoming reflag, and kind splits into three axes.

A rename or a split row also states the obsolete name's retirement condition,
so no superseded path is left with an open-ended life. This lands before any
rename it governs: the map exists first, then the moves it records.

* feat(bin): split task identity into role, deliverable, and stage axes

One kind= field carried three independent facts at once: who the worker is,
what the task produces, and where the task stands in its life. Every consumer
reconstructed the axis it cared about from a value that also encoded the two it
did not, and the scout-to-ship operation expressed a lifecycle transition by
rewriting a deliverable type - which is why a reflagged ship and a commissioned
one were indistinguishable, and why a requested agent role had nowhere to land
that would not have made a fourth conflated dimension.

bin/fm-task-axis-lib.sh becomes the single owner of role=, deliverable=, and
stage=, of their values, and of the total derivation from the retired field, so
no consumer spells that mapping itself. Migration follows the ordered contract:

- Dual-write first. Every writer emits the axes beside kind=, which keeps
  reading unchanged while records converge.
- Backfill by derivation, forward-only and idempotent, in a startup sweep that
  runs only under the fleet lock and leaves a converged home byte-identical.
  Stage is deliberately NOT derived: the old field could not distinguish a
  reflagged ship from a commissioned one, so backfill records the
  lower-information value rather than inventing a fact.
- Migrate readers one axis at a time - role across the secondmate-membership
  consumers, then deliverable across the pipeline and teardown-protection
  consumers - splitting the conditions that had mixed both.

kind= stays dual-written for now; the registry owns its retirement condition.
While it stays, a record whose alias contradicts its axes is REFUSED rather
than resolved, because either side could be the stale one and teardown choosing
between a protected ship worktree and a scratch scout worktree by luck is how
unlanded work gets discarded.

The scout-to-ship operation becomes bin/fm-reflag.sh in the same change, since
it is what makes the stage axis true. The old name stays only as a bounded shim
that forwards, warns, and records each use, so its own retirement is settled by
evidence rather than by memory.

Coverage is red-capable: each guard was witnessed failing with its behavior
removed before being trusted green - the derivation table, dual-write,
backfill idempotence, the shim's evidence, and the refusal in the library, in
reflagging, and in teardown.

* docs: move the fleet's instructions onto the new names and axes

The rename and the axis split are only real once the instructions that drive
them say so, so this carries the fleet's own vocabulary across: the scout
outcome section reflags rather than promotes, the metadata field list names the
three axes and the deprecated field they replace, and the captain-facing
do-not-expose list drops a word the fleet no longer uses internally.

Knowledge routing gains one line: a word with a second live meaning goes to the
collision registry, never settled locally in whichever file it surfaced in.
That is the rule that keeps the registry from going stale the first time
someone is in a hurry.

Also moves teardown's admission release reminder into the admission library,
which already owns that policy. Its test previously reconstructed the function
by parsing teardown's source and eval-ing the fragment, so it broke the moment
the function read a variable defined outside it - and a test that reads
implementation source is exactly what CONTRIBUTING forbids. The reminder now
takes its inputs as arguments and the test calls it directly.

* fix(bin): move the watcher and nested-home checks onto the role axis

Two consumers still read the deprecated field: the watcher classified every
supervised window by it, and teardown's nested-home check read it on a parent
record. Both only ever ask whether they are looking at a persistent direct
report, so both are the role axis and neither needed what the work produces.

The watcher's helper is renamed to say what it answers, which is what made the
one remaining stale reference visible - a variable read with no assignment left,
caught at runtime by the triage suite rather than by lint.

* test: carry the axis library into the old-bin conformance fixture

The old-versus-new teardown conformance case builds a mixed tree: the entry
points come from the baseline commit while their siblings are copied from the
working tree. Several of those copied siblings now source the axis library, so
the fixture needs it present or the baseline entry point dies looking for it.

* docs: teach recovery and provisioning the identity axes

The recovery and secondmate procedures still told an agent to look for the
retired single field, so the instructions that decide which playbook applies
would have gone on naming a field the fleet is removing. Each of these asks
only who the worker is, so each now says role.

* docs: state plainly that the stage axis has one value nothing writes yet

The ruled value set includes delivered, and the spawn and the reflag write the
other two. Nothing writes delivered: the honest place to stamp it is after a
confirmed landing, inside the merge path's own private metadata rewrite, whose
ordering, device, and single-link invariants that path owns - so the writer is
a deliberate follow-up rather than something bolted on beside this split.

Say so in both the library and the registry, because a declared value that
never appears is otherwise read as evidence that the task did not land.

* refactor(bin): tidy the teardown identity block

Reads in the order it acts: the refusal and why it exists, then the axes it
protects. Also drops a local the remote path no longer reads and closes the gap
the moved admission reminder left.

* refactor(bin): drop teardown's now-unread copy of the deprecated field

Every teardown branch reads an axis now, and the ledger record carries role and
deliverable, so nothing consulted the alias teardown still parsed on the way in.

With that gone no consumer anywhere branches on the deprecated field, which
changes what its retirement is waiting for: not a reader migration, but a full
task cycle on the axes across every home. The registry says so precisely,
because a retirement condition nobody can evaluate is how an alias becomes
permanent.

* feat(bin): render the identity axes in the fleet view

The view's type column was the last thing reading the deprecated field, and it
could only ever show one of the three facts a row carries. It now renders the
role and deliverable together and appends the stage when it is not the spawn
default, so a reflagged ship is visible as one at a glance instead of being
indistinguishable from a commissioned one - which is the whole reason the
lifecycle axis exists.

* test: carry the axis library into the gotmp fake roots

Both fake roots symlink the real teardown and each sibling it sources, so the
new axis library has to be linked in beside them or teardown dies looking for it
before it reaches the behavior these cases assert.

* fix(bin): keep a polled record's PR identity intact when writing an axis

A task's metadata doubles as PR identity, and its parser refuses any
unrecognized key that appears after the pr= line - the rule that stops a
tampered record from smuggling a second identity past an armed merge poll.
Backfill appended, so the first startup sweep over a home with a live merge
watch invalidated exactly the records that had one, and the watcher stopped
honoring those polls. Nothing reported it, because a poll that is refused looks
the same as a poll with nothing to say.

Axis writes now land before the pr= line, through one helper both the backfill
and the reflag use, and the regression pins the position rather than only the
parse so a future writer cannot reintroduce it by appending again.

Found by the PR-check security suite, which was green on the base and red here.

* no-mistakes(review): make reflag atomic, dual-carry kind on v1 wire surfaces

* no-mistakes(document): migrate leftover scout-promotion wording to reflag

* no-mistakes(document): reflag retired promote verb in scout brief output
…tructing operational truth (#68)

* feat: consume a deterministic decision surface instead of reconstructing operational truth

Firstmate reconstructed operational facts conversationally - capacity, live
work, decision status - and the drift from the records was silent. The incident
this addresses was a report that queued work would dispatch "as capacity frees"
while nothing in the fleet was capacity-bound. Every fact needed to refute that
sentence was already recorded; nothing made it get read, and nothing refused
the sentence.

Add bin/fm-decision-surface.sh: a read-only composer over the already-landed
deterministic owners, plus three `check` verdicts that refuse a claim structured
state contradicts (a capacity claim against an admitting fleet, a ruled decision
reported pending, a dispatch of an identity already in flight). It adds no fact
of its own; every field names the owner it was read from. An unreadable census,
an undecidable admission policy, or an absent decision record is `unevaluable`
- the fact may not be asserted at all - never a quiet pass.

Rewire the instruction surface onto those owners and delete what they replace:
the capacity reasoning at intake, which now defers to the surface and keeps only
the semantic serialization judgment, and the run-step mapping restatement in
Validate, which bin/fm-crew-state.sh already owns in full.

Where no owner has landed, mark rather than delete. `owners` prints the durable
compensation ledger: each row is either owned by a landed command or pending
with the capability that must land first, and the skill maps every pending row
to the instruction it deliberately keeps alive. Attempt and retry counting, a
shared verifier verdict vocabulary, the pipeline invocation that replaces the
keystroke handoff, and backlog time gates all remain firstmate's for now.

Declare the platform seam without depending on it. The deterministic platform
publishes a richer projection - why_not_now, allowed transitions, path health -
and `platform-seam --probe-platform` measures its wiring rather than assuming
it. Probed against platform f0da880 the launcher answers but resolves none of
this home's fleet task ids, so the seam stays not-wired; consuming a projection
of other identities as fleet truth would be the same silent contradiction the
surface exists to prevent. config/decision-surface-platform holds one launcher
path, never a command line, so a private config file cannot become a
shell-execution seam.

Twelve behavior cases run against canned fm-fleet-snapshot.v1 documents with no
live fleet, worker, or platform. Each guarantee was confirmed by breaking it and
watching the suite fail; docs/verification/decision-surface.md records those
seven mutations and the probe evidence.

* no-mistakes(review): fix seam token match, probe kill grace, render, parsing

* fix: reconcile the decision surface with the landed identity axes and retry budget

The trunk landed two changes this surface must consume rather than talk past.

The identity-axis split replaced the overloaded `kind=` with role, deliverable,
and stage, keeping `kind` only as a deprecated compatibility alias. The task
projection read that alias, so it would have kept reading a field the census
retains only for migration. It now projects the three axes, and a test pins them
plus the absence of `kind` so a revert to the alias fails rather than passing
quietly.

The durable attempt-and-retry budget landed as bin/fm-attempt.sh, which makes
"should this be retried?" arithmetic over a recorded count. The compensation
ledger still marked that row pending, and the skill still listed the instruction
it was keeping alive. Both are wrong the moment the owner exists: a stale pending
row is exactly the silent gap the ledger exists to prevent, and this file's own
contract requires the row and its instruction to change in the same edit. The row
is now owned by bin/fm-attempt.sh and the skill's pending table drops it.
…cy (land of upstream kunchenguid#1923) (#66)

* fix(bin): allocate an empty pool slot instead of blockading on an occupied one

`treehouse get` hands out the first available slot and takes no slot
argument, so the pre-allocation guard could only refuse. One parked slot
therefore blockaded every spawn even when later slots were genuinely
empty, and the only way through was authorizing the parked slots by hand.

The guard now chooses as well as refuses: it names a demonstrably empty
slot that is parked at a detached HEAD or the default branch, and
fm-spawn acquires that slot by name with `treehouse enter`, which does
not reset it. An occupied slot is skipped untouched. The refusal is
preserved exactly where it still matters - with no empty slot to steer
to, the allocation falls back to `treehouse get`, so every available slot
must still be empty or explicitly authorized, and the refusal still names
each slot, its evidence and its apparent owner.

Liveness attribution no longer calls a worker gone on a stale recorded
pid alone. That pid is one process sampled when the slot was accepted, so
it stops matching for reasons that say nothing about the task. Stronger
bindings are read first and any one of them carries the live verdict:
HERDR_PANE_ID in a live process's environment matching the task's
recorded herdr_pane_id, GOTMPDIR matching its recorded tasktmp, or a live
process whose cwd is inside the slot.

Between choosing a slot and the pane's shell arriving in it, fm-spawn
holds the slot with one short-lived process of its own, because treehouse
reports a slot in-use while any process's cwd is inside it; the abort
path releases it.

tests/fm-worktree-guard.test.sh cases (s1) through (s4) and the rewritten
(o5) pin the skip, the preserved all-occupied refusal, both liveness
bindings with a negative control each, and the path-scoped reclaim
authority. docs/verification/worktree-allocation.md records the treehouse
behavior measured against v2.1.0.

* no-mistakes(review): serialize slot selection cross-home, record enter evidence, fix label

* no-mistakes(document): document slot-selecting pool allocation in remaining owner docs

* test(pool): give the directed-spawn case the reason code trunk now requires

Trunk began requiring --reason-code on every ship and scout spawn after this
branch was cut. The pre-existing spawn helper in this suite was updated on
trunk, but the pool-lock helper this branch adds was not, so its directed spawn
was refused before it could enter a slot. It now passes NL_RULE_CLASSIFICATION,
matching the helper beside it.
…land of upstream kunchenguid#1827) (#55)

* feat(bin): make an unobserved result a third value that cannot pass (land of upstream kunchenguid#1827)

Ports upstream PR kunchenguid#1827 onto this fork's trunk. Nothing here is redesigned:
bin/fm-verify.sh, bin/fm-verify-lib.sh, the PASS / FAIL / NO_VERIFIER_RAN law,
the check-conclusion partition (STARTUP_FAILURE as could-not-observe,
CANCELLED/TIMED_OUT as not-observed rather than FAIL), the shared rollup rule
for skipped/stale/neutral checks, the bearings label, and the witnessed-red
test controls are upstream's as written.

Provenance:
  upstream PR   kunchenguid#1827
  head commit   0c3afca
  its base      2cf0283
  landed onto   ed376cf (sbracewell64/firstmate main)

The two trunks diverged at upstream kunchenguid#1495, so the diff did not apply cleanly.
Resolutions, all of them fork-versus-upstream divergence rather than changes to
what kunchenguid#1827 does:

bin/fm-bearings-snapshot.sh - upstream sources bin/fm-timeout-lib.sh here; this
fork has no such file and inlines its own bounded gh call instead. Only the
fm-verify-lib.sh sourcing this contribution adds is kept. The check-rollup
splice itself applied unchanged.

bin/fm-test-run.sh - upstream's hunk carried three family entries; two of them
(fm-sessionstart-run.sh, fm-timeout-lib.sh) are for files this fork does not
have. Only the bin/fm-verify-lib.sh entry, which is this contribution's own,
is landed.

bin/fm-brief.sh - upstream had no verification-discipline block at all, so the
contribution introduced one. This fork already had one, in the older two-bullet
form, shared by the ship, scout and secondmate scaffolds. Its single definition
is replaced in place with the contribution's three-valued text rather than
adding a second definition, so all three scaffolds move together and the
one-owner rule holds. The header comment describing that block is updated to
the text it now emits.

tests/fm-brief.test.sh - both suites are kept. This fork's
test_standing_worker_rules_by_variant asserted the old block's wording; those
three assertions are re-pointed at the replacement text (witnessed negative
control, the three-valued rule, and missing-artifact-is-could-not-observe),
which is the same intent against the sentences that now exist. Upstream's
test_verification_discipline_is_the_type_rule is added alongside it.

docs/scripts.md - the fm-timeout-lib.sh row upstream's hunk carried does not
belong on this fork; the two fm-verify rows are landed.

Verified on this fork: bin/fm-lint.sh clean (ShellCheck 0.11.0, exit 0),
bin/fm-doc-audience-check.sh ok (surfaces=72 local_links=213), and
tests/fm-verify.test.sh, tests/fm-brief.test.sh and
tests/fm-bearings-snapshot.test.sh all pass.

* ci: bump the pinned Bearings count for the test this branch adds

The snapshot-compatibility job asserts an exact Bearings test count, and this
branch adds one Bearings case without moving the pin, so the job failed on this
PR before the rebase as well. Pinned count moved from 41 to 42, which is what
the suite now reports.
…and of upstream kunchenguid#1829) (#59)

* feat(bin): give the crew-state reader typed verdicts and freshness

CFVC-05. The fleet's authoritative current-state reader answered every
question with a confident-looking prose sentence and had no way to say it
did not know, so each unmodelled condition was coerced into some other
condition's verdict. This adds the structured mode the increment asks for,
and closes the four measured defects that shared that single cause.

WHAT WAS MEASURED (2026-08-06, no-mistakes v1.40.3)

1. busy-record-never-expires. bin/fm-busy-lib.sh parsed the record's ts=
   for format and never compared it to the clock, so a worker killed
   mid-turn classified `busy` forever. The watcher's BUSY_TURN_MAX_SECS
   cannot cover this: it ages a pane already believed busy, and a dead
   worker's pane renders an idle footer, so that backstop never arms for
   exactly these workers.
2. crew-state-unknown-after-resolved-line. A `resolved:` line - the closure
   verb every brief instructs crews to write - reported
   `unknown / none / no current-state source available`, claiming no source
   existed while the endpoint was readable and idle. Checking the whole verb
   set against bin/fm-classify-lib.sh rather than the two reported cases
   showed `captain-held:` hit the same fallthrough, confirming it was the
   verb CLASS and not two instances.
3. crew-state-treats-infrastructure-kill-as-rejection. `error: daemon
   crashed during execution` appeared on five terminal runs in one
   afternoon's history, each reported as `failed`. The pipeline broke; the
   work was never judged. Firstmate read it as the change being rejected.
4. crew-state-reports-aborted-run-as-failed. A deliberate `cancelled`
   outcome, which supersession produces on purpose, also reported `failed`.

WHAT CHANGED

Verdict vocabulary, one condition per verdict, none borrowing another:
`failed` (a step judged the work and rejected it), `aborted` (deliberately
cancelled), `interrupted` (the pipeline broke without judging), `idle`
(alive, nothing running, nothing declared), `stale` (evidence aged out),
`unknown` (genuinely no usable evidence).

The failed/interrupted split reads the pipeline's own structural
attribution marker - it prefixes step-attributed errors with
"step <name> failed:" - and never reads the error prose to guess whether a
step failure was "really" the code's fault. The full text travels to the
caller as terminal_error so the semantic residue stays visible instead of
being encoded as message-matching. `interrupted` requires POSITIVE evidence:
a terminal failure with no error field keeps the plain `failed` verdict,
because absence of evidence must not manufacture a claim in either
direction.

Freshness travels with the verdict. A busy record expires
(FM_BUSY_MAX_BUSY_AGE_SECS, 3600s); an idle record never does, because age
cannot make a finished turn unfinished. Expiry is terminal like malformed
and gen-mismatch, so no weaker source can re-answer for a worker the task's
own record just proved had stopped. Each answer reports evidence_age_secs
and precedence_applied.

RETIREMENT

The ad-hoc per-consumer source combination is gone, not left alongside the
new path. bin/fm-classify-lib.sh's crew_absorb_class and
bin/fm-fleet-snapshot.sh's crew_state_json both reconstructed structure by
slicing the prose line on its middle-dot separators; both now read typed
fields. No consumer in bin/ parses this reader's prose. crew_absorb_class
enumerates every verdict explicitly rather than silently defaulting, which
is how a correct reader still produced a wrong supervision outcome.

PREVENTION

tests/fm-crew-state.test.sh carries a conformance table of evidence-inputs
to expected-verdict covering every source combination and every sanctioned
status verb. Two coverage gates fail when a verdict or verb exists with no
row, so the next one cannot be added silently - that, not the four fixes, is
the point. FM_CREW_STATE_VOCABULARY in bin/fm-classify-lib.sh is the single
owner consumers and gates read.

CERTIFICATION - RED-CAPABLE

Run against the pre-change reader, the table reds on exactly the defect rows
and passes the other 18, proving it is precise rather than blanket-red:
  deliberate cancel is aborted        want=aborted      got=failed
  pipeline crash is interrupted       want=interrupted  got=failed
  expired busy record is stale        want=stale        got=working
  verb resolved closes a decision     want=idle         got=unknown
  verb captain-held closes a decision want=idle         got=unknown
  idle endpoint with no log is idle   want=idle         got=unknown
Against the change, 24/24 pass. test_conformance_checker_is_red_capable
proves in-band on every run that the checker rejects a wrong state, source,
and precedence, so it cannot silently become an always-green verifier. The
busy-expiry test includes a control that raises the bound and watches the
verdict return to `busy`, proving the new check is what decides.

TWO COMPLETION CRITERIA SUBSTITUTED, PER THE COMMISSION'S STALE-CRITERION CLAUSE

- `pane_hash` is not emitted. The reader computes no pane hash, and adding
  one would mean capturing and hashing rendered output on every heartbeat -
  the signal the semantic busy-state redesign deliberately abandoned because
  rendered output is not turn state. Replaced with `busy_seq`, the busy
  record's strictly-increasing counter, which answers the same question
  (did the worker's state actually move between two reads) from the
  architecture's own advancing-evidence source.
- The empty-check-set negative control is written as prose/structured
  equivalence rather than pinning `green`. bin/fm-crew-state.sh's
  nm_ci_checks_state is the single owner of that rule and upstream PR 1614
  is the open change that tightens it; duplicating its fix here would leave
  two owners of one invariant. The equivalence assertion is stronger in one
  respect: it guarantees the structured mode can never be the path that
  reports a green the prose mode would not, whichever way 1614 resolves.

EXCLUDED: RUN SELECTION - AND THE EXPOSURE THAT LEAVES OPEN

Resolving the CURRENT run for a task, rather than whatever the repo-scoped
status returns, is NOT in this change. Upstream PR 1816 is an open change to
this same file implementing exactly that, and the increment's own sequencing
note forbids opening another concurrent editor of it. Firstmate ruled that
1816 owns it: duplicating an open PR is the defect CFVC-02 exists to
prevent, and rebasing onto an upstream open PR would carry another author's
unlanded work into ours.

Verified rather than taken on trust, against the installed no-mistakes
v1.40.3:
- Bare `no-mistakes axi` DOES emit `runs[N]{id,branch,status,head,pr}:`. The
  comment still in this file saying that table never appears was verified
  against v1.32.2 and is now STALE. 1816's core mechanism is therefore real
  code, not the dead path that comment describes. Those exact lines are what
  1816 rewrites, so they are deliberately left untouched here rather than
  edited into a conflict.
- 1816 resolves the current run by filtering that table to the task's branch,
  then to a matching code head, preferring pending/running over
  completed/failed/cancelled regardless of row order, then re-querying
  `axi status --run <id>` and verifying id, branch, and head before accepting
  it. That is genuine current-run resolution, not a repo-scoped answer.
- The defect it fixes is live in the run history right now: branch
  fm/wedge-aging-ignores-provably-working carries one running run plus two
  older failed runs, distinguishable only by head - exactly the shape that
  produces a false failed verdict.
- One caveat: 1816's `active_run:` block parser matches that key exactly, but
  v1.40.3 emits `other_branch_active_run:` (confirmed in live output and in
  the binary's strings; no bare `active_run:` key found). That first helper
  appears inert on this version, so the runs-table fallback is what actually
  carries the fix. It is not a defect - a cross-branch block MUST NOT be
  attributed to this task - but the "authoritative when present" comment
  overstates what runs today.
- 1816 is delivered, not landed: open, unmerged, zero reviews, and no CI
  checks configured on it.

EXPOSURE. Until 1816 lands AND this fork resyncs, the false-failed-verdict
defect stays open: crew-state can report `failed` for a lane the pipeline
authority shows as running. Measured three times on 2026-08-06. Nothing in
this change detects or mitigates it; the typed verdicts make the wrong answer
machine-readable, not correct.

REVISIT TRIGGER. If 1816 has not landed by the time this fork next resyncs,
firstmate re-evaluates rather than letting the gap drift.

* no-mistakes(review): enumerate verdicts in decision clearing and keep stale evidence age

* no-mistakes(review): gate absorb classes on the vocabulary and reject non-object reads

* no-mistakes(document): align crew-state and busy-verdict docs with typed verdicts

* docs(bin): correct settled-state rationale for the new run verdicts

The fork trunk's crew_state_is_settled explained its `failed` exclusion by
noting that failed also reconciled a cancelled run. This contribution splits
that: a cancelled run now reports `aborted` and a broken pipeline reports
`interrupted`. The case arms already return the right answer for all three -
only the stated reason had gone stale, along with two comments describing the
reader's prose line that is now a typed verdict.

* fix(bin): treat an empty crew-state field as unreadable, not a verdict

The typed read replaced a prose parse whose non-matching line yielded
`unreadable`, which the watcher's process-liveness source is still allowed to
answer for. A present-but-empty state field carries no answer either, so it
takes the same path rather than falling through to a decided-looking class.

* test(crew-state): stop the mode-equivalence row racing the clock

The conformance row compares the prose and structured renderings of the same
verdict, but reads them through two separate invocations of the reader. An
expired-record detail embeds the age measured at read time, so a second boundary
falling between the two invocations rendered 7200s in one and 7201s in the
other - the same correct answer one tick apart - and failed the row. Observed on
a loaded machine: the row passed on one full run and failed on the next with no
code change between them.

The measured age is now normalized on both sides, so the row tests the rendering
it is there to test. Any other divergence in the detail still fails it, and the
age value keeps its own assertion against a single read, which is the only place
the two can be compared without a race.

* ci: bump the pinned snapshot count for the test this branch adds

The snapshot-compatibility job asserts an exact fleet-view test count, and this
branch adds one snapshot case without moving the pin, so the job failed on this
PR before the rebase as well. Pinned count moved from 20 to 21, which is what
the suite now reports.

The Bearings pin needed no change here: #55 moved it to 42 when it landed, and
this branch adds no Bearings case, so trunk's value already matches.
… repeat (#69)

The PR 59 squash landed literal conflict markers inside the section 7
validation-judgment paragraph of AGENTS.md, the always-loaded instruction
file, where they read as authoritative text to every session. Resolve them by
keeping the typed-verdict wording that commit set out to land.

Add bin/fm-conflict-marker-check.sh and wire it into the repo-invariants CI
job so the class cannot land silently again. It sweeps tracked text files for
the ours, diff3 base, and theirs headers, assembling every pattern at runtime
so the checker and its test never match themselves, and deliberately does not
trigger on a bare separator line, which a seven-character setext heading
underline reproduces exactly.
* feat(bin): have the worker start its own no-mistakes run (CFVC-15)

The implementation-committed -> validate transition, the fleet's most-travelled,
stops being actuated by firstmate typing `/no-mistakes` into a worker's composer.
The generated no-mistakes definition of done now has the worker call
`no-mistakes axi run --intent ...` itself as one blocking call the moment its
implementation commit lands, replacing the append-`done:`-and-stop step.

That actuator had a measured false-positive class: on 2026-07-03 two crewmates
were sent the trigger, both left it fully typed but unsubmitted in the composer
for minutes, and the send exited 0 with no error. It also spent a firstmate turn
whose entire semantic content was a transition the worker had already earned.

Consuming CFVC-07's contract, the brief has the worker judge the call by the run
result it prints rather than by its exit status: a return with no readable run
result is could-not-observe, which is never a pass and never a reason to retry.

Because a worker can now start a run while the one shared daemon is serving
another lane, the brief also carries the branch-scoping rule. A bare
`no-mistakes axi status` answers with another branch's run when the worker's own
branch has none, so a run whose `branch:` is not the worker's is another lane's
work: never responded to, aborted, or adopted, and never a reason to restart the
daemon.

Retirement, per the increment's contract: the per-harness keystroke quirk table
is deleted from the harness-adapters skill rather than wrapped, along with the
per-harness `Skill invocation` rows and the now-dangling skill-invocation load
triggers in AGENTS.md, firstmate-orca, stuck-crewmate-recovery, and
docs/configuration.md. The facts live code still depends on are kept and
re-anchored to command-shaped sends generally: codex's `$` popup settle scoping
and grok's slash-popup argument-hint hazard with its herdr submit-verification
fix. The exit command remains the only routine command-shaped steer.

No scheduler, watcher, queue, or wrapper is introduced: this is one command
inside an existing definition of done, and the shared-daemon prohibition is
unchanged.

Tests (tests/fm-worker-initiated-validation.test.sh) cover the three properties
the increment names, each absence assertion paired with a negative control that
reconstructs the retired shape and watches the same predicate go red. All four
cases were additionally witnessed failing against the pre-change generator
before being trusted green.

Rollout note: the change is harness-independent rather than staged per harness.
The replacement is a shell command every verified adapter already runs, so the
harness-dependent surface is removed rather than migrated, and gating it per
harness would add exactly the machinery the increment's certification forbids.
Already-scaffolded briefs keep their previous contract, so in-flight lanes are
unaffected; AGENTS.md section 7 tells firstmate to steer such a worker into the
run rather than restore the actuator.

* no-mistakes(review): align rule 4 examples and blocked append with DoD
…ocking_on (CFVC-06) (#71)

* feat(bin): carry the status boundary as a typed event with derived blocking_on (CFVC-06)

The worker-to-supervisor boundary's control facts were prose.
bin/fm-classify-lib.sh classified wakes by grepping a crew's own sentence
against `PR ready|checks green|ready in branch|merged`, so
"working: rebased onto merged #76" escalated as a terminal event and had to be
defended by a rule excluding nonterminal verbs - a guard around a guess.

Each event is now a typed `fm-status-event.v1` envelope carrying verb, key,
phase, repeatable evidence references and one bounded summary. New
bin/fm-status-event-lib.sh owns the format; bin/fm-classify-lib.sh remains the
single owner of what a verb MEANS and reads that field instead of a regex. The
default classification path runs no regex at all, so the free-text arm and the
collision class it created are gone rather than caught after the fact.

What a task is waiting on is derived, never declared. status_event_blocking_on
combines the verb, the keyed open-decision fold and bin/fm-crew-state.sh's typed
verdict, so proof that a run is advancing overrules a stale blocked claim, and a
decision left open earlier is not masked by a later unrelated event. A worker
cannot write the field: the envelope's field set is closed, and an event
carrying blocking_on= is refused whole and surfaced as malformed rather than
silently stripped and half believed.

Compatibility is the three shared parsers. Every consumer in bin/ already reads
status lines through status_line_verb, status_line_note and the decision-key
parser, so teaching those the envelope taught the fleet at once and a log part
way through the migration reads correctly. Prose remains the human note.

bin/fm-brief.sh teaches the typed form to every reporting scaffold, including
the rule that blocking_on is derived. bin/fm-fleet-snapshot.sh projects the
envelope and the derived field, reusing the crew read it already paid for.
bin/fm-wake-lib.sh renders a typed event to its prose projection before the
drain annotation's byte budget, so evidence references cannot truncate away the
summary.

Retired: FM_CLASSIFY_CAPTAIN_RE_DEFAULT's free-text arm, and the nonterminal
verb rule as a defence against it. That rule survives as declared policy and
still applies on the opt-in FM_CAPTAIN_RE path, where prose matching is what the
home asked for. A bare verbless line such as "merged" is no longer
captain-relevant, and tests/fm-daemon.test.sh records that change of behavior.

Tests assert the retirement with a negative control that requires each collision
line to match the retired arm as a bare regex before requiring it not to
classify; that a typed event classifies with the default pattern blanked, so no
regex fallback remains; that a worker-written blocking_on is refused with its
own reason and cannot reach the answer even through summary prose; that the
derived answer changes with crew state while the status line is held constant;
that both derivation helpers are total over the declared crew-verdict
vocabulary; and that every reporting scaffold teaches the typed form.

* no-mistakes(review): copy status-event lib into fixtures, project envelope key, add conformance test

* no-mistakes(document): align classification docs and comments with typed status events

* fix(tests): carry the status-event library into every sandbox bin fixture

bin/fm-wake-lib.sh and bin/fm-classify-lib.sh source the sibling
bin/fm-status-event-lib.sh eagerly, so every fixture that builds a synthetic
bin/ from a hand-maintained manifest must carry that sibling too. Three did
not, and under `set -eu` the missing source aborts the script under test:

- tests/fm-gotmp.test.sh symlinks the libraries into a fake FM_ROOT (two sites).
- tests/fm-backend.test.sh copies OLD_BIN_UNCHANGED_SIBLINGS into the synthetic
  pre-refactor tree, whose own header already records that a sourced sibling
  must be a real reachable file there or the source aborts.
- tests/fm-remote-backlog-handoff.test.sh copies a fixed list into a fake
  remote root.

The eager source is deliberately left hard rather than made conditional. The
classifier's dependency is a correctness contract: a silently absent parser
would let a sandbox read a typed event as prose, which is the failure this
increment removes. Softening it to keep a manifest short would trade a loud
fixture break for a quiet wrong answer.

Red before and green after on the same tree: each of the three suites failed
with the missing-sibling abort and now passes (3, 28 and 10 assertions).
A task's contribution target names a commit; it also implicitly names the
repository that commit's trunk belongs to, and that repository is where the
task's pull request has to be raised. On a fork layout it is not a per-project
constant: work cut from the upstream trunk belongs upstream, and work cut from
the fork trunk belongs at the fork. Nothing recorded which one a task meant, so
a fork-targeted task's pull request could be raised upstream, contributing every
commit the two trunks do not share.

Derive the venue from the contribution target and record it per task:

- bin/fm-task-base-lib.sh gains task_base_venue, which resolves the venue from
  the target's trunk, and task_base_venue_identity, which reduces a remote URL
  to a comparable "host/owner/repo". Upstream is tested first, and that ordering
  is the safety property: fork-only commits are unreachable from the upstream
  trunk, so no fork-only target can ever be assigned the upstream venue. A
  target on neither trunk is refused rather than guessed.
- bin/fm-spawn.sh records contribution_venue= and contribution_venue_url=,
  resolved after every --slot-base/--contribution-target override, so a task
  retargeted onto fork-only material records the venue it was retargeted to.
- bin/fm-pr-check.sh refuses a pull request whose venue contradicts that record,
  before anything is armed. The check is three-valued: only a contradiction
  refuses, and a task with no recorded venue is reported unchecked rather than
  read as agreement.

The venue is derived from the target value rather than from TASK_BASE_STATE
because the target can be overridden after resolution, and the venue has to move
with it.

Opening the pull request remains the pipeline's own step, so this decides,
records and guards the venue rather than selecting it at creation time.

Tests cover both directions in one fixture repository, so what is proven is that
the venue follows the task rather than that it merely moved, plus the inversion
case, the three-valued refusal, transport/case/nested-path identity, and the
guard's refuse, accept and unchecked paths.
fm-pr-check.sh now prints a venue line before arming, so the verbatim
transcripts in this file under-reported what the command actually outputs. The
fixture tasks record no contribution venue, so each invocation reports the venue
as unchecked rather than claiming a match it never verified.

The refreshed lines were captured from the real script through the suite's own
hermetic harness rather than composed by hand, so the transcript stays a record
of observed output.
@sbracewell64
sbracewell64 force-pushed the fm/nomistakes-pr-venue-fork-target branch from 5d37ed7 to d5b8c61 Compare August 11, 2026 04:27
@sbracewell64

Copy link
Copy Markdown
Owner Author

Superseded by #81

This pull request tracks a branch the validation pipeline replayed onto the upstream trunk after this request was opened, so its head no longer descends from this task's contribution base and it proposes 337 files, +82662/-3942 across 100 commits.

Measured from the contribution base, the change is 9 files, +844/-5 across 6 commits, which is what #81 proposes from a branch cut at that base. The branch behind this request is left intact.

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.

6 participants