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-paneview 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.
:::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-paneand 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 serveis an explicit foreground process. Installing the PyPI wheel requires Python 3.9+; building from a checkout requires Go 1.25+ (andmakeon macOS/Linux).
Install
- uv tool install
- Homebrew
- Alternative installer
- RPM
- Manual archive
- Source checkout
- Windows
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.
The tap cask installs pairmux and its tmux dependency in one command (macOS and Linuxbrew), and strips the quarantine attribute so the binary runs without a Gatekeeper prompt. Because tmux is installed, it is the automatically selected backend on those machines. Available from v0.2.0; republished automatically with every stable release:
brew tap treeleaves30760/pairmux
brew trust --tap treeleaves30760/pairmux # Homebrew 7+ loads third-party casks only from trusted taps
brew install --cask treeleaves30760/pairmux/pairmux
curl -fsSL https://pairmux.treeleaves30760.com/install.sh | bash
The Bash installer uses a persistent uv tool installation of the pairmux wheel from PyPI, not a GitHub tarball. It bootstraps uv from Astral's official installer if absent, and lets uv obtain a compatible managed Python if necessary. Those uv/Python bootstrap downloads are separate from the pairmux wheel's PyPI source.
It installs to ~/.local/bin by default, uses no sudo, does not write shell profiles, and only
checks for tmux rather than installing it. It clears inherited UV_* settings and ignores uv
configuration/index overrides, uses https://pypi.org/simple for pairmux, and accepts wheels only,
not source distributions. It reinstalls with uv's persistent cache disabled so an existing tool or
shared cache cannot stand in for the PyPI wheel. Ordinary uvx / uv tool install commands can
reuse cache; they do not promise a fresh network download.
For a complete download before execution, inspect the script first:
installer_dir=$(mktemp -d) &&
curl -fsSL https://pairmux.treeleaves30760.com/install.sh -o "$installer_dir/install.sh" &&
less "$installer_dir/install.sh" &&
bash "$installer_dir/install.sh" --version v1.0.0 --dry-run
Pin any published version, or omit --version for the latest stable PyPI release. Remove --dry-run only after a successful download and review
to perform the installation.
The downloaded installer's --dry-run does not access the network or write files. The pipe form is
a convenience, not a complete-download-before-execution check.
Set PAIRMUX_INSTALL_DIR to choose the uv tool executable directory. A piped installer cannot alter
your parent shell's PATH. Follow its PATH hint and use command -v pairmux to check whether an older
installation shadows the new command. It does not overwrite commands owned by a different installer.
GitHub Releases contain native .rpm files for Linux x86-64 (amd64) and ARM64. Choose a version
from the release page, then download and verify
the matching asset in a new directory:
PAIRMUX_VERSION=X.Y.Z # replace with the selected release version, without the leading v
PAIRMUX_ARCH=amd64 # use arm64 on aarch64 systems
PAIRMUX_PACKAGE="pairmux_${PAIRMUX_VERSION}_linux_${PAIRMUX_ARCH}.rpm"
download_dir=$(mktemp -d)
curl -fL "https://github.com/treeleaves30760/pairmux/releases/download/v${PAIRMUX_VERSION}/${PAIRMUX_PACKAGE}" -o "$download_dir/$PAIRMUX_PACKAGE"
curl -fL "https://github.com/treeleaves30760/pairmux/releases/download/v${PAIRMUX_VERSION}/checksums.txt" -o "$download_dir/checksums.txt"
(cd "$download_dir" && sha256sum --ignore-missing -c checksums.txt) &&
sudo dnf install "$download_dir/$PAIRMUX_PACKAGE"
Through v0.6.0 the RPM requires tmux >= 3.2; from v1.0.0 it only recommends it (a weak
dependency), because pairmux runs without tmux. There is no Yum repository; upgrading requires a new
RPM download. pairmux no longer provides an APT installation path; Debian/Ubuntu users should use
PyPI/uv, Homebrew, or a manual archive.
For installation without Python, download a .tar.gz and checksums.txt from
GitHub Releases. This is a separate manual
path; the website's installer uses PyPI. For Windows .zip archives, see the Windows tab.
PAIRMUX_VERSION=X.Y.Z # replace with the selected release version, without the leading v
PAIRMUX_OS=linux # use darwin on macOS
PAIRMUX_ARCH=amd64 # use arm64 on Apple Silicon / aarch64 systems
PAIRMUX_ARCHIVE="pairmux_${PAIRMUX_VERSION}_${PAIRMUX_OS}_${PAIRMUX_ARCH}.tar.gz"
download_dir=$(mktemp -d)
curl -fL "https://github.com/treeleaves30760/pairmux/releases/download/v${PAIRMUX_VERSION}/${PAIRMUX_ARCHIVE}" -o "$download_dir/$PAIRMUX_ARCHIVE"
curl -fL "https://github.com/treeleaves30760/pairmux/releases/download/v${PAIRMUX_VERSION}/checksums.txt" -o "$download_dir/checksums.txt"
# Linux:
(cd "$download_dir" && sha256sum --ignore-missing -c checksums.txt)
# macOS: use (cd "$download_dir" && shasum -a 256 --ignore-missing -c checksums.txt)
Only after the checksum check succeeds, extract the binary and install it in a user-writable location. Review any existing file at that location rather than overwriting another installer:
tar -xzf "$download_dir/$PAIRMUX_ARCHIVE" -C "$download_dir" pairmux
mkdir -p "$HOME/.local/bin"
install -m 0755 "$download_dir/pairmux" "$HOME/.local/bin/pairmux"
export PATH="$HOME/.local/bin:$PATH"
pairmux version
tmux is optional (required through v0.6.0); install tmux >= 3.2 separately if you want the tmux backend. This archive path does not provide automatic upgrades.
To install a checkout as a Python package without PyPI, see Install from a clone below. To build only the binary, from the repository root on macOS/Linux:
make build
mkdir -p "$HOME/.local/bin"
install -m 0755 bin/pairmux "$HOME/.local/bin/pairmux"
pairmux version
On Windows, where make is usually absent, build with Go 1.25+ and put the directory containing
pairmux.exe on PATH:
go build -o pairmux.exe ./cmd/pairmux
.\pairmux.exe version
A plain go build does not stamp a release version; make build stamps VERSION (default
0.1.0-dev).
pairmux runs natively on Windows 10 1809 or newer (needed for ConPTY and AF_UNIX sockets), on x86-64 and ARM64, with the built-in multiplexer: neither tmux nor WSL is needed.
:::note New in v1.0.0
Native Windows ships from v1.0.0, which adds win_amd64/win_arm64 wheels and
pairmux_<version>_windows_amd64.zip / _windows_arm64.zip release archives. It is validated by CI
on hosted Windows Server 2025 runners and was accepted on real Windows 11 x86-64 hardware (Windows
PowerShell 5.1, cmd.exe and Git Bash terminals through ConPTY, including a human attach). The ARM64
build has not been accepted on real hardware; CI runs its unit and packaging tests on a native
Windows ARM64 runner (windows-11-arm). Pinning a version before v1.0.0 has no Windows wheel, so
the native install then fails with a hint to use WSL.
:::
Once published, any PyPI installer works from PowerShell: uv tool install pairmux,
pipx install pairmux, or python -m pip install pairmux in a dedicated environment. Or use the
PowerShell one-liner, which installs natively by default:
irm https://pairmux.treeleaves30760.com/install.ps1 | iex
It applies the same policy as the Bash installer: uv installs the pairmux wheel exclusively from
https://pypi.org/simple, wheels only and without cache, ignoring inherited UV_* settings and uv
configuration, and uv is bootstrapped from Astral's official PowerShell installer only if it is
missing. It needs no administrator rights and does not edit PATH or profiles. A piped script takes no
arguments, so configure it through the environment — PAIRMUX_VERSION, PAIRMUX_INSTALL_DIR,
PAIRMUX_DRY_RUN — or inspect the downloaded install.ps1 before invoking it as a file.
Without Python, download a Windows .zip (pairmux.exe, LICENSE, README.md, man/pairmux.1) and
checksums.txt, compare the zip's SHA-256 (Get-FileHash) with its checksums.txt line, extract
it, and put pairmux.exe on PATH.
New terminals start PowerShell 7 (pwsh.exe), else Windows PowerShell, else %COMSPEC%
(normally cmd.exe). PAIRMUX_SHELL overrides that on every platform, for example
$env:PAIRMUX_SHELL = 'C:\Program Files\Git\bin\bash.exe'; $SHELL is honored only if it names
an existing file. See Concepts: Windows for shell integration and the other
differences, and note that pairmux update works on a persistent uv install (Update).
WSL (optional). Inside WSL, pairmux is an ordinary Linux program: it uses tmux if installed in that distribution and the built-in multiplexer otherwise (v0.6.0 and earlier need tmux there). The one-liner's previous behavior is opt-in:
$env:PAIRMUX_INSTALL_TARGET = 'wsl'
irm https://pairmux.treeleaves30760.com/install.ps1 | iex
The WSL target finds WSL, checks it has a distribution, downloads the Bash installer successfully,
and runs it inside that distribution; PAIRMUX_WSL_DISTRO selects a distribution other than the
default (it is refused without the WSL target). pairmux then lives inside the distribution: run it as wsl -- pairmux version.
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:
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 eventsand--json.