Skip to main content

pairmux

Let AI agents drive interactive terminal programs — and hand off to a human when they can't.

Driving a raw terminal is hard for agents for three separate reasons:

  • Timing. After sending a command, an agent has no signal for when it is done, so it guesses sleep N — and reads half-finished output or wastes time.
  • Information quality. A raw capture-pane view is screen-oriented: it may contain ANSI-driven redraws, omit scrolled-off output, and does not provide a command exit code or completion signal.
  • Human access. Many automation interfaces do not expose the same live terminal to a human who needs to observe or provide authorized input.

pairmux is an ACI (Agent-Computer Interface) layer on top of a terminal multiplexer — tmux when it is installed, otherwise pairmux's own built-in one: blocking calls return on a command completion, a recognized prompt, a requested condition, or timeout; a journal retains raw pane output while CLI reads shape it for agents; and pairmux attach puts a human in the same live pane.

The same primitives let agents drive agents. A lead agent opens workers in pairmux terminals, the workers open their own sub-agents, and you watch and steer the whole tree from one screen.

The pairmux TUI: the agent tree with live status on the left, the selected agent's screen on the right

:::info New in v1.0.0 The built-in multiplexer (tmux becomes optional) and native Windows support. v0.6.0 and earlier require tmux >= 3.2 and run on Windows only inside WSL. :::

Requirements​

  • macOS 12+, Linux, or Windows 10 1809+, on x86-64 or ARM64. Native Windows is new in v1.0.0; see the Windows tab below.
  • tmux is optional. On macOS and Linux, pairmux uses tmux when it is on PATH — the tmux backend needs tmux >= 3.2 (for stable pipe-pane and pane user-option behavior) — and its built-in multiplexer otherwise. Windows always uses the built-in multiplexer. See Concepts: terminal backends.
  • Released pairmux executables are static Go binaries. There is no service to install: tmux keeps its normal server, and the built-in server is started on demand and exits on its own when idle. mcp serve is an explicit foreground process. Installing the PyPI wheel requires Python 3.9+; building from a checkout requires Go 1.25+ (and make on macOS/Linux).

Install​

With uv installed, add a persistent pairmux command:

uv tool install pairmux
pairmux version
pairmux doctor

Ensure uv's tool executable directory is on PATH; command -v pairmux helps check whether an older installation shadows it. This ordinary uv install retains your environment and uv configuration, including index overrides, and may reuse cached downloads.

From v0.6.0 onward, use pairmux update for a verified persistent uv installation. v0.5.3 and older first need uv tool install --upgrade pairmux to obtain v0.6.0+ when available. See Update for the source policy and recovery guidance.

The PyPI wheels bundle the native Go binary and require Python 3.9+ to install. uv can obtain managed Python from Astral upstream if needed; the installed binary itself does not need Python. Supported wheels target macOS 12+ and manylinux_2_17 (glibc 2.17+) on x86-64 and ARM64, plus win_amd64 and win_arm64 from v1.0.0. You can also use pipx install pairmux, or python -m pip install pairmux inside a dedicated Python 3.9+ virtual environment.

uv and pipx do not install tmux. It is optional from v1.0.0 (required through v0.6.0); if you want the tmux backend, use brew install tmux, sudo apt install tmux on Debian/Ubuntu, or your distribution's package manager for tmux >= 3.2. Use the alternative installer below for its explicit public-PyPI-only wheel source policy. On Windows, the same commands work in PowerShell; see the Windows tab.

Install from a clone​

If you can clone the repository but cannot reach PyPI, install from the checkout. The repository root has a pyproject.toml whose in-tree build backend needs no build dependencies, so this works offline with any 64-bit Python 3.9+:

python -m pip install . # into the active environment (uv pip install . also works)
uv tool install --offline . # or as a persistent uv tool
uv tool install --offline --reinstall . # rebuild later, after pulling changes

pip install git+https://github.com/treeleaves30760/pairmux does the same straight from GitHub.

The backend builds the binary with Go 1.25+ if go is on PATH. Without Go, it packages a prebuilt binary named by PAIRMUX_PREBUILT_BINARY, such as the pairmux.exe from a GitHub Release zip. The binary must match the host OS and architecture: its Mach-O/ELF/PE header is checked (it is never executed), and a wrong OS or architecture, a relative path, or a missing file is refused. In PowerShell, from the clone, with a checksum-verified release zip downloaded into the parent directory:

