kolu
Docs

drive kolu from your coding agent · alpha

MCP: drive kolu
from your agent.

kolu mcp connects your coding agent (Claude Code, Codex, or any MCP host) to your running kolu. The agent opens a terminal, types a task into it, waits for the reply, reads the screen, and sees which terminals need you.

It runs as a small process your agent starts over stdio. With no padi reachable at startup it exits non-zero before the MCP handshake, so a consumer can test whether kolu is usable on a host by reading that exit code. kolu surface projects the same tool table to argv.

Install the skill and server together

With kolu on PATH and a running kolu daemon, install the plugin in Claude Code:

/plugin marketplace add juspay/kolu
/plugin install kolu@kolu

Restart Claude Code, then use /kolu:kolu for the terminal-driving skill and /mcp to check the server connection.

For Oh My Pi, pass the repository root as the plugin directory:

omp -e .

Use /skill:kolu to load the skill. The plugin also registers kolu mcp. Keep your host’s environment forwarding configured for PADI_SOCKET. Nix consumers can use ${inputs.kolu} from a github:juspay/kolu input: the repository root is the plugin, archived with the skill, its reference file and the MCP configuration.

Connect it to your agent

  1. Put the kolu binary on your PATH. The home-manager module does it, and so does a kolu terminal (see Inside a kolu terminal). Then register the server:

    # Claude Code
    claude mcp add kolu -- kolu mcp

    No kolu install? Run it straight from the flake instead:

    claude mcp add kolu -- nix --refresh run github:juspay/kolu -- mcp
  2. Prefer a config file? Add an .mcp.json entry, which any MCP host that reads that file picks up:

    {
      "mcpServers": {
        "kolu": { "command": "kolu", "args": ["mcp"] }
      }
    }
  3. Drive a kolu on another machine by adding --host. It reaches the remote over ssh, with nothing installed there first.

    claude mcp add kolu-prod -- kolu mcp --host nix@prod

    kolu mcp takes the same endpoint flags every verb does, so --socket <path> and --state-root <dir> name a specific local daemon.

Without a flag, kolu mcp picks your everyday kolu over a development or test one. If it cannot tell, it says what it looked for.

Inside a kolu terminal

An agent running in a kolu terminal needs no step above, on a remote host as on your own machine. The terminal is spawned with kolu’s own CLIs (kolu, kaval-tui, padi-tui) on its PATH, and with $PADI_SOCKET naming the daemon that owns it. A plain .mcp.json with "command": "kolu" connects.

Those tools match the daemon’s own build. After an upgrade, a terminal you already have runs the new kolu the next time it is used. A terminal opened by a kolu older than this mechanism has to be reopened once.

In bash and zsh, kolu re-applies its PATH entries after your dotfiles run, so an absolute PATH= line in ~/.bashrc or ~/.zshrc cannot remove the tools. In fish and other shells they are only put in the spawn environment, so an absolute set -x PATH … in config.fish drops them. Prepend rather than assign there.

Drive a terminal

Driving another agent is a loop:

  1. Create a terminal (optionally as a split, or in a fresh worktree) and keep the id.
  2. Send the prompt text into it.
  3. Wait for the output to settle, then send Enter as its own step. Combining text and the submit key in one call is a deliberate error, because a same-breath Enter can race the paste.
  4. Wait for the turn to end, then read the screen.
  5. Send the next prompt, or kill the terminal.

How the Conductor’s tools differ

The Conductor, the one chat that drives every terminal on every host, uses this same tool table. kolu mcp, this page, serves one host over stdio and names a terminal by its bare id. The Conductor’s copy covers every host, served inside kolu-server (the process your browser talks to) on a loopback HTTP listener.

kolu mcp, one hostthe Conductor’s, every host
naming a terminal3f29…local/3f29…, remote:nix@prod/9a1b…: the host, then the id, read apart at the last /
lifecycle_createopens one heretakes the host to open on, answers a fleet reference, and is refused without a work and a role; kolu writes a planner’s or implementor’s command
the repo tools — git_getStatus · git_getDiff · fs_listAll · fs_readFilea repo patha repo path and the host it is on
the waits and the watchwait_outputSettled · wait_agentState · watch_open · watch_next · watch_close, all as belowwait_outputSettled, hard-capped at a few seconds, plus the tools below. The rest are not served
diagnostics_readservednot served
live viewsterminals · urgency · daemonStatus · status · identityterminals · urgency · hosts · works · memory

