ccc-spawn · diff
git:20260722.9d3ab82 to git:20261013.fbe187d
77 added, 44 removed. Audit A to A.
---
name: ccc-spawn
- description: "Click-first spawn hub — spin isolated work into its own session on demand: a spawn_task chip in Cowork, a /spawn peer in the CLI. Also routes to $ccc-fleet or $ccc-relay."
+ description: "Spin self-contained work off on demand: a background subagent, a separate session (Cowork spawn_task chip or CLI /spawn peer), or an independent expert pass; routes fan-outs to $ccc-fleet and chains to $ccc-relay. Use when the user types $ccc-spawn or wants a task done outside this thread."
allowed-tools:
- Read
- Bash
+ - Agent
+ - Skill
- AskUserQuestion
argument-hint: "[isolated | fleet | relay | expert | status]"
+ model: sonnet
+ effort: low
---
- # $ccc-spawn — Spawn Hub
+ # $ccc-spawn — spawn hub
- Spin work off into its **own session** on demand — the manual counterpart to the automatic isolation-spawn nudge (`suggest-ticker`). One click-first entry point that routes to the right spawn mechanism for what you're doing, and for the surface you're on.
+ **CC Commander** · $ccc-spawn · one entry point that sends a self-contained task to the right spawn mechanism for this surface.
- > **Surface-aware.** In **Claude Cowork Desktop**, spawning a one-off session is a `spawn_task` sidebar chip. In the **Claude Code CLI**, it's a `/spawn` peer via the claude-peers broker. This skill picks the right one automatically — you don't have to know which surface you're on.
+ The on-demand counterpart of the automatic isolation nudge (`suggest-ticker`). This hub offers; nothing spawns without the user's confirmation.
- ## When you'd reach for it
+ ## When to use / when not to
- - "This is a separate, self-contained thing — do it in its own session so it doesn't derail here."
- - "Fan this out across N files in parallel."
- - "Run spec → build → review as a chain of hand-off sessions."
- - "Get a fresh, independent expert pass on this."
+ - Use for "do this separately so it does not derail here", "fan this out", "chain spec → build → review", or "get an independent expert pass".
+ - Do not use for trivial work that belongs in this thread, or when two spawns would edit the same files (merge them into one task or sequence them).
+ - The automatic nudge already runs every turn; this skill is the manual version.
- ## How it routes
+ ## What happens
- On `$ccc-spawn` with no argument, open a click-first picker:
+ ### 1. Pick what to spawn
+ A sub-command skips this picker. Otherwise call AskUserQuestion (Codex: the same question in plain text), best fit first with 🟢:
+
```
- AskUserQuestion:
- question: "What do you want to spawn?"
- options:
- - Isolated session — one self-contained task, its own fresh context
- - Parallel fleet — fan out across independent files/units at once
- - Cross-session relay — chain spec → build → review as hand-off sessions
- - Expert pass — one independent reviewer (security / perf / design / …)
+ question: "What do you want to spawn?"
+ header: "Spawn"
+ multiSelect: false
+ options:
+ - label: "🟢 Isolated task"
+ description: "One self-contained task with fresh context; this thread keeps going."
+ - label: "🚀 Parallel fleet"
+ description: "Fan out across independent files or units at once (hands off to $ccc-fleet)."
+ - label: "🔄 Cross-session relay"
+ description: "Chain spec → build → review as hand-off sessions (hands off to $ccc-relay)."
+ - label: "🔬 Expert pass"
+ description: "One independent reviewer (security, performance, design, …) prompted to refute."
```
- | Choice | Surface behaviour | Under the hood |
- |--------|-------------------|----------------|
- | **Isolated session** | Cowork → emit a `spawn_task` chip `[⭐ Spawn as separate session]`; CLI → `/spawn quick <task>` | A fresh peer/session with a self-contained brief; never derails the current thread |
- | **Parallel fleet** | Route to **`$ccc-fleet`** (worktree-isolated parallel agents) | fan-out / pipeline / judge / debate modes |
- | **Cross-session relay** | Route to **`$ccc-relay`** | loop-state hand-off, spec→build→review→merge |
- | **Expert pass** | Cowork → `spawn_task` chip scoped to one reviewer persona; CLI → `/spawn expert <domain>` | a single fresh-context reviewer, prompted to refute (Pillar 2) |
+ ### 2. Choose the mechanism for the surface
- Explicit sub-commands skip the picker: `$ccc-spawn isolated <task>`, `$ccc-spawn fleet`, `$ccc-spawn relay`, `$ccc-spawn expert <domain>`, `$ccc-spawn status`.
+ | Choice | Mechanism |
+ |---|---|
+ | Isolated task, result needed in this conversation | Agent tool: `subagent_type: "fleet-worker"` (or `general-purpose`), `run_in_background: true`, `effort` sized to the brief (`low` mechanical, `medium` typical, `high` hard). Add `isolation: "worktree"` only when the task writes files while this session keeps editing; a read-only task runs without it. |
+ | Isolated task as its own session | Claude Desktop (Cowork): emit a `spawn_task` chip, `[🟢 Spawn as separate session]`. CLI with the opt-in claude-peers broker: `/spawn quick <task>`. Codex: `codex exec --json` or `codex cloud exec`. |
+ | Parallel fleet | Invoke `$ccc-fleet` with the Skill tool, passing the task. |
+ | Cross-session relay | Invoke `$ccc-relay` with the Skill tool, passing the chain. |
+ | Expert pass | Agent tool, read-only, no isolation: `subagent_type` `security-auditor`, `performance-engineer`, `designer`, `reviewer` or another matching plugin agent; `effort: "high"`; prompt it to refute, not confirm. As a separate session: Cowork `spawn_task` chip scoped to that reviewer, or CLI `/spawn expert <domain>`. |
- ## The brief a spawned session gets
+ Use the mechanism the current surface actually exposes. If none of the session mechanisms is available, fall back to the background Agent tool and say so.
- Every spawn carries a **self-contained contract** (Pillar 8), because a peer/session does NOT share your context:
+ ### 3. Write the brief
- - **Objective + acceptance criteria** — what DONE looks like, checkably.
- - **Scope + file domains** — exact paths it owns; non-overlapping with anything else in flight.
- - **Hard constraints** — worktree-isolated, relative paths only, don't touch X, don't merge without a human GO (Pillar 5).
- - **Report format** — so the result is parseable when it comes back.
+ A spawned agent or session shares none of this context, so every brief is self-contained (Fable Method pillar 8):
- `$ccc-spawn status` lists active peers/sessions (CLI: `list_peers`; Cowork: the task chips you've started) and any pending hand-offs.
+ - **Objective and acceptance criteria**: what done looks like, as a check.
+ - **Scope**: the exact paths it owns, non-overlapping with anything else in flight.
+ - **Hard constraints**: for a code-writing spawn, its own git worktree, first act `git rev-parse --show-toplevel` must equal that worktree (abort if not), relative paths only, no merge, push or deploy.
+ - **Check command**: the exact command it runs before reporting.
+ - **Report format**: files changed, check result, worktree path and branch, so the result parses when it returns.
- ## Safety (Pillar 5)
+ Show the brief and confirm with AskUserQuestion: 🟢 "Spawn it" · "Edit the brief" · "Cancel".
- - Each spawned code-writing session gets its **own git worktree**; first act is verifying `git rev-parse --show-toplevel` matches — abort if not.
- - **Merge / deploy / delete are never auto** — they require an explicit human GO, every time.
- - Nothing spawns without your confirmation — this hub **offers**; it doesn't fire on its own.
- - Cap the fan-out: don't over-parallelize (1 independent unit = 1 spawn; a small pilot before a big fan-out).
+ ### 4. Spawn and report
- ## When NOT to use
+ Spawn, then report in one line: mechanism, id or chip, worktree and branch if any, and how to check on it.
- - The work is trivial or belongs in the current thread — spawning has real overhead.
- - You just want the *automatic* nudge — that already runs every turn via `suggest-ticker` (this skill is the on-demand version).
- - Two spawns would edit the same files — merge them into one, or sequence them.
+ ### `$ccc-spawn status`
- ## Limitations
+ List what is in flight: background agents started in this session, CLI peers (`list_peers` from the claude-peers broker, when installed), Cowork task chips you started, and any pending relay hand-offs in `.claude/loop-state/`:
- - CLI `/spawn` needs the claude-peers broker; Cowork `spawn_task` needs the Desktop sidebar — the skill uses whichever the current surface provides.
- - Spawned sessions are independent: they inherit no in-flight uncommitted state, so the brief must carry everything they need.
+ ```bash
+ ls .claude/loop-state/*.json 2>/dev/null; git worktree list
+ ```
+
+ ## Arguments
+
+ `$ccc-spawn isolated <task>` · `$ccc-spawn fleet` · `$ccc-spawn relay` · `$ccc-spawn expert <domain>` · `$ccc-spawn status`.
+
+ ## Done when
+
+ - The user confirmed the brief, and the spawn returned an id, chip or agent handle that is reported back.
+ - For a code-writing spawn, its report shows `git rev-parse --show-toplevel` equal to its worktree, and `git status --porcelain | grep -v '^??'` on the main checkout prints nothing.
+ - For an expert pass, findings come back as `path:line`, severity and fix.
+
+ ## Guardrails
+
+ - Nothing spawns without explicit confirmation.
+ - Merge, deploy, push and delete are never automatic; each needs the user's go in this conversation, every time.
+ - One independent unit per spawn; run a small pilot before a large fan-out.
+ - Spawned work inherits no uncommitted state; the brief carries everything it needs.
+ - claude-peers and Cowork chips are optional surfaces; never assume either is present.
+
+ ## See also
+
+ - `$ccc-fleet` — parallel agents with synthesis.
+ - `$ccc-relay` — chained loop sessions.
+ - `$ccc-review` — an inline review pass.
+ - `$ccc-handoff` — preserve state before moving work to a new session.
---
> ⚙️ **Fable contract:** plan before build · verifier ≠ worker · prove before alarm · loops need gates · leave durable state — `rules/fable-method.md`
> (On Codex, present these options as a numbered list and ask the user to reply with a number — AskUserQuestion is Claude-only.)