kolu
Docs

drive kolu outside the browser · alpha

Drive kolu
from a terminal.

Every terminal kolu owns is reachable from outside the browser, so you can script it, automate it, or hand it to a coding agent. Two ways in:

  • MCP: your coding agent (Claude Code, Codex, any MCP host) creates, drives and observes terminals itself.
  • The kolu command: the same terminals from a shell. List them, create one, read a screen, send a prompt, wait for a turn to end.

The verbs

Every verb talks to the same terminals the canvas shows. A terminal you create from the shell appears on the canvas at once, and one you created in the browser is drivable from the shell.

verbwhat it does
kolu lsthe roster: state, repo·branch, PR, agent, and what each is running
kolu createopen a terminal. Say where it goes with --toplevel or --parent <id>; --worktree cuts a branch first, -- <cmd> launches an agent in it
kolu sendtype into a terminal: text, or a named key with --key
kolu waitblock until output settles or matches, or until an agent’s turn ends
kolu debriefwait until a worker’s turn is over and its output is quiet, then print its screen
kolu snapshotread a terminal’s screen as plain text (--tail N for what is on screen now)
kolu screenshotsave that screen as a themed PNG instead, with the colours, box drawing and highlights plain text throws away. Writes kolu-screenshot.png, or -o <path>
kolu historythe scrollback above the current screen
kolu killend a terminal
kolu watcha live feed of terminal changes and output activity, or the supervision feed below

kolu with no subcommand lists the verbs. kolu web runs the server itself.

A driving loop

Create an agent, give it a prompt, wait for its turn to end, read the reply:

id=$(kolu create --toplevel --worktree fix-parser -- claude)
kolu send "$id" "read /tmp/brief.md and take it end-to-end"
kolu wait "$id" --until idle:300          # the text landed
kolu send "$id" --key Enter               # submit — its own step
kolu debrief "$id"                        # its turn ended, it went quiet, here's the screen

kolu debrief waits for the turn to end, waits for the terminal to go quiet, then prints the screen. The quiet matters: an agent whose main loop ends its turn while a background subagent still runs reports “finished” while its work goes on, and nudging it there interrupts real work. debrief is exactly kolu wait "$id" --until awaiting,waiting --settled 15000 --snapshot 40, so --settled and --snapshot are wait’s own flags when you want a different window or condition.

stdout, ids and exit codes

  • stdout is data, so id=$(kolu create …) captures exactly the id. The human-readable trailer goes to stderr.
  • An id is any unique prefix: kolu send 3f9c ….
  • Read verbs take --json.
codewhat it means
0done
1a usage or connection error
2a wait timed out
3the terminal exited first
4the terminal is asleep. It still exists: wake it and run the command again
130interrupted

Which machine a verb talks to

One flag picks the machine: --socket, --state-root, or --host user@box for a remote host over ssh. It goes on either side of the verb. Inside a kolu terminal you pass none at all, because the daemon that owns you is already in the environment.

Where a new terminal goes

kolu create takes exactly one of --toplevel (its own tile) or --parent <id> (a split inside that tile). There is no default: neither flag, or both, is refused with the rule. A terminal with a parent is drawn inside that parent’s tile, and the Dock reads the same edge as who works for whom.

kolu create --toplevel -- claude            # its own tile
kolu create --parent "$KAVAL_TERMINAL_ID" -- codex   # a split beside you

The same rule applies to the MCP tool an agent calls, where placement is a required field, and to padi-tui create.

kolu watch as a standing alert

Name any of --states, --held-for or --nag and kolu watch switches from the change feed to the supervision feed. Every terminal that has been idle long enough announces itself, and keeps announcing itself until somebody gives it work or kills it.

