Skip to content

test(pi): pin before_agent_start run without prompt - #7387

Merged
kunchenguid merged 1 commit into
kunchenguid:mainfrom
thelad-dev:fm/fm-pi-prompt-regressionstest-20261016
Oct 16, 2026
Merged

kunchenguid merged 1 commit into
kunchenguid:mainfrom
thelad-dev:fm/fm-pi-prompt-regressionstest-20261016

Conversation

@thelad-dev

Copy link
Copy Markdown
Contributor

Intent

Der Regressionstest zum Aufsichtsfehler geht als Beitrag nach oben.

Der gemeldete Abbruch ist im Standardzweig seit 8c9c67d behoben; was oben fehlt, ist die Absicherung. Der Test ist fertig: data/branch-prompt-trim-20261015/regressionstest-0547e084.patch, 13 Zeilen in tests/fm-pi-branch-extension.test.sh. Diese eine Veroeffentlichung nach github.com/kunchenguid/firstmate ist ausdruecklich genehmigt.

Inhalt des genannten Patches, damit diese Absicht ohne ihn lesbar bleibt (Commit "test(pi): Lauf ohne prompt in before_agent_start festnageln"): Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder solche Lauf mit einem Fehler auftauchte statt zu starten. Die Verengung dagegen steht seit 8c9c67d im Zweig, ein Test, der sie benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue Fall erweitert den bestehenden Mirror-Test in tests/fm-pi-branch-extension.test.sh (test_branch_mirror_filters_order_and_cursor) und prueft, dass ein solcher Lauf weder wirft noch als Dialog gespiegelt wird. Gegenprobe: ohne die Verengung wirft genau dieser Fall mit "Cannot read properties of undefined (reading 'trim')".

What Changed

  • Extended test_branch_mirror_filters_order_and_cursor in tests/fm-pi-branch-extension.test.sh with a before_agent_start case for a sendCustomMessage-style run that has a custom message and no prompt.
  • Asserts that path neither throws nor mirrors the custom-message run as captain dialog.

Risk Assessment

✅ Low: Test-only change that exercises the already-landed custom-message narrowing via the public fire path, matches the stated intent, and introduces no production behavior.

Testing

Ran the targeted mirror test including the new sendCustomMessage-style custom/no-prompt case; it passed under the 8c9c67d narrowing. Removing only that narrowing in a fixture reproduced Cannot read properties of undefined (reading 'trim'), matching the stated Gegenprobe. No product failure found.

Evidence: Pass with fix: test_branch_mirror_filters_order_and_cursor

Source: Pass with fix: test_branch_mirror_filters_order_and_cursor

ok - dialog mirror filters tool and operational traffic, lands before wakes, and keeps a durable cursor === exit: 0 ===

=== focused regression: test_branch_mirror_filters_order_and_cursor ===
=== branch: HEAD @ 45c50545 ===
=== includes custom before_agent_start case (no prompt) ===
ok - dialog mirror filters tool and operational traffic, lands before wakes, and keeps a durable cursor
=== exit: 0 ===
Evidence: Counterproof without narrowing reproduces trim crash

Source: Counterproof without narrowing reproduces trim crash

COUNTERPROOF_ERROR=Cannot read properties of undefined (reading 'trim') ok - counterproof: without narrowing, custom before_agent_start throws on prompt.trim

mutated-ok
COUNTERPROOF_ERROR=Cannot read properties of undefined (reading 'trim')
ok - counterproof: without narrowing, custom before_agent_start throws on prompt.trim
Evidence: Combined regression e2e transcript (fix site, new test, pass, counterproof)

Source: Combined regression e2e transcript (fix site, new test, pass, counterproof)

=== NEW TEST BLOCK (tests/fm-pi-branch-extension.test.sh) ===
commit 45c505455000c7f84cdc5d7dcf699e667ea33a93
Author: thelad-dev <ladwein@firstmate.bost8.thelad.loc>
Date:   Fri Oct 16 06:49:04 2026 +0200

    test(pi): Lauf ohne prompt in before_agent_start festnageln
    
    Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
    keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
    solche Lauf mit einem Fehler auftauchte statt zu starten.
    
    Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
    benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
    Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
    Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
    Lauf weder wirft noch als Dialog gespiegelt wird.
    
    Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
    "Cannot read properties of undefined (reading 'trim')".

diff --git a/tests/fm-pi-branch-extension.test.sh b/tests/fm-pi-branch-extension.test.sh
index 4a6f8efe..615c897a 100644
--- a/tests/fm-pi-branch-extension.test.sh
+++ b/tests/fm-pi-branch-extension.test.sh
@@ -3216,6 +3216,19 @@ if (mirrored.some((m) => m.content.includes("operational injection") || m.conten
   throw new Error("mirror leaked operational, tool, or merge-note traffic");
 }
 
+// A run that pi.sendCustomMessage starts carries a custom message and no
+// prompt, so reading the prompt here threw and every such run surfaced the
+// failure instead of starting. It is not captain input either, so nothing of
+// it reaches the mirror.
+const mirroredBeforeCustomRun = session.ops.filter((op) => op.kind === "custom").length;
+await fire("before_agent_start", {
+  messageType: "custom",
+  message: { role: "custom", customType: "fm-branch-merge", content: "merge note that starts its own run" },
+}, ctx);
+if (session.ops.filter((op) => op.kind === "custom").length !== mirroredBeforeCustomRun) {
+  throw new Error("a custom-message run was mirrored as captain dialog");
+}
+
 // The durable cursor advances: a second turn_end mirrors only NEW dialog.
 entries.push({ type: "message", message: { role: "user", content: "actually, task-7 may merge when green" } });
 await fire("turn_end", {}, ctx);

=== FIX SITE still present (8c9c67de narrowing) ===
    // SessionManager still contains only the preceding dialog, so relying on
    // getEntries() here loses the captain request that the next wake may answer.
    // Stage it verbatim and remember the future persisted index for turn_end's
    // duplicate suppression. Operational extension injections are not dialog.
    if (event.messageType === "custom") {
      processingOpenedThisRun = isProcessingCustomMessage(event.message) &&
        queuedProcessingContent !== null && event.message.content === queuedProcessingContent;
      return;
    }
    const prompt = event.prompt;
    processingOpenedThisRun = queuedProcessingContent !== null && prompt === queuedProcessingContent;
    const trimmed = prompt.trim();
    if (!trimmed || isOperationalUserText(trimmed)) return;
    const file = currentMainSession.getSessionFile() ?? "";
    const index = mirrorCollection.collectAnchor?.index ?? currentMainSession.getEntries().length;
    pendingMirror.push({ tag: "captain", text: trimmed });

=== COUNTERPROOF (same custom event, narrowing removed in fixture only) ===
mutated-ok
COUNTERPROOF_ERROR=Cannot read properties of undefined (reading 'trim')
ok - counterproof: without narrowing, custom before_agent_start throws on prompt.trim

=== PASS WITH FIX ===
=== focused regression: test_branch_mirror_filters_order_and_cursor ===
=== branch: HEAD @ 45c50545 ===
=== includes custom before_agent_start case (no prompt) ===
ok - dialog mirror filters tool and operational traffic, lands before wakes, and keeps a durable cursor
=== exit: 0 ===
Evidence: Evidence index for reviewers

Source: Evidence index for reviewers

Evidence for: test(pi) custom before_agent_start without prompt

User intent: publish the regression that a sendCustomMessage-started run
(custom message, no prompt) must neither throw nor mirror as captain dialog.
Fix already landed in 8c9c67de; this change only adds the named test coverage.

1) pass-with-fix.txt
   Ran tests/fm-pi-branch-extension.test.sh :: test_branch_mirror_filters_order_and_cursor
   including the new before_agent_start custom/no-prompt case. Result: ok.

2) counterproof-without-narrowing.txt
   Same executable path with the custom early-return removed from a fixture
   copy of fm-branch-supervision.ts only. Result:
   COUNTERPROOF_ERROR=Cannot read properties of undefined (reading 'trim')
   Matches the intent's stated Gegenprobe.

3) regression-e2e-transcript.txt
   Combined transcript of fix site, new test block, pass, and counterproof.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • bash focused runner of tests/fm-pi-branch-extension.test.sh → test_branch_mirror_filters_order_and_cursor (includes new custom/no-prompt before_agent_start case)
  • Manual counterproof: same custom before_agent_start path against a fixture copy of .pi/extensions/fm-branch-supervision.ts with the messageType === &#34;custom&#34; early-return removed
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67d im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".
@thelad-dev

Copy link
Copy Markdown
Contributor Author

The red check here isn't a test failure: Behavior portable serial 2 was cancelled by the runner after about 30 minutes - conclusion cancelled, not failed. The other 18 checks are green, and the diff is 13 lines in one test file. Could someone re-run that one shard? I can't trigger it from my side.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @thelad-dev, you're right. Behavior portable serial 2 was cancelled at the runner's 30-minute ceiling (a known flake class), not a test failure. I've re-run just that shard.

I reviewed the tip against main 1a6714f2. It's 13 test-only lines in tests/fm-pi-branch-extension.test.sh that pin the messageType === "custom" early return, which is still on main in .pi/extensions/fm-branch-supervision.ts. The new case already passed in serial 4, and Require no-mistakes is green. Once the serial 2 re-run comes back green this merges, and there's nothing you need to do.

@kunchenguid
kunchenguid merged commit 5f2b81b into kunchenguid:main Oct 16, 2026
36 of 37 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @thelad-dev — really appreciate you taking the time on this.

