Skip to content

fix: exit Claude workers with the bare exit word and keep worker shells out of the inbox - #71

Merged
doitdigital0495 merged 1 commit into
mainfrom
fm/fm-control-exit-unknown-command-claude
Oct 12, 2026
Merged

doitdigital0495 merged 1 commit into
mainfrom
fm/fm-control-exit-unknown-command-claude

Conversation

@doitdigital0495

Copy link
Copy Markdown
Owner

Intent

Two crew workers are stuck and cannot be restarted through the control plane: "stuck workers, you fix them yourself".
Evidence: bin/fm-control.sh <id> exit (and so relaunch) on a Claude Code 2.1.296 worker delivers /exit, the pane answers "Unknown command: /exit", and the control script reports exit=unconfirmed; the agent did not stop within 30s. The mapping is fm_control_exit_command in bin/fm-control-lib.sh (claude -> /exit).
Second cause: both workers ran cd into their own steering inbox dir (state/<id>.inbox, inside the Firstmate home), so the persistent Bash cwd is outside their worktree and the repo PreToolUse hook (resolved from cwd) fails every Bash call; they cannot move inbox messages or recover by themselves.

What Changed

  • fm_control_exit_command in bin/fm-control-lib.sh now maps claude to the bare word exit instead of /exit. Claude task workers launch with --disable-slash-commands, so /exit only printed Unknown command: /exit and fm-control.sh exit / relaunch ended as exit=unconfirmed. The other harnesses keep their existing /exit and /quit mappings, and the control, relaunch and secondmate-restart tests are updated to expect the new command.
  • The inbox section that bin/fm-brief.sh writes into every brief gains one line telling the worker to reach the inbox only by absolute path and never cd into it or anywhere else outside its worktree, because the shell's working directory persists and project hooks resolve from it. A new test in tests/fm-brief.test.sh checks that line and the absolute inbox path in ship, scout and secondmate briefs.
  • Docs: docs/verification/runtime-backends.md gets a "Claude exit command" record (measured on Claude Code 2.1.296), and docs/agent-control.md plus the Claude harness adapter reference now state the bare exit word and link to that record.

Risk Assessment

✅ Low: One-line mapping change (claude -> bare exit) flows through an unchanged submit path that never retypes and still requires a proven-empty composer and the dialog guard, with tests updated consistently; the inbox-cwd half is an advisory brief sentence only, safe to merge with prevention as a follow-up decision.

Testing

Drove real Claude Code 2.1.296 workers in a disposable lab home (bin/fm-lab-home.sh) on a private fm-lab tmux socket, using the machine's normal Claude login. Base commit 9695b55 reproduced the reported failure exactly. Target commit 14e03ba stopped the same worker in 5s, stopped a mid-turn worker in 4s, stopped a worker launched by the product's own fm-spawn in 4s, and stopped a Claude started without --disable-slash-commands in 5s. relaunch on a mid-turn worker whose Bash cwd was inside state/t1.inbox exited it and launched a replacement in the worktree; that replacement handled and acknowledged its inbox message using absolute paths and its pwd stayed in the worktree. The emitted ship brief and secondmate charter both carry the new inbox sentence. Targeted suites tests/fm-control.test.sh and tests/fm-brief.test.sh pass. The lab home, lab tmux server and lab temp dirs were removed; the worktree is clean. No visual artifact: this is a terminal/CLI change, so evidence is pane captures and CLI transcripts. Setup notes: the first relaunch attempts were refused before stopping the agent by the lab's quota-intake gate, then failed after the stop on my own invalid fixture brief; both were fixture issues, fixed by recording a real intake plus a lab model note and scaffolding the brief with bin/fm-brief.sh. The lab tmux server also loaded the user's tmux config, which created extra idle bash sessions inside the lab server only; they were killed with it and the default server was not touched.

  • Live validation: ✅ go - 8 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Regression repro: on the base commit, operator runs fm-control exit on an idle Claude 2.1.296 task worker and the pane answers 'Unknown command: /exit' while the script reports exit=unconfirmed ✅ pass live 01-base-exit-unknown-command.txt: error: exit-delivered t1 ... agent-state=alive exit=unconfirmed; the agent did not stop within 30s, rc=1 after 38s, pane shows Unknown command: /exit, pane_curren…
