Tmux Orchestrator - Run AI agents 24/7
Published:
The Tmux Orchestrator enables Claude agents to work autonomously, schedule their own check-ins, and coordinate across multiple projects without human intervention - a project I explored and learned a lot from.
π€ Key Capabilities & Autonomous Features
- Self-trigger - Agents schedule their own check-ins and continue work autonomously
- Coordinate - Project managers assign tasks to engineers across multiple codebases
- Persist - Work continues even when you close your laptop
- Scale - Run multiple teams working on different projects simultaneously
ποΈ Architecture
The Tmux Orchestrator uses a three-tier hierarchy to overcome context window limitations:
βββββββββββββββ
β Orchestratorβ β You interact here
ββββββββ¬βββββββ
β Monitors & coordinates
βΌ
βββββββββββββββ βββββββββββββββ
β Project β β Project β
β Manager 1 β β Manager 2 β β Assign tasks, enforce specs
ββββββββ¬βββββββ ββββββββ¬βββββββ
β β
βΌ βΌ
βββββββββββββββ βββββββββββββββ
β Engineer 1 β β Engineer 2 β β Write code, fix bugs
βββββββββββββββ βββββββββββββββ
Why Separate Agents?
- Limited context windows - Each agent stays focused on its role
- Specialized expertise - PMs manage, engineers code
- Parallel work - Multiple engineers can work simultaneously
- Better memory - Smaller contexts mean better recall
πΈ Examples in Action
Project Manager Coordination
The orchestrator creating and briefing a new project manager agent
Status Reports & Monitoring
Real-time status updates from multiple agents working in parallel
Tmux Communication
How agents communicate across tmux windows and sessions
Project Completion
Successful project completion with all tasks verified and committed
To use this repository, we should first install Tmux using this command: https://github.com/tmux/tmux/wiki/Installing
π― Quick Start
Option 1: Basic Setup (Single Project)
# 1. Create a project spec
cat > project_spec.md << 'EOF'
PROJECT: My Web App
GOAL: Add user authentication system
CONSTRAINTS:
- Use existing database schema
- Follow current code patterns
- Commit every 30 minutes
- Write tests for new features
DELIVERABLES:
1. Login/logout endpoints
2. User session management
3. Protected route middleware
EOF
# 2. Start tmux session
tmux new-session -s my-project
# 3. Start project manager in window 0
claude
# 4. Give PM the spec and let it create an engineer
"You are a Project Manager. Read project_spec.md and create an engineer
in window 1 to implement it. Schedule check-ins every 30 minutes."
# 5. Schedule orchestrator check-in
./schedule_with_note.sh 30 "Check PM progress on auth system"
Option 2: Full Orchestrator Setup
# Start the orchestrator
tmux new-session -s orchestrator
claude
# Give it your projects
"You are the Orchestrator. Set up project managers for:
1. Frontend (React app) - Add dashboard charts
2. Backend (FastAPI) - Optimize database queries
Schedule yourself to check in every hour."
β¨ Key Features
π Self-Scheduling Agents
Agents can schedule their own check-ins using:
./schedule_with_note.sh 30 "Continue dashboard implementation"
π₯ Multi-Agent Coordination
- Project managers communicate with engineers
- Orchestrator monitors all project managers
- Cross-project knowledge sharing
πΎ Automatic Git Backups
- Commits every 30 minutes of work
- Tags stable versions
- Creates feature branches for experiments
π Real-Time Monitoring
- See what every agent is doing
- Intervene when needed
- Review progress across all projects
π Best Practices
Writing Effective Specifications
PROJECT: E-commerce Checkout
GOAL: Implement multi-step checkout process
CONSTRAINTS:
- Use existing cart state management
- Follow current design system
- Maximum 3 API endpoints
- Commit after each step completion
DELIVERABLES:
1. Shipping address form with validation
2. Payment method selection (Stripe integration)
3. Order review and confirmation page
4. Success/failure handling
SUCCESS CRITERIA:
- All forms validate properly
- Payment processes without errors
- Order data persists to database
- Emails send on completion
Git Safety Rules
- Before Starting Any Task
git checkout -b feature/[task-name] git status # Ensure clean state - Every 30 Minutes
git add -A git commit -m "Progress: [what was accomplished]" - When Task Completes
git tag stable-[feature]-[date] git checkout main git merge feature/[task-name]
π¨ Common Pitfalls & Solutions
| Pitfall | Consequence | Solution |
|---|---|---|
| Vague instructions | Agent drift, wasted compute | Write clear, specific specs |
| No git commits | Lost work, frustrated devs | Enforce 30-minute commit rule |
| Too many tasks | Context overload, confusion | One task per agent at a time |
| No specifications | Unpredictable results | Always start with written spec |
| Missing checkpoints | Agents stop working | Schedule regular check-ins |
π οΈ How It Works
The Magic of Tmux
Tmux (terminal multiplexer) is the key enabler because:
- It persists terminal sessions even when disconnected
- Allows multiple windows/panes in one session
- Claude runs in the terminal, so it can control other Claude instances
- Commands can be sent programmatically to any window
π¬ Simplified Agent Communication
We now use the send-claude-message.sh script for all agent communication:
# Send message to any Claude agent
./send-claude-message.sh session:window "Your message here"
# Examples:
./send-claude-message.sh frontend:0 "What's your progress on the login form?"
./send-claude-message.sh backend:1 "The API endpoint /api/users is returning 404"
./send-claude-message.sh project-manager:0 "Please coordinate with the QA team"
The script handles all timing complexities automatically, making agent communication reliable and consistent.
Scheduling Check-ins
# Schedule with specific, actionable notes
./schedule_with_note.sh 30 "Review auth implementation, assign next task"
./schedule_with_note.sh 60 "Check test coverage, merge if passing"
./schedule_with_note.sh 120 "Full system check, rotate tasks if needed"
Important: The orchestrator needs to know which tmux window itβs running in to schedule its own check-ins correctly. If scheduling isnβt working, verify the orchestrator knows its current window with:
echo "Current window: $(tmux display-message -p "#{session_name}:#{window_index}")"
π Advanced Usage
Multi-Project Orchestration
# Start orchestrator
tmux new-session -s orchestrator
# Create project managers for each project
tmux new-window -n frontend-pm
tmux new-window -n backend-pm
tmux new-window -n mobile-pm
# Each PM manages their own engineers
# Orchestrator coordinates between PMs
Cross-Project Intelligence
The orchestrator can share insights between projects:
- βFrontend is using /api/v2/users, update backend accordinglyβ
- βAuthentication is working in Project A, use same pattern in Project Bβ
- βPerformance issue found in shared library, fix across all projectsβ
π Core Files
send-claude-message.sh- Simplified agent communication scriptschedule_with_note.sh- Self-scheduling functionalitytmux_utils.py- Tmux interaction utilitiesCLAUDE.md- Agent behavior instructionsLEARNINGS.md- Accumulated knowledge base
π€ Contributing & Optimization
The orchestrator evolves through community discoveries and optimizations. When contributing:
- Document new tmux commands and patterns in CLAUDE.md
- Share novel use cases and agent coordination strategies
- Submit optimizations for claudes synchronization
- Keep command reference up-to-date with latest findings
- Test improvements across multiple sessions and scenarios
Key areas for enhancement:
- Agent communication patterns
- Cross-project coordination
- Novel automation workflows
π License
MIT License - Use freely but wisely. Remember: with great automation comes great responsibility.
βThe tools we build today will program themselves tomorrowβ - Alan Kay, 1971
