# Tmux + Fable = Cut 35% less token

## Executive summary

The video details advanced strategies for optimizing AI coding agent workflows, focusing primarily on reducing token consumption and maintaining context persistence. The core recommendation is shifting from using powerful but expensive frontier models (like Fable 5) as the primary executor to utilizing them only as advisors or planners, while delegating hands-on work to smaller, cost-effective models (like Sonnet 5). Techniques covered include implementing persistent 'sidekick' sessions via Cloud Code Agent Teams and leveraging terminal multiplexers like Tmux for universal agent orchestration.

## Key takeaways

- Optimize Model Roles for Cost Efficiency: It is recommended to use a powerful model (e.g., Fable 5) as the advisor/planner, but delegate execution to smaller models (e.g., Sonnet 5). This approach is more cost-efficient than using the expensive model as the main executor because the advisor role benefits from cached context rather than reading full conversation history.
- Leverage Persistent Agent Sessions (Sidekicks): Traditional sub-agents lose context upon completion, leading to wasted tokens when making edits. Using persistent sessions (like Cloud Code's Agent Teams) ensures the main agent can send follow-up messages that inherit all past context cheaply via cached tokens.
- Universal Agent Orchestration with Tmux: Tmux, a terminal multiplexer, allows users to run and manage multiple independent coding agents (e.g., Grok, Pi Agent) in parallel sessions within a single terminal. This provides a low-level way to achieve agent team functionality across different AI tools.
- Advanced Orchestration Tools: While Cloud Code offers built-in delegation rules via `cloud.md`, dedicated platforms like Orca provide an integrated, packaged experience with out-of-the-box orchestration skills and better visibility into multiple running sessions.

## Technical details

- Model Delegation Strategy: The optimal workflow is to use a powerful model (Fable 5) as the coordinator/planner, defining delegation rules in `cloud.md` for design and architecture, while delegating hands-on execution to smaller models (Sonnet 5). This separation minimizes cost and maximizes performance.
- Cloud Code Agent Teams Implementation: This workflow is achieved by adding specific delegation rules to the `cloud.md` file, explicitly defining which tasks are for the coordinator (design/planning) and which are delegated to executor sub-agents using a smaller model like Sonnet 5.
- Codex Plugin Integration: The Codex plugin provides tools like `Codex rescue`, `Codex review` (for local git), and `Codex result` within Cloud Code, allowing delegation to the OpenAI Codex agent for tasks like UI improvement.
- Tmux Commands for Agent Control: Key Tmux commands demonstrated include: `tmux split window -h` (start new session), `tmux send keys t $1` (send message to a specific terminal session), and `tmux capture pane -p -t .1` (read output from a specific terminal).

## Practical implications

- Build engineers can optimize their CI/CD agent workflows by implementing structured delegation rules (Coordinator/Executor) to drastically reduce API token costs.
- Understanding persistent session management (sidekicks) is crucial for building reliable, multi-step automation that maintains context across multiple tool calls.
- Tmux provides a low-level, platform-agnostic method for managing concurrent execution of diverse AI coding agents.

## Topics

AI Agent Orchestration, LLM Cost Optimization, Build Engineering Workflows, Terminal Multiplexing, Software Development Lifecycle, AI Builder Club GitHub Repo, Open Agent Teams Skill, Orca Orchestration CLI

Source: https://www.youtube.com/watch?v=wCSPgHpcxdc