Operator runs fm-control exit (target commit) on that same idle Claude task worker and the agent stops, leaving its shell and worktree ✅ pass live 02-target-exit-idle.txt: stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1, rc=0 after 5s, pane shows AGENT-EXITED rc=0, pane_current_command=bash; a second exit reports `already-stopped…
Operator runs fm-control exit on a Claude worker that is mid-turn (Bash tool running, shell cd'd into its inbox dir) and the agent stops ✅ pass live 03-target-exit-midturn.txt: stopped t1 ..., rc=0 after 4s, pane shows AGENT-EXITED rc=0, pane_current_command=bash
Operator runs fm-control relaunch on a stuck mid-turn worker whose shell is inside state/<id>.inbox; the old agent exits and a replacement starts in the worktree and can handle its inbox ✅ pass live 04-target-relaunch.txt: relaunched t1 harness=claude from=claude ... endpoint=fmses:fm-t1, rc=0 after 8s; pane shows cd -- &#39;&lt;worktree&gt;&#39; then the new agent; 001.msg moved to handled/, inbox-proof.t…
Operator runs fm-control exit on a worker launched by the product's own fm-spawn (real worker flags, busy_gen recorded) and it stops ✅ pass live 06-target-exit-spawned-worker.txt: worker argv includes --disable-slash-commands; stopped t1 ..., rc=0 after 4s, pane_current_command=bash
Adversarial: bare exit still stops a Claude launched without --disable-slash-commands (slash commands registered, secondmate-style launch) ✅ pass live 07-target-exit-slash-commands-enabled.txt: stopped t1 ..., rc=0 after 5s, pane shows AGENT-EXITED rc=0
Firstmate scaffolds a ship brief and a secondmate charter; both tell the worker to reach the inbox by absolute path and never cd into it ✅ pass live 05-emitted-ship-brief-local-only.md line 94 and 05-emitted-secondmate-charter.md line 43, generated by bin/fm-brief.sh in the lab home; tests/fm-brief.test.sh passes (09-fm-brief-test.log)
A fresh worker given the new brief handles an inbox message without its shell leaving the worktree ✅ pass live 04-target-relaunch.txt: replacement worker used absolute inbox paths for read and mv, final pwd = worktree. Single run of model behaviour, so it shows the sentence works here, not that the failure…
A worker already wedged with the repo PreToolUse hook failing every Bash call is recovered by relaunch ⏸️ untested no The lab worker runs with --setting-sources &#39;&#39; in a throwaway repo that has no PreToolUse hook, so the hook-failure half of the wedge could not be reproduced. Reproducing it needs a lab project that…
Secondmate restart through the control plane (kind=secondmate, background-task exit picker guard) ⏸️ untested no Needs a provisioned lab secondmate home and a Claude session holding a background task to open the picker; not set up in this run. The slash-enabled exit itself was driven live in scenario 6.
Evidence: Base commit repro: Unknown command: /exit, exit=unconfirmed

Source: Base commit repro: Unknown command: /exit, exit=unconfirmed

== BASE 9695b55 (old mapping /exit): fm-control.sh t1 exit error: exit-delivered t1 interrupt=not-needed exit-command=delivered agent-state=alive exit=unconfirmed; the agent did not stop within 30s rc=1 after 38s ● Unknown command: /exit == pane_current_command: claude

== claude --version: 2.1.296 (Claude Code); tmux tmux 3.2a
== BASE 9695b55 (old mapping /exit): fm-control.sh t1 exit
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.69MEIn
error: exit-delivered t1 interrupt=not-needed exit-command=delivered agent-state=alive exit=unconfirmed; the agent did not stop within 30s
rc=1 after 38s
== pane after base exit attempt
claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo AGENT-EXITED rc=$?
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo AGENT-E
XITED rc=$?
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
● Unknown command: /exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle) · ← for agents
== pane_current_command: claude
Evidence: Target commit: same idle worker stops

Source: Target commit: same idle worker stops

== TARGET 14e03ba (new mapping exit): bin/fm-control.sh t1 exit stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.69MEIn/wt-t1 rc=0 after 5s ❯ exit AGENT-EXITED rc=0 == pane_current_command: bash == idempotent second exit already-stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 rc=0

== TARGET 14e03ba (new mapping exit): bin/fm-control.sh t1 exit, same idle worker that just answered 'Unknown command: /exit'
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.69MEIn
stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.69MEIn/wt-t1
rc=0 after 5s
== pane after
claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo AGENT-EXITED rc=$?
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo AGENT-E
XITED rc=$?
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
● Unknown command: /exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)
Resume this session with:
claude --resume f96b4351-0d99-4c30-9e59-6b72a563cafc
AGENT-EXITED rc=0
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$
== pane_current_command: bash
== idempotent second exit
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.69MEIn
already-stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.69MEIn/wt-t1
rc=0
== meta
window=fmses:fm-t1
endpoint_task_id=t1
worktree=/tmp/fm-lab.69MEIn/wt-t1
project=/tmp/fm-lab.69MEIn/projects/p
harness=claude
kind=ship
mode=no-mistakes
yolo=off
model=default
effort=default
Evidence: Target commit: mid-turn worker stops

Source: Target commit: mid-turn worker stops

== worker mid-turn: its Bash tool cd'd into its own inbox dir and is running sleep 300
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ Use the Bash tool to run exactly: cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 300
  Bash(cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 300)
  ⎿  Running…
✻ Flummoxing… (2s · ↓ 163 tokens)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle) · esc to interrupt · ← for agents                                                           ◐ medium · /effort
== TARGET bin/fm-control.sh t1 exit (mid-turn)
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.69MEIn
stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.69MEIn/wt-t1
rc=0 after 4s
== pane after
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ Use the Bash tool to run exactly: cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 300
● Bash(cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 300)
  ⎿  Running…
✽ Flummoxing… (5s · ↓ 242 tokens)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)                                                                                             ◐ medium · /effort
Resume this session with:
claude --resume 4ef3f439-061e-454a-bf67-a0687b608c43
AGENT-EXITED rc=0
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$
== pane_current_command: bash
Evidence: Target commit: relaunch of a worker stuck in its inbox dir, replacement handles inbox

Source: Target commit: relaunch of a worker stuck in its inbox dir, replacement handles inbox

relaunched t1 harness=claude from=claude model=default effort=default backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.69MEIn/wt-t1 rc=0 after 8s ... ● Bash(echo handled > /tmp/fm-lab.69MEIn/wt-t1/inbox-proof.txt && mv /tmp/fm-lab.69MEIn/state/t1.inbox/001.msg /tmp/fm-lab.69MEIn/state/t1.inbox/handled/ ...) ● Bash(pwd) ⎿ /tmp/fm-lab.69MEIn/wt-t1

== before: worker mid-turn, its shell cd'd into state/t1.inbox
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ Use the Bash tool to run exactly: cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 298
● Bash(cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 298)
  ⎿  Running…
✽ Accomplishing… (5s · ↓ 36 tokens)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle) · esc to interrupt · ← for agents                                                           ◐ medium · /effort
== TARGET bin/fm-control.sh t1 relaunch --note ...
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.69MEIn
quota-intake gate: PASS record=quota-1791817948-918189953-1470079.json age=2s account=default provider=claude model=default plan=max (quota-axi) spendPriority=1.5712 runway=through_reset
  scope=all_models status=known used=96% spendPriority=1.5712 runway=through_reset
    window=five_hour used=77% resets=2026-10-12T15:19:59.897140+00:00 source=live
    window=seven_day used=96% resets=2026-10-12T17:59:59.897161+00:00 source=live
  notes=lab fixture note for the gate test
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.69MEIn
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
notice: t1 ships mode=local-only while the standing posture for p is no-mistakes - less rigor than the captain's standing posture; proceed only on a current explicit captain instruction or an intake judgment you can state
quota-intake gate: PASS record=quota-1791817948-918189953-1470079.json age=6s account=default provider=claude model=opus plan=max (quota-axi) spendPriority=1.5712 runway=through_reset
  scope=all_models status=known used=96% spendPriority=1.5712 runway=through_reset
    window=five_hour used=77% resets=2026-10-12T15:19:59.897140+00:00 source=live
    window=seven_day used=96% resets=2026-10-12T17:59:59.897161+00:00 source=live
  notes=lab fixture note for the gate test
admitted: t1 (store ~/.claude is not shaped by this home)
relaunched t1 harness=claude from=claude model=default effort=default backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.69MEIn/wt-t1
rc=0 after 8s
== after relaunch: replacement worker pane
Resume this session with:
claude --resume f96b4351-0d99-4c30-9e59-6b72a563cafc
AGENT-EXITED rc=0
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ clear; claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo
AGENT-EXITED rc=$?
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ Use the Bash tool to run exactly: cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 300
● Bash(cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 300)
  ⎿  Running…
✽ Flummoxing… (5s · ↓ 242 tokens)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)                                                                                             ◐ medium · /effort
Resume this session with:
claude --resume 4ef3f439-061e-454a-bf67-a0687b608c43
AGENT-EXITED rc=0
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ clear; claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo
AGENT-EXITED rc=$?
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ Use the Bash tool to run exactly: cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 299
● Bash(cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 299)
  ⎿  Running… (1m 0s · timeout 5m 10s)
     (ctrl+b ctrl+b (twice) to run in background)
* Ebbing… (1m 3s · ↓ 139 tokens)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)
Resume this session with:
claude --resume 8336db5d-6d4a-4d1e-9199-31d64be30ca9
AGENT-EXITED rc=0
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ clear; claude --dangerously-skip-permissions --setting-sources '' --strict-mcp-config --disable-slash-commands; echo
AGENT-EXITED rc=$?
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ Use the Bash tool to run exactly: cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 298
  Bash(cd /tmp/fm-lab.69MEIn/state/t1.inbox && sleep 298)
  ⎿  Running… (5s · timeout 5m 10s)
     (ctrl+b ctrl+b (twice) to run in background)
· Accomplishing… (8s · ↓ 142 tokens)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ exit
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle)
                                               You've used 96% of your weekly limit · resets 8pm (Europe/Amsterdam) · /usage-credits to keep using Claude Code
Resume this session with:
claude --resume 003f6d0c-c999-41c5-9850-3a46528057f7
AGENT-EXITED rc=0
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ cd -- '/tmp/fm-lab.69MEIn/wt-t1'
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ export GOTMPDIR=/tmp/fm-t1/gotmp
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ export COMPACT_ADVISER_DISABLE=1
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ export FM_TASK_ID=t1
daan@Workstation:/tmp/fm-lab.69MEIn/wt-t1$ . '/tmp/fm-t1+7adcea8b532beef217fbbf684ccae49266d04b38f65fd013a212c71d449b6c83/launch.s1791817955.1475838.20884.sh'
 ▐▛███▛█   Claude Code v2.1.296
▝▜██████▀  Opus 5.5 with medium effort · Claude Max
▝▜██████▀  Opus 5.5 with medium effort · Claude Max
 ▝▝   ▝▝   /tmp/fm-lab.69MEIn/wt-t1
❯ : Firstmate operational input waiting: read '/tmp/fm-lab.69MEIn/state/operational-inbox/1791817955-1b39268d374b3a88.msg' and handle its contents as Firstmate
  operational input.
  Read 1 file (ctrl+o to expand)
● Bash(pwd -P; git rev-parse --show-toplevel; git branch --show-current; git status --short; ls -la /tmp/fm-lab.69MEIn/state/t1.inbox/
      /tmp/fm-lab.69MEIn/state/t1.inbo…)
  ⎿  /tmp/fm-lab.69MEIn/wt-t1
     /tmp/fm-lab.69MEIn/wt-t1
     task-t1
     … +4 lines (ctrl+o to expand)
  Read 1 file (ctrl+o to expand)
● Bash(echo handled > /tmp/fm-lab.69MEIn/wt-t1/inbox-proof.txt && mv /tmp/fm-lab.69MEIn/state/t1.inbox/001.msg /tmp/fm-lab.69MEIn/state/t1.inbox/handled/ && ls
      /tmp/fm…)
  ⎿  001.msg
     handled
● Bash(pwd)
  ⎿  /tmp/fm-lab.69MEIn/wt-t1
● The inbox message is handled and acknowledged, and I'm now waiting.
  - Message 001.msg: it asked for inbox-proof.txt in the worktree root containing the word handled; the file is created with that content.
  - Acknowledgement: 001.msg is moved to /tmp/fm-lab.69MEIn/state/t1.inbox/handled/, and the inbox has no other pending messages.
  - pwd: run once, printing /tmp/fm-lab.69MEIn/wt-t1, so the shell is in the worktree and not inside the inbox directory.
  Two things differ from the generic brief, both because the spec said to do nothing else:
  - No fm/t1 branch: the worktree is still on task-t1, where it was at launch (not the detached HEAD the brief describes).
  - Uncommitted file: inbox-proof.txt is left untracked. I wrote no status line or report.
✻ Cooked for 17s · done 5:12 PM
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ bypass permissions on (shift+tab to cycle) · ← for agents
== pane_current_command/path: claude /tmp/fm-lab.69MEIn/wt-t1
== inbox:
/tmp/fm-lab.69MEIn/state/t1.inbox:
handled

/tmp/fm-lab.69MEIn/state/t1.inbox/handled:
001.msg
== worktree:
inbox-proof.txt
handled
== meta
window=fmses:fm-t1
endpoint_task_id=t1
worktree=/tmp/fm-lab.69MEIn/wt-t1
project=/tmp/fm-lab.69MEIn/projects/p
harness=claude
kind=ship
mode=local-only
yolo=off
branch=fm/t1
tasktmp=/tmp/fm-t1
model=opus
effort=medium
claude_config_dir=~/.claude
busy_gen=g1791817954.1479433.20336
spawn_gen=s1791817955.1475838.20884
control_relaunch_tx=1470728.20261012T151232Z.22629
== status
milestone [name=brief] [at=1791817922]: ship brief scaffold created
Evidence: Emitted ship brief with the new inbox sentence

Source: Emitted ship brief with the new inbox sentence

You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
## Captain's intent
{TASK}

## Request checklist
{ASKS}

## Firstmate spec
{FIRSTMATE_SPEC}



# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text filled in above.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Work economy
For CI, pipelines, deploys, and long jobs, wait outside the conversation with ONE blocking command per run that loops internally and prints only the final state; never take sleep-then-check turns.
Search before reading; read files over ~300 lines by range, and never re-read a whole large file.
Combine related probes into one script run; filter or limit command output.

# Setup
You are in a disposable git worktree of p, at a detached HEAD on a clean default branch.

**Verify isolation before anything else.** Run `pwd -P` and `git rev-parse --show-toplevel`; both must resolve to the disposable task worktree you were launched in, such as a treehouse pool path or an Orca-managed worktree, not the primary checkout firstmate operates from.
The path check is authoritative: `git rev-parse --git-dir` and `git rev-parse --git-common-dir` can help inspect the repo, but they do not prove you are outside the primary checkout.
If the top-level path is the primary checkout or not the worktree you were launched in, STOP - do not branch or commit here - append `blocked [at=<epoch>]: launched in primary checkout, not an isolated worktree` to the status file and stop.

1. First action: create your branch: `git checkout -b fm/t1 --`

# Rules
1. Never push to any remote and never open a PR. Work only on your `fm/t1` branch; firstmate handles the merge into local `main`.
2. Keep project edits inside this worktree; keep proof and scratch output outside it, under `/tmp/fm-lab.69MEIn/data/t1/` or a temporary directory.
   Outside the worktree, write only that task material and the status and steering-inbox records authorized below.
   Leave the worktree clean before reporting done.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state} [at=<epoch>]: {one short line}" >> '/tmp/fm-lab.69MEIn/state/t1.status' && { [ ! -e '/tmp/fm-lab.69MEIn/config/fleet-ledger' ] || '~/.no-mistakes/worktrees/cf62ac6bfd91/01M4RABJA7W01YRSXG37Y3QVEN/bin/fm-fleet-ledger.sh' appended '/tmp/fm-lab.69MEIn/config' '/tmp/fm-lab.69MEIn/state/t1.status' >/dev/null 2>&1 || true; }`
   States: working, needs-decision, blocked, paused, done, failed.
   Substitute `<epoch>` with the current Unix time in seconds - run `date +%s` and write the number it printed; a stamp that is not plain digits records no time at all.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on (setup done, bug reproduced, fix implemented, validation passed) and the
   needs-decision/blocked/paused/done/failed states. No step-by-step FYI progress lines;
   firstmate reads your pane for that.
   Whenever you mention a PR anywhere - a status line, your terminal, a summary - write its full
   https:// URL exactly as the forge printed it, never a bare number such as "PR 108"; firstmate
   copies that URL from your line rather than assembling one.
   A mid-task `working:` line (including setup complete) is nonterminal: do not end the
   turn after it; continue the same stage until a defined `done:` gate under Definition of done.
   Use `paused: {why}` - distinct from `blocked:` - when deliberately waiting for work or an external condition expected to clear on its own, including your own validation round.
   Before ending your turn with your own background shell or monitor still running, or before waiting on your own pipeline run or a long foreground command, append `paused [at=<epoch>]: {job and completion condition}` to the status file.
   Name what you are waiting for and what will let you resume; do not repeat the declaration on every poll.
   Do not declare active implementation or reasoning as a wait.
   Firstmate may still raise one first-sight alert; the declared wait then uses the existing long recheck cadence instead of repeated possible-wedge alarms.
   When you know when the wait clears, include `until <YYYY-MM-DDTHH:MMZ>` (UTC) for a recheck at that time.
   Follow the resolution rule below when the wait clears, then resume the task.
   Use `blocked:` when you are stuck and need help.

