All articles
Tonis Tiganik--8 min read

Why tmux Is a Good AI Agent Manager

tmux gives coding agents durable terminals, scriptable pane creation, stable pane IDs, and a way to send commands or restart services without replacing the tools developers already use.

Why tmux Is a Good AI Agent Manager

Introduction

tmux was not designed as an AI agent product. That is part of why it works so well as the layer underneath one.

A coding agent is already a terminal program. It reads a repository, runs commands, opens interactive prompts, and keeps important state in a long-lived terminal session. tmux preserves that environment while adding four primitives an agent manager needs: create a terminal, give it a stable address, send it input, and observe its output.

This means a coordinator can ask an agent to create a new pane for a worker, refer another agent to that worker by pane ID, send keys to a service pane, or attach a human to the exact same terminal. Claude Code, Codex, OpenCode, shells, test watchers, and development servers can all remain ordinary programs. The manager does not need to reimplement their terminal.

The result is a useful separation of concerns: tmux owns durable terminal processes, while a higher-level manager such as ClawTab adds agent status, scheduling, notifications, layouts, permissions, and remote control.

The Short Answer: tmux Already Has the Right Primitives

The official tmux guide defines a pane as a terminal and the program running inside it. Sessions can detach from a client while every program in their panes continues running. For agent management, that is more important than the familiar split-screen interface: the work belongs to the tmux server, not to whichever GUI happens to be open.

Agent-manager needtmux primitiveWhy it matters
Create another workersplit-window or new-windowAn agent can create a real terminal for another agent or command
Address one workerStable pane ID such as %42The coordinator can target the same pane after it is moved or renamed
Give a worker inputsend-keys or a paste bufferHumans, scripts, and agents use the same interactive program
Read progresscapture-pane, pipe-pane, or control modeA manager can inspect terminal output without taking focus
Keep work aliveDetached sessionsClosing a terminal window does not terminate the agents
Recover a service panerespawn-paneThe pane can keep its place in the layout while its command restarts

These are composable Unix-style controls rather than a provider-specific agent protocol. An orchestration layer can manage multiple agent CLIs without requiring each provider to implement the same SDK.

Agents Can Create New Panes for Other Agents

An agent running inside tmux receives its current pane ID in the TMUX_PANE environment variable. It can split from that pane, choose a working directory, start a worker, and ask tmux to print the new pane's ID. The -P and -F flags make pane creation machine-readable:

# Create a detached worker pane beside the current agent.
worker_pane=$(tmux split-window -d -P -F '#{pane_id}' \
  -t "$TMUX_PANE" -c "$PWD")

# Start an agent in that exact pane.
tmux send-keys -t "$worker_pane" -l 'codex'
tmux send-keys -t "$worker_pane" Enter

# Keep the address for later coordination.
printf 'Worker started in %s\n' "$worker_pane"

The same pattern works for a test runner, log tail, browser automation process, or a second opinion from another model. A coordinator can create one pane per task, while git worktrees isolate agents that write to the same repository.

This is also a clean delegation boundary. Instead of asking a subagent to return a large transcript through a special message bus, the coordinator can say: “work in pane %42; leave the test watcher running there; report the summary here.” The worker's terminal remains available for inspection even after that exchange.

Pane IDs Make Agents Addressable

Names are useful for humans, but IDs are safer for automation. The tmux manual says pane IDs begin with %, remain unchanged for the life of the pane, and are not reused within the running server. Moving %42 to another window or renaming its window does not change the target.

# Let the current agent discover itself.
current_pane="$TMUX_PANE"

# Inventory every pane for a coordinator or dashboard.
tmux list-panes -a -F \
  '#{pane_id} #{session_name}:#{window_index}.#{pane_index} #{pane_current_command} #{pane_current_path}'

# Inspect a specific worker's latest terminal output.
tmux capture-pane -p -t %42 -S -120

That gives both humans and agents a compact vocabulary. “The API server is in %17” or “ask the reviewer in %42 to check the failure” is precise enough for a script and readable enough for a prompt.

The official advanced-use guide makes the same point for scripting: pane IDs let a script target the same object even if it is moved or renamed. ClawTab uses that identity as the bridge between tmux, its daemon, desktop UI, and remote clients.

Agents Can Send Keys, Run Commands, and Restart Services

Once a pane has an address, a coordinator can operate it without focusing it. This is useful for development services and long-running tools: interrupt the old process, type the new command literally, then send Enter as a separate key.

# Restart a service in pane %17.
tmux send-keys -t %17 C-c
tmux send-keys -t %17 -l 'pnpm dev'
tmux send-keys -t %17 Enter

