Documentation

Pane events

Subscribe to what every pane is doing: agent turns, dialogs, typed text, idle, exits — as JSON lines.

toowld watches every pane it hosts and publishes what happens in it as numbered events: a Claude Code or Grok turn starting and ending, a permission or plan-approval dialog with the keys that answer it, text typed but not sent, messages queued behind a turn, a pane idle for a while, its folder gone, its process exiting. A supervisor — a script, a dashboard, an agent that runs other agents — subscribes instead of reading screens.

Follow the stream

toowl roost events -f --json
toowl roost events -f --json --since 48213        # resume after the last id you saw
toowl roost events -f --name 'grok-*' --kind dialog_shown,idle,pane_exited
toowl @build-box roost events -f --json            # another machine, over ssh

One JSON object per line:

{"v":1,"id":48213,"epoch":"build-box:1793520000000","ts":"2026-11-01T08:12:03.512Z",
 "host":"build-box","pane":"s:9f1c…","name":"grok-api","agent":"grok",
 "kind":"dialog_shown","state":"dialog",
 "data":{"dialog":{"kind":"permission","text":"Remove b.txt if it exists",
   "options":[{"key":"3","label":"Yes, proceed","selected":true},{"key":"4","label":"No, reject"}]}}}

Ids grow by one per event and keep growing across daemon restarts, so a consumer that stores the last id it handled resumes exactly where it stopped. A cursor older than what toowld keeps (the last 20,000 events) gets a stream_reset: read the states and continue.

What you get

KindWhen
turn_started, turn_endedAn agent began or finished a turn (a dialog in the middle pauses it).
dialog_shown, dialog_clearedA permission, plan-approval, question, trust, yes/no or password prompt, with its options and keys.
prompt_waiting, input_pendingAt an empty prompt; text typed in the input box and not sent.
queued_messagesMessages queued under the prompt changed.
idle, quietWaiting for 5, 15, 60 min; no output for 10, 30 min while not waiting.
noticeA usage limit or an API error the agent printed.
cwd_missingThe pane's folder is gone, or the process sits in a deleted folder.
pane_started, pane_exited, pane_removedLifecycle, with the exit code.
title_changed, cwd_changed, resized, command_started, command_finishedTerminal facts (OSC 0/2, OSC 7, OSC 133).

One state per pane

toowl roost state            # a table
toowl roost state --json     # name, state, idle_s, dialog, prompt_text, queued, title, cwd_exists, ...
toowl roost watch --json     # a pane's state again whenever it changes
toowl ls --json              # the session list with each pane's state

States: working, prompt, input_pending, queued, dialog, shell_idle, shell_busy, exited, unknown.

Answer it

toowl roost send grok-api --enter 3                # pick option 3
toowl roost send claude-web --enter -- '/compact keep the plan'
toowl roost send claude-web --enter --verify --stdin < message.txt

send types the text exactly (quotes, $, a leading /, newlines as a bracketed paste) and presses Enter as its own keystroke, so agent TUIs submit it. --verify exits 3 if the text is still sitting in the input box.

From an agent (MCP)

The roost MCP server has pane_events (since, wait_ms to long-poll, filters, host) and pane_state. See MCP.

How it decides

Process markers and OSC 133 marks first, then the terminal title, and the screen text only as a fallback; a reader that cannot tell says unknown rather than guess. Every rule is tested on recorded Claude Code, Grok and shell screens. The full contract — every kind and field, cursor rules, the wire requests — is in docs/architecture/roost-events.md in the repository.

A toowld older than your toowl (not restarted since the upgrade) has no event stream; events -f, state and watch then compute the same events on the client from snapshots, without --since.