cmux Prompt Playbook — The Terminal for Agents
The terminal built for agents.
Spawn agents. Dispatch tasks. Monitor everything. From one screen.
Launch your AI team in one command
One script. 5 agents. Each reads their client docs and reports what needs attention. Before you open your inbox.
launch 5 agents across my active client folders. each agent should: 1. read Progress.md and Communication-Log.md 2. identify what needs attention today 3. summarize in 3 bullets max color each workspace: green = on track, yellow = needs input, red = blocked. name each workspace after the client.
# Morning launch script spawn_agent "client-a" ~/clients/ClientA "what needs attention today?" "color-purple" spawn_agent "client-b" ~/clients/ClientB "what needs attention today?" "color-blue" spawn_agent "client-c" ~/clients/ClientC "what needs attention today?" "color-green" spawn_agent "client-d" ~/clients/ClientD "what needs attention today?" "color-yellow" spawn_agent "client-e" ~/clients/ClientE "what needs attention today?" "color-red"
4 agents. 4 tasks. Zero conflicts.
Run feature builds, test suites, and deploy pipelines in parallel. Each agent owns its lane.
pane 1: build the OAuth login feature on branch feature-auth pane 2: watch pane 1 and run the test suite after every file change. report failures immediately.
pane 1: fix the payment webhook failure in src/payments/webhook.ts pane 2: once pane 1 commits, run the deploy pipeline and monitor for errors
pane 1: implement caching using Redis pane 2: implement caching using SQLite pane 3: implement caching using in-memory LRU compare all three when done. pick the winner based on latency and memory usage.
Agents that talk to each other
Chain agent outputs as inputs. One researches, the next writes. One builds, the next reviews.
agent 1 (research): research this prospect on LinkedIn. find their pain points, recent posts, company size, and tech stack. save findings to /tmp/prospect-brief.md agent 2 (writer): wait for /tmp/prospect-brief.md to exist. then write a cold DM using the findings. use your brand voice. no fluff.
agent 1 (builder): build the feature described in TASK.md. commit when done. agent 2 (reviewer): watch for new commits on the feature branch. review each one for security issues, test coverage, and code quality. comment inline.
Your knowledge base runs itself
Agents that process your inbox, generate reports, and run your content pipeline. Set it and forget it.
read every client folder in 01_Projects/Clients/Active/.
for each client, read Progress.md, Communication-Log.md, and Technical.md.
generate a weekly status report: what shipped, what is blocked, what needs my input.
save to 009_Handoffs/weekly-report-{date}.mdread everything in 00_Inbox/. for each file: decide where it belongs in the PARA structure. move it there. update any relevant INDEX files. delete the original from inbox. summarize what you moved and where.
agent 1: write today's LinkedIn post using the 30-day content calendar agent 2: build the HTML lead magnet for the post agent 3: screenshot the HTML and verify it looks right all three run in parallel. notify me when all are done.
See everything. Miss nothing.
Color-coded workspace health, cost tracking, and instant alerts when agents need attention.
check all running workspaces. for each one: read the last 10 lines of output. color the workspace: green = agent is working normally yellow = agent is waiting for input or approval red = agent hit an error or is stuck notify me immediately if any workspace turns red.
at the end of every session, log the cost to ~/.claude/cost-log.jsonl. include: timestamp, session duration, workspace name, task summary. every friday, generate a weekly cost report grouped by client.
When things go wrong
Interrupt rogue agents, kill stuck loops, rollback bad commits. Stay in control.
interrupt the agent in workspace "client-b". it went off track -- it is refactoring files it should not touch. redirect it: "only modify files in src/api/. do not touch anything in src/core/."
kill workspace "bugfix-payments" -- the agent is stuck in a loop. respawn a fresh agent on the same branch. give it the same task but add: "do not retry the approach that failed. try a different strategy."
the agent in workspace "feature-auth" broke the build. revert its last 3 commits. respawn with: "the previous approach broke the build. here is the error: [paste error]. fix it without repeating the same mistake."
Every cmux command. Click to copy.
The complete reference. Click any command to copy it to your clipboard.
| Action | Command | Notes |
|---|---|---|
| New workspace | cmux new-workspace --command "cd ~/project && claude" | Opens Claude in a fresh workspace |
| List workspaces | cmux list-workspaces | See all active workspaces |
| Rename | cmux rename-workspace --workspace X "name" | Give workspace a readable name |
| Full tree | cmux tree | Hierarchical view of all workspaces |
| Action | Command | Notes |
|---|---|---|
| Send task | cmux send --workspace X "task" && cmux send-key --workspace X "enter" | Dispatch a prompt to an agent |
| Interrupt | cmux send-key --workspace X "ctrl+c" | Stop current agent execution |
| Health check | cmux surface-health --workspace X | Get agent status and output |
| Action | Command | Notes |
|---|---|---|
| Green (running) | cmux workspace-action --action color-green --workspace X | Agent working normally |
| Yellow (waiting) | cmux workspace-action --action color-yellow --workspace X | Needs input or approval |
| Red (error) | cmux workspace-action --action color-red --workspace X | Hit an error or stuck |
| Gray (done) | cmux workspace-action --action color-gray --workspace X | Task completed |
| Action | Command | Notes |
|---|---|---|
| Notify | cmux notify --title "done" --body "review needed" | Push notification to desktop |
| List | cmux list-notifications | See all recent notifications |
| Flash | cmux trigger-flash --workspace X | Visual flash on workspace |
| Action | Command | Notes |
|---|---|---|
| Focus workspace | cmux select-workspace --workspace X | Switch to a workspace |
| Split right | cmux new-split right --workspace X | Add pane to the right |
| Split down | cmux new-split down --workspace X | Add pane below |
| Reorder | cmux reorder-workspace --workspace X --index 0 | Move workspace to position |
Install the cmux skill in 60 seconds.
Drop this file into your Claude Code project. Claude learns how to spawn agents, dispatch tasks, color workspaces, and orchestrate your entire terminal.
Step 1: Create the skill folder
mkdir -p .claude/skills/cmux-agent-manager
Step 2: Copy the SKILL.md file below
Click the copy button, then paste into .claude/skills/cmux-agent-manager/SKILL.md
---
name: cmux-agent-manager
description: Manage, spawn, and control multiple Claude Code agent instances via cmux terminal. Create workspaces, split panes, dispatch tasks to other agents, fire notifications, color-code workspaces, reorganize layouts, check surface health, and orchestrate parallel agent workflows.
argument-hint: "[action: spawn|dispatch|list|tree|cleanup|notify|color|organize] [optional: task description or workspace name]"
---
# cmux Agent Manager
You are a terminal orchestration expert. Your job is to use the `cmux` CLI to create, manage, color, organize, and control Claude Code instances across workspaces and panes -- from inside the current running session.
cmux is a native macOS terminal (Ghostty-based) with a full CLI + socket API. Every cmux terminal has `CMUX_WORKSPACE_ID` and `CMUX_SURFACE_ID` auto-injected in its environment.
---
## Prerequisites
```bash
which cmux # /Applications/cmux.app/Contents/Resources/bin/cmux
cmux ping # OK (if fails: open cmux.app first)
cmux list-workspaces
cmux tree # full hierarchy: windows > workspaces > panes > surfaces
```
---
## Topology Model
```
window top-level OS window
workspace named tab in sidebar
pane split region
surface a terminal OR browser tab inside a pane
```
Sidebar per workspace shows: git branch, PR status, working dir, listening ports, notification text, color indicator.
---
## Core Commands
### Inspect
```bash
cmux list-workspaces # * = selected
cmux list-panes [--workspace X]
cmux list-pane-surfaces [--workspace X] [--pane X]
cmux tree # full hierarchy dump
cmux surface-health [--workspace X] # detect unhealthy surfaces
```
### Create
```bash
cmux new-workspace
cmux new-workspace --command "cd ~/project && claude"
cmux new-split right [--workspace X]
cmux new-split down [--workspace X]
```
### Rename
```bash
cmux rename-workspace [--workspace X] "new name"
```
### Color Workspaces
```bash
cmux workspace-action --action color-green [--workspace X] # running
cmux workspace-action --action color-yellow [--workspace X] # waiting
cmux workspace-action --action color-red [--workspace X] # error
cmux workspace-action --action color-blue [--workspace X] # research
cmux workspace-action --action color-purple [--workspace X] # client
cmux workspace-action --action color-gray [--workspace X] # done
```
### Send Commands to Any Surface
```bash
cmux send --workspace X --surface Y "text here"
cmux send-key --workspace X --surface Y "enter"
cmux send-key --workspace X --surface Y "ctrl+c" # interrupt
```
### Notifications
```bash
cmux notify --title "Agent done" --body "Review needed" [--workspace X]
cmux list-notifications
cmux trigger-flash --workspace X # visual flash
```
### Reorder and Move
```bash
cmux reorder-workspace --workspace X --index 0
cmux move-workspace-to-window --workspace X --window Y
cmux move-surface --surface X --pane Y
```
### Close
```bash
cmux close-workspace --workspace X
cmux close-surface --surface X
cmux refresh-surfaces [--workspace X] # fix ghost surfaces
```
---
## Patterns
### Spawn an Agent
```bash
spawn_agent() {
local name="$1" path="$2" task="$3" color="${4:-color-green}"
WS=$(cmux --json new-workspace | python3 -c "import json,sys; print(json.load(sys.stdin)['id'])")
cmux rename-workspace --workspace "$WS" "$name"
cmux workspace-action --action "$color" --workspace "$WS"
cmux send --workspace "$WS" "cd $path && claude"
cmux send-key --workspace "$WS" "enter"
sleep 4
cmux send --workspace "$WS" "$task"
cmux send-key --workspace "$WS" "enter"
cmux trigger-flash --workspace "$WS"
cmux notify --workspace "$WS" --title "Agent: $name" --body "Task dispatched"
}
```
### Dispatch Task to Running Agent
```bash
cmux send-key --workspace X --surface Y "ctrl+c" # interrupt if busy
sleep 0.5
cmux send --workspace X --surface Y "your new task here"
cmux send-key --workspace X --surface Y "enter"
cmux trigger-flash --workspace X
```
### Hook: Auto-notify When Agent Finishes
Add to ~/.claude/settings.json:
```json
{
"hooks": {
"Stop": [{
"hooks": [{
"type": "command",
"command": "cmux notify --title 'Claude done' --body 'Review needed'"
}]
}]
}
}
```
---
## Quick Reference
```
inspect cmux tree / list-workspaces / surface-health
new agent new-workspace > rename > color > send claude > enter
split new-split right|down [--workspace X]
send task send "task" + send-key enter
interrupt send-key ctrl+c
flash trigger-flash --workspace X
color workspace-action --action color-green|red|yellow|blue|purple|gray
notify notify --title "done" --body "review"
close close-workspace / close-surface
```Step 3: Verify it works
open a Claude Code session in cmux and type: "spawn a new agent called test-agent, color it green, and have it say hello" if Claude creates a workspace, names it, colors it, and sends the command -- the skill is working.
Step 4: Add the Stop hook (optional but recommended)
Get notified every time an agent finishes. Add this to your ~/.claude/settings.json
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "command -v cmux &>/dev/null && cmux notify --title 'Claude done' --body 'Agent finished' || osascript -e 'display notification \"Done\" with title \"Claude Code\"'"
}
]
}
]
}
}