Skip to content

feat(bin): sync fork onto upstream main and preserve worktree commit signing - #19

Merged
7hoenix merged 165 commits into
mainfrom
fm/fork-sync-v3
Aug 27, 2026
Merged

7hoenix merged 165 commits into
mainfrom
fm/fork-sync-v3

Conversation

@7hoenix

@7hoenix 7hoenix commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Brings this fork onto the current upstream/main (kunchenguid/firstmate), adopting upstream wholesale and preserving exactly one fork feature: the commit-signing work.

What came in

  • Upstream tip adopted: ef2c3a2
  • 156 upstream commits not previously in this fork, in two hops: the first merge took upstream through 4ee4a0a, the second added the 20 commits upstream landed since (4ee4a0a..ef2c3a2).
  • Branch is 162 commits ahead of origin/main; overall origin/main -> branch is 333 files changed, +83,917 / -10,263.

Merge shape (deliberate: no rebase)

Two real two-parent merge commits, no history rewrite:

Commit Merges
d7e3d76 upstream/main (ef2c3a2)
1b8d43a origin/main (1e74e7c), accepting the rounds deletion

The pipeline ran with --skip=rebase on purpose. Rebasing would replay all 156+ upstream commits linearly onto origin/main, flatten both merge commits, and rewrite published history. The merge shape is a requirement here, not an oversight.

Definition of correct - verified

git diff upstream/main fm/fork-sync-v3 --stat at the merged tip:

 bin/fm-home-seed.sh       |   9 ++
 bin/fm-sign-lib.sh        | 202 ++++++++++++++++++++++++
 bin/fm-spawn.sh           |  25 +++
 bin/fm-teardown.sh        |  27 +++-
 tests/fm-backend.test.sh  |   2 +-
 tests/fm-gotmp.test.sh    |   5 +
 tests/fm-sign-lib.test.sh | 383 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/fm-teardown.test.sh |  64 ++++++++
 8 files changed, 715 insertions(+), 2 deletions(-)

No .agents/skills/rounds/ path. No surviving stray fork content, and no lost upstream content.

Two paths beyond the original six, and why. The task's stated target was six files. The final diff has eight, and both additions are a direct and necessary consequence of the carve-out rather than scope creep - CI caught them and the pipeline fixed them minimally:

  • tests/fm-backend.test.sh - one word added to OLD_BIN_UNCHANGED_SIBLINGS. This test runs a historical fm-teardown.sh against a fabricated bin/ tree; because the carve-out makes teardown source fm-sign-lib.sh, that sibling has to be in the list or the old teardown cannot source it.
  • tests/fm-gotmp.test.sh - two ln -s lines adding fm-sign-lib.sh to the same kind of fake bin/ fixture, for the same reason.

Neither changes any upstream behavior; both just teach existing fixtures that teardown has a new sibling dependency. They are the honest cost of carrying the carve-out, and they add two small recurring conflict points on future upstream syncs.

(Line counts grew from the original 474 as validation hardened bin/fm-sign-lib.sh and extended tests/fm-sign-lib.test.sh - see "Review hardening" below.) No .agents/skills/rounds/ path appears. git merge-tree against origin/main is clean, so this merges without conflict.

