learning-cmux-with-agents: Command for Claude Code

.claude/commands/cmux-did-spawn.md

cmux-did-spawn is a command for Claude Code from disler/learning-cmux-with-agents. It costs 52 tokens per session (947 once invoked), scanned A, original, MIT.

A command for taking control of a pre-started team of coding agents in a cmux terminal window. It reads the team’s startup file, finds the correct workspace, and reconnects to the lead agent.

In plain words
What is it for?
Use it after a team has been launched to locate its workspace, check that the agents started, and prepare to send work to the lead.
Why use it?
It removes the need to restart the team or guess which terminal panes belong to it. It also avoids stale pane references that can point to the wrong agent.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: model in frontmatter; positional $N argument.

This is disler/learning-cmux-with-agents's own configuration. It tells Claude Code how to work on learning-cmux-with-agents itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything learning-cmux-with-agents configures →

Reuse

Borrowing it

Nothing to install: this file belongs to disler/learning-cmux-with-agents. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/disler/learning-cmux-with-agents/main/.claude/commands/cmux-did-spawn.md
Clone the repo
git clone --depth 1 https://github.com/disler/learning-cmux-with-agents

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cmux-did-spawn

README.md
[![agentmods](https://agentmods.dev/badge/commands/disler/learning-cmux-with-agents/cmux-did-spawn/github.svg)](https://agentmods.dev/commands/disler/learning-cmux-with-agents/cmux-did-spawn)
Your own site
<a href="https://agentmods.dev/commands/disler/learning-cmux-with-agents/cmux-did-spawn"><img src="https://agentmods.dev/badge/commands/disler/learning-cmux-with-agents/cmux-did-spawn/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cmux-did-spawn

Your own site · 80×15
<a href="https://agentmods.dev/commands/disler/learning-cmux-with-agents/cmux-did-spawn"><img src="https://agentmods.dev/badge/commands/disler/learning-cmux-with-agents/cmux-did-spawn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 947 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.00947
Opus 5 $0.00026 $0.00474
Sonnet 5 $0.00010 $0.00189
Haiku 4.5 $0.00005 $0.00095

Measured 9d ago against content hash fbb307b53e36, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

cmux-did-spawn scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/cmux-did-spawn.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

cmux Did Spawn

Purpose

A full-stack Flotion team was already booted as a workspace in a cmux window by the fastcc/fastpi recipe (declarative layout — all 5 pi agents launched at once). That window may be shared with other teams — each team is its own workspace, so locate this team's workspace by name, not by position. Your job is to take command of it: read the spawn file, find the window and the team's workspace, confirm the agents are up, and stand ready to drive the lead. You are the orchestrator and you run in a terminal, outside cmux.

Variables

SPAWN_FILE: $1 # path to the .team/.spawn.json written at spawn time

Instructions

  • cmux short refs are positional and renumber. Never cache a surface:N across time. The only stable handle is the window UUID in the spawn file — locate the team by it and rediscover surface refs at the moment you use them, scoped to the team's workspace.
  • Talk to the LEAD only. The lead dispatches its own workers (plan, build-be, build-fe, test). You hand the lead a feature; it does the rest.
  • The team is already booting — don't re-spawn anything. If a pane shows a shell instead of an agent, that one pi failed to start; report it, don't recreate the whole team.
  • Confirm cmux is reachable first (cmux identify --json).

Workflow

  1. Read SPAWN_FILE:
    F=$(jq -r .feature "$SPAWN_FILE"); WIN=$(jq -r .window "$SPAWN_FILE")
    WSNAME=$(jq -r '.workspace_name // .feature' "$SPAWN_FILE")
    
  2. Confirm cmux is reachable (cmux identify --json); if not, tell the user to open -a cmux and stop.
  3. Locate this team's workspace inside the (possibly shared) window by its name, not by position — other teams may be sibling workspaces in the same window. Then map each role to its current surface ref by the layout name:
    WS=$(cmux workspace list --window "$WIN" --json \
         | jq -r --arg n "$WSNAME" '.workspaces[] | select(.custom_title==$n) | .ref' | head -1)
    cmux list-pane-surfaces --workspace "$WS"      # names: lead / plan / build-be / build-fe / test
    
    Capture the surface ref on the line named lead — that's your dispatch target.
  4. Confirm the team is alive: read the lead pane once (cmux read-screen --surface <lead> --scrollback --lines 30). The workers should each be replying ready: <role>.
  5. You are now oriented. Wait for the user to give you a feature request (they may also give it directly to the leads), then:
    cmux send --surface <lead> "<feature>"; cmux send-key --surface <lead> enter
    cmux read-screen --surface <lead> --scrollback --lines 60   # watch it coordinate
    
  6. Now follow the Report section.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 80 lines · 52 tokens per session scan A fbb307b53e36

Subscribe to this mod's changes

cmux-did-spawn is a command published in the GitHub repository disler/learning-cmux-with-agents (109 stars, last pushed 2mo ago), licensed MIT. It adds 52 tokens to every session and 947 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.