5. If you hit the same obstacle twice, append `blocked [at=<epoch>]: {why}` and stop; firstmate will help.
6. If a decision belongs above the implementation worker (product choices, destructive actions),
   append `needs-decision [at=<epoch>]: {summary of options}` and stop. Firstmate will reply with the decision.
   For standing answers and captain-facing report questions, route to firstmate, which applies `ask-user-authority`.

   A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started that work.
   Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved [at=<epoch>]: {how it cleared}` yourself (same `[key=<slug>]` if you opened it with one) as you resume.
7. Never administer infrastructure that every lane shares. Two things are shared:
   - The `no-mistakes` daemon - one instance serving every lane/home, so stopping, restarting, or
     updating it kills other lanes' in-flight pipeline runs; only firstmate manages the daemon.
     Before you append `blocked:` about the pipeline, run `no-mistakes daemon status` and
     `no-mistakes axi status`. If the daemon socket refuses connections or is missing, append
     `blocked [at=<epoch>]: {the daemon error}` and stop even when the local run record still says running or
     fixing, because that record can be stale after the daemon exits. A run record failed with a
     daemon error is also a real block.
     Only after ruling out socket refusal, if the run is still running or fixing, reattach and keep
     going. A drive-call error, timeout, slow read, or generic unreachability is NOT a daemon error:
     the daemon accepts `respond` immediately and runs the round in the background, so a killed or
     timed-out call was only waiting for a read while the run kept working.
   - The worktree pool your own worktree came from, and the repository every lane's worktree
     shares. Never create, remove, return, prune, move, or reassign a worktree or pool slot, and
     never write into a sibling slot's directory. Rule 2 does not cover this: removing a worktree
     is administration rather than an edit outside your directory, and it lands on lanes that are
     running right now. The act is the rule and commands are only examples of it - `treehouse`
     get/return/remove/prune, the equivalent operations on any other worktree provider or runtime
     backend, and `git worktree add|remove|move|prune`. A slot that looks unused is not evidence
     that it is free, and returning your own worktree is firstmate's job at cleanup, not yours.
   If you genuinely need a second checkout, another slot, or the daemon touched, append
   `blocked [at=<epoch>]: {what you need}` and stop; firstmate arranges it.

# Firstmate instruction inbox
Firstmate steers you through durable message files in '/tmp/fm-lab.69MEIn/state/t1.inbox'.
Reach the inbox only by these absolute paths and never `cd` into it or anywhere else outside your worktree, because your shell's working directory persists and project hooks resolve from it.
When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list '/tmp/fm-lab.69MEIn/state/t1.inbox'/*.msg, read and act on each message in numeric order, then acknowledge each handled message by moving it: `mv '/tmp/fm-lab.69MEIn/state/t1.inbox'/NNN.msg '/tmp/fm-lab.69MEIn/state/t1.inbox'/handled/`.
The move IS the acknowledgement: without it firstmate rings again and eventually treats you as stuck. An empty or absent inbox needs no action.

# Project memory
A project's `AGENTS.md` or `CLAUDE.md` is loaded into every agent session in that project, so edit it only to correct information that is factually wrong - including information your own change made wrong - and never to add knowledge because it is missing.
A correction edits only the wrong text: do not run `~/.no-mistakes/worktrees/cf62ac6bfd91/01M4RABJA7W01YRSXG37Y3QVEN/bin/fm-ensure-agents-md.sh`, create either file, or add sections, headings, or pointers alongside it.

# Definition of done
Delivery contract: mode=local-only
## Milestone evidence
Use `~/.no-mistakes/worktrees/cf62ac6bfd91/01M4RABJA7W01YRSXG37Y3QVEN/bin/fm-task-milestones.sh --help` for milestone stamp, coverage and duration mechanics; `bin/fm-classify-lib.sh` owns the strict status schema.
Stamp each reached milestone in `/tmp/fm-lab.69MEIn/state/t1.status` when it really occurs, including local proof, actual gate receipt and end with run id and round count, PR creation, merge, exact deployed SHA, data-ready snapshot, first live proof, DEV acceptance, and UAT merge/deploy/data/live/acceptance.
Use an authoritative event epoch for a phase observed later; missing timestamps remain unknown, never observation time or an invented acceptance.
Deployment alone and failed, partial or waived proof never count as acceptance.
Do not merge or deploy without the task's existing authority; Firstmate or the authorized release/proof owner stamps phases after your delivery stop point using the same helper.
Ship branch: fm/t1
This task ships **local-only**: no remote, no PR, no pipeline.
The task is complete only when committed on your branch `fm/t1`. Do NOT push, do NOT open a PR, do NOT merge.
A `done:` is accepted when the named head is on this project's shared local branch, not only on a detached copy; the check tests that head, not merely that a branch moved.
Keep your branch a clean fast-forward onto the current default branch - if `main` has advanced, rebase onto it so the eventual merge stays a fast-forward.
Account for the captain's asks in a done report at `/tmp/fm-lab.69MEIn/data/t1/report.md` (create the file when you first need it); besides the status file and any escalation file this Definition of done names, it is the one file outside the worktree you may write.
Walk the brief's `## Request checklist` items in order in that report: `[x]` for each delivered ask together with its proof - a test or command and the output line that proves it, a file:line, or a link - or `[ ]` with why it is not done; a brief with no such subsection accounts for each distinct ask under `## Captain's intent` the same way.
End the report with numbered follow-ups: every finding or defect you noticed but did not fix, work deferred, and anything outside the ask, each with a file:line and a one-line description; never fix those in this task - firstmate files them into the backlog from this report, so omitting one silently drops it.
End every `done:` line you append with `asks <done>/<total>`, counting checklist items, so a lost ask is visible the moment work first reports done.
When it is implemented and committed, append `done [at=<epoch>]: ready in branch fm/t1; asks <done>/<total>` to the status file and stop.
The configured merge authority approves the ready branch, then firstmate merges it into local `main` through the guarded fast-forward path.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 3 issues (1 warning, 2 infos)
  • ⚠️ bin/fm-brief.sh:451 - Second cause in the intent (worker cds into state/&lt;id&gt;.inbox, persistent Bash cwd leaves the worktree, repo PreToolUse hook fails every Bash call) is addressed only by one advisory sentence in the brief. Nothing enforces it: a worker that ignores or forgets the sentence (long session, compaction) reaches the same wedged state, and already-running workers never see the new brief. Recovery now exists because fm-control relaunch works again and re-enters the recorded worktree (cd -- &lt;wt&gt;), so this is containment plus recovery, not prevention. A durable fix (e.g. hook resolving from the recorded worktree instead of cwd, or a guard on cwd) would extend the change beyond this diff, so the remedy, not the defect, needs authorization. tests/fm-brief.test.sh:1359 only proves the sentence is emitted, not that the failure is unreachable.
  • ℹ️ bin/fm-brief.sh:451 - The new sentence is part of the shared INBOX_SECTION and is also emitted into the secondmate brief (bin/fm-brief.sh:545), which says never cd ... anywhere else outside your worktree. A secondmate has no worktree: its brief describes an isolated firstmate home with projects/ clones it operates (line 517). The term is undefined for that role and could be read as forbidding ordinary movement inside its home. Consider role-neutral wording (your working directory / your home) or a secondmate-specific variant; tests/fm-brief.test.sh:1370 pins the current wording for the secondmate too.
  • ℹ️ bin/fm-control-lib.sh:238 - Tradeoff note: the Claude exit text is now a valid shell command. If the agent dies between the empty composer read (bin/fm-control.sh:777) and the typed send (bin/fm-control.sh:800), exit lands in the pane's shell and closes the tmux window, where /exit was a harmless shell error. Window is milliseconds wide, the submit core never retypes (Enter-only retries), a shell pane does not read as composer empty, and relaunch re-creates a gone endpoint, so no action is required.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 8 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Regression repro: on the base commit, operator runs fm-control exit on an idle Claude 2.1.296 task worker and the pane answers 'Unknown command: /exit' while the script reports exit=unconfirmed ✅ pass live 01-base-exit-unknown-command.txt: error: exit-delivered t1 ... agent-state=alive exit=unconfirmed; the agent did not stop within 30s, rc=1 after 38s, pane shows Unknown command: /exit, pane_curren…
