kolu
Docs

the coordinator pattern

One driver,
many agents.

kolu can be driven by an agent instead of a person. Every terminal kolu owns can be created, prompted, watched and read from the shell, so one agent can do to another terminal what you would. Scale that up and one coordinator runs a fleet.

A fleet of three agent terminals laid out across the canvas, each with its own repo group in the dock.
Three agents, three repos, one canvas — the dock keeps the roster.

This is a way of using kolu, not a feature you switch on. kolu’s own features are built this way: the remote-terminals work was a coordinator dispatching briefs to agents in kolu’s terminals, on real hosts, for weeks.

The three roles

You

Set the intent and merge the results. You talk to one agent, the coordinator, and review the pull requests that come out.

The coordinator

One agent. It breaks the work into briefs, spawns an implementing agent per brief, watches each one, verifies what they claim, and answers their questions.

The fleet

One implementing agent per task, each in its own worktree so they cannot step on each other. They do the work, open PRs, and send anything they are unsure about back up to the coordinator.

Why add a coordinator

Span of attention. A person can drive one agent well and three agents badly. Past a handful, you spend your time context-switching and none of it thinking. A coordinator does not tire of switching: it holds the state of every agent it spawned, notices when one needs input, and surfaces to you when a PR is ready or a decision is yours.

The coordinator can be an agent in a terminal, driving the others with the kolu command, which is how kolu itself was built. It can also be the Conductor, the same role as a chat, one of them for your whole fleet. Read this page for the shape and that one for the face.

The drive loop

Driving another agent is a loop of discrete moves. One command, kolu, carries every move.

  1. Create a worktree’d agent. It appears live on the canvas.
  2. Send it a short brief.
  3. Wait for the terminal to settle, then send Enter as its own command.
  4. Wait for the turn to end, and read the screen.
# spawn an implementing agent in its own worktree — it appears live on the canvas.
# `--toplevel` says where it lands: its own tile. Use `--parent <id>` instead to
# open it as a split inside the tile it works for; there is no default.
id=$(kolu create --toplevel --worktree fix-parser -- claude --dangerously-skip-permissions)

kolu send "$id" "read /tmp/brief-fix-parser.md and take it end-to-end"  # 1. the brief
kolu wait "$id" --until idle:300                                        # 2. observe it settle
kolu send "$id" --key Enter                                             # 3. submit — its own step
kolu debrief "$id"                                                      # 4. its turn ended, it went quiet, here's the screen

Submitting is separate from typing. An Enter sent in the same breath as the text races the terminal UI’s paste-debounce and is dropped silently, leaving the prompt unsent. So you type the text, watch the UI go quiet, then send Enter on its own: a send carries text or a key, never both (kaval).

Every verb takes the same endpoint flags (--socket, --state-root, --host) on either side of the verb name. Inside a kolu terminal you pass none at all, because the daemon that owns you is already in the environment. Ids accept any unique prefix.

Long briefs do not paste cleanly, because kolu folds a big paste into a placeholder that Enter will not submit (issue #1702). So the coordinator writes the brief to a file and sends a short prompt pointing the agent at it. The agent reads its own brief.

Knowing when an agent is done

The hard part is not sending input. It is knowing when to send the next thing. One wait verb takes two kinds of condition, and they answer different questions.

Output went quiet

kolu wait --until idle:<ms> blocks until no output byte has arrived for a while. It works on any terminal with no setup, but it cannot tell “finished” from “stopped to ask you”: both look like silence.

The agent's state changed

kolu wait --until awaiting,waiting blocks on the real agent state: working, awaiting (it is asking you), waiting (it just finished), starting and fresh (up and never prompted). This one tells a finished turn from a blocked question.

A coordinator uses the state condition where it can. Piling a new task on an agent that stopped to ask a question is how a fleet wedges. --until fresh is how a coordinator waits to brief an agent it has just launched. After any wait returns, it reads the screen before it responds.

Why kolu debrief waits for quiet as well

Agents farm work out to background subagents. An agent’s main loop reports its turn as over the moment it stops typing, while a subagent it launched is still running and still printing. The state says waiting and the work is not done. A coordinator that acts on that signal interrupts real work.

So the rule is to require both: the turn is over and the terminal has gone quiet. Then read the screen. kolu debrief is that protocol as one command:

kolu debrief "$id"     # blocks until the turn is over AND quiet;
                       # stdout is what the screen says — judge, then act

It is exactly kolu wait "$id" --until awaiting,waiting --settled 15000 --snapshot 40. Both flags work on their own: --settled <ms> adds “and quiet for this long” to any condition, and --snapshot <N> makes the wait hand back the screen it settled on.

Asking for them together also closes a race. Output can move in the gap between a wait finishing and a separate snapshot starting, so the screen you read is not the screen the wait settled on. Asked together, a screen the terminal moved under is retaken. Over MCP the same two are settledMs and screenTail.

Questions go up, never out

An implementing agent that hits a real decision is alone in its own terminal, and you are one layer up and probably asleep. An interactive question there sits unanswered, and the agent stalls.

So it sends every question to the coordinator, using the same loop in reverse: it writes to the coordinator’s terminal and waits for a ruling. Observation flows out freely, since anyone can watch any agent’s state, but decisions flow in through one door.

A fleet can span machines

A coordinator on your laptop can drive agents on a remote host: kolu --host prod send <id> "…", kolu --host prod debrief <id>. A remote terminal survives the link dropping, so an agent keeps working while your laptop sleeps. The driving code does not change.

What to watch for

  • Submit is a separate step. The most common failure is a brief that was sent but sits unsubmitted because the Enter was dropped. Watch the settle, then submit.
  • Terminal ids change when a daemon restarts. An id you cached can go stale after a redeploy or a crash-restore. Track a long-lived terminal by its title, which survives, and re-find its current id.
  • Big pastes fold. Anything past a couple of lines goes through a file the agent reads, not the prompt box.
  • You are still in the loop. A coordinator comes to you for a decision it will not make, or a PR that needs your eyes.

A coordinator earns its overhead only past a handful of agents. For one quick task, drive the agent yourself: the loop above is the coordinator’s move, and you can run it by hand.

Next