Guides

Orchestration

Use kumo as an ADE — how humans and AI agents wait, prompt, read, and coordinate across panes.

Who is this for?

Humans driving a session from a shell, and AI agents running inside a kumo pane that need to drive their own web. The entire kumo CLI is the API — agents and humans use the same commands over the same daemon socket. For agents, install the bundled skill.

Why kumo can orchestrate

Classic multiplexers can send-keys. None could wait. An agent that injects a command and then polls sleep 1; check again is fragile, wasteful, and races with the shell.

Kumo adds server-owned, event-driven waits: the daemon holds your socket open and replies once — when the condition is met, on timeout, or if the pane's occupant changed. No polling loop on the client, no race between submit and wait.

tmux:  send-keys "npm test"  →  sleep 2  →  hope
kumo:  agent prompt -p 42 "npm test" --wait idle  →  daemon replies once
       pane wait-output -p 12 --regex "passed|failed"  →  exactly when it appears

How agents use kumo

Any process inside a pane can shell out to the kumo binary. Panes receive KUMO_BIN_PATH (the binary that owns the pane) and KUMO_SOCKET_PATH (the daemon's socket), so "$KUMO_BIN_PATH" always reaches the right daemon — see [worktree] expose-socket in Configuration. Humans, TUI clients, scripts, and AI agents all speak the same protocol.

You do not need a special SDK. If you can run a command, you can orchestrate. Add --json whenever a script consumes the output — the machine API is a stable contract, the human-readable output is not:

kumo pane list -s myproj        # discover panes: ids + s1:t2:p3 positions
kumo agent status -s myproj     # which panes host agents, their status
kumo agent wait -p 42 --until idle
kumo agent read -p 42 --source recent

Composite pane addresses

Panes have a stable numeric id and a composite position s1:t2:p3 (1-based: session index or name, tab, pane). Use whichever is convenient — composites are resolved against the live layout and the daemon always gets the canonical id. kumo pane list and kumo agent status print both. Agent aliases set with kumo agent rename work too.

  • s1:t2:p3 — session 1, tab 2, pane 3
  • kumo:t2:p1 — session named kumo, tab 2, pane 1
  • t2:p1 — tab 2, pane 1 (session from -s)
  • 42 — stable numeric id (best for scripts)

The primitives

PrimitiveWhat it doesServer behavior
kumo agent waitWait until an agent reaches blocked|done|idle|workingHolds the socket; pinned to the pane's process (agent_replaced if it changes); replies at once if already there (agent_blocked if blocked instead); timeout otherwise
kumo agent promptSend text to a pane (bracketed-paste aware)Wrapped in bracketed paste when the pane enabled it; refuses with agent_blocked if already blocked
kumo agent prompt --waitPrompt and wait in one RPCAtomic — no race between send and wait
kumo agent readRead the pane's buffer from the daemonAlt-screen intact; no scraping; --source selects the view
kumo pane wait-outputWait for PATTERN in any pane's outputOne-shot, regex or substring, on recent tail + visible buffer
kumo agent startLaunch an agent in an existing shell paneReturns once detection shows ready; agent_not_ready if blocked at start
kumo agent renameLive alias for a paneSo scripts can use names, not ids
kumo agent broadcastFan one prompt to every AI paneOver existing send-keys path; optional --filter STATUS

kumo agent wait

kumo agent wait <PANE> --until <STATUS> [--timeout 30s] [-s SESSION]

# examples
kumo agent wait -p 42 --until idle --timeout 60s
kumo agent wait -p s1:t1:p2 --until blocked --timeout 10s
kumo agent wait -p 42 --until done          # finished-but-unseen (went idle while unfocused)
  • STATUS: blocked (needs approval) · done (finished while you weren't looking) · idle (quiet, ready) · working (producing output). The five-state model is working · blocked · idle · done · unknown — see AI Agents.
  • Pinned occupant: the wait is pinned to the pane's OS pid at creation. If the process is replaced, the daemon replies agent_replaced instead of falsely succeeding. agent_blocked is returned immediately when --until is not blocked but the pane is already blocked.
  • Default timeout: 30s. Accepts 500ms / 30s / 2m or bare milliseconds.

kumo agent prompt

kumo agent prompt <PANE> <TEXT> [--wait [STATUS]] [--timeout 60s] [-s SESSION]

# examples
kumo agent prompt -p 42 "fix the failing test in src/foo.rs"
kumo agent prompt -p 42 "rebase onto main" --wait idle --timeout 120s
kumo agent prompt -p 42 "ship it" --wait blocked        # wait until it needs approval
kumo agent prompt --wait -p 42 "hello"                  # bare --wait means idle
kumo agent prompt -p 42 -- "echo --wait is not a flag"  # -- separates text from flags
  • Bracketed-paste aware: when the pane has bracketed paste enabled, kumo wraps the payload as \x1b[200~TEXT\x1b[201~\r; otherwise TEXT\r. No stray escapes.
  • Refuses when blocked: if the agent is already blocked, prompt returns agent_blocked without injecting — you must handle the approval first.
  • --wait is atomic: prompt --wait idle does submit + wait in one server-owned request, so there is no window where the agent could go idle between your send-keys and your separate wait. Default prompt --wait timeout is 120s.

kumo agent read

kumo agent read <PANE> [--source <SOURCE>] [-s SESSION]
# SOURCE: visible | recent | detection | traceback  (default visible)
SourceWhat you get
visibleThe viewport as the daemon sees it (what is on screen right now)
recentLast ~16 KiB of output (ring tail) — good for recent logs
detectionRaw signal regions as screen / form / footer / title — for debugging detection
tracebackLast prompt block: form (below last rule) or the last 120 rows if empty

The daemon owns the screen buffer including the alt-screen (ghostty's buffer holds it), so full-screen agent transcripts (claude/codex) read directly without mouse-scroll scraping.

kumo agent read -p 42 --source visible
kumo agent read -p 42 --source recent | tail -n 100
kumo agent read -p 42 --source traceback   # last failing command + output when available

Output may be truncated (flagged in the reply); keep --source targeted and page with tail/grep.

kumo pane wait-output

kumo pane wait-output [PANE] PATTERN [--regex] [--timeout 30s] [-s SESSION]

# examples — PANE may be positional or -p; PATTERN is positional
kumo pane wait-output -p 12 "Ready on http"
kumo pane wait-output -p 12 --regex "passed|failed" --timeout 60s
kumo pane wait-output s1:t1:p2 "TASK_DONE" --timeout 10s
kumo pane wait-output -p 12 --timeout 500ms "demo-token"
  • Any pane, not just AI panes — the primitive behind dev servers, test suites, and builds.
  • Substring by default, --regex treats PATTERN as a Rust regex. Bad regex returns bad_regex: "…: error" immediately.
  • Checks the recent tail + visible buffer, then holds the socket until new output contains the pattern. Pinned to the pane's process like agent wait. Default timeout 30s.

kumo agent start / rename / broadcast

kumo agent start --kind <agent> --pane <PANE> [-- <args>] [-s SESSION]
kumo agent rename <PANE> <NAME> [-s SESSION]
kumo agent broadcast "TEXT" [-s SESSION] [--filter STATUS]

# examples
kumo agent start --kind claude --pane 12 -- --model sonnet --resume abc
kumo agent start --kind opencode --pane s1:t2:p1 -- --help
kumo agent rename -p 42 worker
kumo agent broadcast -s myproj "rebase onto main" --filter idle
kumo agent broadcast "echo broadcast-ok" -s myproj --filter blocked
  • start launches the agent program in an existing shell pane and returns once detection shows it ready (agent_not_ready if it starts blocked; --kind selects the detection rules agent-detection/<kind>.toml).
  • rename sets a live alias so scripts reference agents by name, not id.
  • broadcast fans the prompt over the existing send-keys wire path to every AI pane in the session; --filter restricts to working|blocked|idle|done|unknown.

Isolated worktrees and checkpoints

Use an AI worktree when an agent should work in its own checkout and branch:

kumo worktree create --ai fix-login \
  --agent claude \
  --from main \
  --note "Investigate the authentication tests" \
  -s myproj

--ai creates an ephemeral worktree and opens a session for it. The positional NAME is slugged into a branch unless --branch supplies an explicit branch. --from accepts a local or remote branch, commit, #1234, or a GitHub/GitLab pull or merge request URL. Jira references are not supported yet. --agent KIND starts the selected agent in the new pane and replies once it is ready (agent_not_ready if it starts blocked, like agent start). It does not send the task text — submit it as an explicit step:

kumo agent status
kumo agent prompt -p 42 "Fix the failing authentication tests" --wait idle --timeout 10m
kumo worktree set -s myproj --status in-review \
  --comment "Tests pass; ready for review"

Inspect or clean up the worktree with kumo worktree current, list, set, open, and rm. rm keeps a branch with unmerged commits unless --force is supplied. Checkpoint statuses are todo, in-progress, in-review, and completed; --note on create seeds the checkpoint comment.

Shared directories (node_modules, caches) and copied local files (.env) are configured with [worktree] shared-dirs and .worktreeinclude — see Configuration.

Patterns (copy-paste)

The recipes use jq on the --json output. kumo pane split keeps focus on the original pane, and pane ids only grow, so the newest pane of the active tab is the highest id:

newest_pane() {
  kumo pane list -s "$1" --json | jq '[.tabs[] | select(.active) | .panes[].id] | max'
}

1 — Dev server: run it, wait for ready, then read

SESSION=myproj
kumo pane split -s $SESSION --horizontal
PANE=$(newest_pane $SESSION)

kumo agent prompt -p $PANE "npm run dev"
kumo pane wait-output -p $PANE --regex "Ready|listening|Local:" --timeout 30s
kumo agent read -p $PANE --source recent | grep -i "ready"

2 — Verify loop: run tests, wait for result, feed failure back

Run the suite in a fresh split, wait for its output, and only then feed the failure to the agent:

SESSION=myproj
WORKER=42   # your agent pane
kumo pane split -s $SESSION --horizontal
TEST_PANE=$(newest_pane $SESSION)

kumo agent prompt -p $TEST_PANE "npm test 2>&1"
if kumo pane wait-output -p $TEST_PANE --regex "passed|failed" --timeout 120s; then
  FAIL=$(kumo agent read -p $TEST_PANE --source recent | grep -A 50 "failed\|FAIL")
  if [ -n "$FAIL" ]; then
    kumo agent prompt -p $WORKER "tests failed: $FAIL" --wait idle --timeout 180s
  fi
else
  echo "tests timed out" >&2
fi

3 — Agent-to-agent handoff

Agent in s1:t1:p1 waits for worker s1:t1:p2 to finish:

kumo pane wait-output -p s1:t1:p2 "TASK_DONE" --timeout 300s
RESULT=$(kumo agent read -p s1:t1:p2 --source recent)
kumo agent prompt -p s1:t1:p1 "worker done: $RESULT" --wait idle

Atomic prompt+wait for a worker task:

kumo agent prompt -p s1:t1:p2 "implement feature X and run tests" --wait done --timeout 600s
kumo agent read -p s1:t1:p2 --source traceback

4 — Parallel workers + aggregator

Read-only or non-overlapping tasks can share one checkout. Agents that edit the same files should each get their own worktree.

for TASK in "review module A" "review module B" "review module C"; do
  kumo pane split -s myproj --ai          # runs your ai-cmd
  P=$(newest_pane myproj)
  kumo agent wait -p $P --until idle --timeout 60s
  kumo agent prompt -p $P "$TASK" --wait idle --timeout 30m &
done
wait
kumo agent broadcast -s myproj "summarize your findings" --filter idle

5 — Broadcast to the fleet

kumo agent broadcast -s myproj "git fetch && git rebase origin/main" --filter idle
kumo agent broadcast -s myproj "echo tick"   # all AI panes

Errors, timeouts, and pinning

CodeMeaningWhat to do
timeoutCondition not met before --timeoutRetry, increase timeout, or agent read --source recent to see progress
agent_blockedPane already blocked but --until was not blocked / prompt refused while blockedHandle the approval (agent read to see prompt, prompt after resolving), or wait with --until blocked
agent_replacedPane's OS pid changed since wait was createdRe-resolve the pane id and retry; do not treat as success
bad_regex--regex pattern failed to compile (bad regex "…": error)Fix the pattern

All waits are server-owned and event-driven: the CLI blocks on the socket and the daemon re-checks pending waits whenever an agent changes status or a pane produces output, so there is no client polling. With --json, every failure carries its code — see the full error-code table.

Tips for AI agents

  • Discover panes first: kumo pane list (every pane + s:t:p) and kumo agent status (AI panes + status + positions). Use stable numeric id in scripts; composite s1:t2:p3 for interactive use.
  • Use --json in scripts and match on error.code, never on human-readable text.
  • Prefer read over scraping: agent read --source visible|recent comes from the daemon's ghostty buffer. traceback gives the last prompt block.
  • Use --regex "passed|failed" for test watchers, substring for dev-server banners.
  • Always set a timeout long enough for the job (defaults: 120s for prompt --wait, 30s for wait and wait-output).
  • No polling: do kumo agent wait or kumo pane wait-output, not while true; do kumo agent status; sleep 1; done.
  • Handle agent_blocked: never prompt a blocked pane. read --source visible to see the permission dialog, then act.
  • Bracketed paste is automatic: you do not need to send ESC[200~ yourself — agent prompt does it when the pane has the mode enabled.
  • Keep reads small: recent is ~16 KiB; pipe through grep/tail rather than dumping the whole buffer into context.

Bundled agent skill

Kumo ships its orchestration instructions inside the binary, so they always match the installed CLI. Choose your agent and run the generated command:

Agent to install the skill for

Install for Codex

Personal skill · available in every project · ~/.agents/skills/kumo/SKILL.md

kumo agent skill --output ~/.agents/skills/kumo/SKILL.md

The command does not require a running daemon and installs the skill at user scope, so it is available across projects. Re-run it after updating Kumo to refresh the skill. kumo agent skill without --output prints the instructions instead.

You can manage the same targets from MENU → settings → agents: select an agent and press Enter (or click it) to install the skill; selecting an installed skill removes its SKILL.md. Update available means the file exists but differs from the skill bundled with the running Kumo — usually because Kumo was upgraded, possibly because the file was edited. The update action replaces it with the bundled version.

See also

On this page