kolu watch --states waiting,awaiting --held-for 60s --nag 5m/3 --ignore-self
flagwhat it does
--stateswhich agent states to report: working, awaiting, waiting, comma-separated. awaiting is an agent blocked on you, waiting one whose turn ended
--held-forreport a state only once it has held that long: milliseconds (60000), or with a unit (500ms, 60s, 5m, 2h, 1d)
--nagre-report every interval the state keeps holding. A count after a slash makes it finite: --nag 5m/3 is three reminders, then quiet. A bare --nag 5m never stops
--ignore-selfmute the terminal this process runs in ($KAVAL_TERMINAL_ID)
--ignore <id>mute this terminal, repeatable
--heartbeatemit a timestamped alive line every interval, in the same duration grammar as --held-for. Omit it to stay silent when nothing is happening
--jsonthe same feed as NDJSON, filtered the same way before it leaves kolu
14:02:11  a1b2c3d4  snapshot    waiting   42m  fix the parser
14:04:11            heartbeat
14:07:11  a1b2c3d4  nag         waiting   47m  fix the parser
14:09:40  9f01ee22  transition  awaiting  1m

Each line says why you are being told: snapshot, transition or nag. What each one means is on the MCP page, which serves the same knobs as tool parameters. A heartbeat is the one line with an empty id column.

Details worth knowing before you script it:

  • An agent handed more work inside the --held-for window is never reported.
  • A state change re-arms the nag count, and so does a dropped connection on this feed.
  • --ignore-self is refused when you are not in a kolu-owned terminal, and when the padi you are watching does not know that terminal. That covers --host, a --socket aimed at another padi, and a stamp gone stale across a daemon restart. Pass --ignore <id> rather than guessing.
  • Muting fails open: a stale or unknown full id costs nothing, and every new terminal is still watched. A prefix that named nobody is dropped, with a warning on stderr.
  • No argument watches the whole fleet. A single id narrows to one terminal as a debugging tail, but an id you also muted is refused.
  • kolu watch never reads the screen. It asks the agent’s own state, so an idle agent that repaints its prompt once a second is still idle.
  • Every --json line carries a kind: snapshot, transition or nag here, and terminal, removed or activity on the change feed. --heartbeat adds {"kind":"heartbeat","at":<epoch ms>}, and a nag line adds "nag":{"index":1,"left":2}, where left is absent when the nagging is uncapped.

kolu surface as command-line verbs

kolu surface <verb> … spells the same tool table kolu mcp serves a coding agent as command-line verbs, projected by @kolu/surface-cli. screen_text is a verb, lifecycle_create is a verb, and list prints the whole verb table. list dials nothing, so a dead endpoint still lists.

kolu surface screen_text "$id" --tail 20
kolu surface lifecycle_create --input '{"placement":{"kind":"toplevel"},"run":"claude"}'
  • A verb’s whole input can ride one flag: --input '{…}', or --input - from stdin. lifecycle_create with its placement usually wants it.
  • --json is strictly an output answer here, on every verb including list.
  • The member readers get and keys read the same live views (terminals, urgency, …). Each has a --follow form that streams ndjson.
  • kolu surface --help groups the verbs by what a supervisor does with them.
  • The shared endpoint flags apply unchanged: --socket, --state-root, --host, on either side of the verb.
  • stdout stays data: one JSON value for a read, ndjson lines for a --followed one.

The exit codes are @kolu/surface-cli’s, not the native verbs’ 1/2/3 above:

codewhat it means
0the verb answered
1the daemon’s refusal: typed JSON on stderr with no prefix, so a script branches on the code instead of parsing prose
2usage: the input did not match what the verb declares
3the endpoint could not be reached. The message names it as spelled
130interrupted

A typo’d verb or a rejected flag never reaches either face’s handler, so the CLI library renders the usage and kolu answers 1 on both faces. A 2 means the request never left this process: the face itself rejected the input, such as an --input blob with no valid JSON. The full contract is the surface-cli reference.

MCPdrive kolu from your coding agent — create, drive, and observe terminals over MCP Agent fleetsthe driving loop in full — briefs, done-signals, and running several agents at once