Skip to content

fix: detect Git and centralize backend configuration - #445

Merged
kunchenguid merged 4 commits into
mainfrom
fm/fm-doc-cleanup-c3-s2
Jul 10, 2026
Merged

kunchenguid merged 4 commits into
mainfrom
fm/fm-doc-cleanup-c3-s2

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Slice 2 of the captain-ordered high-star documentation redundancy cleanup wave (firstmate scope), approved by the captain with docs/configuration.md as the declared shared owner: a docs-only consolidation establishing ONE owner for the three universal backend contracts the audit found copy-pasted across the five backend guides (the #372/#411/#332 five-doc re-edit class). (1) docs/configuration.md becomes the declared single owner, each with an explicit one-line ownership sentence so the Document step and humans know where the fact lives: the universal toolchain list (Toolchain section, now explicitly including git and gh with GitHub auth per the prior run's review finding, fixed between runs after that run failed terminally on the fix agent's usage limit), the task-selector vocabulary (Runtime backend section, the five selector-resolution sentences), and the tasks-axi compatibility definition (Backlog backend section). The Toolchain parenthetical defers tasks-axi version gates to the Backlog backend owner instead of restating them, and it absorbed the per-tool purpose clauses (treehouse pools worktrees, no-mistakes runs the pipeline, the axi tools' roles) that previously existed ONLY in the tmux guide's prerequisites - unique content deliberately moved into the owner rather than lost. (2) The five backend guides (tmux, herdr, zellij, orca, cmux) replace their verbatim universal-requirements parentheticals with a pointer to the owner plus only backend-specific items: herdr/zellij/cmux keep their jq and version-floor bullets, orca keeps its node-for-JSON-parsing bullet and the minus-tmux/treehouse exemption, tmux keeps its own install line. (3) Selector-vocabulary restatements in the zellij and cmux guides become pointers; architecture.md's and configuration.md's own trailing partial copies of the selector vocabulary are dropped. (4) CONTRIBUTING.md's 'Compatible means...' sentence becomes a pointer to the owner. (5) Two near-verbatim restatements of orca's bootstrap toolchain behavior (configuration.md carried it twice internally, the orca guide a third time) collapse into the single Toolchain copy. Deliberately untouched, per the wave contract: all empirical verification records in the backend guides, backend-specific setup/behavior/target-string sections, each guide's own backend-selection instructions (backend-specific user guidance, not a universal contract), and AGENTS.md plus the skills (those are the approved slice 3). Also deliberately deferred and documented rather than silently omitted: each guide's internal Setup-vs-Status selection-text duplication, which the audit did not name. PR body accounting (wave requirement): always-loaded AGENTS.md unchanged (slice 3 owns that reduction); full copies removed per contract: universal prereq list 6 copies -> 1 owner + 5 pointers, tasks-axi compatibility definition 7 copies -> 1 owner + pointers, selector vocabulary 4 prose copies -> 1 owner + 2 pointers, orca bootstrap-toolchain behavior 3 copies -> 1; files reduced to pointers: none removed, 7 files carry pointer lines instead of full copies; discoverability proof: every pointer names the owning file and section in the repo's established quoted-section link style, and the grep sweep shows zero remaining 'same universal requirements' phrasings or version-gate restatements outside the owner; checks run: full 59-script behavior suite green, repo-wide shellcheck green, CLAUDE.md and .claude/skills symlink assertions green, cross-reference grep sweep for all three contracts.

What Changed

  • Centralized universal toolchain, task-selector, and tasks-axi compatibility contracts in docs/configuration.md, replacing duplicated backend-guide and contributor prose with pointers.
  • Updated bootstrap checks to detect a missing Git installation and provide installation guidance for standard and Orca toolchains, with regression coverage.
  • Clarified README requirements for Git and an authenticated GitHub CLI.

Risk Assessment

✅ Low: Captain, the change is bounded documentation consolidation plus consistent Git prerequisite detection, with no material risk found.

Testing

The provided full-suite baseline was green; I reran the focused bootstrap behavior test and captured reader-facing documentation evidence showing docs/configuration.md uniquely owns the requested contracts, with valid guide pointers and preserved backend-specific prerequisites.

Evidence: Documentation contract validation

Reader-facing excerpts plus all ownership, pointer, duplicate-sweep, and relative-link checks passed.

Documentation contract validation - reader-facing evidence
Base: 492c937fafead3b817a4b42bdb1247c737982ba8
Target: 962c6957e08f1614be76706e6fa8c05bc9a3a48d

This transcript records the documentation surface a firstmate user reads.
Scope: docs-only consolidation. AGENTS.md is intentionally excluded because the declared follow-up slice owns its reduction.

== Declared owner: docs/configuration.md ==
     9	## Backlog backend (.tasks.toml / config/backlog-backend)
    10	
    11	The tracked `.tasks.toml` pins the default `tasks-axi` markdown backend to `data/backlog.md`, with `done_keep = 10` and an archive at `data/done-archive.md`.
    12	When the default backend is selected and compatible `tasks-axi` is on `PATH`, firstmate uses its verbs for routine backlog mutations.
    13	Secondmate handoffs are separate and unconditional: `fm-backlog-handoff.sh` keeps only its own fleet-level validation and always delegates the item move to `tasks-axi mv`, the single owner of the backlog format.
    14	It moves in-scope `## Queued` items only and refuses `## In flight` and historical `## Done` records, which stay with their home for pruning or archiving.
    15	Handoff item bodies must use at least two leading spaces, and the helper refuses a selected item with a single-space or tab-indented continuation rather than risk orphaning it.
    16	Because bootstrap requires `tasks-axi` on `PATH` on every profile, that delegation works fleet-wide, and the `config/backlog-backend=manual` knob governs firstmate's own hand-editing of its backlog, not this validated helper.
    17	Compatible means the shared bootstrap probe accepts `tasks-axi --version` as 0.1.1 or newer, `tasks-axi update --help` exposes `--archive-body`, and `tasks-axi mv --help` exposes `[<id>...]` for the atomic multi-ID move introduced in 0.2.2 and required by handoff delegation.
    18	That sentence is the single owner of the tasks-axi compatibility definition; every other document points here instead of restating the version gates.
    24	## Runtime backend (config/backend / FM_BACKEND)
    25	
    26	For spawn-capable adapters, the runtime session-provider backend controls where task windows/endpoints are created, captured, sent to, watched, and killed.
    27	`tmux` is the verified reference backend (see [`docs/tmux-backend.md`](tmux-backend.md)); `herdr`, `zellij`, `orca`, and `cmux` are experimental spawn backends (see [`docs/herdr-backend.md`](herdr-backend.md), [`docs/zellij-backend.md`](zellij-backend.md), [`docs/orca-backend.md`](orca-backend.md), and [`docs/cmux-backend.md`](cmux-backend.md)).
    28	Treehouse remains the worktree provider for tmux, herdr, zellij, and cmux, since herdr, zellij, and cmux are session providers only; Orca provides both the task worktree and terminal endpoint.
    29	New spawns choose the backend in this order: an explicit `--backend` flag firstmate passes when it spawns a task, then `FM_BACKEND`, then the first non-empty line of local gitignored `config/backend`, then runtime auto-detection from `$TMUX`, `HERDR_ENV=1`, or cmux runtime signals, then default `tmux`.
    30	If more than one runtime marker is present, detection resolves innermost-first: `$TMUX` is checked before `HERDR_ENV=1`, which is checked before cmux's primary `CMUX_WORKSPACE_ID` marker and its documented fallback signals - tmux or herdr started from inside a cmux terminal is the innermost, currently-executing layer, while cmux itself (a terminal application, not a nestable multiplexer) is always checked last.
    31	See [`docs/cmux-backend.md`](cmux-backend.md#runtime-auto-detection) for why cmux can be selected when `CMUX_WORKSPACE_ID` is absent.
    32	Auto-detected herdr or cmux prints a stderr notice naming `config/backend` and `--backend tmux` as opt-outs; auto-detected tmux stays silent to preserve existing default behavior.
    33	Zellij and Orca are never auto-detected; select them by putting the name in a local `config/backend` file, by exporting `FM_BACKEND=<name>`, or by telling the first mate in chat.
    34	Any value other than `tmux`, `herdr`, `zellij`, `orca`, or `cmux` is rejected until another adapter is implemented and verified.
    35	`fm-spawn.sh` accepts `tmux`, `herdr`, `zellij`, `orca`, and `cmux` for ship and scout tasks; `backend=orca` and `backend=cmux` both still refuse `--secondmate` until secondmate launch semantics are designed for each.
    36	`codex-app` is not an accepted runtime backend yet; [`docs/codex-app-backend.md`](codex-app-backend.md) owns the Codex App boundary.
    37	The session-start secondmate liveness sweep uses a deeper `fm_backend_agent_alive` probe where verified.
    38	Today that probe can classify tmux and herdr secondmate endpoints as `alive`, `dead`, or `unknown`; zellij, Orca, and cmux report `unknown` until their own agent-process classifiers are verified.
    39	A herdr spawn additionally version-gates against the installed `herdr` binary's protocol and requires `jq`, refusing loudly on an incompatible or missing installation.
    40	A zellij spawn additionally version-gates against the installed `zellij` binary's version and requires `jq`, refusing loudly when either is missing or the version is older than 0.44.
    41	A cmux spawn additionally version-gates against the installed `cmux` binary's version, requires `jq`, and requires the control socket to be reachable and accessible (see [`docs/cmux-backend.md`](cmux-backend.md) "Setup" for the one-time socket-access configuration this needs; Automation mode is the recommended socket control mode, with Password mode supported via `config/cmux-socket-password`), refusing loudly and non-retryably on a `cmuxOnly`/unauthenticated socket.
    42	A backend spawn refusal from a missing dependency, version gate, or unauthenticated socket is terminal for that selected backend; firstmate surfaces it as a blocker instead of silently retrying another backend.
    43	Task meta records `backend=` only for a non-default backend; an absent `backend=` means `tmux`, preserving existing default-path meta files.
    44	A herdr task additionally records `herdr_session=`, `herdr_workspace_id=`, `herdr_tab_id=`, and `herdr_pane_id=`.
    45	A zellij task additionally records `zellij_session=`, `zellij_tab_id=`, and `zellij_pane_id=`.
    46	An Orca task additionally records `orca_worktree_id=` and `terminal=`, with `window=fm-<id>` kept as the shared firstmate alias.
    47	A cmux task additionally records `cmux_workspace_id=` and `cmux_surface_id=`.
    48	Task selectors for `fm-peek.sh`, `fm-send.sh`, and `fm-crew-state.sh` resolve centrally through `fm_backend_resolve_selector`.
    49	A selector containing `:` is passed through as an explicit backend endpoint escape hatch.
    50	Otherwise an exact task id matching `state/<id>.meta` wins before the legacy `fm-<id>` label fallback, so task ids that themselves start with `fm-` route to their own metadata instead of being stripped.
    51	A metadata-routed selector returns the recorded backend target (`terminal=` for Orca, otherwise `window=`), and matching explicit targets can still recover the recorded backend when metadata contains the same endpoint.
    52	Only metadata-routed task selectors carry secondmate-marker and Codex-harness context; explicit endpoint escape hatches do not.
    53	These five sentences are the single owner of the task-selector vocabulary; backend guides and other documents point here instead of restating the resolution order.
   130	## Harness support
   131	
   132	claude, codex, opencode, pi, and grok are all empirically verified; new harnesses get verified through a supervised trial task before joining the set.
   169	## Toolchain
   170	
   171	On session start the first mate detects what its required toolchain is missing or too old (tmux, node, git, gh with GitHub auth via `gh auth login`, treehouse with durable lease support, no-mistakes v1.31.2 or newer, gh-axi, chrome-devtools-axi, lavish-axi, compatible tasks-axi per "Backlog backend" above, and quota-axi), lists it with the exact install commands, and installs only after you say go.
   172	This section is the single owner of that universal toolchain list; 

... [1588 bytes truncated] ...

 ("Harness support", "Toolchain"); treehouse still provides the worktree, herdr only provides the session.
    24	

-- docs/zellij-backend.md --
    14	Prerequisites:
    15	
    16	- `zellij` itself, version 0.44 or newer (installed 0.44.0 verified) - see [zellij.dev](https://zellij.dev) for install instructions.
    17	- `jq`, required to parse zellij's JSON output: `brew install jq` (or your platform's package manager).
    18	- The universal firstmate prerequisites - a verified crew harness plus the required toolchain, owned by [`docs/configuration.md`](configuration.md) ("Harness support", "Toolchain"); treehouse still provides the worktree, zellij only provides the session.
    19	
    20	Select zellij by putting `zellij` in a local `config/backend` file - the durable way to pick it - or by exporting `FM_BACKEND=zellij` when you launch your harness for a one-off session; telling the first mate in chat to use zellij also works.
    21	Unlike tmux and herdr, zellij is **never** auto-detected - it always requires an explicit choice.
    22	A zellij spawn refuses loudly before creating a session container or acquiring a ship/scout worktree if `zellij` or `jq` is missing or the installed zellij is older than 0.44.

-- docs/orca-backend.md --
    12	Prerequisites:
    13	
    14	- The Orca app installed at `/Applications/Orca.app`, and **running**.
    15	- The `orca` CLI: `brew install orca`.
    16	- `node`, used by firstmate's adapter to parse Orca's JSON output and to gate spawns on runtime readiness.
    17	- The universal firstmate prerequisites minus `tmux` and `treehouse` (Orca replaces both) - a verified crew harness plus the required toolchain, owned by [`docs/configuration.md`](configuration.md) ("Harness support", "Toolchain").
    18	
    19	Select Orca by putting `orca` in a local `config/backend` file - the durable way to pick it - or by exporting `FM_BACKEND=orca` when you launch your harness for a one-off session; telling the first mate in chat to use Orca also works.
    20	It is never auto-detected.

-- docs/cmux-backend.md --
    16	Prerequisites:
    17	
    18	- The cmux app itself, installed from [cmux.com](https://cmux.com) or `brew install --cask cmux`, version 0.64.17 or newer.
    19	- `jq`, required to parse cmux's JSON output: `brew install jq` (or your platform's package manager).
    20	- The universal firstmate prerequisites - a verified crew harness plus the required toolchain, owned by [`docs/configuration.md`](configuration.md) ("Harness support", "Toolchain"); treehouse still provides the worktree, cmux only provides the session.
    21	- The cmux CLI binary is not guaranteed to be on `PATH` after a plain app install (see "CLI is not on PATH by default" below) - the adapter falls back to the well-known bundle path automatically, so this is not a blocker, just something to be aware of if you want to run `cmux` yourself from a shell.

== Selector and contributor pointers ==
    57	Because every task in every firstmate home - primary or secondmate - shares this ONE session's tab bar with no per-home container split, and zellij enforces no tab-name uniqueness at all (verified: two tabs can share a name), two firstmate homes whose task ids happen to collide could send/peek/close each other's tabs.
    58	This is the exact gap a captain-directed no-mistakes review gate caught for the cmux backend (`docs/cmux-backend.md` "Task container shape") - cmux's fix was ported here for the identical reason, sharing its tag-derivation code (`bin/fm-backend-hometag-lib.sh`).
    59	
    60	The caller-facing task label stays `fm-<id>` in meta and briefs; task-selector resolution is the shared contract owned by [`docs/configuration.md`](configuration.md) ("Runtime backend").
    61	The actual zellij tab title a NEW task's tab is created with is home-scoped: `fm-<home-label>-<id>`.
    62	`<home-label>` is `firstmate` for the primary home, or `2ndmate-<id>` when `$FM_HOME/.fm-secondmate-home` contains a secondmate id, plus a short stable hash of the resolved `FM_ROOT` path - the same identity scheme as cmux's home label (`docs/cmux-backend.md` "Task container shape"), so e.g. `fm-firstmate-a1b2c3d4-fix-login-k3` or `fm-2ndmate-sm1-9f8e7d6c-fix-login-k3`.
    55	No first-run provisioning beyond the socket-access setup above and having `jq` installed; firstmate creates the workspace it needs on first spawn, launching the app itself (`open -a cmux`) if it is not already running.
    56	
    57	Watching and attaching: firstmate uses one workspace per task in whatever cmux window is currently open.
    58	Task selectors resolve through the shared contract owned by [`docs/configuration.md`](configuration.md) ("Runtime backend"), while the actual cmux workspace title is home-scoped as `fm-<home-label>-<id>`, for example `fm-firstmate-<8hex>-cmux-e2e-t1` in the primary home or `fm-2ndmate-<secondmate-id>-<8hex>-cmux-e2e-t1` in a secondmate home.
    59	You do not need to bring the window forward for routine supervision: from an active firstmate session, `bin/fm-peek.sh <id>` reads a task's surface without focusing it, and `FM_HOME=<this-firstmate-home> bin/fm-send.sh <id> "<text>"` steers it unless `FM_HOME` is already set to the active firstmate home - workspace/surface/pane creation all default `focus` to `false`, so an unattended spawn never steals your view.
    60	
    37	- Only shared material is tracked: `AGENTS.md`, `README.md`, `CONTRIBUTING.md`, `.tasks.toml`, `.github/workflows/`, `bin/`, `.agents/skills/`, and `skills/`.
    38	  `.agents/skills/` holds agent-loaded skills that assume a live firstmate home and carry `metadata.internal: true` so installers such as [skills.sh](https://skills.sh) hide them from discovery; `skills/` holds standalone, installer-facing public skills with no firstmate dependency (see the README's "Two-tier skill layout").
    39	  Everything personal to one captain's fleet (`.env`, `data/`, `state/`, `config/`, `projects/`, `.no-mistakes/`) is gitignored; never commit it.
    40	  The root `.tasks.toml` is tracked `tasks-axi` config for `data/backlog.md`; compatible `tasks-axi` is the default backend for routine backlog mutations, with the compatibility definition owned by [`docs/configuration.md`](docs/configuration.md) ("Backlog backend").
    41	  A local `config/backlog-backend=manual` opt-out forces firstmate's routine backlog updates to hand-editing and stays gitignored; validated secondmate handoffs still delegate through `tasks-axi mv`.
    42	  A local `config/backend` file explicitly overrides runtime auto-detection for new task endpoints and stays gitignored; spawn-supported values are `tmux` plus experimental `herdr`, `zellij`, `orca`, and `cmux`, while `codex-app` is documented only in `docs/codex-app-backend.md`.

== Contract checks ==
PASS: owning section exists: Backlog backend (.tasks.toml / config/backlog-backend)
PASS: owning section exists: Runtime backend (config/backend / FM_BACKEND)
PASS: owning section exists: Harness support
PASS: owning section exists: Toolchain
PASS: docs/tmux-backend.md names configuration.md and its owner sections
PASS: docs/herdr-backend.md names configuration.md and its owner sections
PASS: docs/zellij-backend.md names configuration.md and its owner sections
PASS: docs/orca-backend.md names configuration.md and its owner sections
PASS: docs/cmux-backend.md names configuration.md and its owner sections
PASS: CONTRIBUTING.md names the Backlog backend owner
PASS: zellij and cmux selectors point to the Runtime backend owner
PASS: no old "same universal requirements as tmux" copy remains in docs or CONTRIBUTING.md
PASS: no tasks-axi compatibility/version-gate restatement remains outside the owner
PASS: removed architecture/zellij/cmux selector-vocabulary copies are absent
PASS: one Orca bootstrap-toolchain behavior copy remains, in the Toolchain owner
PASS: every relative changed-guide pointer resolves to docs/configuration.md

== Focused automated behavior check run ==
bash tests/fm-bootstrap.test.sh
Result: passed, including the end-user missing-git report contract: MISSING: git (install: brew install git  # or the platform\x27s package manager).

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • ⚠️ docs/configuration.md:171 - The new toolchain owner says bootstrap detects and can install git, but bin/fm-bootstrap.sh neither probes nor installs it. Add matching bootstrap support or describe Git as an external prerequisite.
  • ⚠️ docs/configuration.md:18 - The new single-owner claim for tasks-axi compatibility is broader than the repository state: AGENTS.md still restates its compatibility gates. Either consolidate those copies or scope the ownership claim to this documentation subset.
  • ⚠️ docs/configuration.md:53 - The task-selector ownership claim is broader than the repository state: docs/herdr-backend.md and AGENTS.md still describe exact-id, legacy-label, and explicit-target resolution. Either replace them with pointers or narrow this ownership assertion.

🔧 Fix: Detect Git in bootstrap toolchain
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"
  • Baseline supplied as passed: command -v tmux &gt;/dev/null || { echo &#34;tmux is required for e2e tests&#34; &gt;&amp;2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo &#34;== $t ==&#34;; bash &#34;$t&#34; || rc=1; done; exit &#34;$rc&#34;
  • bash tests/fm-bootstrap.test.sh
  • Manual reader-facing documentation owner, pointer, duplicate-sweep, and relative-link verification recorded in the evidence transcript.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Slice 2 of the documentation redundancy cleanup wave (firstmate scope).

docs/configuration.md is now the declared single owner of three
universal contracts, each with an explicit ownership sentence:
- the universal toolchain list (Toolchain), now also carrying the
  per-tool purpose clauses that previously lived only in the tmux guide;
- the task-selector vocabulary (Runtime backend);
- the tasks-axi compatibility definition (Backlog backend).

The five backend guides' prerequisites replace their verbatim
universal-requirements parentheticals (5 full copies) with a pointer
plus only backend-specific items; zellij/cmux selector restatements
and architecture.md's partial copy become pointers or are dropped;
CONTRIBUTING's compatibility sentence becomes a pointer; two
near-verbatim orca-bootstrap restatements (configuration.md Runtime
backend, orca guide) collapse into the Toolchain owner copy.

Backend-specific setup, behavior, target-string shapes, and every
empirical verification record are untouched. AGENTS.md untouched
(slice 3).
The review flagged that the new universal-toolchain owner omitted git
and GitHub authentication while every backend guide now defers its
prerequisites here; bootstrap's NEEDS_GH_AUTH check makes them real
universal requirements.
@kunchenguid
kunchenguid merged commit bc558c6 into main Jul 10, 2026
4 checks passed
@kunchenguid
kunchenguid deleted the fm/fm-doc-cleanup-c3-s2 branch July 10, 2026 23:27
Keigyoku pushed a commit to Keigyoku/firstmate that referenced this pull request Jul 11, 2026
* docs: consolidate universal backend contracts into configuration.md

Slice 2 of the documentation redundancy cleanup wave (firstmate scope).

docs/configuration.md is now the declared single owner of three
universal contracts, each with an explicit ownership sentence:
- the universal toolchain list (Toolchain), now also carrying the
  per-tool purpose clauses that previously lived only in the tmux guide;
- the task-selector vocabulary (Runtime backend);
- the tasks-axi compatibility definition (Backlog backend).

The five backend guides' prerequisites replace their verbatim
universal-requirements parentheticals (5 full copies) with a pointer
plus only backend-specific items; zellij/cmux selector restatements
and architecture.md's partial copy become pointers or are dropped;
CONTRIBUTING's compatibility sentence becomes a pointer; two
near-verbatim orca-bootstrap restatements (configuration.md Runtime
backend, orca guide) collapse into the Toolchain owner copy.

Backend-specific setup, behavior, target-string shapes, and every
empirical verification record are untouched. AGENTS.md untouched
(slice 3).

* docs: include git and GitHub auth in the toolchain owner list

The review flagged that the new universal-toolchain owner omitted git
and GitHub authentication while every backend guide now defers its
prerequisites here; bootstrap's NEEDS_GH_AUTH check makes them real
universal requirements.

* no-mistakes(review): Detect Git in bootstrap toolchain

* no-mistakes(document): Clarify GitHub CLI and centralize selector documentation

(cherry picked from commit bc558c6)
Keigyoku added a commit to Keigyoku/firstmate that referenced this pull request Jul 11, 2026
…, kunchenguid#435 deferred) (#8)

* feat: add harness-aware supervision (kunchenguid#367)

* Add harness-aware supervision

* no-mistakes(review): Captain, harden watcher supervision regressions

* no-mistakes(review): Captain, harden watcher supervision cadence

* no-mistakes(review): Harden watcher supervision ownership

* no-mistakes(review): Captain, harden Pi extension marker

* no-mistakes(review): Captain, harden Pi supervision restart checks

* no-mistakes(review): Harden watcher ownership checks

* no-mistakes(review): Captain, harden Pi supervision loading

* no-mistakes(review): Captain, require Pi guard extension loading

* no-mistakes(review): Captain, harden watcher supervision recovery

* no-mistakes(test): Fix fm-send baseline log filtering

* no-mistakes(document): Sync harness supervision docs

* no-mistakes: apply CI fixes

(cherry picked from commit 090483e)

* fix: split X-mode replies by platform (kunchenguid#369)

* fix: make x replies split by platform

* no-mistakes(review): Captain: preserve Discord recovery relink context

* no-mistakes(test): Captain: keep split markers outside fences

* no-mistakes(document): Sync X-mode reply docs

(cherry picked from commit 4790bc5)

* fix: make stow memory writes inspect before update (kunchenguid#372)

* docs: make stow inspect-then-update

* no-mistakes(review): Remove unsupported archive-body guidance

* no-mistakes(review): Clarify stow read-before-write exception

* no-mistakes(test): Require archive-body for stow task notes

* no-mistakes(document): Sync stow memory docs

* no-mistakes(lint): Silence ShellCheck source warning

(cherry picked from commit af5361e)

* fix(watcher): wait when arm attaches to a healthy watcher (kunchenguid#375)

* fix: attach-and-wait when arm finds a healthy watcher

Grok and Claude re-arm after every turn with work in flight. When a
watcher was already healthy, fm-watch-arm exited immediately with
watcher: healthy, which completed the harness background task and
injected an empty false wake.

Attach to the live identity-matched holder instead, stay until that
cycle ends, then exit 0 so notify fires for a real end-of-cycle. The
peer-startup-race path uses the same contract. --restart and the
started path are unchanged.

* no-mistakes(review): Gate restart watcher peer attach

* no-mistakes(document): Sync watcher arm docs

(cherry picked from commit 7302a95)

* feat(pi): simplify primary session launch (kunchenguid#386)

* docs(readme): reformat Quick Start and recommend Grok equally with Claude Code

* no-mistakes(review): Captain: align harness launch guidance

* no-mistakes(review): Captain, clarify Pi supervised launch

* no-mistakes(review): Captain, document Pi first-launch bridge

* feat(pi): track primary watcher extension for plain-pi launch

Move Pi's primary watcher bridge from a generated state/ file to a
tracked .pi/extensions/fm-primary-pi-watch.ts, matching how the turn-end
guard extension already works: self-hashing version, project-local
auto-discovery after one-time Pi trust. This drops the state/-generation
step and dual -e requirement from the happy path, so Pi's Quick Start
launch becomes plain 'pi', the same friction class as 'claude' and
'grok --trust'.

- bin/fm-pi-watch-extension.sh is removed; nothing generates the
  extension anymore since it is committed.
- fm-session-start.sh and fm-supervision-instructions.sh resolve the
  watcher extension path from FM_ROOT instead of state/, and the
  session-start diagnostic now points at restarting plain pi after
  trust, with -e as a documented fallback.
- fm-spawn.sh points Pi secondmate launches at the tracked extension
  path in the secondmate home instead of generating a state/ copy.
- README Quick Start Pi block is now just 'pi' plus a trust note.
- Tests, docs, and the harness-adapters skill updated to match.

* fix(pi): drop backticks from session-start diagnostic to satisfy shellcheck SC2016

(cherry picked from commit 1b5a9f5)

* feat(supervision): prevent unsafe watcher-arm commands (kunchenguid#387)

* feat(supervision): add PreToolUse seatbelt against watcher-arm anti-patterns

Adds bin/fm-arm-pretool-check.sh, a shared PreToolUse-style checker that
denies a primary shell command backgrounding, piping, or bundling the
watcher arm/checkpoint, or force-killing the watcher process broadly -
the exact shapes that silently took Grok's supervision down. Wires it
into all five verified harnesses (grok, claude, codex, opencode, pi),
each validated empirically against the real harness.

Also fixes a grok 0.2.93 regression discovered during that validation: the
existing turnend-guard Stop hook's bare root variable broke grok's own
variable pre-substitution and silently no-op'd the hook.

* no-mistakes(review): Harden watcher arm validation

* no-mistakes(review): Harden arm guard metacharacter checks

* no-mistakes(review): Harden nested shell arm guard

* fix(lint): rewrite SC2015 guards in fm-arm-pretool-check.sh as if/then

A && B || C is not if-then-else; C can run when A is true. Replace both
occurrences of the quote-state early-continue with an explicit if/then.

(cherry picked from commit 766f772)

* fix(pi): restore primary watcher supervision lifecycle (kunchenguid#397)

* fix Pi primary supervision lifecycle

* no-mistakes(document): Synchronize Pi primary extension documentation

(cherry picked from commit 80ecc8d)

* fix: keep persistent secondmates out of the main backlog (kunchenguid#398)

* fix secondmate backlog guidance

* no-mistakes(review): Require reasons for captain backlog holds

* no-mistakes(test): Document secondmate handoff skill requirement

* fix secondmate teardown reminder

* no-mistakes(document): sync teardown reminder docs to work-items-only backlog contract

(cherry picked from commit 7525a37)

* fix(backlog-handoff): move full item blocks including indented bodies (kunchenguid#401)

* fix(backlog-handoff): move full item blocks including indented bodies

fm-backlog-handoff only moved the checklist header line, so multi-line
item bodies were left orphaned in the source backlog and never reached
the secondmate. Move the full block (header plus indented body lines)
atomically, treating body membership by indentation so lines like
## Intent stay with the item, and add regression coverage.

* no-mistakes(review): Captain: preserve EOF handoff terminators

* no-mistakes(review): treat blank lines inside item bodies as movable body

* no-mistakes(document): sync backlog-handoff docs with full-block move behavior

(cherry picked from commit 600075e)

* feat(herdr): make Herdr lab lifecycle safety deterministic for briefs (kunchenguid#402)

* guard Herdr lab lifecycle in briefs

* no-mistakes(review): Fix Herdr lab helper and provisioning safety

* no-mistakes(review): Captain, harden Herdr lab lifecycle safety

* no-mistakes(review): fix Herdr lab test cleanup ordering and brief help range

* no-mistakes(review): reject leading options in Herdr lab run guard

* no-mistakes(review): strip leading non-alnum in Herdr lab name generator

* no-mistakes(document): document Herdr lab helper and --herdr-lab brief flag

* no-mistakes(lint): add shellcheck disable for deliberate SC2016 literals in fm-brief herdr-lab

* no-mistakes: apply CI fixes

(cherry picked from commit 4bc0824)

* fix(watcher): classify arm-command seatbelt by execution position (kunchenguid#403)

* fix watcher arm command policy

* no-mistakes(review): Harden watcher command policy parsing

* no-mistakes(review): Captain: harden watcher policy parsing

* no-mistakes(review): harden watcher policy for expanded paths, direct-watch, and sound prefilter

* no-mistakes(review): close prefilter and classifier locale/ANSI-C watcher-path decode gaps

* no-mistakes(review): fail closed on loop-wrapped broad watcher kills

* no-mistakes(document): sync docs for watcher-arm command-position policy

(cherry picked from commit 22b1d71)

* fix: reconcile existing AGENTS.md safely (kunchenguid#405)

* fix(agents-md): inject self-governance section into existing AGENTS.md

fm-ensure-agents-md.sh only appended the canonical "## Maintaining this
file" section on skeleton create or CLAUDE.md promotion, so an existing
AGENTS.md that lacked it exited unchanged and forced hand-copying the
wording during a rollout across existing projects. Call the already-
idempotent ensure_maintenance_section on the existing-AGENTS.md paths and
report whether the file changed; a re-run and an already-complete file stay
byte-identical.

Also fixes kunchenguid#389: refuse a case-variant real memory file (e.g. a lowercase
agents.md) instead of silently emitting a CLAUDE.md symlink whose uppercase
literal target dangles once the tree lands on a case-sensitive filesystem.

Tests extend tests/fm-ensure-agents-md.test.sh; skeleton-create and
CLAUDE.md-promotion regressions still pass. Docs updated to match.

* no-mistakes(review): Captain: preserve CRLF maintenance-section idempotency

* no-mistakes(review): Preserve CRLF during maintenance-section injection

* no-mistakes(review): Captain: harden dangling-symlink regression coverage

* no-mistakes(document): Document agent-memory injection outcomes

(cherry picked from commit 96244f4)

* feat: support project-less secondmate homes (kunchenguid#409)

* feat(secondmate): support project-less homes via --no-projects

fm-brief.sh --secondmate and fm-home-seed.sh now accept an explicit
--no-projects signal to scaffold, seed, and register a secondmate home
whose subject is the firstmate repo itself (no clones). The signal is
mutually exclusive with a project list; omitting both still fails loudly
so an accidental omission is never a silent project-less seed. The
registry line renders an empty projects: field, which spawn and the
snapshot already tolerate. Docs updated in the secondmate-provisioning
skill and both script headers.

* no-mistakes(review): Captain: document project-less secondmate flow

* no-mistakes(review): Captain: refuse project-less reseeding of populated homes

* fix(seed): fail closed on unreadable project data

* no-mistakes(review): Captain: reject stale projectful charters

* no-mistakes(review): Captain: fail closed on unsafe project paths

* no-mistakes(review): Captain: validate project-less charter clone sections

* no-mistakes(document): Document project-less secondmate seeding

(cherry picked from commit 08453f9)

* fix: delegate backlog handoffs to tasks-axi (kunchenguid#411)

* wip(handoff): record verified delegation design + tasks-axi mv blocker

No production code changed yet. tasks-axi mv (v0.2.1) cannot atomically
move a blocked-by-linked item set across backlogs (deadlocks both orders,
no batch/--force), which fm-secondmate-lifecycle-e2e requires. Parked
pending a tasks-axi connected-set mv enhancement; note captures the
verified design, semantics, test/CI/doc changes, and resume checklist.

* refactor(handoff): delegate the item move to tasks-axi mv

fm-backlog-handoff.sh's two-pass awk was a second parser of the backlog
format and the source of the PR kunchenguid#401 body-orphaning drift. Delete it and
delegate the move to `tasks-axi mv <id>... --to <dest>` (v0.2.2 atomic
multi-id), the single owner of the format: a connected set (blocker plus
dependents) moves together with blocked-by preserved, item blocks stay
byte-exact, and destination section placement holds. The helper keeps only
the fleet-level validation tasks-axi cannot know - secondmate-home
resolution, the seeded-home safety checks, the In-flight refusal, and
idempotent per-key reporting - and is atomic: on any move failure nothing
moves.

Tests: fm-backlog-handoff.test.sh keeps PR kunchenguid#401's regression matrix but now
exercises the delegated path and skips cleanly when tasks-axi is absent; the
two whole-file fixtures move to tasks-axi's canonical whitespace. The
lifecycle-e2e and safety move-cases gain the same skip guard. CI installs
tasks-axi so the delegated path is exercised. Docs state that
config/backlog-backend=manual governs firstmate's own hand-editing, not this
validated helper, which delegates fleet-wide because bootstrap requires
tasks-axi on PATH.

Remove the now-redundant WIP design note.

* no-mistakes(review): Captain: harden atomic backlog handoffs

* no-mistakes(review): Captain: enforce queued-only backlog handoffs

* no-mistakes(review): Captain: harden handoff section parsing

* no-mistakes(document): Document delegated backlog handoffs

* no-mistakes(lint): Silence ShellCheck source diagnostics

(cherry picked from commit 31afb8c)

* fix: ignore secondmate home marker during sync (kunchenguid#417)

* fix: gitignore the secondmate home marker

bin/fm-home-seed.sh writes an untracked .fm-secondmate-home marker into
every seeded secondmate home. A secondmate home is a worktree of the
firstmate repo, so any plain `git status --porcelain` dirtiness check
counted the untracked marker and the home read as dirty forever:
fleet-sync reported it STUCK and the local fast-forward convergence
sweeps risked leaving it stale on firstmate updates.

Add .fm-secondmate-home to the tracked .gitignore so the marker is
invisible to every dirtiness check uniformly, without weakening
fleet-sync's deliberate untracked-counting for project clones.

Convergence chicken-and-egg: existing homes predate the fix and it only
arrives by fast-forward. The already-present marker-tolerant ff-skip
(ignore_seed_marker=yes, used by the bootstrap sweep, /updatefirstmate,
and spawn pre-launch) advances such a home past the fix commit, after
which .gitignore takes over - no hand intervention.

Tests in tests/fm-secondmate-sync.test.sh cover a freshly seeded home
reading clean, an existing marker-only home converging then reading
clean, and a genuinely dirty home still skipping.

* no-mistakes(review): Captain: document standalone-clone update path

* no-mistakes(document): Document secondmate marker migration

(cherry picked from commit 171207c)

* fix(composer): prevent dead-shell message injection (kunchenguid#416)

* fix(composer): stop reading dead-shell prompts as empty agent composers

Consolidate composer empty/pending/unknown classification into one shared
owner, bin/fm-composer-lib.sh's fm_composer_classify_content, delegated to by
all four backend adapters (tmux via fm-tmux-lib.sh, herdr, orca, cmux). This
replaces four drifting copies of the glyph decision.

Safety fix: a bare shell prompt glyph (> $ % #) on an unstructured row is now
classified unknown (a dead shell, unsafe for injection), not empty. It is only
empty inside a bordered composer box (the harness's own prompt). Agent glyphs
❯ (claude) and › (codex) read empty either way. The away-mode injector
(inject_msg) now requires an affirmatively-empty composer, deferring on pending
or unknown, so an escalation can never be typed into (or executed by) a pane
whose agent exited to its login shell.

Regression coverage: new tests/fm-composer-lib.test.sh pins the shared owner;
per-backend dead-shell tests in fm-daemon (tmux + injector), orca, and the
existing herdr/cmux suites. shellcheck clean; herdr incident regressions stay
green.

* no-mistakes(review): Captain: harden composer safety checks

* no-mistakes(test): Stabilize Herdr prune safety setup

* no-mistakes(document): Document composer injection safety

* no-mistakes(lint): Clean composer safety lint

* no-mistakes: apply CI fixes

(cherry picked from commit a955a05)

* feat(watcher): add paused external-wait supervision (kunchenguid#421)

* feat(watcher): add paused/awaiting-external crew state

A crew (or firstmate steering it) can declare a deliberate wait on a known
external dependency with a paused: <reason> status. Both the always-on watcher
and the away-mode daemon absorb such an idle pane through shared fm-classify-lib.sh
vocabulary instead of tripping the possible-wedge stale escalation, and re-surface
it for a recheck only on a long bounded cadence (FM_PAUSE_RESURFACE_SECS) so a
forgotten pause cannot rot invisibly. fm-crew-state.sh reports state: paused
distinctly. A crew that goes idle without declaring a pause classifies exactly as
before. Docs and brief scaffold state lists updated; tests colocated.

* no-mistakes(review): Captain: fix paused-state transitions

* init

* no-mistakes(review): Captain: fix paused-state supervision transitions

* no-mistakes(review): Captain: fix paused supervision handoffs

* no-mistakes(review): Reconcile paused supervision markers

* no-mistakes(review): Captain: prioritize paused states over captain relevance

* no-mistakes(review): Captain: preserve paused-working wedge timer

* no-mistakes(review): Captain: honor configured pause verb in briefs

* no-mistakes(test): Captain: fix AFK paused watcher handoff

* no-mistakes(document): Document declared external waits

* no-mistakes(lint): Clean paused-state lint

---------

Co-authored-by: fmtest <[email protected]>
(cherry picked from commit 7788fa3)

* fix: preserve X-mode follow-up platform limits (kunchenguid#425)

* fix(x-mode): make follow-up platform splitting immune to link ordering

A ~470-char Discord follow-up posted as a (1/2)(2/2) thread split at ~280
chars because fm-x-link only learned the platform from the inbox payload,
and the fmx-respond ack path can drain that inbox file before the task is
linked. A link recorded after cleanup silently lost the platform and the
splitter defaulted to the X 280-char budget.

Make platform resolution ordering-proof:

- fm-x-link now resolves the platform AUTHORITATIVELY by request_id via a
  new fmx_request_relay_context helper (POST /connector/request-context)
  when neither the inbox payload nor carry flags carry it. The request_id
  survives the inbox drain, so a post-cleanup link still learns the right
  split budget. Best-effort: no token/curl or a non-2xx relay degrades to
  the loud warning below rather than a silent X default.
- fm-x-link warns loudly when no platform source resolves, so the loss is
  never silent.
- The fmx-respond procedure now orders link-before-inbox-cleanup so the
  fast local path stays correct without a relay round-trip.

Colocated regression tests: a Discord follow-up >280 <2000 posts as ONE
message even when linked after inbox cleanup, and an unresolvable platform
warns loudly instead of splitting silently. docs/configuration.md documents
the request-context lookup.

The relay endpoint is the companion durable change (see done status); until
it ships, the link-before-cleanup reorder keeps the normal path correct.

* no-mistakes(document): Document X-mode platform recovery

(cherry picked from commit 5f808cc)

* fix(composer): handle ANSI ghost text safely (kunchenguid#429)

* fix(composer): one ANSI-aware ghost owner covers claude dim + grok truecolor

Away-mode injection wedged all night on the primary claude-on-herdr pane:
the herdr composer classifier never stripped generic dim ghost text (only a
narrow codex bold-wrapped byte-pattern check), so claude's rotating
prompt-suggestion ghost - a bare "❯" then SGR-2 dim text, which herdr's ANSI
pane read preserves - read as real pending input and every escalation deferred
(6524 lifetime "pending input (non-empty composer)" defers; wedge 30623s).

Consolidate ghost extraction into one fleet-wide ANSI-aware owner,
fm_composer_strip_ghost (bin/fm-composer-lib.sh), that drops every
de-emphasised run - dim/faint (SGR 2: claude, codex) AND a dark/muted truecolor
foreground (grok's placeholder, luminance below FM_COMPOSER_GHOST_LUMA_MAX,
default 128, dark-theme assumption). Both ANSI-capable backends route through
it: fm_tmux_composer_state (fm_tmux_strip_ghost is now a thin adapter) and
fm_backend_herdr_composer_state. The herdr-only faint byte-pattern check is
removed and fm_backend_herdr_strip_ansi reduced to a thin adapter over the
shared fm_composer_strip_ansi. Bordered detection now reads the plain row so a
dark box border dropped with the ghost does not lose the composer shape.

This also closes the documented grok TRUECOLOR placeholder gap by the same
mechanism (harness-adapters skill note updated).

Empirical evidence (read-only live capture + isolated tmux, no herdr lifecycle)
and the incident write-up are in docs/herdr-backend.md; deterministic
regressions feed the exact captured bytes through the real classifiers
(tests/fm-backend-herdr.test.sh, tests/fm-composer-ghost.test.sh). Two prior
ghost-test fixtures that used a near-black 38;2;1;2;3 as "real" colored text
(never a realistic real-input color) are corrected to a bright 38;2;224;222;244,
preserving the truecolor payload-skip parser intent.

* no-mistakes(review): Preserve dark shell prompt safety

* no-mistakes(review): Harden erased shell prompt classification

* no-mistakes(document): Document shared composer ghost extraction

* no-mistakes(lint): Normalize tmux comment punctuation

(cherry picked from commit 0eaf293)

* fix(spawn): make tmux window handling robust under non-default config (kunchenguid#134)

(cherry picked from commit 6d90240)

* test: isolate session-start suite from ambient harness markers (kunchenguid#432)

* fix(session-start): isolate harness env markers in suite runner

Neutralize CLAUDECODE, PI_CODING_AGENT, and GROK_AGENT in
run_session_start so ambient interactive shells cannot override the
suite's fake ps harness (local-vs-CI split on the pi supervision case).

* no-mistakes(document): Correct Pi marker documentation

(cherry picked from commit 3e3dff6)

* fix: complete brief help and consolidate documentation (kunchenguid#438)

* docs: de-feature the scripts.md and CONTRIBUTING test inventories

Slice 1 of the documentation redundancy cleanup wave (firstmate scope).

docs/scripts.md: every row is now one purpose clause; script headers
are the declared owner of behavior, flags, and contracts. Coverage
stays 61/61 scripts; bytes drop 19,922 -> 7,958.

CONTRIBUTING.md: the 54-row per-test inventory is gone; contributors
discover tests by listing tests/*.test.sh and reading each script's
own header, and gated tests print their own skip gates. The run
commands, symlink assertions, and watcher smoke line are unchanged.
Lines drop 135 -> 84 (18,797 -> 7,831 bytes).

Two facts that existed only as inventory rows moved into their
owners' headers first: fm-brief.sh's paused-vs-blocked scaffold
distinction and fm-session-start.sh's Pi extension-loaded check.

No instruction-surface or behavior change; AGENTS.md untouched.

* no-mistakes(review): Captain, fix brief help and Grok test discovery

* no-mistakes(review): Captain: document Grok lock-holder test coverage

(cherry picked from commit 492c937)

* fix: detect Git and centralize backend configuration (kunchenguid#445)

* docs: consolidate universal backend contracts into configuration.md

Slice 2 of the documentation redundancy cleanup wave (firstmate scope).

docs/configuration.md is now the declared single owner of three
universal contracts, each with an explicit ownership sentence:
- the universal toolchain list (Toolchain), now also carrying the
  per-tool purpose clauses that previously lived only in the tmux guide;
- the task-selector vocabulary (Runtime backend);
- the tasks-axi compatibility definition (Backlog backend).

The five backend guides' prerequisites replace their verbatim
universal-requirements parentheticals (5 full copies) with a pointer
plus only backend-specific items; zellij/cmux selector restatements
and architecture.md's partial copy become pointers or are dropped;
CONTRIBUTING's compatibility sentence becomes a pointer; two
near-verbatim orca-bootstrap restatements (configuration.md Runtime
backend, orca guide) collapse into the Toolchain owner copy.

Backend-specific setup, behavior, target-string shapes, and every
empirical verification record are untouched. AGENTS.md untouched
(slice 3).

* docs: include git and GitHub auth in the toolchain owner list

The review flagged that the new universal-toolchain owner omitted git
and GitHub authentication while every backend guide now defers its
prerequisites here; bootstrap's NEEDS_GH_AUTH check makes them real
universal requirements.

* no-mistakes(review): Detect Git in bootstrap toolchain

* no-mistakes(document): Clarify GitHub CLI and centralize selector documentation

(cherry picked from commit bc558c6)

* feat(daemon): add backend-independent wedge alerts (kunchenguid#444)

* feat(daemon): backend-independent active alert for the wedge alarm

When away-mode injection wedges past max-defer, inject_wedge_alarm only
actively signalled via the tmux status-line, which is skipped on non-tmux
backends. A wedged claude-on-herdr primary left only the passive
state/.subsuper-inject-wedged marker (2026-07-10 overnight incident).

Add a config-gated active alert (config/wedge-alarm, local/gitignored;
FM_WEDGE_ALARM_CHANNEL) that reaches the captain even when every pane and
its status-line is unreadable: an OS-level macOS notification (osascript),
a herdr notification, or a captain-supplied command. Default-on (auto) so
the alarm is never silent; each channel best-effort, degrading to the next
and never crashing the daemon loop. The tmux flash and durable marker stay.

The OS notifiers route through a single FM_WEDGE_ALARM_EXEC seam. When the
daemon is sourced (only tests do this; production execs it) the seam
defaults to "discard", and tests/wake-helpers.sh points it at a recorder,
so it is structurally impossible for any test to post a real notification.

Channels verified once manually on macOS 26.5.2 / herdr 0.7.3; see
docs/wedge-alarm.md.

* no-mistakes(review): Bound wedge alarm notifier execution

* no-mistakes(review): Captain: harden wedge alarm notifier safety

* no-mistakes(review): Captain: harden wedge alarm test notifier isolation

* no-mistakes(review): Captain: harden wedge alarm throttling

* no-mistakes(review): Redact wedge alarm directive logs

* no-mistakes(review): Harden wedge alarm notifier safety

* no-mistakes(review): Track notifier process groups through cleanup

* no-mistakes(document): Document wedge-alarm active alert behavior

(cherry picked from commit 52241a5)

* fix(successor): carry reply-platform context through X relinks

Integration reconciliation: upstream's platform-aware fm-x-link.sh
requires carried reply context on relink, so the successor's X-link
carry now forwards the predecessor's x_platform/x_reply_max_chars,
defaulting a pre-platform link to the X budget instead of halting
the watchdog.

* no-mistakes(review): Captain, restore cursor/hermes tmux detection

* no-mistakes(test): captain: fix watcher test regressions

* test(turnend-guard): restore PR #7 project-dir fallback coverage

Rebase reconciliation: re-port the unset-CLAUDE_PROJECT_DIR fallback
and physical-identity tests that the Pi logical-run test replay had
displaced, on top of the logical-run suite.

* no-mistakes(test): Hermeticize turnend guard harness tests

* no-mistakes(document): Sync session-start doc comments

---------

Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: fmtest <[email protected]>
Co-authored-by: Pierre Marais <[email protected]>
DereKk8 added a commit to DereKk8/firstmate that referenced this pull request Jul 12, 2026