# Read enough output to verify the service came back.
tmux capture-pane -p -t %17 -S -80

send-keys is useful because it follows the same input path as a person typing into the terminal. It can answer an interactive question, invoke an agent slash command, stop a process, or restart a watcher. For dead panes configured with remain-on-exit, respawn-pane can restart the original program while preserving the pane's place and size.

There is an important limitation: send-keys is input delivery, not a reliable agent messaging protocol. It does not prove that the target was at a shell prompt, understood the text, or finished the work. A practical manager pairs it with capture-pane, process state, agent hooks, or explicit acknowledgements. The independent Agents via tmux write-up describes a similar workflow: a root agent uses send-keys and capture-pane programmatically while the author can still attach to the same session.

The Human and the Manager Share the Same Workspace

A good agent manager should not trap the work behind its own interface. tmux sessions can have multiple clients, and every pane is still a normal terminal. A developer can attach in a terminal, a desktop manager can render the pane, and a remote client can stream it. The underlying agent does not have to migrate between representations.

This produces a simple control model:

  • Agents operate laterally. They create panes, target peers by pane ID, and send commands.
  • Managers operate globally. They inventory panes, detect waiting or completed states, arrange workspaces, and enforce policy.
  • Humans can drop in anywhere. They attach to the real terminal, type directly, detach, and leave the process running.

tmux control mode goes further for GUI and daemon authors. It provides structured command results, pane output tagged with pane IDs, and notifications when server state changes. That is a stronger foundation than polling screenshots or scraping a terminal window owned by another application.

Why Not Just Use Terminal Tabs or a Process Supervisor?

Several tools can run processes. They optimize for different kinds of state.

ApproachDurable interactive terminalScriptable targetAgent semanticsBest fit
Terminal tabsUsually tied to the appVaries by terminalNoPersonal, foreground work
Process supervisorNo terminal UI by defaultProcess or service nameNoNon-interactive services
Raw tmuxYesSession, window, and pane IDsNoDurable local agent terminals
tmux plus an agent managerYesPane ID plus manager metadataYesParallel agents, schedules, approvals, and remote control
Cloud agent platformPlatform-specificTask or run IDYesManaged remote compute and isolated tasks

A process supervisor is better for a production service that should restart automatically and never expects a terminal question. tmux is better when terminal state is part of the work. A cloud manager is useful when you want provider-managed compute. The tmux advantage is local interoperability: one durable layer can host different agent CLIs and the exact development environment already on the machine. See the local versus cloud agent comparison for the larger trade-off.

tmux Is the Runtime, Not the Whole Agent Manager

Raw tmux does not know that an agent is waiting for permission, writing code, finished, or stuck. It does not assign worktrees, prevent conflicting edits, decide whether a command is safe, or send a phone notification. Pane count is not agent state.

That boundary is healthy. tmux can remain the small, stable runtime while another layer adds:

  • agent and provider detection;
  • waiting, working, error, and completed status;
  • permission policy and approval routing;
  • worktree and working-directory isolation;
  • schedules, secrets, and restart policy;
  • searchable layouts, notifications, and remote access.

This is the architecture behind ClawTab's daemon and tmux control plane. tmux remains the source of truth for the terminal and process. The daemon adds meaning and policy. Desktop, CLI, phone, and browser interfaces become clients of the same workspace.

A Mature, Active Foundation

The supplied screenshot comes from the public tmux/tmux repository Insights view and shows weekly commits over the year ending July 2026. The repository listed 11,852 commits when this article was written, and tmux 3.7b was released on July 1, 2026.

A commit graph is not an architectural argument by itself. It is a useful maintenance signal, though: an agent manager built on tmux is using an actively maintained open-source project with a documented command interface, not an abandoned terminal trick or a private integration.

The more important kind of maturity is compatibility. Agents already run in terminals. Shell scripts already know how to call tmux. Developers already know how to attach and inspect a pane. A manager can add a richer control plane without asking the entire toolchain to move.

A Practical Pattern for a tmux-Based Agent Manager

A reliable implementation can stay small:

  1. Create. Start one pane per agent or service and record the returned pane ID.
  2. Label. Store the task, repository, worktree, provider, and owner alongside that pane ID.
  3. Observe. Combine pane output with process inspection and provider hooks; do not infer everything from terminal text alone.
  4. Control. Send literal text and keys to a validated target, then verify the resulting state.
  5. Expose. Let terminal, desktop, CLI, and remote clients address the same pane instead of cloning its state.

