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

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

boundary-seenclj

(boundary-seen before-count boundaries)

Evidence from BOUNDARIES (panes/compact-boundaries of the transcript now) that a compaction finished after the BEFORE-COUNT boundaries there were when /compact was sent. {:by :compact-boundary :tokens post}, or nil.

Evidence from BOUNDARIES (`panes/compact-boundaries` of the transcript now)
that a compaction finished after the BEFORE-COUNT boundaries there were
when /compact was sent. {:by :compact-boundary :tokens post}, or nil.
sourceraw docstring

compact!clj

(compact! h state ref opts)

Compact the pane REF names, through host H, recording progress in STATE (an atom). OPTS: see defaults, plus :force? (ignore the threshold), :instructions (text after /compact), :goal (replace the goal) and :goal-append (extend it). Returns STATE's final value.

The /compact step ends on proof that the compaction ran (send-and-compact!), never on a screen marker. A compaction proven while the pane then stays busy (someone else gave it work) is :done with :reason :pane-busy-after-compact and the texts it did not type under :unsent: the recycle worked, and typing into a working pane is what this job never does.

Compact the pane REF names, through host H, recording progress in STATE
(an atom). OPTS: see `defaults`, plus :force? (ignore the threshold),
:instructions (text after /compact), :goal (replace the goal) and
:goal-append (extend it). Returns STATE's final value.

The /compact step ends on proof that the compaction ran (`send-and-compact!`),
never on a screen marker. A compaction proven while the pane then stays busy
(someone else gave it work) is :done with :reason :pane-busy-after-compact
and the texts it did not type under :unsent: the recycle worked, and typing
into a working pane is what this job never does.
sourceraw docstring

ctx-dropclj

(ctx-drop before row drop-ratio)

Evidence from ROW that a compaction ran: its context fell below DROP-RATIO of BEFORE tokens. {:by :ctx-drop :tokens n}, or nil.

Evidence from ROW that a compaction ran: its context fell below DROP-RATIO
of BEFORE tokens. {:by :ctx-drop :tokens n}, or nil.
sourceraw docstring

default-reseedclj

source

defaultsclj

source

due?clj

(due? row threshold)

Should ROW be compacted at THRESHOLD tokens?

Should ROW be compacted at THRESHOLD tokens?
sourceraw docstring

goal!clj

(goal! h state ref opts)

Set the /goal of the pane REF names without compacting it: OPTS :goal replaces, :goal-append extends the pane's active goal (read from its transcript). Waits for a settled idle; text at the prompt is waited out up to :input-timeout-ms (deliver!), then stops the job.

Set the /goal of the pane REF names without compacting it: OPTS :goal
replaces, :goal-append extends the pane's active goal (read from its
transcript). Waits for a settled idle; text at the prompt is waited out up
to :input-timeout-ms (`deliver!`), then stops the job.
sourceraw docstring

goal-afterclj

(goal-after {:keys [goal goal-append]} captured)

The goal to set after the re-seed. GOAL (an override) wins over CAPTURED; APPEND is added to whichever applies. Nil when there is nothing to set.

The goal to set after the re-seed. GOAL (an override) wins over CAPTURED;
APPEND is added to whichever applies. Nil when there is nothing to set.
sourceraw docstring

idle?clj

Is ROW a Claude pane at rest? See poll/idle?.

Is ROW a Claude pane at rest? See `poll/idle?`.
sourceraw docstring

jobclj

(job job-id)

The current state of JOB-ID, or nil.

The current state of JOB-ID, or nil.
sourceraw docstring

jobsclj

(jobs)

Every job, newest first.

Every job, newest first.
sourceraw docstring

say!clj

(say! h state ref opts)

Submit OPTS :text to the pane REF names as one prompt. Waits for a settled idle first unless :wait-idle? is false (then a busy pane is skipped). Done once the pane starts working on it, or settles: the reply itself can take an hour, read it later with read. Text at the prompt stops the job at once: a say is not queued behind someone's draft.

Submit OPTS :text to the pane REF names as one prompt. Waits for a settled
idle first unless :wait-idle? is false (then a busy pane is skipped). Done
once the pane starts working on it, or settles: the reply itself can take
an hour, read it later with `read`. Text at the prompt stops the job at
once: a say is not queued behind someone's draft.
sourceraw docstring

screen-stateclj

(screen-state row)

What a timeout reports of the pane's last ROW: enough for a supervisor to tell a slow pane from a stuck one without reading the screen itself.

What a timeout reports of the pane's last ROW: enough for a supervisor to
tell a slow pane from a stuck one without reading the screen itself.
sourceraw docstring

start!clj

(start! ref {:keys [sync? on-end] :as opts})

Start a background job on the pane REF names. OPTS :kind is :compact (default), :say or :goal. Returns the job map at once, or {:error ...} when that pane already has a running job. The job follows the pane by its tmux id, which /compact does not change. OPTS :on-end, a fn of the final job map, runs once when the job ends (how the watcher turns it into a sense). Pass :host in OPTS to use another port (tests); :sync? true runs in the caller.

Start a background job on the pane REF names. OPTS :kind is :compact
(default), :say or :goal. Returns the job map at once, or {:error ...} when
that pane already has a running job. The job follows the pane by its tmux
id, which /compact does not change. OPTS :on-end, a fn of the final job
map, runs once when the job ends (how the watcher turns it into a sense).
Pass :host in OPTS to use another port (tests); :sync? true runs in the
caller.
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