The Conductor never sits in a wait: it opens a piece of work and ends its turn, and kolu-server starts the next one. The capped wait_outputSettled covers the pause between typing and submitting.

hosts is the live roster: each machine kolu knows, its name, and whether it is warming, connected or failed. A call naming an unconnected host is refused by name, never with an empty list.

works holds the pieces of work kolu stores: their members, where each stands, and any question open with you. The view subscribes, so an answer from the card arrives without a call. One terminal’s record is read at surface://collections/terminals/<host>/<id>.

What your agent can do

The name in the first column of each table below is what your agent calls. Every answer is structured data, alongside text for every tool but screen_image, whose answer is the image.

A refusal carries data when the tool has a machine-readable reason. lifecycle_sendInput labels its four refusals text-and-key, key-refused, text-refused or no-input. lifecycle_create labels its directory refusals (cwd-and-worktree, worktree-needs-repo, repo-without-worktree, blank-field) and the partial-failure report stopped-partway. A bad placement is refused by the schema, before any terminal is created.

Create and drive terminals

ToolWhat it does
lifecycle_createOpen a new terminal and return its id. placement is required: {"kind":"toplevel"} for a tile of its own, or {"kind":"child-of","parentId":"…"} for a split inside that terminal.
lifecycle_sendInputType into a terminal: text, or one named key or chord (Enter, Escape, C-c, arrows…), never both in one call.
lifecycle_killClose one terminal by id.
agent_saySay something to the agent in a terminal, idle or mid-turn. kolu presses that agent’s own submit keys, in the order and number it wants.

lifecycle_create also takes a working directory (cwd) or a fresh git worktree (repo + worktree, cut at <repo>/.worktrees/<name>), a canvas label (intent), and a first command (run). It does what kolu create --toplevel --repo … --worktree … -- <cmd> does, and the terminal picks up your new-terminal theme setting. A create that fails midway names the survivors as data.

agent_say knows which agent is in the terminal (see agent detection). It refuses by name for a terminal with no agent, an agent kolu has no recipe for, an agent that cannot be told anything mid-turn, and an agent whose screen is still being drawn.

Its answer says whether the words took. An idle agent began working within a few seconds, or the screen is what to read. A working agent got them steered into its turn or queued behind it; a steer to omp or pi landed, or is held in its steering pane until a long tool call ends, then delivered on its own. The CLI serves it: kolu surface agent_say <id> --text '…'.

Wait for the right moment

ToolWhat it does
wait_outputSettledBlock until a terminal’s output goes quiet — the turn ended, or it is waiting for input.
wait_agentStateBlock until the terminal’s agent reaches a state you name (working, awaiting, waiting) — a precise done-signal, not a guess from silence.

Both take two extras that turn a three-call routine into one:

  • settledMs also requires the output to have been quiet that long. Bytes still arriving keep the wait open. This tells a finished agent from one whose main loop ended while a background helper runs on.
  • screenTail: N hands back the last N screen lines on the signal itself. A later read can catch a screen that has moved on.

wait_agentState with until: ["awaiting","waiting"], settledMs: 15000 and screenTail: 40 answers “is this worker’s turn really over, and what did it say?”, as kolu debrief does from a shell.

Watch many terminals at once

The two waits each watch one terminal, while the call is open. A subscription watches many, between your agent’s calls:

ToolWhat it does
watch_openStart watching — the whole fleet by default, or a named few. You choose the subscription’s name.
watch_nextBlock until a watched terminal needs you, then hand over everything since your last call.
watch_closeStop watching and discard the queue.

Anything that happens while your agent is not asking is kept for it, so reopening with the same name picks up where you left off. Each event says which terminal and why: it is asking for input, it finished its turn, or it is gone. Leaving ids off is the better default: a subscription scoped to the lanes you remembered goes blind to the one you did not.

Report a terminal until you deal with it

A settle event fires once, so an agent that finishes and then waits is reported then and never again. Optional parameters on watch_open replace that with a level you cannot miss:

