You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: prevent manual Claude Stop hook calls from arming supervision - #6032
convert decided plan to an implementation plan in md file and pass that back to firstmate for implementation
Context: that closed the captain's review of the AFK revamp audit, in which the captain selected "Sequence and 3d scope: approve-claude-only-3d1" (the audit's proposed execution sequence approved; the first default-on flip is Claude-only), "3e non-Claude scope: build-3d2-first", all twelve backlog dispositions, and "Sailboat and anchor on Claude: build-now-always-on". The resulting plan is data/fm-afk-revamp-audit-s1/implementation-plan.md in the Firstmate home ~/fm-homes/fmdev-f1, with its evidence in report.md beside it. The AFK revamp's standing words also apply: "2 should be done by opus crewmates" and "this is a major architectural revamp so i want it to do very careful live validation including regression in isolated live environments with some real complex sessions before calling it done. it's ok to use my real llm tokens here".
This task is P4 in that plan: bin/fm-claude-stop-autoarm.sh has no help mode, so a model that runs it with --help mid-turn arms a real supervision-host park owned by that tool process, and when the process exits supervision is down until the next turn end (seen live in the 3c-3 lab, finding U1). Default-on multiplies that exposure, so this ships before or with the Claude default-on flip.
What Changed
Add help output for -h and --help, and reject other arguments before the Claude Stop hook reads state or arms supervision.
Document that the hook must not be used as a manual arm from a tool turn.
Add regression coverage confirming argument calls leave state unchanged while the normal Stop path still arms.
Risk Assessment
✅ Low: The argument guard runs before hook state is read or changed, and the behavioral regression test covers manual arguments and the ordinary Stop path.
Testing
The targeted regression test passed. In the live Claude lab, --help printed usage and --bogus was refused with exit 2; neither invocation created auto-arm state or changed the persisted task. The lab was removed.
Live validation: ✅ go - 2 of 2 scenarios driven live against the product
Scenario
Result
Live
Evidence
A Claude primary requests hook help mid-turn and receives usage without arming supervision
✅ pass
live
Claude manual-hook transcript and isolated state; targeted regression test
A Claude primary passes an unknown argument and receives a refusal without changing supervision state
✅ pass
live
Claude manual-hook transcript and isolated state; targeted regression test
Evidence: Claude manual-hook transcript and isolated state
Real Claude Code tmux lab primary (Claude 2.1.284 (Claude Code))
⏺ Captain, here's the output:
Usage: fm-claude-stop-autoarm.sh
Claude Stop hook registered in .claude/settings.json; not for manual use.
It reads the Stop payload on stdin and, in a primary home that needs
supervision, arms the watcher or supervision host for this session.
Exit 0 is silent; exit 2 carries a rewake banner on stderr.
error: unknown argument: --bogus
Usage: fm-claude-stop-autoarm.sh
Claude Stop hook registered in .claude/settings.json; not for manual use.
It reads the Stop payload on stdin and, in a primary home that needs
supervision, arms the watcher or supervision host for this session.
Exit 0 is silent; exit 2 carries a rewake banner on stderr.
exit=2
✻ Cogitated for 9s · done 12:13 PM
────────────────────────────────────────────────────────────────────────────────
❯ now try it with a valid stdin payload
────────────────────────────────────────────────────────────────────────────────
Opus 4.8 ctx window ▉ 60.4k / 1.0M
⏵⏵ auto mode on (shift+tab to cycle) · ← for agents
Isolated lab state after manual --help and --bogus:
total 16
drwxr-xr-x@ 4 kunchen staff 128 Sep 28 12:13 .
drwx------@ 8 kunchen staff 256 Sep 28 12:11 ..
-rw-r--r--@ 1 kunchen staff 6 Sep 28 12:13 .lock
-rw-r--r--@ 1 kunchen staff 44 Sep 28 12:11 task.meta
Persisted task checksum:
43657233 44 /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T//fm-lab.HV1Pn0/state/task.meta
Live validation: ✅ go - 2 of 2 scenarios driven live against the product
Scenario
Result
Live
Evidence
A Claude primary requests hook help mid-turn and receives usage without arming supervision
✅ pass
live
Claude manual-hook transcript and isolated state; targeted regression test
A Claude primary passes an unknown argument and receives a refusal without changing supervision state
✅ pass
live
Claude manual-hook transcript and isolated state; targeted regression test
bash tests/fm-claude-stop-autoarm.test.sh
Ran real Claude Code 2.1.284 in a disposable, private-tmux lab and had it invoke the hook with --help and --bogus; inspected the lab state, then tore down the lab.
Intent
convert decided plan to an implementation plan in md file and pass that back to firstmate for implementation
Context: that closed the captain's review of the AFK revamp audit, in which the captain selected "Sequence and 3d scope: approve-claude-only-3d1" (the audit's proposed execution sequence approved; the first default-on flip is Claude-only), "3e non-Claude scope: build-3d2-first", all twelve backlog dispositions, and "Sailboat and anchor on Claude: build-now-always-on". The resulting plan is data/fm-afk-revamp-audit-s1/implementation-plan.md in the Firstmate home ~/fm-homes/fmdev-f1, with its evidence in report.md beside it. The AFK revamp's standing words also apply: "2 should be done by opus crewmates" and "this is a major architectural revamp so i want it to do very careful live validation including regression in isolated live environments with some real complex sessions before calling it done. it's ok to use my real llm tokens here".
This task is P4 in that plan: bin/fm-claude-stop-autoarm.sh has no help mode, so a model that runs it with --help mid-turn arms a real supervision-host park owned by that tool process, and when the process exits supervision is down until the next turn end (seen live in the 3c-3 lab, finding U1). Default-on multiplies that exposure, so this ships before or with the Claude default-on flip.
What Changed
-hand--help, and reject other arguments before the Claude Stop hook reads state or arms supervision.Risk Assessment
✅ Low: The argument guard runs before hook state is read or changed, and the behavioral regression test covers manual arguments and the ordinary Stop path.
Testing
The targeted regression test passed. In the live Claude lab,
--helpprinted usage and--boguswas refused with exit 2; neither invocation created auto-arm state or changed the persisted task. The lab was removed.Evidence: Claude manual-hook transcript and isolated state
Source: Claude manual-hook transcript and isolated state
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-claude-stop-autoarm.test.shRan real Claude Code 2.1.284 in a disposable, private-tmux lab and had it invoke the hook with--helpand--bogus; inspected the lab state, then tore down the lab.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.