Expand-Archive ..\pairmux_<ver>_windows_amd64.zip -DestinationPath ..\pairmux-download
$env:PAIRMUX_PREBUILT_BINARY = (Resolve-Path ..\pairmux-download\pairmux.exe).Path
python -m pip install . # or: uv tool install --offline .
Remove-Item Env:PAIRMUX_PREBUILT_BINARY

Windows zips exist from v1.0.0; for older releases, a Windows install from a clone needs Go. On macOS/Linux, point the variable at the pairmux binary from the matching .tar.gz. There is no sdist and no editable install (pip install -e .); both refuse with an explanation, and uv build needs --wheel.

These are development builds, never release wheels. Their version comes from git describe against the latest vX.Y.Z tag: X.Y.Z.post<N>.dev0+g<12-character sha>, with .dirty appended for uncommitted changes. Even a tagged commit builds as post0.dev0, and without git metadata the version is 0.0.0.dev0+unknown. The same string is stamped into the binary, so pairmux update refuses it as not a canonical release: update such an install by rebuilding from the clone. PAIRMUX_VERSION overrides the version with a canonical SemVer tag or PEP 440 version. The wheel is tagged for the host only (macosx_12_0_<arch>, linux_<arch>, win_amd64, or win_arm64).

With no Python at all, put a release binary on PATH (see the Manual archive and Windows tabs), or build it with Go (see Source checkout).

Optional temporary run with uvx​

Try pairmux without adding a persistent command to PATH:

uvx pairmux version
uvx pairmux doctor

uvx remains supported. It uses a temporary tool environment, which uv may cache, or reuses an existing uv-managed installation. It does not promise a fresh download or the latest version on every invocation; temporary runs cannot use pairmux update.

Update (v0.6.0+)​

From v0.6.0 onward, update the currently running, verified persistent uv tool installation, including one created by the Bash/WSL installer:

pairmux update

v0.5.3 and older have no update command. First run uv tool install --upgrade pairmux with your normal uv configuration to obtain v0.6.0+ when available; then use the new command.

The updater needs uv installed; it never bootstraps or updates uv. It clears all inherited UV_* settings, ignores uv configuration, and reinstalls the latest compatible stable wheel from https://pypi.org/simple, with no persistent cache or source builds. Old exact pins, constraints, indexes, and extras are replaced. It never selects below the running version's numeric core; recognized alpha/beta/rc builds may advance to that core's final or a later stable release, while dev/snapshot builds are refused.

A version change returns updated; a same-version reinstall returns refreshed, not a no-op. Failures return E_UPDATE with a recovery hint, without guaranteed rollback. Recover with the original manager, or uv tool install --upgrade pairmux for uv installs (normal configuration applies). Homebrew, RPM, pipx/pip, manual/development installs, and temporary uvx runs are unchanged; tmux is untouched. There are no command-specific options, automatic updates, or sudo. Global --json is supported; see the CLI reference for verification, JSON, and exit behavior.

On Windows, pairmux update works for a persistent uv install (uv tool install pairmux, or the PowerShell installer). uv copies the tool's pairmux.exe into its executable directory instead of linking it, so the updater checks that copy byte for byte against the tool environment's Scripts\pairmux.exe. Windows will not overwrite or delete a running program, so the updater renames both files to pairmux.exe.old-<pid> before uv runs, renames them back if uv fails, and deletes leftovers on a later update. Programs already running (watch, attach, an MCP client's mcp serve) keep the old executable until restarted. Managed terminals may stay open: the built-in server runs from its own copy of the executable. An install made with a custom UV_TOOL_DIR is refused when the copy in the executable directory is the one running; run that tool environment's Scripts\pairmux.exe update instead. A path that contains (, such as Program Files (x86), is refused.

Migrating from APT / Debian packages​

pairmux's APT repository and historical .deb distribution were retired on 2026-10-08 with v0.5.3. If you use the tmux backend, keep tmux installed through your system package manager. Follow the APT migration guide to inspect and retire the old source, origin pin, keyring/package, and command without destructive cleanup shortcuts, and check whether an old installation shadows the new command on PATH.

Verify your environment​

pairmux doctor probes everything pairmux depends on and prints an actionable report:

pairmux doctor

The exact paths and shell list depend on the machine. A healthy Linux result with tmux installed has this shape:

ok
pairmux doctor

✓ backend tmux (tmux is installed): 3.4 at /usr/bin/tmux (>= 3.2)
✓ state dir writable: /home/alice/.local/state/pairmux/.sockets/<endpoint-id>
✓ live probe bash: hooks; dash: sentinel
✓ notifier notify-send at /usr/bin/notify-send (desktop notifications available)

The first line, backend, names the selected backend and why it was chosen. Without tmux it reads like this instead, with the built-in server's socket path:

✓ backend built-in multiplexer (tmux is not installed); socket /tmp/pairmux-1000/pairmux.sock; tmux not installed (not required)

The live probe runs on an isolated throwaway endpoint of the selected backend and reports which completion-detection tier each shell reaches. Fish 4+ emits compatible OSC 133 marks natively; fish without a ready mark degrades to a $status sentinel. PowerShell reports hooks-no-C. See Concepts.

Quick start​

Every command that emits a single pairmux response accepts --json for a machine-readable pairmux.v1 envelope; without it you get a friendly text block. attach and watch are interactive human interfaces, while mcp serve reserves stdout for MCP JSON-RPC. Commands followed by JSON below explicitly enable --json.

1. Open a terminal​

pairmux --json new --name build
{"schema":"pairmux.v1","ok":true,"status":"created","terminal":"build","mode":"hooks","next":["pairmux run build \"echo hello\""]}

This opens a terminal — a tmux window, or a pane on the built-in server — and starts capturing output into a journal. zsh, bash, PowerShell, and compatible fish configurations normally report mode: hooks; other shells (including cmd.exe), or a failed hook-ready probe, report mode: sentinel. Always act on the returned mode and status rather than assuming either one.

2. Run a command and block for an actionable outcome​

No sleep, no guessing — run returns when the command completes, a recognized prompt has been quiet long enough to trust, or its timeout expires. A completed command includes the exit code and duration:

pairmux --json run build "echo hello world"
{"schema":"pairmux.v1","ok":true,"status":"done","terminal":"build","mode":"hooks","exit_code":0,"duration_ms":101,"output":"hello world"}

3. Long-running commands: the run → wait → peek loop​

If a command outlives --timeout (default 60s), run returns status: running with the current tail instead of failing. You then keep waiting or look whenever you like:

pairmux --json run build 'for step in 1 2 3; do echo "step $step"; sleep 1; done' --timeout 1s
pairmux --json wait build --idle 800 # returns on idle, input, pane death, or timeout
pairmux --json peek build # read-only snapshot, any time

See the long-running commands guide.

4. Interactive programs​

Start a separate terminal for an interactive flow. When its command goes quiet on a recognized prompt, pairmux reports awaiting-input and tells you how to answer:

pairmux --json new --name confirm
pairmux --json run confirm 'printf "Continue? [y/N] "; read answer; printf "answer=%s\n" "$answer"'
pairmux --json send confirm --text y --enter
pairmux --json wait confirm --idle 800
pairmux --json peek confirm

For password, passphrase, and passcode prompts, the returned next omits send and recommends a human handoff. The CLI cannot enforce that policy, so the driving agent must never guess or send the secret itself. See interactive programs and human collaboration.

5. Humans jump into the same terminal​

pairmux ls # at your own terminal: the session manager (same as pairmux tui)
pairmux attach build # run from an interactive terminal (outside tmux, on the tmux backend)
pairmux watch # live dashboard of every terminal

pairmux ls opens the TUI. Select build and press ⏎ (or double-click it) to attach. When an agent reaches a password prompt, it hands off to you and its row shows needs input in yellow:

The TUI with a terminal that needs input selected: the preview shows a sudo password prompt and the footer says to attach and answer it

Detach with Ctrl-b d on either backend (on tmux, your configured tmux binding). attach refuses a non-interactive terminal. On the tmux backend it also refuses to nest inside tmux: detach to the outer shell first or use another terminal, because switch-client cannot cross tmux servers to pairmux's named socket. On the built-in backend it works inside tmux and attaches your terminal straight to the pane; see human collaboration.

Next steps​

  • CLI Reference — every command and flag, plus the full envelope schema.
  • Concepts — why pairmux is built the way it is: the two terminal backends, endpoint-isolated journals, completion modes, and the idle backstop.
  • Long-running commands guide — the complete run/wait/peek playbook.
  • Agent Skills — install targets and the repeatable cross-agent benchmark runner.
  • Agent hierarchy — agents that run their own sub-agents, and how to supervise them.
  • The TUI — a tour of the console where you watch and steer the agent tree.
  • Integrations — build a desktop app, dashboard or supervisor agent on pairmux events and --json.