Answer the option menu a Claude Code pane is showing.
Parsing and selection are pure. All screen reads and key writes go through the existing host port; this namespace never starts a compaction job.
This verb sits on the operator's consent boundary. It answers only a menu it can positively read, refuses a permission dialog unless the caller passes permission? with an expect text from the dialog, never chooses a standing grant, re-reads the pane before Enter, and audits every attempt to a file whether or not a job is running on the pane.
Answer the option menu a Claude Code pane is showing. Parsing and selection are pure. All screen reads and key writes go through the existing host port; this namespace never starts a compaction job. This verb sits on the operator's consent boundary. It answers only a menu it can positively read, refuses a permission dialog unless the caller passes permission? with an expect text from the dialog, never chooses a standing grant, re-reads the pane before Enter, and audits every attempt to a file whether or not a job is running on the pane.
Who is calling, and is a pane row the caller's own session? (card 20261122175413-3d66aa77.)
The host stamps every call with _caller_id. A coordinator is
coordinator:<token>, and since bb-mcp #45 (2026-11-18) the token is the
first 8 hex digits of the Claude session id. bb-mcp falls back to the
client pid only when no session record was readable. The pid-only reader
this replaces returned nil for a hex token, so every own-pane guard built
on it FAILED OPEN: a session could compact its own pane or answer its own
dialog.
Ported from hive-self-steer's caller-token (PR #10). An 8-character token is always a session token, digits only included: a Linux pid has at most 7 digits (pid_max 4194304).
FAIL CLOSED. A coordinator: id whose token is neither form is
:unresolvable. The guards refuse such a caller with a reason. They never
treat it as "not the caller's pane".
Stratum: Promote. Pure; no tmux, no files.
Who is calling, and is a pane row the caller's own session? (card 20261122175413-3d66aa77.) The host stamps every call with `_caller_id`. A coordinator is `coordinator:<token>`, and since bb-mcp #45 (2026-11-18) the token is the first 8 hex digits of the Claude session id. bb-mcp falls back to the client pid only when no session record was readable. The pid-only reader this replaces returned nil for a hex token, so every own-pane guard built on it FAILED OPEN: a session could compact its own pane or answer its own dialog. Ported from hive-self-steer's caller-token (PR #10). An 8-character token is always a session token, digits only included: a Linux pid has at most 7 digits (pid_max 4194304). FAIL CLOSED. A `coordinator:` id whose token is neither form is :unresolvable. The guards refuse such a caller with a reason. They never treat it as "not the caller's pane". Stratum: Promote. Pure; no tmux, no files.
Compact a Claude Code pane and bring it back to work: wait until it is idle, remember its /goal, send /compact, re-seed it with a prompt, then set the goal again.
The goal step exists because /compact clears an active /goal: a peer that is re-seeded with catchup alone finishes catchup, finds no task and stops.
WAITING FOR REST. A job must not type into a working turn, so every step
waits for rest first. A pane busy for ordinary reasons is read at a settled
idle (idle twice, :settle-ms apart); a pane under a /goal Stop hook is read
at its single turn boundary, because the hook restarts the next turn within
a poll and twice-in-a-row can never happen on it (friction 20261116185504:
30 min at :wait-idle, then 337k -> 469k tokens). poll/wait-rest is the one
waiter, so the choice holds across every step of a job.
THE GOAL LOOP (card 20261122170735-7c6f5ad3). Measured on Claude Code
2.1.330: a pane its /goal Stop hook keeps re-prompting shows NO rest at all
(the spinner and its timer run on across turns, running Stop hooks 1/2
at each turn end, then Goal not yet met… continuing), and a /compact
typed into it stays Queued through every re-prompt. A force-sent
(C-x C-s) /compact does run, but the goal stays active and the loop
resumes. So on a pane poll/goal-looping? reads, the job reads the goal
text, types /goal clear (taken in mid-turn, per the /goal docs and as
measured), waits for the settled idle the ended loop gives, compacts,
re-seeds with the goal text inside the re-seed prompt (goal-reseed), and
sets the goal again. :goal-loop false turns it off.
Strata:
Promote due? / ctx-drop / goal-after pure
Pipeline compact! / say! / goal! drive the steps through the host port
(waiting: poll; typing: composer)
Boundary start! / job / jobs one background job per pane
Every effect (tmux, transcript, clock, sleep) goes through the host port, so the whole sequence runs in a test against a scripted screen.
Compact a Claude Code pane and bring it back to work: wait until it is
idle, remember its /goal, send /compact, re-seed it with a prompt, then
set the goal again.
The goal step exists because /compact clears an active /goal: a peer that
is re-seeded with catchup alone finishes catchup, finds no task and stops.
WAITING FOR REST. A job must not type into a working turn, so every step
waits for rest first. A pane busy for ordinary reasons is read at a settled
idle (idle twice, :settle-ms apart); a pane under a /goal Stop hook is read
at its single turn boundary, because the hook restarts the next turn within
a poll and twice-in-a-row can never happen on it (friction 20261116185504:
30 min at :wait-idle, then 337k -> 469k tokens). `poll/wait-rest` is the one
waiter, so the choice holds across every step of a job.
THE GOAL LOOP (card 20261122170735-7c6f5ad3). Measured on Claude Code
2.1.330: a pane its /goal Stop hook keeps re-prompting shows NO rest at all
(the spinner and its timer run on across turns, `running Stop hooks 1/2`
at each turn end, then `Goal not yet met… continuing`), and a /compact
typed into it stays Queued through every re-prompt. A force-sent
(C-x C-s) /compact does run, but the goal stays active and the loop
resumes. So on a pane `poll/goal-looping?` reads, the job reads the goal
text, types `/goal clear` (taken in mid-turn, per the /goal docs and as
measured), waits for the settled idle the ended loop gives, compacts,
re-seeds with the goal text inside the re-seed prompt (`goal-reseed`), and
sets the goal again. :goal-loop false turns it off.
Strata:
Promote due? / ctx-drop / goal-after pure
Pipeline compact! / say! / goal! drive the steps through the host port
(waiting: `poll`; typing: `composer`)
Boundary start! / job / jobs one background job per pane
Every effect (tmux, transcript, clock, sleep) goes through the host port,
so the whole sequence runs in a test against a scripted screen.The prompt line (composer) of a Claude Code pane: type text into it and, for a slash command, read it back before submitting it.
Stratum: Pipeline, under hive-tmux.claude.compact. Every effect (tmux,
sleep) goes through the host port.
The prompt line (composer) of a Claude Code pane: type text into it and, for a slash command, read it back before submitting it. Stratum: Pipeline, under `hive-tmux.claude.compact`. Every effect (tmux, sleep) goes through the host port.
The host port the Claude pane verbs read and write through, and its one real adapter.
Stratum: Port + Boundary. Everything that touches the tmux server, the
Claude Code state directory (~/.claude) or the clock is a key of the port
map, so panes and compact are tested with a stub map and no tmux.
The adapter shells out to the tmux CLI rather than libtmux: the panes a
supervisor watches are on whatever server the operator runs, not only the
hive session the python bridge owns.
The host port the Claude pane verbs read and write through, and its one real adapter. Stratum: Port + Boundary. Everything that touches the tmux server, the Claude Code state directory (~/.claude) or the clock is a key of the port map, so `panes` and `compact` are tested with a stub map and no tmux. The adapter shells out to the tmux CLI rather than libtmux: the panes a supervisor watches are on whatever server the operator runs, not only the `hive` session the python bridge owns.
S1 idle-capacity: the lazy-coordinator sense (card 20261122160543-4df00c21).
Coordinators never sit back (axiom 20261003154522-36473755). A coordinator pane that has been at rest for more than :idle-ms (10 min), with no working ling under it in the sixth-sense pulse while its board still holds open todo or doing cards, is spare capacity. This namespace says so:
:idle-capacity {:tmux-coordinator id :tmux-idle-ms n :tmux-live-lings n :tmux-open-cards n}
It never fires for a pane a human is busy with: a pane whose prompt holds
text (:input) or whose session is :waiting on a dialog is not idle
(compact/human-guard, the S3 human-draft guard), and the idle clock
restarts there.
A coordinator is matched by its Claude Code SESSION ID, never by pane id:
tmux reuses pane ids, so a new session in an old pane starts a fresh clock.
Its coordinator ids are the ones bb-mcp stamps (coordinator:<first 8 hex of the session id>, or coordinator:<pid> on an older launcher).
Strata:
Promote coordinator-ids / quiet? / working? / step pure over the ports
Port {:pulse :open-cards :now-ms} see Ports
Boundary default-ports soft-resolved hosts
One firing per idle spell: the pane must work again (or a human touch it) before it can fire again. Pulse and board are read only for a pane already past the threshold, and at most once per :recheck-ms while it stays there.
S1 idle-capacity: the lazy-coordinator sense (card 20261122160543-4df00c21).
Coordinators never sit back (axiom 20261003154522-36473755). A coordinator
pane that has been at rest for more than :idle-ms (10 min), with no
working ling under it in the sixth-sense pulse while its board still holds
open todo or doing cards, is spare capacity. This namespace says so:
:idle-capacity {:tmux-coordinator id :tmux-idle-ms n
:tmux-live-lings n :tmux-open-cards n}
It never fires for a pane a human is busy with: a pane whose prompt holds
text (:input) or whose session is :waiting on a dialog is not idle
(`compact/human-guard`, the S3 human-draft guard), and the idle clock
restarts there.
A coordinator is matched by its Claude Code SESSION ID, never by pane id:
tmux reuses pane ids, so a new session in an old pane starts a fresh clock.
Its coordinator ids are the ones bb-mcp stamps (`coordinator:<first 8 hex of
the session id>`, or `coordinator:<pid>` on an older launcher).
Strata:
Promote coordinator-ids / quiet? / working? / step pure over the ports
Port {:pulse :open-cards :now-ms} see `Ports`
Boundary default-ports soft-resolved hosts
One firing per idle spell: the pane must work again (or a human touch it)
before it can fire again. Pulse and board are read only for a pane already
past the threshold, and at most once per :recheck-ms while it stays there.When may a compact job cut into a working turn? Pure: a screen and a row
in, a verdict out. compact performs what this decides.
A /goal coordinator can keep ONE turn alive for hours by looping on
100 s ss wait calls (friction 20261121180326-2ea1d54b), so a job that
waits for a turn boundary never sees one. Interrupting is the way out,
but a keystroke into a working turn can cut a commit, a ship land or a
kubectl apply in half. So the rule is narrow:
write-markers);read-only-markers) or no
tool runs at all (the model is thinking, the prompt is empty);How the interrupt is made is the caller's choice (:interrupt-via):
:force-send type /compact (Claude Code queues it: Queued · ctrl+x ctrl+s to send now), then C-x C-s. Measured on Claude Code
2.1.330: a running foreground Bash is moved to the
background, not killed, and the compaction starts at once.
:escape Esc (up to 3 tries) until the spinner is gone, then /compact
as usual (the raw-tmux recipe recycle-goal-pane.sh). Esc
kills the running tool call.
Stratum: Promote. No tmux, no clock.
When may a compact job cut into a working turn? Pure: a screen and a row
in, a verdict out. `compact` performs what this decides.
A /goal coordinator can keep ONE turn alive for hours by looping on
100 s `ss wait` calls (friction 20261121180326-2ea1d54b), so a job that
waits for a turn boundary never sees one. Interrupting is the way out,
but a keystroke into a working turn can cut a commit, a `ship land` or a
`kubectl apply` in half. So the rule is narrow:
* never while text stands at the prompt (someone's draft), nor while a
dialog is open (on screen, or the session :waiting on a human);
* never while the running tool reads as a WRITE (`write-markers`);
* under :auto, only on a pane whose /goal was active when the job began,
after it waited :interrupt-after-ms for rest, and only while the
running tool reads as a read-only wait (`read-only-markers`) or no
tool runs at all (the model is thinking, the prompt is empty);
* under true, the goal and wait gates are dropped and an unclassified
tool is accepted; the write and prompt gates still hold.
How the interrupt is made is the caller's choice (:interrupt-via):
:force-send type /compact (Claude Code queues it: `Queued · ctrl+x
ctrl+s to send now`), then C-x C-s. Measured on Claude Code
2.1.330: a running foreground Bash is moved to the
background, not killed, and the compaction starts at once.
:escape Esc (up to 3 tries) until the spinner is gone, then /compact
as usual (the raw-tmux recipe recycle-goal-pane.sh). Esc
kills the running tool call.
Stratum: Promote. No tmux, no clock.Claude Code panes as data: which tmux pane runs which Claude session, how full its context is, and whether it is working.
Strata: Collect list-raw / capture tmux reads through the host port Promote parse-panes / join-session / goal-text / pane-row pure Boundary panes / pane one call that does all of it
Three sources are joined, because no single one is enough: tmux list-panes pane id, target, cwd, title sessions/<pid>.json session id, name, busy|idle (Claude Code's own word) the pane's screen context tokens, /goal active, spinner
A bg session's process is not a child of the pane that shows it, so the join is by name: the footer rule (or the pane title) names the session, the same name ListAgents prints. cwd breaks a tie between equal names.
Claude Code panes as data: which tmux pane runs which Claude session, how full its context is, and whether it is working. Strata: Collect list-raw / capture tmux reads through the host port Promote parse-panes / join-session / goal-text / pane-row pure Boundary panes / pane one call that does all of it Three sources are joined, because no single one is enough: tmux list-panes pane id, target, cwd, title sessions/<pid>.json session id, name, busy|idle (Claude Code's own word) the pane's screen context tokens, /goal active, spinner A bg session's process is not a child of the pane that shows it, so the join is by name: the footer rule (or the pane title) names the session, the same name ListAgents prints. cwd breaks a tie between equal names.
Waiting on a Claude Code pane: poll its row until a predicate holds, until it is at rest twice in a row, until its prompt is free of anyone's text.
Two ways to wait for rest, and the difference matters:
settled idle idle twice, SETTLE-MS apart. A pane between two tool calls looks idle for a moment, so one idle read proves nothing. turn boundary idle once. Under a /goal Stop hook the pane starts its next turn within one poll, so the rest between turns lasts a single read and never two in a row: waiting for two can only ever time out (friction 20261116185504-0376516a).
:between-turns? in the opts selects the second; every waiter here honours
it, so a job stays consistent across all of its steps.
Stratum: Pipeline, under hive-tmux.claude.compact. Every read, clock and
sleep goes through the host port, so a test drives time.
Waiting on a Claude Code pane: poll its row until a predicate holds, until it
is at rest twice in a row, until its prompt is free of anyone's text.
Two ways to wait for rest, and the difference matters:
settled idle idle twice, SETTLE-MS apart. A pane between two tool calls
looks idle for a moment, so one idle read proves nothing.
turn boundary idle once. Under a /goal Stop hook the pane starts its next
turn within one poll, so the rest between turns lasts a
single read and never two in a row: waiting for two can
only ever time out (friction 20261116185504-0376516a).
`:between-turns?` in the opts selects the second; every waiter here honours
it, so a job stays consistent across all of its steps.
Stratum: Pipeline, under `hive-tmux.claude.compact`. Every read, clock and
sleep goes through the host port, so a test drives time.compact-ready (S2, card 20261122160542-14c8ef6c): when a Claude pane may be compacted without losing anything, and the one compactor that may act on it.
A pane is compact-ready only when ALL hold:
compact/idle?);compact/open-dialog?);Strata: Promote verdict / reseed-text / agent-ids / lease-verdict pure Port evidence (row -> {:wrapped-at :handoff}), lease {:read :write!}, silence (row -> result) fns Boundary host-evidence / file-lease / host-silencer soft-resolved host fns, one file
Exactly ONE compactor (decision 20261121215259-7b40b779): auto-compact holds a lease naming its owner; a second owner is refused while the lease is fresh.
compact-ready (S2, card 20261122160542-14c8ef6c): when a Claude pane may be
compacted without losing anything, and the one compactor that may act on it.
A pane is compact-ready only when ALL hold:
- its context is at or over the threshold;
- it is idle (`compact/idle?`);
- its prompt line is empty (:input nil): nobody is typing;
- no dialog is open and the session is not :waiting (`compact/open-dialog?`);
- its coordinator said it is done: it shouted WRAPPED, or a memory tagged
handoff for its agent-session was updated, AFTER the context crossed
the threshold.
Evidence is always matched by the session (its id prefix or its pid, the
two ways a coordinator is named), never by the pane: pane ids are reused
across restarts (friction 181557dd).
Strata:
Promote verdict / reseed-text / agent-ids / lease-verdict pure
Port evidence (row -> {:wrapped-at :handoff}), lease {:read :write!},
silence (row -> result) fns
Boundary host-evidence / file-lease / host-silencer soft-resolved host fns, one file
Exactly ONE compactor (decision 20261121215259-7b40b779): auto-compact
holds a lease naming its owner; a second owner is refused while the lease
is fresh.The tmux subdomain of the host's swarm tool: Claude and Codex discovery,
with Claude compaction, re-seed and goal restore.
swarm tmux panes assistant panes with provider and capabilities; Claude: pane, target, name, session id, cwd, ctx-tokens, busy?, status, goal-active?, goal-age swarm tmux compact compact one pane, or every pane over threshold swarm tmux job one compaction job by id, or all of them
The `tmux` subdomain of the host's `swarm` tool: Claude and Codex discovery,
with Claude compaction, re-seed and goal restore.
swarm tmux panes assistant panes with provider and capabilities;
Claude: pane, target, name, session id, cwd,
ctx-tokens, busy?, status, goal-active?, goal-age
swarm tmux compact compact one pane, or every pane over threshold
swarm tmux job one compaction job by id, or all of themPure reading of a Claude Code pane: the captured screen lines of one tmux pane in, the facts a supervisor needs out.
Stratum: Promote. Nothing here touches tmux, the filesystem or a clock; the
lines come from hive-tmux.claude.panes, which is the Boundary.
What the screen carries (Claude Code 2.1.x):
The context count is the bare NNN tokens that opens the status line. The
spinner line also says 29.8k tokens, which is the turn's output, so only a
first segment made of digits and tokens counts.
Matching is plain string work, no regex: every shape here is a fixed glyph or word at a fixed edge of a line.
Pure reading of a Claude Code pane: the captured screen lines of one tmux
pane in, the facts a supervisor needs out.
Stratum: Promote. Nothing here touches tmux, the filesystem or a clock; the
lines come from `hive-tmux.claude.panes`, which is the Boundary.
What the screen carries (Claude Code 2.1.x):
* Working… (26m 48s · ↓ 29.8k tokens) <- spinner line while a turn runs
260803 tokens · ◎ /goal active (26m) <- status line: context size, goal
──────────── caveman skill hydration ─ <- footer rule naming the session
❯ <- the prompt
-- INSERT -- ⏵⏵ auto mode on <- vim mode + permission mode
The context count is the bare `NNN tokens` that opens the status line. The
spinner line also says `29.8k tokens`, which is the turn's output, so only a
first segment made of digits and ` tokens` counts.
Matching is plain string work, no regex: every shape here is a fixed glyph
or word at a fixed edge of a line.The sixth-sense classes the pane watcher's shouts become, so a supervisor
hears pane changes with swarm ss wait instead of polling.
:sense/pane-idle a pane that worked settled idle :sense/goal-ended a pane's /goal stopped being active :sense/context-high a pane crossed the watch threshold upward :sense/pane-waiting a pane waits on a human (permission or other prompt) :sense/tmux-job a compact | say | goal job ended (detail job_status) :sense/compact-ready a pane may be compacted: high, idle, empty prompt, no dialog, and its coordinator wrapped :sense/idle-capacity a coordinator idle > 10 min with no working ling and open cards (detail coordinator, idle_ms, live_lings, open_cards; hive-tmux.claude.idle-capacity)
sixth-sense belongs to hive-agent, which this addon does not depend on, so its registry is resolved softly (the hive-elm pattern): without it the shouts are still piggybacked, only never pushed.
The sixth-sense classes the pane watcher's shouts become, so a supervisor
hears pane changes with `swarm ss wait` instead of polling.
:sense/pane-idle a pane that worked settled idle
:sense/goal-ended a pane's /goal stopped being active
:sense/context-high a pane crossed the watch threshold upward
:sense/pane-waiting a pane waits on a human (permission or other prompt)
:sense/tmux-job a compact | say | goal job ended (detail job_status)
:sense/compact-ready a pane may be compacted: high, idle, empty prompt,
no dialog, and its coordinator wrapped
:sense/idle-capacity a coordinator idle > 10 min with no working ling and
open cards (detail coordinator, idle_ms, live_lings,
open_cards; hive-tmux.claude.idle-capacity)
sixth-sense belongs to hive-agent, which this addon does not depend on, so
its registry is resolved softly (the hive-elm pattern): without it the
shouts are still piggybacked, only never pushed.Watch Claude Code panes server-side and shout each change, so the agent
that supervises them hears it through sixth-sense (swarm ss wait)
instead of polling tmux.
Strata: Promote step pure: previous pane states + new rows -> states + events Boundary start! / stop! one watcher thread per process, shouts through the host
Events (see hive-tmux.claude.sense for the sense classes):
:pane-idle a pane seen working is idle on two ticks in a row
:goal-ended goal-active? went true -> false, or Goal achieved appeared
:context-high ctx-tokens went from under the threshold to at or over it
:pane-waiting the session status went to :waiting (a permission or other
human prompt); once per waiting spell
:tmux-job a compact | say | goal job ended (via job-ended!)
:compact-ready the pane may be compacted (hive-tmux.claude.ready): over
the threshold, idle, empty prompt, no dialog, and its
coordinator WRAPPED or updated its hand-off after the
crossing; once per spell over the threshold, per session.
With :auto-compact? the watcher, as the ONE compactor
(a host-wide lease), silences the wrapped coordinator's
wakers and compacts it, re-seeding with its hand-off.
:idle-capacity a coordinator session idle > 10 min, no working ling under
it, open cards on its board (hive-tmux.claude.idle-capacity)
The first tick only seeds: a pane already idle when the watch starts is not
news. Every shout is addressed to :parent, the supervisor's agent id, which
is who ss wait hears by default.
Watch Claude Code panes server-side and shout each change, so the agent
that supervises them hears it through sixth-sense (`swarm ss wait`)
instead of polling tmux.
Strata:
Promote step pure: previous pane states + new rows -> states + events
Boundary start! / stop! one watcher thread per process, shouts through the host
Events (see hive-tmux.claude.sense for the sense classes):
:pane-idle a pane seen working is idle on two ticks in a row
:goal-ended goal-active? went true -> false, or `Goal achieved` appeared
:context-high ctx-tokens went from under the threshold to at or over it
:pane-waiting the session status went to :waiting (a permission or other
human prompt); once per waiting spell
:tmux-job a compact | say | goal job ended (via `job-ended!`)
:compact-ready the pane may be compacted (`hive-tmux.claude.ready`): over
the threshold, idle, empty prompt, no dialog, and its
coordinator WRAPPED or updated its hand-off after the
crossing; once per spell over the threshold, per session.
With :auto-compact? the watcher, as the ONE compactor
(a host-wide lease), silences the wrapped coordinator's
wakers and compacts it, re-seeding with its hand-off.
:idle-capacity a coordinator session idle > 10 min, no working ling under
it, open cards on its board (`hive-tmux.claude.idle-capacity`)
The first tick only seeds: a pane already idle when the watch starts is not
news. Every shout is addressed to :parent, the supervisor's agent id, which
is who `ss wait` hears by default.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |