An Agent-Computer Interface for terminals

Your agent drives the terminal. You take over when it matters.

pairmux gives AI coding agents a real, persistent terminal — REPLs, TUIs, ssh, [y/N] prompts — and hands the same live terminal to a human the moment a prompt needs a password or a judgment call.

The agent runs ssh in a pairmux terminal named deploy. The server asks for a password. pairmux reports awaiting-input and tells the agent not to guess secrets. The agent waits for a human, who can run pairmux attach deploy, type the password, and hand the terminal back. Press “Type the password” to take over: the wait returns, and the agent finishes the deploy.

Coding agent

Deploy the build to staging.

I'll open a persistent terminal and ssh in.

pairmux --json new --name deploy

  • status: created

pairmux --json run deploy "ssh deploy@staging.internal"

  • status: awaiting-input
  • next: do NOT guess or type secrets
  • next: pairmux wait deploy --human --notify

The server wants a password. I won't guess it — handing off to you.

pairmux --json wait deploy --human --notify --timeout 5m

Waiting for a human…

deployawaiting-input · secret

a human can take over: pairmux attach deploy

$ ssh deploy@staging.internal
deploy@staging.internal's password:
A scripted illustration built from real pairmux output.
The pairmux TUI. Left: a bordered list of seven terminals with status, age and command, nested by agent (lead, its api and web workers, and api’s lint and tests). Right: the screen of the selected terminal.
What the human sees: pairmux tui, the whole fleet on one screen.

01 — The problem

Three things an exec tool cannot do.

Most agent shell tools run a command without a terminal. That is fine for ls. It is not fine for the rest.

  • No terminal.

    python, psql, ssh, git rebase -i, pagers and TUIs need a PTY. Without one they are not awkward — they are impossible.

    $ python
    >>> 
  • No one to ask.

    A password prompt leaves an agent with two bad options: guess, or give up. pairmux adds a third: hand the live terminal to a person.

    Password: 
  • No memory between commands.

    source venv/bin/activate, export, nvm use evaporate after every call, so they get re-composed into every command. A real shell keeps them.

    $ source .venv/bin/activate
    (.venv) $ 

02 — How it works

The handoff loop.

  1. pairmux --json new --name deployStatus: created

    One persistent shell. Its state survives between commands.

  2. pairmux --json run deploy "ssh deploy@staging.internal"Status: awaiting-input

    run blocks until the command finishes, a recognized prompt appears, or the timeout expires. A secret-shaped prompt comes back with do NOT guess or type secrets.

  3. pairmux --json wait deploy --human --notify --timeout 5mStep: waiting

    The agent parks on a resumable checkpoint and the human gets a best-effort desktop notification.

  4. pairmux attach deployStep: attached

    The human steps into the same live terminal, answers the prompt, and detaches. Optionally: pairmux --json note deploy "entered the staging password".

  5. wait returnsStatus: human-done

    The wait ends the moment the prompt is answered. A note explains what the human did; it is never required to resume.

Only one writer per terminal. Reads are lock-free. Every byte is journaled and retrievable with log.

03 — Agents driving agents

One agent can run a team of agents.

A lead agent opens worker agents in pairmux terminals. Workers open their own sub-agents, so the fleet is a tree and every terminal has a path, such as lead/api/tests.

  • Its own subtree only.

    An agent can drive only the terminals below it: not the terminal that started it, not a sibling, not the human’s top layer.

  • Reports go up.

    A sub-agent tells the agent that started it that a turn is done with pairmux report.

  • Supervise without polling.

    pairmux events --wait blocks until something in the fleet changes.

Diagram of the tree: you at the top, the lead agent below you, workers lead/api and lead/web below it, and lead/api’s sub-agents tests, lint and release at the bottom. Solid arrows run down; dashed arrows carry reports and a passphrase prompt up. A side panel lists the front-end interfaces that read the same tree.
The tree: control flows down, reports flow up.
A terminal session: pairmux ls --tree lists seven terminals, pairmux events --wait returns when lead/api/tests goes from running to awaiting-input, and pairmux peek shows its passphrase prompt with the instruction not to guess secrets.
An agent’s view: ls --tree, events --wait, peek.

04 — Human at the top

You stay at the top of the tree.

Run pairmux tui, or pairmux ls in an interactive terminal. Attach to any terminal in the tree and answer the password prompts that agents must not type.

The pairmux TUI with deploy selected and marked needs input. The preview on the right shows a sudo password prompt, and the status line says to attach and answer it.
A terminal stopped at a password prompt, waiting for you.
The pairmux TUI with the activity tab open for lead: its path, status and journal, then timestamped commands with exit codes, and a note.
The activity tab: commands, exit codes and notes.

05 — Fit

When to use it — and when not to.

Reach for your shell tool

  • Short one-shot commands: ls, git status, a quick grep.
  • A long non-interactive job in a fresh environment, with no human needed — your harness's background execution already does this well.

Reach for pairmux

  • Interactive programs: a REPL, a TUI, a pager, [y/N], ssh, sudo.
  • Shell state that must persist: a venv, exports, nvm use.
  • Credential prompts, judgment calls, live human takeover.
  • A dev server or tail -f that a person may also watch.

pairmux earns its place where a terminal, its state, or a human is part of the work.

06 — Works with

Works with the agent you already use.

  • Claude Code

    Install the embedded Agent Skill once; the agent learns the new → run → wait loop and the safety rules.

    pairmux skill install --target all
    Agent Skills guide
  • MCP clients

    A stdio MCP server exposes new, run, peek, wait, send, log, ls, kill, note and doctor as typed tools.

    pairmux mcp serve
    CLI reference
  • Any agent with a shell tool

    Plain CLI. Add --json for a versioned pairmux.v1 envelope with status, output, recovery hints and ordered next steps.

    pairmux --json run deploy "ssh deploy@staging.internal"
    Human collaboration guide

07 — Build on pairmux

Build your own front end.

A desktop app, a dashboard or an editor panel can show the same fleet the TUI does.

  • Events stream

    pairmux events streams the fleet as JSON lines (pairmux.events.v1): one snapshot, then added, changed and removed per terminal, and end when it stops.

  • Block until change

    pairmux events --wait returns when something changes. Supervisor agents get it as the MCP tool pairmux_events.

  • JSON actions

    pairmux --json <command> returns a versioned pairmux.v1 envelope.

  • MCP and skills

    pairmux mcp serve for MCP clients; pairmux skill install for agent skills.

Integrations guide

08 — Install

Install in one command.

macOS / Linux

uv tool install pairmux

then pairmux doctor

Needs uv and Python 3.9+ for the tool environment. tmux is optional: when it is on your PATH pairmux uses it (3.2 or newer); otherwise the built-in multiplexer takes over.

Or let the installer set up uv:

curl -fsSL https://pairmux.treeleaves30760.com/install.sh | bash
Read install.sh first

After installing

pairmux doctor
Reports the backend in use: tmux when it is on your PATH, otherwise the built-in multiplexer. Windows always uses the built-in one.
pairmux update
Keeps your uv install current (v0.6.0+; on Windows too, for a uv install).

Homebrew, pipx, release archives and details are in the install guide.