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.
(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.
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.
(due? row threshold)Should ROW be compacted at THRESHOLD tokens?
Should ROW be compacted at THRESHOLD tokens?
(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 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 stops the job.
(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.
(idle? row)Is ROW a Claude pane at rest? The screen shows no spinner and Claude Code's own session status, when known, is not busy. A row that could not be read is not idle.
Is ROW a Claude pane at rest? The screen shows no spinner and Claude Code's own session status, when known, is not busy. A row that could not be read is not idle.
(job job-id)The current state of JOB-ID, or nil.
The current state of JOB-ID, or nil.
(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.
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.
(send-text! {:keys [tmux! sleep!]} pane-id text vim-mode)Type TEXT into PANE-ID and submit it. One line goes as literal keys; text with newlines is pasted as one bracketed frame so no LF submits early. A pane in vim NORMAL mode is put in insert mode first.
Type TEXT into PANE-ID and submit it. One line goes as literal keys; text with newlines is pasted as one bracketed frame so no LF submits early. A pane in vim NORMAL mode is put in insert mode first.
(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.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 |