Operator runs fm-control exit (target commit) on that same idle Claude task worker and the agent stops, leaving its shell and worktree ✅ pass live 02-target-exit-idle.txt: stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1, rc=0 after 5s, pane shows AGENT-EXITED rc=0, pane_current_command=bash; a second exit reports `already-stopped…
Operator runs fm-control exit on a Claude worker that is mid-turn (Bash tool running, shell cd'd into its inbox dir) and the agent stops ✅ pass live 03-target-exit-midturn.txt: stopped t1 ..., rc=0 after 4s, pane shows AGENT-EXITED rc=0, pane_current_command=bash
Operator runs fm-control relaunch on a stuck mid-turn worker whose shell is inside state/<id>.inbox; the old agent exits and a replacement starts in the worktree and can handle its inbox ✅ pass live 04-target-relaunch.txt: relaunched t1 harness=claude from=claude ... endpoint=fmses:fm-t1, rc=0 after 8s; pane shows cd -- &#39;&lt;worktree&gt;&#39; then the new agent; 001.msg moved to handled/, inbox-proof.t…
Operator runs fm-control exit on a worker launched by the product's own fm-spawn (real worker flags, busy_gen recorded) and it stops ✅ pass live 06-target-exit-spawned-worker.txt: worker argv includes --disable-slash-commands; stopped t1 ..., rc=0 after 4s, pane_current_command=bash
Adversarial: bare exit still stops a Claude launched without --disable-slash-commands (slash commands registered, secondmate-style launch) ✅ pass live 07-target-exit-slash-commands-enabled.txt: stopped t1 ..., rc=0 after 5s, pane shows AGENT-EXITED rc=0
Firstmate scaffolds a ship brief and a secondmate charter; both tell the worker to reach the inbox by absolute path and never cd into it ✅ pass live 05-emitted-ship-brief-local-only.md line 94 and 05-emitted-secondmate-charter.md line 43, generated by bin/fm-brief.sh in the lab home; tests/fm-brief.test.sh passes (09-fm-brief-test.log)
A fresh worker given the new brief handles an inbox message without its shell leaving the worktree ✅ pass live 04-target-relaunch.txt: replacement worker used absolute inbox paths for read and mv, final pwd = worktree. Single run of model behaviour, so it shows the sentence works here, not that the failure…
A worker already wedged with the repo PreToolUse hook failing every Bash call is recovered by relaunch ⏸️ untested no The lab worker runs with --setting-sources &#39;&#39; in a throwaway repo that has no PreToolUse hook, so the hook-failure half of the wedge could not be reproduced. Reproducing it needs a lab project that…
Secondmate restart through the control plane (kind=secondmate, background-task exit picker guard) ⏸️ untested no Needs a provisioned lab secondmate home and a Claude session holding a background task to open the picker; not set up in this run. The slash-enabled exit itself was driven live in scenario 6.
  • bin/fm-lab-home.sh create $LAB + private tmux -L fm-lab session fmses:fm-t1 running claude --dangerously-skip-permissions --setting-sources &#39;&#39; --strict-mcp-config --disable-slash-commands
  • Base repro: git archive 9695b55 extracted into the lab, FM_HOME=$LAB &lt;base&gt;/bin/fm-control.sh t1 exit against the idle worker
  • FM_HOME=$LAB bin/fm-control.sh t1 exit (target) against the same idle worker, then a second time for idempotence
  • FM_HOME=$LAB bin/fm-control.sh t1 exit against a worker mid-turn running cd $LAB/state/t1.inbox &amp;&amp; sleep 300 in its Bash tool
  • FM_HOME=$LAB bin/fm-quota-intake.sh record + gate --harness claude in the lab home
  • FM_HOME=$LAB bin/fm-brief.sh t1 p --mode local-only and bin/fm-brief.sh s1 --secondmate --no-projects, emitted briefs inspected
  • FM_HOME=$LAB bin/fm-control.sh t1 relaunch --note ... against a mid-turn worker whose shell was inside state/t1.inbox, with 001.msg waiting in the inbox
  • FM_HOME=$LAB bin/fm-control.sh t1 exit against the replacement worker launched by fm-spawn.sh --relaunch
  • FM_HOME=$LAB bin/fm-control.sh t1 exit against Claude started without --disable-slash-commands
  • bash tests/fm-control.test.sh
  • bash tests/fm-brief.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…ls out of the inbox

Claude task workers launch with --disable-slash-commands, which on Claude
Code 2.1.296 unregisters every built-in slash command, so fm-control's /exit
printed 'Unknown command: /exit' and exit/relaunch timed out unconfirmed.
The bare word exit is handled locally, idle or mid-turn, and never reaches
the model. The worker brief now tells workers to reach the steering inbox by
absolute path and never cd outside their worktree.
@doitdigital0495
doitdigital0495 merged commit 08041fa into main Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants