Repository navigation
fix: harden crew dispatch profile enforcement - #159
Merged
Merged
Conversation
JTInventory
added a commit
to JTInventory/firstmate
that referenced
this pull request
Jun 30, 2026
* feat(x-mode): add X mention completion follow-ups (kunchenguid#113) * feat(x-mode): X-mention completion follow-up flow Acknowledge an actionable X mention first, do the work, then post one follow-up reply when it completes. - fm-x-reply.sh: add --followup mode posting to the relay's /connector/followup endpoint; reuses thread-split, payload shape, dry-run (with a self-describing endpoint marker), and never-inline safety. Answer path unchanged. - fm-x-link.sh: link a spawned task to its originating mention via x_request/x_request_ts in state/<id>.meta (atomic, preserves other lines). - fm-x-followup.sh: --check detection plus post-and-clear on terminal completion; honors the 24h window (skip+prune past it), keeps the link on a failed post for retry. - fm-x-lib.sh: shared meta link get/set/clear helpers. - Docs: fmx-respond reads as one ack-first -> act -> follow-up flow; AGENTS.md §14 + supervision pointer document the link, completion follow-up, and 24h public-safe window. - Tests: cover --followup endpoint/payload/dry-run, link, and the followup helper; shellcheck clean. * no-mistakes(review): Captain, fix atomic X meta rewrites * no-mistakes(document): Document X completion follow-ups * feat(x-mode): dismiss skipped X mentions through the relay (kunchenguid#120) * feat(x-mode): dismiss skipped mentions at the relay The relay now exposes POST /connector/dismiss: acknowledge a pending mention without replying - it drops the request, posts nothing, and stops re-offering it. Wire firstmate to use it on the skip path so a deliberately unanswered mention no longer churns every poll and times out to the relay's "offline" auto-reply. - bin/fm-x-dismiss.sh: new client modeled on fm-x-reply.sh. POSTs {request_id} (no body) to /connector/dismiss with the bearer; echoes the request_id on 2xx, exits non-zero on non-2xx/transport failure. Honors FMX_DRY_RUN (records the would-be POST to state/x-outbox/ with an endpoint:"dismiss" marker, posts nothing) and rejects unsafe request_ids. - fmx-respond skill: the skip path now calls bin/fm-x-dismiss.sh before clearing the inbox file; answer and follow-up paths unchanged. - AGENTS.md section 14: documents that a skipped mention is dismissed at the relay, not just locally cleared. - tests: dismiss posts {request_id} to /connector/dismiss with the bearer and echoes it; dry-run records and posts nothing; non-2xx and transport failures exit non-zero; unsafe id and bad args rejected. * chore(no-mistakes): run the bash suite directly as the test step The test step had no configured test command, so it delegated to an agent; that agent-driven run crashed the no-mistakes daemon mid-step on this repo. Configure commands.test to run the firstmate behavior suite deterministically instead, mirroring .github/workflows/ci.yml: iterate every tests/*.test.sh, run each, and fail the step if any exits non-zero. This removes the agent from the test step entirely (no crash) and makes the gate's test baseline match CI. Same pattern myfirstmate uses (commands.test: mix deps.get && mix test). * no-mistakes(review): Fix X dismiss docs and gate preflight * no-mistakes(document): Document X dismiss and gate tests * feat(watcher): absorb wakes only when the crew is provably working (kunchenguid#126) * feat(watcher): absorb wakes only when the crew is provably working The no-verb triage path (a bare turn-end, a working: note, a non-terminal stale) used to be benign by default and surfaced only on a captain-relevant status verb. A crew that finished but reported through interactive pane menus (no done: status) had its final turn-end absorbed, so firstmate was never woken and the finish was missed. Invert the rule: absorb a no-verb turn-end or non-terminal stale ONLY when the crew shows positive evidence it is still working - its no-mistakes run for its branch is in an actively-running step, or its pane shows the harness busy signature. Otherwise surface it so firstmate peeks (done, waiting, or wedged). - fm-classify-lib.sh: add crew_is_provably_working (reuses fm-crew-state.sh, no run-step duplication) and signal_crew_provably_working; FM_CREW_STATE_BIN override for tests. - fm-watch.sh: signal path surfaces a no-verb wake whose crew is not provably working (costly check runs only on the no-verb, non-afk path); non-terminal stale surfaces immediately when not provably working, else absorbs with the wedge timer (run-step read only on first sight of a stale hash). - afk path unchanged: the watcher stays one-shot and skips the provably-working read; the daemon keeps its bounded-latency stale backstop. - tests: cover every required semantic (mid-pipeline absorb, finished/parked surface, no-running-pipeline idle surface, busy absorb, captain-verb surface) as classifier unit tests and behavioral watcher runs; queue-safety test for the new immediate-surface stale path. - AGENTS.md section 8: document absorb-only-when-provably-working. * no-mistakes(document): Sync watcher documentation * feat: add grok crewmate harness support (kunchenguid#143) * feat(harness): add grok (Grok Build) as a verified crewmate adapter Empirically verified against grok 0.2.73 and encoded across the machinery: - fm-harness.sh: detect grok via GROK_AGENT=1 env marker (grok does not set CLAUDECODE) and `grok` command-name ancestry. - fm-spawn.sh: grok launch template (`grok --always-approve "$(cat BRIEF)"`, fully autonomous, no permission gate) and a turn-end Stop hook. grok only loads project hooks after a manual folder-trust grant, so the hook is a single firstmate-owned global hook (~/.grok/hooks/fm-turn-end.json, always trusted) that is a guarded no-op unless the workspace holds a per-task .fm-grok-turnend pointer; fm-spawn drops that gitignored pointer naming state/<id>.turn-ended. Hook stays outside the worktree, needs no trust grant. - fm-watch.sh + fm-tmux-lib.sh: grok busy signature `Ctrl+c:cancel` (the mid-turn cancel hint; ASCII, present iff a turn runs). - harness-adapters skill: grok facts section (busy, exit=Ctrl+Q x2, interrupt=Ctrl+C, skill invocation /<skill>, resume) and /no-mistakes form. Gating question confirmed: grok invokes /no-mistakes and drives a real no-mistakes axi run, so grok is usable for no-mistakes-mode tasks. End-to-end verified through fm-spawn: autonomous launch past the dir picker into the worktree, brief processed, busy->idle and turn-end signal detected, fm-send steer lands, clean Ctrl+Q exit and teardown. config/crew-harness is left unchanged; this only makes grok available as a verified option. * no-mistakes(review): Captain, harden Grok hook lifecycle * no-mistakes(review): Captain, make Grok harness test executable * no-mistakes(review): Captain, bound Grok pointer reads * no-mistakes(test): Captain, harden crew-state and watcher-lock timing * no-mistakes(document): Document Grok harness support * feat(harness): split secondmate harness configuration (kunchenguid#144) * feat(harness): split secondmate harness and inherit primary config into secondmate homes Add config/secondmate-harness so secondmates can run on a different adapter than crewmates. fm-harness.sh gains a `secondmate` mode resolving the chain config/secondmate-harness -> config/crew-harness -> own; `crew` mode is unchanged. fm-spawn resolves a --secondmate launch through that mode (durable: every respawn re-resolves), while an explicit per-spawn harness arg still wins and the unverified-adapter guard still holds. Add a generic, extensible inheritable-config mechanism (fm-config-inherit-lib.sh) that pushes the primary's declared LOCAL config into each secondmate home's config/ at secondmate spawn and on the bootstrap secondmate sweep. Exactly one item is wired today: config/crew-harness, so a secondmate's own crewmates use the primary's setting. Primary-authoritative (re-pushed every convergence, mirrors absence); config/secondmate-harness is deliberately not inherited since secondmates never spawn secondmates. config/ is gitignored, so this is a copy separate from the tracked-files fast-forward. Update AGENTS.md (layout, bootstrap, harness, spawn), the harness-adapters skill, docs/scripts.md, and .gitignore. New tests cover secondmate resolution and fallback, spawn/respawn honoring config/secondmate-harness, config propagation on spawn and sweep, the unverified-adapter guard, and backward compatibility. * no-mistakes(review): Surface inherited config propagation failures * no-mistakes(review): Harden inherited config propagation * no-mistakes(review): Document literal harness inheritance requirement * no-mistakes(document): Document secondmate harness config * feat(backlog): default backlog operations to tasks-axi (kunchenguid#145) * feat(backlog): default to tasks-axi backend * no-mistakes(document): Sync backlog backend docs * fix(spawn): set per-task GOTMPDIR so interrupted Go builds don't leak /tmp (#36) * fix(spawn): set per-task GOTMPDIR so interrupted Go builds don't leak /tmp Go's GOTMPDIR is unset, so every go build/test creates numbered /tmp/go-build* dirs. Go cleans them on a clean exit but LEAVES THEM when interrupted (signal, timeout, OOM, full disk), accumulating and filling the disk over time. Give each task its own temp root at /tmp/fm-<id>/ with Go's build temp nested at gotmp/. fm-spawn creates the dir (Go won't mkdir GOTMPDIR), exports GOTMPDIR into the crewmate pane so the agent and child processes inherit it, and records tasktmp= in meta. fm-teardown reads tasktmp= and removes the whole root on cleanup, deterministically. GOTMPDIR (not TMPDIR) is the targeted knob: TMPDIR is too broad (affects every program's temp). The nested root is extensible: other per-task temp can live under /tmp/fm-<id>/ later. Backward compat: tasks spawned before this change have no tasktmp= in meta; teardown tolerates the empty value as a no-op. The daily fm-disk-cleanup.sh cron remains a safety net for any pre-fix stray dirs. * fix(tests): silence SC2016 for literal grep -F patterns in fm-gotmp test The structural grep -F assertions deliberately match literal $TASK_TMP in the fm-spawn source; add per-line shellcheck disable=SC2016 (the codebase's existing pattern, e.g. bin/fm-spawn.sh) so CI lint passes. * no-mistakes(document): docs: document tasktmp= meta field for per-task GOTMPDIR --------- Co-authored-by: e-jung <8334081+e-jung@users.noreply.github.com> * fix: accept landed squash-merged PR heads (kunchenguid#149) * fix(teardown): accept landed squash-merge PR heads * no-mistakes(document): Document teardown landing behavior * no-mistakes: apply CI fixes * fix(test): pass explicit teardown git identity * feat(dispatch): add dynamic crew profiles (kunchenguid#154) * feat(dispatch): add dynamic crew profiles * no-mistakes(review): Captain, document dispatch profile inheritance * no-mistakes(review): Captain, guard stale dispatch inheritance * no-mistakes(document): Sync dispatch profile docs * no-mistakes: apply CI fixes * fix: harden crew dispatch profile enforcement (kunchenguid#159) * Harden crew dispatch profile enforcement * no-mistakes(document): Captain, synced crew dispatch docs * feat: add live secondmate config push (kunchenguid#161) * feat(config): add live secondmate config push * no-mistakes(document): Document config push behavior * no-mistakes(lint): Clean changed shell lint * no-mistakes: apply CI fixes * feat: support image attachments in X replies (kunchenguid#162) * feat(x): add image attachments to reply helpers * no-mistakes(review): Stream X image replies safely * no-mistakes(review): Captain, clean X reply temp tracking * no-mistakes(document): Document X reply image support * Harden cleanup and image payload limits * no-mistakes(review): Captain, validate spawn task IDs * no-mistakes(document): Document X image cap --------- Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com> Co-authored-by: e-jung <e-jung@users.noreply.github.com> Co-authored-by: e-jung <8334081+e-jung@users.noreply.github.com>
SSBrouhard
pushed a commit
to SSBrouhard/firstmate
that referenced
this pull request
Jul 1, 2026
* feat(dispatch): add dynamic crew profiles (kunchenguid#154) * feat(dispatch): add dynamic crew profiles * no-mistakes(review): Captain, document dispatch profile inheritance * no-mistakes(review): Captain, guard stale dispatch inheritance * no-mistakes(document): Sync dispatch profile docs * no-mistakes: apply CI fixes * fix: harden crew dispatch profile enforcement (kunchenguid#159) * Harden crew dispatch profile enforcement * no-mistakes(document): Captain, synced crew dispatch docs * feat: add live secondmate config push (kunchenguid#161) * feat(config): add live secondmate config push * no-mistakes(document): Document config push behavior * no-mistakes(lint): Clean changed shell lint * no-mistakes: apply CI fixes * feat: support image attachments in X replies (kunchenguid#162) * feat(x): add image attachments to reply helpers * no-mistakes(review): Stream X image replies safely * no-mistakes(review): Captain, clean X reply temp tracking * no-mistakes(document): Document X reply image support * fix(teardown): make landed PR detection robust (kunchenguid#167) * fix(teardown): make landed-check robust when no pr= was ever recorded fm-teardown.sh's squash-merge landed-check already falls back to discovering a merged PR by branch name when state/<id>.meta has no recorded pr=, but nothing guaranteed pr=/pr_head= actually got recorded on a yolo-authorized merge - the "checks green" trigger that normally runs fm-pr-check.sh never fires on repos with no PR CI, so a merge done via a bare `gh-axi pr merge` silently skips it. Add bin/fm-pr-merge.sh as the one path for merging a task's PR: it always runs fm-pr-check.sh first, so pr=/pr_head= land in meta as part of the merge itself regardless of any CI signal. Document both the existing branch-name discovery fallback and the new merge path in AGENTS.md, and add regression coverage for the no-pr=-recorded landed scenario and for fm-pr-merge.sh's record-then-merge behavior. * no-mistakes(review): Guard PR merges on task metadata * no-mistakes(document): Document PR merge wrapper * no-mistakes: apply CI fixes * fix: parse PR merge URLs for gh-axi (kunchenguid#168) * Fix fm-pr-merge.sh to parse PR URLs for gh-axi gh-axi pr merge expects a PR number and --repo, not a full GitHub URL. Parse the URL, default to --squash when no merge method is passed, and fail fast on malformed URLs. Tests cover parsing, defaults, and refusal. * no-mistakes(review): Harden PR merge validation * no-mistakes(review): Harden PR merge URL guards * no-mistakes(document): Document PR merge URL handling * no-mistakes(lint): Clean shell lint * fix: make imported shell paths bash 3 compatible * no-mistakes(document): Sync upstream docs --------- Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com> Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
leo1oel
added a commit
to leo1oel/nemo
that referenced
this pull request
Jul 3, 2026
…unchenguid#159, kunchenguid#161, kunchenguid#180) (#21) Port the upstream dispatch-profile bundle to the Claude-only herdr fork, collapsing the harness axis to model/effort: - fm-spawn gains --model/--effort (claude --model/--effort), records model=/effort= in meta, and forwards shared flags across batch pairs. - config/crew-dispatch.json holds natural-language rules firstmate matches at intake; while it exists and parses, template crewmate/scout spawns refuse without an explicit profile (the consultation backstop, kunchenguid#159). Invalid JSON warns loudly and is not enforced; raw launches are exempt. - config/secondmate-profile pins the secondmate launch profile ('<model> [<effort>]'), re-resolved on every respawn; explicit flags win. - fm-config-inherit-lib.sh + fm-config-push.sh propagate the primary's crew-dispatch.json into secondmate homes at spawn and mid-session, primary-authoritative with absence mirroring (kunchenguid#161). - config/ joins .gitignore, matching AGENTS.md's tracking principle and the inherit guard's gitignored-destination requirement.
mielyemitchell
added a commit
to mielyemitchell/firstmate
that referenced
this pull request
Jul 6, 2026
* feat(dispatch): add dynamic crew profiles (#154)
* feat(dispatch): add dynamic crew profiles
* no-mistakes(review): Captain, document dispatch profile inheritance
* no-mistakes(review): Captain, guard stale dispatch inheritance
* no-mistakes(document): Sync dispatch profile docs
* no-mistakes: apply CI fixes
* fix: harden crew dispatch profile enforcement (#159)
* Harden crew dispatch profile enforcement
* no-mistakes(document): Captain, synced crew dispatch docs
* feat: add live secondmate config push (#161)
* feat(config): add live secondmate config push
* no-mistakes(document): Document config push behavior
* no-mistakes(lint): Clean changed shell lint
* no-mistakes: apply CI fixes
* feat: support image attachments in X replies (#162)
* feat(x): add image attachments to reply helpers
* no-mistakes(review): Stream X image replies safely
* no-mistakes(review): Captain, clean X reply temp tracking
* no-mistakes(document): Document X reply image support
* fix(teardown): make landed PR detection robust (#167)
* fix(teardown): make landed-check robust when no pr= was ever recorded
fm-teardown.sh's squash-merge landed-check already falls back to
discovering a merged PR by branch name when state/<id>.meta has no
recorded pr=, but nothing guaranteed pr=/pr_head= actually got
recorded on a yolo-authorized merge - the "checks green" trigger that
normally runs fm-pr-check.sh never fires on repos with no PR CI, so a
merge done via a bare `gh-axi pr merge` silently skips it.
Add bin/fm-pr-merge.sh as the one path for merging a task's PR: it
always runs fm-pr-check.sh first, so pr=/pr_head= land in meta as part
of the merge itself regardless of any CI signal. Document both the
existing branch-name discovery fallback and the new merge path in
AGENTS.md, and add regression coverage for the no-pr=-recorded landed
scenario and for fm-pr-merge.sh's record-then-merge behavior.
* no-mistakes(review): Guard PR merges on task metadata
* no-mistakes(document): Document PR merge wrapper
* no-mistakes: apply CI fixes
* fix: parse PR merge URLs for gh-axi (#168)
* Fix fm-pr-merge.sh to parse PR URLs for gh-axi
gh-axi pr merge expects a PR number and --repo, not a full GitHub URL.
Parse the URL, default to --squash when no merge method is passed, and
fail fast on malformed URLs. Tests cover parsing, defaults, and refusal.
* no-mistakes(review): Harden PR merge validation
* no-mistakes(review): Harden PR merge URL guards
* no-mistakes(document): Document PR merge URL handling
* no-mistakes(lint): Clean shell lint
* feat(bin): pin secondmate model and effort (#180)
* feat: pin secondmate model/effort in config/secondmate-harness
Extend config/secondmate-harness's format to an optional
"<harness> [<model>] [<effort>]" line so a secondmate can be durably
locked to a concrete model/effort in the same file, without adding a
new config file. A bare harness-only file behaves exactly as before.
fm-harness.sh gains secondmate-model/secondmate-effort accessors;
fm-spawn.sh populates MODEL/EFFORT from them on every secondmate spawn
(including respawns) unless the caller passed an explicit --model/--effort.
* no-mistakes(review): Fix secondmate override pin precedence
* no-mistakes(document): Document secondmate harness pins
* feat(bin): add runtime backend interface (#183)
* feat(bin): extract tmux runtime behind a backend interface (P1)
Add bin/fm-backend.sh (selection, meta helpers, selector resolution,
dispatch) and bin/backends/tmux.sh (the tmux adapter), then route
fm-send.sh, fm-peek.sh, fm-watch.sh, fm-spawn.sh, and fm-teardown.sh
through them. Every default tmux command sequence, meta shape, and
printed output stays byte-identical: missing backend= still means
tmux, and a default spawn never writes backend=tmux.
Adds a --backend flag (tmux-only for now) and FM_BACKEND/config/backend
selection, refusing any unimplemented backend loudly. Names the
watcher's poll loop as the default event-source implementation over the
backend's pull primitives, per the herdr-addendum's events-as-the-core-
abstraction direction, without changing its behavior.
Verification: fake-tmux/treehouse old-vs-new command-log conformance
tests for send/peek/spawn/teardown, a real-tmux smoke test for the
adapter, and the full existing suite passing unmodified (bar two
fixture-only additions in fm-gotmp.test.sh for the new sibling
scripts).
* no-mistakes(review): Captain, harden backend baseline resolution
* no-mistakes(review): Captain, ignore and document backend config
* no-mistakes(review): Captain, make backend tests executable
* no-mistakes(document): Sync runtime backend documentation
* feat(bin): add experimental Herdr runtime backend (#186)
* feat(bin): add experimental herdr runtime backend (P2)
Implements bin/backends/herdr.sh (session-provider adapter, D3: treehouse
stays the worktree provider) wired through fm-backend.sh's dispatch, with
--backend herdr / FM_BACKEND=herdr / config/backend selection, a
version/protocol gate at spawn, semantic busy-state detection via herdr's
agent.get (fm-watch.sh and fm-crew-state.sh consult it before falling back to
the existing tmux pane-regex path), and label-based recovery discovery.
Container shape (D4) decided empirically: tab-per-task in one "firstmate"
workspace, mirroring tmux's one-session-many-windows model.
Found and fixed two real herdr v0.7.1 bugs during verification: `pane read
--lines N` returns empty for small N (worked around by over-fetching and
trimming locally), and `pane get`'s cwd field is frozen at pane-creation time
(fixed to read foreground_cwd instead, needed for fm-spawn's worktree-
discovery poll after `treehouse get`). Also fixed a pre-existing bug in
tests/fm-backend.test.sh's old-vs-new fixture that was silently missing
fm-backend.sh/bin/backends/ from the old bin/ shim.
Full empirical verification, the D4 decision evidence, and a real end-to-end
run (spawn/steer/peek/done/merge-local/teardown, including confirming
teardown refuses before the merge) are recorded in docs/herdr-backend.md.
The entire existing tmux conformance suite stays green.
* no-mistakes(review): Fix Herdr supervision recovery gaps
* no-mistakes(review): Captain, fix Herdr stale recovery gaps
* no-mistakes(review): Document Herdr composer primitive candidate
* no-mistakes(review): Captain, harden Herdr stale recovery and tests
* no-mistakes(document): Sync herdr backend docs
* no-mistakes: apply CI fixes
* feat(bin): auto-detect runtime backend (#188)
* feat(bin): auto-detect runtime backend from HERDR_ENV/TMUX markers
fm_backend_name now falls through to runtime auto-detection between
config/backend and the hard tmux default: a firstmate running natively
inside herdr (HERDR_ENV=1) now spawns crewmates into herdr by default,
mirroring how harness detection already works in fm-harness.sh. Nesting
resolves innermost-first (tmux wins over a nested herdr pane). Explicit
--backend/FM_BACKEND/config/backend settings always win over detection.
Selecting herdr via auto-detect prints a loud stderr notice; auto-detecting
tmux stays silent so the unconfigured default path is unchanged.
* no-mistakes(review): Captain, pin tmux tests and backend docs
* no-mistakes(document): Sync backend autodetect docs
* no-mistakes: apply CI fixes
* feat(stow): add operational memory capture (#197)
* feat(stow): add operational-memory learnings convention and /stow skill
Add data/learnings.md as the fleet-local operational-learnings home,
a knowledge-routing table in AGENTS.md, and a user-invocable /stow
skill that sweeps a session for uncaptured durable knowledge and
files it to the right disk home before a reset.
* no-mistakes(review): Fix stow backlog note command
* no-mistakes(document): Document stow memory routing
* fix(tests): protect herdr smoke cleanup from default sessions (#199)
* fix(tests): stop real-herdr smoke tests from ever killing the default session
Both fm-backend-herdr-smoke.test.sh and fm-backend-autodetect-smoke.test.sh
tore down their isolated throwaway HERDR_SESSION via a bare/inline-prefixed
`herdr server stop`, which is unscoped and resolves ambiently. On this herdr
client, that ambient resolution silently falls back to whatever server is
already running instead of the requested session - it killed the captain's
live default herdr server twice in production (2026-07-02), once from each
smoke test's cleanup trap.
Add tests/herdr-test-safety.sh with herdr_safe_stop_and_delete: it uses the
explicit-by-name `herdr session stop/delete <name>` form (never the ambient
`server stop`) and, before that, a read-only hard guard
(herdr_refuse_if_default) that re-queries `herdr session list --json` and
refuses outright if the target is literally "default", not found, or flagged
default:true. Fails closed on any ambiguity. Verified empirically against a
real isolated session: refuses on default/nonexistent/empty names without
ever calling stop, and correctly tears down a genuine isolated session while
leaving the default session's workspace state byte-identical before and
after.
* no-mistakes(review): guard herdr delete with fresh check
* no-mistakes(document): Document herdr smoke cleanup safety
* feat(bin): route herdr secondmates into per-home workspaces (#200)
* feat(bin): give each secondmate its own labeled herdr workspace
Give each secondmate its own labeled herdr workspace, and land crewmates
spawned from a secondmate home in that secondmate's own space, instead of
every firstmate home (primary and all secondmates) sharing one "firstmate"
workspace.
bin/backends/herdr.sh: replace the constant FM_BACKEND_HERDR_WORKSPACE_LABEL
with fm_backend_herdr_workspace_label(), resolved fresh from FM_HOME on every
call. The primary (no .fm-secondmate-home marker) still resolves to
"firstmate" - byte-identical to every pre-existing task's recorded label, no
forced migration. A secondmate home resolves to "firstmate-<secondmate-id>".
Every workspace-scoped path (find/ensure, tab create + duplicate check,
list-live recovery, pane-for-tab) uses this same resolution, so recovery and
duplicate checks stay scoped to each home's own space. Workspace and tab
create now pass --no-focus unconditionally (verified: neither focuses by
default once a workspace exists; --no-focus is defense in depth against the
one bootstrap edge case where the very first workspace in a session auto-
focuses).
Also fixes a session-targeting bug found while verifying this empirically:
HERDR_SESSION (env var, exported or inline-prefixed) is not reliably honored
by herdr 0.7.1 CLI subcommands once another herdr server is already running -
it silently falls back to whatever server IS running. fm_backend_herdr_cli
wraps every herdr invocation with both HERDR_SESSION and a trailing
--session <name> flag (verified to route correctly in every case tried),
fixing this for the whole adapter, not just the new label-scoped calls.
bin/fm-spawn.sh: a --secondmate spawn is launched BY the primary's own
process, whose FM_HOME still names the primary at that point. The herdr case
arm now shadows FM_HOME to the secondmate's own home (PROJ_ABS) for just the
two calls that resolve/create the workspace and tab, restored automatically
afterward (bash's temporary-assignment-before-a-command form works for shell
functions too). A crewmate/scout spawned FROM a secondmate's own fm-spawn.sh
process needs no such glue - its own FM_HOME already names it.
Tests: extended tests/fm-backend-herdr.test.sh (per-home label resolution,
--no-focus, --session flag, workspace-find/list-live scoping) and
tests/fm-backend-herdr-smoke.test.sh (a secondmate-shaped home's workspace
label, list-live scoping, restart stability in the multi-workspace shape).
Added tests/fm-backend-herdr-workspace-per-home-e2e.test.sh: the mandatory
isolated E2E, driving real bin/fm-spawn.sh/fm-teardown.sh - a primary-shaped
home into "firstmate", a --secondmate spawn into its own labeled space, a
crewmate spawned FROM that secondmate-shaped home landing in the same space
(this exact path had never run before), teardown closing only the right tab,
and list-live recovery seeing only each home's own tabs. All ten assertions
passed on the real binary; the default herdr session's own workspace state
was confirmed byte-identical before and after every real-herdr test run in
this change.
docs/herdr-backend.md: rewrote "Task container shape" for the workspace-per-
home design (label derivation, the --secondmate FM_HOME-shadow wrinkle, focus
behavior, label-collision/adopt-don't-duplicate semantics, no-forced-
migration), added "Session targeting: the --session flag, not HERDR_SESSION
alone", extended "ID stability" to the multi-workspace shape, and documented
the new E2E test.
* no-mistakes(review): Clarify herdr focus docs
* no-mistakes(review): Captain, clarify herdr server session docs
* no-mistakes(document): Document herdr per-home spaces
* fix(backends): rename Herdr secondmate workspace labels (#203)
* Rename herdr secondmate workspace prefix to 2ndmate-
The primary home keeps the firstmate label; secondmate homes now
resolve to 2ndmate-<id> so the herdr spaces sidebar is unambiguous.
Tests and docs updated; pre-rename workspaces can be aligned with
herdr workspace rename.
* no-mistakes(review): Clarify herdr workspace migration behavior
* no-mistakes(document): Herdr docs label alignment
* feat(bin): add unified session start digest (#201)
* feat(bin): collapse session start into one command
Add bin/fm-session-start.sh, composing fm-lock.sh, fm-bootstrap.sh, and
fm-wake-drain.sh into one ordered digest (lock, bootstrap diagnostics,
wake queue, context files, fleet state) instead of six-plus separate
turns. Lock now runs before bootstrap's mutating sweeps, closing a race
where a second concurrent session could mutate shared state before
discovering the lock was held. A lock refusal prints a loud read-only
banner, skips every mutating step via a new opt-in
FM_BOOTSTRAP_DETECT_ONLY flag on fm-bootstrap.sh, and still completes
the read-only-safe digest.
Add fm_backend_target_exists to fm-backend.sh as a shared, read-only,
never-side-effecting per-task endpoint-liveness primitive for both the
tmux and herdr backends.
Rewrite AGENTS.md sections 3 and 5 around the single command and add
tests/fm-session-start.test.sh.
* no-mistakes(review): Harden session-start read-only guidance
* no-mistakes(review): Suppress read-only tangle repair guidance
* no-mistakes(review): Include orphan status logs
* no-mistakes(review): Captain: make session-start test executable
* no-mistakes(review): Captain: clarify status tail guidance
* no-mistakes(document): Sync session-start docs
* no-mistakes(lint): Shell lint clean
* fix(tests): avoid shellcheck boolean chain
* fix(bin): corroborate herdr idle crew state (#207)
* fix(bin): corroborate herdr idle agent_status with the pane's own text
crew_pane_is_busy trusted a bare `idle` verdict from herdr's agent.get
outright, skipping the tail-regex corroboration unknown already gets.
agent.get reports generation state only (working while the model streams
a turn), so it reads idle for a crew blocked on its own long foreground
no-mistakes run - even though the pane still shows the busy banner the
whole time. Combined with the no-mistakes CLI's 10-run attribution cap,
this made a genuinely working herdr crew read as not provably working,
triggering an immediate stale wake instead of absorb-then-escalate.
* no-mistakes(document): Align herdr busy-state docs
* fix(backends): reuse the herdr firstmate workspace instead of leaking one per spawn (#202)
* fix(backends): reuse the herdr firstmate workspace instead of leaking one per spawn
Every herdr-backed crewmate left an orphaned `firstmate`-labelled workspace
behind, one per task, because `fm_backend_herdr_workspace_find` never matched
the existing workspace: its jq filter used `--arg label ... $label`, and
`label` is a reserved keyword in jq (label/break), so the filter was a compile
error. The error was swallowed by `2>/dev/null`, the find returned empty on
every call, and `workspace_ensure` took the create path each spawn, minting a
fresh workspace. The same collision silently disabled the create-task
duplicate-label check and the bare-selector tab lookup.
Rename the jq variable to `$want` in all three affected filters so reuse,
duplicate detection, and bare-selector lookup work. With reuse restored the
single `firstmate` workspace is persistent (like tmux's session) and teardown
correctly leaves it in place, closing only the task's pane/tab.
Also prune the default tab (label "1") herdr auto-creates inside a freshly
created workspace, best-effort, so the workspace holds only real task tabs.
Add stateful-fake-CLI tests that replay repeated spawn/teardown cycles and
assert one reused workspace, zero orphans, the default tab pruned, and
`workspace create` invoked exactly once. Verified against the real herdr binary
too: the pre-fix code failed the smoke idempotency check (minted wE then wF in
an isolated session); the fix passes it.
Document the workspace lifecycle, the jq-keyword pitfall, the default-tab
prune, and the project-labelled-workspace anomaly (not adapter-created) in
docs/herdr-backend.md.
* docs(herdr): trim workspace-lifecycle addition to current-state facts
The docs/herdr-backend.md convention documents current behavior, not
history - narrative belongs in the PR/commit message. Tightened the
workspace-leak and default-tab-prune write-up down to the operative
facts (the jq reserved-keyword guard, when pruning is safe, and the
persistence caveat), and corrected the CLI-facts table rows to match
the corrected prune timing.
* fix(backends): defer herdr default-tab prune until a real task tab exists
Closing a workspace's LAST tab deletes the whole workspace on real
herdr (verified). Pruning the auto-created default tab right after
workspace create closed the workspace's only tab at that point,
destroying the just-created workspace on every single spawn instead of
reusing it - the fake-CLI unit tests didn't model this real-herdr
behavior, so they passed while the real-herdr smoke test failed with
"container_ensure is not idempotent".
Move the prune into fm_backend_herdr_create_task, right after the
first real task tab is added to a freshly created workspace, when
closing the default tab alongside it is safe. Update the fake-CLI unit
test to match the corrected timing.
Also fix a smoke-test-only bug this surfaced: the test's second
create_task call reused a $CONTAINER captured before the first task
was killed, rather than re-running container_ensure like real
fm-spawn.sh always does immediately before every create_task call - so
once the workspace (correctly) disappeared after its last tab closed,
the stale reference no longer named a live workspace.
* test(backends): guard against jq --arg names colliding with jq keywords
Regression guard for the workspace-leak bug this PR fixes: a jq
--arg/--argjson variable named after a jq reserved keyword (e.g.
label) is a compile error on jq <= 1.6, and this adapter's
2>/dev/null silently turns that into an empty result instead of a
visible failure. Greps bin/ for the pattern so a future violation
fails loudly here instead of silently misbehaving on an older jq.
* docs(herdr): fix per-home staleness and drop contributor-specific example
The workspace-lifecycle write-up hardcoded "the firstmate workspace"
as if the label were always the fixed constant, stale against the
per-home labeling documented earlier in this file (primary: firstmate,
secondmate: 2ndmate-<id>). Rephrased per-home throughout, and pointed
the "workspace this adapter did not derive" case at the existing
Label-derivation section instead of a separate anomaly writeup.
Dropped the "Anomaly: a workspace labelled with a project name"
section - the python-teslemetry-stream example was a contributor's own
environment, not current adapter fact, and it repeated a now-incorrect
FM_BACKEND_HERDR_WORKSPACE_LABEL constant claim. Replaced with one
generic sentence already covered by the corrected wording above.
Also fixed the jq-reserved-keyword guard test's file reference, which
named tests/fm-backend.test.sh when the test actually lives in
tests/fm-backend-herdr.test.sh.
---------
Co-authored-by: kunchenguid <kun@kunchenguid.com>
* fix(backends): make Herdr default-tab pruning safe (#215)
* fix(backends): make the herdr default-tab prune provably safe
The default-tab prune could close a pane holding a LIVE agent: an
ADOPTED workspace (found pre-existing by label match) was pruned using
the same tab-count/label heuristic as a freshly created one, and herdr
derives a workspace's displayed label from its cwd basename when no
explicit --label is given. A captain launching herdr directly inside a
directory named "firstmate" produces a workspace that looks identical,
by label alone, to firstmate's own container - so the very next spawn
adopted the captain's own live workspace and closed their live pane
27ms after creating its task tab (2026-07-02 incident).
The fix is structural: fm_backend_herdr_workspace_ensure now captures
the seeded default tab's id straight from its own `workspace create`
response, only when it just created the workspace. That id threads
through fm_backend_herdr_container_ensure to fm_backend_herdr_create_task,
which is the only function allowed to prune it - an adopted workspace's
caller always passes an empty seeded-tab-id, so create_task never
re-derives "prunable" from a tab's label or count. Defense in depth:
the prune also refuses a tab whose pane reports a working agent.
Covered by new unit tests (adopted-never-prunes, created-prunes-exactly,
the exact label-collision incident shape) and a new isolated real-herdr
E2E test that reproduces the incident against the pre-fix code and shows
it fixed, plus the normal happy path.
* no-mistakes(document): Sync herdr prune docs
* no-mistakes: apply CI fixes
* fix(brief): remove apostrophe breaking bash -n and guard bash 3.2 set -u in spawn (#173)
* fix(brief): remove apostrophe that broke bash -n on fm-brief.sh
The no-mistakes DOD heredoc, built via VAR=$(cat <<EOF ... EOF), had an
unescaped apostrophe in "no-mistakes' own guidance". Nesting a heredoc
inside $(...) makes bash track quote state through the body, so the lone
apostrophe broke parsing of the rest of the script (bin/fm-brief.sh:211),
making the default no-mistakes ship path fail outright. Audited the other
two $(cat <<EOF...EOF) blocks (direct-PR, local-only) for the same class
of bug; none found. Added tests/fm-brief.test.sh as a regression guard.
* no-mistakes(test): fix(spawn): guard empty shared_args under bash 3.2 set -u
* no-mistakes(document): docs(contributing): list tests/fm-brief.test.sh in the test suite inventory
* fix(test): silence shellcheck SC2034/SC2100 in fm-brief.test.sh
Drop the unused out= capture (redirect to /dev/null instead) and quote
the id= assignment so shellcheck stops reading the hyphenated id value
as an arithmetic expression.
* feat: add experimental zellij runtime backend (#217)
* feat(backends): add experimental zellij runtime backend (P3)
Implements bin/backends/zellij.sh on the P1 dispatcher + P2 herdr precedent:
one zellij session, one tab per task, treehouse stays the worktree provider.
Wired through fm-backend.sh/fm-spawn.sh so fm-send/fm-peek/fm-watch/
fm-crew-state/fm-teardown work generically with zero changes to those scripts.
Empirically verified against real zellij 0.44.0: every "gaps to verify" item
from the design report, plus real findings the report missed - new-tab always
steals focus (mitigated with a restore call), zellij action always exits 0
even against a dead target, every pane op needs an explicit --pane-id, and
pane_cwd never tracks a subshell's own cd (treehouse get's exact shape) so
worktree-path discovery uses an active pwd-probe instead of passive JSON
polling. Findings and the full real-CLI evidence log are in
docs/zellij-backend.md.
Full real E2E cycle passed: spawn a real claude crewmate, accept its trust
dialog, steer it, receive done, confirm teardown refuses before merge, merge
local-only, confirm teardown then succeeds and the zellij tab is gone - all
in a scratch FM_HOME against a uniquely-named isolated zellij session, never
touching the real "firstmate" session or the live fleet.
Existing tmux and herdr conformance suites stay green; the two P1-era tests
asserting zellij was unimplemented now assert that of orca instead.
* no-mistakes(review): captain, guard zellij paste payloads
* no-mistakes(review): Captain, guard zellij pane readiness
* no-mistakes(review): Captain, harden zellij dead-target handling
* no-mistakes(review): Captain, harden zellij teardown and tests
* no-mistakes(review): Captain, harden zellij target validation
* no-mistakes(document): Document zellij backend
* docs: document Orca backend adapter contract (#209)
* docs: specify Orca backend adapter contract
* docs: require Orca window target alias
* no-mistakes(test): Captain: handle empty arrays under nounset
* no-mistakes(document): Document Orca backend proposal
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* feat(backends): add Orca primitive backend support (#210)
* feat(backends): add Orca adapter primitives
* no-mistakes(review): Gate Orca from task spawning
* no-mistakes(document): Document Orca backend limits
* fix(backends): stop mapping Orca Escape to interrupt
* no-mistakes(document): Document Orca primitive key support
* no-mistakes: apply CI fixes
* fix: drop CI-gate rewrite and normalize shared array-guard hunks
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix(backends): submit herdr slash commands reliably (#223)
* fix(backends): herdr slash-command submit verification false-positives on popup autocomplete
Two grok/herdr crewmates left /no-mistakes fully typed but unsubmitted for
minutes while fm-send exited 0. Live-reproduced against real grok 0.2.82:
the herdr adapter's submit verification declared success on ANY pane content
change after Enter, but an argument-taking slash command's first Enter only
closes the popup and expands the composer into an argument-hint placeholder
(/compact -> /compact compaction instructions) rather than submitting - a
real, visible change that isn't a submission. A second Enter is required.
fm_backend_herdr_composer_state replaces the delta check with a structural
read of the composer's own row (located by border-glyph shape, since herdr
exposes no cursor-row primitive), mirroring what cursor_y gives the tmux
adapter. A popup-close-with-placeholder-fill still reads pending, so the
retry loop now correctly sends the needed second Enter instead of stopping
early. The tmux backend was unaffected (its cursor-row read already handled
this correctly, verified side by side against the same live repro).
* no-mistakes(document): Sync herdr submit docs
* feat(skills): publish public stow skill with internal-skill hiding (#221)
* feat(skills): hide agent-only skills from installer discovery, add public stow
Mark every .agents/skills/* skill metadata.internal: true so the
skills.sh installer (npx skills add) hides them from discovery - all
assume a live firstmate home and are meaningless elsewhere. This is
inert to firstmate's own harness skill loader.
Add a new, fully standalone skills/stow for non-firstmate users: sweep
a conversation for durable knowledge and file it into whatever notes
convention the host project/user already has, asking once and
remembering the answer when ambiguous. No shared code with the
internal stow by design.
Document the two-tier layout in README and CONTRIBUTING.
* no-mistakes(review): Tighten public stow tracker routing
* no-mistakes(document): Sync skill docs
* fix(skills): make public stow's undone-next-steps routing local-first
Supersede the earlier ask-before-tracker-write tightening: the
standalone stow no longer treats an issue tracker as a routing option
at all based on inference (git remote, .github/ presence, etc).
Undone next steps always land in a local file by default - an
existing TODO/BACKLOG/NOTES file, or a freshly created local scratch
file otherwise. A tracker (or any other external system) is only ever
used when the user has explicitly said so, this session or as a
previously recorded standing preference.
* no-mistakes(document): Sync skill documentation
* feat(skills): clarify public stow resume and fallback routing (#225)
* feat(skills): resume pointer, routing tiers, default notes file for public stow
Adds a copy-pasteable resume pointer to the safe-to-end verdict so a
new session can pick the work back up cold, states the explicit three-tier
routing priority (explicit instruction > existing local convention > default
NOTES.md fallback) instead of leaving it implicit, and names NOTES.md as the
top-level discoverable default instead of letting each agent improvise a
location. Also removes a leftover internal-tooling word from the maintainer
comment so the public file carries zero internal vocabulary.
* fix(skills): make the public stow default fallback private and gitignored
Supersedes the earlier NOTES.md/ask-once split: the tier-3 default fallback
(no existing local convention fits) is now .stow-notes.md, gitignored so it
never lands unprompted in a shared/committed file. Because it's private, it's
safe for every finding-kind including user preferences, so the separate
ask-once carve-out for personal material is no longer needed there. Tier 2
(an already-established tracked convention) is unchanged and is the only
tier that still writes into a shared file. Step 7's resume pointer now flags
when notes landed in the private fallback and that they can be promoted into
a shared file later.
* fix(skills): split the public stow private fallback by scope, use git exclude
Supersedes the single .stow-notes.md fallback: user preferences (cross-project
by nature) now default to a host-local ~/.stow/notes.md instead of being
siloed into one project's repo. Project-scoped findings still default to
.stow-notes.md at the project root, but it's now kept out of git via the
local-only .git/info/exclude instead of the tracked .gitignore, so the
fallback is truly zero-shared-footprint: nothing lands in a tracked file and
nothing is left for the user to review or commit.
* fix(skills): keep the public stow private fallback sandbox-safe (current dir only)
Supersedes the home-file split: a home-directory path fails for agents
sandboxed to their current working directory, so the tier-3 default now
stays a single .stow-notes.md at the project root for every finding-kind,
including user preferences. Tier 2's user-level memory file is now framed
as a bonus when accessible, never assumed or required. Step 7 gains a
caveat when a preference lands in the project-local fallback: it applies to
this project only, and the user can copy it into their own global memory
file if they want it to follow them everywhere.
* fix(skills): use a current-directory .gitignore for the public stow fallback
Supersedes .git/info/exclude: that mechanism resolves outside the working
directory in a linked worktree, breaking the sandbox-safety guarantee for
exactly the setup this fleet uses everywhere. Switch to an ordinary
.gitignore file in the current directory instead - always in-directory
regardless of worktree layout - creating or appending a .stow-notes.md
line, left uncommitted for the user. If that write itself fails, the skill
still creates .stow-notes.md and tells the user to ignore it manually
rather than blocking. Also scopes the "never writes outside the current
directory" guarantee precisely to tier 3: tier 2 is exempted since it only
targets a destination the user's own existing convention already
established, which can legitimately be a user-level file outside the
project.
* no-mistakes(review): Clarify stow routing precedence
* no-mistakes(review): Clarify stow fallback metadata boundary
* no-mistakes(review): Guard tracked stow fallback
* no-mistakes(review): Clarify stow fallback verdict
* no-mistakes(document): Sync stow skill docs
* no-mistakes(lint): Public skill lint cleanup
* docs: clarify note hygiene guidance (#226)
* docs: add note-hygiene rule to backlog format section
Backlog and task notes accumulate volatile specifics that drift and
mislead; capture the general principle so every firstmate user avoids
trusting a stale note over the authoritative source.
* no-mistakes(review): Clarify note hygiene schema exemptions
* no-mistakes(document): Clarify note-hygiene docs
* revert: drop out-of-scope stow/architecture doc edits
Keep this PR's diff scoped to the AGENTS.md note-hygiene addition only;
skills/stow/SKILL.md, .agents/skills/stow/SKILL.md, and docs/architecture.md
are under separate close review and must not change out of band here.
This reverts commit ed2d73205b01e24ba8ffd40c523a24993f6eb1a5.
* feat(backends): add Orca task lifecycle support (#228)
* feat(backends): add Orca task lifecycle support
* fix(backends): harden Orca spawn lifecycle
* no-mistakes(review): Fix Orca lifecycle cleanup gaps
* no-mistakes(review): Release Orca worktrees without paths
* no-mistakes(review): Guard Orca spawn abort cleanup
* no-mistakes(review): Allow partial Orca child cleanup
* no-mistakes(review): Fix Orca selector and cleanup leaks
* no-mistakes(review): Preserve pathless Orca cleanup metadata
* no-mistakes(review): Harden Orca spawn and teardown lifecycle
* no-mistakes(review): Enforce Orca scout report gate
* no-mistakes(review): Harden Orca teardown path validation
* no-mistakes(review): Harden Orca capture errors
* no-mistakes(review): Harden Orca JSON cleanup validation
* no-mistakes(test): Fix zellij scout teardown fixture
* no-mistakes(document): Document Orca lifecycle support
* Harden Orca runtime and submit verification
* no-mistakes(review): Captain, preserve Orca current-tail verification
* no-mistakes(document): Sync Orca lifecycle docs
* no-mistakes(lint): Captain, silence deliberate ShellCheck
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix: use PR head for review diffs (#229)
* Fix fm-review-diff to compare PR head when pr= is recorded
After no-mistakes fix rounds push to the open PR, the crewmate worktree
branch can lag the authoritative PR head. When meta records pr=, resolve
the compare ref from reachable pr_head= or refs/pull/<n>/head before
diffing against the fetched authoritative base; fall back to the local
branch with a loud warning when the PR head cannot be resolved.
Add behavior tests for pr_head resolution, fetch, unchanged no-pr path,
and unreachable-PR fallback.
* no-mistakes(review): Make review-diff test executable
* no-mistakes(document): Document PR-head review diffs
* no-mistakes: apply CI fixes
* fix: make backend matching shell-portable (#230)
* Make fm-backend.sh backend-name matching shell-portable for zsh
Replace word-split-dependent for-loops in fm_backend_is_known() and
fm_backend_validate_spawn() with case-based membership tests so sourcing
the library from zsh no longer falsely rejects known backends.
Add zsh/bash regression coverage in tests/fm-backend.test.sh.
* no-mistakes(review): Fix zsh backend loading and validation
* no-mistakes(document): Document backend membership portability
* fix(backends): make herdr respawn idempotent (#231)
* fix(backends): make herdr respawn idempotent against restored-layout husks
herdr persists and restores its session layout (workspaces/tabs/panes)
across a server restart, so a restored fm-<id> task tab comes back a
husk - a dead pane, or a plain agent-less shell - which fm-spawn.sh's
duplicate-tab guard refused unconditionally, forcing manual pane closes
after every restart.
fm_backend_herdr_create_task now classifies an existing same-labeled
tab's pane conservatively (dead/no-agent/live/unknown) and
closes-and-replaces only a confirmed husk, always creating the
replacement tab before closing the old one so a husk that is a
workspace's only tab is never at risk of taking the whole workspace
down with it. A genuinely live agent, or anything not confidently
classifiable, still refuses exactly as before.
* no-mistakes(review): Harden herdr duplicate respawn guard
* no-mistakes(review): Enforce herdr husk cleanup postcondition
* no-mistakes(document): sync herdr respawn docs
* no-mistakes: apply CI fixes
* fix: absorb stale wakes during active validation (#233)
* fix(watcher): stop stale_is_terminal from ignoring an active run-step
A crewmate's status log gets no new entry once firstmate hands it to a
no-mistakes validation (the sparse status-reporting contract), so the
log's last line can stay a pre-validation "done:" (or needs-decision/
blocked) leftover for the run's entire duration. fm-watch.sh's
stale_is_terminal only reads that raw last line - it has no run-step
awareness - so it kept surfacing a stale pane as immediately terminal
every time it went quiet for two polls, no matter how actively the
pipeline was validating (confirmed live against fm-herdr-respawn-idem,
whose status log's last line is literally "done: ..." while its
no-mistakes run-step reads "validating (running)"). crew_is_provably_working
now gets a chance to override a stale captain-relevant log line on a
new stale hash, exactly as it already did for a non-captain-relevant one.
Also fixed a separate, independently-confirmed dead code path in
fm-crew-state.sh: its cross-branch run-attribution fallback shelled out
to `no-mistakes axi` (bare) expecting a runs[N]{...} TOON table that the
real CLI (v1.32.2) never emits - verified the axi surface exposes only
abort/logs/respond/run/status. Replaced it with the real top-level
`no-mistakes runs` listing.
* no-mistakes(document): Sync watcher stale docs
* no-mistakes(lint): Fix stale fake run-list variables
* docs: clarify no-mistakes evidence commit handling (#232)
* docs: no-mistakes evidence commits in crew branches are intentional
* no-mistakes(review): Scope evidence guidance to project repos
* no-mistakes(document): Document evidence commit policy
* fix: tighten Orca backend parsing (#237)
* fix: tighten orca parser coverage
* no-mistakes(document): Sync Orca backend docs
* no-mistakes(lint): Captain, lint clean
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* docs: add backend setup guides and slim README (#238)
* docs: make README pointer-first, add per-backend setup guides
Trim the Quick Start and How It Works walls of prose down to overview plus
pointers, relocating every removed sentence's content into docs/architecture.md,
docs/configuration.md, or the relevant backend doc. Add docs/tmux-backend.md as
the reference-backend setup guide, and add a Setup section to each experimental
backend doc (herdr, zellij, Orca) covering prerequisites, selection, first run,
watching/attaching, verification, and limitations. Record the README convention
in CONTRIBUTING.md.
* no-mistakes(review): Clarify backend setup docs
* no-mistakes(review): Clarify tmux secondmate support
* no-mistakes(document): Align backend documentation
* docs: stop telling users to run fm-spawn.sh for backend selection
fm-spawn.sh is firstmate-internal; a user never runs it directly. Rephrase
every user-facing backend-selection sentence across the tmux/herdr/zellij/orca
guides and docs/configuration.md to present the actual user mechanisms: a
local config/backend file, FM_BACKEND at launch, or telling the first mate in
chat. Internal-reference mentions of the --backend flag (fm-spawn.sh usage
notes, test coverage lists) are left as mechanics, not user instructions.
* Document herdr dual license in docs and install hint (#239)
Add AGPL-3.0-or-later/commercial licensing note to herdr-backend Setup
and the missing-binary error in bin/backends/herdr.sh.
* feat: support multiple X-mode follow-ups (#241)
* feat(x-mode): raise X follow-up cap to 3 within a 7-day window
Matches the relay's parallel contract change: fm-x-link.sh now records a
follow-up counter (with --carry-count to preserve it across a re-link onto
a successor task), fm-x-followup.sh posts up to three follow-ups per
mention within a 7-day window instead of one within 24h, clearing the
link on --final, cap exhaustion, window lapse, or a distinguishable relay
rejection (fm-x-reply.sh HTTP 409 -> exit 9) rather than treating that
rejection as a retryable failure. AGENTS.md and the fmx-respond skill are
updated to keep usage disciplined: spend follow-ups only on genuine
milestones, always finish with --final.
* no-mistakes(review): Update follow-up dry-run docs
* no-mistakes(review): Captain: refresh X follow-up docs
* no-mistakes(review): Captain: harden X follow-up relinks
* no-mistakes(review): Captain: harden follow-up state persistence
* no-mistakes(document): Document X follow-up carryover
* feat(backends): add experimental cmux runtime backend (#246)
* feat(backends): add cmux runtime backend (experimental)
Session-provider-only adapter for cmux (bin/backends/cmux.sh), mirroring
zellij/herdr structurally, wired into fm-backend.sh and fm-spawn.sh with
--secondmate refused for now. Verified against the real cmux 0.64.17 app:
send does not auto-submit, cwd is creation-time-frozen (zellij-shape,
pwd-marker-probe workaround), close-surface refuses on a workspace's last
surface (falls back to close-workspace), workspace ids do not survive a
relaunch, and the control socket defaults to cmuxOnly access (requires a
one-time password-mode setup, documented in docs/cmux-backend.md). Also
found and fixed a live bug during development: read-screen fails on a
surface that has never been written to, so liveness now uses list-panes
instead. Fake-CLI unit suite (40 tests), a real-binary smoke test, and a
full spawn/steer/peek/done/merge/teardown E2E pass against a real claude
crewmate all pass, including the popup/second-Enter regression class.
* no-mistakes(review): Harden cmux recovery and password parsing
* no-mistakes(review): Harden cmux capture failure handling
* no-mistakes(review): Mark cmux test scripts executable
* no-mistakes(review): Scope cmux workspaces and teardown
* no-mistakes(review): Captain, honor cmux password config override
* no-mistakes(review): Captain, hash cmux home labels
* no-mistakes(document): Sync cmux backend docs
* feat(agents): add firstmate coding guidelines skill (#248)
* Add firstmate-coding-guidelines skill (AGENTS.md diet PR 0)
Encodes the knowledge-placement decision tree, one-owner rule, and
inline-stub pattern from the diet analysis so future contributions stop
adding conditional detail inline. AGENTS.md gets one section-13 trigger
line; fm-brief.sh's REPO argument has no reliable signal for "this is
firstmate's own repo", so the load instruction goes in CONTRIBUTING.md's
Development section instead of the scaffold.
* no-mistakes(review): Captain, align tracked-material trigger scope
* no-mistakes(document): Sync coding guidelines docs
* no-mistakes(lint): Fix Markdown style issues
* fix: add turn-end supervision guard (#249)
* feat: structural Stop-hook backstop for primary turn-end supervision
fm-guard.sh is pull-based: it only warns when some other supervision
script happens to run, so a primary session that ends a turn without
re-arming the watcher and then runs no further fleet-touching command
can sit blind for hours (the 2026-07-04 incident this fixes).
Add bin/fm-turnend-guard.sh, a Claude Code Stop hook registered in the
tracked .claude/settings.json, that fires on every primary turn end and
blocks (exit 2, verified empirically to force continuation) when work
is in flight with no fresh watcher beacon. It never blocks more than
once per turn, using Claude Code's own stop_hook_active loop-guard
field, and scopes itself to the actual primary checkout only (inert in
crewmate/scout worktrees and secondmate homes).
Factor the shared "in-flight but no live watcher" predicate out of
fm-guard.sh into bin/fm-supervision-lib.sh so the pull-based banner and
the push-based hook can never drift on what "unhealthy" means.
Document the verified Stop-hook mechanism and scoping in
docs/turnend-guard.md, add a harness-adapters note, and cover the
predicate and hook with tests/fm-turnend-guard.test.sh.
* no-mistakes(review): Respect active home in turnend guard
* no-mistakes(review): Require live watcher for turn-end guard
* no-mistakes(review): Captain: portable turn-end timing
* no-mistakes(document): Sync turn-end guard documentation
* feat(backends): auto-detect cmux runtime (#250)
* feat(backends): auto-detect cmux runtime from CMUX_WORKSPACE_ID
Wires cmux into fm_backend_detect the same way herdr already is: a
firstmate process running inside a cmux-spawned terminal now spawns
new tasks into cmux by default, no config needed. Verified from cmux's
own shipped source that CMUX_WORKSPACE_ID/CMUX_SURFACE_ID/CMUX_SOCKET_PATH
are unconditionally, non-overridably injected into every terminal
surface it spawns, and that cmux's own CLI treats CMUX_WORKSPACE_ID as
its own ambient-target fallback - the same role $TMUX/HERDR_ENV play for
their backends. CMUX_WORKSPACE_ID is checked last (after $TMUX and
HERDR_ENV=1) since cmux is a terminal application, not a nestable
multiplexer. Socket auth (config/cmux-socket-password) stays required
regardless of how the backend was selected; the existing spawn refusal
now also names the config/backend=tmux / --backend tmux opt-out for a
caller who never explicitly chose cmux.
A live env dump inside a real cmux terminal was not obtained safely on
the shared dev machine (documented in docs/cmux-backend.md); this rests
on the source read instead, mirroring this doc's existing
verified-from-source precedent.
* no-mistakes(review): Fix cmux autodetect docs and tests
* no-mistakes(document): Document cmux auto-detection
* fix(afk): support herdr away-mode injection (#251)
* fix(afk): make the away-mode daemon backend-aware for herdr
bin/fm-supervise-daemon.sh discovered its supervisor pane and injected
via raw tmux calls only, so /afk failed outright on a herdr-based
fleet (TMUX_PANE unset, firstmate:0 fallback unresolvable).
Discovery now resolves backend (tmux|herdr) and target independently,
mirroring fm-backend.sh's own runtime auto-detection, with an explicit
FM_SUPERVISOR_BACKEND override alongside the existing FM_SUPERVISOR_TARGET.
zellij/orca refuse loudly at startup instead of misapplying tmux
primitives. Injection (pane-exists probe, busy-guard, composer-guard,
verified submit) now dispatches through bin/fm-backend.sh's generic
primitives, adding a new fm_backend_composer_state dispatcher; the
tmux path is byte-identical to before. Also fixes a pre-existing bug
in fm_backend_target_exists's herdr arm (missing --session, so it
silently misrouted once more than one herdr server was running) found
while verifying this end to end against a real isolated herdr session.
Classification, batching, max-defer, the marker contract, locks, and
wake-queue handling are unchanged - this is a transport-layer fix.
* no-mistakes(review): Corroborate Herdr idle busy state
* no-mistakes(review): Stabilize Herdr daemon startup wait
* no-mistakes(review): Captain, route cmux composer and update AFK docs
* no-mistakes(document): Document AFK supervisor backend support
* docs(agents): move X-mode procedures out of AGENTS (#253)
* docs(agents): collapse X-mode section 14 into fmx-respond/docs pointers
AGENTS.md diet PR 1 of 3 (agentsmd-diet-s2 report, move-plan items 1-2).
Replaces section 14's "Answering"/"Completion follow-up"/"Conversations"/
"Length and threads"/"Preview / dry-run" blocks (54 lines) and the
"Mechanism" narrative (6 lines) with two short pointers: fmx-respond
(section 13) for the procedure, docs/configuration.md "X mode (.env)"
for the wire protocol. Net -55 lines in AGENTS.md.
Destination edits landed first, deletions second (q4 discipline):
- docs/configuration.md: added the "purely additive, watcher untouched"
guarantee that AGENTS.md's Mechanism block stated but configuration.md
did not.
- fmx-respond/SKILL.md: added the x-mode-error wake boundary (report as
a blocker, do not load this skill), the --image flag for replies and
follow-ups, the "images are for real artifacts, not prose" rule, and
the dry-run compact-image-marker behavior - none of these were
previously in the skill even though AGENTS.md described them, so they
were genuine gaps, not pre-existing duplication. Also made the skill's
own "Completion follow-up" section the sole, full owner of that
procedure instead of deferring to AGENTS.md section 14 for substance
that no longer lives there (two internal cross-references updated to
point at section 8's terminal-wake trigger and the skill's own section
instead).
Mechanical line-by-line audit of every removed AGENTS.md line:
Mechanism block (6 lines removed):
- bootstrap artifact-writing description -> already owned by
docs/configuration.md "X mode (.env)" (locked-bootstrap paragraph)
- check-shim/poll mechanism description -> already owned by
docs/configuration.md same section
- missing-deps/x-mode-error diagnostic description -> already owned by
docs/configuration.md ("Relay auth or config problems...") plus
bin/fm-x-poll.sh's own header comment for the missing-curl/jq mechanics
- opt-out artifact removal description -> already owned by
docs/configuration.md same section
- "purely additive, no edit to fm-watch.sh/fm-watch-arm.sh/fm-wake-lib.sh/
afk daemon" guarantee -> MOVED to docs/configuration.md (added in this
PR; this fact had no other home before)
Answering/Completion follow-up/Conversations/Length and threads/
Preview-dry-run blocks (54 lines removed):
- x-mention wake -> load fmx-respond: already owned by section 13's
existing trigger line (unchanged) and restated in the new pointer
- x-mode-error wake -> report as blocker, don't load fmx-respond: MOVED
to fmx-respond/SKILL.md (added in this PR)
- inbox-draining, classification, acting, reply composition, submission,
cleanup-on-success/failure: already owned by fmx-respond/SKILL.md
"Procedure" section (unchanged, pre-existing)
- owner-only routing / captain-as-asker framing: already owned by
fmx-respond/SKILL.md "The asker is your own captain" section
- standing X-mode authorization / autonomous posting / dry-run as only
non-posting path: already owned by fmx-respond/SKILL.md same section
- acknowledge-first -> act -> follow-up shape, three-case classification:
already owned by fmx-respond/SKILL.md "A request to act on" section
- destructive/irreversible/security-sensitive escalation guardrail:
already owned by fmx-respond/SKILL.md "Public channel..." section and
Procedure step 2c
- dismiss-instead-of-reply for pure acknowledgments, relay re-offer
prevention, dry-run honoring: already owned by fmx-respond/SKILL.md
Procedure steps 2b/2c/2e-skip and docs/configuration.md
- public-safety bar (no task ids/internals/captain-private/secrets):
already owned by fmx-respond/SKILL.md "The reply is public" section
- never-inline-into-shell-command / --text-file or stdin: already owned
by fmx-respond/SKILL.md Procedure step 2e and Notes
- --image flag for replies (formats, base64, no-inline guarantee): MOVED
to fmx-respond/SKILL.md Procedure step 2e (added in this PR - this was
not previously in the skill)
- fm-x-link field names (x_request=, x_request_ts=, x_followups=):
already owned by AGENTS.md section 2's state/<id>.meta field list
(untouched, out of scope for this PR) and fmx-respond/SKILL.md
- carry-count/carry-ts relink behavior, three-follow-up budget, milestone
sparingness, --check/--text-file posting, connector/followup wire
detail, --final clearing, cap/window graceful degradation: already
owned by fmx-respond/SKILL.md "Completion follow-up" section (now sole
owner) and docs/configuration.md wire-protocol paragraphs
- --image flag for follow-ups: MOVED to fmx-respond/SKILL.md "Completion
follow-up" section (added in this PR - genuine gap)
- "failed task still gets an honest final follow-up": already owned by
fmx-respond/SKILL.md "Completion follow-up" section
- FMX_DRY_RUN whole-loop previewability: already owned by
fmx-respond/SKILL.md "Dry-run / preview mode" section
- in_reply_to conversation continuity, untrusted-thread handling,
follow-up worthiness judgment, relay-owned self-reply guard/cap:
already owned by fmx-respond/SKILL.md "The direct ask is the captain's"
section and Notes (one bullet is a verbatim match)
- concise-by-default / no hand-numbered threads: already owned by
fmx-respond/SKILL.md "Voice" section
- auto-split behavior, char/tweet caps, premium-independence, wire shape
({text}/{text,texts}): behavior already owned by fmx-respond/SKILL.md
Voice section; exact defaults and wire shape already owned by
docs/configuration.md; "premium-independent" mechanics already owned
by bin/fm-x-reply.sh's own header comment
- "images are for real artifacts, not prose": MOVED to fmx-respond/
SKILL.md "Voice" section (added in this PR - genuine gap)
- image-on-thread wire behavior: already owned by docs/configuration.md;
reinforced in fmx-respond/SKILL.md's new --image note
- dry-run POST-body shape, endpoint marker, truthy-value definition,
jq-only dependency, end-to-end testability, x-outbox inspection:
already owned by fmx-respond/SKILL.md "Dry-run / preview mode" section
(several near-verbatim matches) and docs/configuration.md wire detail
- dry-run compact image marker: MOVED to fmx-respond/SKILL.md "Dry-run /
preview mode" section (added in this PR - genuine gap)
Section 8's terminal-wake completion-follow-up trigger (the one fact
required to survive inline) is untouched and already present; the new
section 14 pointer references it instead of restating it.
Nothing outside section 14 (plus the two destination files) is touched.
Full test suite green, including all 74 fm-x-mode.test.sh checks.
* no-mistakes(review): Preserve X-linked follow-up triggers
* no-mistakes(review): Fix x-mode error trigger
* no-mistakes(document): Docs cross-reference synchronized
* no-mistakes(lint): Clean Markdown lint pass
* docs: trim duplicated harness guidance (#255)
* docs(agents): trim section 4 harness/secondmate duplication
AGENTS.md diet PR 2 of 3 (data/agentsmd-diet-s2/report.md, move-plan
items 3-4; redundancy item 2 folded into item 3).
Removed the five claude/codex/grok/pi/opencode model/effort-flag
bullets from section 4 - byte-for-byte duplicated by
harness-adapters' "Launch profile axes" table (which is already a
superset: it carries verified CLI versions per adapter that the
AGENTS.md bullets lacked). Replaced with a one-line pointer; the
skill is already loaded before every spawn per section 4's own
closing trigger, so no new trigger was needed.
Moved the config/secondmate-harness model/effort pin-format detail
(the `<harness> [<model>] [<effort>]` line format, the
secondmate-model/secondmate-effort accessors, back-compat, and the
durability-across-respawn behavior) into secondmate-provisioning,
which is already a mandatory load at every secondmate lifecycle
touchpoint. Added the destination content to the skill first, then
replaced the AGENTS.md paragraph with a 3-line pointer.
Mechanical audit - every removed line's new home:
- 5 harness bullets (claude/codex/grok/pi/opencode model+effort
flags, per-harness max-omission rationale) -> already present in
harness-adapters SKILL.md's "Launch profile axes" table (lines
53-59), confirmed fact-by-fact before deleting.
- "config/secondmate-harness may also pin..." paragraph (pin format,
bare-harness back-compat, secondmate-model/secondmate-effort
accessors, per-spawn override precedence, respawn durability,
secondmate-only scope) -> secondmate-provisioning SKILL.md's
"Charter and seed" section, added verbatim before this trim.
- The following paragraph (inheritable config: crew-dispatch.json,
crew-harness, backlog-backend) is untouched - out of scope for
this PR, still inline.
- The bootstrap CREW_DISPATCH effort-mismatch diagnostic sentence is
untouched - not part of the five-bullet duplication, stays inline.
No script changes. Section 4 shrinks from 104 to 87 lines
(958 -> 901 total AGENTS.md lines) with zero facts lost: every fact
is reachable through harness-adapters or secondmate-provisioning,
both already mandatory loads at the relevant lifecycle points.
* no-mistakes(document): Align secondmate skill triggers
* no-mistakes(lint): Markdown style clean
* fix: anchor turn-end Stop hook to project root (#256)
* Fix turn-end Stop hook to use CLAUDE_PROJECT_DIR path
Claude Code runs hook commands via /bin/sh from the session cwd, so the
bare relative bin/fm-turnend-guard.sh path fails when cwd is not the repo
root. Anchor the command with "$CLAUDE_PROJECT_DIR"/bin/fm-turnend-guard.sh
instead; verified CLAUDE_PROJECT_DIR is set on Stop hooks in Claude Code
2.1.201. Document the cwd caveat and add a settings.json regression test.
* no-mistakes(document): Document Stop hook path anchoring
* docs: trim firstmate agent guidance duplication (#258)
* docs: trim AGENTS.md redundancy (diet PR 3/3)
Consolidates five duplicated passages to a single owner each, per
data/agentsmd-diet-s2/report.md redundancy items c3-c7:
- Inheritable-config propagation mechanism: owned by section 3 (where
the sweep runs); sections 4 and 7 keep compact references. Section 4
retains its one genuinely unique fact (crew-harness inherit-vs-fallback
semantics), just no longer restates the propagation mechanism itself.
- Landed-work definition: owned by section 7's ship-teardown detail
(PR-containment mechanics, pr= discovery fallback); section 1's hard
rule #3 keeps the rule plus a three-case summary and a pointer.
- Backend meta-field enumeration: owned by docs/configuration.md
("Runtime backend", already comprehensive including cmux) and each
backend's own doc; AGENTS.md keeps only the fields common to every
task plus a pointer.
- Dropped one redundant restatement of "silence is correct while
waiting" in section 8.
- Worktree-tangle guard explanation: owned by section 8 (already the
fuller, cross-referenced version); section 3's TANGLE bullet keeps
the remediation action and points at section 8 for the why.
Also adds two captain-requested single-sentence rules: invoke bin/
scripts by absolute $FM_ROOT path after any cd away from the home, and
a backend spawn refusal must be surfaced to the captain rather than
silently worked around by switching backends.
AGENTS.md: 901 -> 889 lines, 112355 -> 108560 bytes.
* no-mistakes(review): Clarify post-cd bin invocation guidance
* no-mistakes(document): Sync AGENTS trim docs
* no-mistakes(lint): Fix Markdown line style
* feat(backends): improve cmux detection and socket-mode guidance (#259)
* feat(backends): cmux detection fallbacks and socket-mode matrix
Workstream A: cmux's bundled claude wrapper strips every CMUX_* env var on
its passthrough path (reproduced live 2026-07-04, cmux 0.64.17), so a
claude-harness firstmate inside a cmux tab has no CMUX_WORKSPACE_ID.
fm_backend_detect now falls back - macOS-only, only when the primary marker
is absent - to __CFBundleIdentifier=com.cmuxterm.app and then a process
ancestry walk resolved by bundle id (lsappinfo) plus a bundle-shaped ps comm
match. Innermost-first ordering is unchanged and absorbs the
tmux-inside-cmux bundle-id false positive; the auto-detect NOTICE names the
winning fallback signal.
Workstream B: the five socketControlMode values were traced through cmux
source (commit 9c91710e3f58): off/cmuxOnly can never admit an external CLI,
automation admits same-user clients with no secret (0600 socket only),
password needs the auth handshake, allowAll opens the socket to every local
user (0666). Automation mode is now the documented recommendation; the
adapter's refusals name every viable mode, classify Invalid password as
unauth, and the launch-timeout message names the off-mode possibility.
Docs carry the wrapper-strip empirical record, the fallback contract and
authority split, and the full mode matrix with rationale; tests cover the
new detection paths, the nested false positive, and the refusal wording.
* no-mistakes(review): Document cmux fallback detection
* no-mistakes(review): Update cmux architecture docs
* no-mistakes(document): Align cmux backend docs
* fix(backends): scope zellij tabs by firstmate home (#252)
* fix(backends): home-scope zellij tab titles to close cross-home collision gap
Zellij's one shared "firstmate" session has no per-home split and enforces
no tab-name uniqueness, so two firstmate homes with colliding task ids could
send/peek/close each other's tabs - the same gap a no-mistakes review gate
caught for cmux (docs/cmux-backend.md). Ports that fix: every new tab is
created with a home-scoped title (fm-<home-label>-<id>), and every
list/find/recover/kill path scopes matches to this home's own tag. A tab
spawned before this change still matches via its old untagged bare title,
but only when unambiguous - two live tabs sharing a bare title refuse rather
than guessing which one is ours.
Factors the home-label/hash derivation shared with cmux into
bin/fm-backend-hometag-lib.sh so the two adapters can't drift.
* no-mistakes(review): Fix zellij child teardown home tag
* no-mistakes(review): Fix zellij teardown and selector scoping
* no-mistakes(document): Sync zellij home-scope docs
* fix: sync project clones after merged PR wakes (#293)
* fix(fleet-sync): auto-sync on merged-PR wake, accept project name
fm-fleet-sync.sh's single-project form failed on a bare project name
("not a directory"), forcing hand-typed full paths (4 manual runs in
one incident). It now resolves a bare name or projects/<name> against
the home's projects dir.
AGENTS.md now encodes the trigger: a wake whose status reports a
merged PR for a project cloned in this home runs fleet-sync for that
project as part of handling the wake, so a secondmate-reported merge
does not leave the primary's clone stale until the next session start
or teardown.
* no-mistakes(review): Fix fleet-sync project name shadowing
* no-mistakes(document): sync fleet-sync docs
* fix: canonicalize spawn worktree path checks (#294)
* fix(spawn): canonicalize worktree-isolation guard against symlinked project prefixes
fm-spawn.sh compared a logical PROJ_ABS against the physically-resolved
pane cwd every backend reports, so a project reached through a symlinked
prefix (e.g. macOS's /tmp -> /private/tmp) could trip the isolation
guard's false refusal before treehouse ever moved the pane. Canonicalize
once into PROJ_ABS_REAL and compare against that everywhere instead.
* no-mistakes(review): Canonicalize spawn cwd comparisons
* no-mistakes(document): Refresh symlinked spawn docs
* docs: add Orca operator skill (#276)
* docs: add Orca operator skill
* no-mistakes(document): Document Orca checklist
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix: surface green PRs during CI monitoring (#297)
* fix(crew-state): detect green-PR CI monitoring, escalate repeat wedges
fm-crew-state.sh's ci step never distinguishes "still waiting on checks"
from "checks green, waiting on merge" via axi status alone, since a repo
that defers merge to the captain keeps the ci step at status=running for
the whole monitor phase. Read the ci step's own log tail (axi logs) for
the checks-passed marker and surface done instead of a false "validating
(running)" - verified against the real PR #252 run's ci.log.
The watcher's wedge timer can re-escalate the same stale pane forever
without ever signaling that it is a repeat; track a per-pane consecutive
escalation count and add a demand-deep-inspection marker to the wake
payload once it crosses a threshold, so the supervisor can no longer
dismiss each one as an isolated, still-validating pane.
Also clarify the ship-brief's checks-green line: it is owed at the
CI-ready return point, not after the background monitor-until-merge
loop finishes.
* no-mistakes(review): Captain, distinguish pending no-checks CI marker
* no-mistakes(review): Harden CI relapse handling
* no-mistakes(review): Block stale done during fixing
* no-mistakes(review): Captain, tighten CI status gating
* no-mistakes(review): Captain, harden stale CI green handling
* no-mistakes(review): Captain, recognize ranged CI rearm markers
* no-mistakes(document): Sync crew-state supervision docs
* fix(teardown): recover provably stale git index locks (#296)
* fix(teardown): recover from a stale worktree git index.lock
A crew process killed mid-git-operation can leave a stale
.git/worktrees/<wt>/index.lock behind, making fm-teardown.sh's
`treehouse return --force` fail closed. On that failure, retry once
after a short wait (the owning process may be exiting), then remove
the lock and retry once more only when it is provably stale: old
enough by mtime and lsof shows no live holder on the lock or the
worktree itself. A lock that isn't provably stale is left in place and
the original…
kostas-nt
added a commit
to kostas-nt/firstmate
that referenced
this pull request
Jul 8, 2026
* feat: add grok crewmate harness support (#143)
* feat(harness): add grok (Grok Build) as a verified crewmate adapter
Empirically verified against grok 0.2.73 and encoded across the machinery:
- fm-harness.sh: detect grok via GROK_AGENT=1 env marker (grok does not set
CLAUDECODE) and `grok` command-name ancestry.
- fm-spawn.sh: grok launch template (`grok --always-approve "$(cat BRIEF)"`,
fully autonomous, no permission gate) and a turn-end Stop hook. grok only
loads project hooks after a manual folder-trust grant, so the hook is a
single firstmate-owned global hook (~/.grok/hooks/fm-turn-end.json, always
trusted) that is a guarded no-op unless the workspace holds a per-task
.fm-grok-turnend pointer; fm-spawn drops that gitignored pointer naming
state/<id>.turn-ended. Hook stays outside the worktree, needs no trust grant.
- fm-watch.sh + fm-tmux-lib.sh: grok busy signature `Ctrl+c:cancel` (the
mid-turn cancel hint; ASCII, present iff a turn runs).
- harness-adapters skill: grok facts section (busy, exit=Ctrl+Q x2,
interrupt=Ctrl+C, skill invocation /<skill>, resume) and /no-mistakes form.
Gating question confirmed: grok invokes /no-mistakes and drives a real
no-mistakes axi run, so grok is usable for no-mistakes-mode tasks. End-to-end
verified through fm-spawn: autonomous launch past the dir picker into the
worktree, brief processed, busy->idle and turn-end signal detected, fm-send
steer lands, clean Ctrl+Q exit and teardown. config/crew-harness is left
unchanged; this only makes grok available as a verified option.
* no-mistakes(review): Captain, harden Grok hook lifecycle
* no-mistakes(review): Captain, make Grok harness test executable
* no-mistakes(review): Captain, bound Grok pointer reads
* no-mistakes(test): Captain, harden crew-state and watcher-lock timing
* no-mistakes(document): Document Grok harness support
* feat(harness): split secondmate harness configuration (#144)
* feat(harness): split secondmate harness and inherit primary config into secondmate homes
Add config/secondmate-harness so secondmates can run on a different adapter
than crewmates. fm-harness.sh gains a `secondmate` mode resolving the chain
config/secondmate-harness -> config/crew-harness -> own; `crew` mode is
unchanged. fm-spawn resolves a --secondmate launch through that mode (durable:
every respawn re-resolves), while an explicit per-spawn harness arg still wins
and the unverified-adapter guard still holds.
Add a generic, extensible inheritable-config mechanism (fm-config-inherit-lib.sh)
that pushes the primary's declared LOCAL config into each secondmate home's
config/ at secondmate spawn and on the bootstrap secondmate sweep. Exactly one
item is wired today: config/crew-harness, so a secondmate's own crewmates use
the primary's setting. Primary-authoritative (re-pushed every convergence,
mirrors absence); config/secondmate-harness is deliberately not inherited since
secondmates never spawn secondmates. config/ is gitignored, so this is a copy
separate from the tracked-files fast-forward.
Update AGENTS.md (layout, bootstrap, harness, spawn), the harness-adapters
skill, docs/scripts.md, and .gitignore. New tests cover secondmate resolution
and fallback, spawn/respawn honoring config/secondmate-harness, config
propagation on spawn and sweep, the unverified-adapter guard, and backward
compatibility.
* no-mistakes(review): Surface inherited config propagation failures
* no-mistakes(review): Harden inherited config propagation
* no-mistakes(review): Document literal harness inheritance requirement
* no-mistakes(document): Document secondmate harness config
* feat(backlog): default backlog operations to tasks-axi (#145)
* feat(backlog): default to tasks-axi backend
* no-mistakes(document): Sync backlog backend docs
* fix(spawn): set per-task GOTMPDIR so interrupted Go builds don't leak /tmp (#36)
* fix(spawn): set per-task GOTMPDIR so interrupted Go builds don't leak /tmp
Go's GOTMPDIR is unset, so every go build/test creates numbered /tmp/go-build*
dirs. Go cleans them on a clean exit but LEAVES THEM when interrupted (signal,
timeout, OOM, full disk), accumulating and filling the disk over time.
Give each task its own temp root at /tmp/fm-<id>/ with Go's build temp nested at
gotmp/. fm-spawn creates the dir (Go won't mkdir GOTMPDIR), exports GOTMPDIR into
the crewmate pane so the agent and child processes inherit it, and records
tasktmp= in meta. fm-teardown reads tasktmp= and removes the whole root on
cleanup, deterministically.
GOTMPDIR (not TMPDIR) is the targeted knob: TMPDIR is too broad (affects every
program's temp). The nested root is extensible: other per-task temp can live
under /tmp/fm-<id>/ later.
Backward compat: tasks spawned before this change have no tasktmp= in meta;
teardown tolerates the empty value as a no-op. The daily fm-disk-cleanup.sh cron
remains a safety net for any pre-fix stray dirs.
* fix(tests): silence SC2016 for literal grep -F patterns in fm-gotmp test
The structural grep -F assertions deliberately match literal $TASK_TMP in the
fm-spawn source; add per-line shellcheck disable=SC2016 (the codebase's existing
pattern, e.g. bin/fm-spawn.sh) so CI lint passes.
* no-mistakes(document): docs: document tasktmp= meta field for per-task GOTMPDIR
---------
Co-authored-by: e-jung <8334081+e-jung@users.noreply.github.com>
* fix: accept landed squash-merged PR heads (#149)
* fix(teardown): accept landed squash-merge PR heads
* no-mistakes(document): Document teardown landing behavior
* no-mistakes: apply CI fixes
* fix(test): pass explicit teardown git identity
* feat(dispatch): add dynamic crew profiles (#154)
* feat(dispatch): add dynamic crew profiles
* no-mistakes(review): Captain, document dispatch profile inheritance
* no-mistakes(review): Captain, guard stale dispatch inheritance
* no-mistakes(document): Sync dispatch profile docs
* no-mistakes: apply CI fixes
* fix: harden crew dispatch profile enforcement (#159)
* Harden crew dispatch profile enforcement
* no-mistakes(document): Captain, synced crew dispatch docs
* feat: add live secondmate config push (#161)
* feat(config): add live secondmate config push
* no-mistakes(document): Document config push behavior
* no-mistakes(lint): Clean changed shell lint
* no-mistakes: apply CI fixes
* feat: support image attachments in X replies (#162)
* feat(x): add image attachments to reply helpers
* no-mistakes(review): Stream X image replies safely
* no-mistakes(review): Captain, clean X reply temp tracking
* no-mistakes(document): Document X reply image support
* fix(teardown): make landed PR detection robust (#167)
* fix(teardown): make landed-check robust when no pr= was ever recorded
fm-teardown.sh's squash-merge landed-check already falls back to
discovering a merged PR by branch name when state/<id>.meta has no
recorded pr=, but nothing guaranteed pr=/pr_head= actually got
recorded on a yolo-authorized merge - the "checks green" trigger that
normally runs fm-pr-check.sh never fires on repos with no PR CI, so a
merge done via a bare `gh-axi pr merge` silently skips it.
Add bin/fm-pr-merge.sh as the one path for merging a task's PR: it
always runs fm-pr-check.sh first, so pr=/pr_head= land in meta as part
of the merge itself regardless of any CI signal. Document both the
existing branch-name discovery fallback and the new merge path in
AGENTS.md, and add regression coverage for the no-pr=-recorded landed
scenario and for fm-pr-merge.sh's record-then-merge behavior.
* no-mistakes(review): Guard PR merges on task metadata
* no-mistakes(document): Document PR merge wrapper
* no-mistakes: apply CI fixes
* fix: parse PR merge URLs for gh-axi (#168)
* Fix fm-pr-merge.sh to parse PR URLs for gh-axi
gh-axi pr merge expects a PR number and --repo, not a full GitHub URL.
Parse the URL, default to --squash when no merge method is passed, and
fail fast on malformed URLs. Tests cover parsing, defaults, and refusal.
* no-mistakes(review): Harden PR merge validation
* no-mistakes(review): Harden PR merge URL guards
* no-mistakes(document): Document PR merge URL handling
* no-mistakes(lint): Clean shell lint
* feat(bin): pin secondmate model and effort (#180)
* feat: pin secondmate model/effort in config/secondmate-harness
Extend config/secondmate-harness's format to an optional
"<harness> [<model>] [<effort>]" line so a secondmate can be durably
locked to a concrete model/effort in the same file, without adding a
new config file. A bare harness-only file behaves exactly as before.
fm-harness.sh gains secondmate-model/secondmate-effort accessors;
fm-spawn.sh populates MODEL/EFFORT from them on every secondmate spawn
(including respawns) unless the caller passed an explicit --model/--effort.
* no-mistakes(review): Fix secondmate override pin precedence
* no-mistakes(document): Document secondmate harness pins
* feat(bin): add runtime backend interface (#183)
* feat(bin): extract tmux runtime behind a backend interface (P1)
Add bin/fm-backend.sh (selection, meta helpers, selector resolution,
dispatch) and bin/backends/tmux.sh (the tmux adapter), then route
fm-send.sh, fm-peek.sh, fm-watch.sh, fm-spawn.sh, and fm-teardown.sh
through them. Every default tmux command sequence, meta shape, and
printed output stays byte-identical: missing backend= still means
tmux, and a default spawn never writes backend=tmux.
Adds a --backend flag (tmux-only for now) and FM_BACKEND/config/backend
selection, refusing any unimplemented backend loudly. Names the
watcher's poll loop as the default event-source implementation over the
backend's pull primitives, per the herdr-addendum's events-as-the-core-
abstraction direction, without changing its behavior.
Verification: fake-tmux/treehouse old-vs-new command-log conformance
tests for send/peek/spawn/teardown, a real-tmux smoke test for the
adapter, and the full existing suite passing unmodified (bar two
fixture-only additions in fm-gotmp.test.sh for the new sibling
scripts).
* no-mistakes(review): Captain, harden backend baseline resolution
* no-mistakes(review): Captain, ignore and document backend config
* no-mistakes(review): Captain, make backend tests executable
* no-mistakes(document): Sync runtime backend documentation
* feat(bin): add experimental Herdr runtime backend (#186)
* feat(bin): add experimental herdr runtime backend (P2)
Implements bin/backends/herdr.sh (session-provider adapter, D3: treehouse
stays the worktree provider) wired through fm-backend.sh's dispatch, with
--backend herdr / FM_BACKEND=herdr / config/backend selection, a
version/protocol gate at spawn, semantic busy-state detection via herdr's
agent.get (fm-watch.sh and fm-crew-state.sh consult it before falling back to
the existing tmux pane-regex path), and label-based recovery discovery.
Container shape (D4) decided empirically: tab-per-task in one "firstmate"
workspace, mirroring tmux's one-session-many-windows model.
Found and fixed two real herdr v0.7.1 bugs during verification: `pane read
--lines N` returns empty for small N (worked around by over-fetching and
trimming locally), and `pane get`'s cwd field is frozen at pane-creation time
(fixed to read foreground_cwd instead, needed for fm-spawn's worktree-
discovery poll after `treehouse get`). Also fixed a pre-existing bug in
tests/fm-backend.test.sh's old-vs-new fixture that was silently missing
fm-backend.sh/bin/backends/ from the old bin/ shim.
Full empirical verification, the D4 decision evidence, and a real end-to-end
run (spawn/steer/peek/done/merge-local/teardown, including confirming
teardown refuses before the merge) are recorded in docs/herdr-backend.md.
The entire existing tmux conformance suite stays green.
* no-mistakes(review): Fix Herdr supervision recovery gaps
* no-mistakes(review): Captain, fix Herdr stale recovery gaps
* no-mistakes(review): Document Herdr composer primitive candidate
* no-mistakes(review): Captain, harden Herdr stale recovery and tests
* no-mistakes(document): Sync herdr backend docs
* no-mistakes: apply CI fixes
* feat(bin): auto-detect runtime backend (#188)
* feat(bin): auto-detect runtime backend from HERDR_ENV/TMUX markers
fm_backend_name now falls through to runtime auto-detection between
config/backend and the hard tmux default: a firstmate running natively
inside herdr (HERDR_ENV=1) now spawns crewmates into herdr by default,
mirroring how harness detection already works in fm-harness.sh. Nesting
resolves innermost-first (tmux wins over a nested herdr pane). Explicit
--backend/FM_BACKEND/config/backend settings always win over detection.
Selecting herdr via auto-detect prints a loud stderr notice; auto-detecting
tmux stays silent so the unconfigured default path is unchanged.
* no-mistakes(review): Captain, pin tmux tests and backend docs
* no-mistakes(document): Sync backend autodetect docs
* no-mistakes: apply CI fixes
* feat(stow): add operational memory capture (#197)
* feat(stow): add operational-memory learnings convention and /stow skill
Add data/learnings.md as the fleet-local operational-learnings home,
a knowledge-routing table in AGENTS.md, and a user-invocable /stow
skill that sweeps a session for uncaptured durable knowledge and
files it to the right disk home before a reset.
* no-mistakes(review): Fix stow backlog note command
* no-mistakes(document): Document stow memory routing
* fix(tests): protect herdr smoke cleanup from default sessions (#199)
* fix(tests): stop real-herdr smoke tests from ever killing the default session
Both fm-backend-herdr-smoke.test.sh and fm-backend-autodetect-smoke.test.sh
tore down their isolated throwaway HERDR_SESSION via a bare/inline-prefixed
`herdr server stop`, which is unscoped and resolves ambiently. On this herdr
client, that ambient resolution silently falls back to whatever server is
already running instead of the requested session - it killed the captain's
live default herdr server twice in production (2026-07-02), once from each
smoke test's cleanup trap.
Add tests/herdr-test-safety.sh with herdr_safe_stop_and_delete: it uses the
explicit-by-name `herdr session stop/delete <name>` form (never the ambient
`server stop`) and, before that, a read-only hard guard
(herdr_refuse_if_default) that re-queries `herdr session list --json` and
refuses outright if the target is literally "default", not found, or flagged
default:true. Fails closed on any ambiguity. Verified empirically against a
real isolated session: refuses on default/nonexistent/empty names without
ever calling stop, and correctly tears down a genuine isolated session while
leaving the default session's workspace state byte-identical before and
after.
* no-mistakes(review): guard herdr delete with fresh check
* no-mistakes(document): Document herdr smoke cleanup safety
* feat(bin): route herdr secondmates into per-home workspaces (#200)
* feat(bin): give each secondmate its own labeled herdr workspace
Give each secondmate its own labeled herdr workspace, and land crewmates
spawned from a secondmate home in that secondmate's own space, instead of
every firstmate home (primary and all secondmates) sharing one "firstmate"
workspace.
bin/backends/herdr.sh: replace the constant FM_BACKEND_HERDR_WORKSPACE_LABEL
with fm_backend_herdr_workspace_label(), resolved fresh from FM_HOME on every
call. The primary (no .fm-secondmate-home marker) still resolves to
"firstmate" - byte-identical to every pre-existing task's recorded label, no
forced migration. A secondmate home resolves to "firstmate-<secondmate-id>".
Every workspace-scoped path (find/ensure, tab create + duplicate check,
list-live recovery, pane-for-tab) uses this same resolution, so recovery and
duplicate checks stay scoped to each home's own space. Workspace and tab
create now pass --no-focus unconditionally (verified: neither focuses by
default once a workspace exists; --no-focus is defense in depth against the
one bootstrap edge case where the very first workspace in a session auto-
focuses).
Also fixes a session-targeting bug found while verifying this empirically:
HERDR_SESSION (env var, exported or inline-prefixed) is not reliably honored
by herdr 0.7.1 CLI subcommands once another herdr server is already running -
it silently falls back to whatever server IS running. fm_backend_herdr_cli
wraps every herdr invocation with both HERDR_SESSION and a trailing
--session <name> flag (verified to route correctly in every case tried),
fixing this for the whole adapter, not just the new label-scoped calls.
bin/fm-spawn.sh: a --secondmate spawn is launched BY the primary's own
process, whose FM_HOME still names the primary at that point. The herdr case
arm now shadows FM_HOME to the secondmate's own home (PROJ_ABS) for just the
two calls that resolve/create the workspace and tab, restored automatically
afterward (bash's temporary-assignment-before-a-command form works for shell
functions too). A crewmate/scout spawned FROM a secondmate's own fm-spawn.sh
process needs no such glue - its own FM_HOME already names it.
Tests: extended tests/fm-backend-herdr.test.sh (per-home label resolution,
--no-focus, --session flag, workspace-find/list-live scoping) and
tests/fm-backend-herdr-smoke.test.sh (a secondmate-shaped home's workspace
label, list-live scoping, restart stability in the multi-workspace shape).
Added tests/fm-backend-herdr-workspace-per-home-e2e.test.sh: the mandatory
isolated E2E, driving real bin/fm-spawn.sh/fm-teardown.sh - a primary-shaped
home into "firstmate", a --secondmate spawn into its own labeled space, a
crewmate spawned FROM that secondmate-shaped home landing in the same space
(this exact path had never run before), teardown closing only the right tab,
and list-live recovery seeing only each home's own tabs. All ten assertions
passed on the real binary; the default herdr session's own workspace state
was confirmed byte-identical before and after every real-herdr test run in
this change.
docs/herdr-backend.md: rewrote "Task container shape" for the workspace-per-
home design (label derivation, the --secondmate FM_HOME-shadow wrinkle, focus
behavior, label-collision/adopt-don't-duplicate semantics, no-forced-
migration), added "Session targeting: the --session flag, not HERDR_SESSION
alone", extended "ID stability" to the multi-workspace shape, and documented
the new E2E test.
* no-mistakes(review): Clarify herdr focus docs
* no-mistakes(review): Captain, clarify herdr server session docs
* no-mistakes(document): Document herdr per-home spaces
* fix(backends): rename Herdr secondmate workspace labels (#203)
* Rename herdr secondmate workspace prefix to 2ndmate-
The primary home keeps the firstmate label; secondmate homes now
resolve to 2ndmate-<id> so the herdr spaces sidebar is unambiguous.
Tests and docs updated; pre-rename workspaces can be aligned with
herdr workspace rename.
* no-mistakes(review): Clarify herdr workspace migration behavior
* no-mistakes(document): Herdr docs label alignment
* feat(bin): add unified session start digest (#201)
* feat(bin): collapse session start into one command
Add bin/fm-session-start.sh, composing fm-lock.sh, fm-bootstrap.sh, and
fm-wake-drain.sh into one ordered digest (lock, bootstrap diagnostics,
wake queue, context files, fleet state) instead of six-plus separate
turns. Lock now runs before bootstrap's mutating sweeps, closing a race
where a second concurrent session could mutate shared state before
discovering the lock was held. A lock refusal prints a loud read-only
banner, skips every mutating step via a new opt-in
FM_BOOTSTRAP_DETECT_ONLY flag on fm-bootstrap.sh, and still completes
the read-only-safe digest.
Add fm_backend_target_exists to fm-backend.sh as a shared, read-only,
never-side-effecting per-task endpoint-liveness primitive for both the
tmux and herdr backends.
Rewrite AGENTS.md sections 3 and 5 around the single command and add
tests/fm-session-start.test.sh.
* no-mistakes(review): Harden session-start read-only guidance
* no-mistakes(review): Suppress read-only tangle repair guidance
* no-mistakes(review): Include orphan status logs
* no-mistakes(review): Captain: make session-start test executable
* no-mistakes(review): Captain: clarify status tail guidance
* no-mistakes(document): Sync session-start docs
* no-mistakes(lint): Shell lint clean
* fix(tests): avoid shellcheck boolean chain
* fix(bin): corroborate herdr idle crew state (#207)
* fix(bin): corroborate herdr idle agent_status with the pane's own text
crew_pane_is_busy trusted a bare `idle` verdict from herdr's agent.get
outright, skipping the tail-regex corroboration unknown already gets.
agent.get reports generation state only (working while the model streams
a turn), so it reads idle for a crew blocked on its own long foreground
no-mistakes run - even though the pane still shows the busy banner the
whole time. Combined with the no-mistakes CLI's 10-run attribution cap,
this made a genuinely working herdr crew read as not provably working,
triggering an immediate stale wake instead of absorb-then-escalate.
* no-mistakes(document): Align herdr busy-state docs
* fix(backends): reuse the herdr firstmate workspace instead of leaking one per spawn (#202)
* fix(backends): reuse the herdr firstmate workspace instead of leaking one per spawn
Every herdr-backed crewmate left an orphaned `firstmate`-labelled workspace
behind, one per task, because `fm_backend_herdr_workspace_find` never matched
the existing workspace: its jq filter used `--arg label ... $label`, and
`label` is a reserved keyword in jq (label/break), so the filter was a compile
error. The error was swallowed by `2>/dev/null`, the find returned empty on
every call, and `workspace_ensure` took the create path each spawn, minting a
fresh workspace. The same collision silently disabled the create-task
duplicate-label check and the bare-selector tab lookup.
Rename the jq variable to `$want` in all three affected filters so reuse,
duplicate detection, and bare-selector lookup work. With reuse restored the
single `firstmate` workspace is persistent (like tmux's session) and teardown
correctly leaves it in place, closing only the task's pane/tab.
Also prune the default tab (label "1") herdr auto-creates inside a freshly
created workspace, best-effort, so the workspace holds only real task tabs.
Add stateful-fake-CLI tests that replay repeated spawn/teardown cycles and
assert one reused workspace, zero orphans, the default tab pruned, and
`workspace create` invoked exactly once. Verified against the real herdr binary
too: the pre-fix code failed the smoke idempotency check (minted wE then wF in
an isolated session); the fix passes it.
Document the workspace lifecycle, the jq-keyword pitfall, the default-tab
prune, and the project-labelled-workspace anomaly (not adapter-created) in
docs/herdr-backend.md.
* docs(herdr): trim workspace-lifecycle addition to current-state facts
The docs/herdr-backend.md convention documents current behavior, not
history - narrative belongs in the PR/commit message. Tightened the
workspace-leak and default-tab-prune write-up down to the operative
facts (the jq reserved-keyword guard, when pruning is safe, and the
persistence caveat), and corrected the CLI-facts table rows to match
the corrected prune timing.
* fix(backends): defer herdr default-tab prune until a real task tab exists
Closing a workspace's LAST tab deletes the whole workspace on real
herdr (verified). Pruning the auto-created default tab right after
workspace create closed the workspace's only tab at that point,
destroying the just-created workspace on every single spawn instead of
reusing it - the fake-CLI unit tests didn't model this real-herdr
behavior, so they passed while the real-herdr smoke test failed with
"container_ensure is not idempotent".
Move the prune into fm_backend_herdr_create_task, right after the
first real task tab is added to a freshly created workspace, when
closing the default tab alongside it is safe. Update the fake-CLI unit
test to match the corrected timing.
Also fix a smoke-test-only bug this surfaced: the test's second
create_task call reused a $CONTAINER captured before the first task
was killed, rather than re-running container_ensure like real
fm-spawn.sh always does immediately before every create_task call - so
once the workspace (correctly) disappeared after its last tab closed,
the stale reference no longer named a live workspace.
* test(backends): guard against jq --arg names colliding with jq keywords
Regression guard for the workspace-leak bug this PR fixes: a jq
--arg/--argjson variable named after a jq reserved keyword (e.g.
label) is a compile error on jq <= 1.6, and this adapter's
2>/dev/null silently turns that into an empty result instead of a
visible failure. Greps bin/ for the pattern so a future violation
fails loudly here instead of silently misbehaving on an older jq.
* docs(herdr): fix per-home staleness and drop contributor-specific example
The workspace-lifecycle write-up hardcoded "the firstmate workspace"
as if the label were always the fixed constant, stale against the
per-home labeling documented earlier in this file (primary: firstmate,
secondmate: 2ndmate-<id>). Rephrased per-home throughout, and pointed
the "workspace this adapter did not derive" case at the existing
Label-derivation section instead of a separate anomaly writeup.
Dropped the "Anomaly: a workspace labelled with a project name"
section - the python-teslemetry-stream example was a contributor's own
environment, not current adapter fact, and it repeated a now-incorrect
FM_BACKEND_HERDR_WORKSPACE_LABEL constant claim. Replaced with one
generic sentence already covered by the corrected wording above.
Also fixed the jq-reserved-keyword guard test's file reference, which
named tests/fm-backend.test.sh when the test actually lives in
tests/fm-backend-herdr.test.sh.
---------
Co-authored-by: kunchenguid <kun@kunchenguid.com>
* fix(backends): make Herdr default-tab pruning safe (#215)
* fix(backends): make the herdr default-tab prune provably safe
The default-tab prune could close a pane holding a LIVE agent: an
ADOPTED workspace (found pre-existing by label match) was pruned using
the same tab-count/label heuristic as a freshly created one, and herdr
derives a workspace's displayed label from its cwd basename when no
explicit --label is given. A captain launching herdr directly inside a
directory named "firstmate" produces a workspace that looks identical,
by label alone, to firstmate's own container - so the very next spawn
adopted the captain's own live workspace and closed their live pane
27ms after creating its task tab (2026-07-02 incident).
The fix is structural: fm_backend_herdr_workspace_ensure now captures
the seeded default tab's id straight from its own `workspace create`
response, only when it just created the workspace. That id threads
through fm_backend_herdr_container_ensure to fm_backend_herdr_create_task,
which is the only function allowed to prune it - an adopted workspace's
caller always passes an empty seeded-tab-id, so create_task never
re-derives "prunable" from a tab's label or count. Defense in depth:
the prune also refuses a tab whose pane reports a working agent.
Covered by new unit tests (adopted-never-prunes, created-prunes-exactly,
the exact label-collision incident shape) and a new isolated real-herdr
E2E test that reproduces the incident against the pre-fix code and shows
it fixed, plus the normal happy path.
* no-mistakes(document): Sync herdr prune docs
* no-mistakes: apply CI fixes
* fix(brief): remove apostrophe breaking bash -n and guard bash 3.2 set -u in spawn (#173)
* fix(brief): remove apostrophe that broke bash -n on fm-brief.sh
The no-mistakes DOD heredoc, built via VAR=$(cat <<EOF ... EOF), had an
unescaped apostrophe in "no-mistakes' own guidance". Nesting a heredoc
inside $(...) makes bash track quote state through the body, so the lone
apostrophe broke parsing of the rest of the script (bin/fm-brief.sh:211),
making the default no-mistakes ship path fail outright. Audited the other
two $(cat <<EOF...EOF) blocks (direct-PR, local-only) for the same class
of bug; none found. Added tests/fm-brief.test.sh as a regression guard.
* no-mistakes(test): fix(spawn): guard empty shared_args under bash 3.2 set -u
* no-mistakes(document): docs(contributing): list tests/fm-brief.test.sh in the test suite inventory
* fix(test): silence shellcheck SC2034/SC2100 in fm-brief.test.sh
Drop the unused out= capture (redirect to /dev/null instead) and quote
the id= assignment so shellcheck stops reading the hyphenated id value
as an arithmetic expression.
* feat: add experimental zellij runtime backend (#217)
* feat(backends): add experimental zellij runtime backend (P3)
Implements bin/backends/zellij.sh on the P1 dispatcher + P2 herdr precedent:
one zellij session, one tab per task, treehouse stays the worktree provider.
Wired through fm-backend.sh/fm-spawn.sh so fm-send/fm-peek/fm-watch/
fm-crew-state/fm-teardown work generically with zero changes to those scripts.
Empirically verified against real zellij 0.44.0: every "gaps to verify" item
from the design report, plus real findings the report missed - new-tab always
steals focus (mitigated with a restore call), zellij action always exits 0
even against a dead target, every pane op needs an explicit --pane-id, and
pane_cwd never tracks a subshell's own cd (treehouse get's exact shape) so
worktree-path discovery uses an active pwd-probe instead of passive JSON
polling. Findings and the full real-CLI evidence log are in
docs/zellij-backend.md.
Full real E2E cycle passed: spawn a real claude crewmate, accept its trust
dialog, steer it, receive done, confirm teardown refuses before merge, merge
local-only, confirm teardown then succeeds and the zellij tab is gone - all
in a scratch FM_HOME against a uniquely-named isolated zellij session, never
touching the real "firstmate" session or the live fleet.
Existing tmux and herdr conformance suites stay green; the two P1-era tests
asserting zellij was unimplemented now assert that of orca instead.
* no-mistakes(review): captain, guard zellij paste payloads
* no-mistakes(review): Captain, guard zellij pane readiness
* no-mistakes(review): Captain, harden zellij dead-target handling
* no-mistakes(review): Captain, harden zellij teardown and tests
* no-mistakes(review): Captain, harden zellij target validation
* no-mistakes(document): Document zellij backend
* docs: document Orca backend adapter contract (#209)
* docs: specify Orca backend adapter contract
* docs: require Orca window target alias
* no-mistakes(test): Captain: handle empty arrays under nounset
* no-mistakes(document): Document Orca backend proposal
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* feat(backends): add Orca primitive backend support (#210)
* feat(backends): add Orca adapter primitives
* no-mistakes(review): Gate Orca from task spawning
* no-mistakes(document): Document Orca backend limits
* fix(backends): stop mapping Orca Escape to interrupt
* no-mistakes(document): Document Orca primitive key support
* no-mistakes: apply CI fixes
* fix: drop CI-gate rewrite and normalize shared array-guard hunks
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix(backends): submit herdr slash commands reliably (#223)
* fix(backends): herdr slash-command submit verification false-positives on popup autocomplete
Two grok/herdr crewmates left /no-mistakes fully typed but unsubmitted for
minutes while fm-send exited 0. Live-reproduced against real grok 0.2.82:
the herdr adapter's submit verification declared success on ANY pane content
change after Enter, but an argument-taking slash command's first Enter only
closes the popup and expands the composer into an argument-hint placeholder
(/compact -> /compact compaction instructions) rather than submitting - a
real, visible change that isn't a submission. A second Enter is required.
fm_backend_herdr_composer_state replaces the delta check with a structural
read of the composer's own row (located by border-glyph shape, since herdr
exposes no cursor-row primitive), mirroring what cursor_y gives the tmux
adapter. A popup-close-with-placeholder-fill still reads pending, so the
retry loop now correctly sends the needed second Enter instead of stopping
early. The tmux backend was unaffected (its cursor-row read already handled
this correctly, verified side by side against the same live repro).
* no-mistakes(document): Sync herdr submit docs
* feat(skills): publish public stow skill with internal-skill hiding (#221)
* feat(skills): hide agent-only skills from installer discovery, add public stow
Mark every .agents/skills/* skill metadata.internal: true so the
skills.sh installer (npx skills add) hides them from discovery - all
assume a live firstmate home and are meaningless elsewhere. This is
inert to firstmate's own harness skill loader.
Add a new, fully standalone skills/stow for non-firstmate users: sweep
a conversation for durable knowledge and file it into whatever notes
convention the host project/user already has, asking once and
remembering the answer when ambiguous. No shared code with the
internal stow by design.
Document the two-tier layout in README and CONTRIBUTING.
* no-mistakes(review): Tighten public stow tracker routing
* no-mistakes(document): Sync skill docs
* fix(skills): make public stow's undone-next-steps routing local-first
Supersede the earlier ask-before-tracker-write tightening: the
standalone stow no longer treats an issue tracker as a routing option
at all based on inference (git remote, .github/ presence, etc).
Undone next steps always land in a local file by default - an
existing TODO/BACKLOG/NOTES file, or a freshly created local scratch
file otherwise. A tracker (or any other external system) is only ever
used when the user has explicitly said so, this session or as a
previously recorded standing preference.
* no-mistakes(document): Sync skill documentation
* feat(skills): clarify public stow resume and fallback routing (#225)
* feat(skills): resume pointer, routing tiers, default notes file for public stow
Adds a copy-pasteable resume pointer to the safe-to-end verdict so a
new session can pick the work back up cold, states the explicit three-tier
routing priority (explicit instruction > existing local convention > default
NOTES.md fallback) instead of leaving it implicit, and names NOTES.md as the
top-level discoverable default instead of letting each agent improvise a
location. Also removes a leftover internal-tooling word from the maintainer
comment so the public file carries zero internal vocabulary.
* fix(skills): make the public stow default fallback private and gitignored
Supersedes the earlier NOTES.md/ask-once split: the tier-3 default fallback
(no existing local convention fits) is now .stow-notes.md, gitignored so it
never lands unprompted in a shared/committed file. Because it's private, it's
safe for every finding-kind including user preferences, so the separate
ask-once carve-out for personal material is no longer needed there. Tier 2
(an already-established tracked convention) is unchanged and is the only
tier that still writes into a shared file. Step 7's resume pointer now flags
when notes landed in the private fallback and that they can be promoted into
a shared file later.
* fix(skills): split the public stow private fallback by scope, use git exclude
Supersedes the single .stow-notes.md fallback: user preferences (cross-project
by nature) now default to a host-local ~/.stow/notes.md instead of being
siloed into one project's repo. Project-scoped findings still default to
.stow-notes.md at the project root, but it's now kept out of git via the
local-only .git/info/exclude instead of the tracked .gitignore, so the
fallback is truly zero-shared-footprint: nothing lands in a tracked file and
nothing is left for the user to review or commit.
* fix(skills): keep the public stow private fallback sandbox-safe (current dir only)
Supersedes the home-file split: a home-directory path fails for agents
sandboxed to their current working directory, so the tier-3 default now
stays a single .stow-notes.md at the project root for every finding-kind,
including user preferences. Tier 2's user-level memory file is now framed
as a bonus when accessible, never assumed or required. Step 7 gains a
caveat when a preference lands in the project-local fallback: it applies to
this project only, and the user can copy it into their own global memory
file if they want it to follow them everywhere.
* fix(skills): use a current-directory .gitignore for the public stow fallback
Supersedes .git/info/exclude: that mechanism resolves outside the working
directory in a linked worktree, breaking the sandbox-safety guarantee for
exactly the setup this fleet uses everywhere. Switch to an ordinary
.gitignore file in the current directory instead - always in-directory
regardless of worktree layout - creating or appending a .stow-notes.md
line, left uncommitted for the user. If that write itself fails, the skill
still creates .stow-notes.md and tells the user to ignore it manually
rather than blocking. Also scopes the "never writes outside the current
directory" guarantee precisely to tier 3: tier 2 is exempted since it only
targets a destination the user's own existing convention already
established, which can legitimately be a user-level file outside the
project.
* no-mistakes(review): Clarify stow routing precedence
* no-mistakes(review): Clarify stow fallback metadata boundary
* no-mistakes(review): Guard tracked stow fallback
* no-mistakes(review): Clarify stow fallback verdict
* no-mistakes(document): Sync stow skill docs
* no-mistakes(lint): Public skill lint cleanup
* docs: clarify note hygiene guidance (#226)
* docs: add note-hygiene rule to backlog format section
Backlog and task notes accumulate volatile specifics that drift and
mislead; capture the general principle so every firstmate user avoids
trusting a stale note over the authoritative source.
* no-mistakes(review): Clarify note hygiene schema exemptions
* no-mistakes(document): Clarify note-hygiene docs
* revert: drop out-of-scope stow/architecture doc edits
Keep this PR's diff scoped to the AGENTS.md note-hygiene addition only;
skills/stow/SKILL.md, .agents/skills/stow/SKILL.md, and docs/architecture.md
are under separate close review and must not change out of band here.
This reverts commit ed2d73205b01e24ba8ffd40c523a24993f6eb1a5.
* feat(backends): add Orca task lifecycle support (#228)
* feat(backends): add Orca task lifecycle support
* fix(backends): harden Orca spawn lifecycle
* no-mistakes(review): Fix Orca lifecycle cleanup gaps
* no-mistakes(review): Release Orca worktrees without paths
* no-mistakes(review): Guard Orca spawn abort cleanup
* no-mistakes(review): Allow partial Orca child cleanup
* no-mistakes(review): Fix Orca selector and cleanup leaks
* no-mistakes(review): Preserve pathless Orca cleanup metadata
* no-mistakes(review): Harden Orca spawn and teardown lifecycle
* no-mistakes(review): Enforce Orca scout report gate
* no-mistakes(review): Harden Orca teardown path validation
* no-mistakes(review): Harden Orca capture errors
* no-mistakes(review): Harden Orca JSON cleanup validation
* no-mistakes(test): Fix zellij scout teardown fixture
* no-mistakes(document): Document Orca lifecycle support
* Harden Orca runtime and submit verification
* no-mistakes(review): Captain, preserve Orca current-tail verification
* no-mistakes(document): Sync Orca lifecycle docs
* no-mistakes(lint): Captain, silence deliberate ShellCheck
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix: use PR head for review diffs (#229)
* Fix fm-review-diff to compare PR head when pr= is recorded
After no-mistakes fix rounds push to the open PR, the crewmate worktree
branch can lag the authoritative PR head. When meta records pr=, resolve
the compare ref from reachable pr_head= or refs/pull/<n>/head before
diffing against the fetched authoritative base; fall back to the local
branch with a loud warning when the PR head cannot be resolved.
Add behavior tests for pr_head resolution, fetch, unchanged no-pr path,
and unreachable-PR fallback.
* no-mistakes(review): Make review-diff test executable
* no-mistakes(document): Document PR-head review diffs
* no-mistakes: apply CI fixes
* fix: make backend matching shell-portable (#230)
* Make fm-backend.sh backend-name matching shell-portable for zsh
Replace word-split-dependent for-loops in fm_backend_is_known() and
fm_backend_validate_spawn() with case-based membership tests so sourcing
the library from zsh no longer falsely rejects known backends.
Add zsh/bash regression coverage in tests/fm-backend.test.sh.
* no-mistakes(review): Fix zsh backend loading and validation
* no-mistakes(document): Document backend membership portability
* fix(backends): make herdr respawn idempotent (#231)
* fix(backends): make herdr respawn idempotent against restored-layout husks
herdr persists and restores its session layout (workspaces/tabs/panes)
across a server restart, so a restored fm-<id> task tab comes back a
husk - a dead pane, or a plain agent-less shell - which fm-spawn.sh's
duplicate-tab guard refused unconditionally, forcing manual pane closes
after every restart.
fm_backend_herdr_create_task now classifies an existing same-labeled
tab's pane conservatively (dead/no-agent/live/unknown) and
closes-and-replaces only a confirmed husk, always creating the
replacement tab before closing the old one so a husk that is a
workspace's only tab is never at risk of taking the whole workspace
down with it. A genuinely live agent, or anything not confidently
classifiable, still refuses exactly as before.
* no-mistakes(review): Harden herdr duplicate respawn guard
* no-mistakes(review): Enforce herdr husk cleanup postcondition
* no-mistakes(document): sync herdr respawn docs
* no-mistakes: apply CI fixes
* fix: absorb stale wakes during active validation (#233)
* fix(watcher): stop stale_is_terminal from ignoring an active run-step
A crewmate's status log gets no new entry once firstmate hands it to a
no-mistakes validation (the sparse status-reporting contract), so the
log's last line can stay a pre-validation "done:" (or needs-decision/
blocked) leftover for the run's entire duration. fm-watch.sh's
stale_is_terminal only reads that raw last line - it has no run-step
awareness - so it kept surfacing a stale pane as immediately terminal
every time it went quiet for two polls, no matter how actively the
pipeline was validating (confirmed live against fm-herdr-respawn-idem,
whose status log's last line is literally "done: ..." while its
no-mistakes run-step reads "validating (running)"). crew_is_provably_working
now gets a chance to override a stale captain-relevant log line on a
new stale hash, exactly as it already did for a non-captain-relevant one.
Also fixed a separate, independently-confirmed dead code path in
fm-crew-state.sh: its cross-branch run-attribution fallback shelled out
to `no-mistakes axi` (bare) expecting a runs[N]{...} TOON table that the
real CLI (v1.32.2) never emits - verified the axi surface exposes only
abort/logs/respond/run/status. Replaced it with the real top-level
`no-mistakes runs` listing.
* no-mistakes(document): Sync watcher stale docs
* no-mistakes(lint): Fix stale fake run-list variables
* docs: clarify no-mistakes evidence commit handling (#232)
* docs: no-mistakes evidence commits in crew branches are intentional
* no-mistakes(review): Scope evidence guidance to project repos
* no-mistakes(document): Document evidence commit policy
* fix: tighten Orca backend parsing (#237)
* fix: tighten orca parser coverage
* no-mistakes(document): Sync Orca backend docs
* no-mistakes(lint): Captain, lint clean
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* docs: add backend setup guides and slim README (#238)
* docs: make README pointer-first, add per-backend setup guides
Trim the Quick Start and How It Works walls of prose down to overview plus
pointers, relocating every removed sentence's content into docs/architecture.md,
docs/configuration.md, or the relevant backend doc. Add docs/tmux-backend.md as
the reference-backend setup guide, and add a Setup section to each experimental
backend doc (herdr, zellij, Orca) covering prerequisites, selection, first run,
watching/attaching, verification, and limitations. Record the README convention
in CONTRIBUTING.md.
* no-mistakes(review): Clarify backend setup docs
* no-mistakes(review): Clarify tmux secondmate support
* no-mistakes(document): Align backend documentation
* docs: stop telling users to run fm-spawn.sh for backend selection
fm-spawn.sh is firstmate-internal; a user never runs it directly. Rephrase
every user-facing backend-selection sentence across the tmux/herdr/zellij/orca
guides and docs/configuration.md to present the actual user mechanisms: a
local config/backend file, FM_BACKEND at launch, or telling the first mate in
chat. Internal-reference mentions of the --backend flag (fm-spawn.sh usage
notes, test coverage lists) are left as mechanics, not user instructions.
* Document herdr dual license in docs and install hint (#239)
Add AGPL-3.0-or-later/commercial licensing note to herdr-backend Setup
and the missing-binary error in bin/backends/herdr.sh.
* feat: support multiple X-mode follow-ups (#241)
* feat(x-mode): raise X follow-up cap to 3 within a 7-day window
Matches the relay's parallel contract change: fm-x-link.sh now records a
follow-up counter (with --carry-count to preserve it across a re-link onto
a successor task), fm-x-followup.sh posts up to three follow-ups per
mention within a 7-day window instead of one within 24h, clearing the
link on --final, cap exhaustion, window lapse, or a distinguishable relay
rejection (fm-x-reply.sh HTTP 409 -> exit 9) rather than treating that
rejection as a retryable failure. AGENTS.md and the fmx-respond skill are
updated to keep usage disciplined: spend follow-ups only on genuine
milestones, always finish with --final.
* no-mistakes(review): Update follow-up dry-run docs
* no-mistakes(review): Captain: refresh X follow-up docs
* no-mistakes(review): Captain: harden X follow-up relinks
* no-mistakes(review): Captain: harden follow-up state persistence
* no-mistakes(document): Document X follow-up carryover
* feat(backends): add experimental cmux runtime backend (#246)
* feat(backends): add cmux runtime backend (experimental)
Session-provider-only adapter for cmux (bin/backends/cmux.sh), mirroring
zellij/herdr structurally, wired into fm-backend.sh and fm-spawn.sh with
--secondmate refused for now. Verified against the real cmux 0.64.17 app:
send does not auto-submit, cwd is creation-time-frozen (zellij-shape,
pwd-marker-probe workaround), close-surface refuses on a workspace's last
surface (falls back to close-workspace), workspace ids do not survive a
relaunch, and the control socket defaults to cmuxOnly access (requires a
one-time password-mode setup, documented in docs/cmux-backend.md). Also
found and fixed a live bug during development: read-screen fails on a
surface that has never been written to, so liveness now uses list-panes
instead. Fake-CLI unit suite (40 tests), a real-binary smoke test, and a
full spawn/steer/peek/done/merge/teardown E2E pass against a real claude
crewmate all pass, including the popup/second-Enter regression class.
* no-mistakes(review): Harden cmux recovery and password parsing
* no-mistakes(review): Harden cmux capture failure handling
* no-mistakes(review): Mark cmux test scripts executable
* no-mistakes(review): Scope cmux workspaces and teardown
* no-mistakes(review): Captain, honor cmux password config override
* no-mistakes(review): Captain, hash cmux home labels
* no-mistakes(document): Sync cmux backend docs
* feat(agents): add firstmate coding guidelines skill (#248)
* Add firstmate-coding-guidelines skill (AGENTS.md diet PR 0)
Encodes the knowledge-placement decision tree, one-owner rule, and
inline-stub pattern from the diet analysis so future contributions stop
adding conditional detail inline. AGENTS.md gets one section-13 trigger
line; fm-brief.sh's REPO argument has no reliable signal for "this is
firstmate's own repo", so the load instruction goes in CONTRIBUTING.md's
Development section instead of the scaffold.
* no-mistakes(review): Captain, align tracked-material trigger scope
* no-mistakes(document): Sync coding guidelines docs
* no-mistakes(lint): Fix Markdown style issues
* fix: add turn-end supervision guard (#249)
* feat: structural Stop-hook backstop for primary turn-end supervision
fm-guard.sh is pull-based: it only warns when some other supervision
script happens to run, so a primary session that ends a turn without
re-arming the watcher and then runs no further fleet-touching command
can sit blind for hours (the 2026-07-04 incident this fixes).
Add bin/fm-turnend-guard.sh, a Claude Code Stop hook registered in the
tracked .claude/settings.json, that fires on every primary turn end and
blocks (exit 2, verified empirically to force continuation) when work
is in flight with no fresh watcher beacon. It never blocks more than
once per turn, using Claude Code's own stop_hook_active loop-guard
field, and scopes itself to the actual primary checkout only (inert in
crewmate/scout worktrees and secondmate homes).
Factor the shared "in-flight but no live watcher" predicate out of
fm-guard.sh into bin/fm-supervision-lib.sh so the pull-based banner and
the push-based hook can never drift on what "unhealthy" means.
Document the verified Stop-hook mechanism and scoping in
docs/turnend-guard.md, add a harness-adapters note, and cover the
predicate and hook with tests/fm-turnend-guard.test.sh.
* no-mistakes(review): Respect active home in turnend guard
* no-mistakes(review): Require live watcher for turn-end guard
* no-mistakes(review): Captain: portable turn-end timing
* no-mistakes(document): Sync turn-end guard documentation
* feat(backends): auto-detect cmux runtime (#250)
* feat(backends): auto-detect cmux runtime from CMUX_WORKSPACE_ID
Wires cmux into fm_backend_detect the same way herdr already is: a
firstmate process running inside a cmux-spawned terminal now spawns
new tasks into cmux by default, no config needed. Verified from cmux's
own shipped source that CMUX_WORKSPACE_ID/CMUX_SURFACE_ID/CMUX_SOCKET_PATH
are unconditionally, non-overridably injected into every terminal
surface it spawns, and that cmux's own CLI treats CMUX_WORKSPACE_ID as
its own ambient-target fallback - the same role $TMUX/HERDR_ENV play for
their backends. CMUX_WORKSPACE_ID is checked last (after $TMUX and
HERDR_ENV=1) since cmux is a terminal application, not a nestable
multiplexer. Socket auth (config/cmux-socket-password) stays required
regardless of how the backend was selected; the existing spawn refusal
now also names the config/backend=tmux / --backend tmux opt-out for a
caller who never explicitly chose cmux.
A live env dump inside a real cmux terminal was not obtained safely on
the shared dev machine (documented in docs/cmux-backend.md); this rests
on the source read instead, mirroring this doc's existing
verified-from-source precedent.
* no-mistakes(review): Fix cmux autodetect docs and tests
* no-mistakes(document): Document cmux auto-detection
* fix(afk): support herdr away-mode injection (#251)
* fix(afk): make the away-mode daemon backend-aware for herdr
bin/fm-supervise-daemon.sh discovered its supervisor pane and injected
via raw tmux calls only, so /afk failed outright on a herdr-based
fleet (TMUX_PANE unset, firstmate:0 fallback unresolvable).
Discovery now resolves backend (tmux|herdr) and target independently,
mirroring fm-backend.sh's own runtime auto-detection, with an explicit
FM_SUPERVISOR_BACKEND override alongside the existing FM_SUPERVISOR_TARGET.
zellij/orca refuse loudly at startup instead of misapplying tmux
primitives. Injection (pane-exists probe, busy-guard, composer-guard,
verified submit) now dispatches through bin/fm-backend.sh's generic
primitives, adding a new fm_backend_composer_state dispatcher; the
tmux path is byte-identical to before. Also fixes a pre-existing bug
in fm_backend_target_exists's herdr arm (missing --session, so it
silently misrouted once more than one herdr server was running) found
while verifying this end to end against a real isolated herdr session.
Classification, batching, max-defer, the marker contract, locks, and
wake-queue handling are unchanged - this is a transport-layer fix.
* no-mistakes(review): Corroborate Herdr idle busy state
* no-mistakes(review): Stabilize Herdr daemon startup wait
* no-mistakes(review): Captain, route cmux composer and update AFK docs
* no-mistakes(document): Document AFK supervisor backend support
* docs(agents): move X-mode procedures out of AGENTS (#253)
* docs(agents): collapse X-mode section 14 into fmx-respond/docs pointers
AGENTS.md diet PR 1 of 3 (agentsmd-diet-s2 report, move-plan items 1-2).
Replaces section 14's "Answering"/"Completion follow-up"/"Conversations"/
"Length and threads"/"Preview / dry-run" blocks (54 lines) and the
"Mechanism" narrative (6 lines) with two short pointers: fmx-respond
(section 13) for the procedure, docs/configuration.md "X mode (.env)"
for the wire protocol. Net -55 lines in AGENTS.md.
Destination edits landed first, deletions second (q4 discipline):
- docs/configuration.md: added the "purely additive, watcher untouched"
guarantee that AGENTS.md's Mechanism block stated but configuration.md
did not.
- fmx-respond/SKILL.md: added the x-mode-error wake boundary (report as
a blocker, do not load this skill), the --image flag for replies and
follow-ups, the "images are for real artifacts, not prose" rule, and
the dry-run compact-image-marker behavior - none of these were
previously in the skill even though AGENTS.md described them, so they
were genuine gaps, not pre-existing duplication. Also made the skill's
own "Completion follow-up" section the sole, full owner of that
procedure instead of deferring to AGENTS.md section 14 for substance
that no longer lives there (two internal cross-references updated to
point at section 8's terminal-wake trigger and the skill's own section
instead).
Mechanical line-by-line audit of every removed AGENTS.md line:
Mechanism block (6 lines removed):
- bootstrap artifact-writing description -> already owned by
docs/configuration.md "X mode (.env)" (locked-bootstrap paragraph)
- check-shim/poll mechanism description -> already owned by
docs/configuration.md same section
- missing-deps/x-mode-error diagnostic description -> already owned by
docs/configuration.md ("Relay auth or config problems...") plus
bin/fm-x-poll.sh's own header comment for the missing-curl/jq mechanics
- opt-out artifact removal description -> already owned by
docs/configuration.md same section
- "purely additive, no edit to fm-watch.sh/fm-watch-arm.sh/fm-wake-lib.sh/
afk daemon" guarantee -> MOVED to docs/configuration.md (added in this
PR; this fact had no other home before)
Answering/Completion follow-up/Conversations/Length and threads/
Preview-dry-run blocks (54 lines removed):
- x-mention wake -> load fmx-respond: already owned by section 13's
existing trigger line (unchanged) and restated in the new pointer
- x-mode-error wake -> report as blocker, don't load fmx-respond: MOVED
to fmx-respond/SKILL.md (added in this PR)
- inbox-draining, classification, acting, reply composition, submission,
cleanup-on-success/failure: already owned by fmx-respond/SKILL.md
"Procedure" section (unchanged, pre-existing)
- owner-only routing / captain-as-asker framing: already owned by
fmx-respond/SKILL.md "The asker is your own captain" section
- standing X-mode authorization / autonomous posting / dry-run as only
non-posting path: already owned by fmx-respond/SKILL.md same section
- acknowledge-first -> act -> follow-up shape, three-case classification:
already owned by fmx-respond/SKILL.md "A request to act on" section
- destructive/irreversible/security-sensitive escalation guardrail:
already owned by fmx-respond/SKILL.md "Public channel..." section and
Procedure step 2c
- dismiss-instead-of-reply for pure acknowledgments, relay re-offer
prevention, dry-run honoring: already owned by fmx-respond/SKILL.md
Procedure steps 2b/2c/2e-skip and docs/configuration.md
- public-safety bar (no task ids/internals/captain-private/secrets):
already owned by fmx-respond/SKILL.md "The reply is public" section
- never-inline-into-shell-command / --text-file or stdin: already owned
by fmx-respond/SKILL.md Procedure step 2e and Notes
- --image flag for replies (formats, base64, no-inline guarantee): MOVED
to fmx-respond/SKILL.md Procedure step 2e (added in this PR - this was
not previously in the skill)
- fm-x-link field names (x_request=, x_request_ts=, x_followups=):
already owned by AGENTS.md section 2's state/<id>.meta field list
(untouched, out of scope for this PR) and fmx-respond/SKILL.md
- carry-count/carry-ts relink behavior, three-follow-up budget, milestone
sparingness, --check/--text-file posting, connector/followup wire
detail, --final clearing, cap/window graceful degradation: already
owned by fmx-respond/SKILL.md "Completion follow-up" section (now sole
owner) and docs/configuration.md wire-protocol paragraphs
- --image flag for follow-ups: MOVED to fmx-respond/SKILL.md "Completion
follow-up" section (added in this PR - genuine gap)
- "failed task still gets an honest final follow-up": already owned by
fmx-respond/SKILL.md "Completion follow-up" section
- FMX_DRY_RUN whole-loop previewability: already owned by
fmx-respond/SKILL.md "Dry-run / preview mode" section
- in_reply_to conversation continuity, untrusted-thread handling,
follow-up worthiness judgment, relay-owned self-reply guard/cap:
already owned by fmx-respond/SKILL.md "The direct ask is the captain's"
section and Notes (one bullet is a verbatim match)
- concise-by-default / no hand-numbered threads: already owned by
fmx-respond/SKILL.md "Voice" section
- auto-split behavior, char/tweet caps, premium-independence, wire shape
({text}/{text,texts}): behavior already owned by fmx-respond/SKILL.md
Voice section; exact defaults and wire shape already owned by
docs/configuration.md; "premium-independent" mechanics already owned
by bin/fm-x-reply.sh's own header comment
- "images are for real artifacts, not prose": MOVED to fmx-respond/
SKILL.md "Voice" section (added in this PR - genuine gap)
- image-on-thread wire behavior: already owned by docs/configuration.md;
reinforced in fmx-respond/SKILL.md's new --image note
- dry-run POST-body shape, endpoint marker, truthy-value definition,
jq-only dependency, end-to-end testability, x-outbox inspection:
already owned by fmx-respond/SKILL.md "Dry-run / preview mode" section
(several near-verbatim matches) and docs/configuration.md wire detail
- dry-run compact image marker: MOVED to fmx-respond/SKILL.md "Dry-run /
preview mode" section (added in this PR - genuine gap)
Section 8's terminal-wake completion-follow-up trigger (the one fact
required to survive inline) is untouched and already present; the new
section 14 pointer references it instead of restating it.
Nothing outside section 14 (plus the two destination files) is touched.
Full test suite green, including all 74 fm-x-mode.test.sh checks.
* no-mistakes(review): Preserve X-linked follow-up triggers
* no-mistakes(review): Fix x-mode error trigger
* no-mistakes(document): Docs cross-reference synchronized
* no-mistakes(lint): Clean Markdown lint pass
* docs: trim duplicated harness guidance (#255)
* docs(agents): trim section 4 harness/secondmate duplication
AGENTS.md diet PR 2 of 3 (data/agentsmd-diet-s2/report.md, move-plan
items 3-4; redundancy item 2 folded into item 3).
Removed the five claude/codex/grok/pi/opencode model/effort-flag
bullets from section 4 - byte-for-byte duplicated by
harness-adapters' "Launch profile axes" table (which is already a
superset: it carries verified CLI versions per adapter that the
AGENTS.md bullets lacked). Replaced with a one-line pointer; the
skill is already loaded before every spawn per section 4's own
closing trigger, so no new trigger was needed.
Moved the config/secondmate-harness model/effort pin-format detail
(the `<harness> [<model>] [<effort>]` line format, the
secondmate-model/secondmate-effort accessors, back-compat, and the
durability-across-respawn behavior) into secondmate-provisioning,
which is already a mandatory load at every secondmate lifecycle
touchpoint. Added the destination content to the skill first, then
replaced the AGENTS.md paragraph with a 3-line pointer.
Mechanical audit - every removed line's new home:
- 5 harness bullets (claude/codex/grok/pi/opencode model+effort
flags, per-harness max-omission rationale) -> already present in
harness-adapters SKILL.md's "Launch profile axes" table (lines
53-59), confirmed fact-by-fact before deleting.
- "config/secondmate-harness may also pin..." paragraph (pin format,
bare-harness back-compat, secondmate-model/secondmate-effort
accessors, per-spawn override precedence, respawn durability,
secondmate-only scope) -> secondmate-provisioning SKILL.md's
"Charter and seed" section, added verbatim before this trim.
- The following paragraph (inheritable config: crew-dispatch.json,
crew-harness, backlog-backend) is untouched - out of scope for
this PR, still inline.
- The bootstrap CREW_DISPATCH effort-mismatch diagnostic sentence is
untouched - not part of the five-bullet duplication, stays inline.
No script changes. Section 4 shrinks from 104 to 87 lines
(958 -> 901 total AGENTS.md lines) with zero facts lost: every fact
is reachable through harness-adapters or secondmate-provisioning,
both already mandatory loads at the relevant lifecycle points.
* no-mistakes(document): Align secondmate skill triggers
* no-mistakes(lint): Markdown style clean
* fix: anchor turn-end Stop hook to project root (#256)
* Fix turn-end Stop hook to use CLAUDE_PROJECT_DIR path
Claude Code runs hook commands via /bin/sh from the session cwd, so the
bare relative bin/fm-turnend-guard.sh path fails when cwd is not the repo
root. Anchor the command with "$CLAUDE_PROJECT_DIR"/bin/fm-turnend-guard.sh
instead; verified CLAUDE_PROJECT_DIR is set on Stop hooks in Claude Code
2.1.201. Document the cwd caveat and add a settings.json regression test.
* no-mistakes(document): Document Stop hook path anchoring
* docs: trim firstmate agent guidance duplication (#258)
* docs: trim AGENTS.md redundancy (diet PR 3/3)
Consolidates five duplicated passages to a single owner each, per
data/agentsmd-diet-s2/report.md redundancy items c3-c7:
- Inheritable-config propagation mechanism: owned by section 3 (where
the sweep runs); sections 4 and 7 keep compact references. Section 4
retains its one genuinely unique fact (crew-harness inherit-vs-fallback
semantics), just no longer restates the propagation mechanism itself.
- Landed-work definition: owned by section 7's ship-teardown detail
(PR-containment mechanics, pr= discovery fallback); section 1's hard
rule #3 keeps the rule plus a three-case summary and a pointer.
- Backend meta-field enumeration: owned by docs/configuration.md
("Runtime backend", already comprehensive including cmux) and each
backend's own doc; AGENTS.md keeps only the fields common to every
task plus a pointer.
- Dropped one redundant restatement of "silence is correct while
waiting" in section 8.
- Worktree-tangle guard explanation: owned by section 8 (already the
fuller, cross-referenced version); section 3's TANGLE bullet keeps
the remediation action and points at section 8 for the why.
Also adds two captain-requested single-sentence rules: invoke bin/
scripts by absolute $FM_ROOT path after any cd away from the home, and
a backend spawn refusal must be surfaced to the captain rather than
silently worked around by switching backends.
AGENTS.md: 901 -> 889 lines, 112355 -> 108560 bytes.
* no-mistakes(review): Clarify post-cd bin invocation guidance
* no-mistakes(document): Sync AGENTS trim docs
* no-mistakes(lint): Fix Markdown line style
* feat(backends): improve cmux detection and socket-mode guidance (#259)
* feat(backends): cmux detection fallbacks and socket-mode matrix
Workstream A: cmux's bundled claude wrapper strips every CMUX_* env var on
its passthrough path (reproduced live 2026-07-04, cmux 0.64.17), so a
claude-harness firstmate inside a cmux tab has no CMUX_WORKSPACE_ID.
fm_backend_detect now falls back - macOS-only, only when the primary marker
is absent - to __CFBundleIdentifier=com.cmuxterm.app and then a process
ancestry walk resolved by bundle id (lsappinfo) plus a bundle-shaped ps comm
match. Innermost-first ordering is unchanged and absorbs the
tmux-inside-cmux bundle-id false positive; the auto-detect NOTICE names the
winning fallback signal.
Workstream B…
This was referenced Jul 14, 2026
delaanthonio
added a commit
to delaanthonio/firstmate
that referenced
this pull request
Aug 23, 2026
* fix(send): settle codex skill popups before submit (#103)
* fix(send): settle codex $skill popup before submit
A `$<skill>` invocation (e.g. $no-mistakes) opens codex's $-autocomplete
popup; submitting too fast lets it swallow the Enter so the invocation
never lands - biting every pipeline trigger to a codex crew/secondmate.
Mirror the existing `/` slash-popup handling: give a `$...` message the
1.2s popup-settle before the (retried) Enter, but scope it to
harness=codex (read from the target's meta) so `$`-prefixed plain text
("$5/month", "$HOME") to claude/opencode/pi keeps the 0.3s fast path. An
explicit session:window target has no meta -> harness unknown -> treated
as non-codex. The retried Enter in fm_tmux_submit_core still backs the
settle up; the `/` case, --key path, marker, and meta-resolution
contract are unchanged.
Record the codex $-popup fact in the harness-adapters skill, and add a
per-harness settle-selection test (codex $ ->1.2, claude $ ->0.3,
explicit $ ->0.3, any / ->1.2, plain ->0.3).
* no-mistakes(document): Sync fm-send popup docs
* feat(supervise): add deterministic crew state helper (#104)
* feat(supervise): deterministic crew current-state helper
Add bin/fm-crew-state.sh, a deterministic one-line read of a crew's
CURRENT state that ends the stale-status-line friction in supervision.
The status log is an append-only wake-event log, so tail -1 reports the
last event, not the current state: after firstmate resolves a
needs-decision/blocked and the crew silently resumes, the log stays
stale. The helper takes the active no-mistakes run-step as the source of
truth (attributed to the crew's branch, via axi status then the run
list), reconciles a possibly-stale needs-decision/blocked log line
against it (flagging it superseded when the run has resumed), and falls
back to the pane busy-signature + status log when no run is active.
Handles scout/secondmate kinds and torn-down/missing crews gracefully.
Reuses fm-tmux-lib.sh busy detection and meta parsing; fully
deterministic (run-step/pane/log reads only, no heuristics, no LLM).
Wire AGENTS.md sections 7 and 8 to read current state via the helper and
to stop inferring state from a tail of the status log; the status file
stays the wake-event log. Watcher core, status-file/brief contracts, and
wake/dedup machinery are unchanged.
Add tests/fm-crew-state.test.sh covering run-step authority, superseded
stale log lines, genuine-parked, cross-branch attribution, pane and
status-log fallback, scout skip, and torn-down/missing-meta cases.
* no-mistakes(review): Fix dead-window crew state fallback
* no-mistakes(review): Harden crew state liveness checks
* no-mistakes(review): Harden crew state gate handling
* no-mistakes(review): Harden crew state gate parsing
* no-mistakes(document): Document crew state helper
* no-mistakes: apply CI fixes
* fix(crew-state): keep run-step authoritative over a closed pane
The dead-window guard ran before the no-mistakes run lookup, so a
finished crew whose agent had exited and closed its window reported
'unknown' instead of its authoritative run-step state (e.g. done) - the
normal gap between a crew completing and teardown, and a regression
against the helper's core principle of judging by the run-step, not the
shell. Move the pane-readability guard into the no-run fallback path so
it runs only after the run-step lookup: a crew with a run reports its
run-step state regardless of pane liveness, while a genuinely runless
dead window still reports unknown rather than trusting a stale log.
Replace the test that encoded the regression with two that pin the
correct behavior: a closed pane with a terminal run reports done, and a
closed pane with an active run reports working.
* no-mistakes(document): Sync crew-state docs
* feat(bin): absorb benign watcher wakes (#107)
* feat(watch): always-on wake triage absorbs benign wakes in bash
Factor the afk daemon's classify_signal/classify_stale/heartbeat-scan into a
shared bin/fm-classify-lib.sh used by both the always-on watcher and the daemon.
fm-watch.sh now loops internally: it classifies each wake and absorbs the benign
majority (working: signals, bare turn-ended, non-terminal stale, no-change
heartbeat) by advancing the suppression marker and logging, without queuing or
exiting; it writes the durable queue and exits only on an actionable wake
(captain-relevant signal, any check, terminal stale, a non-terminal stale that
persists past FM_STALE_ESCALATE_SECS, or the heartbeat fleet-scan backstop). So
firstmate re-arms once per actionable event instead of once per wake.
Safety preserved: singleton lock + beacon (touched every poll including while
absorbing), durable queue for actionable wakes, kind=secondmate stale-skip,
per-task check polling, heartbeat backoff, bounded wedge latency. While state/.afk
exists the daemon owns triage and the watcher reverts to one-shot, so the two
never double-triage. AGENTS.md section 8 + afk skill updated; tests added.
* no-mistakes(review): Captain, repair watcher triage edge cases
* no-mistakes(document): Sync watcher triage docs
* no-mistakes: apply CI fixes
* feat: firstmate listens and replies on X (inert-by-default client) (#87)
The firstmate side of "listen on X and reply", shipped inside the repo so every
user has it but INERT until they opt in (a non-empty FMX_PAIRING_TOKEN in .env).
Purely additive: the watcher backbone (fm-watch.sh, fm-watch-arm.sh,
fm-wake-lib.sh) and the afk daemon (fm-supervise-daemon.sh, afk skill) are
untouched.
- bin/fm-x-poll.sh: one short-poll of GET /connector/poll; hard no-op without a
token; requires non-empty text; stashes the full mention (incl. in_reply_to
conversation context) to state/x-inbox/<id>.json behind a path-traversal guard;
prints "x-mention <id>" (or a rate-limited "x-mode-error ...") for the watcher.
- bin/fm-x-reply.sh: POST /connector/answer; bearer token via a 0600 header file
(never argv); reply via --text-file/stdin so mention text is never inlined into
a shell command. Long replies auto-split into a premium-independent numbered
"(k/n)" thread (codepoint-aware, capped); single tweet stays unnumbered. Wire:
{request_id, text}, plus {texts:[...]} for a thread. FMX_DRY_RUN previews to
state/x-outbox and posts nothing.
- bin/fm-x-lib.sh: .env/env config (token, relay default, dry-run, max chars,
thread cap; env wins over .env) and the thread splitter.
- bin/fm-bootstrap.sh: .env-presence activation - drop the check shim + 30s
cadence config on opt-in, remove on opt-out, idempotent, silent off.
- .agents/skills/fmx-respond: public-safe answer playbook - drain inbox, judge
follow-up worthiness (skip pure acks), conversation continuity via in_reply_to,
concise by default, dry-run aware.
- AGENTS.md section 14 + README/CONTRIBUTING/docs; tests/fm-x-mode.test.sh
(hermetic: fake curl, real jq).
* fix: clarify X-mode owner mention handling (#109)
* fix(fmx): X-mode mentions are captain instructions - act, then reply
Owner-only relay routing means every routed mention is from the firstmate's
own owner, so fmx-respond no longer frames the asker as a stranger and may
address them as captain. Enabling X mode is the standing authorization, so
replies are composed and posted autonomously with no per-reply confirmation;
dry-run stays the only non-posting path.
A mention's request is a real captain instruction to act on, not merely to
reply to: the drain loop now classifies each mention as an actionable request
(run firstmate's normal lifecycle - intake, backlog, dispatch, scout, ship -
then report the outcome), a question (answer from fleet state), or a pure
acknowledgment (skip). The public channel keeps the yolo carve-out: anything
destructive, irreversible, or security-sensitive is flagged to the captain
through the trusted channel first, never executed straight from a mention.
Public-safety (outcomes only, no secrets/internals), the untrusted-in_reply_to
caution, and the skip-acknowledgment judgment remain intact. AGENTS.md §14
reflects the owner identity, autonomous answering, and act-on-requests carve-out.
* no-mistakes(review): Captain: clarify X-mode consent safeguards
* no-mistakes(review): Captain: document X-mode action consent
* no-mistakes(document): Captain, sync X-mode docs
* fix: recover safe fleet sync drift (#111)
* fix(fleet-sync): self-heal safe detached drift, loudly flag stuck clones
A pooled clone that drifts off its default branch was silently skipped
forever by both the post-merge teardown sync and bootstrap fleet-sync,
falling further behind on every merge with only an easy-to-miss skip line.
- Auto-recover the one safe case: a clean, detached HEAD that is an
ancestor of origin/<default> and whose <default> is free to check out
is re-attached and fast-forwarded, reported as 'recovered:'.
- Every other off-default state (dirty, non-default named branch,
detached with unique commits, diverged) is left untouched and reported
as a quantified 'STUCK: ... N commits behind ... - needs attention'
warning instead of a quiet drift. Nothing is forced, stashed, or discarded.
- Relay the new recovered:/STUCK: outcomes through bootstrap FLEET_SYNC
lines; document both in AGENTS.md section 3.
- Add tests/fm-fleet-sync.test.sh covering recover, every stuck variant,
ordinary fast-forward, already-current, local-only/no-origin skips, the
whole-fleet form, and the bootstrap relay.
* no-mistakes(review): Guard detached recovery from diverged local defaults
* no-mistakes(document): Sync fleet refresh docs
* no-mistakes: apply CI fixes
* feat(x-mode): add X mention completion follow-ups (#113)
* feat(x-mode): X-mention completion follow-up flow
Acknowledge an actionable X mention first, do the work, then post one
follow-up reply when it completes.
- fm-x-reply.sh: add --followup mode posting to the relay's
/connector/followup endpoint; reuses thread-split, payload shape,
dry-run (with a self-describing endpoint marker), and never-inline
safety. Answer path unchanged.
- fm-x-link.sh: link a spawned task to its originating mention via
x_request/x_request_ts in state/<id>.meta (atomic, preserves other
lines).
- fm-x-followup.sh: --check detection plus post-and-clear on terminal
completion; honors the 24h window (skip+prune past it), keeps the link
on a failed post for retry.
- fm-x-lib.sh: shared meta link get/set/clear helpers.
- Docs: fmx-respond reads as one ack-first -> act -> follow-up flow;
AGENTS.md §14 + supervision pointer document the link, completion
follow-up, and 24h public-safe window.
- Tests: cover --followup endpoint/payload/dry-run, link, and the
followup helper; shellcheck clean.
* no-mistakes(review): Captain, fix atomic X meta rewrites
* no-mistakes(document): Document X completion follow-ups
* feat(x-mode): dismiss skipped X mentions through the relay (#120)
* feat(x-mode): dismiss skipped mentions at the relay
The relay now exposes POST /connector/dismiss: acknowledge a pending
mention without replying - it drops the request, posts nothing, and stops
re-offering it. Wire firstmate to use it on the skip path so a deliberately
unanswered mention no longer churns every poll and times out to the relay's
"offline" auto-reply.
- bin/fm-x-dismiss.sh: new client modeled on fm-x-reply.sh. POSTs
{request_id} (no body) to /connector/dismiss with the bearer; echoes the
request_id on 2xx, exits non-zero on non-2xx/transport failure. Honors
FMX_DRY_RUN (records the would-be POST to state/x-outbox/ with an
endpoint:"dismiss" marker, posts nothing) and rejects unsafe request_ids.
- fmx-respond skill: the skip path now calls bin/fm-x-dismiss.sh before
clearing the inbox file; answer and follow-up paths unchanged.
- AGENTS.md section 14: documents that a skipped mention is dismissed at the
relay, not just locally cleared.
- tests: dismiss posts {request_id} to /connector/dismiss with the bearer
and echoes it; dry-run records and posts nothing; non-2xx and transport
failures exit non-zero; unsafe id and bad args rejected.
* chore(no-mistakes): run the bash suite directly as the test step
The test step had no configured test command, so it delegated to an agent;
that agent-driven run crashed the no-mistakes daemon mid-step on this repo.
Configure commands.test to run the firstmate behavior suite deterministically
instead, mirroring .github/workflows/ci.yml: iterate every tests/*.test.sh,
run each, and fail the step if any exits non-zero. This removes the agent from
the test step entirely (no crash) and makes the gate's test baseline match CI.
Same pattern myfirstmate uses (commands.test: mix deps.get && mix test).
* no-mistakes(review): Fix X dismiss docs and gate preflight
* no-mistakes(document): Document X dismiss and gate tests
* feat(watcher): absorb wakes only when the crew is provably working (#126)
* feat(watcher): absorb wakes only when the crew is provably working
The no-verb triage path (a bare turn-end, a working: note, a non-terminal
stale) used to be benign by default and surfaced only on a captain-relevant
status verb. A crew that finished but reported through interactive pane menus
(no done: status) had its final turn-end absorbed, so firstmate was never
woken and the finish was missed.
Invert the rule: absorb a no-verb turn-end or non-terminal stale ONLY when the
crew shows positive evidence it is still working - its no-mistakes run for its
branch is in an actively-running step, or its pane shows the harness busy
signature. Otherwise surface it so firstmate peeks (done, waiting, or wedged).
- fm-classify-lib.sh: add crew_is_provably_working (reuses fm-crew-state.sh,
no run-step duplication) and signal_crew_provably_working; FM_CREW_STATE_BIN
override for tests.
- fm-watch.sh: signal path surfaces a no-verb wake whose crew is not provably
working (costly check runs only on the no-verb, non-afk path); non-terminal
stale surfaces immediately when not provably working, else absorbs with the
wedge timer (run-step read only on first sight of a stale hash).
- afk path unchanged: the watcher stays one-shot and skips the provably-working
read; the daemon keeps its bounded-latency stale backstop.
- tests: cover every required semantic (mid-pipeline absorb, finished/parked
surface, no-running-pipeline idle surface, busy absorb, captain-verb surface)
as classifier unit tests and behavioral watcher runs; queue-safety test for
the new immediate-surface stale path.
- AGENTS.md section 8: document absorb-only-when-provably-working.
* no-mistakes(document): Sync watcher documentation
* feat: add grok crewmate harness support (#143)
* feat(harness): add grok (Grok Build) as a verified crewmate adapter
Empirically verified against grok 0.2.73 and encoded across the machinery:
- fm-harness.sh: detect grok via GROK_AGENT=1 env marker (grok does not set
CLAUDECODE) and `grok` command-name ancestry.
- fm-spawn.sh: grok launch template (`grok --always-approve "$(cat BRIEF)"`,
fully autonomous, no permission gate) and a turn-end Stop hook. grok only
loads project hooks after a manual folder-trust grant, so the hook is a
single firstmate-owned global hook (~/.grok/hooks/fm-turn-end.json, always
trusted) that is a guarded no-op unless the workspace holds a per-task
.fm-grok-turnend pointer; fm-spawn drops that gitignored pointer naming
state/<id>.turn-ended. Hook stays outside the worktree, needs no trust grant.
- fm-watch.sh + fm-tmux-lib.sh: grok busy signature `Ctrl+c:cancel` (the
mid-turn cancel hint; ASCII, present iff a turn runs).
- harness-adapters skill: grok facts section (busy, exit=Ctrl+Q x2,
interrupt=Ctrl+C, skill invocation /<skill>, resume) and /no-mistakes form.
Gating question confirmed: grok invokes /no-mistakes and drives a real
no-mistakes axi run, so grok is usable for no-mistakes-mode tasks. End-to-end
verified through fm-spawn: autonomous launch past the dir picker into the
worktree, brief processed, busy->idle and turn-end signal detected, fm-send
steer lands, clean Ctrl+Q exit and teardown. config/crew-harness is left
unchanged; this only makes grok available as a verified option.
* no-mistakes(review): Captain, harden Grok hook lifecycle
* no-mistakes(review): Captain, make Grok harness test executable
* no-mistakes(review): Captain, bound Grok pointer reads
* no-mistakes(test): Captain, harden crew-state and watcher-lock timing
* no-mistakes(document): Document Grok harness support
* feat(harness): split secondmate harness configuration (#144)
* feat(harness): split secondmate harness and inherit primary config into secondmate homes
Add config/secondmate-harness so secondmates can run on a different adapter
than crewmates. fm-harness.sh gains a `secondmate` mode resolving the chain
config/secondmate-harness -> config/crew-harness -> own; `crew` mode is
unchanged. fm-spawn resolves a --secondmate launch through that mode (durable:
every respawn re-resolves), while an explicit per-spawn harness arg still wins
and the unverified-adapter guard still holds.
Add a generic, extensible inheritable-config mechanism (fm-config-inherit-lib.sh)
that pushes the primary's declared LOCAL config into each secondmate home's
config/ at secondmate spawn and on the bootstrap secondmate sweep. Exactly one
item is wired today: config/crew-harness, so a secondmate's own crewmates use
the primary's setting. Primary-authoritative (re-pushed every convergence,
mirrors absence); config/secondmate-harness is deliberately not inherited since
secondmates never spawn secondmates. config/ is gitignored, so this is a copy
separate from the tracked-files fast-forward.
Update AGENTS.md (layout, bootstrap, harness, spawn), the harness-adapters
skill, docs/scripts.md, and .gitignore. New tests cover secondmate resolution
and fallback, spawn/respawn honoring config/secondmate-harness, config
propagation on spawn and sweep, the unverified-adapter guard, and backward
compatibility.
* no-mistakes(review): Surface inherited config propagation failures
* no-mistakes(review): Harden inherited config propagation
* no-mistakes(review): Document literal harness inheritance requirement
* no-mistakes(document): Document secondmate harness config
* feat(backlog): default backlog operations to tasks-axi (#145)
* feat(backlog): default to tasks-axi backend
* no-mistakes(document): Sync backlog backend docs
* fix(spawn): set per-task GOTMPDIR so interrupted Go builds don't leak /tmp (#36)
* fix(spawn): set per-task GOTMPDIR so interrupted Go builds don't leak /tmp
Go's GOTMPDIR is unset, so every go build/test creates numbered /tmp/go-build*
dirs. Go cleans them on a clean exit but LEAVES THEM when interrupted (signal,
timeout, OOM, full disk), accumulating and filling the disk over time.
Give each task its own temp root at /tmp/fm-<id>/ with Go's build temp nested at
gotmp/. fm-spawn creates the dir (Go won't mkdir GOTMPDIR), exports GOTMPDIR into
the crewmate pane so the agent and child processes inherit it, and records
tasktmp= in meta. fm-teardown reads tasktmp= and removes the whole root on
cleanup, deterministically.
GOTMPDIR (not TMPDIR) is the targeted knob: TMPDIR is too broad (affects every
program's temp). The nested root is extensible: other per-task temp can live
under /tmp/fm-<id>/ later.
Backward compat: tasks spawned before this change have no tasktmp= in meta;
teardown tolerates the empty value as a no-op. The daily fm-disk-cleanup.sh cron
remains a safety net for any pre-fix stray dirs.
* fix(tests): silence SC2016 for literal grep -F patterns in fm-gotmp test
The structural grep -F assertions deliberately match literal $TASK_TMP in the
fm-spawn source; add per-line shellcheck disable=SC2016 (the codebase's existing
pattern, e.g. bin/fm-spawn.sh) so CI lint passes.
* no-mistakes(document): docs: document tasktmp= meta field for per-task GOTMPDIR
---------
Co-authored-by: e-jung <8334081+e-jung@users.noreply.github.com>
* fix: accept landed squash-merged PR heads (#149)
* fix(teardown): accept landed squash-merge PR heads
* no-mistakes(document): Document teardown landing behavior
* no-mistakes: apply CI fixes
* fix(test): pass explicit teardown git identity
* feat(dispatch): add dynamic crew profiles (#154)
* feat(dispatch): add dynamic crew profiles
* no-mistakes(review): Captain, document dispatch profile inheritance
* no-mistakes(review): Captain, guard stale dispatch inheritance
* no-mistakes(document): Sync dispatch profile docs
* no-mistakes: apply CI fixes
* fix: harden crew dispatch profile enforcement (#159)
* Harden crew dispatch profile enforcement
* no-mistakes(document): Captain, synced crew dispatch docs
* feat: add live secondmate config push (#161)
* feat(config): add live secondmate config push
* no-mistakes(document): Document config push behavior
* no-mistakes(lint): Clean changed shell lint
* no-mistakes: apply CI fixes
* feat: support image attachments in X replies (#162)
* feat(x): add image attachments to reply helpers
* no-mistakes(review): Stream X image replies safely
* no-mistakes(review): Captain, clean X reply temp tracking
* no-mistakes(document): Document X reply image support
* fix(teardown): make landed PR detection robust (#167)
* fix(teardown): make landed-check robust when no pr= was ever recorded
fm-teardown.sh's squash-merge landed-check already falls back to
discovering a merged PR by branch name when state/<id>.meta has no
recorded pr=, but nothing guaranteed pr=/pr_head= actually got
recorded on a yolo-authorized merge - the "checks green" trigger that
normally runs fm-pr-check.sh never fires on repos with no PR CI, so a
merge done via a bare `gh-axi pr merge` silently skips it.
Add bin/fm-pr-merge.sh as the one path for merging a task's PR: it
always runs fm-pr-check.sh first, so pr=/pr_head= land in meta as part
of the merge itself regardless of any CI signal. Document both the
existing branch-name discovery fallback and the new merge path in
AGENTS.md, and add regression coverage for the no-pr=-recorded landed
scenario and for fm-pr-merge.sh's record-then-merge behavior.
* no-mistakes(review): Guard PR merges on task metadata
* no-mistakes(document): Document PR merge wrapper
* no-mistakes: apply CI fixes
* fix: parse PR merge URLs for gh-axi (#168)
* Fix fm-pr-merge.sh to parse PR URLs for gh-axi
gh-axi pr merge expects a PR number and --repo, not a full GitHub URL.
Parse the URL, default to --squash when no merge method is passed, and
fail fast on malformed URLs. Tests cover parsing, defaults, and refusal.
* no-mistakes(review): Harden PR merge validation
* no-mistakes(review): Harden PR merge URL guards
* no-mistakes(document): Document PR merge URL handling
* no-mistakes(lint): Clean shell lint
* feat(bin): pin secondmate model and effort (#180)
* feat: pin secondmate model/effort in config/secondmate-harness
Extend config/secondmate-harness's format to an optional
"<harness> [<model>] [<effort>]" line so a secondmate can be durably
locked to a concrete model/effort in the same file, without adding a
new config file. A bare harness-only file behaves exactly as before.
fm-harness.sh gains secondmate-model/secondmate-effort accessors;
fm-spawn.sh populates MODEL/EFFORT from them on every secondmate spawn
(including respawns) unless the caller passed an explicit --model/--effort.
* no-mistakes(review): Fix secondmate override pin precedence
* no-mistakes(document): Document secondmate harness pins
* feat(bin): add runtime backend interface (#183)
* feat(bin): extract tmux runtime behind a backend interface (P1)
Add bin/fm-backend.sh (selection, meta helpers, selector resolution,
dispatch) and bin/backends/tmux.sh (the tmux adapter), then route
fm-send.sh, fm-peek.sh, fm-watch.sh, fm-spawn.sh, and fm-teardown.sh
through them. Every default tmux command sequence, meta shape, and
printed output stays byte-identical: missing backend= still means
tmux, and a default spawn never writes backend=tmux.
Adds a --backend flag (tmux-only for now) and FM_BACKEND/config/backend
selection, refusing any unimplemented backend loudly. Names the
watcher's poll loop as the default event-source implementation over the
backend's pull primitives, per the herdr-addendum's events-as-the-core-
abstraction direction, without changing its behavior.
Verification: fake-tmux/treehouse old-vs-new command-log conformance
tests for send/peek/spawn/teardown, a real-tmux smoke test for the
adapter, and the full existing suite passing unmodified (bar two
fixture-only additions in fm-gotmp.test.sh for the new sibling
scripts).
* no-mistakes(review): Captain, harden backend baseline resolution
* no-mistakes(review): Captain, ignore and document backend config
* no-mistakes(review): Captain, make backend tests executable
* no-mistakes(document): Sync runtime backend documentation
* feat(bin): add experimental Herdr runtime backend (#186)
* feat(bin): add experimental herdr runtime backend (P2)
Implements bin/backends/herdr.sh (session-provider adapter, D3: treehouse
stays the worktree provider) wired through fm-backend.sh's dispatch, with
--backend herdr / FM_BACKEND=herdr / config/backend selection, a
version/protocol gate at spawn, semantic busy-state detection via herdr's
agent.get (fm-watch.sh and fm-crew-state.sh consult it before falling back to
the existing tmux pane-regex path), and label-based recovery discovery.
Container shape (D4) decided empirically: tab-per-task in one "firstmate"
workspace, mirroring tmux's one-session-many-windows model.
Found and fixed two real herdr v0.7.1 bugs during verification: `pane read
--lines N` returns empty for small N (worked around by over-fetching and
trimming locally), and `pane get`'s cwd field is frozen at pane-creation time
(fixed to read foreground_cwd instead, needed for fm-spawn's worktree-
discovery poll after `treehouse get`). Also fixed a pre-existing bug in
tests/fm-backend.test.sh's old-vs-new fixture that was silently missing
fm-backend.sh/bin/backends/ from the old bin/ shim.
Full empirical verification, the D4 decision evidence, and a real end-to-end
run (spawn/steer/peek/done/merge-local/teardown, including confirming
teardown refuses before the merge) are recorded in docs/herdr-backend.md.
The entire existing tmux conformance suite stays green.
* no-mistakes(review): Fix Herdr supervision recovery gaps
* no-mistakes(review): Captain, fix Herdr stale recovery gaps
* no-mistakes(review): Document Herdr composer primitive candidate
* no-mistakes(review): Captain, harden Herdr stale recovery and tests
* no-mistakes(document): Sync herdr backend docs
* no-mistakes: apply CI fixes
* feat(bin): auto-detect runtime backend (#188)
* feat(bin): auto-detect runtime backend from HERDR_ENV/TMUX markers
fm_backend_name now falls through to runtime auto-detection between
config/backend and the hard tmux default: a firstmate running natively
inside herdr (HERDR_ENV=1) now spawns crewmates into herdr by default,
mirroring how harness detection already works in fm-harness.sh. Nesting
resolves innermost-first (tmux wins over a nested herdr pane). Explicit
--backend/FM_BACKEND/config/backend settings always win over detection.
Selecting herdr via auto-detect prints a loud stderr notice; auto-detecting
tmux stays silent so the unconfigured default path is unchanged.
* no-mistakes(review): Captain, pin tmux tests and backend docs
* no-mistakes(document): Sync backend autodetect docs
* no-mistakes: apply CI fixes
* feat(stow): add operational memory capture (#197)
* feat(stow): add operational-memory learnings convention and /stow skill
Add data/learnings.md as the fleet-local operational-learnings home,
a knowledge-routing table in AGENTS.md, and a user-invocable /stow
skill that sweeps a session for uncaptured durable knowledge and
files it to the right disk home before a reset.
* no-mistakes(review): Fix stow backlog note command
* no-mistakes(document): Document stow memory routing
* fix(tests): protect herdr smoke cleanup from default sessions (#199)
* fix(tests): stop real-herdr smoke tests from ever killing the default session
Both fm-backend-herdr-smoke.test.sh and fm-backend-autodetect-smoke.test.sh
tore down their isolated throwaway HERDR_SESSION via a bare/inline-prefixed
`herdr server stop`, which is unscoped and resolves ambiently. On this herdr
client, that ambient resolution silently falls back to whatever server is
already running instead of the requested session - it killed the captain's
live default herdr server twice in production (2026-07-02), once from each
smoke test's cleanup trap.
Add tests/herdr-test-safety.sh with herdr_safe_stop_and_delete: it uses the
explicit-by-name `herdr session stop/delete <name>` form (never the ambient
`server stop`) and, before that, a read-only hard guard
(herdr_refuse_if_default) that re-queries `herdr session list --json` and
refuses outright if the target is literally "default", not found, or flagged
default:true. Fails closed on any ambiguity. Verified empirically against a
real isolated session: refuses on default/nonexistent/empty names without
ever calling stop, and correctly tears down a genuine isolated session while
leaving the default session's workspace state byte-identical before and
after.
* no-mistakes(review): guard herdr delete with fresh check
* no-mistakes(document): Document herdr smoke cleanup safety
* feat(bin): route herdr secondmates into per-home workspaces (#200)
* feat(bin): give each secondmate its own labeled herdr workspace
Give each secondmate its own labeled herdr workspace, and land crewmates
spawned from a secondmate home in that secondmate's own space, instead of
every firstmate home (primary and all secondmates) sharing one "firstmate"
workspace.
bin/backends/herdr.sh: replace the constant FM_BACKEND_HERDR_WORKSPACE_LABEL
with fm_backend_herdr_workspace_label(), resolved fresh from FM_HOME on every
call. The primary (no .fm-secondmate-home marker) still resolves to
"firstmate" - byte-identical to every pre-existing task's recorded label, no
forced migration. A secondmate home resolves to "firstmate-<secondmate-id>".
Every workspace-scoped path (find/ensure, tab create + duplicate check,
list-live recovery, pane-for-tab) uses this same resolution, so recovery and
duplicate checks stay scoped to each home's own space. Workspace and tab
create now pass --no-focus unconditionally (verified: neither focuses by
default once a workspace exists; --no-focus is defense in depth against the
one bootstrap edge case where the very first workspace in a session auto-
focuses).
Also fixes a session-targeting bug found while verifying this empirically:
HERDR_SESSION (env var, exported or inline-prefixed) is not reliably honored
by herdr 0.7.1 CLI subcommands once another herdr server is already running -
it silently falls back to whatever server IS running. fm_backend_herdr_cli
wraps every herdr invocation with both HERDR_SESSION and a trailing
--session <name> flag (verified to route correctly in every case tried),
fixing this for the whole adapter, not just the new label-scoped calls.
bin/fm-spawn.sh: a --secondmate spawn is launched BY the primary's own
process, whose FM_HOME still names the primary at that point. The herdr case
arm now shadows FM_HOME to the secondmate's own home (PROJ_ABS) for just the
two calls that resolve/create the workspace and tab, restored automatically
afterward (bash's temporary-assignment-before-a-command form works for shell
functions too). A crewmate/scout spawned FROM a secondmate's own fm-spawn.sh
process needs no such glue - its own FM_HOME already names it.
Tests: extended tests/fm-backend-herdr.test.sh (per-home label resolution,
--no-focus, --session flag, workspace-find/list-live scoping) and
tests/fm-backend-herdr-smoke.test.sh (a secondmate-shaped home's workspace
label, list-live scoping, restart stability in the multi-workspace shape).
Added tests/fm-backend-herdr-workspace-per-home-e2e.test.sh: the mandatory
isolated E2E, driving real bin/fm-spawn.sh/fm-teardown.sh - a primary-shaped
home into "firstmate", a --secondmate spawn into its own labeled space, a
crewmate spawned FROM that secondmate-shaped home landing in the same space
(this exact path had never run before), teardown closing only the right tab,
and list-live recovery seeing only each home's own tabs. All ten assertions
passed on the real binary; the default herdr session's own workspace state
was confirmed byte-identical before and after every real-herdr test run in
this change.
docs/herdr-backend.md: rewrote "Task container shape" for the workspace-per-
home design (label derivation, the --secondmate FM_HOME-shadow wrinkle, focus
behavior, label-collision/adopt-don't-duplicate semantics, no-forced-
migration), added "Session targeting: the --session flag, not HERDR_SESSION
alone", extended "ID stability" to the multi-workspace shape, and documented
the new E2E test.
* no-mistakes(review): Clarify herdr focus docs
* no-mistakes(review): Captain, clarify herdr server session docs
* no-mistakes(document): Document herdr per-home spaces
* fix(backends): rename Herdr secondmate workspace labels (#203)
* Rename herdr secondmate workspace prefix to 2ndmate-
The primary home keeps the firstmate label; secondmate homes now
resolve to 2ndmate-<id> so the herdr spaces sidebar is unambiguous.
Tests and docs updated; pre-rename workspaces can be aligned with
herdr workspace rename.
* no-mistakes(review): Clarify herdr workspace migration behavior
* no-mistakes(document): Herdr docs label alignment
* feat(bin): add unified session start digest (#201)
* feat(bin): collapse session start into one command
Add bin/fm-session-start.sh, composing fm-lock.sh, fm-bootstrap.sh, and
fm-wake-drain.sh into one ordered digest (lock, bootstrap diagnostics,
wake queue, context files, fleet state) instead of six-plus separate
turns. Lock now runs before bootstrap's mutating sweeps, closing a race
where a second concurrent session could mutate shared state before
discovering the lock was held. A lock refusal prints a loud read-only
banner, skips every mutating step via a new opt-in
FM_BOOTSTRAP_DETECT_ONLY flag on fm-bootstrap.sh, and still completes
the read-only-safe digest.
Add fm_backend_target_exists to fm-backend.sh as a shared, read-only,
never-side-effecting per-task endpoint-liveness primitive for both the
tmux and herdr backends.
Rewrite AGENTS.md sections 3 and 5 around the single command and add
tests/fm-session-start.test.sh.
* no-mistakes(review): Harden session-start read-only guidance
* no-mistakes(review): Suppress read-only tangle repair guidance
* no-mistakes(review): Include orphan status logs
* no-mistakes(review): Captain: make session-start test executable
* no-mistakes(review): Captain: clarify status tail guidance
* no-mistakes(document): Sync session-start docs
* no-mistakes(lint): Shell lint clean
* fix(tests): avoid shellcheck boolean chain
* fix(bin): corroborate herdr idle crew state (#207)
* fix(bin): corroborate herdr idle agent_status with the pane's own text
crew_pane_is_busy trusted a bare `idle` verdict from herdr's agent.get
outright, skipping the tail-regex corroboration unknown already gets.
agent.get reports generation state only (working while the model streams
a turn), so it reads idle for a crew blocked on its own long foreground
no-mistakes run - even though the pane still shows the busy banner the
whole time. Combined with the no-mistakes CLI's 10-run attribution cap,
this made a genuinely working herdr crew read as not provably working,
triggering an immediate stale wake instead of absorb-then-escalate.
* no-mistakes(document): Align herdr busy-state docs
* fix(backends): reuse the herdr firstmate workspace instead of leaking one per spawn (#202)
* fix(backends): reuse the herdr firstmate workspace instead of leaking one per spawn
Every herdr-backed crewmate left an orphaned `firstmate`-labelled workspace
behind, one per task, because `fm_backend_herdr_workspace_find` never matched
the existing workspace: its jq filter used `--arg label ... $label`, and
`label` is a reserved keyword in jq (label/break), so the filter was a compile
error. The error was swallowed by `2>/dev/null`, the find returned empty on
every call, and `workspace_ensure` took the create path each spawn, minting a
fresh workspace. The same collision silently disabled the create-task
duplicate-label check and the bare-selector tab lookup.
Rename the jq variable to `$want` in all three affected filters so reuse,
duplicate detection, and bare-selector lookup work. With reuse restored the
single `firstmate` workspace is persistent (like tmux's session) and teardown
correctly leaves it in place, closing only the task's pane/tab.
Also prune the default tab (label "1") herdr auto-creates inside a freshly
created workspace, best-effort, so the workspace holds only real task tabs.
Add stateful-fake-CLI tests that replay repeated spawn/teardown cycles and
assert one reused workspace, zero orphans, the default tab pruned, and
`workspace create` invoked exactly once. Verified against the real herdr binary
too: the pre-fix code failed the smoke idempotency check (minted wE then wF in
an isolated session); the fix passes it.
Document the workspace lifecycle, the jq-keyword pitfall, the default-tab
prune, and the project-labelled-workspace anomaly (not adapter-created) in
docs/herdr-backend.md.
* docs(herdr): trim workspace-lifecycle addition to current-state facts
The docs/herdr-backend.md convention documents current behavior, not
history - narrative belongs in the PR/commit message. Tightened the
workspace-leak and default-tab-prune write-up down to the operative
facts (the jq reserved-keyword guard, when pruning is safe, and the
persistence caveat), and corrected the CLI-facts table rows to match
the corrected prune timing.
* fix(backends): defer herdr default-tab prune until a real task tab exists
Closing a workspace's LAST tab deletes the whole workspace on real
herdr (verified). Pruning the auto-created default tab right after
workspace create closed the workspace's only tab at that point,
destroying the just-created workspace on every single spawn instead of
reusing it - the fake-CLI unit tests didn't model this real-herdr
behavior, so they passed while the real-herdr smoke test failed with
"container_ensure is not idempotent".
Move the prune into fm_backend_herdr_create_task, right after the
first real task tab is added to a freshly created workspace, when
closing the default tab alongside it is safe. Update the fake-CLI unit
test to match the corrected timing.
Also fix a smoke-test-only bug this surfaced: the test's second
create_task call reused a $CONTAINER captured before the first task
was killed, rather than re-running container_ensure like real
fm-spawn.sh always does immediately before every create_task call - so
once the workspace (correctly) disappeared after its last tab closed,
the stale reference no longer named a live workspace.
* test(backends): guard against jq --arg names colliding with jq keywords
Regression guard for the workspace-leak bug this PR fixes: a jq
--arg/--argjson variable named after a jq reserved keyword (e.g.
label) is a compile error on jq <= 1.6, and this adapter's
2>/dev/null silently turns that into an empty result instead of a
visible failure. Greps bin/ for the pattern so a future violation
fails loudly here instead of silently misbehaving on an older jq.
* docs(herdr): fix per-home staleness and drop contributor-specific example
The workspace-lifecycle write-up hardcoded "the firstmate workspace"
as if the label were always the fixed constant, stale against the
per-home labeling documented earlier in this file (primary: firstmate,
secondmate: 2ndmate-<id>). Rephrased per-home throughout, and pointed
the "workspace this adapter did not derive" case at the existing
Label-derivation section instead of a separate anomaly writeup.
Dropped the "Anomaly: a workspace labelled with a project name"
section - the python-teslemetry-stream example was a contributor's own
environment, not current adapter fact, and it repeated a now-incorrect
FM_BACKEND_HERDR_WORKSPACE_LABEL constant claim. Replaced with one
generic sentence already covered by the corrected wording above.
Also fixed the jq-reserved-keyword guard test's file reference, which
named tests/fm-backend.test.sh when the test actually lives in
tests/fm-backend-herdr.test.sh.
---------
Co-authored-by: kunchenguid <kun@kunchenguid.com>
* fix(backends): make Herdr default-tab pruning safe (#215)
* fix(backends): make the herdr default-tab prune provably safe
The default-tab prune could close a pane holding a LIVE agent: an
ADOPTED workspace (found pre-existing by label match) was pruned using
the same tab-count/label heuristic as a freshly created one, and herdr
derives a workspace's displayed label from its cwd basename when no
explicit --label is given. A captain launching herdr directly inside a
directory named "firstmate" produces a workspace that looks identical,
by label alone, to firstmate's own container - so the very next spawn
adopted the captain's own live workspace and closed their live pane
27ms after creating its task tab (2026-07-02 incident).
The fix is structural: fm_backend_herdr_workspace_ensure now captures
the seeded default tab's id straight from its own `workspace create`
response, only when it just created the workspace. That id threads
through fm_backend_herdr_container_ensure to fm_backend_herdr_create_task,
which is the only function allowed to prune it - an adopted workspace's
caller always passes an empty seeded-tab-id, so create_task never
re-derives "prunable" from a tab's label or count. Defense in depth:
the prune also refuses a tab whose pane reports a working agent.
Covered by new unit tests (adopted-never-prunes, created-prunes-exactly,
the exact label-collision incident shape) and a new isolated real-herdr
E2E test that reproduces the incident against the pre-fix code and shows
it fixed, plus the normal happy path.
* no-mistakes(document): Sync herdr prune docs
* no-mistakes: apply CI fixes
* fix(brief): remove apostrophe breaking bash -n and guard bash 3.2 set -u in spawn (#173)
* fix(brief): remove apostrophe that broke bash -n on fm-brief.sh
The no-mistakes DOD heredoc, built via VAR=$(cat <<EOF ... EOF), had an
unescaped apostrophe in "no-mistakes' own guidance". Nesting a heredoc
inside $(...) makes bash track quote state through the body, so the lone
apostrophe broke parsing of the rest of the script (bin/fm-brief.sh:211),
making the default no-mistakes ship path fail outright. Audited the other
two $(cat <<EOF...EOF) blocks (direct-PR, local-only) for the same class
of bug; none found. Added tests/fm-brief.test.sh as a regression guard.
* no-mistakes(test): fix(spawn): guard empty shared_args under bash 3.2 set -u
* no-mistakes(document): docs(contributing): list tests/fm-brief.test.sh in the test suite inventory
* fix(test): silence shellcheck SC2034/SC2100 in fm-brief.test.sh
Drop the unused out= capture (redirect to /dev/null instead) and quote
the id= assignment so shellcheck stops reading the hyphenated id value
as an arithmetic expression.
* feat: add experimental zellij runtime backend (#217)
* feat(backends): add experimental zellij runtime backend (P3)
Implements bin/backends/zellij.sh on the P1 dispatcher + P2 herdr precedent:
one zellij session, one tab per task, treehouse stays the worktree provider.
Wired through fm-backend.sh/fm-spawn.sh so fm-send/fm-peek/fm-watch/
fm-crew-state/fm-teardown work generically with zero changes to those scripts.
Empirically verified against real zellij 0.44.0: every "gaps to verify" item
from the design report, plus real findings the report missed - new-tab always
steals focus (mitigated with a restore call), zellij action always exits 0
even against a dead target, every pane op needs an explicit --pane-id, and
pane_cwd never tracks a subshell's own cd (treehouse get's exact shape) so
worktree-path discovery uses an active pwd-probe instead of passive JSON
polling. Findings and the full real-CLI evidence log are in
docs/zellij-backend.md.
Full real E2E cycle passed: spawn a real claude crewmate, accept its trust
dialog, steer it, receive done, confirm teardown refuses before merge, merge
local-only, confirm teardown then succeeds and the zellij tab is gone - all
in a scratch FM_HOME against a uniquely-named isolated zellij session, never
touching the real "firstmate" session or the live fleet.
Existing tmux and herdr conformance suites stay green; the two P1-era tests
asserting zellij was unimplemented now assert that of orca instead.
* no-mistakes(review): captain, guard zellij paste payloads
* no-mistakes(review): Captain, guard zellij pane readiness
* no-mistakes(review): Captain, harden zellij dead-target handling
* no-mistakes(review): Captain, harden zellij teardown and tests
* no-mistakes(review): Captain, harden zellij target validation
* no-mistakes(document): Document zellij backend
* docs: document Orca backend adapter contract (#209)
* docs: specify Orca backend adapter contract
* docs: require Orca window target alias
* no-mistakes(test): Captain: handle empty arrays under nounset
* no-mistakes(document): Document Orca backend proposal
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* feat(backends): add Orca primitive backend support (#210)
* feat(backends): add Orca adapter primitives
* no-mistakes(review): Gate Orca from task spawning
* no-mistakes(document): Document Orca backend limits
* fix(backends): stop mapping Orca Escape to interrupt
* no-mistakes(document): Document Orca primitive key support
* no-mistakes: apply CI fixes
* fix: drop CI-gate rewrite and normalize shared array-guard hunks
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix(backends): submit herdr slash commands reliably (#223)
* fix(backends): herdr slash-command submit verification false-positives on popup autocomplete
Two grok/herdr crewmates left /no-mistakes fully typed but unsubmitted for
minutes while fm-send exited 0. Live-reproduced against real grok 0.2.82:
the herdr adapter's submit verification declared success on ANY pane content
change after Enter, but an argument-taking slash command's first Enter only
closes the popup and expands the composer into an argument-hint placeholder
(/compact -> /compact compaction instructions) rather than submitting - a
real, visible change that isn't a submission. A second Enter is required.
fm_backend_herdr_composer_state replaces the delta check with a structural
read of the composer's own row (located by border-glyph shape, since herdr
exposes no cursor-row primitive), mirroring what cursor_y gives the tmux
adapter. A popup-close-with-placeholder-fill still reads pending, so the
retry loop now correctly sends the needed second Enter instead of stopping
early. The tmux backend was unaffected (its cursor-row read already handled
this correctly, verified side by side against the same live repro).
* no-mistakes(document): Sync herdr submit docs
* feat(skills): publish public stow skill with internal-skill hiding (#221)
* feat(skills): hide agent-only skills from installer discovery, add public stow
Mark every .agents/skills/* skill metadata.internal: true so the
skills.sh installer (npx skills add) hides them from discovery - all
assume a live firstmate home and are meaningless elsewhere. This is
inert to firstmate's own harness skill loader.
Add a new, fully standalone skills/stow for non-firstmate users: sweep
a conversation for durable knowledge and file it into whatever notes
convention the host project/user already has, asking once and
remembering the answer when ambiguous. No shared code with the
internal stow by design.
Document the two-tier layout in README and CONTRIBUTING.
* no-mistakes(review): Tighten public stow tracker routing
* no-mistakes(document): Sync skill docs
* fix(skills): make public stow's undone-next-steps routing local-first
Supersede the earlier ask-before-tracker-write tightening: the
standalone stow no longer treats an issue tracker as a routing option
at all based on inference (git remote, .github/ presence, etc).
Undone next steps always land in a local file by default - an
existing TODO/BACKLOG/NOTES file, or a freshly created local scratch
file otherwise. A tracker (or any other external system) is only ever
used when the user has explicitly said so, this session or as a
previously recorded standing preference.
* no-mistakes(document): Sync skill documentation
* feat(skills): clarify public stow resume and fallback routing (#225)
* feat(skills): resume pointer, routing tiers, default notes file for public stow
Adds a copy-pasteable resume pointer to the safe-to-end verdict so a
new session can pick the work back up cold, states the explicit three-tier
routing priority (explicit instruction > existing local convention > default
NOTES.md fallback) instead of leaving it implicit, and names NOTES.md as the
top-level discoverable default instead of letting each agent improvise a
location. Also removes a leftover internal-tooling word from the maintainer
comment so the public file carries zero internal vocabulary.
* fix(skills): make the public stow default fallback private and gitignored
Supersedes the earlier NOTES.md/ask-once split: the tier-3 default fallback
(no existing local convention fits) is now .stow-notes.md, gitignored so it
never lands unprompted in a shared/committed file. Because it's private, it's
safe for every finding-kind including user preferences, so the separate
ask-once carve-out for personal material is no longer needed there. Tier 2
(an already-established tracked convention) is unchanged and is the only
tier that still writes into a shared file. Step 7's resume pointer now flags
when notes landed in the private fallback and that they can be promoted into
a shared file later.
* fix(skills): split the public stow private fallback by scope, use git exclude
Supersedes the single .stow-notes.md fallback: user preferences (cross-project
by nature) now default to a host-local ~/.stow/notes.md instead of being
siloed into one project's repo. Project-scoped findings still default to
.stow-notes.md at the project root, but it's now kept out of git via the
local-only .git/info/exclude instead of the tracked .gitignore, so the
fallback is truly zero-shared-footprint: nothing lands in a tracked file and
nothing is left for the user to review or commit.
* fix(skills): keep the public stow private fallback sandbox-safe (current dir only)
Supersedes the home-file split: a home-directory path fails for agents
sandboxed to their current working directory, so the tier-3 default now
stays a single .stow-notes.md at the project root for every finding-kind,
including user preferences. Tier 2's user-level memory file is now framed
as a bonus when accessible, never assumed or required. Step 7 gains a
caveat when a preference lands in the project-local fallback: it applies to
this project only, and the user can copy it into their own global memory
file if they want it to follow them everywhere.
* fix(skills): use a current-directory .gitignore for the public stow fallback
Supersedes .git/info/exclude: that mechanism resolves outside the working
directory in a linked worktree, breaking the sandbox-safety guarantee for
exactly the setup this fleet uses everywhere. Switch to an ordinary
.gitignore file in the current directory instead - always in-directory
regardless of worktree layout - creating or appending a .stow-notes.md
line, left uncommitted for the user. If that write itself fails, the skill
still creates .stow-notes.md and tells the user to ignore it manually
rather than blocking. Also scopes the "never writes outside the current
directory" guarantee precisely to tier 3: tier 2 is exempted since it only
targets a destination the user's own existing convention already
established, which can legitimately be a user-level file outside the
project.
* no-mistakes(review): Clarify stow routing precedence
* no-mistakes(review): Clarify stow fallback metadata boundary
* no-mistakes(review): Guard tracked stow fallback
* no-mistakes(review): Clarify stow fallback verdict
* no-mistakes(document): Sync stow skill docs
* no-mistakes(lint): Public skill lint cleanup
* docs: clarify note hygiene guidance (#226)
* docs: add note-hygiene rule to backlog format section
Backlog and task notes accumulate volatile specifics that drift and
mislead; capture the general principle so every firstmate user avoids
trusting a stale note over the authoritative source.
* no-mistakes(review): Clarify note hygiene schema exemptions
* no-mistakes(document): Clarify note-hygiene docs
* revert: drop out-of-scope stow/architecture doc edits
Keep this PR's diff scoped to the AGENTS.md note-hygiene addition only;
skills/stow/SKILL.md, .agents/skills/stow/SKILL.md, and docs/architecture.md
are under separate close review and must not change out of band here.
This reverts commit ed2d73205b01e24ba8ffd40c523a24993f6eb1a5.
* feat(backends): add Orca task lifecycle support (#228)
* feat(backends): add Orca task lifecycle support
* fix(backends): harden Orca spawn lifecycle
* no-mistakes(review): Fix Orca lifecycle cleanup gaps
* no-mistakes(review): Release Orca worktrees without paths
* no-mistakes(review): Guard Orca spawn abort cleanup
* no-mistakes(review): Allow partial Orca child cleanup
* no-mistakes(review): Fix Orca selector and cleanup leaks
* no-mistakes(review): Preserve pathless Orca cleanup metadata
* no-mistakes(review): Harden Orca spawn and teardown lifecycle
* no-mistakes(review): Enforce Orca scout report gate
* no-mistakes(review): Harden Orca teardown path validation
* no-mistakes(review): Harden Orca capture errors
* no-mistakes(review): Harden Orca JSON cleanup validation
* no-mistakes(test): Fix zellij scout teardown fixture
* no-mistakes(document): Document Orca lifecycle support
* Harden Orca runtime and submit verification
* no-mistakes(review): Captain, preserve Orca current-tail verification
* no-mistakes(document): Sync Orca lifecycle docs
* no-mistakes(lint): Captain, silence deliberate ShellCheck
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* fix: use PR head for review diffs (#229)
* Fix fm-review-diff to compare PR head when pr= is recorded
After no-mistakes fix rounds push to the open PR, the crewmate worktree
branch can lag the authoritative PR head. When meta records pr=, resolve
the compare ref from reachable pr_head= or refs/pull/<n>/head before
diffing against the fetched authoritative base; fall back to the local
branch with a loud warning when the PR head cannot be resolved.
Add behavior tests for pr_head resolution, fetch, unchanged no-pr path,
and unreachable-PR fallback.
* no-mistakes(review): Make review-diff test executable
* no-mistakes(document): Document PR-head review diffs
* no-mistakes: apply CI fixes
* fix: make backend matching shell-portable (#230)
* Make fm-backend.sh backend-name matching shell-portable for zsh
Replace word-split-dependent for-loops in fm_backend_is_known() and
fm_backend_validate_spawn() with case-based membership tests so sourcing
the library from zsh no longer falsely rejects known backends.
Add zsh/bash regression coverage in tests/fm-backend.test.sh.
* no-mistakes(review): Fix zsh backend loading and validation
* no-mistakes(document): Document backend membership portability
* fix(backends): make herdr respawn idempotent (#231)
* fix(backends): make herdr respawn idempotent against restored-layout husks
herdr persists and restores its session layout (workspaces/tabs/panes)
across a server restart, so a restored fm-<id> task tab comes back a
husk - a dead pane, or a plain agent-less shell - which fm-spawn.sh's
duplicate-tab guard refused unconditionally, forcing manual pane closes
after every restart.
fm_backend_herdr_create_task now classifies an existing same-labeled
tab's pane conservatively (dead/no-agent/live/unknown) and
closes-and-replaces only a confirmed husk, always creating the
replacement tab before closing the old one so a husk that is a
workspace's only tab is never at risk of taking the whole workspace
down with it. A genuinely live agent, or anything not confidently
classifiable, still refuses exactly as before.
* no-mistakes(review): Harden herdr duplicate respawn guard
* no-mistakes(review): Enforce herdr husk cleanup postcondition
* no-mistakes(document): sync herdr respawn docs
* no-mistakes: apply CI fixes
* fix: absorb stale wakes during active validation (#233)
* fix(watcher): stop stale_is_terminal from ignoring an active run-step
A crewmate's status log gets no new entry once firstmate hands it to a
no-mistakes validation (the sparse status-reporting contract), so the
log's last line can stay a pre-validation "done:" (or needs-decision/
blocked) leftover for the run's entire duration. fm-watch.sh's
stale_is_terminal only reads that raw last line - it has no run-step
awareness - so it kept surfacing a stale pane as immediately terminal
every time it went quiet for two polls, no matter how actively the
pipeline was validating (confirmed live against fm-herdr-respawn-idem,
whose status log's last line is literally "done: ..." while its
no-mistakes run-step reads "validating (running)"). crew_is_provably_working
now gets a chance to override a stale captain-relevant log line on a
new stale hash, exactly as it already did for a non-captain-relevant one.
Also fixed a separate, independently-confirmed dead code path in
fm-crew-state.sh: its cross-branch run-attribution fallback shelled out
to `no-mistakes axi` (bare) expecting a runs[N]{...} TOON table that the
real CLI (v1.32.2) never emits - verified the axi surface exposes only
abort/logs/respond/run/status. Replaced it with the real top-level
`no-mistakes runs` listing.
* no-mistakes(document): Sync watcher stale docs
* no-mistakes(lint): Fix stale fake run-list variables
* docs: clarify no-mistakes evidence commit handling (#232)
* docs: no-mistakes evidence commits in crew branches are intentional
* no-mistakes(review): Scope evidence guidance to project repos
* no-mistakes(document): Document evidence commit policy
* fix: tighten Orca backend parsing (#237)
* fix: tighten orca parser coverage
* no-mistakes(document): Sync Orca backend docs
* no-mistakes(lint): Captain, lint clean
---------
Co-authored-by: Stephen Brouhard <vesta@stephens-macbook-air.tail2122af.ts.net>
* docs: add backend setup guides and slim README (#238)
* docs: make README pointer-first, add per-backend setup guides
Trim the Quick Start and How It Works walls of prose down to overview plus
pointers, relocating every removed sentence's content into docs/architecture.md,
docs/configuration.md, or the relevant backend doc. Add docs/tmux-backend.md as
the reference-backend setup guide, and add a Setup section to each experimental
backend doc (herdr, zellij, Orca) covering prerequisites, selection, first run,
watching/attaching, verification, and limitations. Record the README convention
in CONTRIBUTING.md.
* no-mistakes(review): Clarify backend setup docs
* no-mistakes(review): Clarify tmux secondmate support
* no-mistakes(document): Align backend documentation
* docs: stop telling users to run fm-spawn.sh for backend selection
fm-spawn.sh is firstmate-internal; a user never runs it directly. Rephrase
every user-facing backend-selection sentence across the tmux/herdr/zellij/orca
guides and docs/configuration.md to present the actual user mechanisms: a
local config/backend file, FM_BACKEND at launch, or telling the first mate in
chat. Internal-reference mentions of the --backend flag (fm-spawn.sh usage
notes, test coverage lists) are left as mechanics, not user instructions.
* Document herdr dual license in docs and install hint (#239)
Add AGPL-3.0-or-later/commercial licensing note to herdr-backend Setup
and the missing-binary error in bin/backends/herdr.sh.
* feat: support multiple X-mode follow-ups (#241)
* feat(x-mode): raise X follow-up cap to 3 within a 7-day window
Matches the relay's parallel contract change: fm-x-link.sh now records a
follow-up counter (with --carry-count to preserve it across a re-link onto
a successor task), fm-x-followup.sh posts up to three follow-ups per
mention within a 7-day window instead of one within 24h, clearing the
link on --final, cap exhaustion, window lapse, or a distinguishable relay
rejection (fm-x-reply.sh HTTP 409 -> exit 9) rather than treating that
rejection as a retryable failure. AGENTS.md and the fmx-respond skill are
updated to keep usage disciplined: spend follow-ups only on genuine
milestones, always finish with --final.
* no-mistakes(review): Update follow-up dry-run docs
* no-mistakes(review): Captain: refresh X follow-up docs
* no-mistakes(review): Captain: harden X follow-up relinks
* no-mistakes(review): Captain: harden follow-up state persistence
* no-mistakes(document): Document X follow-up carryover
* feat(backends): add experimental cmux runtime backend (#246)
* feat(backends): add cmux runtime backend (experimental)
Session-provider-only adapter for cmux (bin/backends/cmux.sh), mirroring
zellij/herdr structurally, wired into fm-backend.sh and fm-spawn.sh with
--secondmate refused for now. Verified against the real cmux 0.64.17 app:
send does not auto-submit, cwd is creation-time-frozen (zellij-shape,
pwd-marker-probe workaround), close-surface refuses on a workspace's last
surface (falls back to close-workspace), workspace ids do not survive a
relaunch, and the control socket defaults to cmuxOnly access (requires a
one-time password-mode setup, documented in docs/cmux-backend.md). Also
found and fixed a live bug during development: read-screen fails on a
surface that has never been written to, so liveness now uses list-panes
instead. Fake-CLI unit suite (40 tests), a real-binary smoke test, and a
full spawn/steer/peek/done/merge/teardown E2E pass against a real claude
crewmate all pass, including the popup/second-Enter regression class.
* no-mistakes(review): Harden cmux recovery and password parsing
* no-mistakes(review): Harden cmux capture failure handling
* no-mistakes(review): Mark cmux test scripts executable
* no-mistakes(review): Scope cmux workspaces and teardown
* no-mistakes(review): Captain, honor cmux password config override
* no-mistakes(review): Captain, hash cmux home labels
* no-mistakes(document): Sync cmux backend docs
* feat(agents): add firstmate coding guidelines skill (#248)
* Add firstmate-coding-guidelines skill (AGENTS.md diet PR 0)
Encodes the knowledge-placement decision tree, one-owner rule, and
inline-stub pattern from the diet analysis so future contributions stop
adding conditional detail inline. AGENTS.md gets one section-13 trigger
line; fm-brief.sh's REPO argument has no reliable signal for "this is
firstmate's own repo", so the load instruction goes in CONTRIBUTING.md's
Development section instead of the scaffold.
* no-mistakes(review): Captain, align tracked-material trigger scope
* no-mistakes(document): Sync coding guidelines docs
* no-mistakes(lint): Fix Markdown style issues
* fix: add turn-end supervision guard (#249)
* feat: structural Stop-hook backstop for primary turn-end supervision
fm-guard.sh is pull-based: it only warns when some other supervision
script happens to run, so a primary session that ends a turn without
re-arming the watcher and then runs no further fleet-touching command
can sit blind for hours (the 2026-07-04 incident this fixes).
Add bin/fm-turnend-guard.sh, a Claude Code Stop hook registered in the
tracked .claude/settings.json, that fires on every primary turn end and
blocks (exit 2, verified empirically to force continuation) when work
is in flight with no fresh watcher beacon. It never blocks more than
once per turn, using Claude Code's own stop_hook_active loop-guard
field, and scopes itself to the actual primary checkout only (inert in
crewmate/scout worktrees and secondmate homes).
Factor the shared "in-flight but no live watcher" predicate out of
fm-guard.sh into bin/fm-supervision-lib.sh so the pull-based banner and
the push-based hook can never drift on what "unhealthy" means.
Document the verified Stop-hook mechanism and scoping in
docs/turnend-guard.md, add a harness-adapters note, and cover the
predicate and hook with tests/fm-turnend-guard.test.sh.
* no-mistakes(review): Respect active home in turnend guard
* no-mistakes(review): Require live watcher for turn-end guard
* no-mistakes(review): Captain: portable turn-end timing
* no-mistakes(document): Sync turn-end guard documentation
* feat(backends): auto-detect cmux runtime (#250)
* feat(backends): auto-detect cmux runtime from CMUX_WORKSPACE_ID
Wires cmux into fm_backend_detect the same way herdr already is: a
firstmate process running inside a cmux-spawned terminal now spawns
new tasks into cmux by default, no config needed. Verified from cmux's
own shipped source that CMUX_WORKSPACE_ID/CMUX_SURFACE_ID/CMUX_SOCKET_PATH
are unconditionally, no…
umeranjum17
referenced
this pull request
in umeranjum17/juggernaut
Oct 25, 2026
* fix(nm-drain): register and unregister checks with FM_STATE_OVERRIDE unset (#32)
* fix(nm-drain): install registers and unregisters checks with FM_STATE_OVERRIDE unset
fm-check-unregister.sh treats an exported empty FM_STATE_OVERRIDE as set, so install.sh failed at its
unregister step when a caller exported it empty. Run both calls with env -u FM_STATE_OVERRIDE, and add an
install case that exports it empty against stubs that fail if it reaches them.
* no-mistakes(document): Fix stale nm-drain test scope; lint clean
* feat(pipeline-quota-failover): run requested model first in quota failover chain (#29)
* feat(pipeline-quota-failover): requested model first, then the rest of the chain in order
B2: with the pipeline profile set to Muse 1.3 Contributor, a quota error now
fails over to GLM 5.3 Flash, then DeepSeek v4.1 Flash, instead of skipping
the chain models listed before the requested one.
* docs(pipeline-quota-failover): README states the requested-model-first order
* no-mistakes(document): docs: align pi-quota-failover header comment with requested-first order
* fix(host-memory): hold wrapped emulator and Gradle jobs at their memory-gate caps (#34)
* host-memory: move fm-mem-gate.sh and its test verbatim from Main's config
* host-memory: hold wrapped emulator and Gradle jobs at their caps; install step and CI test
The gate matched the emulator and Gradle caps on its first word only, so a job run as
flock L timeout 60 bash -c "emulator ..." started a third emulator on a cap of 2.
It now looks past timeout, flock, nice, ionice, env, exec, NAME=VALUE and bash/sh -c
to the real program. host-memory/install.sh installs the gate under
~/.local/share/fm-host-memory/, and the gate's integration test runs in CI.
* fleet-flow: read the gate policy from the installed host-memory gate when present
Once Main's config/fm-mem-gate.sh is a one-line shim, the capacity census found no
cap defaults in it. It now reads ~/.local/share/fm-host-memory/fm-mem-gate.sh when
installed, else config/fm-mem-gate.sh, and gate_source names the file read.
* no-mistakes(document): docs: name memory gate test in CI-gate list; lint clean
* feat(merge-on-green): auto-merge green yolo PRs through fm-pr-merge (#33)
* feat(merge-on-green): merge a yolo task's PR through fm-pr-merge once checks are green
Watcher check per home: for each state/<task>.meta with yolo=on and a recorded
pr= and pr_head=, gate on fm-crew-state.sh saying checks green / PR ready, then
run fm-checks-lint.sh (PASS required), verify the run receipt (PASS verdict,
head == pr_head, spawn_gen match), and merge through bin/fm-pr-merge.sh only -
no --auto, no direct gh merge, refusals never bypassed or retried in-cycle.
One wake line per merge or refusal; one merge attempt per task per head,
remembered under the add-on's own data dir; silent otherwise; every command
timeout-bounded. install.sh mirrors nm-drain/install.sh; e2e test drives a
fixture home with stub fm-checks-lint / fm-pr-merge / fm-crew-state.
* no-mistakes(review): Reserve merge budget against watcher bound before recording head
* no-mistakes(review): Remember gate refusals per head and reason; wake once
* no-mistakes(review): Align timing contract comments with budget-reservation behavior
* no-mistakes(review): Treat own timeout kills as retried no-attempts, not refusals
* no-mistakes(review): Remember timeout wakes per head and reason like refusals
* no-mistakes(review): Scope timeout-wake contract to evidence gates and merge
* no-mistakes(document): Add merge-on-green section to README catalog
* no-mistakes(ci): Fixed CI check 'Add-on self-checks' (github-check-run:117075290612), which failed ShellCheck SC2002 (useless cat) at three sites in merge-on-green/tests/merge-on-green.test.sh (lines 62, 109, 117 — the only `cat ... | wc -l` instances in the repo, verified by grep). Invariant violated: every add-on script must pass the ShellCheck gate at every severity, per the workflow's own stated policy. Root-cause fix, smallest diff: replaced `cat "$STUB_DIR/lint-calls" [2>/dev/null] | wc -l` with `wc -l 2>/dev/null < "$STUB_DIR/lint-calls" || echo 0` — the identical-count semantics were verified empirically before editing: absent file yields `0` silently (the `2>/dev/null` must precede `<` or the shell's redirect-error line leaks to stderr), existing file yields the unpiped line count, and the `|| echo 0` keeps the `before=$(...)` assignment safe under set -euo pipefail. Applied the same canonical form at all three sibling sites; no workflow exclusion was added, so the style check stays on as the gate requires. Re-traced the ordinary path: the full e2e suite (bash merge-on-green/tests/merge-on-green.test.sh) passes end to end, exercising the absent-file case (test a) and present-file cases (f/j/k); shellcheck -x -e SC2015 on the file is clean under ShellCheck 0.11.0 (stricter than CI's 0.9.0). No behavior outside the three test-count expressions changed
* feat(merge-on-green): skip merge=manual and "not proven" PRs; write the merged status line
maintainer request conditions before merge: a task whose meta says merge=manual is
skipped silently (the lead marks it at intake on destructive, irreversible or
security-sensitive work and on work waiting for the captain's own review), and
a PR whose ## Checks block says "not proven" is skipped silently (filing the
proof gap stays with the lead). Each merge appends the normal
'done [at=<epoch>]: merged <PR URL>' line to state/<task>.status and runs the
fleet-ledger hook, so leads relay it. e2e asserts cover both skips (no body
read / lint / merge / recorded attempt), not proven outside the Checks block,
an unreadable PR body waking once, and the merged line.
* no-mistakes(review): Align condition-(b) skip with the evidence gate's Checks-block grammar
* no-mistakes(review): Stop the not-proven block extraction at bare ## lines like the evidence gate
* no-mistakes(review): Anchor the not-proven skip to evidence lines like the evidence gate
* no-mistakes(review): Skip not-proven PRs from the evidence gate's own PASS
* docs: add FORK-EXIT.md, the fork-exit list for every commit not on Kun's main (#35)
* fix(merge-card): resolve bare Checks evidence names against the task folder before done-done checks them (#37)
On done-done 0.3.0 (no --citation-base) merge-card ran done-done in the work
copy, so every bare evidence name read as missing (ENOENT) even though the files
were in $FM_HOME/data/<task>; the old fallback only rewrote the verdict after the
check had already failed. Now merge-card resolves each relative name in the
Checks block itself and hands it to done-done check --from -, naming the PR
branch as --claim-id. Absolute names stay unchanged; a name still missing is
reported at its resolved path. The e2e stub now models done-done's existence
check and covers the PR 24 shape, an absolute name and a missing name.
* feat(route-change): one command moves dispatch, gate and lead pins together (#38)
* feat(route-change): one command moves dispatch, gate and lead pins to a route
route-change [--dry-run] <fm-home> <route> takes a route from the
pipeline-quota-failover chain (read from the wrapper the gate runs, via the
new PI_QUOTA_FAILOVER_PRINT_CHAIN), refuses a route quota-axi reads exhausted
or quota-failover holds out, backs up every file, moves crew-dispatch.json,
the no-mistakes gate keys and non-Claude lead pins together, then sends one
real request through pi and restores every backup when it fails.
E2E test with a fixture home wired into the add-on CI.
* no-mistakes(review): fix(route-change): match prefixed dead-file entries, keep gate-line comments, refuse unusable quota reading
* no-mistakes(review): ci: provision python3-yaml before the route-change e2e step
* no-mistakes(document): CI job comment now names the route-change test
* pipeline-literal-delete: deliver the literal-path delete rule to pipeline agents (#40)
* pipeline-literal-delete: give pipeline agents the literal-path delete rule at the runtime instruction surface
Pipeline agents never read the worker brief and the gate neutralizes repo
AGENTS.md/CLAUDE.md, so review/test/document/lint steps kept deleting a $VAR
set in an earlier command and losing the step to a delete-guard block.
New add-on delivers the worker rule once, where every pipeline agent in every
home already reads it: a pi extension appending the rule on before_agent_start
(gate agents run with project context files disabled but user extensions load)
and a Claude Code SessionStart hook whose additionalContext carries the rule.
One per-user install covers every FM_HOME and every step; idempotent, .bak
backups, dry-run, no no-mistakes config touched.
Also names the literal-path fix in the delete-guard block message itself, so
any blocked agent (pipeline or not) sees rm -rf -- /tmp/tmp.Ab12 and the
same-command mktemp form instead of retrying.
* test: silence intentional SC2016 (literal $VAR/$(...) text is the subject)
* feat(quota-failover): move limit-stopped pool workers to the next account behind account-pool-autorelaunch (#41)
* feat(quota-failover): move limit-stopped pool workers to the next account behind account-pool-autorelaunch
A worker on a pool account (account= in its meta, usable config/account-pool)
that stops on a limit now moves through bin/fm-control.sh relaunch --account
next while config/account-pool-autorelaunch exists and its tool is in the D1
set fixed in code (Claude Code, Cursor, Pi subscription logins); when that
fails the existing route move runs. Otherwise (file absent, OpenCode Go, Codex
or an OpenAI login) the account only rests once and one wake line names it and
the manual command; check.sh prints that line as the watcher's wake. An
account limit no longer takes the route out of dispatch. Codex stays rest +
wake: OpenAI's consumer terms (effective 1 Jan 2026) bar circumventing rate
limits.
* no-mistakes(review): Key pool rest+wake dedupe on worker generation and wake on rest failure
* no-mistakes(review): Guard pool rest+wake against mid-pass worker relaunch like sibling paths
* no-mistakes(review): Let route-scoped probe evidence mark pool workers' routes out of dispatch
* no-mistakes(review): Dedupe pool rest+wake per stop identity, not label text
* no-mistakes(review): Dedupe rest-failed log+wake on stop identity
* no-mistakes(document): Fix stale pool-worker docs and probe-exception wording
* zai-quota-check: ship the GLM quota wake check with the repeat-signature fix (#43)
Main's state/zai-quota.check.sh (16 Oct) as an add-on: same thresholds, 10 min
read limit, message text and file-argument test mode. Repeat fix: the 5 h step
(fp//10) joins the signature only while the 5 h condition (fp<30, left>45)
holds, otherwise the week step alone - the old fp//10|wp//10 signature woke
about 10 times per 5 h window while the week-ahead condition stayed true all
week. ZAI_QUOTA_MARK names the repeat-state file in test mode so a fixture
sequence can prove the repeat logic. Integration test wired into addons-ci.
* fleet-stall: ship the fleet stall check with the paused-reason match on reason text only (#44)
Main's state/fleet-stall.check.sh (16 Oct) as an add-on: missed-wake guard,
fleet-pause marker, zero-busy guard, 2700 s age, live-lane filter, slot
exclusion and message unchanged. Fix: the paused word list now matches the
reason text with absolute paths, URLs, key=value tokens and [key=...] stamps
removed, so a /home/fixture/users/user-019/.treehouse/firstmate-... evidence path no longer
counts a worker waiting on its own run as waiting on the lead (17:18Z false
stall for muxr and writeboost). FM_STALL_ROOT/FM_STALL_BASE default to the
live paths for the fixture test. install.sh copies the check to
~/.local/share/fm-fleet-stall and writes the home's check as an exec shim.
Integration test wired into addons-ci.
* FORK-EXIT: add the PR 84 row (watch-triage drain-ack retry, diagnostics only) (#45)
* FORK-EXIT: add the PR 84 row (watch-triage drain-ack retry + miss diagnostics)
* FORK-EXIT: name the PR 84 merged commit (5758e520) per MainLead correct
---------
Co-authored-by: firstmate worker <worker@firstmate.local>
* feat(fleet-flow): free lane slots after long external waits and add counted/dry to pulse (#39)
* fleet-flow: move Main's config/fm-flow-check.sh in verbatim
* fleet-flow: long external waits free their lane slot; --summary adds counted and dry
A lane whose last status event is paused, blocked or failed, stamped more than
4 h ago, not waiting on the captain, and still that wait in bin/fm-crew-state.sh
stops counting toward config/lane-caps in fm-flow-check.sh: the --can-start
hard cap and the over-cap line use the counted lanes, and --summary appends
counted and dry (ready = 0 and counted < cap) for the fleet pulse.
install.sh installs the check; the fixture-home test runs in Add-ons CI.
* no-mistakes(review): fix(fleet-flow): skip long-wait probes for --target by moving its exit above the probe block
* no-mistakes(review): fix(fleet-flow): drop committed pycache artifact and ignore __pycache__
* no-mistakes(review): fix(fleet-flow): dry reads working < cap per intent, docs and test aligned
* no-mistakes(review): docs(fleet-flow): add operator install and symlink runbook
* no-mistakes(review): test(fleet-flow): export PYTHONDONTWRITEBYTECODE in check test
* no-mistakes(review): test(fleet-flow): correct dry-case comment to working = 1
* no-mistakes(document): docs: scope fleet-flow dormancy claim to the reader
* no-mistakes(review): fix(fleet-flow): tolerate non-UTF-8 crew-state probe output
* no-mistakes(document): docs: record flow check exit in FORK-EXIT list
* delete-guard: accept plain $NAME and ${NAME} in a same-command mktemp template (#46)
* delete-guard: wake Main only for literal-path blocks outside temp and scratch folders (#47)
The check now wakes only for a block whose target is a literal path, or a
variable the same command set to one, outside temp and scratch folders, from
an agent not itself working in one, and not a repeat the guard already woke
on. Every other block is counted per UTC day in state/delete-guard.counted for
the daily fleet summary. guard.mjs and the blocks are unchanged.
The test replays the 16 Oct log one sweep per row and asserts the only wake is
the 14:22 /home/fixture/users/user-019/mt-test block.
* feat(claude-quota): wake on the burn rate only under 40% of the week, with an install shim (#48)
* claude-quota: add Main's state/claude-quota.check.sh verbatim
Moved from /home/fixture/users/user-019/firstmate/state/claude-quota.check.sh (16 Oct 12:27) unchanged, so the next commit shows only the rule change.
* claude-quota: wake on the burn rate only under 40% of the week, and ship an install shim
Captain 16 Oct 15:00Z: Opus (effort medium) may take build work while the Claude week is at or above 40%, but the
state copy's burn-rate wake ('no new Opus workers') fired on every 10% step of the 5 h window or the week, 14 times
on 16 Oct. The burn rate alone no longer wakes; under 40% one week wake names the action (no new Opus build workers,
leads to the GLM/Go mix, Main reports to the captain) and carries the rate. The 5 h rule is unchanged.
install.sh writes Main's state/claude-quota.check.sh as an exec shim with a backup and re-registers it; the test
replays 16 Oct's readings and drives the install.
* fix(delete-guard): require mktemp delete variable to use the agent's own name (#49)
* delete-guard: rule text and block message name the own-variable requirement
The 21:08:45Z block set TMP=$(mktemp -d ...) and deleted "$TMP" in the same
command: correctly refused (SHELL_VARS never trusts a runtime name - an
inherited value would be deleted), but the rule text and block message never
said the variable must be the agent's own, so the agent could keep retrying
with TMP. One clause in the rule (rule.txt, README, block message); one
blocked and one allowed test case for the reduced shape.
* no-mistakes(document): Fix stale block-message description; lint clean
* fix(claude-quota): week wake fires at or under 40% left, not under 40 (#50)
The captain rule is 40% of the week LEFT: above 40% left stays quiet,
at or below 40% left fires once with the mix change. The check had
low = wp<40, so exactly 40% left stayed quiet. Now wp<=40, wake text
and comments say 'at or under 40% left' (LEFT, never 'use'), the 5 h
rule is unchanged, and the replay covers 41% left (quiet), 40% left
(one wake) and 39% left (no second wake right after 40).
* feat(glm-queue): queue GLM calls locally to cap concurrent Z.AI requests and stop 1302 refusals (#36)
* feat(glm-queue): one local queue in front of Z.AI so GLM calls wait instead of drawing 1302
* no-mistakes(review): Validate GLM_QUEUE_MAX loudly at proxy startup and install.sh
* no-mistakes(review): Add upstream idle timeout, end client response on stream error
* no-mistakes(review): Destroy client socket on truncated upstream responses for fast failure
* no-mistakes(review): Test truncated upstream response fails fast, slot drains
* no-mistakes(document): Document glm-queue fast-fail contract and full test coverage
* no-mistakes(review): Bound glm-queue test clients with timeouts so a wedged queue fails named, not hung
* feat(git-identity): pin lane git identity and refuse pushes of commits made as anyone else (#52)
* feat(git-identity): pin lane git identity and refuse pushes of commits made as anyone else
* docs(fork-exit): cite fork PR 90 for the launch-env hook
* no-mistakes(review): Fix pre-push guard to refuse uninspectable pushes; correct README leak PR list
* feat(fleet-flow): take FM_BIN for the fork helper libraries ahead of the fork shim (#53)
* feat(fleet-flow): take FM_BIN for the fork helper libraries ahead of the fork shim
The fork's bin/fm-flow.sh becomes a thin shim that execs this reader with
FM_BIN pointing at the fork bin/, so the reader resolves fm-classify-lib.sh,
fm-tasks-axi-lib.sh, fm-backlog-transition-lib.sh and the fm-tasks-axi.sh
consumer from ${FM_BIN:-its own directory}, exactly like fleet-dashboard.
The moved test now requires FM_BIN and drives the fork's model/skill readers
from it; the README tells the shim story and retires the parity section.
* docs(FORK-EXIT): cite the merged-flow fork shim PR for the fleet-flow row
* parked-homes: one shared reader parks a secondmate home for every supervision producer (#42)
* feat(parked-homes): one shared reader parks a secondmate home for every supervision producer
config/parked-homes lists parked home ids; the add-on's fm_parked_home reader
gates the supervision session (fm-send steer/answer/nudge), relaunch
(fm-control, remote relaunch, secondmate restart pass), reconcile and reread
nudges, config push (fm-config-push + bootstrap CONFIG_REREAD), pending-reply
retries, the model-outage scan, the wake-loop stall check, and quota-failover.
A parked home gets one log line per skip and nothing else; the fork hook PR
carries only the shim and one predicate call per producer (FORK-EXIT row).
The e2e drives a fixture fleet of two homes, one parked, through every path.
* style(parked-homes): inline the e2e EXIT trap for ShellCheck 0.9 (CI)
* fix(parked-homes): initialize locals in fm_parked_meta_id (set -u) and honor FM_CONFIG_OVERRIDE as the config dir
fm_parked_meta_id declared kind/home/fixture/users/user-015 without values and used an undeclared
line, so under the set -u producers (fm-watch, quota-failover) a meta without
kind= printed unbound-variable noise every pass and a remote secondmate meta
without home= aborted instead of being reported parked. The lead review found
it; both cases are now e2e cases run under set -u. fm_parked_homes_file also
treats FM_CONFIG_OVERRIDE as the config directory itself (the fork-wide
override convention) instead of appending /config twice.
* docs(fork-exit): rows for merged fork PRs 86, 91, 92; mark PR 90 merged (#54)
* README: a one-minute top for new users (#55)
* README: a one-minute top for new users
One-line purpose, who the add-ons are for, one plain line per add-on
with how it wires in, the shortest true install (a loop verified with
--dry-run against a throwaway home), one ran check command per add-on,
and per-add-on removal. The long per-add-on sections move under
Details unchanged.
* README: per-add-on list instead of a table, so phones render it without a cut column
* README review: standalone intro, upstream wording, plain-words add-on one-liners
* README: remove owner details; agnostic for any Firstmate user
* Scrub owner details from add-ons: generic paths, identities, history (#56)
* feat(owner-guard): refuse commits and pushes matching private owner-details patterns (#57)
* Add owner-guard hook: refuse commits and pushes matching private owner-details patterns
New owner-guard add-on shaped like delete-guard: a pre-commit and
pre-push guard matched against the home's private
config/owner-details-patterns (mode 600, never committed), chained
through a new hooks.d hook point in git-identity so every lane
commit runs it. Refusals print file:line plus a placeholder hint
and are final. Fixture test covers refused and clean commits,
refused push, removal-only pass, repo-hook chaining, and the
missing-patterns note.
* no-mistakes(review): Fix owner-guard new-push deadlock, root scans, diff parsing, fail-open
* no-mistakes(review): Scope guard matching to added content only; fix installer comment
* no-mistakes(review): Remove OWNER_GUARD_PATTERNS override; home patterns file only
* no-mistakes(document): Document hooks.d chaining; fix owner-guard shellcheck failures
* no-mistakes(document): Document hooks.d chaining in usage header; tighten owner-guard README
* no-mistakes(document): Wire owner-guard fixture test into CI
* fix(owner-guard): scan added lines that follow a missing trailing newline (#58)
* Fix owner-guard marker match: scan the line after a missing trailing newline
* no-mistakes(document): Fix owner-guard newline scan; add missing README row
* no-mistakes(document): Revert README owner-guard row; lints pass
* feat(owner-guard): daily scan of public repos for owner details (#59)
* feat(owner-guard): daily scan of public repos for owner details
Adds scan-check (once-a-day shallow clone of every fleet public repo,
matched against the private patterns file; one wake line with hit counts
and a private file:line report), install-scan.sh in the fleet-stall shape,
scan-e2e.sh fixture proof, and the README wiring.
* fix(owner-guard): detached scan loop and silent due run
The clone loop cannot finish inside the watcher timeout, so a due run
records the marker, starts the loop detached, and returns with no output.
A finished loop with hits leaves one wake line under state for the next
run to print once. Proof extended for the detached flow.
* fix(owner-guard): keep scan run dir and report owner-only
umask 077 so the copied patterns, the report and the result file are
never group- or world-readable; e2e asserts the report is mode 600.
* feat(owner-guard): extend owner-details guard to plain-shell commits and pushes via global hooksPath (#60)
* Guard owner details in plain-shell commits and pushes via global hooksPath
Point the user's global core.hooksPath at generated per-hook wrappers:
pre-commit and pre-push run the guard first, then chain the previous
global hooks dir and the repository's own hook. Install stays idempotent,
records a replaced global value instead of dropping it, and uninstall
restores it; repo-local config is never touched. Fixture tests cover
plain-shell and lane refusals, clean pass-through, hook chaining, double
install and uninstall.
* Document pipeline push bypass as a known owner-guard limit
The pipeline pins a per-worktree hooksPath and pushes with hooks
skipped, so only its own authored commits are unguarded.
* no-mistakes(review): Pin GIT_CONFIG_GLOBAL in owner-guard tests; assert real hooksPath unchanged
* feat(owner-guard): chain server-side hooks with byte-exact stdin replay (#61)
* fix(owner-guard): chain receive hooks in local bare repos under the global hooks dir
* no-mistakes(review): Replay stdin via here-string so chained hooks' verdicts win; dedupe stdin hook list
* no-mistakes(review): Add post-rewrite to stdin replay set so chained consumers all get git's input
* no-mistakes(review): Capture hook stdin to temp file for byte-exact NUL-safe replay
* no-mistakes(document): Document server-side hook chaining in owner-guard README
* feat(owner-guard): refuse PR merges that add owner details via the home merge gate (#62)
* feat(owner-guard): refuse PR merges that add owner details via the home merge gate
The no-mistakes pipeline pushes its own fix-round commits with client hooks
skipped, so a leak it authors is never checked at commit or push time.
owner-guard now has a merge-gate mode for the home's config/merge-gate
contract: it fetches the PR's exact head and base branch into a scratch
repo and scans every line the PR adds against their merge-base with the
same patterns and refusal text as the commit/push guard. Forge or fetch
failures refuse (nothing merges unscanned); a missing patterns file allows
with one note. install.sh chains the home's existing merge gate behind the
scan (moved aside, restored on uninstall), idempotently.
* no-mistakes(document): Fix merge-card docs for owner-guard merge-gate chaining
* no-mistakes(document): README Check/Remove list owner-guard tests and uninstall
* chore: update pull request (#64)
* feat(pipeline-quota-failover): fail GLM over to Claude Haiku 5.5
The default chain was GLM 5.3 Flash, Go Muse, DeepSeek; Go is locked and
DeepSeek is out, so a quota-dead GLM left the pipeline with no model.
The chain is now zai/glm-5.3-flash, then claude-bridge/claude-haiku-5-5:
GLM stays first, Claude Haiku 5.5 only as its failover, never Opus,
Sonnet, Fable or Step 5.
pi does not list Haiku 5.5 under claude-bridge yet; it runs the id as a
custom model and Claude Code serves claude-haiku-5-5. claude-bridge words
a Claude subscription limit as "Claude rate limit (...): You're out of
extra usage", which matched no quota pattern, so a quota-dead Haiku
would have passed through instead of ending in "quota exhausted"; both
phrasings now count as quota errors.
route-change's journeys pin their own three-route list so they keep
testing route switching independent of the default chain.
* feat(pipeline-quota-failover): skip a quota-dead model for an hour
A dead GLM spends 13-16 min in pi's own retries before the wrapper sees
its quota error, so after GLM runs out every pipeline call would wait
that long before reaching Haiku 5.5. A quota error now leaves a marker
(model and time) under the wrapper's state dir, and later calls skip
that model for PI_QUOTA_FAILOVER_DEAD_SECS (default 3600); after the
window it is tried again, and an answer without a quota error clears
the marker. With every model inside its window the call fails at once
with the terminal "quota exhausted" line and no pi call.
zai-quota-check's advice no longer says to set the pipeline to Muse or
"never Claude for reviews": the pipeline fails over to Claude Haiku 5.5
on its own.
* no-mistakes(document): Align README with skip-window failover; lint clean
* fix(owner-guard): stamp absolute tool paths into hooks and refuse scans on missing tools (#65)
* fix(owner-guard): run hooks without PATH lookups for bash
The global guard hooks started with `#!/usr/bin/env bash`, so every ref
update (git branch fires reference-transaction) failed with
"env: bash: No such file or directory" under a PATH without bash.
install.sh now writes the absolute bash path into each installed wrapper
and copy of owner-guard, plus absolute cat, mktemp and rm paths for the
wrapper, resolved at install time. Chained hooks still get the caller's
environment unchanged.
The scan refuses by name when a scan tool (grep, sed, awk, ...) is not on
PATH, so a missing tool can never read as "no match".
Tests: the global test adds a git-only PATH case (git branch passes, a
commit is refused naming the missing tool). Proof: learn-from-mistakes
apply test with a PATH holding every system tool except bash fails on
main's guard (4 env: bash lines) and passes on this change.
* no-mistakes(document): docs(owner-guard): scope stamped-path claim, list git-only-PATH test
* feat(fleet-dashboard): newest-first asks with sort toggle and typed filter (#66)
* feat(fleet-dashboard): newest-first asks with sort toggle, type tags and type filter
* feat(fleet-dashboard): live Needs you list gets newest-first, sort toggle, type tags and filter
* no-mistakes(review): ask-type rule: pick/choose verbs, approv/merg stems, dual option markers
* no-mistakes(review): Add visible keyboard focus ring to static ask controls
* no-mistakes(document): Update dashboard fork-provenance docs for asks change
* feat(bearings-board): add the Bearings board as a standalone dormant add-on (#63)
* feat(bearings-board): add the Bearings board as a dormant add-on copy
Standalone copy of the fork's Bearings board script and template, with the
milestone fields, evidence thumbnails, home-board links and reconcile choice
the fork's 9ad8e1fb and 08472745 added. It runs against any Firstmate home
named by FM_HOME and calls that home's own lifecycle helpers.
The test is a new behavior suite over stub helpers and a stub lavish-axi;
the fork's process-event and live-Lavish tests stay on the fork. FORK-EXIT
moves the row to dormant copy, fork shim next.
* no-mistakes(review): wire bearings-board test suite into addons CI
* fix(bearings-board): wrap the Captain's Call header at 390 px and show only the last path segment for repo names
The Captain's Call header wrapped its label off-screen at 390 px. Project names
that arrive as a path now show only their last segment, so no home path is shown.
* no-mistakes(document): Aligned FORK-EXIT bearings status punctuation; docs and lint verified clean.
* test(bearings-board): use a placeholder user in the home-path example paths
The owner-details guard refuses the real home user name in the test's example
paths. The example paths now use the placeholder 'you'; the test's meaning is
unchanged.
* fix(fleet-dashboard): wrap long ask text and tag multi-option asks as pick (#67)
* fix(fleet-dashboard): wrap long ask text and tag multi-option asks as pick
Long unbroken URLs in an ask pushed the age past the right edge at 390 px;
the text cells now wrap (overflow-wrap:anywhere, min-width:0) in the static
page, the Needs you view and the overview card.
Ask type reads an optional type column (yn|pick|approval) before the wording,
falling back to inference when it is empty or unknown. The wording rule now
tags three or more comma-separated choices ending in 'or ...?' and single-letter
option markers ('A Foo, C Bar') as pick; plain yes/no wording stays yes/no.
* no-mistakes(review): Document captain-asks.tsv optional fifth type column in fleet-dashboard README
* no-mistakes(document): Ask-type docs already consistent; all lint checks pass
* chore(bearings-board): remove dormant bearings-board add-on (#68)
* chore: remove the bearings-board add-on
Kun's plain board (bin/fm-bearings-board.sh) is the fork's Bearings board.
Nothing in the repo, the live homes, scripts or systemd units calls the
add-on, so drop its folder, its README line, its CI test step and its test
command, and point the FORK-EXIT.md Bearings row at Kun's helper.
* no-mistakes(review): Mark Bearings row dropped in FORK-EXIT.md
* no-mistakes(document): Document Bearings add-on drop and dropped status
* fix(fleet-flow): read captain holds from the backlog in the flow check (#69)
fm-captain-hold.sh hold records the hold on the task's backlog line, not in
the status file, so a captain-held lane still flagged red. A lane whose open
backlog item carries hold-kind captain (active until hold-until) is now
captain-held: no wait or red line. The status-key path is unchanged.
* refactor(sentinel): replace the copied restart supervisor with a thin wrapper (#70)
The sentinel script and its two tests were a verbatim copy of the Firstmate
checkout's files. The add-on now holds only a wrapper that runs the checkout's
bin/fm-sentinel.sh with the same argv, plus a hermetic wrapper test. Copied
upstream lines in sentinel/: 450 before, 0 after.
* refactor(signoff): remove the copied sign-off adapter; add-on holds no code (#71)
* refactor(signoff): remove the copied sign-off adapter; add-on holds no code
The adapter and its journey test were a verbatim copy of Firstmate files (fork
commit 0689b4b9). Upstream has since dropped the sign-off source, and its runner
cannot dispatch an add-on adapter, so the copy cannot run. Removed here, and the
upstream seam is written up for the lead. Recoverable at 33a8de8.
Overlap with current upstream main: 0 whole-line matches before (238 counted
lines), 0 after; the signoff/ folder holds only README.md.
* fix(signoff): restore the sign-off adapter as a thin layer on the Firstmate checkout
The adapter is our own logic and stays in the add-on, dormant until the fork
dispatch hook lands. It now resolves the runner, the keyed-answer intake and the
libraries from the Firstmate checkout (FM_CODE_ROOT, default FM_HOME), not from
its own directory. Its test sources tests/lib.sh from that checkout.
Copied upstream lines: 0 whole-line matches against kunchenguid/firstmate main
c7b7798 in signoff/ (12 idiom lines and 5 test lines rewritten to equivalent
forms; the beads fixture is our own, since upstream exposes no sourceable helper).
The ack-contract drift between upstream and the fork is in the seam record.
* fix(pipeline-quota-failover): skip exhausted routes and fail over on silent calls (#72)
* fix(pipeline-quota-failover): skip exhausted routes and fail over on a silent pi
Before each route, ask quota-axi for its provider; an exhausted_now runway
skips the route without a call and writes its dead marker. quota-axi missing,
slow (10s cap) or failing leaves the route to be tried as before.
A pi call with no stdout and no stderr for PI_QUOTA_FAILOVER_IDLE_SECS
(default 300) is killed (TERM, then KILL) and counts as a quota failure.
A dead marker is cleared only when the attempt answered (exit 0, no
errorMessage); a kill, timeout or other failure keeps it.
* no-mistakes(review): skip routes only on structured exhausted_now match
* no-mistakes(review): add SIGINT idle-path test, real quota-axi rejection stub
* no-mistakes(review): Signal pi's process group on idle and forwarded signals
* fix(pipeline-quota-failover): skip exhausted routes and fail over on a silent pi
Before each route, ask quota-axi for its provider; an exhausted_now runway
skips the route without a call and writes its dead marker. quota-axi missing,
slow (10s cap) or failing leaves the route to be tried as before.
A pi call with no stdout and no stderr for PI_QUOTA_FAILOVER_IDLE_SECS
(default 300) is killed (TERM, then KILL) and counts as a quota failure.
A dead marker is cleared only when the attempt answered (exit 0, no
errorMessage); a kill, timeout or other failure keeps it.
* no-mistakes(review): skip routes only on structured exhausted_now match
* no-mistakes(review): add SIGINT idle-path test, real quota-axi rejection stub
* no-mistakes(review): Signal pi's process group on idle and forwarded signals
* no-mistakes(review): Stop failover when signalled during idle-kill grace
* no-mistakes(review): install signal traps before forking pi
* test(pipeline-quota-failover): fix ShellCheck SC2034 and SC2261 in e2e test
* no-mistakes(review): Forward received INT or TERM to pi; kill orphaned sleep in test 9h
* no-mistakes(review): stop path escalates to KILL, exits 128+signal
* no-mistakes(review): Drop signal forwarding; idle kill signals pi's full tree
* no-mistakes(review): no changes; both findings not legitimate on current code
* no-mistakes(review): Forward INT to pi and wait full grace before KILL
* no-mistakes(review): Simplify run_watched reap loop to single wait
* no-mistakes(document): Document quota pre-check and idle watchdog; fix SC2086
* feat(sentinel): restore the sentinel as the add-on's own code, with install and uninstall (#73)
Restores bin/fm-sentinel.sh from the fork's current file (origin/main of
umeranjum17/firstmate) under sentinel/bin, and removes the PR 70 wrapper and
its test. The sentinel calls the host tool's scripts and libraries from
$FM_HOME/bin and copies none of them.
Adds install.sh and uninstall.sh: install copies the sentinel to the data dir
and points the fm-sentinel user unit at that copy for one home, restarting
the service in the same step; uninstall restores the unit recorded before the
first install and restarts on it. Both are idempotent, and install takes
--dry-run.
Slice 1. The restart tests (dead relaunch, restart resume, live e2e) follow
in slice 2 from commit d670f4e, which holds them.
The fork's reconcile loop guard becomes two `|| continue` statements instead
of one `&&` test, the same logic, so no run of three lines matches upstream.
* fix(pipeline-quota-failover): a stall is not a quota error (#74)
A pi call silent for the idle window was counted as a quota failure, so
the route got a dead marker for 3600s and the whole chain had no model
under host load. A stall now moves on to the next chain model for that
call only and writes no marker; only a real quota error or quota-axi
exhausted_now marks a route dead. A chain that only stalled fails without
the terminal 'quota exhausted' line, so the pipeline may retry it.
The skip log shows the time left for a future-dated marker instead of a
negative age.
* test(sentinel): move the restart tests into the add-on (#75)
Slice 2 of the sentinel restore. Brings the three restart tests from the fork
onto the add-on: dead relaunch (runs without a live host), restart resume (a
real-Herdr lab), and the live Herdr e2e (opt-in). Each sources the fork
checkout's tests/lib.sh through FM_UPSTREAM_ROOT and runs the add-on's
bin/fm-sentinel.sh. Fixture homes symlink the checkout's bin/ because the
sentinel runs the host tool's scripts from FM_HOME/bin.
Only dead-relaunch runs here. restart-resume and the live e2e skip without a
live Herdr and a signed-in Claude.
* fix(fleet-stats): source fm-wake-lib.sh from the Firstmate checkout, not the add-on (#76)
The outcome recorder sourced a sibling fm-wake-lib.sh that only exists in the
fork tree. Source it from FM_BIN, else $FM_HOME/bin, and exit 2 with the path
when it is missing. The library is not copied into the add-on.
* feat(backlog-lock-reclaim): reclaim a 0-byte backlog lock left by a dead tasks-axi writer (#77)
tasks-axi 0.2.6 creates <backlog>.lock with wx and writes its token after;
a writer killed between the two leaves an empty lock that is never reclaimed,
so every later write fails LOCKED. This add-on's watcher check removes a
0-byte lock older than 60 s that no process has open, logs the reclaim, and
prints one wake line. Install and uninstall are delete-guard style.
* fix(fleet-flow): a paused lane whose own run is executing counts as busy (#78)
A lane that waits on its own no-mistakes run writes paused:, so the flow
check's working count (field 3 of --summary, read by the fleet-stall
zero-busy guard, and the --can-start spawn gate) left it out. crew-state reads
the same lane's run-step as working. Probes ran only for paused lanes older
than 4 h and only freed slots, so a busy paused lane never counted.
Paused lanes are now probed at any age; a paused lane whose crew-state reads
working is busy. Blocked and failed waits keep the 4 h rule. fleet-stall gives
the check 20 s, above its 15 s probe deadline, so a slow probe does not read
as no answer.
Repro: fleet-flow test (working count and --can-start) and fleet-stall e2e
(no muxr 0-busy line). Both fail on origin/main.
* fix(pipeline-quota-failover): idle limit 120 s and one retry for a stalled last route (#79)
* fix(pipeline-quota-failover): set the idle limit to 120 s from measured Haiku streams
pi in --mode json streams text and thinking deltas as they are produced:
two Haiku 5.5 calls on a 103 KB review prompt gave 1390 and 1574 events,
with the longest mid-stream gap 12 s. The longest gap of the whole call was
26 s, before pi's first event. So idle is a real liveness signal and the
watchdog stays, but 300 s was far above what a live call ever goes silent for.
120 s is about 4.5x the worst measured gap.
A route that stalls now fails over after 2 min instead of 5. The stall still
writes no quota marker. Adds an e2e case: a route that streams for longer
than its idle limit is not killed.
* fix(pipeline-quota-failover): retry a stall once on the last route
Measured stalls on Haiku were silent calls: no byte on stdout or stderr for 300 s,
then killed. They cluster in time and carry no quota text. When the stalled route
is the last live one, the call failed on its first attempt, and no-mistakes does
not retry a wrapper stall. A stall on the last route now gets one more try on the
same route before failing. A second stall fails as before. e2e 9o covers a route
that is silent on its first call and answers on the next.
* fix(pipeline-quota-failover): GPT-6 Luna fallback, pi without pi-hermes-memory, codex quota mapping (#80)
* fix(pipeline-quota-failover): default fallback is GPT-6 Luna, quota-axi codex mapping, log successes
The claude-bridge Haiku route left the default chain: every pi start waits on
pi-hermes-memory's session_start persistence sync, and the 120 s no-output
watch killed those starts. The chain is now GLM 5.3 Flash, then
openai-codex/gpt-6-luna.
quota-axi knows the openai-codex provider as codex, so the pre-check maps the
pi name before asking; it no longer exits 2 for the fallback route.
Each successful call writes one log line with the model, duration and bytes.
* fix(pipeline-quota-failover): run pi without pi-hermes-memory
pi-hermes-memory's session_start sync runs before pi emits agent_start and kept
pipeline calls silent for 5 s to 134 s on this host, so the 120 s watch killed
them. Every wrapped call now runs pi with -ne plus -e for each extension pi
would load except pi-hermes-memory: user packages from pi list, the user
extensions dir (fm-rm-guard, fm-literal-delete), settings extensions, and the
built-ins minus any settings turn off. An unreadable list runs pi as before
with one log line.
Proof: GPT-6 Luna large review through the wrapper, 17.4 s total, session
header 1.0 s after pi starts, agent_start 82 ms later.
* refactor(pipeline-quota-failover): compact the extension set code and tests
Same behaviour as the previous commit: one listing helper and the built-in list
inline, shorter comments and README, and a smaller extension test block. Keeps
the PR under 300 changed lines against main.
* supervisor-guard: own the supervisor-work guard, zero copied upstream lines (#81)
* feat(supervisor-guard): own the supervisor-work guard; install and uninstall; drop upstream copies
The add-on owns the supervisor-work guard, which upstream Kun does not ship. The
upstream-copied transport and test lines are gone: the scope predicate and the
shell lexer are read from the Firstmate checkout the hook is installed for.
install.sh copies the guard to the user's data dir and merges one PreToolUse
Bash hook into ~/.claude/settings.json; uninstall.sh removes it. Both are
idempotent, take --dry-run, and back up what they change. The guard stays
inert outside a supervisor home and fails open on any missing piece.
* no-mistakes(review): Harden hook array expansion, uninstall no-op, tests, docs
* no-mistakes(review): Drop unused hook args, restore prefilter, align docs
* no-mistakes(review): strip newline continuations from supervisor prefilter
* no-mistakes(review): Remove Grok toolInput fallback from pretool hook
* refactor(supervisor-guard): export decision inline; drop the copied-looking export line
* feat(kill-guard): block kill, pkill and killall outside the caller's own tree (#82)
* feat(kill-guard): block kill, pkill and killall outside the caller's own tree
A worker killed the systemd user manager as a "stray" parent on 18 Oct and
every lane and lab on the host dropped. kill-guard/ is the guard that stops
it: kill, pkill and killall (any signal, kill -9 included) may signal only the
caller's own descendants, found from /proc. PID 1, the systemd --user manager
and the herdr server are always refused, and so is any target the guard cannot
resolve (a $VAR, %job, xargs input, an unknown PID or a pattern it cannot read).
A refusal names the target and tells the worker to write blocked:.
Same hook wiring as delete-guard: guard.mjs (the rule and the Claude hook CLI),
a pi extension, an OpenCode plugin, and install.sh. The Claude hook passes
--caller $PPID so the agent's children are the ones allowed. The e2e test
signals only sleep children and fake named processes it starts itself.
The watcher check and block log are a second slice.
* no-mistakes(review): strip redirections from kill operands; execute adapters in tests
* no-mistakes(review): Close kill -l and unreadable-/proc bypasses
* no-mistakes(review): Judge wrapped kills and refuse ambiguous pkill patterns
* no-mistakes(review): Close nested substitution, killall path and wrapper bypasses
* no-mistakes(review): Trim kill guard to intent, drop heredoc bodies
* fix(kill-guard): judge shell heredoc bodies; narrow heredoc delimiters
Only a letter or underscore delimiter opens a heredoc, so $((1<<2)) never drops a line.
A body fed to bash, sh, zsh or dash is kept and judged, since the shell runs it.
* fix(kill-guard): compare realpaths in the hook entry check; document known gaps
A symlinked install dir made argv[1] differ from the resolved module path, so the hook
exited 0 and allowed every command. The e2e journey now runs the hook through a symlink.
* chore(kill-guard): drop the known-gap README and a repeated PID 1 case
Known gaps move to the PR body; the PID 1 rule stays proven by the sh -c, installed hook and adapter cases.
* no-mistakes(review): Fix kill -l signal-list parsing
* no-mistakes(review): Trim kill guard below the 300-line cap
* test(kill-guard): drop the unused argument pass-through in the install helper
ShellCheck (SC2119/SC2120) flagged inst() forwarding "$@" that no call passes.
* Support multiple supervisor guard homes (#83)
* fix(kill-guard): close the parser bypasses that slice 1 left open (#84)
* docs: correct fork exit audit facts (#85)
* Retry stalled final quota-failover route three times (#86)
* Add uninstall scripts for first add-on slices (#87)
* fix(kill-guard): load in compiled pi, ask for the literal PID, treat quoted text as data, add uninstall.sh (#88)
The pi extension failed to load in the compiled pi binary: guard.mjs's entry check ran realpathSync on argv[1], which is /$bunfs/root/pi there. An argv[1] that does not resolve is now just not this file.
A kill whose PID the shell sets ($pid, $!, %1, $(...)) now asks for the literal PID instead of a final block; a final block anywhere in the command still wins.
Heredoc writes to a *.sh file are data; an unquoted heredoc's $( ) and backticks are checked.
uninstall.sh removes the rule, adapters, the disabled/ pi copy and only the kill-guard hook (backup, --dry-run).
* Add uninstall scripts for next add-on slices (#89)
* Add uninstall scripts for next add-on slices
* Label uninstall test evidence distinctly
* Unregister shared checks through Firstmate
* Weight heavy memory-gate scopes against app.slice (#90)
* Scope heavy memory-gate jobs in weighted slice
* Weight heavy scopes against app slice without replacing caps
* Add uninstallers for remaining add-on slices (#91)
* Allow kill guard targets in task worktree (#92)
* feat(parked-homes): add refusal and skip gates (#93)
* feat(parked-homes): add refusal and skip gates
* test(parked-homes): keep fallback checks shellcheck-clean
* docs(parked-homes): keep fork inventory out of add-on repo
* host-memory: expose optional sampler lifecycle library (#94)
* Protect Herdr from CPU-heavy pane jobs (#95)
* Add fleet read guard for agent tools (#96)
* Add fleet read guard
* Block reads through protected directories and code paths
* Allow non-secret runtime state reads
* read-guard: block only real login paths and path fields (#97)
* read-guard: block only real login paths and path fields
Wildcard-only fragments such as bold markers matched every protected
file, and non-bash tools scanned body text like content. A fragment is
now a glob only when it is rooted at a slash or at a home-relative
prefix, and non-bash tools scan only path-like fields. Adds tests for a
markdown heredoc, a Pi-style write, and a glob through a wildcard home.
* read-guard: scan find patterns as paths too
Pi's find tool takes a glob pattern, so the pattern field is scanned for
find as well as glob. Adds a test for a home-rooted codex login glob.
* read-guard: stop false matches on text-only commands and doc-comment openers (#98)
* read-guard: block only real file access, not text-only commands or doc-comment openers
A bare doc-comment opener fragment is no longer a root-wide glob: a path
glob now needs a literal segment. echo, printf and fm-send.sh may name a
login path as text; substitution, redirects and a ';' chained read still
block. Adds regression cases for both false matches.
* read-guard: a pipe in the command ends the text-only exemption
printf or echo of a login path piped to xargs cat or sh passed the text-only
exemption and then read the file. The exemption now needs the whole command
to have no pipe, backtick, substitution, or redirect.
* Skip captain-held lanes in land actions (#99)
* fix(pipeline-quota-failover): default failover chain to claude-haiku-5-5 (#100)
* pi-quota-failover: default failover to claude-bridge Haiku 5.5 instead of GPT-6 Luna
Both chain models were out of quota, so every fleet pipeline call failed.
Haiku through claude-bridge becomes the GLM failover. The e2e suite pins
the GLM -> GPT-6 Luna pair for its failover cases and checks the new
default chain.
* no-mistakes(review): Reword stale GPT-6 Luna failover comment in wrapper
* feat(pipeline-quota-failover): own idle limit for claude-bridge models (#101)
Add PI_QUOTA_FAILOVER_BRIDGE_IDLE_SECS (default 300) for claude-bridge/*
models; PI_QUOTA_FAILOVER_IDLE_SECS (default 120) keeps applying to every
other model. The kill log line and stall detail name the limit used.
Fleet logs show Haiku calls over claude-bridge answering in 30-166 s, so the
120 s limit killed slow answers and failed whole sign-off reviews.
Tests: e2e cases for a silent bridge route under its limit (not killed), a
silent non-bridge route over its limit (killed), and the bridge kill naming
its own limit.
* feat(pipeline-quota-failover): add DeepSeek Flash to the failover chain (#102)
Default chain is now zai/glm-5.3-flash, deepseek/deepseek-flash, then
claude-bridge/claude-haiku-5-5. quota-axi answers provider deepseek with
no exhausted scope, so the pre-check passes it through unchanged.
* fix(pipeline-quota-failover): DeepSeek hop, GLM off the chain, quota failures move on (#103)
- DeepSeek gets its own idle limit (PI_QUOTA_FAILOVER_DEEPSEEK_IDLE_SECS,
default 300); the generic 120 s watch killed its slow first answers and
moved every call to Haiku.
- Default chain is DeepSeek Flash then claude-haiku-5-5; GLM is removed.
- QUOTA_RE matches Z.AI balance and rate-limit texts and DeepSeek's
Insufficient Balance, so those move on instead of ending the run.
- A call pinned outside the chain runs the chain in chain order, so a
Codex-pinned fix step cannot bypass the failover.
- e2e journey covers the DeepSeek hop, the GLM-free chain, and GLM
quota failures that move on.
* feat(bearings-board): run the Bearings board from the Firstmate checkout as a thin wrapper (#104)
* feat(bearings-board): thin wrapper over the checkout's board (slice 1)
Runs the Firstmate checkout's bin/fm-bearings-board.sh unchanged: no copied
upstream code. Dormant until wired by install.sh. Extras (projects strip,
underway/landed rows, Captain's Call cards, evidence thumbnails) follow in
later slices.
* no-mistakes(review): fix bearings-board install order, uninstall launcher safety, recursion guard, arg forwarding
* no-mistakes(review): uninstall no longer restores a backup naming the launcher
* no-mistakes(review): Found all review findings already fixed; corrected remaining doc claims
* no-mistakes(review): Verified hook symlink/mode and hook-ownership fixes already hold
* no-mistakes(review): install leaves launcher-naming hooks alone; uninstall drops backup grep
* no-mistakes(review): Test install rerun and dry-run paths; warnings already fixed
* no-mistakes(document): Fix bearings-board install doc facts; shellcheck pass
* fix(claude-model-guard): allow Sonnet, keep Fable refused (#105)
* merge-card: move fork merge gate and post-merge hook into the add-on (step A) (#106)
* WIP: extract merge-card adapters and stage integration journey
* test: retain failed merge fixtures and create their data directory
* feat(account-pool): launch-side pool pick and fm-spawn hook as an add-on (fork exit 7, slice 1) (#107)
* feat(account-pool): launch-side pool pick and fm-spawn hook events as an add-on (slice 1)
* test(account-pool): use the exact hook setup line
* lead-wake: move the fork's lead-wake policy into an add-on behind one watch-policy seam (step A) (#109)
* merge-card: refuse a PR merge with no checks-lint PASS row for its head; log the evidence folder on post (#110)
* alerts: serve the model-outage observer from the add-on (step A) (#108)
* alerts: run the model-outage observer from the add-on with fork-bin dependencies; add hook e2e
* alerts: silence SC2317 on the test stubs
* pipeline-quota-failover: fail over on WaitDelay, extension-warning exits and no credit (#111)
* pipeline-quota-failover: free MiniMax OpenRouter route in the default chain (#112)
* pipeline-quota-failover: add free MiniMax OpenRouter route after Haiku; never credit-probe :free models
* pipeline-quota-failover: drop DeepSeek from the default chain
* pipeline-quota-failover: fail over on OpenRouter's 402 requires-more-credits error (#113)
* merge-card: stop passing a bare --judge to done-done 0.4.1 (needs a route) (#114)
* merge-card: skip the card for a merge that declares screen: none (#115)
* brief-inherit: shared worker-instruction include behind a fork seam (step A) (#116)
* wait-timers: run the timer library from the add-on with fork-bin dependencies; add hook e2e (#117)
* receipts: serve acceptance and publisher from the add-on (step A) (#118)
* WIP receipts step A (paused)
* receipts: serve acceptance and brief/meta helpers from the add-on; publisher reads fork libs from fork bin; add hook e2e
* feat(merge-card): attach passed-test receipt to evidence cards (#119)
* merge-card: attach the passed-test receipt (run) to the evidence card when a sealed done-done run backs the pass
* no-mistakes(review): Bind passed-test receipt to merge head and cited file
* no-mistakes(review): Bind passed-test receipts to sealed file bytes; drop line cap
* no-mistakes(review): Scrub local folders from receipt evidence and proof
* no-mistakes(review): test abspath fixture with absolute proof path
* no-mistakes(review): cut passed-test receipt to head-matched clean run only
* no-mistakes(review): restore media gate so receipts never change posting
* no-mistakes(document): Document merge-card passed-test receipt in root README
* test(merge-card): run merge hook e2e against the real fork seam (#120)
* merge-card: run merge-hooks e2e against the real fork seam
* no-mistakes(review): Update merge-card README for merged fork seam
* no-mistakes(document): update merge-card docs for merged fork seam
* fix(alerts): define fm_alerts_push_suppress for the fork's push-transition hook (#121)
* alerts: define fm_alerts_push_suppress for the fork's push-transition hook
* no-mistakes(document): document push-suppress hook in alerts README
* no-mistakes(ci): Root cause: ShellCheck reported SC2317 (unreachable command) on the `fm_meta_get` and `task_captain_call_open` stubs defined inside the push-transition subshell in alerts/tests/model-outage-hook-e2e.sh (lines 73-74). The existing disable directive above that block listed only SC2031 and SC2329. Fix: added SC2317 to that directive in alerts/tests/model-outage-hook-e2e.sh. The stubs are invoked indirectly by the sourced hook, so the directive is accurate. Verified locally: the edited file and alerts/bin/fm-model-outage-lib.sh pass `shellcheck -x -e SC2015,SC1091`, and a full run of the CI ShellCheck loop over all 148 add-on bash scripts reports zero failures. Local shellcheck is 0.11.0 while CI uses 0.9.0, so the full loop was not run on the CI version. I did not run the e2e test itself because it needs FM_TEST_FORK. The declined simplify-push-suppress-guard item was not touched
* test(brief-inherit): compare e2e against a pinned pre-seam reference (#122)
* test(brief-inherit): compare against a pinned pre-seam reference, not the live fork checkout
* no-mistakes(review): harden pre-seam patch and compute seam presence once
* no-mistakes(document): Update brief-inherit README for pinned pre-seam reference
* feat(owner-rules): refuse a lane brief with no owner ask or no-mistakes without a risk reason (#123)
* feat(owner-rules): merge gate refuses a merge with no done-done receipt (#124)
* feat(owner-rules): merge gate refuses a merge with no done-done receipt
* test(owner-rules): silence SC2119/SC2120 on the gate helper
* feat(owner-rules): leads skill stating both rules, the refusal lines and their fixes (#125)
* feat(owner-rules): merge gate refuses a merge with no checks-lint PASS for the PR head (#126)
* feat(owner-rules): merge gate refuses a merge with no checks-lint PASS for the PR head
* fix(owner-rules): skill quote matches the lint refusal; test counts four
* feat(owner-rules): name the skill firstmate-addons-owner-rules (#127)
* fix(owner-rules): install line links firstmate-addons-owner-rules (#128)
* feat(merge-card): accept a sealed clean run from done-done's default evidence root (#129)
receipt_run asks done-done (doctor) for its evidence root and also reads
<root>/*/.done-done/runs; the per-task lookup and acceptance test are kept,
and with no done-done only the task folder counts.
* test(alerts): port the model-outage scan cases from the fork (#130)
* feat(receipts): fm_receipts_accept_done, call-site signatures for inherit and promote (#131)
* Test wait timers with post-step-B fork hooks (#132)
* fix(sentinel): restore recorded Claude models after restart (#133)
* fix(sentinel): reconcile model mismatches in lead homes (#134)
* Require fleet evidence cards before PR merges (#135)
* Accept sign-off evidence commit in owner gate (#138)
* Replace dismissed merge evidence cards (#139)
* Inherit fleet board from main home (#137)
* Inherit fleet board from main home
* Fix board fallback test lint
* Keep merge-card media in task evidence folder (#136)
* Post merge evidence per PR head (#140)
* Add Firstmate sign-off engagement route (#141)
* Show captured command output on text evidence cards (#142)
* test: cover wait timer Main escalation hook (#143)
* test: cover wait timer main escalation hook
* test: run focused wait escalation journey in CI
* fix: record task-owned device processes in kill guard (#144)
* feat: refuse blocked status lines that declare waits (#146)
* feat(merge-on-green): route checks lint through done-done (#147)
* test(owner-rules): verify evidence gate contract (#145)
* fix: normalize trailing status verb colon (#148)
* Refuse sentinel relaunch without stored model (#150)
* fix(merge-on-green): resolve lint input paths and receipts (#149)
* fix(addons): reverse parked homes and owner guard installs (#151)
* fix(addons): reverse parked homes and owner guard installs
* test(addons): isolate uninstall journeys from user homes
* test(addons): isolate quota failover uninstall home
* Fail clearly when owner guard is missing (#152)
* Fail clearly when owner guard is missing
* Add owner guard installation doctor
* fix(addons): use moved receipt publisher path (#153)
* fix(addons): use moved receipt publisher path
* test(addons): exclude regression test from scan
* Make owner-rules card hint runnable across homes (#155)
* Add private captain chat TSV extractor (#154)
* Add private captain chat TSV extractor
* Filter injected chat transcript wrappers
* Filter Firstmate wake text from chat backfill
* Filter system-style transcript XML wrappers
* Add fleet-pulse chat TSV refresh hook (#156)
* Add incremental fleet-pulse refresh hook
* Add done-done proof for fleet-pulse refresh
* Add fleet pulse gate audit (#157)
* test(owner-rules): match stable checks-lint refusal (#158)
* Add stable Firstmate pane titles (#159)
* Fix quota failover screen matching (#160)
* Fix quota failover screen matching
* Add done-done proof for quota failover
* Keep quota proof out of code-only journey detection
* Make failover proof captures judgeable
* pipeline-quota-failover: pin the pipeline route to the OpenRouter DeepSeek floor route (#161)
* pipeline-quota-failover: pin the pipeline route to the OpenRouter DeepSeek floor route
The no-mistakes config holds agent_config.pi.model =
openrouter/deepseek/deepseek-v4.1-flash-1017:floor, but the wrapper's
default chain was claude-bridge/claude-haiku-5-5 then
openrouter/minimax/minimax-m3.1-flash:free. A pinned model outside the
chain does not run, so the config's route was not the route that ran: the
pipeline answered through claude-bridge while the config named the
OpenRouter DeepSeek floor route.
The default chain is now that one route, so the config's route is the
route that runs. An openrouter/* route also takes the deepseek idle
limit (300 s) instead of the generic 120 s one, because the floor route
answers on the same clock as direct DeepSeek.
The route fixture test pins the chain, the off-chain pin and the idle
class; the add-on README and the root README record the route and the
daemon environment caveat: the OpenRouter key lives only in the systemd
user manager environment, so after a reboot or a manager restart it has
to be re-imported from ~/.config/openrouter/api_key before the daemon
starts. The key is never copied into a file and never printed.
* pipeline-quota-failover: add the done-done route journey and its proof script
The verify skill names the persisted pipeline route as a feature, so
done-done needs a journey that drives it: run-proof.sh captures the
chain the wrapper holds and the fixture journey's output in the
evidence root, with a result.json summary and the exit code of each
capture. The route feature file names the paths the journey covers.
* pipeline-quota-failover: capture the route proof in the names the PR cites
The judge checks that every cited evidence file is tied to a done-done
run, so the journey now captures exactly the files the Checks block
names: the chain the wrapper holds, the live config's agent and model
read-only next to that chain, the fixture journey's output and the same
journey against the wrapper in main, which must fail.
* pipeline-quota-failover: persist the pipeline agent and route switch (#162)
* pipeline-quota-failover: persist the pipeline agent and route switch
The no-mistakes pipeline agent is global: every step (intent, rebase,
review, test, document, lint, push, PR, CI) runs the configured `agent`,
and a route that is not the one the config names changes what the whole
pipeline runs on. Switching that by hand meant editing the config
without a backup, without a check that the model actually answers, and
without a way back.
switch.sh does the switch the safe way: it edits only the two keys by
name (agent, agent_config.<agent>.model), leaves every other key, value
and comment alone, writes a timestamped backup next to the config first,
and keeps the backup's version unless a real request on the model
answers PONG. --dry-run prints the planned edit and writes nothing,
--restore-latest puts the last backup back. The script is persisted
byte-identical from the copy that runs this host's pipeline.
The test drives the real script against a fixture config and a stub pi:
the two keys change and nothing else does, a backup is written, a model
that does not answer PONG leaves the config alone, and the backup
restores it. The default model is the pipeline route the wrapper's
chain holds.
* pipeline-quota-failover: group the switch test with its add-on checks, restore the CI file's trailing newline
* Insights: name each waiting task's recorded reason, count parked apart from open (#164)
* Insights: show each waiting task's recorded reason and count parked work apart from open
* Insights: split recorded waits by real reason; Open counts active only
* Add done-done journey for the Insights wait-reasons card
* run-proof: stop the browser it started
* claude-accounts: quota reader and dashboard card (slice 1) (#165)
* claude-accounts: quota reader for every signed-in Claude account, plus dash…
fritznoff
pushed a commit
to fritznoff/starship
that referenced
this pull request
Nov 2, 2026
… Deepgram ones (kunchenguid#159) The register owner truncates the shaped line before playback, and its own default budget is the ~8s one tuned for the glasses. fm-speak only pointed it at the 30s desk register when a Deepgram key was detected, so whenever that path was skipped an ordinary two- or three-sentence outcome was cut mid-message before any speaker saw it: short lines finished, slightly longer ones sounded cut off. The budget belongs to the desk, not to whichever speaker plays the line, so apply it unconditionally. Both published opt-outs are unchanged: an already-set GLASSES_ANNOUNCE_CONFIG is never overridden, and FM_SPEAK_DEEPGRAM_REGISTER= (empty) keeps the glasses cut. That variable keeps its historical name because it is the documented opt-out. Tests drive a register-aware stand-in owner that truncates to seconds x words_per_second the way the real one does, so a multi-sentence line that the glasses budget cuts at 20 words is proven to survive whole with no Deepgram key present, to be cut again under the empty-override opt-out, and to follow a caller's own register when one is already chosen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Harden dispatch-profile consultation so config/crew-dispatch.json cannot be silently bypassed. Bootstrap should print a concise active-rules block for valid crew-dispatch configs while preserving the invalid JSON/schema error path. fm-spawn should require an explicit resolved harness for crewmate and scout dispatches whenever that file exists, while preserving no-file fallback to config/crew-harness, preserving explicit --harness, positional harness, raw launch command, and batch behavior, and exempting --secondmate launches. Update AGENTS.md and focused behavior tests for those contracts.
What Changed
config/crew-dispatch.jsonrules during bootstrap while keeping malformed or invalid config diagnostics intact.Risk Assessment
✅ Low: Captain, the change is narrowly scoped to bootstrap reporting and spawn-time harness enforcement, and I found no material correctness or compatibility issues in the reviewed paths.
Testing
Captain, the configured full-suite baseline was already green per prompt; I reran the focused bootstrap and spawn dispatch-profile behavior tests, then captured CLI evidence showing the intended end-user contracts working in isolated homes with fake tmux and real git worktrees. All focused checks and manual evidence-producing scenarios passed.
Evidence: Manual CLI evidence transcript
Evidence: Focused bootstrap behavior test log
Evidence: Focused spawn dispatch-profile behavior test log
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.
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 already successful per prompt: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"bash tests/fm-bootstrap.test.sh > /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWBNS83NX0YWR86G0RNFPEYP/fm-bootstrap-test.log 2>&1bash tests/fm-spawn-dispatch-profile.test.sh > /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KWBNS83NX0YWR86G0RNFPEYP/fm-spawn-dispatch-profile-test.log 2>&1Manual isolated CLI verification saved todispatch-profile-cli-transcript.txt:fm-bootstrap.shvalid active rules, malformed JSON error path,fm-spawn.shno-harness refusal with no meta, explicit codex spawn with captured launch command, no-profileconfig/crew-harnessfallback, and--secondmateexemption.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.