witt3rd added a commit to witt3rd/firstmate that referenced this pull request Oct 21, 2026
* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): name the failing step when a contribution observation is unavailable (#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes #6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs #6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <konrad.heimel@corp.ovh.com>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/f…
Pibomeister added a commit to Pibomeister/firstmate that referenced this pull request Oct 22, 2026
…ort kept (#15)

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's own temp
dir, and runs cleanup once. Test-only; assertions are unchanged.

* no-mistakes(document): List paseo in FM_BACKEND and README backend lists

* no-mistakes(document): Add paseo to backend dependency docs and lists

* no-mistakes(document): docs: list paseo among Command Code refused backends

* no-mistakes(document): Note Paseo as unstyled in opencode footer record

* fix(skills): keep recovery-skill triggers inside Claude Code's listing budget (#7545) (#7558)

Claude Code lists skill descriptions within a budget of 1% of the context
window and drops the least-invoked skills' descriptions first, which are
the rarely-loaded recovery skills whose descriptions AGENTS.md section 13
uses as the trigger index.

- Remove the decision-hold-lifecycle redirect stub; nothing on main
  points briefs at it any more (captain-hold-lifecycle owns the policy and
  docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh
  shim).
- Tighten the longest skill descriptions to their load triggers, keeping
  every trigger. Total description size drops from 11312 to 6142
  characters across the listing.
- Document /doctor, /skill-doctor, skillListingBudgetFraction, and
  skillOverrides "name-only" in the Claude harness adapter notes as
  opt-in, home-local vendor settings.

No session-start budget warning or other default-on surface is added.

* fix(extension): launch lifecycle helpers through verified Bash (#7563)

* fix(extension): launch lifecycle helpers through verified Bash

The extension host spawned bin/fm-procevent.sh directly with
shell:false, which native Windows Node rejects with spawn EFTYPE because
it cannot run a script through its shebang. Resolve an absolute Bash
from $BASH or PATH, verify it with a short probe (on Windows it must
report an MSYS or Cygwin OSTYPE, so WSL bash.exe is skipped), and pass
the script as its first argument. The child keeps shell:false, the
sanitized environment, literal argv, and the existing failure mapping.

Fixes #7559

* no-mistakes(review): Harden lifecycle Bash interpreter verification

* no-mistakes(document): Document lifecycle Bash verification contract

* fix(extension): try exported BASH only on Windows for lifecycle helpers

* feat(bin): add an opt-in no-mistakes home resolver for host reads (#7348)

Sites that run one no-mistakes daemon per isolated workspace keep each
task's runs in a per-workspace NM_HOME that cannot be derived from the
shared gate remote, so crew state, pipeline spend, and teardown read the
wrong home.

When NM_HOME is unset and config/nm-home-resolver names a site-provided
executable, fm-nm-run-lib.sh now calls it with the task copy path and
exports the printed home for that one call. Only host reads (axi status,
the axi overview, axi logs, runs, daemon status, the state database) and
axi abort --run use it. An explicit NM_HOME always wins, and with no file
behaviour is unchanged.

Fixes #7309

* feat(bin): defer wedge escalation for a worker's own open blocked/needs-decision line (#7361)

* feat(bin): let a worker's own open blocked: or needs-decision: line defer wedge escalation behind config/wedge-defer-worker-wait

Opt-in only: absent the flag the wedge ladder is unchanged. Counts only the worker's own newest line (reserved keys excluded via status_own_open_decisions), defers onto the existing bounded recheck with a verb-specific clearing action and no escalation-count increase, and ends on any newer status line or a newer acknowledged inbox record. The away daemon honors the same evidence before escalating an enriched wedge.

Refs #6899

* no-mistakes(document): Document worker-wait deferral in wait-evidence lists

* feat(brief): forbid leading cd in generated scout and ship briefs (#7481)

* feat: support per-mate secondmate runtime pins (#6917)

* feat(bin): pin per-mate secondmate runtime overrides in config/secondmate-harness

A single default pin line gives every secondmate one runtime, so raising the
default pin silently migrates a mate the captain ruled onto its own runtime.
config/secondmate-harness now accepts optional
"mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and
fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the
secondmate id as an optional second argument that selects that line.

Spawn, the control-plane relaunch, and the secondmate restart each pass the
mate id they already know, so all three resolve one decision. A malformed pin
file is refused with its line number and prints no token instead of resolving
around it to the default runtime.

* no-mistakes(review): Bypass unused pins during explicit secondmate relaunch

* no-mistakes(document): Correct and consolidate per-mate runtime pin documentation

* fix: preserve legacy secondmate pin parsing without overrides

* fix(bin): keep legacy secondmate pin files opt-in

config/secondmate-harness is documented as "the first non-empty, non-comment
line is parsed". The per-mate override grammar made the whole file strict, so
a second default line or a fourth token started refusing every secondmate
spawn, relaunch, and restart - even in a home that never wrote a mate line.
That changed how an existing, already-valid file is read, so the feature was
not opt-in.

Scope the strict whole-file parse to files that declare at least one
"mate <secondmate-id>:" line. A file with no mate line parses exactly as
before: first non-empty, non-comment line, the rest ignored, a fourth token
ignored, nothing refused. A file that does declare a mate line keeps the
strict parsing, so a duplicate override, a malformed entry, or an extra token
still refuses loudly with its line number.

Coverage: a legacy file with a second default line and a fourth token now
spawns, relaunches, and restarts a mate onto its first line; a declaring file
that is malformed refuses each of those paths with the offending line; and an
explicit --harness/--model/--effort relaunch succeeds whatever the pin file
holds, because the config read stays behind the explicit-harness guard.

* no-mistakes(document): Document per-mate secondmate runtime pins

* no-mistakes(ci): Fixed `tests/fm-backend-herdr-presentation-e2e.test.sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)

* feat(bin): add fm-capacity.sh to report open lanes and host headroom (#6973)

Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.

* fix(bin): bound repeat stale alarms for unknown-but-alive progressing panes (#7437)

* fix: bound unknown-live watcher alarms

* no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG

* no-mistakes(review): Keep watch.env loading only in the watcher arm

* no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test

* no-mistakes(document): List config/watch.env in operational home layout

* no-mistakes(review): Narrow watch.env docs to arm-launched watchers

---------

Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>

* fix(bin): honor explicit no-run verdict in crew-state (#5888)

* fix(bin): honour the no-run verdict from axi status in crew-state

* no-mistakes(review): Honor authoritative no-run verdict across fallbacks

* no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck

* no-mistakes(document): document authoritative no-run verdict in crew-state attribution

* fix(composer): recognize Grok approval-titled borders (#6132)

* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer

* no-mistakes(document): Document Grok’s aligned approval title

* no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure

* no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths

* fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown

Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from
bin/fm-teardown.sh. The top-level source already names that file. Point
the second directive at /dev/null and leave the runtime source unchanged.

* docs: record Grok 1.0.44's approval-titled composer border

The verification record scoped its titled-bottom-border note to the Grok
1.0.5 three-column overhang but never recorded the newer shape this branch
accepts, so a maintainer could not tell the two cases apart or know what a
Grok upgrade re-verifies.

Add a dated record of the 1.0.44 shape - the typed model/effort title plus
its ` · always-approve` suffix, drawn inside a rounded bottom border at the
aligned width - with the live verdicts that prove it, the portable test that
owns it, and the fail-safe verdict every neighbouring title keeps.

* no-mistakes(review): Narrow Grok composer coverage claims to verified matrix

* no-mistakes(document): Correct stale Grok verification notes

* docs: trigger CI re-run for flaky shard 4

Behavior portable serial 4 failed on the previous head with one assertion
only, `not ok - the NUL-bearing line was not captured`, in the unchanged
remote-reply and relay path; its fixture hardcodes /bin/sleep, direct NUL
ingestion passes, and the other 19 checks were green. GitHub refused a job
re-run for this fork PR, so this empty commit is the re-trigger. No content
change.

* no-mistakes(document): Clarify Grok live guard verification scope

* fix(composer): restrict Grok approval titles to rounded borders

Reject light, heavy, double, and ASCII approval-title boxes at the shared
classifier boundary. Only the rounded family has recorded live evidence,
and an empty verdict grants permission to type into the pane.

Cover denied families through tmux and cursorless backend profiles while
preserving rounded idle, draft, malformed-title, and legacy behavior.

* no-mistakes(document): Refresh Grok composer verification evidence

* no-mistakes(ci): Fixed the stale local link in `docs/verification/runtime-backends.md`; the section heading’s anchor had changed. `tests/fm-documentation-audiences.test.sh` passes

* fix(bin): point non-checkout omp homes at fm <project> relaunch (#7155)

* fix(omp): point non-checkout homes at fm <project> relaunch and name why the extension is not loaded

* no-mistakes(review): Remove unset-FM_HOME omp watch cause line

* feat(fm-watch): bound consecutive wedge escalations behind an opt-in cap (#7552)

* feat(fm-watch): bound consecutive wedge escalations per worker window

An unattended watcher escalation loop once burned ~359M tokens in a day: the
watcher keeps re-escalating a pane it believes is wedged, and nothing bounded
how many times it did that for one worker window.

Add an opt-in ceiling on consecutive wedge escalations for a single window.
At FM_WEDGE_MAX_ESCALATIONS the watcher publishes one terminal
PERMANENTLY-WEDGED wake and writes both cap markers, after which the wedge
path short-circuits for that window until FM_CAP_HORIZON_SECS elapses or an
operator removes both markers. A pane hash chang…
kunchenguid added a commit that referenced this pull request Oct 24, 2026
* fix(bin): make fm-send.sh --help print usage before FM_HOME resolution

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's own temp
dir, and runs cleanup once. Test-only; assertions are unchanged.

* no-mistakes(document): List paseo in FM_BACKEND and README backend lists

* no-mistakes(document): Add paseo to backend dependency docs and lists

* no-mistakes(document): docs: list paseo among Command Code refused backends

* no-mistakes(document): Note Paseo as unstyled in opencode footer record

* fix(skills): keep recovery-skill triggers inside Claude Code's listing budget (#7545) (#7558)

Claude Code lists skill descriptions within a budget of 1% of the context
window and drops the least-invoked skills' descriptions first, which are
the rarely-loaded recovery skills whose descriptions AGENTS.md section 13
uses as the trigger index.

- Remove the decision-hold-lifecycle redirect stub; nothing on main
  points briefs at it any more (captain-hold-lifecycle owns the policy and
  docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh
  shim).
- Tighten the longest skill descriptions to their load triggers, keeping
  every trigger. Total description size drops from 11312 to 6142
  characters across the listing.
- Document /doctor, /skill-doctor, skillListingBudgetFraction, and
  skillOverrides "name-only" in the Claude harness adapter notes as
  opt-in, home-local vendor settings.

No session-start budget warning or other default-on surface is added.

* fix(extension): launch lifecycle helpers through verified Bash (#7563)

* fix(extension): launch lifecycle helpers through verified Bash

The extension host spawned bin/fm-procevent.sh directly with
shell:false, which native Windows Node rejects with spawn EFTYPE because
it cannot run a script through its shebang. Resolve an absolute Bash
from $BASH or PATH, verify it with a short probe (on Windows it must
report an MSYS or Cygwin OSTYPE, so WSL bash.exe is skipped), and pass
the script as its first argument. The child keeps shell:false, the
sanitized environment, literal argv, and the existing failure mapping.

Fixes #7559

* no-mistakes(review): Harden lifecycle Bash interpreter verification

* no-mistakes(document): Document lifecycle Bash verification contract

* fix(extension): try exported BASH only on Windows for lifecycle helpers

* feat(bin): add an opt-in no-mistakes home resolver for host reads (#7348)

Sites that run one no-mistakes daemon per isolated workspace keep each
task's runs in a per-workspace NM_HOME that cannot be derived from the
shared gate remote, so crew state, pipeline spend, and teardown read the
wrong home.

When NM_HOME is unset and config/nm-home-resolver names a site-provided
executable, fm-nm-run-lib.sh now calls it with the task copy path and
exports the printed home for that one call. Only host reads (axi status,
the axi overview, axi logs, runs, daemon status, the state database) and
axi abort --run use it. An explicit NM_HOME always wins, and with no file
behaviour is unchanged.

Fixes #7309

* feat(bin): defer wedge escalation for a worker's own open blocked/needs-decision line (#7361)

* feat(bin): let a worker's own open blocked: or needs-decision: line defer wedge escalation behind config/wedge-defer-worker-wait

Opt-in only: absent the flag the wedge ladder is unchanged. Counts only the worker's own newest line (reserved keys excluded via status_own_open_decisions), defers onto the existing bounded recheck with a verb-specific clearing action and no escalation-count increase, and ends on any newer status line or a newer acknowledged inbox record. The away daemon honors the same evidence before escalating an enriched wedge.

Refs #6899

* no-mistakes(document): Document worker-wait deferral in wait-evidence lists

* feat(brief): forbid leading cd in generated scout and ship briefs (#7481)

* feat: support per-mate secondmate runtime pins (#6917)

* feat(bin): pin per-mate secondmate runtime overrides in config/secondmate-harness

A single default pin line gives every secondmate one runtime, so raising the
default pin silently migrates a mate the captain ruled onto its own runtime.
config/secondmate-harness now accepts optional
"mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and
fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the
secondmate id as an optional second argument that selects that line.

Spawn, the control-plane relaunch, and the secondmate restart each pass the
mate id they already know, so all three resolve one decision. A malformed pin
file is refused with its line number and prints no token instead of resolving
around it to the default runtime.

* no-mistakes(review): Bypass unused pins during explicit secondmate relaunch

* no-mistakes(document): Correct and consolidate per-mate runtime pin documentation

* fix: preserve legacy secondmate pin parsing without overrides

* fix(bin): keep legacy secondmate pin files opt-in

config/secondmate-harness is documented as "the first non-empty, non-comment
line is parsed". The per-mate override grammar made the whole file strict, so
a second default line or a fourth token started refusing every secondmate
spawn, relaunch, and restart - even in a home that never wrote a mate line.
That changed how an existing, already-valid file is read, so the feature was
not opt-in.

Scope the strict whole-file parse to files that declare at least one
"mate <secondmate-id>:" line. A file with no mate line parses exactly as
before: first non-empty, non-comment line, the rest ignored, a fourth token
ignored, nothing refused. A file that does declare a mate line keeps the
strict parsing, so a duplicate override, a malformed entry, or an extra token
still refuses loudly with its line number.

Coverage: a legacy file with a second default line and a fourth token now
spawns, relaunches, and restarts a mate onto its first line; a declaring file
that is malformed refuses each of those paths with the offending line; and an
explicit --harness/--model/--effort relaunch succeeds whatever the pin file
holds, because the config read stays behind the explicit-harness guard.

* no-mistakes(document): Document per-mate secondmate runtime pins

* no-mistakes(ci): Fixed `tests/fm-backend-herdr-presentation-e2e.test.sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)

* feat(bin): add fm-capacity.sh to report open lanes and host headroom (#6973)

Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.

* fix(bin): bound repeat stale alarms for unknown-but-alive progressing panes (#7437)

* fix: bound unknown-live watcher alarms

* no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG

* no-mistakes(review): Keep watch.env loading only in the watcher arm

* no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test

* no-mistakes(document): List config/watch.env in operational home layout

* no-mistakes(review): Narrow watch.env docs to arm-launched watchers

---------

Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>

* fix(bin): honor explicit no-run verdict in crew-state (#5888)

* fix(bin): honour the no-run verdict from axi status in crew-state

* no-mistakes(review): Honor authoritative no-run verdict across fallbacks

* no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck

* no-mistakes(document): document authoritative no-run verdict in crew-state attribution

* fix(composer): recognize Grok approval-titled borders (#6132)

* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer

* no-mistakes(document): Document Grok’s aligned approval title

* no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure

* no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths

* fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown

Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from
bin/fm-teardown.sh. The top-level source already names that file. Point
the second directive at /dev/null and leave the runtime source unchanged.

* docs: record Grok 1.0.44's approval-titled composer border

The verification record scoped its titled-bottom-border note to the Grok
1.0.5 three-column overhang but never recorded the newer shape this branch
accepts, so a maintainer could not tell the two cases apart or know what a
Grok upgrade re-verifies.

Add a dated record of the 1.0.44 shape - the typed model/effort title plus
its ` · always-approve` suffix, drawn inside a rounded bottom border at the
aligned width - with the live verdicts that prove it, the portable test that
owns it, and the fail-safe verdict every neighbouring title keeps.

* no-mistakes(review): Narrow Grok composer coverage claims to verified matrix

* no-mistakes(document): Correct stale Grok verification notes

* docs: trigger CI re-run for flaky shard 4

Behavior portable serial 4 failed on the previous head with one assertion
only, `not ok - the NUL-bearing line was not captured`, in the unchanged
remote-reply and relay path; its fixture hardcodes /bin/sleep, direct NUL
ingestion passes, and the other 19 checks were green. GitHub refused a job
re-run for this fork PR, so this empty commit is the re-trigger. No content
change.

* no-mistakes(document): Clarify Grok live guard verification scope

* fix(composer): restrict Grok approval titles to rounded borders

Reject light, heavy, double, and ASCII approval-title boxes at the shared
classifier boundary. Only the rounded family has recorded live evidence,
and an empty verdict grants permission to type into the pane.

Cover denied families through tmux and cursorless backend profiles while
preserving rounded idle, draft, malformed-title, and legacy behavior.

* no-mistakes(document): Refresh Grok composer verification evidence

* no-mistakes(ci): Fixed the stale local link in `docs/verification/runtime-backends.md`; the section heading’s anchor had changed. `tests/fm-documentation-audiences.test.sh` passes

* fix(bin): point non-checkout omp homes at fm <project> relaunch (#7155)

* fix(omp): point non-checkout homes at fm <project> relaunch and name why the extension is not loaded

* no-mistakes(review): Remove unset-FM_HOME omp watch cause line

* feat(fm-watch): bound consecutive wedge escalations behind an opt-in cap (#7552)

* feat(fm-watch): bound consecutive wedge escalations per worker window

An unattended watcher escalation loop once burned ~359M tokens in a day: the
watcher keeps re-escalating a pane it believes is wedged, and nothing bounded
how many times it did that for one worker window.

Add an opt-in ceiling on consecutive wedge escalations for a single window.
At FM_WEDGE_MAX_ESCALATIONS the watcher publishes one terminal
PERMANENTLY-WEDGED wake and writes both cap markers, after which the wedge
path short-circuits for that window until FM_CAP_HORIZON_SECS elapses or an
o…
speechybubble added a commit to speechybubble/firstmate that referenced this pull request Oct 28, 2026
* fix: require explicit authority for Firstmate upstream contributions (#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

* fix(pi): narrow before_agent_start events before reading prompt (#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): name the failing step when a contribution observation is unavailable (#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes #6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs #6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <konrad.heimel@corp.ovh.com>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now…
bnvinay92 added a commit to bnvinay92/firstmate that referenced this pull request Oct 29, 2026
* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's own temp
dir, and runs cleanup once. Test-only; assertions are unchanged.

* no-mistakes(document): List paseo in FM_BACKEND and README backend lists

* no-mistakes(document): Add paseo to backend dependency docs and lists

* no-mistakes(document): docs: list paseo among Command Code refused backends

* no-mistakes(document): Note Paseo as unstyled in opencode footer record

* fix(skills): keep recovery-skill triggers inside Claude Code's listing budget (#7545) (#7558)

Claude Code lists skill descriptions within a budget of 1% of the context
window and drops the least-invoked skills' descriptions first, which are
the rarely-loaded recovery skills whose descriptions AGENTS.md section 13
uses as the trigger index.

- Remove the decision-hold-lifecycle redirect stub; nothing on main
  points briefs at it any more (captain-hold-lifecycle owns the policy and
  docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh
  shim).
- Tighten the longest skill descriptions to their load triggers, keeping
  every trigger. Total description size drops from 11312 to 6142
  characters across the listing.
- Document /doctor, /skill-doctor, skillListingBudgetFraction, and
  skillOverrides "name-only" in the Claude harness adapter notes as
  opt-in, home-local vendor settings.

No session-start budget warning or other default-on surface is added.

* fix(extension): launch lifecycle helpers through verified Bash (#7563)

* fix(extension): launch lifecycle helpers through verified Bash

The extension host spawned bin/fm-procevent.sh directly with
shell:false, which native Windows Node rejects with spawn EFTYPE because
it cannot run a script through its shebang. Resolve an absolute Bash
from $BASH or PATH, verify it with a short probe (on Windows it must
report an MSYS or Cygwin OSTYPE, so WSL bash.exe is skipped), and pass
the script as its first argument. The child keeps shell:false, the
sanitized environment, literal argv, and the existing failure mapping.

Fixes #7559

* no-mistakes(review): Harden lifecycle Bash interpreter verification

* no-mistakes(document): Document lifecycle Bash verification contract

* fix(extension): try exported BASH only on Windows for lifecycle helpers

* feat(bin): add an opt-in no-mistakes home resolver for host reads (#7348)

Sites that run one no-mistakes daemon per isolated workspace keep each
task's runs in a per-workspace NM_HOME that cannot be derived from the
shared gate remote, so crew state, pipeline spend, and teardown read the
wrong home.

When NM_HOME is unset and config/nm-home-resolver names a site-provided
executable, fm-nm-run-lib.sh now calls it with the task copy path and
exports the printed home for that one call. Only host reads (axi status,
the axi overview, axi logs, runs, daemon status, the state database) and
axi abort --run use it. An explicit NM_HOME always wins, and with no file
behaviour is unchanged.

Fixes #7309

* feat(bin): defer wedge escalation for a worker's own open blocked/needs-decision line (#7361)

* feat(bin): let a worker's own open blocked: or needs-decision: line defer wedge escalation behind config/wedge-defer-worker-wait

Opt-in only: absent the flag the wedge ladder is unchanged. Counts only the worker's own newest line (reserved keys excluded via status_own_open_decisions), defers onto the existing bounded recheck with a verb-specific clearing action and no escalation-count increase, and ends on any newer status line or a newer acknowledged inbox record. The away daemon honors the same evidence before escalating an enriched wedge.

Refs #6899

* no-mistakes(document): Document worker-wait deferral in wait-evidence lists

* feat(brief): forbid leading cd in generated scout and ship briefs (#7481)

* feat: support per-mate secondmate runtime pins (#6917)

* feat(bin): pin per-mate secondmate runtime overrides in config/secondmate-harness

A single default pin line gives every secondmate one runtime, so raising the
default pin silently migrates a mate the captain ruled onto its own runtime.
config/secondmate-harness now accepts optional
"mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and
fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the
secondmate id as an optional second argument that selects that line.

Spawn, the control-plane relaunch, and the secondmate restart each pass the
mate id they already know, so all three resolve one decision. A malformed pin
file is refused with its line number and prints no token instead of resolving
around it to the default runtime.

* no-mistakes(review): Bypass unused pins during explicit secondmate relaunch

* no-mistakes(document): Correct and consolidate per-mate runtime pin documentation

* fix: preserve legacy secondmate pin parsing without overrides

* fix(bin): keep legacy secondmate pin files opt-in

config/secondmate-harness is documented as "the first non-empty, non-comment
line is parsed". The per-mate override grammar made the whole file strict, so
a second default line or a fourth token started refusing every secondmate
spawn, relaunch, and restart - even in a home that never wrote a mate line.
That changed how an existing, already-valid file is read, so the feature was
not opt-in.

Scope the strict whole-file parse to files that declare at least one
"mate <secondmate-id>:" line. A file with no mate line parses exactly as
before: first non-empty, non-comment line, the rest ignored, a fourth token
ignored, nothing refused. A file that does declare a mate line keeps the
strict parsing, so a duplicate override, a malformed entry, or an extra token
still refuses loudly with its line number.

Coverage: a legacy file with a second default line and a fourth token now
spawns, relaunches, and restarts a mate onto its first line; a declaring file
that is malformed refuses each of those paths with the offending line; and an
explicit --harness/--model/--effort relaunch succeeds whatever the pin file
holds, because the config read stays behind the explicit-harness guard.

* no-mistakes(document): Document per-mate secondmate runtime pins

* no-mistakes(ci): Fixed `tests/fm-backend-herdr-presentation-e2e.test.sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)

* feat(bin): add fm-capacity.sh to report open lanes and host headroom (#6973)

Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.

* fix(bin): bound repeat stale alarms for unknown-but-alive progressing panes (#7437)

* fix: bound unknown-live watcher alarms

* no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG

* no-mistakes(review): Keep watch.env loading only in the watcher arm

* no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test

* no-mistakes(document): List config/watch.env in operational home layout

* no-mistakes(review): Narrow watch.env docs to arm-launched watchers

---------

Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>

* fix(bin): honor explicit no-run verdict in crew-state (#5888)

* fix(bin): honour the no-run verdict from axi status in crew-state

* no-mistakes(review): Honor authoritative no-run verdict across fallbacks

* no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck

* no-mistakes(document): document authoritative no-run verdict in crew-state attribution

* fix(composer): recognize Grok approval-titled borders (#6132)

* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer

* no-mistakes(document): Document Grok’s aligned approval title

* no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure

* no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths

* fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown

Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from
bin/fm-teardown.sh. The top-level source already names that file. Point
the second directive at /dev/null and leave the runtime source unchanged.

* docs: record Grok 1.0.44's approval-titled composer border

The verification record scoped its titled-bottom-border note to the Grok
1.0.5 three-column overhang but never recorded the newer shape this branch
accepts, so a maintainer could not tell the two cases apart or know what a
Grok upgrade re-…
Pibomeister added a commit to Pibomeister/firstmate that referenced this pull request Oct 30, 2026
…he fork (#52)

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's own temp
dir, and runs cleanup once. Test-only; assertions are unchanged.

* no-mistakes(document): List paseo in FM_BACKEND and README backend lists

* no-mistakes(document): Add paseo to backend dependency docs and lists

* no-mistakes(document): docs: list paseo among Command Code refused backends

* no-mistakes(document): Note Paseo as unstyled in opencode footer record

* fix(skills): keep recovery-skill triggers inside Claude Code's listing budget (#7545) (#7558)

Claude Code lists skill descriptions within a budget of 1% of the context
window and drops the least-invoked skills' descriptions first, which are
the rarely-loaded recovery skills whose descriptions AGENTS.md section 13
uses as the trigger index.

- Remove the decision-hold-lifecycle redirect stub; nothing on main
  points briefs at it any more (captain-hold-lifecycle owns the policy and
  docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh
  shim).
- Tighten the longest skill descriptions to their load triggers, keeping
  every trigger. Total description size drops from 11312 to 6142
  characters across the listing.
- Document /doctor, /skill-doctor, skillListingBudgetFraction, and
  skillOverrides "name-only" in the Claude harness adapter notes as
  opt-in, home-local vendor settings.

No session-start budget warning or other default-on surface is added.

* fix(extension): launch lifecycle helpers through verified Bash (#7563)

* fix(extension): launch lifecycle helpers through verified Bash

The extension host spawned bin/fm-procevent.sh directly with
shell:false, which native Windows Node rejects with spawn EFTYPE because
it cannot run a script through its shebang. Resolve an absolute Bash
from $BASH or PATH, verify it with a short probe (on Windows it must
report an MSYS or Cygwin OSTYPE, so WSL bash.exe is skipped), and pass
the script as its first argument. The child keeps shell:false, the
sanitized environment, literal argv, and the existing failure mapping.

Fixes #7559

* no-mistakes(review): Harden lifecycle Bash interpreter verification

* no-mistakes(document): Document lifecycle Bash verification contract

* fix(extension): try exported BASH only on Windows for lifecycle helpers

* feat(bin): add an opt-in no-mistakes home resolver for host reads (#7348)

Sites that run one no-mistakes daemon per isolated workspace keep each
task's runs in a per-workspace NM_HOME that cannot be derived from the
shared gate remote, so crew state, pipeline spend, and teardown read the
wrong home.

When NM_HOME is unset and config/nm-home-resolver names a site-provided
executable, fm-nm-run-lib.sh now calls it with the task copy path and
exports the printed home for that one call. Only host reads (axi status,
the axi overview, axi logs, runs, daemon status, the state database) and
axi abort --run use it. An explicit NM_HOME always wins, and with no file
behaviour is unchanged.

Fixes #7309

* feat(bin): defer wedge escalation for a worker's own open blocked/needs-decision line (#7361)

* feat(bin): let a worker's own open blocked: or needs-decision: line defer wedge escalation behind config/wedge-defer-worker-wait

Opt-in only: absent the flag the wedge ladder is unchanged. Counts only the worker's own newest line (reserved keys excluded via status_own_open_decisions), defers onto the existing bounded recheck with a verb-specific clearing action and no escalation-count increase, and ends on any newer status line or a newer acknowledged inbox record. The away daemon honors the same evidence before escalating an enriched wedge.

Refs #6899

* no-mistakes(document): Document worker-wait deferral in wait-evidence lists

* feat(brief): forbid leading cd in generated scout and ship briefs (#7481)

* feat: support per-mate secondmate runtime pins (#6917)

* feat(bin): pin per-mate secondmate runtime overrides in config/secondmate-harness

A single default pin line gives every secondmate one runtime, so raising the
default pin silently migrates a mate the captain ruled onto its own runtime.
config/secondmate-harness now accepts optional
"mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and
fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the
secondmate id as an optional second argument that selects that line.

Spawn, the control-plane relaunch, and the secondmate restart each pass the
mate id they already know, so all three resolve one decision. A malformed pin
file is refused with its line number and prints no token instead of resolving
around it to the default runtime.

* no-mistakes(review): Bypass unused pins during explicit secondmate relaunch

* no-mistakes(document): Correct and consolidate per-mate runtime pin documentation

* fix: preserve legacy secondmate pin parsing without overrides

* fix(bin): keep legacy secondmate pin files opt-in

config/secondmate-harness is documented as "the first non-empty, non-comment
line is parsed". The per-mate override grammar made the whole file strict, so
a second default line or a fourth token started refusing every secondmate
spawn, relaunch, and restart - even in a home that never wrote a mate line.
That changed how an existing, already-valid file is read, so the feature was
not opt-in.

Scope the strict whole-file parse to files that declare at least one
"mate <secondmate-id>:" line. A file with no mate line parses exactly as
before: first non-empty, non-comment line, the rest ignored, a fourth token
ignored, nothing refused. A file that does declare a mate line keeps the
strict parsing, so a duplicate override, a malformed entry, or an extra token
still refuses loudly with its line number.

Coverage: a legacy file with a second default line and a fourth token now
spawns, relaunches, and restarts a mate onto its first line; a declaring file
that is malformed refuses each of those paths with the offending line; and an
explicit --harness/--model/--effort relaunch succeeds whatever the pin file
holds, because the config read stays behind the explicit-harness guard.

* no-mistakes(document): Document per-mate secondmate runtime pins

* no-mistakes(ci): Fixed `tests/fm-backend-herdr-presentation-e2e.test.sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)

* feat(bin): add fm-capacity.sh to report open lanes and host headroom (#6973)

Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.

* fix(bin): bound repeat stale alarms for unknown-but-alive progressing panes (#7437)

* fix: bound unknown-live watcher alarms

* no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG

* no-mistakes(review): Keep watch.env loading only in the watcher arm

* no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test

* no-mistakes(document): List config/watch.env in operational home layout

* no-mistakes(review): Narrow watch.env docs to arm-launched watchers

---------

Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>

* fix(bin): honor explicit no-run verdict in crew-state (#5888)

* fix(bin): honour the no-run verdict from axi status in crew-state

* no-mistakes(review): Honor authoritative no-run verdict across fallbacks

* no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck

* no-mistakes(document): document authoritative no-run verdict in crew-state attribution

* fix(composer): recognize Grok approval-titled borders (#6132)

* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer

* no-mistakes(document): Document Grok’s aligned approval title

* no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure

* no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths

* fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown

Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from
bin/fm-teardown.sh. The top-level source already names that file. Point
the second directive at /dev/null and leave the runtime source unchanged.

* docs: record Grok 1.0.44's approval-titled composer border

The verification record scoped its titled-bottom-border note to the Grok
1.0.5 three-column overhang but never recorded the newer shape this branch
accepts, so a maintainer could not tell the two cases apart or know what a
Grok upgrade re-verifies.

Add a dated record of the 1.0.44 shape - the typed model/effort title plus
its ` · always-approve` suffix, drawn inside a rounded bottom border at the
aligned width - with the live verdicts that prove it, the portable test that
owns it, and the fail-safe verdict every neighbouring title keeps.

* no-mistakes(review): Narrow Grok composer coverage claims to verified matrix

* no-mistakes(document): Correct stale Grok verification notes

* docs: trigger CI re-run for flaky shard 4

Behavior portable serial 4 failed on the previous head with one assertion
only, `not ok - the NUL-bearing line was not captured`, in the unchanged
remote-reply and relay path; its fixture hardcodes /bin/sleep, direct NUL
ingestion passes, and the other 19 checks were green. GitHub refused a job
re-run for this fork PR, so this empty commit is the re-trigger. No content
change.

* no-mistakes(document): Clarify Grok live guard verification scope

* fix(composer): restrict Grok approval titles to rounded borders

Reject light, heavy, double, and ASCII approval-title boxes at the shared
classifier boundary. Only the rounded family has recorded live evidence,
and an empty verdict grants permission to type into the pane.

Cover denied families through tmux and cursorless backend profiles while
preserving rounded idle, draft, malformed-title, and legacy behavior.

* no-mistakes(document): Refresh Grok composer verification evidence

* no-mistakes(ci): Fixed the stale local link in `docs/verification/runtime-backends.md`; the section heading’s anchor had changed. `tests/fm-documentation-audiences.test.sh` passes

* fix(bin): point non-checkout omp homes at fm <project> relaunch (#7155)

* fix(omp): point non-checkout homes at fm <project> relaunch and name why the extension is not loaded

* no-mistakes(review): Remove unset-FM_HOME omp watch cause line

* feat(fm-watch): bound consecutive wedge escalations behind an opt-in cap (#7552)

* feat(fm-watch): bound consecutive wedge escalations per worker window

An unattended watcher escalation loop once burned ~359M tokens in a day: the
watcher keeps re-escalating a pane it believes is wedged, and nothing bounded
how many times it did that for one worker window.

Add an opt-in ceiling on consecutive wedge escalations for a single window.
At FM_WEDGE_MAX_ESCALATIONS the watcher publishes one terminal
PERMANENTLY-WEDGED wake and writes both cap markers, after which the wedge
path short-circuits for that window until FM_CAP_HORIZON_SECS elapses or an
operator removes both markers. A pane hash chang…
prajwal-395 added a commit to prajwal-395/firstmate that referenced this pull request Nov 2, 2026
* fix: avoid argument-size failures in fleet contribution snapshots (#6830)

* fix(bin): stage contribution-input JSON via temp files

The contribution-input branch passed the whole canonical backlog document to
jq as a single --argjson argv argument. A large fleet's backlog JSON exceeds
Linux MAX_ARG_STRLEN (128 KiB), so jq fails with E2BIG (Argument list too
long) and the contribution-input snapshot emits empty output, breaking the
bearings contribution path.

Write both the backlog and task documents to a temp directory and hand them
to jq with --slurpfile, matching how the full snapshot path already stages
the same pair. Output is unchanged for any backlog that fits in argv.

* no-mistakes(document): Correct contribution cleanup trap comment

* fix(bin): arm the busy contract on secondmate launches (#5342)

* fix(bin): arm the busy contract on secondmate launches

A tmux-backed secondmate's active-turn gate can only see a busy verdict from the parent home's record, and those launches never armed it.

* no-mistakes(review): Reopen secondmate busy on blocked Claude Stop; drop muse guard

* no-mistakes(review): Make Claude secondmate Stop guard the sole Stop-state writer

* no-mistakes(review): Record live rewake UserPromptSubmit evidence and add regression

* docs: record Claude secondmate Stop guard as busy writer

* no-mistakes(review): Keep Stop idle hook for older secondmate guards

* no-mistakes(document): Correct stale omp secondmate -e rationale in supervision verification

* no-mistakes(document): Fix skill-relative turnend-guard link in Claude harness reference

* no-mistakes(ci): Root cause: in shard 9, the pure-contract-unit family ran two scripts, tests/fm-rovo-harness.test.sh (14712 ms) and tests/fm-omp-harness.test.sh (10335 ms). Those two durations add up exactly to the failing family's 25047 ms. The failing one was tests/fm-omp-harness.test.sh. Its test_secondmate_launch_relies_on_discovery still asserted the old contract: that an omp secondmate launch names no -e and gets no state/<id>.omp-ext.ts. This PR (issue #4268) deliberately changed that. bin/fm-spawn.sh now arms the busy contract for omp secondmates, so their launch names `-e state/<id>.omp-ext.ts` and writes that extension. The primary extensions are still left to auto-discovery. The harness reference docs were updated to match, but the test was not. The fix is test-only and touches just tests/fm-omp-harness.test.sh. The test now asserts that the secondmate launch names exactly one -e and that it points at the parent-home state/sm.omp-ext.ts. Because only one -e is allowed, the tracked .omp/extensions files are not named a second time, which would load them twice. The test also asserts that the extension file exists, and the header comment for contract 3 was updated. The posture overlay, --cwd, marker, and supervision-model assertions are unchanged. Verification: the host's load average was about 140 on 8 cores, and the full script timed out locally after 590 s having finished only its first 2 tests. So I ran the one affected test function on its own through the real fm-spawn path, and it passed (`ok - fm-spawn: a real omp secondmate launch loads only the busy -e and auto-discovers its primary extensions`). The remaining omp tests were not re-run locally. shellcheck on the file reports only existing info-level notices. The change is left uncommitted for the outer executor

* test: keep the secondmate busy stall gate visible after main's liveness probe

The merged watcher treats a window-name inventory miss as a missing endpoint and exits a later checkpoint on the previous quiet run's recovery wake. The fake pane now answers both list-windows formats, and each observation starts without a leftover downtime marker, so a busy mate still defers the stall and an idle mate still surfaces it.

* no-mistakes(review): Align fm-spawn secondmate comments with omp -e and devin refusal

* no-mistakes(document): Document secondmate busy extensions in configuration reference

* no-mistakes(test): Make live busy-contract guard clean up read-only lab dirs

* fix(bin): pass Claude secondmate busy hooks through --settings

Rewriting a persistent mate home's settings.local.json drops the captain's saved permissions. The hooks now live in a parent-state file Claude Code loads for that session only.

* no-mistakes(review): skip busy arm for raw secondmate launch commands

* no-mistakes(review): retire earlier busy arm on raw secondmate respawn

* no-mistakes(review): retire Stop pointer on relaunch, load --settings in live guard

* no-mistakes(document): Document secondmate Claude settings file and raw-launch exception

* no-mistakes(ci): The check "Behavior portable serial 9" failed because of this PR, and I fixed it with a test-only change; `tests/fm-spawn-dispatch-profile.test.sh` now passes locally in full. Cause: the one failing test was "claude secondmate launch settings JSON does not disable Claude attribution" in `tests/fm-spawn-dispatch-profile.test.sh`. This PR makes a claude secondmate launch pass `--settings` as a file path (`state/<id>.claude-settings.json`) instead of inline JSON. The test helper `claude_settings_json_arg` handed that path string to jq as if it were JSON, so jq reported a parse error. The product behavior is correct: the file does carry `feedbackDrafts` and the attribution-off policy. Invariant: a test that checks the Claude launch settings must read the settings Claude would load, whichever form `--settings` takes (inline JSON or a file path). The only place this must hold is `claude_settings_json_arg`, the single reader of the `--settings` value in the tests. Its two callers, `assert_attribution_policy` and `assert_attribution_policy_absent`, both go through it. Fix: `claude_settings_json_arg` now prints the value when it starts with `{` and prints the file contents otherwise. No product code changed. Verification: I ran `bash tests/fm-spawn-dispatch-profile.test.sh` in the worktree. It ended with "all fm-spawn-dispatch-profile tests passed", including the previously failing secondmate case and the crewmate and keep-ai-trailers cases that use the inline form. I did not run the other tests of shard 9; they passed in the CI run and this change touches only this test file. The change is uncommitted in the worktree (one file modified)

* test: guard fleet snapshot contribution input against argument-size failures (#7036)

The large-backlog regression already proved the json and secondmate
home-summary modes stay within exec limits. It now also runs the
contribution-input mode on the same 1200-record backlog, which is the
path #6830 moved off argv. With that fix reverted the test fails with
the field error jq Argument list too long at the contribution-input call.

* fix(bin): scrub nested repos from scratch copies before treehouse return (#5843)

* fix(teardown): scrub nested repos before return

Treehouse return uses git clean -fd, which leaves a nested git
repository in the pool slot. Scout and forced teardown run
git clean -ffdq first. A return that stays dirty names the
lost slot instead of reporting a clean return.

* no-mistakes(review): Report lost pool slots early and scrub forced child copies

* no-mistakes(review): Drop misleading no-rerun clause from lost-slot message

* no-mistakes(document): Note failed status read in teardown dirty-return header

* no-mistakes(ci): I fixed ci-1 and ci-2 in bin/fm-teardown.sh, and I added tests in tests/fm-teardown.test.sh. Invariant (ci-1): a lost-slot finding must only warn. It must never change the teardown exit status. Two places must obey this: the final status block, and the remote success path that a forced remote retirement uses. - The final block no longer runs `exit 1`. When a slot is lost, teardown writes a lost-slot line to stderr instead of the clean "teardown X complete" line. Then backlog_refresh_reminder runs and teardown exits with its normal status. - Before this change, remote_secondmate_teardown discarded the remote output when the remote run succeeded. Now it sends that output to stderr. Without this, the remote lost-slot warning would not reach the operator once the remote side exits 0. - I updated the header comment to match. Invariant (ci-2): after a return that succeeds, teardown must verify every returned copy, or it must warn that it could not. This invariant is enforced inside teardown_note_dirty_return, which both return sites call (the main WT return and the forced-secondmate child return). Before, a copy that was missing or not a readable git worktree caused a silent `return 0`. Now it sets the lost flag and gives the same warning, with the text "cannot verify: the copy is missing or not a readable git worktree after return". Both call sites run only for a copy that existed before the return. The exit status does not change. Tests: - The dirty-return test now expects exit 0 and the warning. - New test (z3d): a forced secondmate teardown whose child return leaves residue. This is the same command that `retire --force` runs on the remote host. The test expects exit 0 and the warning, and it checks that the task record and the home are removed. - New test (z3e): a return that removes the copy's .git. The test expects exit 0, the "cannot verify" warning that names the copy, and no clean completion line. Verification: - I ran the new and updated tests against the old script. Three failed as expected (exit 1, or no warning). With the fix, all of them pass. - The full tests/fm-teardown.test.sh suite passes: 117 ok, 0 not ok. - shellcheck shows no new warnings. - tests/fm-remote-secondmate-lifecycle-e2e.test.sh is still running. It covers the remote success path that now relays output. Up to now it has no failures, but it has not finished, so I cannot report a final result for it

* no-mistakes(ci): I fixed ci-1 and ci-2 as one exit contract, as the user asked. The changes are in bin/fm-teardown.sh, tests/fm-teardown.test.sh, and tests/fm-remote-secondmate-lifecycle-e2e.test.sh. Invariant (ci-1): when a returned slot is dirty or cannot be verified, teardown must finish every cleanup step and then exit with exit code 4. Exit 4 is used for nothing else. It must hold in two places: the final status of a local teardown, and the remote secondmate retirement caller. - Local: the existing lost-slot flag now leads to `exit 4` (TEARDOWN_LOST_SLOT_EXIT). This exit comes after the task record is removed, the warning is printed, and backlog_refresh_reminder runs. A clean return still exits 0. Refusals and errors exit 1, and an invalid request exits 2. The header documents all of these codes. Exit 3 is only an internal "not remote" return. The ssh transport uses 255. - Remote caller: remote_secondmate_teardown treats a remote exit 4 as "retired with a lost-slot warning". It does the full local retirement (route, registry line, reply source, records, summary refresh), prints the normal completion line on stdout, and then returns 4. The remote control script runs fm-teardown.sh as its last command, and fm-on.sh execs ssh, so the remote 4 reaches the local side unchanged. Invariant (ci-2): remote output goes to local stderr only when it is a lost-slot warning. - After a clean remote retirement (exit 0), the caller no longer prints the captured remote output. - After exit 4, the caller forwards only the lost-slot warning header and the remaining-path lines. To make those lines easy to find, teardown_note_dirty_return now indents each remaining path by two spaces. Tests: - The dirty-return (z3), forced-secondmate dirty-child (z3d), and copy-removed (z3e) tests now expect exit 4 after cleanup. The clean scout return (z1) still expects 0. - The final remote retirement in the e2e test now uses a fake-ssh mode, retire-lost-slot. In this mode the real remote retire runs, and then the fake reports a lost child slot with exit 4. The test checks the following: exit 4; the remote home, parent metadata, and route are removed; stdout has "teardown ios complete (remote"; stderr has the warning and the remaining path; and stderr does not contain the remote completion text. The remote side producing exit 4 is covered by z3d. Verification: - tests/fm-teardown.test.sh: 117 ok, 0 not ok. - tests/fm-remote-secondmate-lifecycle-e2e.test.sh: ALL TESTS PASSED. - shellcheck shows the same warning count as before on all three files. - Against the previous script, both suites fail as expected. In the local suite, dirty-return expected 4 but got 0. In the e2e test, the stdout local-completion check fails

* no-mistakes(ci): Both CI failures came from the lost-slot check that this PR added. Shard 3: tests/fm-secondmate-safety.test.sh "force teardown failed to discard child work". Shard 7: tests/fm-teardown-endpoint-safety.test.sh exited 4. The check ran after the return of every copy. Treehouse return removes a copy that is not a pool slot, so the check reported "cannot verify" and teardown exited 4. Before the fix, both failures happened on my machine. Invariant: only a Treehouse pool slot can be lost by the pool, so the check runs only for a copy that was a pool slot before the return. Fix in bin/fm-teardown.sh: both return sites (the main WT return and the forced-secondmate child return) now run fm_treehouse_pool_slot before the return. They call teardown_note_dirty_return only when the copy was a pool slot. teardown_note_dirty_return lost its pool-slot branch and its unused proj argument; the slot label still comes from the path of the copy. Test fix: in tests/fm-teardown.test.sh, the z3d child copy was not a pool slot. It is now a real pool slot (pool/6/repo plus treehouse-state.json), and the test still expects exit 4 and the warning. Verification: endpoint-safety 27 ok, exit 0. secondmate-safety 79 ok, exit 0. fm-teardown 117 ok, 0 not ok. remote-secondmate-lifecycle-e2e ALL TESTS PASSED. shellcheck count is unchanged (17)

---------

Co-authored-by: Nova Agent B <novaagentb@gmail.com>

* fix(bin): pin markdown backend in backlog handoff and receive (#7047)

* fix(tests): keep backlog suites hermetic against a local .tasks.toml

Fixture homes now write the tracked markdown defaults through a
fm_test_tasks_toml helper instead of copying the checkout's .tasks.toml,
which an operator may override with a beads backend at a live backlog.

The backlog handoff and receive moves pin --backend markdown, because they
already name their markdown files and otherwise resolve the backend from the
caller's working directory. The atomicity suite runs from its scratch root so
its direct tasks-axi fixture calls cannot read the checkout config.

* no-mistakes(review): Add decoy-cwd .tasks.toml regressions for handoff and receive

* no-mistakes(lint): Reuse sha256_file helper to fix SC2015 in remote handoff test

* fix(bin): parse whole project names in home seed registry queries (#7076)

* fix(bin): parse whole project name in home seed registry queries

Parse the full project name after the dash in fm-home-seed.sh registry lookups.

This matches the round-3 bootstrap mirror check parser so spaced names resolve.

Cover both the project-less seed refusal guard and registry line lookups in tests.

* no-mistakes(review): Match registry rows by name prefix plus separator

* no-mistakes(document): Note shared registry row-match rule in fm-home-seed

* fix: preserve announced recovery across Codex checkpoints (#4490)

* fix(codex): preserve announced recovery across checkpoints

* no-mistakes(review): Make announced-recovery checkpoint test reproduce the regression

* no-mistakes(review): Separate 2026-10-07 checkpoint fixture verification from original run

* no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks

* no-mistakes(document): Update checkpoint recovery and signal documentation

* no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh

* no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks

* Revert "no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh"

This reverts commit 44ce29bfbfa95149a7785efc200f6a00b5bf3a41.

* Revert "no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks"

This reverts commit e1e37067a9369f0c38d7bd1c7a0913b1c54fc28a.

* Revert "no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks"

This reverts commit 9877bf92134e77414e25cd8e6f122ff4d089473a.

* fix: let checkpoint watcher clean up before timeout

* no-mistakes(review): Scope checkpoint timeout escalation and restore signal docs

* no-mistakes(review): Fix Perl checkpoint timeout escalation

* no-mistakes(document): Clarify checkpoint recovery documentation

* no-mistakes(document): Document isolated checkpoint regression command

* no-mistakes(ci): Tied direct-checkpoint SIGKILL escalation to the effective cleanup bound, preserving the five-second minimum and leaving the supervision-host path unchanged. The targeted checkpoint suite, shell syntax checks, ShellCheck, and diff checks pass. CI was not manually rerun

---------

Co-authored-by: jopo <jopo@JP-M2mini.local>

* feat(bin): support Forgejo/Gitea as a forge via the tea CLI (#4395)

* feat(bin): add Forgejo (tea) as a third forge alongside GitHub and GitLab

Extends the existing provider-tagged PR/MR dispatch in fm-pr-lib.sh,
fm-pr-poll.sh, fm-pr-check.sh, and fm-pr-merge.sh with a forgejo arm,
following the same pattern already established for GitLab. tea addresses a
repository by owner/repo slug only and resolves the host through a named
"tea login" rather than a URL, so the login is matched against the PR's host
fresh at arm and merge time. tea's own merge subcommand exposes no
head-binding flag, so the merge itself calls Forgejo/Gitea's REST API
directly via "tea api" with head_commit_id, verified against a real
disposable instance to behave like --match-head-commit/--sha; that same
verification found that "tea api" reports an HTTP-level failure with exit
status 0, so a merge is confirmed only by reading the pull request back
afterward, never by trusting the command's own exit code.

Adds forgejo as a value of the registry's existing forge= binding (the
closed set becomes none|gerrit|forgejo, with its refusals unchanged), so a
generated brief and its direct-PR Definition of done name tea before any PR
exists and bin/fm-spawn.sh's forge agreement and bin/fm-promote.sh carry it
like gerrit. Documents the new value in docs/configuration.md,
docs/architecture.md, and a new maintainer-verification doc mirroring
docs/gitlab-merge-watch.md.

* no-mistakes(review): Redact private Forgejo host/IP from evidence doc

* no-mistakes(review): Fix doc's tea-login JSON shape; dedupe host validators

* no-mistakes(document): Add Forgejo to README doc index and scripts.md forge list

* no-mistakes(lint): {"summary": "fix(bin): drop unused FORGEJO_LOGIN capture in fm-pr-check.sh"}

* fix(bin): refuse --allow-red on Forgejo instead of dropping it silently

The attended --allow-red waiver landed on main while the Forgejo arm was
being written, so its applicability guard only ever classified GitHub and
GitLab. On a Forgejo pull request the flag parsed, and then nothing read
it: forgejo_verify_mergeable requires the head's combined commit status to
be exactly "success", with no per-check name to match a waiver against.

The merge still refused, so no red Forgejo merge was ever possible, but it
refused without saying the waiver had been ignored. Extend the existing
GitLab guard to cover Forgejo for the same reason GitLab has it: both
collapse their checks into a single head verdict, so the green requirement
is absolute and a named waiver cannot apply.

* fix(bin): poll a Forgejo pull request by number through tea api

The merge watch listed the 50 most recent pull requests and filtered to the
watched index, so in a repository with more newer pull requests a merged
watch never fired. Read the one pull request through tea api instead and wake
only on a boolean merged field of true, since tea api exits 0 on HTTP errors.

Share the tea login match as fm_pr_forgejo_login for every sourcing script and
add fm_pr_forgejo_read_record for the state, merged flag, and head. Arming now
also requires jq, which the poll needs to read the record.

* fix(bin): gate a Forgejo merge on every status page and on draft state

The combined-status endpoint computes its state from one page of contexts, so
a failing context past the first page could leave the head reading green. Read
every page until an empty one and require each to be success. Also refuse a
pull request the API reports as a draft.

* fix(bin): prove a Forgejo task landed from its merged pull request at teardown

pr_is_merged read the recorded pr= only through gh, so a Forgejo task always
fell back to the content check and refused landed work whenever that check was
inconclusive, such as when later default-branch commits conflict with the
merged tree. Read a recorded Forgejo URL through fm_pr_forgejo_read_record and
apply the same containment check against its head.

* feat(bin): read Forgejo pull requests in crew-state and review-diff

fm-crew-state reports a terminal passed run's Forgejo pull request as open,
closed, merged, or unknown through fm_pr_forgejo_read_record, and
fm-review-diff resolves a /pulls/<n> URL to the refs/pull/<n>/head ref
Forgejo serves. Document the by-number read, the paged status gate, and the
draft gate, and mark what the evidence instance did not exercise.

* fix(bin): parse tea logins as JSON and close the remaining Forgejo gaps

The tea login match split each line of `tea login list --output json` on
quotes and read field 4, which only works while tea pretty-prints one field
per line. A login printed as one compact object put the login name where the
url belonged, so arming, merging, and polling refused every Forgejo host.
fm_pr_forgejo_login and the static poll's own copy now parse the list with
jq, matching each login's url host with scheme, userinfo, port, and path
stripped, and still refuse zero or several matches.

--allow-missing is now refused on a Forgejo pull request the way --allow-red
already is, instead of being parsed and ignored: the merge already requires
the head's combined commit status to have succeeded.

The forge=forgejo Definition of done read the draft state back with
gh-axi pr view and cleared it with gh-axi pr ready although the PR is opened
with tea; both publishing modes now read the draft state through tea api and
clear Forgejo's work-in-progress title prefix with tea pulls edit.

* no-mistakes(review): Retry Forgejo merge confirmation read before failing

* no-mistakes(document): Document Forgejo draft gate and merge confirmation retry

* fix(bin): merge Forgejo pull requests with the repository's default style

When the caller named no merge method, a Forgejo merge always sent Do=merge,
so a repository that allows only squash or rebase merges refused every
default call. The style now comes from the repository's own
default_merge_style, read live through the same tea login, and a merge is
refused when that value cannot be read or is not a known style rather than
replaced by one chosen here. A method the caller names still wins.

---------

Co-authored-by: dna <dna@local>

* fix: prevent concurrent secondmate relaunch races (#7154)

* fix: serialize secondmate liveness relaunches across task set

* no-mistakes(review): Remove relaunch wait override and test bounded contention

* no-mistakes(document): Clarify secondmate relaunch locking and timeout documentation

* chore: keep local Stele binding out of shared template

* no-mistakes(document): Correct stale secondmate recovery timing comment

* chore: exclude local Stele binding from relaunch fix

* ci: retrigger CI after a timed-out test shard

* no-mistakes(document): Correct secondmate recovery ordering documentation

* fix: require explicit authority for Firstmate upstream contributions (#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

* fix(pi): narrow before_agent_start events before reading prompt (#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): name the failing step when a contribution observation is unavailable (#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes #6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs #6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <konrad.heimel@corp.ovh.com>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(t…
peterOC26 added a commit to peterOC26/firstmate that referenced this pull request Nov 9, 2026
* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <konrad.heimel@corp.ovh.com>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which …
mfylkesnes added a commit to mfylkesnes/firstmate that referenced this pull request Nov 9, 2026
* fix: require explicit authority for Firstmate upstream contributions (#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

* fix(pi): narrow before_agent_start events before reading prompt (#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): name the failing step when a contribution observation is unavailable (#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes #6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs #6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <konrad.heimel@corp.ovh.com>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requ…
remicaesar added a commit to remicaesar/firstmate that referenced this pull request Nov 11, 2026
* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's own temp
dir, and runs cleanup once. Test-only; assertions are unchanged.

* no-mistakes(document): List paseo in FM_BACKEND and README backend lists

* no-mistakes(document): Add paseo to backend dependency docs and lists

* no-mistakes(document): docs: list paseo among Command Code refused backends

* no-mistakes(document): Note Paseo as unstyled in opencode footer record

* fix(skills): keep recovery-skill triggers inside Claude Code's listing budget (#7545) (#7558)

Claude Code lists skill descriptions within a budget of 1% of the context
window and drops the least-invoked skills' descriptions first, which are
the rarely-loaded recovery skills whose descriptions AGENTS.md section 13
uses as the trigger index.

- Remove the decision-hold-lifecycle redirect stub; nothing on main
  points briefs at it any more (captain-hold-lifecycle owns the policy and
  docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh
  shim).
- Tighten the longest skill descriptions to their load triggers, keeping
  every trigger. Total description size drops from 11312 to 6142
  characters across the listing.
- Document /doctor, /skill-doctor, skillListingBudgetFraction, and
  skillOverrides "name-only" in the Cla…
JacyAnderson added a commit to JacyAnderson/firstmate that referenced this pull request Nov 11, 2026
* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Fix away branch relaunch admission (#7444)

* fix(bin): show reported checks when a pull request's base requires none (#7450)

Port the reported-check fallback and regressions from df605386963686dff138f89bea84541c0ade6c96. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs #6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs #7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation

* fix: require positive daemon running status in crew-state (#7317)

* fix(tests): stabilize supervision host drain and offer fixtures (#7467)

* fix(bin): refuse spawn into a project with an unborn HEAD (#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes

* feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record

* test(tests): stop orphan-storm fixture failing on slow launches (#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry

* fix: honor gh-resolved publication targets (#7540)

* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection

* feat(bin): add Paseo as an experimental session backend (#4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on #4484 and #3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's…
jredgard added a commit to jredgard/firstmate that referenced this pull request Nov 15, 2026
…cts (#57)

* feat(bin): add opt-in local Claude usage threshold warner (#7421)

* feat(bin): add opt-in local Claude usage threshold warner

A usage window is exhausted without warning: work is cut off mid-run
rather than stopping deliberately, and nothing says a window is close to
its cap until it is already gone.

bin/fm-usage-warner.sh is a threshold warner, not a usage viewer.
quota-axi is already the one Claude-quota reader this repo depends on
(bin/fm-quota-axi-lib.sh), so the warner runs that existing read rather
than adding a second reader that could drift from it: one bounded
`quota-axi --provider claude --json --full --no-credential-refresh`, the
snapshot validated with fm_quota_json_valid, and the provider row picked
with the same FM_QUOTA_ROW_JQ join the dispatch consumers use, under
schema 5 and schema 6 alike.

Thresholds are `<window-id>:<percent>` directives in config/usage-warner,
naming quota-axi's own window ids (five_hour, seven_day, model:<name>)
rather than a second vocabulary, and compared against each window's own
percentUsed. Naming the window is the point: the session and weekly
windows exhaust at very different times, so a figure that does not say
which window is close misleads.

One read with two callers and no new schedule: `check` is what a human
runs on demand and what the watcher runs on its ordinary check-shim
cadence once `arm` registers state/usage-warner.check.sh through
bin/fm-check-register.sh. There is no daemon.

Warnings post through macOS Notification Center with the same osascript
call bin/fm-supervise-daemon.sh's wedge alarm makes, without sourcing or
coupling to that daemon's away-mode-specific config and rate limiting.
Delivery is edge-triggered against state/.usage-warner: a crossing warns
once, stays quiet while it holds, and re-arms when the window next reads
back below its threshold, the same standing-report contract
fm-mail-check.sh and fm-tool-update-check.sh already use.

bin/fm-procevent-quota.sh already reads the same snapshot, so docs name
the boundary rather than leaving two similar surfaces unexplained. That
source fires at most once, wakes firstmate with a durable check event,
and compares a provider's aggregate effectivePercentRemaining. This
warner is the standing, human-facing half: per-window, delivered to the
person through Notification Center, and self-re-arming. Neither replaces
the other and arming both is reasonable.

Opt-in is load-bearing and enforced in code. With no valid directive,
`check` returns before any read and `arm` refuses, so an unconfigured
home gains no behaviour change, no new failure mode, and no new hard
dependency at dispatch. Notification Center is macOS-only, so `arm`
refuses on other platforms instead of registering a check that could
never speak.

The warner only warns. It does not stop or pace dispatch, and its
coverage is exactly what quota-axi can see locally, so a plan or
organisation spend cap quota-axi does not report is not covered; the doc
says so rather than implying coverage it does not have.

The new test script carries no measured CI duration hint yet, so the
portable-serial lane balances it on the conservative default until the
hints are next refreshed from a green run, per docs/fm-test-portable-shards.md.

* no-mistakes(review): Key usage-warner de-dupe on window and threshold; fix docs

* no-mistakes(review): Keep absent-window crossings recorded; stub osascript in tests

* no-mistakes(document): Document absent-window de-dupe carry-forward in usage-warner header

* fix: correct Rex secondmate grouping and lifecycle (#7656)

* Fix Rex secondmate session lifecycle

* no-mistakes(review): Retire Rex secondmate sessions under the owning home identity

* no-mistakes(review): Limit Rex FM_ROOT label override to secondmate launches

* no-mistakes(document): Clarify Rex secondmate grouping and lifecycle documentation

* feat(opencode): add OpenCode 2 support with version-gated launch, plugins, and exit (#7336)

* feat(opencode): add OpenCode 2 support with version-gated launch and plugins

OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.*
plugins now export a default definition with an id and a setup function
alongside their legacy OpenCode 1 server export, backed by a new shared
lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check,
pretool-check, and sessionstart-nudge install their behavior from setup(ctx)
on OpenCode 2 and keep the server entrypoint for OpenCode 1.

fm-spawn probes the resolved opencode executable's --version once and branches
the launch, model flag, reasoning config, exit key, and busy-state plugin off
the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model,
the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the
session.execution.* busy plugin); OpenCode 1.x and any undetected or
unparseable version fall back to the 1.x shape (--model, 1.x config, /exit)
everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1
keeps the pre-port session.status/session.idle plugin so its busy-state wiring
is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter
and supervision docs, OpenCode 2 live fixtures, and regression tests for the
unknown->1.x launch path and the version-gated busy-plugin shape are included.

* no-mistakes(review): gate OpenCode 2 busy plugin turn-end touch on notifyTurnEnd

* feat(opencode): launch detected OpenCode 2 workers with --standalone

OpenCode 2's default launch attaches to the shared background service, which
hosts plugins with the service's environment and ignores the pane's
OPENCODE_CONFIG_CONTENT. A private server keeps per-worker model, permissions,
FM_HOME, and lock ancestry correct. 1.x and undetected versions are unchanged.

Ported from https://github.com/kunchenguid/firstmate/pull/5143.

Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>

* fix(opencode): resolve the OpenCode 2 project location and treat every terminal turn as a turn end

OpenCode 2.0.x hands plugins the project only as ctx.location.project.directory
and takes ctx.session.prompt({ sessionID, text }), so the V2 setup path never
found its root or delivered a prompt. Interrupted and failed turns now end a
turn like a succeeded one, while a server shutdown does not.

Ported from https://github.com/kunchenguid/firstmate/pull/5143.

Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>

* test(opencode): add a token-free OpenCode 2 native plugin fixture to the live e2e

A private opencode serve plus a loopback provider proves the five primary
plugins load and act on OpenCode 2: startup nudge, cd and watcher-redirection
guards, turn-end guard, watcher arming across succeeded, interrupted, and
failed turns. The fixture declares the complete model capabilities object,
which OpenCode 2.0.11 requires and 2.0.22 accepts. FM_OPENCODE_LIVE_BINS runs
it across several OpenCode 2 executables. The credentialed half now picks its
run flags and session tables by detected major, so it keeps working on 1.x.

Fixture ported from https://github.com/kunchenguid/firstmate/pull/5143.

Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>

* feat(opencode): send one Enter when an OpenCode 2 launch leaves the brief unsent

OpenCode 2.0.11 prefills the --prompt brief without submitting it, while 2.0.22 submits it.
After launch, fm-spawn waits for the worker's busy-state plugin to report the turn start, sends one Enter only if it has not started and the composer is not empty, and fails the spawn if the turn never starts.

* docs(opencode): document the OpenCode 2 launch, delivery gate, and standalone primary homes

Records the 2.0.11 and 2.0.22 live evidence for the native plugin fixture and the post-launch brief delivery gate.

* no-mistakes(review): Trim OpenCode 2 adapter shapes and harden Ctrl-C exit

* no-mistakes(review): Record OpenCode 2 live seatbelt and exit evidence

* no-mistakes(test): Document OpenCode 2.0.22 wide-pane sidebar exit refusal limitation

* no-mistakes(document): Refresh OpenCode 2 exit-key and seatbelt payload docs

* test(opencode): verify OpenCode 1.x live with the dual-export plugins

Pin the live e2e TUI panes to the resolved opencode executable, and record
OpenCode 1.15.7, 1.18.20, and 1.18.31 evidence for plugin loading, the
turn-end guard, watcher continuity, and 1.x worker launch and exit.

* no-mistakes(review): Defer OpenCode 2 Enter on unknown composer; widen turn-end docs

* no-mistakes(document): Document OpenCode 2 delivery gate unknown-composer test outcomes

---------

Co-authored-by: Niranjan <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* feat(bin): add opt-in local Claude usage threshold warner

A usage window is exhausted without warning: work is cut off mid-run
rather than stopping deliberately, and nothing says a window is close to
its cap until it is already gone.

bin/fm-usage-warner.sh is a threshold warner, not a usage viewer.
quota-axi is already the one Claude-quota reader this repo depends on
(bin/fm-quota-axi-lib.sh), so the warner runs that existing read rather
than adding a second reader that could drift from it: one bounded
`quota-axi --provider claude --json --full --no-credential-refresh`, the
snapshot validated with fm_quota_json_valid, and the provider row picked
with the same FM_QUOTA_ROW_JQ join the dispatch consumers use, under
schema 5 and schema 6 alike.

Thresholds are `<window-id>:<percent>` directives in config/usage-warner,
naming quota-axi's own window ids (five_hour, seven_day, model:<name>)
rather than a second vocabulary, and compared against each window's own
percentUsed. Naming the window is the point: the session and weekly
windows exhaust at very different times, so a figure that does not say
which window is close misleads.

One read with two callers and no new schedule: `check` is what a human
runs on demand and what the watcher runs on its ordinary check-shim
cadence once `arm` registers state/usage-warner.check.sh through
bin/fm-check-register.sh. There is no daemon.

Warnings post through macOS Notification Center with the same osascript
call bin/fm-supervise-daemon.sh's wedge alarm makes, without sourcing or
coupling to that daemon's away-mode-specific config and rate limiting.
Delivery is edge-triggered against state/.usage-warner: a crossing warns
once, stays quiet while it holds, and re-arms when the window next reads
back below its threshold, the same standing-report contract
fm-mail-check.sh and fm-tool-update-check.sh already use.

bin/fm-procevent-quota.sh already reads the same snapshot, so docs name
the boundary rather than leaving two similar surfaces unexplained. That
source fires at most once, wakes firstmate with a durable check event,
and compares a provider's aggregate effectivePercentRemaining. This
warner is the standing, human-facing half: per-window, delivered to the
person through Notification Center, and self-re-arming. Neither replaces
the other and arming both is reasonable.

Opt-in is load-bearing and enforced in code. With no valid directive,
`check` returns before any read and `arm` refuses, so an unconfigured
home gains no behaviour change, no new failure mode, and no new hard
dependency at dispatch. Notification Center is macOS-only, so `arm`
refuses on other platforms instead of registering a check that could
never speak.

The warner only warns. It does not stop or pace dispatch, and its
coverage is exactly what quota-axi can see locally, so a plan or
organisation spend cap quota-axi does not report is not covered; the doc
says so rather than implying coverage it does not have.

The new test script carries no measured CI duration hint yet, so the
portable-serial lane balances it on the conservative default until the
hints are next refreshed from a green run, per docs/fm-test-portable-shards.md.

* no-mistakes(review): Key usage-warner de-dupe on window and threshold; fix docs

* no-mistakes(review): Keep absent-window crossings recorded; stub osascript in tests

* no-mistakes(document): Document absent-window de-dupe carry-forward in usage-warner header

* no-mistakes(review): Serialize usage-warner check, dedupe directives, drop vacuous greps

* no-mistakes(document): List usage-warner check lock in state layout

---------

Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
Co-authored-by: Kostadin Pop-Kochev <kostadin.popkocev@gmail.com>
Co-authored-by: Niranjan <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): stabilize remote worker process identity (#6440)

* fix(bin): use clock-stable /proc starttime for remote job worker ownership

Linux remote job ownership compared ps lstart, which drifts on WSL2 while
/proc starttime stays fixed, so ensure treated a healthy worker as dead and
started another supervisor on every call. fm_remote_job_process_start now emits
a proc-starttime token when /proc is readable and falls back to ps lstart
otherwise. The Linux start path hands a live worker of the configured root
whose lock still records a legacy start over to one replacement, checked
against the recorded and live command so no unrelated pid is signaled.

Fixes #2921

* no-mistakes(review): Treat legacy lstart claim starts as indeterminate, not mismatched

* no-mistakes(test): Assert legacy handoff interrupts job once

* no-mistakes(test): Remove scratch debug test; legacy job case git-tracked

* no-mistakes(test): Revert legacy start comparator; simplify legacy handoff test

* fix(bin): drop automatic legacy worker upgrade; document manual one-time restart

* chore: remove stray file

* no-mistakes(document): Drop stale handoff mention from remote worker docs

* fix(bin): verify pre-update remote job workers via legacy lstart

When a recorded start lacks the proc-starttime= prefix, compare it against
ps -o lstart= without LC_ALL=C so a healthy pre-update worker still verifies.
The ordinary code-identity path then replaces it once instead of piling
supervisors. Add regression coverage for the bare-lstart cookie and the
lock upgrade path.

* no-mistakes(document): Clarify legacy remote-job start verification docs

* no-mistakes(review): Preserve C-locale legacy cookie verification, captain

* no-mistakes(document): Clarify legacy process identity cookie compatibility

* no-mistakes(lint): Replace deprecated fgrep with lint-compliant grep -F

---------

Co-authored-by: Pitch Perfekt Collective <pitchperfekt@Pitchs-Mac-Studio.local>
Co-authored-by: mehulbhagwani <270960355+mehulbhagwani@users.noreply.github.com>

* feat(bin): add persistent managed-approval failover for Codex and Claude (#6722)

* fix: use managed-compatible worker approval modes

* no-mistakes(document): update codex and claude worker approval mode docs

* no-mistakes(ci): Fixed two test files that weren't updated when the PR changed the default claude permission mode from `--dangerously-skip-permissions` (bypass) to `--permission-mode auto`. Changes: - `tests/fm-claude-trust.test.sh` lines 664 and 696: updated two `assert_grep` assertions from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` - `tests/fm-backend-orca.test.sh` line 568: updated one `assert_contains` assertion from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` Both tests now pass locally (orca: exit=0, backend-dispatch/claude-trust: exit=0)

* fix: remove stray scratch directories from tests/

tests/.tmp-managed-approvals-test.bBuGhY/ and tests/.tmp-managed-approvals2.exz2qr/
were accidentally committed as worktree-local scratch dirs and do not belong in the repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve bypass defaults with persistent managed approval failover

* no-mistakes(review): fix approve-for-me fixture and bypass diagnostic messages

* no-mistakes(review): restore absent-Claude-default test and fix pass messages

* fix: recognize managed Codex approval prompts in the C locale

* no-mistakes(review): Fix managed approval failover bounds, authorization, inheritance, and capture

* Simplify managed approval recovery to persistent explicit failover

* no-mistakes(review): Guard failover authorization and unlink staging before recovery

* no-mistakes(document): Correct managed approval documentation and consolidate owner references

* no-mistakes(document): Correct managed-approval references and stale hook guarantees

* fix: require approval and inherit managed modes from primary

* no-mistakes(document): Clarify live hook verification scope

* no-mistakes(review): Remove dead approval_configured key from relaunch metadata

* fix: resurface queued wakes from handling successors (#7466)

* fix(bin): resurface wakes appended while a handling successor is parked

The supervision host parks on the handling successor it starts for a wake
its engine handled, and a handling successor never resurfaced recovery, so
a row another script appended during the park (a captain inbox note from
the Basecamp integration) sat queued until an unrelated close - four hours
in the observed case.

A handling successor now records the newest queued sequence at its start
and closes once with the recovery wake while a newer row is still queued;
a newer row already consumed only advances that mark, so the predecessor's
delivered episode is still never re-announced.

Follow-ups, not built here:
- A row appended in the short window between a handled close and its
  successor's start (about a second) is below the successor's mark; if the
  engine handles that close without claiming the row, the row waits for the
  next close. Closing that window needs the host to treat rows left queued
  after a handled attended turn as main's, which is a separate host change.
- After a machine reboot the primary session does not restart on its own,
  so queued wakes wait until it is resumed by hand. Either auto-resume the
  primary session after boot, or alert the owner when the primary session
  is down while wakes are queued.

* no-mistakes(review): Close handling-successor startup wake race

* no-mistakes(test): Stabilize parked-host inbox wake regression timeout

* no-mistakes(document): Clarify handling-successor wake continuity guarantees

* no-mistakes(ci): Stabilized the flaky remote secondmate lifecycle test by extending the auto-relaunch watcher deadline from ~30 to ~60 seconds. The CI runner exceeded the old deadline by about 3 seconds; the changed production branch was not reachable in this fixture. `bash -n` and `git diff --check` pass. The full test was attempted but exceeded the 600-second local execution limit before reaching this case

* no-mistakes(ci): Fixed flaky concurrent Herdr recovery testing by retrying only documented session-lock contention after both competitors finish. Cleanup now handles fixture-owned read-only hooks. Targeted E2E passed; bash syntax and diff checks passed. Shellcheck reported only existing SC1091 source-following notices

* no-mistakes(test): Preserve successor wake boundaries across handoffs

* no-mistakes(test): Revert successor boundaries and drain teardown fixture wake

* no-mistakes(test): Notify main when downtime handback publication fails

* no-mistakes(test): Revert downtime handback notification changes

* no-mistakes(document): Correct stale supervision wake routing documentation

* fix(bin): stop the supervision host deadlocking and re-announcing handed-back closes

Two defects in this branch's handling-successor changes surfaced as the
"Behavior portable serial 2" shard hanging at its 30-minute limit.

A TERM that lands while the host settles a handled turn's successor handoff
left the host holding the wake-queue and recovery-marker locks; its exit
cleanup then waited forever on the queue lock it still owned. The cleanup now
releases those locks if this process owns them before releasing its grant.

When an accepted close turns main-only at its turn, the host hands it back and
leaves the successor running, but republished the episode as pending
downtime, so that successor re-announced the same close and exited. The
handback now republishes the episode as already announced; a later durable
append still opens a pending episode the successor recovers.

* no-mistakes(test): Park on successor after handling settlement failure

* no-mistakes(test): Use tab-delimited handled-settlement failure logs

---------

Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com>

* fix(bin): preserve accents in pending-reply summaries (#7618)

* fix(bin): keep accented letters in pending-reply request summaries

fm_pending_reply_summarize deleted every byte outside printable ASCII, so a Portuguese summary lost its accents: "não faça a correção" was stored as "no faa a correo". It now removes control characters only. The 120-character cap counts UTF-8 characters from lead bytes, so it never splits a letter under any caller locale, including the C locale.

* no-mistakes(document): Documentar preservação de acentos nos resumos

---------

Co-authored-by: Alexandre Custodio <alexandre.custodio@soraschools.com>

* feat: add OpenRouter support for typed dispatch resolution (#7149)

* Add explicit OpenRouter Jev dispatch resolution

* no-mistakes(document): Clarify dispatch documentation and remove stale duplicates

* chore: exclude local Stele binding from PR

* no-mistakes(document): Correct dispatch help and never-send documentation

* ci: retrigger CI after a timed-out test shard

* no-mistakes(document): Correct dispatch architecture documentation ownership

* feat(bin): publish lane capacity facts with beat pressure and keyed limits (#6983)

Opt-in: fm-watch.sh publishes state/lane-capacity.json via bin/fm-capacity.sh --publish only while config/lane-capacity exists; adds beat pressure and keyed limits to fm-capacity.sh. Unconfigured fm-capacity output unchanged.

* fix(bin): propagate contribution input assembly failures (#5359)

* fix(bin): transport contribution-input JSON through slurpfile, not argjson

bin/fm-fleet-snapshot.sh --contribution-input passed the full backlog and
task-record JSON to jq through --argjson. A single --argjson argument is
capped by the kernel's MAX_ARG_STRLEN (131072 bytes on Linux), so a large
enough backlog made the kernel refuse to exec jq while the script still
exited 0 with a broken result.

Transport both documents through temporary files and --slurpfile, matching
the pattern the default snapshot path already uses, and propagate a
non-zero exit when that jq invocation fails.

Fixes #5349

* test: narrow contribution-input regression to final assembly failure

The ARG_MAX transport is already fixed on main by #6830, so keep only the regression proving a failing final jq assembly exits non-zero.

* fix: correct Rex secondmate grouping and lifecycle (#7656)

* Fix Rex secondmate session lifecycle

* no-mistakes(review): Retire Rex secondmate sessions under the owning home identity

* no-mistakes(review): Limit Rex FM_ROOT label override to secondmate launches

* no-mistakes(document): Clarify Rex secondmate grouping and lifecycle documentation

* feat(opencode): add OpenCode 2 support with version-gated launch, plugins, and exit (#7336)

* feat(opencode): add OpenCode 2 support with version-gated launch and plugins

OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.*
plugins now export a default definition with an id and a setup function
alongside their legacy OpenCode 1 server export, backed by a new shared
lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check,
pretool-check, and sessionstart-nudge install their behavior from setup(ctx)
on OpenCode 2 and keep the server entrypoint for OpenCode 1.

fm-spawn probes the resolved opencode executable's --version once and branches
the launch, model flag, reasoning config, exit key, and busy-state plugin off
the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model,
the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the
session.execution.* busy plugin); OpenCode 1.x and any undetected or
unparseable version fall back to the 1.x shape (--model, 1.x config, /exit)
everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1
keeps the pre-port session.status/session.idle plugin so its busy-state wiring
is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter
and supervision docs, OpenCode 2 live fixtures, and regression tests for the
unknown->1.x launch path and the version-gated busy-plugin shape are included.

* no-mistakes(review): gate OpenCode 2 busy plugin turn-end touch on notifyTurnEnd

* feat(opencode): launch detected OpenCode 2 workers with --standalone

OpenCode 2's default launch attaches to the shared background service, which
hosts plugins with the service's environment and ignores the pane's
OPENCODE_CONFIG_CONTENT. A private server keeps per-worker model, permissions,
FM_HOME, and lock ancestry correct. 1.x and undetected versions are unchanged.

Ported from https://github.com/kunchenguid/firstmate/pull/5143.

Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>

* fix(opencode): resolve the OpenCode 2 project location and treat every terminal turn as a turn end

OpenCode 2.0.x hands plugins the project only as ctx.location.project.directory
and takes ctx.session.prompt({ sessionID, text }), so the V2 setup path never
found its root or delivered a prompt. Interrupted and failed turns now end a
turn like a succeeded one, while a server shutdown does not.

Ported from https://github.com/kunchenguid/firstmate/pull/5143.

Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>

* test(opencode): add a token-free OpenCode 2 native plugin fixture to the live e2e

A private opencode serve plus a loopback provider proves the five primary
plugins load and act on OpenCode 2: startup nudge, cd and watcher-redirection
guards, turn-end guard, watcher arming across succeeded, interrupted, and
failed turns. The fixture declares the complete model capabilities object,
which OpenCode 2.0.11 requires and 2.0.22 accepts. FM_OPENCODE_LIVE_BINS runs
it across several OpenCode 2 executables. The credentialed half now picks its
run flags and session tables by detected major, so it keeps working on 1.x.

Fixture ported from https://github.com/kunchenguid/firstmate/pull/5143.

Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>

* feat(opencode): send one Enter when an OpenCode 2 launch leaves the brief unsent

OpenCode 2.0.11 prefills the --prompt brief without submitting it, while 2.0.22 submits it.
After launch, fm-spawn waits for the worker's busy-state plugin to report the turn start, sends one Enter only if it has not started and the composer is not empty, and fails the spawn if the turn never starts.

* docs(opencode): document the OpenCode 2 launch, delivery gate, and standalone primary homes

Records the 2.0.11 and 2.0.22 live evidence for the native plugin fixture and the post-launch brief delivery gate.

* no-mistakes(review): Trim OpenCode 2 adapter shapes and harden Ctrl-C exit

* no-mistakes(review): Record OpenCode 2 live seatbelt and exit evidence

* no-mistakes(test): Document OpenCode 2.0.22 wide-pane sidebar exit refusal limitation

* no-mistakes(document): Refresh OpenCode 2 exit-key and seatbelt payload docs

* test(opencode): verify OpenCode 1.x live with the dual-export plugins

Pin the live e2e TUI panes to the resolved opencode executable, and record
OpenCode 1.15.7, 1.18.20, and 1.18.31 evidence for plugin loading, the
turn-end guard, watcher continuity, and 1.x worker launch and exit.

* no-mistakes(review): Defer OpenCode 2 Enter on unknown composer; widen turn-end docs

* no-mistakes(document): Document OpenCode 2 delivery gate unknown-composer test outcomes

---------

Co-authored-by: Niranjan <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): resolve the tmux container from firstmate's own session, not the most recent group member (#7662)

* fix(bin): resolve the tmux container from the caller's own session, not the most recent group member

* no-mistakes(test): Fall back when the $TMUX session id is stale

* no-mistakes(document): Document tmux container choice under grouped sessions

* fix(bin): read a fully dim Cursor idle placeholder as an empty composer (#7647)

* fix(bin): read a fully dim Cursor placeholder as an empty composer

cursor-agent 2026.10.19 draws the composer glyph and its idle placeholder
as one SGR 2 run with no reverse-video cell, so ghost stripping empties the
row and the empty-content guard returned unknown. Relaunch and exit then
refused on every idle Cursor pane on tmux.

When a styled bare row strips to empty and the plain row is an agent glyph
followed by an anchored idle placeholder, read it empty. Bright typed text,
other dim text, and unstyled rows keep their existing verdicts.

Fixes #7413

* docs(verification): record the fully dim Cursor placeholder verdict and refresh command

* fix(bin): say why away-mode inject deferred and pin named Claude idle composer as empty (#6163)

* fix(bin): recognize a named Claude session's titled composer rule on cursorless backends

`claude -n <name>` right-aligns the session name in the rule above the
composer. Cursorless backends (Herdr) accepted only solid rules, so the
scan saw the lower rule alone, the idle composer read `unknown`, and
away-mode delivery to a named Claude primary deferred until return.

A rule carrying one right-aligned title now opens a separator pair. It
never closes one, the pair it opens counts only over an agent-glyph row,
and it is never a valid Pi pair, so Pi's verdict is unchanged.

The away-mode composer deferral now names which refusal it was:
unsubmitted text, or no composer shape recognized.

* no-mistakes(review): Reword composer deferral reason to cover busy harness

* no-mistakes(ci): ci-3 (Greptile, user chose to fix): The rule that must always hold is that Claude's titled opening rule is accepted for any non-empty session name that doesn't start with a space and doesn't contain the rule glyph `─`, including a multiword name. The only place that check lives is the title `case` in `_fm_composer_titled_rule_row` (bin/fm-composer-lib.sh). It now reads `case "$title" in ''|' '*|*─*) return 1 ;; esac`, as the user asked, and the comment above the function mentions multiword titles. I added regression fixtures to `test_matrix_claude_named_session_titled_rule` in tests/fm-composer-lib.test.sh, next to the existing single-word `Andrew` cases. They use the title `Andrew Chen` and check that an idle composer on herdr reads `empty` and a composer with typed text reads `pending`. Something you should know: the old pattern already accepted a title with a space in the middle. It only rejected a title ending in a space. So the new multiword fixtures also pass against the old code, and the bot's failure scenario did not actually happen for "Andrew Chen". What the fix really changes is that it drops the trailing-space rejection, as instructed. Checks run: tests/fm-composer-lib.test.sh and tests/fm-composer-ghost.test.sh both pass (exit 0, no failures), and `shellcheck -x` is clean on both changed files

* no-mistakes(review): Match unnamed-ghost fixture rule width to the partner rule

* fix: use managed-compatible worker approval modes

* no-mistakes(document): update codex and claude worker approval mode docs

* no-mistakes(ci): Fixed two test files that weren't updated when the PR changed the default claude permission mode from `--dangerously-skip-permissions` (bypass) to `--permission-mode auto`. Changes: - `tests/fm-claude-trust.test.sh` lines 664 and 696: updated two `assert_grep` assertions from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` - `tests/fm-backend-orca.test.sh` line 568: updated one `assert_contains` assertion from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` Both tests now pass locally (orca: exit=0, backend-dispatch/claude-trust: exit=0)

* fix: remove stray scratch directories from tests/

tests/.tmp-managed-approvals-test.bBuGhY/ and tests/.tmp-managed-approvals2.exz2qr/
were accidentally committed as worktree-local scratch dirs and do not belong in the repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: preserve bypass defaults with persistent managed approval failover

* no-mistakes(review): fix approve-for-me fixture and bypass diagnostic messages

* no-mistakes(review): restore absent-Claude-default test and fix pass messages

* fix: recognize managed Codex approval prompts in the C locale

* no-mistakes(review): Fix managed approval failover bounds, authorization, inheritance, and capture

* Simplify managed approval recovery to persistent explicit failover

* no-mistakes(review): Guard failover authorization and unlink staging before recovery

* no-mistakes(document): Correct managed approval documentation and consolidate owner references

* no-mistakes(document): Correct managed-approval references and stale hook guarantees

* fix: require approval and inherit managed modes from primary

* no-mistakes(document): Clarify live hook verification scope

* no-mistakes(review): Remove dead approval_configured key from relaunch metadata

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Caleb LeNoir <caleb.lenoir@constructease.com>
Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com>
Co-authored-by: Alexandre Custodio <xandy.alexandrec@gmail.com>
Co-authored-by: Alexandre Custodio <alexandre.custodio@soraschools.com>
Co-authored-by: Pedro Guimarães <21346846+0x7067@users.noreply.github.com>
Co-authored-by: Konner Moshier <39997550+Moshik21@users.noreply.github.com>
Co-authored-by: Oscar Santis Brante <49914973+osantis@users.noreply.github.com>
Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
Co-authored-by: Kostadin Pop-Kochev <kostadin.popkocev@gmail.com>
Co-authored-by: Niranjan <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Tomas Perez <71987424+tomasperezcoscia@users.noreply.github.com>
Co-authored-by: Cameron Aragon <69489633+camaragon@users.noreply.github.com>
Co-authored-by: Brian <bthome@users.noreply.github.com>

* fix(bin): keep handling successors from stranding inbox wakes after counter loss (#6467)

* fix: notify handling successors about newer inbox wakes

* no-mistakes(document): Document handling-successor inbox regression in watcher coverage list

* no-mistakes(ci): Fixed Greptile P1 (comment 4172295712): a handling successor could miss a new inbox wake when `.wake-queue.seq` was missing or malformed. What must always hold: a row added after the successor took its snapshot must be announced and must never be consumed by an older acknowledgement. Two places were breaking this: 1. `bin/fm-watch.sh`: the successor only recorded the highest inherited sequence number. If the counter was reset, a new row could get a number at or below that and be treated as already covered. This now stays silent forever once the inherited rows are acknowledged and the queue drains. 2. `bin/fm-wake-lib.sh` `fm_wake_append_locked`: a reset counter reused the sequence number of a row still in the queue. The predecessor's pending `--ack-through` consumes rows by sequence number, so it deleted the new row before anyone handled it. This was a gap in the existing allocator, and it is what made the before-ack cases fail even after fix 1. Fixes: - Watcher: the successor now snapshots the inherited rows themselves instead of their highest sequence. On each poll it announces if any queued row is not in that snapshot. It still never consumes rows, and inherited rows alone stay silent. - Allocator: the next sequence is now one more than the larger of the counter and the highest sequence still queued, so a new row can't land inside an outstanding acknowledgement's range. - `docs/watcher-continuity.md`: the paragraph and coverage list are updated to match. Tests: `test_append_wakes_handling_successor` in `tests/fm-watch-arm.test.sh` now inherits two rows and takes a counter state (intact, missing, malformed). The four new cases are after-ack and before-ack with a missing or malformed counter, and they run real watcher, arm and drain processes. In after-ack the queue is fully drained before the new append. Evidence: - Before any production change (on 92c724d), all four new cases failed: "not ok - handling successor stranded the second inbox wake" for after-ack and before-ack. - With only the watcher fix, the after-ack cases passed and the before-ack cases still failed, which shows the allocator fix is needed. - With both fixes, all four pass. Full results: `fm-watch-arm` 36/36 (including the intact after-ack and before-ack cases, so ordinary silence and fresh-beacon delivery still hold), `fm-watch-recovery-loop` 2/2, `fm-inbox` 16/16, `fm-pi-watch-extension` 60/60, `fm-wake-queue` 67/67, and all four `fm-wake-drain-*` suites passed (9, 9, 18, 14). Canonical `bin/fm-lint.sh` with `PATH=/home/nino/.local/bin:$PATH` passed: ShellCheck clean, actionlint 1.7.12, 3 workflows valid. That lint run was in local changed-file mode with ShellCheck source following disabled. In a first run of all nine suites in parallel, `fm-wake-queue` failed on "presentation lock delayed the drain for 10s" and one `fm-pi-watch-extension` timing test failed. Both passed in full when rerun on their own, so I read that as load contention, not this change. Design decision to flag: the allocator change sits in the shared wake library, so it goes beyond the watcher comparison the bot pointed at. It is a one-expression change, and the before-ack tests can't pass without it, because otherwise the predecessor's acknowledgement deletes the new message. Not done, per the phase boundary: nothing committed, pushed or posted, and the live fleet was not touched. Evidence logs are in /tmp/fmci, not in a pipeline logs/evidence directory

* no-mistakes(ci): Fixed both Greptile findings on PR #6467. Nothing was committed, pushed or posted, and the live fleet was not touched. **ci-1 (4172409813): a new wake was mistaken for an inherited one.** - Invariant that must hold: a successor treats a row as covered only if it is an unchanged inherited row in the inherited recovery episode. - Cause: after the predecessor's acknowledgement and a lost counter, a re-append with the same kind, key, payload and epoch was byte-identical to the snapshot row, so the successor stayed silent. - Fix (`bin/fm-watch.sh`): I used the existing recovery generation rather than a new identity scheme. Any append after an acknowledgement mints a new generation. The successor records the generation with its row snapshot, under the queue lock and in arm-check's lock order. Each poll counts the queue as newer if a row is not in the snapshot, or if the queue is non-empty and the generation changed. The existing arm-check then decides whether to announce. No rows are consumed, and inherited rows alone stay silent. - The row snapshot is still needed for before-ack, because an append before the acknowledgement keeps the same generation. **ci-2 (4172409821): large sequence numbers became unusable.** - Invariant that must hold: sequence numbers are always exact digit-only decimals. - Fix (`bin/fm-wake-lib.sh`): the allocator picks the largest of the counter and the queued sequences by comparing decimal text (length, then string order, leading zeros stripped), then adds 1 in bash with `$((10#$seq + 1))`. This restores the 64-bit exactness of the original bash counter. - Same fix at two places in `bin/fm-wake-drain.sh` that print sequences: `presented_max_row` and `ACK_THROUGH` print the matched text instead of `max + 0`. **Tests** - `tests/fm-watch-arm.test.sh`: two new `identical` cases, after-ack with a missing and with a malformed counter. A fake `date` pins the epoch, and the test asserts the row is byte-identical, then checks timely notification, preservation until its own acknowledgement, and no repeat notification. - `tests/fm-wake-queue.test.sh`: new `test_large_sequences_stay_exact_decimal_identifiers` starts from 2147483647, 9007199254740991 and 9223372036854775806, each with an intact, missing and malformed counter. It checks the next sequence is exact and digit-only. For the first two it also checks a real drain shows both rows, names the exact acknowledgement sequence, and acknowledging empties the queue. - `docs/watcher-continuity.md` now describes the generation check. **Evidence** (in `/home/nino/.no-mistakes/evidence/01M40CDTX2000A5TFFRZN27YFR/ci-round3/`) - Before, on 050a5fc: both identical cases failed with "handling successor stranded the second inbox wake (after-ack)". The large-sequence test failed with "advanced to '9223372036854775808', not 9223372036854775807". - After the fix, all three pass (`after-*.log`). - All nine suites passed, each run on its own, all with 0 not ok (`final-results.txt`): `fm-wake-queue` 68/68, `fm-watch-arm` 38/38, `fm-watch-recovery-loop` 2/2, `fm-inbox` 16/16, `fm-pi-watch-extension` 60/60, `fm-wake-drain-open-decisions-cursor` 9/9, `fm-wake-drain-open-decisions` 9/9, `fm-wake-drain-outcome-backstop` 18/18, `fm-wake-drain-unread-status` 14/14. - `bin/fm-lint.sh` with `PATH=/home/nino/.local/bin:$PATH` passes: ShellCheck clean, actionlint 1.7.12, 3 workflows valid (local changed-file mode). **Not run** - The only OpenCode suite is an opt-in live test, so I did not run it. **Limits** - The 2.14748e+09 symptom doesn't reproduce with the awks here (gawk, mawk 1.3.4, busybox). The failure reproduced locally is the precision loss at 64-bit values. - The drain's awk comparisons are only exact up to 2^53. That predates this PR and I left it alone, so the drain test stops at 2^53

* no-mistakes(document): Reattach successor poll-loop sentence to its subject

* fix(bin): stop lock waits and test fixtures from spinning after their directory is removed (#7685)

* fix(tests): bound lock waits on removed dirs and reap fixture-root processes

A lock wait spun every 0.1s forever once its directory was removed, so a
watcher or reconcile scan of a deleted test home never reached its own
home-gone exit. fm_lock_acquire_wait now returns within 0.2s once the
lock's parent directory is gone.

Test teardown now signals every process naming the exact fixture root
(TERM, then KILL) before removing it, in both fm_test_cleanup and the
orphan sweep. The supervision-host fake harness sessions stop once their
home is gone or the suite pid has died, so a hard-killed runner no longer
leaves them polling under init.

Fixes #7672

* fix(tests): bound the session-lock concurrency barrier

Forty workers polled a find pipeline every 0.01s to wait for each other,
so the barrier alone launched thousands of processes a second, and once a
stopped run removed the barrier directory the workers polled forever under
init. Count entries with a builtin glob every 0.05s, and end the wait once
the directory is gone, the suite has died, or the stub block bound passes.

Refs #7672

* fix: watch review-bot findings on owned pull requests (#7499)

* fix(bin): admit listed review-bot comments as contribution signals

* no-mistakes(review): Persist review-bot config in contribution check shim

* no-mistakes(review): Classify allowlisted collaborators as review bots

* no-mistakes(document): Document review-bot contribution signals

* no-mistakes(review): Preserve review-bot config and re-raise classification

* no-mistakes(review): Prevent acknowledged bot signals replaying after allowlist changes

* no-mistakes(document): Document configurable review-bot contribution watching

* no-mistakes(document): Clarify review-bot thread documentation

* fix(bin): make review-bot contribution watching opt-in

* docs(bin): state review-bot allowlist has no built-in default

* no-mistakes(document): Document per-home review-bot configuration

---------

Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com>

* fix(brief): drop undefined heavy-test slot from the Waiting section (#7674)

The generated Waiting section told workers to wait on a heavy-test slot that nothing in the repository defines. Remove the phrase and assert that a brief generated with config/wait-no-turns does not name one.

* fix(bin): read the no_ci ci-monitor marker as no-checks (#7675)

* fix(bin): read the no_ci ci-monitor marker as no-checks instead of validating

Fixes #7644

* no-mistakes(document): Rewrap nm_ci_checks_state no_ci comment

* feat(bin): add opt-in restricted permission mode for Codex workers (#7683)

* feat: add opt-in restricted permissions for Codex workers

* no-mistakes(review): Document restricted Codex network and git approval limits

* fix(test): keep serial packing at-budget fixture stable with unhinted scripts (#7699)

* fix(test): keep serial packing at-budget when a script has no hint

tests/fm-approval-failover.test.sh landed without a serial duration hint,
so the at-budget packing fixture overflowed by 1040ms. Record a measured
5410ms hint and give the fixture its own complete hint table so unmeasured
defaults cannot join the boundary shard.

Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>

* docs: note the local approval-failover packing hint

Record the 5410 ms provisional local sample for the next CI refresh,
and describe the packing-boundary fixture as independent of unhinted
scripts.

Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>

* fix(inbox): newline-terminate steering records (#6309)

* fix: terminate steering inbox records with newline

* no-mistakes(ci): Fixed Greptile P2 by updating the shared generated `INBOX_SECTION` in `bin/fm-brief.sh`, which is the single guidance source consumed by ship, scout, and secondmate scaffolds. The guidance now tells workers to prefer `fm_task_inbox_body`, explains that `body-terminator=1` marks exactly one synthetic record-termination newline that is not logical body content, and says to remove only that marked terminator while preserving intentional trailing newlines and legacy EOF bodies. Added generated-brief behavioral coverage for all three scaffold paths in `tests/fm-brief.test.sh`. Verified with `./tests/fm-brief.test.sh && bash ./tests/fm-task-inbox.test.sh`

* fix: print fm-send help before resolving FM_HOME (#6402)

* fix(bin): make fm-send.sh --help print usage before FM_HOME resolution

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched over…
OliwerO added a commit to OliwerO/firstmate that referenced this pull request Nov 22, 2026
* fix(bin): pin markdown backend in backlog handoff and receive (#7047)

* fix(tests): keep backlog suites hermetic against a local .tasks.toml

Fixture homes now write the tracked markdown defaults through a
fm_test_tasks_toml helper instead of copying the checkout's .tasks.toml,
which an operator may override with a beads backend at a live backlog.

The backlog handoff and receive moves pin --backend markdown, because they
already name their markdown files and otherwise resolve the backend from the
caller's working directory. The atomicity suite runs from its scratch root so
its direct tasks-axi fixture calls cannot read the checkout config.

* no-mistakes(review): Add decoy-cwd .tasks.toml regressions for handoff and receive

* no-mistakes(lint): Reuse sha256_file helper to fix SC2015 in remote handoff test

* fix(bin): parse whole project names in home seed registry queries (#7076)

* fix(bin): parse whole project name in home seed registry queries

Parse the full project name after the dash in fm-home-seed.sh registry lookups.

This matches the round-3 bootstrap mirror check parser so spaced names resolve.

Cover both the project-less seed refusal guard and registry line lookups in tests.

* no-mistakes(review): Match registry rows by name prefix plus separator

* no-mistakes(document): Note shared registry row-match rule in fm-home-seed

* fix: preserve announced recovery across Codex checkpoints (#4490)

* fix(codex): preserve announced recovery across checkpoints

* no-mistakes(review): Make announced-recovery checkpoint test reproduce the regression

* no-mistakes(review): Separate 2026-10-07 checkpoint fixture verification from original run

* no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks

* no-mistakes(document): Update checkpoint recovery and signal documentation

* no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh

* no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks

* Revert "no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh"

This reverts commit 44ce29bfbfa95149a7785efc200f6a00b5bf3a41.

* Revert "no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks"

This reverts commit e1e37067a9369f0c38d7bd1c7a0913b1c54fc28a.

* Revert "no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks"

This reverts commit 9877bf92134e77414e25cd8e6f122ff4d089473a.

* fix: let checkpoint watcher clean up before timeout

* no-mistakes(review): Scope checkpoint timeout escalation and restore signal docs

* no-mistakes(review): Fix Perl checkpoint timeout escalation

* no-mistakes(document): Clarify checkpoint recovery documentation

* no-mistakes(document): Document isolated checkpoint regression command

* no-mistakes(ci): Tied direct-checkpoint SIGKILL escalation to the effective cleanup bound, preserving the five-second minimum and leaving the supervision-host path unchanged. The targeted checkpoint suite, shell syntax checks, ShellCheck, and diff checks pass. CI was not manually rerun

---------

Co-authored-by: jopo <jopo@JP-M2mini.local>

* feat(bin): support Forgejo/Gitea as a forge via the tea CLI (#4395)

* feat(bin): add Forgejo (tea) as a third forge alongside GitHub and GitLab

Extends the existing provider-tagged PR/MR dispatch in fm-pr-lib.sh,
fm-pr-poll.sh, fm-pr-check.sh, and fm-pr-merge.sh with a forgejo arm,
following the same pattern already established for GitLab. tea addresses a
repository by owner/repo slug only and resolves the host through a named
"tea login" rather than a URL, so the login is matched against the PR's host
fresh at arm and merge time. tea's own merge subcommand exposes no
head-binding flag, so the merge itself calls Forgejo/Gitea's REST API
directly via "tea api" with head_commit_id, verified against a real
disposable instance to behave like --match-head-commit/--sha; that same
verification found that "tea api" reports an HTTP-level failure with exit
status 0, so a merge is confirmed only by reading the pull request back
afterward, never by trusting the command's own exit code.

Adds forgejo as a value of the registry's existing forge= binding (the
closed set becomes none|gerrit|forgejo, with its refusals unchanged), so a
generated brief and its direct-PR Definition of done name tea before any PR
exists and bin/fm-spawn.sh's forge agreement and bin/fm-promote.sh carry it
like gerrit. Documents the new value in docs/configuration.md,
docs/architecture.md, and a new maintainer-verification doc mirroring
docs/gitlab-merge-watch.md.

* no-mistakes(review): Redact private Forgejo host/IP from evidence doc

* no-mistakes(review): Fix doc's tea-login JSON shape; dedupe host validators

* no-mistakes(document): Add Forgejo to README doc index and scripts.md forge list

* no-mistakes(lint): {"summary": "fix(bin): drop unused FORGEJO_LOGIN capture in fm-pr-check.sh"}

* fix(bin): refuse --allow-red on Forgejo instead of dropping it silently

The attended --allow-red waiver landed on main while the Forgejo arm was
being written, so its applicability guard only ever classified GitHub and
GitLab. On a Forgejo pull request the flag parsed, and then nothing read
it: forgejo_verify_mergeable requires the head's combined commit status to
be exactly "success", with no per-check name to match a waiver against.

The merge still refused, so no red Forgejo merge was ever possible, but it
refused without saying the waiver had been ignored. Extend the existing
GitLab guard to cover Forgejo for the same reason GitLab has it: both
collapse their checks into a single head verdict, so the green requirement
is absolute and a named waiver cannot apply.

* fix(bin): poll a Forgejo pull request by number through tea api

The merge watch listed the 50 most recent pull requests and filtered to the
watched index, so in a repository with more newer pull requests a merged
watch never fired. Read the one pull request through tea api instead and wake
only on a boolean merged field of true, since tea api exits 0 on HTTP errors.

Share the tea login match as fm_pr_forgejo_login for every sourcing script and
add fm_pr_forgejo_read_record for the state, merged flag, and head. Arming now
also requires jq, which the poll needs to read the record.

* fix(bin): gate a Forgejo merge on every status page and on draft state

The combined-status endpoint computes its state from one page of contexts, so
a failing context past the first page could leave the head reading green. Read
every page until an empty one and require each to be success. Also refuse a
pull request the API reports as a draft.

* fix(bin): prove a Forgejo task landed from its merged pull request at teardown

pr_is_merged read the recorded pr= only through gh, so a Forgejo task always
fell back to the content check and refused landed work whenever that check was
inconclusive, such as when later default-branch commits conflict with the
merged tree. Read a recorded Forgejo URL through fm_pr_forgejo_read_record and
apply the same containment check against its head.

* feat(bin): read Forgejo pull requests in crew-state and review-diff

fm-crew-state reports a terminal passed run's Forgejo pull request as open,
closed, merged, or unknown through fm_pr_forgejo_read_record, and
fm-review-diff resolves a /pulls/<n> URL to the refs/pull/<n>/head ref
Forgejo serves. Document the by-number read, the paged status gate, and the
draft gate, and mark what the evidence instance did not exercise.

* fix(bin): parse tea logins as JSON and close the remaining Forgejo gaps

The tea login match split each line of `tea login list --output json` on
quotes and read field 4, which only works while tea pretty-prints one field
per line. A login printed as one compact object put the login name where the
url belonged, so arming, merging, and polling refused every Forgejo host.
fm_pr_forgejo_login and the static poll's own copy now parse the list with
jq, matching each login's url host with scheme, userinfo, port, and path
stripped, and still refuse zero or several matches.

--allow-missing is now refused on a Forgejo pull request the way --allow-red
already is, instead of being parsed and ignored: the merge already requires
the head's combined commit status to have succeeded.

The forge=forgejo Definition of done read the draft state back with
gh-axi pr view and cleared it with gh-axi pr ready although the PR is opened
with tea; both publishing modes now read the draft state through tea api and
clear Forgejo's work-in-progress title prefix with tea pulls edit.

* no-mistakes(review): Retry Forgejo merge confirmation read before failing

* no-mistakes(document): Document Forgejo draft gate and merge confirmation retry

* fix(bin): merge Forgejo pull requests with the repository's default style

When the caller named no merge method, a Forgejo merge always sent Do=merge,
so a repository that allows only squash or rebase merges refused every
default call. The style now comes from the repository's own
default_merge_style, read live through the same tea login, and a merge is
refused when that value cannot be read or is not a known style rather than
replaced by one chosen here. A method the caller names still wins.

---------

Co-authored-by: dna <dna@local>

* fix: prevent concurrent secondmate relaunch races (#7154)

* fix: serialize secondmate liveness relaunches across task set

* no-mistakes(review): Remove relaunch wait override and test bounded contention

* no-mistakes(document): Clarify secondmate relaunch locking and timeout documentation

* chore: keep local Stele binding out of shared template

* no-mistakes(document): Correct stale secondmate recovery timing comment

* chore: exclude local Stele binding from relaunch fix

* ci: retrigger CI after a timed-out test shard

* no-mistakes(document): Correct secondmate recovery ordering documentation

* fix: require explicit authority for Firstmate upstream contributions (#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

* fix(pi): narrow before_agent_start events before reading prompt (#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): name the failing step when a contribution observation is unavailable (#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes #6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs #6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <konrad.heimel@corp.ovh.com>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <254459182+pedromuller-del@users.noreply.github.com>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's an…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants