Orchestrating Multi-Agent Coding Workflows with Tmux
AI Jasongo watch the original →
the gist
Reduce token costs by using a high-end model as a persistent orchestrator and smaller models as specialized executors, using Tmux to bridge disparate agent CLI tools.
The Orchestrator-Executor Pattern
To reduce token consumption and costs, developers should shift from using a single frontier model (like Claude 3.5 Sonnet or GPT-4o) for all tasks to an orchestrator-worker architecture. By using a high-end model as a persistent orchestrator that delegates tasks to smaller, cheaper models (like Haiku or Sonnet 3.5) acting as executors, users can maintain high performance while lowering costs by approximately 35%. The key is to maintain persistent sessions for sub-agents, allowing them to inherit context rather than re-reading the entire conversation history, which minimizes input token usage.
Implementing Agent Teams via Tmux
Because different coding agents (Claude Code, Cursor, Gemini, etc.) often lack native interoperability, Tmux can be used as a universal bridge to manage multi-agent workflows. By using Tmux to split terminal windows and programmatically sending commands via tmux send-keys and tmux capture-pane, a main orchestrator agent can spawn, control, and monitor sub-agents in the background. This allows the orchestrator to wait for completion signals, capture outputs, and manage complex tasks across different agent harnesses.
Configuration and Delegation
To implement this, define clear delegation rules within your claude.md or agent.md configuration files. These rules should explicitly define the orchestrator's role (planning, architecture, review) versus the executor's role (hands-on implementation).
- Use a persistent session flag to ensure sub-agents stay active for follow-up messages.
- Implement a "frozen spec" in a task folder to provide clear instructions for executors, reducing ambiguity.
- Utilize the
open-agent-teamsskill script to encapsulate Tmux commands for starting sessions, sending messages, and waiting for task completion signals. - For a more integrated experience, tools like Orca provide built-in orchestration UIs that automate these CLI interactions and provide visual tracking of sub-agent hierarchies.