Liking cljdoc? Tell your friends :D

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!) :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.
raw docstring

defaultsclj

source

evidence-wantedclj

(evidence-wanted states rows {:keys [threshold exclude auto-compact?]})

The ROWS (not EXCLUDEd) whose coordinator evidence the boundary should read now: every cheap compact-ready condition holds (ready/candidate?), or, under auto-compact, the pane is over the threshold and not yet silenced (a WRAPPED coordinator whose own wakers keep it busy).

The ROWS (not EXCLUDEd) whose coordinator evidence the boundary should
read now: every cheap compact-ready condition holds (`ready/candidate?`),
or, under auto-compact, the pane is over the threshold and not yet
silenced (a WRAPPED coordinator whose own wakers keep it busy).
sourceraw docstring

job-ended!clj

(job-ended! job)

Shout a finished compact | say | goal JOB to the running watcher's parent. A no-op when no watcher runs: nobody asked to hear it.

Shout a finished compact | say | goal JOB to the running watcher's parent.
A no-op when no watcher runs: nobody asked to hear it.
sourceraw docstring

ready-dataclj

(ready-data row evidence)

The shout data of a :compact-ready about ROW with its EVIDENCE.

The shout data of a :compact-ready about ROW with its EVIDENCE.
sourceraw docstring

row-dataclj

(row-data row)

The shout data of an event about ROW.

The shout data of an event about ROW.
sourceraw docstring

running?clj

(running?)
source

shout-symclj

source

start!clj

(start! {:keys [parent auto-compact? takeover?] :as opts})

Start (or restart) the watcher. OPTS: :parent (agent id the shouts are addressed to; required), :threshold, :interval-ms, :exclude (refs), :auto-compact? (compact every compact-ready pane, as the ONE compactor: takes the host-wide lease, refused while another owner holds it fresh unless :takeover?), :idle-ms / :recheck-ms (idle-capacity), :idle-ports (the idle-capacity ports; default idle-capacity/default-ports), :idle-capacity? false (turn that sense off), and the ports :host :shout-fn :evidence-fn :lease :silencer :start-job! (tests; the defaults read the host).

Start (or restart) the watcher. OPTS: :parent (agent id the shouts are
addressed to; required), :threshold, :interval-ms, :exclude (refs),
:auto-compact? (compact every compact-ready pane, as the ONE compactor:
takes the host-wide lease, refused while another owner holds it fresh
unless :takeover?), :idle-ms / :recheck-ms (idle-capacity), :idle-ports
(the idle-capacity ports; default `idle-capacity/default-ports`),
:idle-capacity? false (turn that sense off), and the ports :host :shout-fn
:evidence-fn :lease :silencer :start-job! (tests; the defaults read the host).
sourceraw docstring

statusclj

(status)
source

stepclj

(step states rows {:keys [exclude] :as opts})

All panes: STATES (pane id -> state) and ROWS now -> {:states :events}. EXCLUDE (a set of refs) drops panes before they are tracked. A pane that vanished is forgotten. OPTS :now (epoch ms) and :evidence (pane id -> evidence) feed :compact-ready.

All panes: STATES (pane id -> state) and ROWS now -> {:states :events}.
EXCLUDE (a set of refs) drops panes before they are tracked. A pane that
vanished is forgotten. OPTS :now (epoch ms) and :evidence (pane id ->
evidence) feed :compact-ready.
sourceraw docstring

stop!clj

(stop!)

Stop the watcher, releasing the compactor lease it holds. Returns its last status, or nil when none ran.

Stop the watcher, releasing the compactor lease it holds. Returns its last
status, or nil when none ran.
sourceraw docstring

tick!clj

(tick! w)

One pass: read the panes and the coordinator evidence, step, shout every event, and (auto-compact) silence and compact. The idle-capacity sense (idle-capacity/step) rides the same pane read, keyed by session id, through the watcher's :idle-ports. Returns the events.

One pass: read the panes and the coordinator evidence, step, shout every
event, and (auto-compact) silence and compact. The idle-capacity sense
(`idle-capacity/step`) rides the same pane read, keyed by session id,
through the watcher's :idle-ports. Returns the events.
sourceraw 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