Liking cljdoc? Tell your friends :D

hive-tmux.claude.compact

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.

Strata: Promote idle? / plan-steps pure Pipeline run! drives the steps through the host port 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.

Strata:
  Promote   idle? / plan-steps          pure
  Pipeline  run!                        drives the steps through the host port
  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.
raw docstring

hive-tmux.claude.host

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.
raw docstring

hive-tmux.claude.panes

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.
raw docstring

hive-tmux.claude.registry

The tmux subdomain of the host's swarm tool: Claude Code panes as data for a supervisor, and compaction with re-seed and goal restore.

swarm tmux panes every Claude pane: 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 Code panes as data
for a supervisor, and compaction with re-seed and goal restore.

  swarm tmux panes     every Claude pane: 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
raw docstring

hive-tmux.claude.screen

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.

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.
raw docstring

hive-tmux.claude.sense

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)

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)

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.
raw docstring

hive-tmux.claude.watch

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!)

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!`)

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.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close