Run 4 AI Agents in Parallel with Tmux Split Panes
Step-by-step guide to running 4 AI agents in parallel with tmux split panes: the four-quadrant layout, one-key bindings, and per-pane task assignments.
Independent article: published by AI Coding Tools, not official vendor documentation.
Run 4 AI Agents in Parallel with Tmux Split Panes
The biggest waste of time in AI-assisted development is waiting: you submit one task to an agent, watch the spinner, and do nothing until it finishes. With tmux split panes, you can run four independent tasks at once — one per quadrant of your screen — and get four results in the time one would have taken.
This is the flagship pattern of tmux for AI coding. Here's the exact setup, step by step.
Why four panes?
A terminal pane is an independent shell. Four panes means four independent processes: four agents, or a mix of agents, test watchers, and review commands. Nothing blocks anything else, because each pane runs its own program.
The classic assignment for an agent-based workflow:
┌──────────────────────┬──────────────────────┐
│ Pane 1 │ Pane 2 │
│ Agent A: feature │ Agent B: bug fix │
├──────────────────────┼──────────────────────┤
│ Pane 3 │ Pane 4 │
│ Test watcher │ git review / logs │
└──────────────────────┴──────────────────────┘
The key rule: keep the four tasks independent. Don't point two agents at the same files — you'll get conflicting edits. Separate features, separate files, separate concerns.
Step 1: Create a session and split into quadrants
tmux new -s work
Inside the session, create the 2×2 grid:
| Step | Shortcut | Result |
|---|---|---|
| Split the window horizontally | Ctrl-b " | Top and bottom panes |
| Focus the right pane, split it vertically | Ctrl-b % | Top right and bottom right |
| Focus the left pane, split it vertically | Ctrl-b % | All four panes |
Ctrl-b o cycles between panes; Ctrl-b + arrow keys moves in a specific direction.
Step 2: Assign a task to each pane
Move into a pane and launch the task:
# Pane 1 — feature agent (Claude Code, Codex CLI, OpenCode, or any agent CLI)
claude
# Pane 2 — a second, independent agent
codex
# Pane 3 — the test watcher
npm test -- --watch
# Pane 4 — review and monitoring
git diff --stat
Each pane is a fresh shell, so the agents never collide. Running two Claude Code sessions like this is covered in detail in tmux + Claude Code: multiple agent sessions.
Step 3: Make it one key with a quad-layout binding
Typing four splits every time gets old. Add this to ~/.tmux.conf to create the quad layout with a single keystroke:
# ~/.tmux.conf
# Alt-q → instant 2x2 grid (reuses the current window)
bind -n M-q send-keys tmux new-session -d \; split-window -h \; split-window -v -t 0 \; split-window -v -t 2 \; select-pane -t 0
# Reload config from any session
bind R source-file ~/.tmux.conf
Then:
tmux new -s work
# press Alt-q → four panes appear instantly
Reload an existing config without restarting: Ctrl-b : → source-file ~/.tmux.conf. The full config — prefix remap, mouse, status bar — is in our tmux.conf productivity guide.
Step 4: Detach and let everything run
The real payoff: once the four tasks are running, detach.
# Ctrl-b d
# The agents keep working. Close the laptop, SSH away, come back later.
tmux attach -t work
Every pane is exactly where you left it. This "submit and walk away" loop is what makes tmux feel like a force multiplier for parallel AI programming.
Workflow variations
The 3-agent + watcher layout
Three coding agents (one per concern: frontend, backend, tests) plus a CI log pane. Best when you have three genuinely independent subsystems.
The 2×1 planner/verifier split
If four is too many, start with two: agent on top, your shell below. Submit a task, then use the bottom pane to inspect the repo, run the agent's suggested commands, or prepare the next prompt.
The zoom trick
Ctrl-b z zooms a pane to fullscreen when you need to read an agent's long output, and zooms back when you're done. Pairs well with the quad layout — details in the cheatsheet.
FAQ
Can I really run four agents at once?
Yes — each pane is a separate shell running its own process. The only real limit is CPU, RAM, and API rate limits. Agents are mostly I/O-bound while they think, so three or four run fine on a normal laptop.
What if two agents edit the same repo?
Don't. Give each agent disjoint files or directories. If they must touch shared code, run them in separate tmux sessions instead of panes, and merge manually.
Does this work with IDE-based agents?
Terminal agents (Claude Code, Codex, OpenCode) run natively in panes. IDE agents like Antigravity run inside the editor — our Antigravity vs Claude Code comparison discusses mixing both worlds.
My agent output is slow to redraw in a pane
That's normal for terminal UIs in panes. Use Ctrl-b z to zoom the agent pane while it works.
Next steps
- Full strategy: tmux for AI coding: run parallel agents without waiting
- Command reference: tmux cheatsheet
- Agent-specific: tmux + Claude Code multi-session setup
- Setup: tmux.conf for faster AI coding