Use worktrees when agents may write to overlapping files. Keep destructive commands behind explicit policy. Treat send-keys as an actuator, not as proof of delivery. Preserve the pane ID as the shared reference between every surface.

With those rules, tmux becomes more than a grid of terminals. It is a durable, addressable runtime for coding agents, and a strong foundation for the dashboards, schedulers, notifications, and controls that turn those terminals into an agent manager.

Frequently Asked Questions

AI coding agents already run as interactive terminal programs. tmux keeps those programs alive in detached sessions and adds scriptable pane creation, stable pane IDs, input delivery, and output capture. A higher-level manager can add status, scheduling, permissions, and remote control without replacing the agents' native terminal interfaces.

Yes. An agent inside tmux can call split-window with -P and -F '#{pane_id}' to create a pane and receive its ID, then use send-keys to start Claude Code, Codex, OpenCode, or another command in that pane.

Use tmux pane IDs such as %42. The current agent can read its own ID from TMUX_PANE, and a coordinator can list all pane IDs with list-panes. A pane ID remains stable for the life of that pane even if the pane is moved or its window is renamed.

Yes. A controller can target a pane with send-keys, send Ctrl-C, type the service command literally, and send Enter. It should then inspect output or process state to verify the restart. respawn-pane is another option for panes configured around a fixed command.

No. tmux manages terminals, processes, layouts, input, and output. It does not understand agent states, worktree conflicts, approvals, schedules, or notifications. Those semantics belong in a layer above tmux, such as ClawTab.

Not by itself. send-keys delivers terminal input but does not confirm that the target agent was ready, understood the message, or completed it. Use capture-pane, provider hooks, process state, or an acknowledgement protocol when delivery guarantees matter.

Use a separate worktree when agents may write to overlapping paths in the same repository. Plain panes are enough for different repositories, non-overlapping directories, read-only reviews, or services that do not modify the same files.

Related Articles

Two Weeks Rebuilding ClawTab Around a Daemon and tmux
-10 min read

Two Weeks Rebuilding ClawTab Around a Daemon and tmux

How ClawTab made tmux the durable workspace for Claude Code, Codex, and OpenCode: a headless daemon, coherent PTY views, live agent state, useful pane titles, and control from terminal, phone, or GUI.

tmuxdaemoncwtctlclaude-codecodexopencodeterminalrelease
Claude Code Parallel Agents in tmux: Run 8+ Sessions Side by Side
-10 min read

Claude Code Parallel Agents in tmux: Run 8+ Sessions Side by Side

Run 8+ Claude Code parallel agents in tmux panes with git worktrees per session. How worktrees, tmux panes, and Agent Teams compare in 2026, when 5x parallelism is worth 5x tokens, and two copy-paste swarm configs you can run today.

claude-codeparallel-agentstmuxgit-worktreesagent-teamsmulti-agent
Claude Code Multi-Agent Swarm in tmux: Run 10+ Parallel Agents With ClawTab
-6 min read

Claude Code Multi-Agent Swarm in tmux: Run 10+ Parallel Agents With ClawTab

Run 10+ Claude Code agents in parallel tmux panes - each with its own prompt, auto-yes policy, secrets, and remote phone monitoring. How ClawTab multi-agent orchestration compares to Claude Code Agent Teams for background automation and scheduled swarms.

agentstmuxparallel
Claude Code tmux Plugin: Auto-Yes, Forking, and Secrets
-7 min read

Claude Code tmux Plugin: Auto-Yes, Forking, and Secrets

Install the ClawTab Claude Code tmux plugin to toggle auto-yes, fork sessions, inject secrets, and search skills without leaving the terminal.

tmuxterminalskillssecretsauto-yesfork
Restore Claude Code, Codex, and OpenCode Sessions in tmux
-8 min read

Restore Claude Code, Codex, and OpenCode Sessions in tmux

How to restore exact Claude Code, Codex, and OpenCode conversations after a tmux restart. Use tmux-resurrect for panes, then ClawTab session ids for claude -r, codex resume, and opencode -s.

tmuxsession-restoreclaude-codecodexopencodetmux-resurrectcwtctl
Local vs Cloud AI Coding Agents: Claude Code, Codex, GitHub
-10 min read

Local vs Cloud AI Coding Agents: Claude Code, Codex, GitHub

Compare local Claude Code sessions, Codex cloud tasks, GitHub coding agents, Browserbase browser agents, and ClawTab for parallel software work.

ai-coding-agentsclaude-codecodexgithubbrowser-agentscloud-agentslocal-agentscomparison