tmux-multi-agent
Multi-pane tmux layouts for coordinating multiple Claude Code agents
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Multi-pane tmux layouts for coordinating multiple Claude Code agents
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Shell scripts for managing Claude Code instances in tmux sessions, enabling multi-agent orchestration, message sending, and session monitoring
Patterns for sending prompts to Claude Code sessions via tmux send-keys
Session lifecycle management for Claude Code tmux sessions
| name | tmux-multi-agent |
| description | Multi-pane tmux layouts for coordinating multiple Claude Code agents |
Run multiple Claude Code instances in a single tmux session, each in its own pane. Panes are addressed by index (0, 1, 2, ...) and can receive independent tasks.
# Create a 3-agent swarm
scripts/multi-agent-setup.sh my-swarm --agents 3 --workdir ~/project
# Send tasks to each agent
scripts/send-message.sh my-swarm --pane 0 "implement the database models"
scripts/send-message.sh my-swarm --pane 1 "implement the API routes"
scripts/send-message.sh my-swarm --pane 2 "write the test suite"
# Monitor progress
scripts/multi-agent-dashboard.sh my-swarm --watch 10
scripts/multi-agent-setup.sh my-swarm --agents 3 --workdir ~/project
# Creates 3 bash panes. Send Claude commands manually.
scripts/multi-agent-setup.sh my-swarm --agents 3 --workdir ~/project --claude
# Each pane starts an interactive Claude Code session.
scripts/multi-agent-setup.sh my-swarm --agents 3 --workdir ~/project --claude --model opus
Create a tasks JSON file:
[
{"pane": 0, "task": "implement user authentication"},
{"pane": 1, "task": "write API integration tests"},
{"pane": 2, "task": "set up CI/CD pipeline"}
]
scripts/multi-agent-setup.sh my-swarm --agents 3 --workdir ~/project --tasks tasks.json
| Layout | Best For | Agents |
|---|---|---|
tiled (default) | General use | 3-6 |
even-horizontal | Side-by-side comparison | 2 |
even-vertical | Pipeline stages | 2-3 |
main-vertical | Lead + workers | 3-5 |
main-horizontal | Lead + workers | 3-5 |
scripts/multi-agent-setup.sh my-swarm --agents 4 --layout main-vertical --workdir ~/project
See references/multi-pane-layouts.md for ASCII diagrams of each layout.
# One-shot status
scripts/multi-agent-dashboard.sh my-swarm
# Auto-refresh every 5 seconds
scripts/multi-agent-dashboard.sh my-swarm --watch 5
# JSON output (for programmatic monitoring)
scripts/multi-agent-dashboard.sh my-swarm --json
Status indicators:
[*] WORKING - Agent is actively processing[!] ERROR - Error detected in output[?] WAITING - Agent is waiting for input/approval[+] DONE - Agent reports completion[-] IDLE - Agent appears idle (at shell prompt)# One-shot capture
scripts/pane-tail.sh my-swarm --pane 1 --lines 30
# Continuous follow
scripts/pane-tail.sh my-swarm --pane 1 --follow 3
Distribute tasks, then collect results:
# Fan out
scripts/send-message.sh my-swarm --pane 0 "implement feature A"
scripts/send-message.sh my-swarm --pane 1 "implement feature B"
scripts/send-message.sh my-swarm --pane 2 "implement feature C"
# Wait and collect
sleep 120
for i in 0 1 2; do
echo "=== Pane $i ==="
scripts/session-review.sh my-swarm --pane "$i" --lines 20
done
Pane 0 is the lead, others are workers:
scripts/multi-agent-setup.sh my-swarm --agents 4 --layout main-vertical --workdir ~/project
# Lead agent plans
scripts/send-message.sh my-swarm --pane 0 "analyze the codebase and create a plan"
# Wait for plan
sleep 60
PLAN=$(scripts/session-review.sh my-swarm --pane 0 --lines 50)
# Assign work based on plan
scripts/send-message.sh my-swarm --pane 1 "implement: step 1 from the plan"
scripts/send-message.sh my-swarm --pane 2 "implement: step 2 from the plan"
scripts/send-message.sh my-swarm --pane 3 "implement: step 3 from the plan"
Sequential processing where output feeds forward:
# Stage 1: Generate
scripts/send-message.sh my-swarm --pane 0 "generate the API schema"
sleep 60
# Stage 2: Implement (based on stage 1)
OUTPUT=$(scripts/session-review.sh my-swarm --pane 0 --lines 100)
echo "Implement this schema: $OUTPUT" | scripts/send-message.sh my-swarm --pane 1 --stdin
sleep 60
# Stage 3: Test (based on stage 2)
scripts/send-message.sh my-swarm --pane 2 "write tests for the newly implemented API"
# Kill the entire swarm
scripts/cleanup.sh my-swarm
# Or kill session directly
scripts/session-kill.sh my-swarm --force