ParameterWhat it does
stateswhich agent states to report — any of working, awaiting, waiting. Defaults to awaiting + waiting, the two that need somebody
heldForMsreport a terminal only once it has held that state this long. An agent handed more work inside the window is never reported
nagMsre-report it every this many milliseconds while it keeps holding. A string spells the same interval, "30m", and a count after the slash caps it: "30m/3" is three reminders, then quiet until the state changes
ignoreSelfmute the terminal this MCP server runs inside. Refused if the transport cannot identify the caller, or if this server’s padi does not know that terminal
ignoreIdsmute these terminals. Fail-open: a stale id costs nothing, and every new terminal is still watched. An ids list that is entirely muted is refused rather than hanging silent
{ "name": "campaign", "states": ["awaiting", "waiting"],
  "heldForMs": 60000, "nagMs": 300000, "ignoreSelf": true }

Such a subscription reports three kinds of event. A snapshot is a terminal already in that state when you opened, handed over first. A transition is one that entered the state and held it. A nag is one still holding, an interval later: it carries nag.index, which reminder this is (the first re-report is 1), and nag.left, how many follow (0 on the last, absent when uncapped).

Reopening after a restart leads with a fresh snapshot, and inherits the episode’s spent nag budget. Re-specifying the filter throws away the queued events and the nag accounting both. Restarting kolu’s background service clears the queue, and says so.

kolu asks each agent for its own state rather than watching its output, so heldForMs times the state, not the screen. The same knobs are kolu watch’s flags.

These parameters report states, so they do not report gone when a terminal disappears. To hear about that, keep a second subscription without them. A batch is handed over until your agent confirms it, and a queue holds the most recent 512 events; overflow it and the next batch carries a count of what was dropped.

The Conductor’s pieces of work

The Conductor’s tools replace the subscription with the pieces of work kolu-server stores: it is woken rather than waiting.

ToolWhat it does
work_openOpen a work by host, repo (git names its root) and branch, with its setup questions, or by a terminal to watch. kolu offers harness and model. An existing one comes back.
work_askAsk you about a work: a short header, options, your own box, the file to read, and a required whenAway for while you are away. It answers at once; your answer wakes the Conductor.
work_adoptBring a terminal into a work by its host/id and role, including one that left. Answers the state it was found in. Refused for a role another holds, or a second one in a watch.
work_leaveTake a terminal out of its work. One that closes leaves by itself.
work_stopEnd a work: its terminals stop being members and its open questions go. The record stays, and the card offers Reopen.
work_notePut a line of plain text on a work’s timeline.
memory_proposePropose a note to add, replace or forget. Nothing is remembered until you approve it.

A new Conductor turn starts when a member terminal’s agent comes up, stops, asks, goes or sleeps, when you answer, and when a work loses its last terminal. The Conductor has the rest.

Read the screen and the code

ToolWhat it does
screen_textRead a terminal’s rendered screen as text; ask for just the last N lines.
screen_imageSee the same screen as a themed PNG, with the colours, box drawing and highlights text throws away. Ask for the last N rows (up to 200), or omit that for the visible screen.
screen_historyRead the older scrollback above the current screen.
git_getStatus · git_getDiffThe git status and diff for a terminal’s repo.
fs_listAll · fs_readFileList and read files in a terminal’s project.
diagnostics_readWhy kolu is slow here.

Your agent’s host must show images for screen_image; CJK and emoji render as empty boxes.

A sleeping terminal has no live screen. A read or a wait aimed at one answers “Terminal … is asleep — wake it before reading its screen”, naming the id and whether it is sleeping or parked. An agent then asks you to wake it, or tells you how many are asleep.

Live views

Live viewWhat it shows
terminalsThe live roster of your terminals — what is open, what each is running, and each agent’s state.
urgencyWhich terminals need attention now — the ones waiting on a human or an answer.
daemonStatus · status · identityWhether kolu’s background service is live, up to date, and has not restarted underneath the agent.

An agent subscribed to urgency hears the moment a terminal starts waiting.

When kolu’s background service restarts

An upgrade restarts kolu’s background service, and the restart keeps your terminals running. Your agent does not need to reconnect: the next tool call opens a new connection, and the terminals it was driving keep their ids.

A local connection is told when the service goes away; with --host, kolu mcp finds out by making one call that fails. That call says the connection dropped, that kolu mcp is still running, and that retrying re-opens it. Nothing is queued or re-sent behind your back.

What an agent cannot touch

kolu mcp exposes a reviewed allowlist. Reads and terminal control are in: creating, driving, killing, and observing terminals. Out: administering the background service, changing session policy, or rearranging your canvas. Widening the list is a reviewed change, never a runtime toggle. An agent’s terminals obey your new-terminal theme policy, which only your browser can read or change.