Rounds is gone by intent. .agents/skills/rounds/ and bin/fm-rounds-queue.sh do not exist upstream, and the adoption drops them. The origin/main merge hit a modify/delete conflict there (fork PR #18 had modified it) and it was resolved by accepting the deletion. That resolution is what makes this branch mergeable. Verified: zero remaining references to the rounds skill or its queue script.

What changes about how firstmate operates

This is the part worth reading - these files are the live fleet's operating rules.

New governance rule: captain instruction precedence

AGENTS.md gains a top-level "Captain instruction precedence" section: a current, explicit, concrete captain instruction now overrides a conflicting standing rule, provided it names the specific action or bounded object. It explicitly forbids inferring an override, broadening scope, or converting a request into standing authority, and destructive/irreversible/security-sensitive/discard/merge actions still require the captain to state the concrete action.

Hard rule 1 is loosened

"Never write to a project" now carries a concrete captain-approved project operation exception: firstmate may directly edit, create, move, or delete project files when the captain clearly and concretely approves in the moment for a specific project. Previously every project write went through a crewmate. Force, discard, unlanded-work, and merge boundaries stay independently in force.

Captain address reverts to mandatory

Upstream requires direct address in every response ("mandatory respectful address, not performance"). Fork PR #6 had relaxed this to a preference-deferring default; that relaxation is dropped.

Remote secondmate infrastructure - ADDED

The fm-remote-* family is added by upstream: 12 scripts, 4,071 insertions, 0 deletions (remote home provisioning/seeding, a job worker and job lib, delta reads, an inherit-push path, a doctor, and remote secondmate control). (An earlier note in this task's brief claimed these were removed - that was a diff-direction error. They are added.) Secondmates can now be provisioned on remote hosts, with whole-home remote routes.

Scripts

  • 58 scripts added under bin/, including the fm-remote-* family, process-event sources (fm-procevent*), public follow-ups (fm-public-followup*), busy-event supervision (fm-busy-lib.sh, fm-busy-event.sh), decision holds (fm-decision-hold.sh), PR polling/migration (fm-pr-poll.sh, fm-pr-check-migrate.sh), a startup memory budget, a test runner, and bin/backends/herdr-workspace-move.py.
  • One genuine upstream deletion: bin/fm-dispatch-select.sh, removed upstream in fix(bin): remove vestigial dispatch selector kunchenguid/firstmate#1026 as a vestigial dispatch selector. Quota-balanced dispatch is now the quota-array-dispatch agent skill instead of a shell selector.
  • Four fork-only scripts dropped with the adoption: fm-nm-clone-config.sh, fm-pause-ack.sh, fm-rounds-queue.sh, fm-toon-lib.sh.
  • Verified: zero dangling references to any of the five removed scripts.

Skills

Added: ahoy, ask-user-authority, decision-hold-lifecycle, diagnostic-reasoning, process-event-sources, project-management, quota-array-dispatch. Removed: rounds. 21 new docs.

AXI tool floors raised - bootstrap will start reporting

Upstream raises the enforced minimums. Three installed tools now fall below them:

Tool Installed New floor
gh-axi 0.1.28 0.1.29
lavish-axi 0.1.43 0.1.45
tasks-axi 0.2.3 0.2.4 (FM_TASKS_AXI_MIN, new file bin/fm-tasks-axi-lib.sh)

Bootstrap will report all three once this lands. The tasks-axi floor is the one with teeth: fm-decision-hold.sh, fm-backlog-receive.sh, and fm-backlog-handoff.sh hard-refuse below it, so local backlog and decision-hold operations will fail until npm install -g tasks-axi@0.2.4 is run.

Fork commits: superseded vs dropped

15 fork-only commits existed. Because the branch now differs from upstream only by the signing files, every fork change other than signing is gone - either reimplemented upstream or dropped.

Preserved (the carve-out): 2c22a96 scoped commit-signing disable, plus its ceb363f / 68f991e follow-ups, rebuilt on upstream's structure.

Superseded by upstream's own implementation:

Dropped outright:

Both of those last two are good candidates for upstream contributions rather than fork carve-outs, which is why they were not re-added here - re-adding either would break the definition-of-correct check above.

Judgment calls a reasonable person could have made differently

  • bin/fm-home-seed.sh was the only content conflict. Upstream restructured it for remote secondmate homes (7809ab9) and parent bindings (30b18b9); the fork scoped the signing override to the task and restored it when a treehouse return is refused. Resolved by rebuilding the fork's signing-override intent on top of upstream's new structure rather than taking either side wholesale. Taking either side wholesale would have been simpler and wrong.
  • #10 and #8 were deliberately not re-added. Keeping the diff-vs-upstream to exactly the signing files was treated as the stronger invariant. Someone could reasonably have argued the fleet-sync regression is worth a second carve-out.
  • Merge over rebase. A linear rebuild on upstream would give cleaner history, but only pays off if origin/main is force-pushed, which is not authorized.
  • bin/fm-sign-lib.sh is missing from docs/scripts.md. That file is the authoritative bin/ toolbelt inventory, and taking upstream wholesale dropped the fork's row for the signing lib (it existed at 1e74e7c:docs/scripts.md:31). The row was deliberately not re-added: doing so would put a seventh path in the diff above - which this task treats as a bug - and would plant a permanent conflict point in an upstream-owned file on every future sync. The cost is discoverability only: nothing enforces inventory completeness (no lint or test reads docs/scripts.md, and bin/fm-doc-audience-check.sh passes), and that file's own preamble designates each script's header comment as the authoritative description, which fm-sign-lib.sh and its three hook sites carry in full. Someone could reasonably prefer the seventh path over the index gap.

Review hardening

The validation gate found three issues in the signing carve-out and two were fixed inside it (the third was informational):

  1. extensions.worktreeConfig written without a safety guard. disable_worktree_commit_signing enabled that extension on a project repo's shared common config without first checking core.worktree / core.bare, which git-config(1) requires be moved to config.worktree first. On a repo cloned with --separate-git-dir, a submodule checkout, or a bare-main-plus-linked-worktrees pool layout, that write breaks every worktree of the repo, persists after teardown, and lands in a repo firstmate does not own. Now guarded by a refusal (the caller's existing warning path fires). This write was pre-existing and unchanged from origin/main; it was not introduced by this merge.

  2. Stale signing override leaking to reused pool slots. The worktree-scoped commit.gpgsign=false was cleared in only two places, but a slot can leave firstmate's control without either running - a teardown that refuses on dirty or unlanded work, a manual treehouse return --force, or lease reclamation. The slot then re-entered the pool still carrying the override, so subsequent human use produced silently unsigned commits under the operator's own identity. The step-0 gate made it self-concealing: the leftover false read as "already disabled", so the mechanism never repaired or reported it. disable_worktree_commit_signing now unconditionally clears any pre-existing per-worktree override before evaluating that gate.

A follow-up review round then caught a real hole in the new guard from (1): its escape clause accepted the key being present in both the common config and config.worktree. That is still hazardous, because a linked worktree's $GIT_DIR is .git/worktrees/<id>, so the main worktree's config.worktree is never read by linked worktrees and cannot neutralize the common-config value - which is exactly why git requires these keys be moved, not copied. The guard now refuses whenever the common config itself carries core.worktree or core.bare=true. This is strictly tighter and breaks nothing that previously passed, since the existing accept-path test performs a real move.

New coverage was added for both, inside tests/fm-sign-lib.test.sh.

Local test suite: mostly environment gaps, plus two real breaks CI caught

The local full-suite walk was red across 34 files. Nearly all of it is machine environment rather than this change - but not all of it, and the exceptions matter:

Two genuine breaks caused by the carve-out. tests/fm-backend.test.sh and tests/fm-gotmp.test.sh failed because fm-teardown.sh now sources fm-sign-lib.sh and their fabricated bin/ fixtures did not provide that sibling. Local triage wrongly bucketed these with the environmental noise; CI caught them and the pipeline fixed both minimally (see the two extra paths above). This is exactly the case for treating CI, not the local walk, as authoritative.

The remaining causes are environmental:

1. 1Password commit signing (~42 suites). The log carries 276 1Password: failed to fill whole buffer errors cascading into 295 fatal: failed to write commit object. Test fixtures create throwaway git repos that inherit the operator's global commit.gpgsign=true + gpg.ssh.program=op-ssh-sign, and op-ssh-sign cannot authorize in that context, so every test that makes a commit fails.

Verified by direct experiment rather than inference:

  • tests/fm-review-diff.test.sh fails identically at 1b8d43a, before any of the hardening commits, in an untouched worktree - so the carve-out changes did not cause it.
  • The same test passes 5/5 under GIT_CONFIG_GLOBAL=/dev/null, isolating signing as the sole cause.

This is the same class as the previously-investigated teardown-suite failure, which was already settled as a wedged toolchain rather than a code defect. Harness-level signing isolation is deliberately out of scope here.

2. tasks-axi below the newly enforced floor (2 suites). tests/fm-decision-hold-lifecycle.test.sh and tests/fm-backlog-handoff.test.sh fail on compatible tasks-axi is required - the 0.2.3-vs-0.2.4 floor described above. fm-decision-hold-lifecycle.test.sh is byte-identical to upstream and bin/fm-tasks-axi-lib.sh did not exist on origin/main at all, so both arrived with the merge rather than being caused by it. Verified passing 9/9 against tasks-axi 0.2.4.

A few backend suites (herdr, zellij, kimi, pi) also fail for want of runtimes that are not installed on this machine.

3. ShellCheck not installed locally (lint step). The local lint gate exited 127 with fm-lint.sh: ShellCheck not found. CI installs a pinned ShellCheck via bin/fm-install-shellcheck.sh and runs the same bin/fm-lint.sh, so lint is genuinely enforced there rather than skipped. As a local substitute, every script under bin/ and bin/backends/ was parse-checked with bash -n at the final head - all clean, including the hardened bin/fm-sign-lib.sh.

None of these three causes exists on GitHub Actions: CI has no 1Password signing configured, installs tasks-axi unpinned (resolving to 0.2.4), and installs pinned ShellCheck. Per .no-mistakes.yaml, .github/workflows/ci.yml is the owner of broad regression coverage, so CI is the authoritative signal for this branch.

Recommended follow-up on the operator's machine

npm install -g tasks-axi@0.2.4. Until then bin/fm-decision-hold.sh, bin/fm-backlog-receive.sh, and bin/fm-backlog-handoff.sh hard-refuse, so local backlog and decision-hold operations fail. gh-axi and lavish-axi are also below their new floors and will start being reported by bootstrap, though nothing in this branch depends on them.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped

Step was skipped.

🔧 **Review** - 3 issues found → auto-fixed (2) ✅
  • ⚠️ bin/fm-sign-lib.sh:84 - disable_worktree_commit_signing enables extensions.worktreeConfig on the SHARED common config, but the header's safety proof (lines 35-39) is scoped only to "firstmate's clone" ("core.bare=false ... core.worktree is unset. Verified"). The function is not limited to that clone: for ship/scout tasks fm-spawn.sh:1767 passes $WT, a treehouse worktree of an arbitrary operator project repo under projects/<name>. Git documents that before enabling this extension you must move core.worktree, and core.bare when true, out of $GIT_COMMON_DIR/config into config.worktree; there is no such guard or migration here. Concrete failing sequence: an operator project repo whose common config carries core.worktree (e.g. cloned with --separate-git-dir, or a submodule checkout) or core.bare=true (a bare main repo with linked worktrees, a common pool layout) AND global commit.gpgsign=true. fm-spawn leases a worktree, calls disable_worktree_commit_signing, git writes extensions.worktreeConfig=true into that repo's common config, and from then on those two keys apply to every worktree of the repo instead of just the main one: with core.worktree set, git commands in each pooled worktree resolve to the captain's primary working tree; with core.bare=true, every worktree fails with "this operation must be run in a work tree". The damage is repo-wide, persists after teardown (nothing ever removes extensions.worktreeConfig), and hits a repo firstmate does not own. tests/fm-sign-lib.test.sh:44 covers only the safe core.bare=false shape. Note this specific write is unchanged from origin/main, so it is pre-existing rather than introduced here. Suggested remedy: in disable_worktree_commit_signing, before writing the extension, refuse (return non-zero so the caller's existing warning fires) when the common config has core.worktree set or core.bare=true and no config.worktree already holds them.
  • ⚠️ bin/fm-sign-lib.sh:97 - The worktree-scoped commit.gpgsign=false/tag.gpgsign=false override is cleared in exactly two places - teardown's return (bin/fm-teardown.sh:1022) and seed rollback (bin/fm-home-seed.sh:592) - but the pool slot can leave firstmate's control without either running. Concrete failing sequence: a task worktree gets the disable at fm-spawn.sh:1767; teardown then exits before reaching the return at fm-teardown.sh:2282 (a dirty/landed-work refusal, or a refused return that fm-teardown.sh's own header says it deliberately leaves in place for the operator); the captain recovers by running treehouse return --force by hand, which is the documented manual remedy. The slot goes back into the pool still carrying commit.gpgsign=false in .git/worktrees/<slot>/config.worktree, so any subsequent human use of that slot produces silently unsigned commits under the operator's identity, and treehouse's own reclamation of an expired lease has the same effect. The step-0 gate at bin/fm-sign-lib.sh:83 makes this undetectable from inside the mechanism: worktree_signing_is_in_effect resolves commit.gpgsign to the leftover false, so a later disable_worktree_commit_signing returns 0 as a silent no-op and never repairs or reports the stale state. Exposure is bounded (the next firstmate task's teardown does clear it), which is why this is a warning and not an error. Suggested remedy: have disable_worktree_commit_signing unconditionally clear any pre-existing per-worktree override before evaluating the gate, so a slot never carries a disable it did not earn from the current task.
  • ℹ️ bin/fm-home-seed.sh:594 - restore_worktree_commit_signing_override is justified in bin/fm-sign-lib.sh:112-116 by "the worktree is still ours and may still hold a live agent" - true for teardown, but not for seed rollback. fm-home-seed leases the home at line 398 and the signing disable is applied much later by fm-spawn.sh:1767, so during rollback the home has no override and no live agent (seeding refuses to convert populated homes in place). Concrete sequence: the treehouse return at line 593 fails, restore then calls disable_worktree_commit_signing, which - because the firstmate repo's inherited config signs - WRITES a commit.gpgsign=false/tag.gpgsign=false override that never existed before, onto a still-leased slot for an id whose seed just failed. No teardown will ever run for that id, so nothing clears it and it feeds the stale-override path above. Impact is small and the failure is already an operator-recovery situation, so this is informational: the restore here is a compensating action for a clear that had nothing to compensate.

🔧 Fix: guard worktreeConfig footgun keys and clear stale signing overrides
2 issues (1 warning, 1 info) still open:

  • ⚠️ bin/fm-sign-lib.sh:127 - The new guard's escape clause makes it return "safe" on a shape that is still hazardous. worktree_config_extension_is_safe refuses only when the common config carries core.worktree (or core.bare=true) AND $GIT_COMMON_DIR/config.worktree does not also hold it. But the hazard is the key's PRESENCE IN THE COMMON CONFIG, not its absence from config.worktree: each worktree reads only its own $GIT_DIR/config.worktree, and for a linked worktree $GIT_DIR is .git/worktrees/<id>, so the MAIN worktree's config.worktree is never read by linked worktrees and cannot neutralize the common-config value for them. That is why git-config(1) says these keys must be MOVED from $GIT_COMMON_DIR/config to $GIT_COMMON_DIR/config.worktree, not copied. Concrete failing sequence: an operator project repo where core.worktree is present in BOTH .git/config and .git/config.worktree (a copy-then-forget-to-delete migration, or tooling that writes both), plus global commit.gpgsign=true. fm-spawn.sh:1767 calls disable_worktree_commit_signing on a treehouse worktree of that repo; line 127's first condition is false because config.worktree holds the key, line 131's is likewise false for core.bare, the gate returns 0, and line 158 writes extensions.worktreeConfig=true into the common config. Every linked worktree of that repo now honors the common config's core.worktree and resolves at the main working tree - precisely the damage this guard was added to prevent, on a repo firstmate does not own, persisting after teardown. Remedy: drop both config.worktree escape clauses and refuse whenever $GIT_COMMON_DIR/config itself carries core.worktree or core.bare=true. This is strictly tighter and breaks nothing that currently passes: tests/fm-sign-lib.test.sh:236-237 (test_allows_migrated_footgun_keys) performs a real move - it writes core.bare into $bare/config.worktree and then runs git -C &#34;$bare&#34; config --unset core.bare - so it still exercises the accept path under the stricter rule. It also collapses worktree_config_extension_is_safe to two straight-line checks and removes the two long inline command substitutions on lines 127 and 131.
  • ℹ️ bin/fm-sign-lib.sh:1 - Informational, for the PR description rather than the code. The intent's DEFINITION OF CORRECT states git diff upstream/main fm/fork-sync-v3 --stat must show "ONLY those 6 signing files (474 insertions, 1 deletion) and nothing else". After dd3dd97 it shows the same 6 paths with 679 insertions, 1 deletion. The binding clause - "Any other path appearing there would be a bug" - still holds exactly: bin/fm-home-seed.sh, bin/fm-sign-lib.sh, bin/fm-spawn.sh, bin/fm-teardown.sh, tests/fm-sign-lib.test.sh, tests/fm-teardown.test.sh and nothing else, with no new files created. The 474 figure was a snapshot ("That currently holds") taken before the same user explicitly authorized extending these files in round 1, so this is not a contradiction - but the PR body should quote 679/1 so the captain is not checking against a stale number.

🔧 Fix: refuse worktreeConfig footgun keys copied but not moved
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 error
  • 🚨 tests failed with exit code 1
  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"
⚠️ **Document** - 2 infos
  • ℹ️ docs/scripts.md:7 - docs/scripts.md is the authoritative bin/ toolbelt inventory (audience operator-current), and taking upstream wholesale replaced the fork's copy, dropping its row for bin/fm-sign-lib.sh (present at base 1e74e7c:docs/scripts.md:31). The script still exists and is the fork's sole surviving carve-out, so the inventory is now incomplete. I deliberately did NOT add the row: doing so would make git diff upstream/main fm/fork-sync-v3 --stat show a 7th path, which the user intent marks explicitly as a bug, and it would plant a permanent conflict point in an upstream-owned file on every future sync. Mitigating factors: nothing enforces inventory completeness (no lint or test references docs/scripts.md; bin/fm-doc-audience-check.sh passes), the file's own preamble designates each script's header comment as the authoritative description of its behavior and contracts, and bin/fm-sign-lib.sh's header plus the fm-spawn.sh/fm-teardown.sh/fm-home-seed.sh hook comments fully and accurately document the mechanism. The residual cost is discoverability only. Captain's call: accept the index gap as the price of a code-only carve-out, or accept a 7th path in the upstream diff.
  • ℹ️ The intent's DEFINITION OF CORRECT cites 474 insertions, 1 deletion; the branch tip now shows 6 files changed, 709 insertions(+), 1 deletion(-). The binding part of the criterion still holds exactly - only those same 6 signing files appear - and the growth is entirely from the two later review commits (dd3dd97, 99e5747) hardening bin/fm-sign-lib.sh. Flagging only so the PR body does not ship the stale 474 figure; no repo file states it, so there is nothing for me to edit.
⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

kunchenguid and others added 30 commits July 13, 2026 14:20
…id#533)

* fix: preserve secondmate routing markers

* no-mistakes(review): Captain, preserve trailing newlines in marked secondmate sends

* no-mistakes(test): Captain, tolerate bootstrap timeout elapsed drift

* no-mistakes(document): Refresh Herdr marker documentation
* fix: align grok effort docs and spawn with 0.2.99 ceiling

grok 0.2.99 accepts only low|medium|high for --reasoning-effort and
rejects both xhigh and max. Omit unsupported values on spawn, flag them
in crew-dispatch validation, and update harness-adapters.

* no-mistakes(test): Captain: refresh gotmp teardown fixture dependencies

* no-mistakes(document): Clarify Grok effort documentation ownership
…#555)

* fix: make bearings use secondmate home state

* test: anonymize bearings fixtures

* no-mistakes(review): Bound parent activity evidence scans, captain

* no-mistakes(review): Preserve structured secondmate authority and bounds, captain

* no-mistakes(review): Preserve registry completeness and child inventory, captain

* no-mistakes(review): Reconcile parent evidence by verb and key, captain

* no-mistakes(review): Treat unkeyed parent evidence as inconclusive, captain

* no-mistakes(document): Document bearings local snapshot and PR opt-in

* no-mistakes(lint): Fix fleet snapshot ShellCheck findings

* no-mistakes: apply CI fixes
* fix: restore stock macOS snapshot parsing

* no-mistakes(document): Clarify Linux gate and macOS CI coverage
…d#587)

* fix: close away-mode blocker supervision gap

* no-mistakes(review): Gate teardown retries and verify U+2063 dedupe

* no-mistakes(test): Fail closed on incomplete Pi composer separators

* no-mistakes(document): Document Pi composer recognition and return gating
* support Pi max thinking profiles

* no-mistakes(review): Captain, allow Pi max dispatch profiles
…nguid#595)

* Clarify validation response ownership

* no-mistakes(document): Clarify yolo response ownership
* Add instruction owners foundation

* no-mistakes(document): Refresh project-management owner pointers
…kunchenguid#626)

* docs: compress firstmate operating contract

* docs: make delivery rigor single-owner

PR B already removed personal and stacked review requirements, but it did not explicitly assign rigor to the selected delivery path or forbid risk-based manual clean gates. That gap still permitted the Hi Bit inversion.

* no-mistakes(review): Honor configured merge authority across faster delivery paths

* no-mistakes(document): Align docs with compressed operating contract
* Add durable captain decision holds

* no-mistakes(review): Validate decision hold retries and origin paths

* no-mistakes(review): Enforce durable decision lifecycle boundaries

* no-mistakes(review): Harden decision display and partial retry recovery

* no-mistakes(test): Update scout teardown fixtures for decision inventory

* no-mistakes(document): Align decision lifecycle and scout teardown documentation

* no-mistakes: apply CI fixes

* no-mistakes(review): Reconcile terminal decision holds

* no-mistakes(document): Align captain decision-hold documentation
* fix: harden PR check artifacts

* fix: close PR check migration gaps

* fix: close PR check retry gaps

* fix: clarify migration outcomes and ESM boundary

* fix: keep failed migrations authoritative

* test: use inert PR validation fixtures

* no-mistakes(review): Reserve noncanonical PR quarantine namespace

* no-mistakes(review): Prevalidate final PR-check teardown artifacts

* no-mistakes(review): Preserve X metadata and validate teardown IDs

* no-mistakes(review): Initialize migration state before watcher exclusion

* no-mistakes(review): Isolate failed poll migrations from bootstrap recovery

* no-mistakes(review): Allow safe polling during incomplete private repairs

* no-mistakes(review): Authenticate watcher checks at execution time

* no-mistakes(review): Preserve custom checks with hash-bound registration

* no-mistakes(review): Clean custom check snapshots on watcher signals

* no-mistakes(review): Stop watcher checks promptly on signals

* no-mistakes(review): Terminate watcher check groups before cleanup

* no-mistakes(document): Correct stale X-mode watcher documentation

* fix: drain returned watcher check groups

* no-mistakes(review): Harden quarantine links and recover validated replacement polls

* no-mistakes(review): Preserve X mode across shim version transitions

* no-mistakes(review): Refresh legacy X shims before marker short-circuits

* no-mistakes(document): Correct persisted PR-check artifact documentation

* no-mistakes(document): Correct stale PR-check documentation

* fix: bind PR poll repair provenance

* no-mistakes(review): Enforce single-link ownership for custom check artifacts

* no-mistakes(review): Preserve private checks, X polling, and lifecycle IDs

* no-mistakes(review): Separate task creation and legacy teardown validation

* no-mistakes(review): Restore safe legacy operations and teardown validation

* no-mistakes(review): Disambiguate migration obligations and preserve legacy retries

* no-mistakes(review): Preserve fail-closed diagnostics and legacy quarantine evidence

* no-mistakes(review): Reconcile legacy migration retries and teardown collisions

* no-mistakes(review): Force legacy namespace reconciliation before marker short-circuits

* no-mistakes(document): Document private poll artifact safety contracts

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

* fix: migrate historical X poll identity

* fix: harden PR check artifacts

* no-mistakes(review): Preserve fail-closed diagnostics and legacy quarantine evidence

* no-mistakes(review): Reconcile legacy migration retries and teardown collisions

* fix: migrate historical X poll identity

* no-mistakes(review): Harden X-mode artifact publication against symlink corruption

* no-mistakes(review): Guard X artifact publication

* no-mistakes(review): Enforce private X artifact reads

* no-mistakes(test): Fix backend compatibility fixture dependencies

* no-mistakes(document): Refresh PR-check documentation

* no-mistakes(lint): Remove unused x-mode test locals

* no-mistakes: apply CI fixes
* fix: compact session-start backlog digest

* no-mistakes(test): Fix legacy backend fixture helper

* no-mistakes(test): Fix watcher exit wait helper

* no-mistakes(document): Document compact backlog digest
* fix: dedupe stale watcher guard banner

* no-mistakes(review): Keep read-only guard state nonmutating

* no-mistakes(document): Clarify stale watcher docs
* fix: balance bearings landed defaults

* no-mistakes(document): Document balanced landed baseline

* no-mistakes: apply CI fixes
* docs: clarify captain-facing translation contract

* no-mistakes(review): Restore runtime fallback mandate

* no-mistakes(document): Align Bearings translation wording
…#646)

* fix: make bootstrap nudges deterministic

* no-mistakes(review): Honor state override for bootstrap nudges

* no-mistakes(review): Update benign bootstrap documentation labels

* no-mistakes(review): Validate bootstrap nudge retry markers

* no-mistakes(document): Align bootstrap nudge documentation

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

* Clarify concise secondmate registry contract

* no-mistakes(review): Expand secondmate registry boilerplate coverage

* no-mistakes(document): Point route docs to owner
…kunchenguid#654)

* fix(bin): strip quotes on blocked_by in decision-hold resolve

tasks-axi quotes multi-entry blocked_by as "a,b,c", so the comma-boundary
membership test only matched middle elements. Strip surrounding quotes
before matching so first and last hold ids resolve correctly.

* no-mistakes(document): Refresh decision-hold regression evidence
* feat(secondmate): inherit shared captain preferences

* no-mistakes(review): Honor shared captain data overrides

* no-mistakes(review): Honor bootstrap data override registry

* no-mistakes(document): Refresh shared inheritance docs

* no-mistakes(document): Clarify inherited local-material docs
* feat(spawn): gate local agent secret injection

* fix(spawn): align final Keychain slot

* no-mistakes: apply CI fixes
* test: isolate herdr autodetect smoke session

* no-mistakes(review): Restored autodetect smoke gate bypass

* no-mistakes(test): Harden Herdr lab provisioning

* no-mistakes(document): Refresh Herdr lab docs
* fix(pi): distinguish stale locks when arming watcher

* no-mistakes(test): Stabilize watcher extension async waits

* no-mistakes(document): Document Pi lock recovery
* fix: accept secondmate as house vocabulary

* no-mistakes(test): Update captain vocabulary contract test

* no-mistakes(document): Align secondmate documentation vocabulary
…uid#686)

* fix: parse secondmate home after pre-field parentheses

Registry summaries often include parentheticals before the structured
(home: ...) field. Match that field with a greedy prefix so handoff
no longer reports "has no home" for those entries.

* no-mistakes(document): Refresh handoff test comments
* feat: add native session-start nudges

* no-mistakes(document): Document nudge script inventory
…nguid#688)

Relabel absent-captain and related domain defaults wording so it names
the firstmate repo rather than treating "template" as this domain's
identity label. Keep the design-tenet "shared template" statements and
unrelated launch/PR-poll template uses unchanged.
…nsion (kunchenguid#205)

* fix(bin): use set -u-safe empty-array expansion in pr-merge and spawn

Expanding "${arr[@]}" on an empty array under set -u fails on bash < 4.4
(notably macOS bash 3.2). Quote the portable "${arr[@]+"${arr[@]}"}" idiom
in fm-pr-merge and fm-spawn batch dispatch so empty arrays expand to nothing.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(brief): harden fm-brief regression coverage for parse and scaffolds

Tighten bash -n checking, pin literal backtick rendering in the no-mistakes
DOD wording assertion, and keep a scout/secondmate scaffold smoke test so the

Co-authored-by: Cursor <cursoragent@cursor.com>
kunchenguid#166 apostrophe regression cannot return unnoticed.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
…nchenguid#693)

* fix: make watcher supervision continuous

* no-mistakes(review): Bound watcher retries and log attached signals

* no-mistakes(review): Add bounded successor-recovery wake fallbacks

* no-mistakes(review): Prevent overlapping successor-arm retries

* no-mistakes(review): Resume supervision after late arm closes

* no-mistakes(review): Bind OpenCode recovery to attempted arm

* no-mistakes(test): Synchronize peer beacon regression fixture

* no-mistakes(test): Synchronize Pi and OpenCode late-close lifecycle fixtures

* no-mistakes(document): Captain: document watcher successor protocol behavior

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes
7hoenix and others added 29 commits August 3, 2026 05:40
Take upstream/main's tree exactly: this merge commit's tree is byte-identical
to upstream/main. The fork's 14 local commits are shelved for one-at-a-time
reintegration rather than resolved here.
An autonomous crewmate inherits the operator's global git config, so a
commit.gpgsign=true backed by an interactive signer (1Password on this host)
hangs every unattended commit.

fm-sign-lib.sh scopes commit/tag signing off to the one worktree via git's
per-worktree config namespace; the primary checkout, sibling pooled worktrees,
and the captain's own repos keep normal signing.
* 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
Adopt upstream wholesale through 20 further commits. The only carve-out is
the worktree-scoped commit-signing work, rebuilt on upstream's new
fm-home-seed.sh structure. Rounds is dropped by intent.
Bring in fork commit #18. Its target, .agents/skills/rounds/SKILL.md, does
not exist upstream and the adoption deletes it; accept the deletion so the
branch is mergeable.
@7hoenix
7hoenix merged commit 7eccfce into main Aug 27, 2026
14 of 15 checks passed
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.