Docs/Hosting a runtime

Hosting a runtime

constant host runs one agent CLI inside a native PTY and lets you switch the live runtime with a tmux-style prefix key, mid-conversation.

constant host codex
constant host claude
constant host opencode

The child keeps its own terminal UI, colors, keybindings, and resume behavior. Constant sits outside it, forwards input and output untouched, and only steps in when it sees the prefix key.

Switching

The default prefix is Ctrl-B. Press it, release, then a key:

KeysAction
Ctrl-B cContinue in Claude Code (C: new continuation)
Ctrl-B xContinue in Codex (X: new continuation)
Ctrl-B oContinue in OpenCode (O: new continuation)
Ctrl-B tToggle the trail graph
Ctrl-B :Open the Constant command line
Ctrl-B dQuit (the hosted CLI exits with it)
Ctrl-B Ctrl-BSend a literal Ctrl-B to the child

The full list lives in Keybindings.

The status bar

While hosting, a one-row bar lives on the terminal's bottom line:

 constant · codex · ch04·auth-bug · Ctrl-B c/x=switch d=quit

Active runtime (+tools when carrying tool history), the conversation's chapter and name, and the prefix keys. Constant stays a pass-through proxy: the child PTY is simply told the terminal is one row shorter, and a scroll region protects the bar row. The bar auto-disables on tiny terminals; --no-bar turns it off.

After every switch, the carry receipt is held in the bar for a few seconds:

 ✓ ch04 → claude · auth bug · carried 14 turns · 2 redactions

The trail graph

Ctrl-B t toggles Constant's own full-screen view of the conversation: a colored chapter graph — one dot per chapter, rails between runtimes, fork and restore glyphs, relative times, record markers, and a "you are here" head.

The graph acts, too: c/x/o switch runtimes straight from it (uppercase forks a new continuation), and r opens the command line prefilled with rename <current name>. t, q, or Enter close it. The child's output is paused while the view is open and repaints when you leave — Constant still never composites.

The command line

Ctrl-B : opens a one-line command prompt in the bar row:

:switch claude    :new opencode    :rename auth bug    :quit

Tab completes verbs and runtime names, rename + Tab prefills the current name for editing, and ↑/↓ recall command history.

Changing the prefix

If Ctrl-B collides with tmux, pick another:

constant host codex --prefix C-t
CONSTANT_PREFIX=C-t constant host codex

What a switch does

On a switch, Constant stops the current child, distills its active session, snapshots it to the record, writes the target runtime's native session, and starts the target with its own resume command. No summary, no model calls. If the target can't launch, the switch degrades instead of dying: target resumed → target fresh → back to the previous runtime. See How it works and What carries.

Carrying tool history

--with-tools (experimental, also on carry and resume) carries tool calls and results across switches — redacted and size-capped. The default carries the conversation only. See What carries.

Pass-through, not a multiplexer

Constant hosts exactly one runtime at a time and forwards its output verbatim. It is not a terminal multiplexer or compositor, which is why the host stays small: the bar borrows one row, the graph borrows the screen between turns, and everything else is the child's own pixels.