Repository navigation
Sync upstream firstmate template - #2
Merged
Merged
Conversation
* 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 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 to tasks-axi backend * no-mistakes(document): Sync backlog backend docs
… /tmp (kunchenguid#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 <[email protected]>
* 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 * 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
* Harden crew dispatch profile enforcement * no-mistakes(document): Captain, synced crew dispatch docs
* 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(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-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 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: 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): 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 (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 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 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
…nguid#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
…uid#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
) * 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): 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 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
… one per spawn (kunchenguid#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 <[email protected]>
* 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
… -u in spawn (kunchenguid#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(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: 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 <[email protected]>
* 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 <[email protected]>
* 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
…unchenguid#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
…nguid#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(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 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 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
…henguid#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): 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(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(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 * no-mistakes(document): Document Orca checklist --------- Co-authored-by: Stephen Brouhard <[email protected]>
* 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 kunchenguid#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 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 failure still surfaces. * no-mistakes(review): Harden teardown lock refusal paths * no-mistakes(review): Harden stale-lock teardown safety rechecks * no-mistakes(review): Harden stale teardown lock checks * no-mistakes(document): Document teardown lock recovery
…-governance section (kunchenguid#307) * Encode project AGENTS authoring bar * no-mistakes(review): Captain, centralize CLAUDE promotion governance * no-mistakes(review): make ensure_maintenance_section idempotent-success, drop || true guards * no-mistakes(review): separate appended maintenance section on newline-less CLAUDE.md promotion * no-mistakes(review): assert maintenance heading present before separator check in test * no-mistakes(document): sync docs with AGENTS.md authoring bar and self-governance --------- Co-authored-by: fmtest <[email protected]>
…chenguid#300) * Add captain-invocable bearings skill Generates a pick-up-where-I-left-off status report from live fleet state to data/status-report-<YYYY-MM-DD>.md plus a concise chat summary. Read-mostly procedure: reads backlog, per-task crew state via bin/fm-crew-state.sh, open PRs via gh-axi, scout reports, pending decisions, and date-gated queued work; composes the exemplar's sections (TL;DR, Check first, Landed, In flight, Plans, Decisions pending, Date-gated/queued); never tears down, merges, or mutates task state as a side effect. * no-mistakes(document): docs: list new /bearings skill in README built-in skills table
* fix(watcher): pin LC_ALL=C in fm_pid_identity for locale-invariant identity ps's lstart date format follows the caller's LC_TIME/LC_ALL. The watcher records its process identity under one locale, but arm/guard/turn-end re-read it under the machine's ambient locale. On a non-C locale (e.g. ko_KR) the two strings differ only in the date portion, so fm_watcher_lock_matches_pid / fm_watcher_healthy reject a genuinely live watcher - breaking fm-watch-arm.sh, fm-guard.sh, and fm-turnend-guard.sh on every non-C-locale machine. Pin LC_ALL=C on that one ps call so the write and read sides agree regardless of machine locale, matching the LC_ALL=C determinism the file already uses elsewhere. Add a colocated regression test asserting fm_pid_identity is locale-invariant across exported LC_ALL/LC_TIME. * no-mistakes(document): Document watcher PID identity coverage
* docs: reconcile Codex App backend contract * no-mistakes(document): Sync backend docs * docs: clarify Codex Desktop bridge blocker * no-mistakes(document): Align Codex App backend docs * no-mistakes(test): Captain, stabilize watcher self-eviction test cadence * no-mistakes(document): Document Codex App backend contract * no-mistakes(document): Captain, document blocked codex-app coverage * docs: make Codex App contract doc authoritative * no-mistakes(document): Align Codex App backend docs * docs: redact local Codex App smoke paths --------- Co-authored-by: Stephen Brouhard <[email protected]>
* docs: add Codex App coordination skill * no-mistakes(review): Captain, mark Codex App skill agent-only * no-mistakes(document): Document Codex App backend boundary * no-mistakes(document): Captain, document Codex Desktop backend boundary * no-mistakes(lint): Captain, lint clean * no-mistakes(document): Document Codex Desktop boundaries * docs: narrow Codex App skill playbook
* fix(afk): recognize unbordered herdr composer rows to stop escalation redelivery loop fm_backend_herdr_composer_state only recognized bordered composer rows (the grok shape). Real claude and codex render their live input row with no border at all, so once a harness's own startup banner scrolled out of the capture window the classifier read the composer as unknown forever. fm_backend_herdr_send_text_submit never confirmed "empty", so escalate_flush never cleared state/.subsuper-escalations, and the away-mode daemon retyped and resubmitted the same buffered digest every housekeeping cycle - reproduced live against a real herdr+claude pane (5+ identical deliveries in 40s). The classifier now recognizes an unbordered (bare) composer row led by a known prompt glyph alongside the existing bordered shape, keeping whichever match is bottom-most so a stale decorative box never outranks the live composer. * no-mistakes(review): Narrow herdr bare prompt matcher * no-mistakes(document): Sync herdr composer docs
…guid#323) * fix(herdr): confirm message submit via native agent-state, not composer text fm_backend_herdr_send_text_submit now confirms a landed submit by polling herdr's own agent-state (agent get) for the idle->working transition instead of reading composer content. Composer scraping remains, unchanged, for the away-mode daemon's pre-injection empty-box guard only. This fixes the practical effect of the codex idle-tip gap from the 2026-07-07 incident: codex's dynamic idle-composer hint text can no longer misread as pending and block/mis-confirm a send, since confirmation no longer looks at composer text at all. Verified empirically against real claude and codex agents (timing, swallowed-Enter, unreadable-target, and already-busy-target scenarios), and against the real away-mode daemon end-to-end after updating its synthetic supervisor-pane test fixture to register itself as a real herdr agent (herdr's own report-agent primitive) so it can still exercise the new confirmation path. * no-mistakes(review): Captain, harden herdr submit confirmation * no-mistakes(review): Captain, harden herdr submit confirmation * no-mistakes(document): Sync Herdr submit docs * no-mistakes: apply CI fixes
* Add quota-balanced dispatch selection * no-mistakes(document): Document dispatch selector guidance
* fix(session-start): deterministically respawn dead-shell secondmates A secondmate agent that exits leaves its backend pane alive as a bare shell. The session-start endpoint check only verified pane presence, so recovery and the watcher (which exempts secondmates from stale-pane detection) never noticed - evidence 2026-07-07: every secondmate in one fleet was found sitting at a dead zsh shell. Add fm_backend_agent_alive (bin/fm-backend.sh), a deeper per-backend liveness probe distinct from pane presence: fm_backend_tmux_agent_alive classifies the pane's live foreground process via tmux's own pane_current_command, and fm_backend_herdr_agent_alive reuses the already-verified pane_agent_state husk classifier. Both are conservative: anything ambiguous reports unknown, never a false dead. Wire this into a new session-start-only, locked-and-primary-only sweep in bin/fm-bootstrap.sh that kills and respawns only a confidently dead secondmate endpoint, leaving alive/unknown readings untouched - idempotent by construction, so repeated runs converge without duplicating agents. * no-mistakes(review): Guard raw secondmate liveness respawns * no-mistakes(review): Fix detect-only bootstrap test * no-mistakes(test): Pin liveness fixture harness * no-mistakes(document): Sync secondmate liveness docs * no-mistakes: apply CI fixes
* Fix NUDGE_SECONDMATES to print stable fm-<id> selectors. Session-start secondmate sync used to accumulate raw backend window targets into NUDGE_SECONDMATES, but the liveness sweep in the same bootstrap run can respawn secondmates onto new endpoints. fm-send with those stale explicit targets bypasses meta resolution and fails, while fm-<id> resolves correctly. Accumulate fm-<id> in process_secondmate, update the bootstrap/update contracts and /updatefirstmate skill, and add a herdr respawn regression test. * no-mistakes(review): Captain, guard herdr regression jq dependency * no-mistakes(document): Document stable secondmate nudge selectors * no-mistakes(lint): Fix shell lint hints
* Make tasks-axi and quota-axi required bootstrap tools Add both to the normal toolchain checks alongside lavish-axi, keep the tasks-axi 0.1.1+ compatibility gate, and report quota-axi through the standard MISSING install-consent flow. TASKS_AXI: available remains a backlog-backend capability signal only; manual opt-out no longer suppresses the missing-tool report. Update bootstrap tests and point docs/configuration.md at the canonical toolchain contract. * no-mistakes(review): Clarify manual backlog bootstrap reporting * no-mistakes(document): Document bootstrap AXI tools
Replace overwrite-in-place wording with explicit delete-then-create instructions so agents do not modify an existing daily report file.
* Add primary turn-end guards for all harnesses * no-mistakes(review): Normalize Codex hook cwd resolution * no-mistakes(review): Fix OpenCode guard worktree anchoring * no-mistakes(review): Anchor Codex guard outside nested roots * no-mistakes(review): Anchor Codex guard to hook root * no-mistakes(review): Avoid Grok permission escalation * no-mistakes(document): Sync turn-end guard docs
* fix backend selector task id resolution * no-mistakes(document): Document selector resolution behavior
* fix bootstrap fleet sync timeout * no-mistakes(review): Fix bootstrap fleet-sync timeout regressions * no-mistakes(document): Sync bootstrap timeout docs * no-mistakes(lint): Clean ShellCheck directives * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes
Sync kostas-nt/firstmate with the upstream firstmate template, merging 72
upstream commits on top of the fork's one unique commit (per-repo GitHub
account routing + descriptive work-branch naming). This is a true merge so
future upstream syncs stay cheap.
What the sync brings in from upstream:
- A runtime session-provider backend abstraction (bin/fm-backend.sh +
bin/backends/{tmux,herdr,zellij,orca,cmux}.sh) so spawn/send/peek/teardown
work across tmux (verified reference) and the experimental herdr, zellij,
orca, and cmux backends; tmux stays the silent default and absent backend=
meta still means tmux.
- fm-session-start.sh, a single session-start entrypoint composing the lock,
bootstrap, and wake-drain with a full context/fleet digest and a read-only
path when another live session holds the lock.
- Concrete dispatch profile axes for spawn (--harness/--model/--effort) plus
crew-dispatch.json selection (fm-dispatch-select.sh), and secondmate harness
pins with primary->secondmate config inheritance.
- fm-pr-merge.sh (record-then-merge with URL parsing), a squash-merged/landed
PR-head teardown fix (patch-id containment + refs/pull fetch), and stale
worktree index.lock recovery in teardown.
- Grok harness adapter and shared primary turn-end guard (fm-turnend-guard.sh),
bootstrap fleet-sync timeout scaling, stable secondmate nudge selectors, X
mode follow-up counters/caps and image payloads, and assorted skills/docs.
How the two fork features were reconciled with the upstream churn:
- Per-repo GitHub account routing: upstream did not implement an equivalent, so
bin/fm-gh.sh and config/gh-accounts land intact. The routed GitHub lookups
were re-applied on top of upstream's rewritten scripts: fm-pr-check.sh keeps
upstream's unverified remote-head semantics (the squash-merge fix) while
routing pr view and the merge poll through fm-gh.sh; fm-teardown.sh takes
upstream's redesigned validate_worktree_teardown_safety and routes its
pr list / pr view lookups through fm-gh.sh. The fm-pr-merge test's gh-axi
mock was updated to answer headRefOid because fm-pr-check now routes the head
lookup through fm-gh.sh (gh-axi preferred), mirroring the fork's own teardown
test.
- Descriptive work-branch naming: layered --branch onto upstream's new
fm-spawn.sh argument parser and meta writer, kept fm-branch-lib.sh and the
branch= consumers (fm-brief/fm-review-diff/fm-merge-local/fm-promote), and
re-inserted the branch-naming documentation into upstream's rewritten
AGENTS.md, CONTRIBUTING.md, and docs. teardown derives the branch from the
live worktree HEAD, so it needs no change for any branch name.
AGENTS.md, CONTRIBUTING.md, and docs took upstream's structure with the fork's
feature documentation re-inserted at the equivalent locations.
Validation: shellcheck clean across bin/*.sh, bin/backends/*.sh, tests/*.sh;
the merge-affected test suites pass (fm-teardown, fm-gh, fm-branch-name,
fm-spawn-batch, fm-spawn-dispatch-profile, fm-pr-merge, fm-review-diff,
fm-brief, fm-tangle-guard).
This merge commit must be preserved with a merge commit (never squashed) so
shared history stays intact for future upstream syncs.
kostas-nt
pushed a commit
that referenced
this pull request
Aug 10, 2026
* fix(bin): handle dash-leading harness process names (#2) * fix: handle dash-leading harness process names * no-mistakes(review): Make dash-leading harness regression hermetic * fix: preserve secondmate reply routes across relative homes Resolve relative home, data, and state inputs before durable charter generation, and fail when caller-relative directories cannot be resolved. Use absolute paths at the related spawn, AFK daemon, and X-mode cross-process handoffs so later processes cannot reinterpret them from another working directory. * no-mistakes(review): Preserve absolute overrides and normalize relative durable paths * no-mistakes(review): Normalize relative home before deriving durable paths * no-mistakes(document): Document relative durable-path normalization * no-mistakes(review): Captain: Ignore inherited CDPATH during relative path normalization * no-mistakes(lint): Fix empty CDPATH assignments for ShellCheck
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.
Summary
Syncs this fork with upstream
kunchenguid/firstmate@091384bby merging the 72 upstream commits ontokostas-nt/firstmate@9f06051with a true merge commit.Notable upstream changes brought in:
fm-session-start.sh, combining lock, bootstrap, wake drain, context digest, and fleet-state digest into one entrypoint.index.lockrecovery, and bootstrap fleet-sync timeout scaling.Fork Feature Reconciliation
Upstream did not independently implement the fork's per-repo GitHub account routing, so
bin/fm-gh.shplusconfig/gh-accountssemantics are preserved and re-applied across the upstream script churn. Routed PR operations now keep upstream's newer remote-head and teardown safety behavior while using the fork's account-routing wrapper for GitHub lookups.Upstream also did not replace the fork's descriptive work-branch naming feature. The fork's
--branchflow was layered onto upstream's newer spawn parser and metadata handling, with the existingbranch=consumers kept intact acrossfm-brief,fm-review-diff,fm-merge-local, andfm-promote.AGENTS.md,CONTRIBUTING.md, and docs follow upstream's new structure with the fork-only account-routing and branch-naming documentation reinserted at the equivalent locations.Validation
Already run on the merge commit:
shellcheckclean acrossbin/*.sh,bin/backends/*.sh, andtests/*.sh.fm-teardown,fm-gh,fm-branch-name,fm-spawn-batch,fm-spawn-dispatch-profile,fm-pr-merge,fm-review-diff,fm-brief, andfm-tangle-guard.Merge Requirement
This PR must be merged with a merge commit and must not be squashed or rebased. Preserving the merge commit keeps shared upstream history intact and makes future upstream template syncs cheaper.