TUI Orchestrators
An orchestrator is a program that manages terminal panes and keeps long-running sessions organized: tmux, zellij, and herdr are common examples. Polytoken detects which one you are running in and adapts to it.
When you run Polytoken inside a herdr pane, Polytoken reports session activity so herdr, an agent-aware terminal multiplexer, can show whether the pane is working, idle, or waiting for your decision.
Keyboard input in herdr panes
Section titled “Keyboard input in herdr panes”In kitty keyboard protocol terminals such as Ghostty, herdr can deliver a keystroke twice to programs it launches from a pane after the pane’s keyboard mode changes. An external editor that Polytoken opens from a herdr pane can also receive duplicate keystrokes.
When Polytoken detects herdr, it keeps the pane in the terminal’s default input mode for the entire session. This avoids triggering the duplicate-key behavior and lets the external editor receive each keystroke once.
The default input mode has a trade-off: modified-key chords such as Shift+Enter
may register as their base key inside herdr, and held-key repeats cannot be
distinguished from fresh presses. The same behavior applies in terminals that
do not support the kitty keyboard protocol. Set
POLYTOKEN_TUI_DISABLE_KEYBOARD_ENHANCEMENT to force the same input mode in any
terminal. See Troubleshooting for details.
Client context
Section titled “Client context”Each session records who is driving it. The harness type describes the client:
tui for the terminal interface, outpost for sessions launched by Outpost,
and exec for a non-interactive polytoken exec run. The orchestrator list
names the terminal orchestrators Polytoken detected when the client started,
such as tmux, zellij, or herdr.
Polytoken stores both values with the session and replaces them with the
resuming client’s values when you resume. A client can also update either
value while the session runs by sending a request to POST /client-context.
For each field, Polytoken keeps the recorded value if the request omits the
field and clears the value if the request sends the field empty.
Templates can read these values: harness_type holds the harness type,
orchestrators holds the orchestrator list, and using_orchestrator(name)
tests whether the list contains a name. See the
template reference for the full rows.
Updating the harness type or orchestrator list affects the system prompt only if a template produces different text with the updated value. That prompt change may flush the provider’s cache of your prompt prefix, so the next request can cost more to process than usual.
Pane status
Section titled “Pane status”Polytoken reports one of three states to herdr:
| State | Meaning |
|---|---|
working | A turn is running, a ! or !! shell command you launched is in flight, or background work such as a subagent or a shell command is pending or still running. Services keep running by design, so Polytoken excludes services from pending work. |
idle | No turn is running, no shell command is in flight, and no background work is pending. |
blocked | Polytoken needs a decision from you. A pending question, permission request, goal approval, or plan review takes precedence over a running turn, an in-flight shell command, or pending background work. |
When you exit the TUI, Polytoken releases the pane.
Herdr receives the current model and facet as display metadata. That metadata does not affect herdr’s waits or rollups.
Program status in the terminal
Section titled “Program status in the terminal”Polytoken reports what it is doing to the terminal itself, using the Program Status Protocol (OSC 7501, specification revision 0.4, published at https://www.superlogical.com/rex/docs/build/program-status). This support is experimental. Terminals that read the protocol keep a per-window or per-pane picture of each session. Terminals that do not read it ignore the reports silently, and the reports never change what is on your screen.
| Report | When Polytoken sends it |
|---|---|
working | A turn is running, a ! or !! shell command you launched is in flight, or background work such as a subagent or a shell command is pending or still running. |
blocked (kind question) | Polytoken asked you a question: a question prompt, a confirmation, a clarification, a goal approval, or a plan review. |
blocked (kind permission) | A permission or capability request waits for your decision. |
done | The last turn finished successfully and you have not started a new one. |
error | The last turn failed: a provider error, a stream error, or a harness failure. |
idle | You canceled a turn, or nothing has started yet. |
Blocked reports carry a short message, such as “waiting for answer” or “permission request”. Terminals choose how to show the status; Polytoken does not control the display.
Two terminals support the protocol today, verified hands-on on Linux against specification revision 0.4 (the current revision as of the verification date, 2026-11-12). Kitty 0.50.0 keeps per-window records and shows the status in its tab bar: a progress symbol while a program works and an attention symbol while it waits on you. TUIOS 0.12.1 turns the reported state into pane state in its rail and Inbox, so a blocked pane surfaces where you answer it. Other terminals may also read the protocol; Polytoken has not verified them.
Inside tmux or GNU screen, Polytoken writes the reports, but the multiplexer does not forward them to the outer terminal, so no status shows there. tmux has an open feature request for the protocol (tmux issue 5713, retrieved 2026-11-12), so forwarding does not exist in released tmux as of that date.
Restore a session
Section titled “Restore a session”Polytoken includes polytoken continue <session-id> as the resume command with
each state report. Herdr 0.9.2 and later can use that command to restore the
pane to the same Polytoken session. Earlier herdr versions ignore the resume
command.
The herdr skill
Section titled “The herdr skill”Polytoken adds the shipped herdr skill to the session’s skill library when
Polytoken starts with HERDR_ENV=1. The skill helps the model inspect panes,
wait for sibling agents, and prompt them. The herdr environment controls skill
activation independently of project configuration. A project definition at
.polytoken/skills/herdr/ replaces the shipped skill body. See
Skills for how Polytoken loads skill definitions.
Detach and reattach
Section titled “Detach and reattach”Detaching the TUI ends pane reporting, but the daemon keeps running. Herdr clears the pane at the next shell prompt and drops the stored resume command. When you reattach the TUI in a pane, Polytoken holds the pane again and resumes reporting.
Requirements
Section titled “Requirements”Use herdr 0.9.2 or later for session restore. Polytoken reports pane state only
inside a herdr pane, where herdr sets HERDR_ENV, HERDR_BIN_PATH, and
HERDR_PANE_ID.