Repository navigation
feat(mods): add the read-only Claude Code Fleet mod behind FM_FLEET_ENABLED - #27
Merged
Merged
Conversation
…, and notices A Claude Code mod that gives a supervision session a fleet view: /fleet lists every task with its state, the evidence that state came from, its age, and its last wake event; one line above the prompt names what waits on the captain and draws nothing at all when nothing does; and a transient notice fires the first time a task reaches done, blocked, or failed. The one data source is bin/fm-fleet-snapshot.sh --json, measured at 17.7-21.6s against a 10s budget for one hook, with two overlapping runs measured at 72s where one takes 18s. So it runs only from a 60s timer and one un-awaited reading at session start, both behind a single in-flight promise; a drawing hook never starts it and only ever draws the cache. A failed, timed-out, or wrong-schema reading is reported as unavailable or stale with its age, never as a healthy empty fleet, and every reading redraws so a drawing cannot go on claiming more than the mod still knows. Only current_state is printed as a state word and the status log's last line stays labeled as an event, because that line goes stale exactly when a resolved decision lets a worker resume; unreadable and unknown are kept apart. Whether the session can draw comes from session start's own isInteractive, since a pane reports itself placed even in a -p run where nothing can draw; those sessions get the same rows as text from /fleet instead. Other mods keep their band content. Activation follows Calm's firstmate-owned gate: FM_FLEET_ENABLED must equal 1 exactly, and anything else leaves the mod a complete no-op even once Claude Code has loaded the module. It is new, so it carries no deprecated alias. Nothing in it writes, and the capabilities the module reaches for are pinned by the strict-validation guard rather than left to review. Policy lives in plain libs testable under Node and the engine glue in one hooks module. tests/fm-fleet-mod.test.sh pins the plugin's shape, the activation rule, the reading policy, and the parser against the real producer's own bytes; tests/fm-fleet-mod-plugin.test.sh runs claude plugin validate --strict and the mod's engine suites against the installed Claude Code. Verified on 2.1.291. Also gitignores the tsconfig and type declarations claude --plugin-dir writes into a mod while hot-reloading, which is the documented way to develop one.
…ly across reloads
…e, worded by kind
max-metaplanet
force-pushed
the
fm/fleet-mod
branch
from
October 6, 2026 10:47
4488a6d to
fc12da2
Compare
max-metaplanet
added a commit
that referenced
this pull request
Oct 6, 2026
…NABLED (#27) * feat(firstmate-fleet): add the read-only Claude Code fleet pane, band, and notices A Claude Code mod that gives a supervision session a fleet view: /fleet lists every task with its state, the evidence that state came from, its age, and its last wake event; one line above the prompt names what waits on the captain and draws nothing at all when nothing does; and a transient notice fires the first time a task reaches done, blocked, or failed. The one data source is bin/fm-fleet-snapshot.sh --json, measured at 17.7-21.6s against a 10s budget for one hook, with two overlapping runs measured at 72s where one takes 18s. So it runs only from a 60s timer and one un-awaited reading at session start, both behind a single in-flight promise; a drawing hook never starts it and only ever draws the cache. A failed, timed-out, or wrong-schema reading is reported as unavailable or stale with its age, never as a healthy empty fleet, and every reading redraws so a drawing cannot go on claiming more than the mod still knows. Only current_state is printed as a state word and the status log's last line stays labeled as an event, because that line goes stale exactly when a resolved decision lets a worker resume; unreadable and unknown are kept apart. Whether the session can draw comes from session start's own isInteractive, since a pane reports itself placed even in a -p run where nothing can draw; those sessions get the same rows as text from /fleet instead. Other mods keep their band content. Activation follows Calm's firstmate-owned gate: FM_FLEET_ENABLED must equal 1 exactly, and anything else leaves the mod a complete no-op even once Claude Code has loaded the module. It is new, so it carries no deprecated alias. Nothing in it writes, and the capabilities the module reaches for are pinned by the strict-validation guard rather than left to review. Policy lives in plain libs testable under Node and the engine glue in one hooks module. tests/fm-fleet-mod.test.sh pins the plugin's shape, the activation rule, the reading policy, and the parser against the real producer's own bytes; tests/fm-fleet-mod-plugin.test.sh runs claude plugin validate --strict and the mod's engine suites against the installed Claude Code. Verified on 2.1.291. Also gitignores the tsconfig and type declarations claude --plugin-dir writes into a mod while hot-reloading, which is the documented way to develop one. * no-mistakes(review): Dedup fleet notices on announced word; load lazily across reloads * no-mistakes(test): Update fleet mod test for types dir and announced field * no-mistakes(review): Silence idle fleet band, keep /fleet text within hook budget * no-mistakes(review): Notify fleet outages once per two-failure episode, worded by kind * no-mistakes(review): Poll the joined fleet reading in bounded /fleet text loop * no-mistakes(test): Bound /fleet text wait by summed sleeps under hook budget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Build a Claude Code mod in the firstmate repo: firstmate-fleet.
It provides a /fleet pane, an above-prompt band that appears only when something waits on the captain (a decision, a merge ask, or a blocker), and done/blocked toasts.
It refreshes in the background every 60s via fm-fleet-snapshot.sh --json with an in-flight guard (the snapshot takes about 18-22s, and must never run inside a render hook).
It has a text fallback via the /fleet command for sessions that cannot draw, and it preserves other mods' band content.
Steer (the report's C6) is NOT in scope.
Deploy it under .claude/mods/ the way Calm is, with tests, and with its own activation consistent with the Calm flag fix already in progress.
Ship via the no-mistakes PR path.
The source is a scout report on Claude Code mods, readable at ~/firstmate/data/claude-mods-research/report.md; sections 2 (platform limits), 5 (supervision-session ideas), 8 (build sketches), 9 (gotchas) and 10a (a working firstmate-fleet prototype that printed the real fleet) are the basis.
Calm, the one firstmate mod already shipped, lives at .claude/mods/firstmate-calm/ with a symlink from .agents/skills/, and a trusted project auto-loads it as a skills-dir plugin with no install step.
The report measured two overlapping snapshot runs taking 72s where one takes 18s, which is why the in-flight guard matters, and found that $.ui.open's isPlaced answers placed in a -p run where nothing can draw, so it must not be used to detect a non-drawing session (use the session.start isInteractive value instead).
The substance of the referenced report sections, since the report itself is a private file outside this repository:
Section 2, the platform and its binding limits. A mod is a plugin whose hooks/hooks.json carries a "modules" key, and its handlers run inside Claude Code as middleware that can observe, rewrite, or answer an event. One hook event has a 10 second budget, which the 17.7-21.6 second fleet snapshot exceeds twice over.$.process.run takes an argv array, uses no shell, defaults to a 30 second timeout so the snapshot needs an explicit timeoutMs, caps stdout at 4 MiB, and rejects both when the program cannot start and when it times out. A pane a mod opens unasked needs 144 terminal columns, 110 once the person has opened one by hand. Toasts are transient, 4 seconds by default. Nothing a mod draws is ever seen in a claude -p run, the Agent SDK, a Desktop WSL session, or the VS Code extension's chat panel, so every drawing needs a text fallback. Module-level variables reset on hot reload; $ .state survives a reload but is reset by /clear, /resume and /branch; $.store survives everything and is shared by every session on the machine.
Section 5, the three supervision-session ideas this mod is (C1, C2 and C3 of that list). C1 is the decision band: one line above the prompt naming every task with an open decision or a blocked or failed state, and nothing at all when that set is empty, with noise from ever drawing on an empty set named as the main risk. C2 is the fleet pane: one row per task with its state, the source that state was resolved from, its age and its last event, "r" to refresh, read from fm-fleet-snapshot.sh on a timer, with the 18-22 second read kept off the render path and overlapping runs named as the contention risk. C3 is the worker-done or needs-decision toast the moment a task's state word changes, at most one refresh period late, deduplicated on the last announced word so a flapping task cannot toast repeatedly.
Section 8, the build sketch. session.start reads the home, records e.isInteractive as whether anything can be drawn, registers the /fleet command inside try/catch, starts a 60 second clock, and fires one un-awaited refresh so the session starts instantly. refresh runs the snapshot with an explicit timeout behind an in-flight promise, parses it, caches it, diffs the state words against the announced set to toast transitions, then invalidates the drawing. The pane hook, filtered on the fleet request id, draws only the cache. The band hook returns next(e) and draws nothing when nothing is waiting, and awaits next(e) and nests that result above its own line when something is, so other mods' band content survives.
Section 9, the gotchas that bite. The status log is an event history and not a state, and its last line goes stale exactly when a resolved decision lets a crew resume, so only current_state from the snapshot may be printed as a state word. fm-crew-state.sh mints "unreadable" as distinct from "unknown", the reader's claim about itself, and a surface that collapses the two loses a distinction its author built deliberately. Registering the same event twice without a matcher fails the whole module to load. A thrown $.command.register skips the rest of the session.start hook, so commands are registered last or guarded. An invalid element tree silently draws Claude Code's own version instead. focus, closeOnEscape and holdToasts accept only true and throw on false. Returning a tree in the band replaces what later mods draw there. Mods are not sandboxed, so claude plugin validate's reported calls line is the review surface. claude plugin validate --strict and claude plugin test are the lint and test tools and need no session, sign-in or network.
Section 10a, the prototype. A working firstmate-fleet skeleton that printed the real 14-task fleet, validated with claude plugin validate and tested with claude plugin test on Claude Code 2.1.291. It is to be hardened rather than rewritten.
The Calm flag fix the activation must be consistent with has since merged to main as "feat(mods): gate the Claude Code Calm mod on its own FM_CALM_ENABLED flag". It moves Calm's gate off the dead CLAUDE_CODE_ENABLE_FUNCTION_HOOKS early-access flag onto a firstmate-owned FM_CALM_ENABLED that must equal "1" exactly, keeping "a complete no-op unless explicitly enabled", and reads the old name only as a deprecated alias because Calm already had one.
What Changed
firstmate-fleetmod under.claude/mods/firstmate-fleet. Like Calm, it auto-loads through a symlink in.agents/skills. It does nothing unlessFM_FLEET_ENABLEDis exactly"1", and it has no deprecated alias. Once enabled, it provides:/fleetpane with one row per task showingcurrent_state, the evidence that state came from, its age and the last event;rrefreshes it/fleetin sessions that cannot draw, decided fromsession.start'sisInteractivebin/fm-fleet-snapshot.sh --jsononly from a 60s timer, one un-awaited start-up reading, or the text path of/fleet. All three share one in-flight promise with an explicit timeout, so drawing hooks only ever draw the cache. A failed or aged reading is marked unavailable or stale with its reason, never shown as an empty fleet. One toast fires on the second failure in a row. The/fleettext wait counts its own sleeps and stops 2s short of the hook budget.tests/fm-fleet-mod.test.shandtests/fm-fleet-mod-plugin.test.sh, the latter a strict-validation guard that pins the env names and capabilities the mod reads. Also wires these intobin/fm-test-run.sh, addsdocs/fleet-mod.md, updates theAGENTS.mdlayout line, and gitignores the types and tsconfig Claude Code generates during hot-reload.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The last fix round correctly replaces the single racing sleep with a bounded polling loop. The loop joins the in-flight reading without starting a second snapshot, re-reads the budget on each pass, stops after 90s, and falls back to the reading-in-progress marker. The outage-notice behavior and the rest of the mod were verified in earlier rounds and are unchanged.
Testing
I drove the changed /fleet text-wait path live on Claude Code 2.1.291, using a stub fm-fleet-snapshot.sh that writes a run log. In non-drawing stream-json sessions, asking /fleet during a 25s clock reading gave the reading-in-progress marker at 8.1s. Readings that landed about 5s and 7.5s after the ask came back with the full rows, at 5.6s and 7.5s. Every case had exactly one reader run. A plain -p /fleet printed the rows. With the flag unset or set to "true" the mod stayed inert and ran no reader. In a throwaway fm-lab Herdr session, an interactive session drew the waiting band above the prompt and opened the /fleet pane. Pressing r twice ran the reader once. The mod's portable test and plugin test suites passed. The lab was torn down and the scratch dirs removed. The TUI evidence is plain-text and ANSI terminal captures only. No PNG was made because no ANSI-to-image converter is installed, and earlier PNGs in the same evidence directory came from older commits.
Evidence: Text-join bound: marker answer at 8.1s, one reader run
Source: Text-join bound: marker answer at 8.1s, one reader run
Evidence: Text-join wait wins: rows at 5.6s
Source: Text-join wait wins: rows at 5.6s
Evidence: Text-join near bound: rows at 7.5s
Source: Text-join near bound: rows at 7.5s
Evidence: -p text fallback prints rows
Source: -p text fallback prints rows
Evidence: Flag off: inert, no reader runs
Source: Flag off: inert, no reader runs
Evidence: Interactive band with waiting task (text)
Source: Interactive band with waiting task (text)
Evidence: Interactive band (ANSI)
Source: Interactive band (ANSI)
Evidence: Interactive /fleet pane (text)
Source: Interactive /fleet pane (text)
Evidence: Interactive /fleet pane (ANSI)
Source: Interactive /fleet pane (ANSI)
Evidence: Pane r pressed twice -> one reader run
Source: Pane r pressed twice -> one reader run
Evidence: Portable mod test
Source: Portable mod test
Evidence: Plugin validate/test
Source: Plugin validate/test
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed (4) ✅
.claude/mods/firstmate-fleet/lib/fm-fleet-toasts.ts:41- Notices are deduplicated on the last word seen, not the last word announced, which goes against the intent's C3 requirement ("deduplicated on the last announced word so a flapping task cannot toast repeatedly").fleetToastsputs every row's current state into the carried map (states.set(row.id, row.state)) and register.ts overwritesannounced = round.stateson every reading. Example: a task reads blocked → working → blocked → working → blocked on consecutive 60s refreshes. Each return to blocked compares against the stored "working", so it toasts every other refresh, which is the repeated toasting the intent rules out. The file's header comment says "the recorded word is the one last announced", which the code does not do, and no test covers the blocked→working→blocked sequence. Suggested fix: carry the last announced word per task and only update it when a toast actually fires (or when the task moves into a non-announced state, if re-announcing after a real resolution is wanted). Which of those two behaviors to keep is the author's call..claude/mods/firstmate-fleet/hooks/register.ts:223- All of the session setup (snapshotCommand,canDraw, the 60sticker, the first refresh) happens only insession.startand is kept in module variables. Module variables reset on hot reload, and session.start does not run again after one. A reload happens when the firstmate checkout is updated under a running supervision session, for example by pulling a merged change to this mod. After that: no timer, so no refreshes and no toasts. Snapshot is undefined and the error is empty, so the band is 'unread' and draws nothing, which silently says nothing is waiting.canDrawis false, so /fleet in an interactive session returns text "fleet unavailable: the fleet reader has not been resolved yet" instead of opening the pane, and the band then stays yellow. Calm guards against exactly this with a lazy, cachedensureLoadedthat every hook awaits (firstmate-calm/hooks/register.ts:30-33, 147-150). Suggested fix: resolve the command and start the ticker lazily from every activated hook, and keepisInteractivein$.state, which survives a reload.🔧 Fix applied.
1 info still open:
ℹ️
.claude/mods/firstmate-fleet/hooks/register.ts:95- After a hot reload, the lazyloadstarts the 60s clock but never takes a first reading. Until the first tick fires, the snapshot is undefined. In that window the band draws nothing and a /fleet pane opened in an interactive session shows no rows; pressing 'r' fixes it. This is a short gap after a reload, not a lasting failure, and it keeps reads away from render hooks. If you want to close it,loadcould start an un-awaitedrefresh($)when no reading is cached, since the call is never awaited inside the render. Optional..claude/mods/firstmate-fleet/hooks/register.ts:276- The text fallback for /fleet can wait out the whole snapshot read inside one hook. In a non-drawing session, if no reading has landed yet (snapshot === undefined && readError === ""),command.runawaitsrefresh($), which joins or starts the 17.7-21.6sfm-fleet-snapshot.shrun. The intent's platform limits give one hook event a 10s budget. The most common text-fallback case hits this:claude -p "/fleet"(or an SDK call) runs the command right after session.start, while the un-awaited first read is still in flight. The handler then runs about 2x over budget, so the command is likely cut off and returns no fleet text at all. The unit tests use an instant fake process, so they never reach this. Fix: race the in-flight read against a deadline under the budget (for example about 8s), then returnfleetTextReport(await view($)), which already says "reading the fleet…" or shows the rows. The docs line "joins the reading already under way" should change to match..claude/mods/firstmate-fleet/lib/fm-fleet-toasts.ts:17- No notice fires when a worker raises a decision. The intent's C3 asks for "the worker-done or needs-decision toast the moment a task's state word changes", butANNOUNCED_STATESis only done/blocked/failed.bin/fm-crew-state.shmap_log_stateturns aneeds-decisionstatus line into the state wordparked, which is not in the set. So a worker that stops to ask the captain a decision raises no notice; only the band shows it. The intent's summary line says "done/blocked toasts", so the two parts of the intent disagree. Addingparkedis not a simple fix either:parkedalso covers parked no-mistakes runs, so a narrower trigger may be needed, such aspendingDecision/openDecisionsturning on. The author needs to decide whether needs-decision notices are in scope and what should trigger them..claude/mods/firstmate-fleet/lib/fm-fleet-view.ts:304- The band also draws when nothing is waiting, which goes against the intent's C1 wording. The intent says the band "appears only when something waits on the captain (a decision, a merge ask, or a blocker)" and C1 says "nothing at all when that set is empty".fleetBandalso returns a yellow line when the reading is stale or unavailable and nothing waits (if (freshness.kind === "stale" || freshness.kind === "unavailable") return { tone: "yellow", ... }). Example: the snapshot script keeps failing (bad FM_HOME, a reader error, or a timeout). Then a permanent yellow "fleet unavailable: …" line sits above the prompt even though nothing waits on the captain. That is the always-drawn noise C1 names as the main risk. docs/fleet-mod.md also says both "nothing whatsoever when nothing does" and "The band draws in all three cases". The design reason (silence would imply nothing waits) is reasonable, but it is an added behavior beyond the stated intent. Remove the yellow branch, or confirm it as wanted and fix the doc contradiction.🔧 Fix applied.
2 issues (1 warning, 1 info) still open:
.claude/mods/firstmate-fleet/hooks/register.ts:177- The one-shot outage notice fires on any failed reading, but the user asked for it only "on the transition into unavailable". InfleetFreshness, a failure that follows a good reading isstale(the rows stay), notunavailable. Here is the sequence: good readings land, then one reading times out at 90s.readFleettakes the error branch,outageAnnouncedis false, and it toasts "fleet unavailable: …timed out…" while the pane still shows every row marked stale. The new test asserts exactly this (good reading, then reject, then a second "fleet unavailable" toast). The result is a misleading word, plus a notice for every transient blip after recovery. A narrower fix would toast only whensnapshot === undefined(the unavailable kind), or would word the notice for the stale case. Asking because the user's wording and the fixer's reading of it differ..claude/mods/firstmate-fleet/hooks/register.ts:232-readForTextraces the in-flight reading against one$.clock.sleep(remainingMs - 2s)and then answers "reading the fleet…". The user's stated budget rule is that time inside a$.*call is not counted. Time spent in that sleep therefore does not use the budget, and the user suggested a bounded polling loop of sleeps that keeps waiting for the rows. With the current code, a non-drawing SDK session that asks /fleet while the clock's 18-22s reading is under way gives up after about 8s and returns no rows, even though it could have waited for them. In a plain-prun this path is almost never reached, because the first clock tick comes at 60s. No test exercises the branch where the sleep wins.🔧 Fix applied.
1 warning still open:
.claude/mods/firstmate-fleet/hooks/register.ts:226- The fix the user chose in round 4 (text-join-bound-shorter-than-needed) was not applied. The fix commit d557f55 changed only the outage notice.readForTextstill races the in-flight reading against one$.clock.sleep(remainingMs - 2s). Example: a non-drawing session asks /fleet while the clock's 18-22s reading is under way. The answer gives up after about 8s and returns "reading the fleet…" with no rows, even though time inside$.clock.sleepdoes not count against the hook budget and the rows land a few seconds later. The user asked for these: (1) replace the single race with a bounded loop of repeated$.clock.sleepcalls that polls the cache, orinFlightsettling, until the reading lands; (2) keep the single in-flight guard so a second snapshot never starts; (3) keep an overall bound, and if it elapses, answer with the reading-in-progress marker, never an empty fleet; (4) add the missing test for the branch where the wait wins and the rows come back. The docstring at lines 220-224 and docs/fleet-mod.md:54 ("waits only as long as the hook budget allows") also need updating to describe the loop.🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed (2) ✅
tests/fm-fleet-mod.test.sh:62- The review-fix commit broke tests/fm-fleet-mod.test.sh in two ways. (1) It added .claude/mods/firstmate-fleet/types/index.d.ts, but the shape check allowed only hooks, lib and tests, so it failed with 'the mod folder holds hooks, lib, tests, types'. (2) It renamed fleetToasts' return field fromstatestoannounced, but the policy check still readfirst.states, so it threw TypeError: Cannot read properties of undefined. Fixed in the test only: types/ is now allowed and must hold exactly index.d.ts, and the checks read.announced. I also added the blocked→working→blocked→working→blocked sequence (asserting exactly one notice) and a check that a task leaving the fleet drops its record. All four portable checks now pass.claude plugin validate --stricton .claude/skills/firstmate-fleet. The live sessions loaded t…bash tests/fm-fleet-mod.test.sh(failed on the shape check and the renamedstatesfield, fixed, re-run: 4/4 ok)bash tests/fm-fleet-mod-plugin.test.sh(claude plugin validate --strict on the folder and the .claude/skills auto-load path, plus claude plugin test suites: ok)claude -p "/fleet" --plugin-dir .claude/mods/firstmate-fleetwith FM_FLEET_ENABLED unset and with FM_FLEET_ENABLED=true: /fleet not served (falls through to the model and gets a 401), and the reader is never runFM_FLEET_ENABLED=1 claude -p "/fleet"with the reader delayed 3s: the text report prints every row plus the waiting line, and runs.log shows exactly one reader run (/fleet joined the session-start read)Interactiveclaude --plugin-dir ...in a privatetmux -L fmfleetlab160x45 session, reader delayed 20s: the session was usable before the first read landed; /fleet opened the pane; pressing r 3x, then 5x during the timer's in-flight read, never started an overlapping run (runs.log start/end pairs)60s timer readings with lab current_state overrides of blocked, working, blocked, working, blocked, done: on-screen notices captured every 0.5sSwitched the reader to a home with nothing waiting and pressed r: no band line drawn; reopened /fleet to confirm the new reading had landedSecond interactive session with a lab mod whose AbovePrompt hook returns its own line without calling next: both lines are drawn, the other mod's above the fleet'sHot reload: appended a comment to a lab copy of hooks/register.ts (the engine printed 'firstmate-fleet: reloaded'); /fleet then opened the pane, not the text fallback; readings continued at a single 60s cadence; the band was restored🔧 Fix applied.
✅ Re-checked - no issues remain.
claude -p "/fleet"with FM_FLEET_ENABLED=1: gets the fleet as text rows (state word from current_state, event labelled as event, waiting summary), not a panebash tests/fm-fleet-mod.test.sh(baseline portable checks: shape, activation, real-producer parse, toast policy including the blocked→working→blocked flap)bash tests/fm-fleet-mod-plugin.test.sh(realclaude plugin validate --strictscan +claude plugin testsuites)FM_FLEET_ENABLED=1 FM_HOME=<throwaway home> claude -p "/fleet"against the real bin/fm-fleet-snapshot.shclaude -p "/fleet"with FM_FLEET_ENABLED unset / 0 / trueInteractiveclaudein a private tmux socket (tmux -L fmfleetlab) with FM_FLEET_ENABLED=1, FM_HOME=<throwaway home>, FM_ROOT_OVERRIDE=<throwaway stub root whose fm-fleet-snapshot.sh logs runs, sleeps, and emits controlled real-schema JSON>Typed/fleet, pressedr3x during a 25s in-flight read, inspected stub run log for overlapDrove alpha through blocked→working→blocked→working→blocked then beta→done via pane refresh, captured pane/toasts after each stepMade the stub emit non-JSON and captured the pane and band stale markingForced a live hot reload (transient one-line edit to register.ts +/reload-plugins, edit reverted with git checkout), then reopened/fleetand watched the 60s ticker for 2+ minutesFresh session starting with alpha blocked and beta done: checked no notices on the first readingLoaded a throwaway terminal AbovePrompt mod (transient .agents/skills symlink, removed afterwards) and checked both band lines render, and that the other mod's line survives when the fleet has nothing waitingInteractive session with FM_FLEET_ENABLED unset: no /fleet completion, no band, zero snapshot runs🚨
.claude/mods/firstmate-fleet/hooks/register.ts:236- Driven live on Claude Code 2.1.291 in a non-drawing stream-json session, with the lab reader slowed to 25s. /fleet was asked about 1s after the 60s clock reading started. The answer came at 10.04s and was Claude Code's own error, "firstmate-fleet registered /fleet but no command.run hook answered it…", not the rows and not the reading-in-progress marker. A reading that landed exactly 10s after the ask failed the same way (10.05s). Asked 5s before landing, the rows came back in 6.1s with only one reader run. So the loop works only inside 10s, and the single in-flight guard holds. Root cause: the premise that time inside a$.*call does not count is wrong for$.clock.sleep. The engine's own types (HookBudget, clock.sleep) say "a $.clock wait excepted" and "its budget runs on through it". An instrumented scratch copy also loggednext.budget.remainingMs= 9999 on every pass, soif (spareMs <= 0) returnnever fires and the engine drops the hook (one caveat: that copy's added logging was itself a$call). The previous single race (stop at remainingMs − 2s) at least answered with the marker. This needs a decision because the requested design (keep waiting past the budget with repeated$.clock.sleep) is not possible on this engine. Options: (a) bound the loop by its own elapsed wall time (measured with$.clock.now()or summed sleeps) to about 8s, then answer with the reading-in-progress marker; (b) wait through a$call the budget really does not count, which would change the capabilities strict validation pins. A test that fakesremainingMsdoes not show this; only the live engine does.🚨 live validation verdict: no-go (10 of 10 scenarios were driven live against the product); failed: Non-drawing session asks /fleet while the clock's 25s reading is in flight: answers with the rows or the reading-in-progress marker, never an error or an empty fleet
Live validation: ❌ no-go - 10 of 10 scenarios driven live against the product
claude -p /fleetwith FM_FLEET_ENABLED=1 prints every row plus the waiting line, one reader runbash tests/fm-fleet-mod.test.sh(4 portable checks pass)bash tests/fm-fleet-mod-plugin.test.sh(strict validate +claude plugin testsuites pass)FM_FLEET_ENABLED=0|true claude -p /fleet --max-turns 1with lab FM_HOME/FM_ROOT_OVERRIDE: the mod does not answer, no reader runFM_FLEET_ENABLED=1 claude -p /fleet: text rows + waiting line, exactly one reader runclaude -p --input-format stream-jsonsession, 25s-delayed lab reader, /fleet asked during the clock's in-flight reading: Claude Code error at 10.04s (3 runs, incl. an instrumented scratch copy logging next.budget.remainingMs)Same session shape, /fleet asked 5s before the reading lands: rows returned in 6.1s, one reader runInteractiveclaudein isolatedtmux -L fm-lab-fleet170x50: band line while a decision is open;/fleetpane rows +r: Refresh; 3 rapidrpresses with a 15s reader → one reader runInteractive: alpha unblocked → band draws nothingInteractive: forced reader failures → 1st quiet, 2nd one 'fleet reading failing; rows shown are 20s old' notice, 3rd/4th silent, good reading re-arms, new two-failure episode notifies againInteractive fresh session with failing reader: band silent, pane 'fleet unavailable: <reason>', second failure → 'fleet cannot be read' notice🔧 Fix applied.
✅ Re-checked - no issues remain.
FM_FLEET_ENABLED=1 FM_ROOT_OVERRIDE=<lab root> claude -p /fleetwith a 3s stub reader (non-drawing text fallback)claude -p /fleet --max-turns 1with FM_FLEET_ENABLED unset and =true (inert flag, no reader runs)stream-jsonclaude -p --input-format stream-jsondriver: /fleet asked 1.1s into a 25s clock reading (bound path)stream-json driver: /fleet asked 15s into a 20s reading (lands ~5s after ask, the wait succeeds)stream-json driver: /fleet asked 12.7s into a 20s reading (lands ~7.5s after ask, near the 8s bound)Herdr lab viabin/fm-herdr-lab.sh provision/run/teardown(fm-lab-fleetr4b-*): interactive claude, band captured, /fleet pane opened,rpressed twice with a 4s readerbash tests/fm-fleet-mod.test.shbash tests/fm-fleet-mod-plugin.test.sh(claude plugin validate --strict + claude plugin test on 2.1.291)✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.