agent-control
Skill1 starsChanged 6 months agoMITView on GitHub
Run and orchestrate multiple Pi AI agents inside cmux on macOS. Covers pane creation, non-disruptive layout management, interactive Pi sub-agent spawning, sending task prompts, reading screens, and monitoring worker sessions.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leadgenjay/claude-skillstheir own version, first seen Jun 19, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- leadgenjay/claude-skills★ 19same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 12 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use this skill when you need to run, delegate to, or monitor multiple Pi agent sessions in the cmux macOS terminal app.
- Distinctive: line 18
Run automation from inside a cmux terminal whenever possible.
- Very specific: line 40
Always anchor commands to CMUX_WORKSPACE_ID when available:
- Very specific: line 49
Do not steal focus: pass --focus false when creating panes.
- Distinctive: line 50
Do not close, respawn, or replace panes unless the user explicitly asked.
- Distinctive: line 51
Read the layout before sending commands.
- Distinctive: line 53
Keep worker agents interactive.
- Distinctive: line 91
Create panes only if reusable panes do not already exist:
- Distinctive: line 102
Create an empty terminal pane first, then send the Pi launch command into that pane.
- Very specific: line 124
When a pane already contains a Pi TUI session, start a fresh conversation with /new:
- Very specific: line 140
Do not send long multiline prompts directly with cmux send.
- Distinctive: line 161
If literal paste is required:
- Distinctive: line 176
Use short reads repeatedly instead of dumping huge scrollback.
- Distinctive: line 214
Avoid this for inspectable worker sessions:
- Distinctive: line 228
Write long prompts to a file and send a one-line instruction to read it.
- Distinctive: line 245
After layout mutations, rerun:
- Very specific: line 254
Use --focus false when creating panes and avoid focus-changing commands unless explicitly requested.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Control with Pi + cmux
Use this skill when you need to run, delegate to, or monitor multiple Pi agent sessions in the cmux macOS terminal app.
This skill is intentionally generic. It does not prescribe project-specific branching, task trackers, model-routing policy, or repository workflow.
Prerequisites
- macOS with cmux installed.
cmuxCLI available inPATH.piCLI available inPATH.- Run automation from inside a cmux terminal whenever possible.
jqis recommended for parsing--jsonoutput.
Quick checks:
which cmux
which pi
env | grep '^CMUX_' || truecmux Environment
cmux injects useful environment variables into terminal panes:
| Variable | Purpose |
CMUX_WORKSPACE_ID | Current workspace UUID. Prefer this for all automation. |
CMUX_SOCKET_PATH | cmux Unix socket path. Do not hardcode it. |
CMUX_SURFACE_ID | Current surface UUID. |
CMUX_PORT / CMUX_PORT_RANGE | Ports available to browser/app automation. |
Always anchor commands to CMUX_WORKSPACE_ID when available:
WS="${CMUX_WORKSPACE_ID:?Run this from inside cmux or set CMUX_WORKSPACE_ID}"Non-Disruptive Rules
- Reuse existing agent panes when possible.
- Do not steal focus: pass
--focus falsewhen creating panes. - Do not close, respawn, or replace panes unless the user explicitly asked.
- Read the layout before sending commands.
- Send long prompts through files, not as raw multiline terminal input.
- Keep worker agents interactive; do not use one-shot print mode for sessions you need to inspect later.
Inspect Current Layout
cmux tree --workspace "$CMUX_WORKSPACE_ID"
cmux list-panes --workspace "$CMUX_WORKSPACE_ID"To inspect real screen geometry:
cmux list-panes --workspace "$CMUX_WORKSPACE_ID" --json | jq '.panes | map({
ref: .ref,
x: .pixel_frame.x,
y: .pixel_frame.y,
width: .pixel_frame.width,
height: .pixel_frame.height,
focused: .focused
})'cmux tree shows refs, not visual position. Use JSON geometry to verify actual left/right/top/bottom layout.
Recommended Layout
A practical multi-agent layout is one large orchestrator pane plus several compact worker panes:
┌───────────────────────┬────────────────┐
│ │ worker agent 1 │
│ primary/orchestrator ├────────────────┤
│ │ worker agent 2 │
│ ├────────────────┤
│ │ worker agent 3 │
└───────────────────────┴────────────────┘Create panes only if reusable panes do not already exist:
cmux new-pane --workspace "$CMUX_WORKSPACE_ID" --type terminal --direction right --focus false
cmux new-split down --focus falseExact layout commands may vary by cmux version. Prefer cmux help new-pane / cmux help new-split if unsure.
Start an Interactive Pi Worker
Create an empty terminal pane first, then send the Pi launch command into that pane.
SURFACE=$(cmux new-pane --workspace "$CMUX_WORKSPACE_ID" \
--type terminal --direction right --focus false --json | jq -r '.result.surface_ref')
cmux send --surface "$SURFACE" "pi --mode text --no-extensions"
cmux send-key --surface "$SURFACE" enterOptional model examples:
pi --model provider/model-name --mode text --no-extensions
pi --model magnit-ailab/MagnitCopilot --mode text --no-extensions
pi --model ollama/kimi-k2.6:cloud --mode text --no-extensionsThese are examples only. Choose models according to your project, budget, and provider availability.
Reuse an Existing Pi Pane
When a pane already contains a Pi TUI session, start a fresh conversation with /new:
cmux send --surface surface:14 "/new"
cmux send-key --surface surface:14 enterThen send a short pointer to a task file:
cmux send --surface surface:14 "Read /tmp/task-agent.md and execute it exactly."
cmux send-key --surface surface:14 enterSend Long Prompts Safely
Do not send long multiline prompts directly with cmux send. Some TUIs treat each line as a separate input.
Preferred pattern:
cat > /tmp/task-agent.md <<'TASK'
Task: implement the requested change.
Context:
- ...
Instructions:
- Work in the specified directory.
- Report changed files and validation.
- Do not commit unless explicitly asked.
TASK
cmux send --surface surface:14 "Read /tmp/task-agent.md and execute it exactly."
cmux send-key --surface surface:14 enterIf literal paste is required:
cmux set-buffer --name agent-task "$(cat /tmp/task-agent.md)"
cmux paste-buffer --name agent-task --surface surface:14
cmux send-key --surface surface:14 enterRead Worker Output
cmux read-screen --surface surface:14 --lines 40
cmux read-screen --surface surface:14 --lines 80 --scrollbackUse short reads repeatedly instead of dumping huge scrollback.
Send Follow-Up Instructions
cmux send --surface surface:14 "Please fix the failing test and rerun validation."
cmux send-key --surface surface:14 enterFor interactive prompts, send the option or short answer, then Enter:
cmux send --surface surface:14 "1"
cmux send-key --surface surface:14 enterMonitor Multiple Agents
for S in surface:14 surface:15 surface:16; do
echo "===== $S ====="
cmux read-screen --surface "$S" --lines 20 || true
echo
doneOptional cmux UI signals:
cmux notify --title "Agent finished" --body "Worker 1 is ready for review"
cmux trigger-flash --workspace "$CMUX_WORKSPACE_ID"
cmux set-progress 0.5 --label "Workers running"Common Pitfalls
Do not use one-shot prompt mode for workers
Avoid this for inspectable worker sessions:
pi -p "do something"It runs once and exits. For a worker you can monitor, use interactive mode:
pi --mode text --no-extensionsDo not send raw multiline prompts
Write long prompts to a file and send a one-line instruction to read it.
Do not respawn panes casually
Respawning can destroy the current surface, change refs, or disrupt the layout. Prefer /new inside an existing Pi TUI or send a launch command into an existing shell pane.
cmux send-surface is not a command
Use:
cmux send --surface surface:14 "text"
cmux send-key --surface surface:14 enterPane refs can change
After layout mutations, rerun:
cmux tree --workspace "$CMUX_WORKSPACE_ID"
cmux list-panes --workspace "$CMUX_WORKSPACE_ID" --jsonFocus stealing is disruptive
Use --focus false when creating panes and avoid focus-changing commands unless explicitly requested.
Complete Example
#!/usr/bin/env bash
set -euo pipefail
WS="${CMUX_WORKSPACE_ID:?Run inside cmux}"
cat > /tmp/task-agent-1.md <<'TASK'
Task: inspect the code and report likely causes of the failing test.
Do not modify files.
TASK
SURFACE=$(cmux new-pane --workspace "$WS" --type terminal \
--direction right --focus false --json | jq -r '.result.surface_ref')
cmux send --surface "$SURFACE" "pi --mode text --no-extensions"
cmux send-key --surface "$SURFACE" enter
sleep 2
cmux send --surface "$SURFACE" "Read /tmp/task-agent-1.md and execute it exactly."
cmux send-key --surface "$SURFACE" enter
echo "Worker started on $SURFACE"Quick Reference
# Layout
cmux tree --workspace "$CMUX_WORKSPACE_ID"
cmux list-panes --workspace "$CMUX_WORKSPACE_ID" --json
# Create pane
cmux new-pane --workspace "$CMUX_WORKSPACE_ID" --type terminal --direction right --focus false
# Send input
cmux send --surface surface:14 "message"
cmux send-key --surface surface:14 enter
# Read output
cmux read-screen --surface surface:14 --lines 40
# Fresh Pi conversation
cmux send --surface surface:14 "/new"
cmux send-key --surface surface:14 enterDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

