Use when the user wants to dispatch the squad to actually do the work — phrases like "dispatch the squad", "spawn the team", "start the work", "kick off the squad", "run the squad", or a "ready to start" signal after squad onboarding and role generation. Branches on the squad's mode — One-time spawns subagents, Multi-use spawns Agent Teams teammates (each referenced by name; spawn.sh optionally pre-creates one git worktree per role as a working directory), Evergreen surfaces scheduling option...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Squad Spawn?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/amit1992ko-squad-spawn)
---
name: squad-spawn
description: Use when the user wants to dispatch the squad to actually do the work — phrases like "dispatch the squad", "spawn the team", "start the work", "kick off the squad", "run the squad", or a "ready to start" signal after squad onboarding and role generation. Branches on the squad's mode — One-time spawns subagents, Multi-use spawns Agent Teams teammates (each referenced by name; spawn.sh optionally pre-creates one git worktree per role as a working directory), Evergreen surfaces scheduling options for the user to choose. Bakes the full text of .squad/goal.md and each role's declared goal reference into every spawn prompt — that is the only reliable context channel from parent to worker.
license: MIT
allowed-tools:
- Read
- Agent
- 'Bash(bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-spawn/scripts/spawn.sh" *)'
- 'Bash(bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-env/scripts/provision.sh" .squad/*)'
- 'Bash(bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-world/scripts/world.sh" *)'
- 'Bash(bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-ontology/scripts/ontology.sh" *)'
---
# squad-spawn
You orchestrate dispatch. The squad has been onboarded (`.squad/goal.md` exists), roles have been generated (`.squad/roster.json` is populated, `.claude/agents/<role>.md` files exist). Your job is to launch them in the right way for the squad's mode.
**What still asks.** This skill pre-approves reading, dispatching agents, and four bundled scripts (for `provision.sh`, the dry pass only; `world.sh` and `ontology.sh` only read). Everything else shows a normal permission prompt, and that is intended: deleting stale hand-off manifests and engagement records (steps 7 and 8), the Agent Teams environment check, and any `provision.sh --install` run. Tell the human a prompt is coming before the first one, so it does not read as a fault.
## Roster shape compatibility
Whenever this skill reads `.squad/roster.json`, choose its source shape once:
`schema_version: 2` means v2; no schema version means legacy. Project roles into a
read-only lifecycle view using these equivalents:
- identifier: v2 `id` // legacy `name`
- cadence: v2 `execution_mode` // legacy `mode`
- goal references: `squad_goal_ref` in both shapes; v2 `goal_ref` // legacy `role_goal`
- ownership: v2 `file_ownership.include` and `.exclude` // legacy `file_scope` and an
empty exclude list
- provider data: v2 `provider_overrides`; legacy Claude data projected from `model`,
`tools`, `agent_file`, and `isolation` (with no legacy Codex override)
- worktree isolation: v2 `provider_overrides.claude.isolation` // legacy `isolation`
The `//` notation names source-shape equivalents; it is not permission to fall back to
legacy aliases inside a malformed v2 object. Validate the selected shape and stop on a
missing required field. This projection is read-only. Preserve a legacy roster's source
shape on ordinary lifecycle writes; migrate it to v2 only through a separate
`squad-roster` conversion plan that previews the exact writes/deletes and receives the
matching confirmation. If a requested change cannot be represented losslessly in legacy
shape, stop and offer that migration instead of dropping data.
In the pseudocode below, `role.name` means this projected identifier, never a raw
shape-specific lookup. `role.file_scope` means projected ownership includes together
with its excludes; an exclude always wins. Resolve the role-goal and Claude agent paths
from the projected references rather than inventing filename conventions.
## Preflight — refuse if not ready
1. Read `.squad/goal.md`. If absent: refuse with *"No squad goal set. Run `/squad-os:squad-onboard` first."* and stop.
2. Read `.squad/roster.json`. If absent or `roles` array is empty: refuse with *"Roster is empty. Run `/squad-os:squad-role` to generate at least one role."* and stop.
3. For each active projected role, require a declared role-goal reference and Claude `agent_file`, then verify both exact paths exist. Do not substitute `.squad/role-goal-<identifier>.md` or `.claude/agents/<identifier>.md` when a declared reference is absent. If any reference or file is missing, print the exact gaps and ask the user to re-run `squad-role` for those roles.
4. Read the exact projected role-goal reference for each active role.
5. Note the squad's mode from `goal.md` frontmatter and require it to match the projected roster cadence.
6. **Provision environments.** If any active role has an `environment` block, run `/squad-os:squad-env` (or directly `bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-env/scripts/provision.sh" .squad/roster.json .squad/goal.md`) **before** dispatching. This builds each role's sandbox and surfaces any `global_needs` for the user to approve. Do not dispatch a role whose sandbox could not be provisioned (the summary's `errors` > 0) — fix the `environment` first. Roles with no `environment` block skip this.
7. **Clear the hand-off channel (staleness).** Manifests under `.squad/role-comm-*.md` are per-engagement working state. If any exist from a prior run, delete them before dispatching — baking them would feed roles stale hand-offs (the deliverables they referenced live on in committed `file_scope` paths; only the routing note is discarded). **Exception:** keep them when this dispatch is an explicit follow-on stage consuming a previous run's hand-offs (the user says so, or the previous run's synthesis planned this stage). In Evergreen mode, every iteration is a fresh engagement — clear at the start of each.
8. **Clear engagement records — dispatched roles only.** Delete `.squad/role-plan-<role.name>.md` for each role you are about to dispatch **in this invocation**, and only those, before dispatching. This is narrower than step 7's blanket clear: a parallel dispatch — say, `squad-role` just registered one new teammate and you're dispatching only that role — must never delete a currently-running role's record just because it shares the roster. **Exception, same as step 7:** keep a role's record when this dispatch is an explicit follow-on stage for that role (the `--chain` case at the `/squad-os:squad-workflow` command, or the equivalent explicit continuation on this path) — the record still describes the still-current engagement. In Evergreen mode, clear at the start of each iteration, for the role(s) that iteration dispatches.
9. **Compute the shared world model index once (hard rule #13).** Run:
```bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-world/scripts/world.sh" --index
```
from the project root. This is the same claims-file family `spawn.sh collect` brings back from a worktree — here you're reading whatever already lives at the root. The script performs the projection itself: capped, 80-byte-truncated, recency-ordered index lines, full blocks for a handful of disputed keys, and explicit `+N more` tails — it is **script output pasted verbatim into the prompt, not something you reformat, summarize, or re-derive.** Capture stdout once, before building any per-role prompt below — the world model is squad-wide, so the same text (or its absence) goes into every role's prompt this dispatch, not a per-role slice. Cheap and safe to run even when `.squad/world/` doesn't exist yet.
**If stdout is non-empty, live beliefs exist** — bake it into every role's prompt at the position in the template below. **If stdout is empty** (no `.squad/world/` at all, or every claims file's blocks are invalid/superseded/retired with nothing currently `live`), **omit the `# Shared world model` section entirely from every role's prompt this dispatch** — never an empty heading, never "no beliefs recorded yet" filler. This is the same absence contract every other `.squad/world/`-touching surface in this plugin honors.
**Then compute the squad vocabulary index once (hard rule #17)**, the same way:
```bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-ontology/scripts/ontology.sh" --index
```
Capture stdout once and paste it verbatim into the `# Squad vocabulary` section of every role's prompt this dispatch. **Empty stdout** (no `.squad/ontology.md`, or no live valid term in it) **means no `# Squad vocabulary` section at all**, never an empty heading. Invalid term blocks never reach this output; the script drops them. Never instruct a role to read or write `.squad/ontology.md`: the human owns it, and the hook defers every role write to it.
10. **Read the partner model once (hard rule #12).** Read `.squad/partner.md` if it exists. **Absence contract, same discipline as step 9:** file absent, or present but empty, means omit the `# Partner model` section entirely from every role's prompt this dispatch — never an empty heading. If present and non-empty, capture its full text once, before building any per-role prompt below — like the world index, it describes something squad-wide (the human commanding the whole project, not this role), so the same text goes into every role's prompt this dispatch. **Baked, never re-read:** do not instruct any role to read `.squad/partner.md` itself anywhere in the prompt you build — the file is gitignored by default (`squad-partner`'s create flow proposes that as its default) and will not exist inside a worktree (hard rule #7 isolation), so hard rule #4's prompt-baking is the only reliable channel, exactly as for the goal. Never instruct a role to write to it either: `squad-partner` is its only writer anywhere in this plugin (hard rule #12), and `hooks/permission-request.sh`'s `.squad/` reservation already defers every role's write to it structurally — confirmed by running the hook, not by reading it and assuming.
11. **Dispatch triage (§3.4 — "who starts?").** For each role you are about to dispatch this invocation, read its `## Stop conditions` from `.squad/role-goal-<role.name>.md` (hard rule #14) and filter to the `needs:`-prefixed bullets only — `stop:` bullets are mid-run bounds the role self-polices, not something a preflight check can evaluate before the role has started. Probe each `needs:` bullet that's actually checkable from here: a file/path existing on disk, a declared tool being present in the role's `tools` list, or one cheap read-only MCP call if the bullet names one explicitly and a matching tool is available. A bullet phrased as a judgment call isn't checkable — skip it silently, it neither passes nor fails triage. **One class of non-checkable bullet is the exception and is never skipped silently: a `needs:` bullet that names an open question research came back `unanswered` on** (hard rule #13's research verb writes them in exactly that shape — see `squad-role`'s stop-condition derivation). Nothing on disk can settle an open question, so probing it is meaningless — but it is precisely a knowable-in-advance blocker, and swallowing it would leave the human's own unanswered question visible only inside a prompt the human never reads. Print one line per role:
- `starts: machine — <role.name>` — every checkable `needs:` bullet passed (or none were checkable).
- `starts: YOU — <role.name>: <failing precondition, verbatim from the bullet>` — at least one checkable bullet failed.
- `starts: YOU — <role.name>: <the open question, verbatim from the bullet> (unanswered by research)` — the role carries an unanswered-question bullet. Not a failure and not a probe result: a question only the human can close.
This **informs, it never gates** — dispatch every role the user asked for regardless of what triage printed. Its only job is to surface a knowable-in-advance blocker before the run starts instead of thirty seconds in.
## Build the spawn prompt (per role)
Every spawn — subagent, teammate, scheduled — follows the same canonical prompt order, regardless of mode: **goal → partner model → role-goal → onboarded skills → vocabulary → world index → hand-offs → file scope → Step 0 → stop-condition contract → task.** Partner model sits right after the goal, not buried after role-specific material, for the same reason session-start.sh appends it right after the goal too: standing constraints bind like the goal (hard rule #12), and a role should see the human's own brief before it sees its own slice of the work.
```
You are the <role.name> role on a Squad OS squad.
# Squad goal (binding north-star)
<full contents of .squad/goal.md>
# Partner model (hard rule #12) — only if .squad/partner.md exists and is non-empty (step 10)
<the full contents of .squad/partner.md, pasted VERBATIM — do not reformat,
summarize, or truncate it; it is short by design>
Binding on this run, on top of what the file itself says:
- **Decide vs. ask is a surfacing rule, not a settling rule.** An item
listed under "Always ask first" above is never yours to decide, no
matter how obvious the right call looks or how short you are on time.
Do not silently pick the safer option and move on. Instead, end your
final response to the orchestrator (the summary you return when your
task is done) with one line per item you hit:
`[surfaced-ask-first] <the decision, one line> — <why it's ask-first>`.
An item under "Decide without me" is yours to settle and needs no line
here — only ask-first items get one. If the file's "Attention" lines
give a deadline tie-break and it actually applies this run, follow it
and say so in the same line rather than silently improvising one.
- **Surfacing versus stopping — which one an ask-first item triggers.**
Check your own "Your stop conditions" block below. If the item you hit
is named there as a `stop:` bound, it is a stop: end the run, write
`status: escalated` and `fired: <that bullet, verbatim>` on your
engagement record (hard rule #14), *and* emit the
`[surfaced-ask-first]` line — the two are one event reported on two
channels, not a choice between them. If the item is **not** among your
declared bounds (your role carries at most four, so most ask-first
items will not be), do not escalate and do not stop: leave that one
decision unmade, carry on with everything that does not depend on it,
say in your summary what you could not finish because of it, and emit
the line. Either way the decision reaches the human unmade — what
differs is only whether the rest of your work stops with it.
- **Standing constraints bind this run exactly the way `.squad/goal.md`
does** — treat every constraint listed above as a hard boundary on your
own work this run, not a preference to weigh against convenience.
- **A belief to check is verified, not inherited.** If your task actually
touches one of the hypotheses under "Beliefs to check" above, test it
rather than assume it's still true, and report what you found: end your
final response with `[belief-check: <the belief, one line>] confirmed |
contradicted | could not test — <the evidence, one line>`. A belief you
never touched needs no line; one you did needs exactly one, and the
three outcomes above are the only three words that belong after the
bracket.
- This section is baked into your prompt once, at dispatch — it is not
re-read, and you will not find `.squad/partner.md` on disk if you are
running in a worktree (it is gitignored by default). Never attempt to
read or write it yourself: `squad-partner` is its only writer anywhere
in this plugin, and every role's write to it — including a role named
`partner` — defers to the human structurally, regardless of what your
file_scope says.
# Your role's goal
<full contents of .squad/role-goal-<role.name>.md>
# Your onboarded skills — only if this role's roster entry has a non-empty onboarded_skills
<one line per skill: name — (knowledge|execution) — ABSOLUTE path to its SKILL.md — purpose>
Read each of these before starting; they are part of your role.
Before executing, one step-further check: ask yourself — "could one more research
step find a better way than my onboarded method?" If yes, and the step is cheap (one
search, one doc lookup, one MCP introspection call — never a second research pass),
take it. Record the answer either way in your engagement record's `## Assumptions`
(hard rule #11): `[confirmed]` if you checked and your onboarded method still holds,
or `[inferred]`/`[assumed]` with `if wrong → <what breaks>` if you took the step and
found something better, or didn't check. Never spiral — one step, bounded, then
proceed with whichever method you're using.
# Squad vocabulary (hard rule #17) — only if `ontology.sh --index` produced output this dispatch (step 9)
<the script's stdout, pasted VERBATIM>
Binding on this run:
- Use these words with these meanings, in your work and in your hand-offs.
- Do not use the avoided words listed in brackets; write the term instead.
- If a term you need is missing or a definition looks wrong, report it in
the `## Caveats` section of your hand-off manifest and in your final
report, instead of redefining it. The human owns the vocabulary and decides.
# Shared world model — only if `world.sh --index` produced output this dispatch (step 9)
<the script's stdout, pasted VERBATIM — do not reformat, summarize, or truncate
it further; it already did that itself>
Standing instructions for using it:
- Reuse an existing key rather than minting a near-duplicate — check the
index above before writing a new `## Belief:` heading to your own claims
file.
- Never edit another owner's claims file. `.squad/world/claims-<owner>.md`
is yours to write only when `<owner>` is your own role name — the
`PermissionRequest` hook enforces this structurally regardless of what
this prompt says, so there is nothing to gain by trying.
- Contest a belief by writing your own counter-block under the same key, in
your own claims file — never by editing the block you disagree with. Two
`live` blocks under one key from different owners *are* the dispute;
nobody writes the word "disputed", including you.
- A key the index shows as DISPUTED may not be silently picked. If your
work depends on one, say in your engagement record's `## Assumptions`
which side you used and why.
- This file is never cleared between dispatches — unlike your engagement
record and the hand-off channel below, what's written here accumulates
for the life of the squad. Nothing you read above went stale just because
a new dispatch started.
# Incoming hand-offs — only if any .squad/role-comm-*--<role.name>.md (or --any.md) with status: ready exist
<full contents of each ready manifest addressed to this role>
# Your role's file ownership
Includes:
<one projected file_ownership.include or legacy file_scope entry per bullet>
Excludes (these win over every include):
<one projected file_ownership.exclude entry per bullet, or "- (none)">
# Your workspace (sandbox) — only if the role has an environment block
Your sandbox is <role.environment.workspace>. Work inside it freely. Before
running tooling, load your environment: `set -a; . <workspace>/env; set +a; <cmd>`.
Seeded reference material is under the sandbox.
# Step 0 — publish your engagement record (hard rule #11)
Before your first write to anything else, write your engagement record to
`.squad/role-plan-<role.name>.md`, with exactly this shape:
frontmatter `role: <role.name>`, `created: <ISO-8601>`, `status: active`;
body sections in order — `## Task read`, `## Intended approach`,
`## Deliverables` (one backtick-quoted path per bullet), `## Assumptions` (each
bullet starts with its grade tag, as in `- [assumed] …`), `## Amendments`.
`status` is `active`, `amended` (append a timestamped note under
`## Amendments`; never rewrite the sections above it), or `escalated`
(below) — no other value. Grade every assumption
with exactly one of `[confirmed]`, `[reported]`, `[inferred]`, `[assumed]` —
never a number — and for every `[assumed]` bullet, name what breaks:
`if wrong → <deliverable or DoD signal>`. This path is granted
unconditionally, before anything else — it is the bootstrap, not a
generation choice you can skip your way around. Every other in-scope
Edit/Write, and your hand-off outbox (`.squad/role-comm-<role.name>--*`),
DEFER until this file exists: the `PermissionRequest` hook checks for it
before granting either surface, and it does not deny — it just waits, and
so does your own progress. Write it first.
# Your stop conditions (hard rules #14–#15)
Your role goal declares this role's `## Stop conditions` — 2-4 bullets,
each prefixed `needs:` (a precondition, checked before you start) or
`stop:` (a mid-run bound you self-police; nothing external monitors it). If
a `stop:` bound becomes true at any point during this run, do not guess
forward and do not ask a question — a One-time subagent has no mid-run
channel back to a human; your engagement record is the only hand-back
there is. Instead:
1. Update your own engagement record (`.squad/role-plan-<role.name>.md`) in
place: set frontmatter `status: escalated` and `fired: <the bullet that
fired, verbatim from ## Stop conditions>`.
2. Fill three sections at the end of the record's body: `## What
happened` (which condition fired, on what evidence, at which numbered
step of your `## Intended
approach` you were on — "it seemed stuck" is not evidence, "step 3,
`POST /flows/{id}/actions`, returned 403 on the second attempt" is),
`## State of the work` (one line per path in `## Deliverables`: complete
/ partial: `<the gap, named plainly>` / untouched), and `## What would
unblock` (the smallest grant, file, or ruling that would let you
resume — not "someone should look at this").
3. Stop. Leave in place whatever deliverables you already finished before
the stop condition fired — only the blocked one is left undone. Do not
poll for a ruling, do not retry, do not add a fourth section.
Never write `resolved`, `resolution:`, or anything that closes your own
escalation, anywhere, on this or any file — that ruling belongs to the
human alone, recorded later in `.squad/verification.md` by
`/squad-os:squad-verify`, never by you (hard rule #10). A role that
could clear its own escalation could mint the verdict.
**[Multi-use teammate]** Also message the team lead directly (Agent Teams
mailbox) that you've escalated and where the record is — the message is
faster visibility, the record is still the authority.
**[Workflow subagent]** Return `status: "blocked"` from this step alongside
writing the same record. `verify.sh` never trusts a workflow step's return
value on its own — it reads only `.squad/role-plan-<role.name>.md`, so the
record is not optional even though you also returned a status.
# Your task on this invocation
<task description — see below per mode>
Read .squad/goal.md and .squad/role-goal-<role.name>.md at any time during your work. Stay inside your file scope. Hand off deliverables by writing to your scope. When a deliverable is ready for another role, publish a hand-off manifest at .squad/role-comm-<role.name>--<consumer>.md: frontmatter `from: <role.name>`, `to: <consumer>`, `created: <ISO-8601>`, `status: ready`; then `## What's ready` (one artifact path per bullet, with a one-line description), `## How to consume` (read order, entry point, format notes), and `## Caveats` (known gaps; leave it empty only if the consumer may rely on everything). Overwrite your own earlier manifest to the same consumer; if the consumer may already have read it, set `status: superseded` on it instead of deleting it.
```
Include the workspace block only for roles that have an `environment`; omit it otherwise. Include the Step 0 block and the "Your stop conditions" block always — both are baked unconditionally, in every mode, with no opt-out. A role with an empty `## Stop conditions` section (shouldn't happen post-`squad-role`, but don't assume) still gets the contract block — it just has nothing to fire on. The "Onboarded skills" block is conditional too, but unlike the two below, its yes/no is decided per-role, not once for the whole dispatch — read straight from that role's own roster entry (`onboarded_skills`) when building its prompt, and never bake an empty heading. Resolve every `local_path` in it to an absolute path before baking it in: a worktree checkout won't have `.squad/skills/**` if it isn't tracked in git, so the relative form can silently point at nothing. The "Squad vocabulary" block, the "Shared world model" block and the "Partner model" block are the three sections in this template that are decided *once, for the whole dispatch*, per steps 9 and 10 above — every role in a given dispatch gets the same yes/no on each, since all three reflect state that's squad-wide (or project-wide, for the partner model and the vocabulary) rather than anything role-specific. Never bake an empty "Partner model" heading — absent or empty `.squad/partner.md` means the section is left out entirely, not printed with nothing under it.
**Hard rule #4:** the full text of `.squad/goal.md` and the role's projected goal reference is the only reliable channel from parent to subagent. The SessionStart hook does not fire for subagents. Bake both texts in; don't rely on hook injection for the One-time path. `.squad/partner.md` rides the same channel for the same reason (hard rule #12): it is gitignored by default, so it is typically absent inside an `isolation: worktree` checkout even where SessionStart *does* fire — baking is the only path that works everywhere, every mode, every isolation setting.
## Branch on mode
### Mode: One-time
For each role in `.squad/roster.json` (filter `active: true`):
1. Build the spawn prompt using the template above. For "your task on this invocation", derive from the role's purpose plus the squad's definition of done — what does this role contribute *this run*?
2. Invoke the `Agent` tool. Pass:
- `description`: the role's purpose (3–5 words)
- `subagent_type`: the projected identifier (the declared Claude `agent_file` must describe this same role)
- `prompt`: the composed spawn prompt
3. If projected Claude isolation is `worktree`, verify the declared agent artifact carries that frontmatter; the subagent then runs in a worktree (per sub-agents doc — no extra flag needed from you).
4. Subagents can run in parallel if their workstreams are independent. Send multiple `Agent` tool calls in one message to dispatch in parallel. Otherwise dispatch sequentially.
5. **Sequential chains ride the hand-off channel.** Before dispatching a downstream role, glob `.squad/role-comm-*--<role.name>.md` (plus `--any.md` broadcasts); bake the full text of every `status: ready` manifest into its spawn prompt under "Incoming hand-offs". Subagents can't receive messages mid-run — the manifest travels the same prompt-baking channel as the goal (hard rule #4). If an expected upstream manifest is missing, say so in the prompt rather than silently omitting it; the consumer role must know it's working without the hand-off.
6. Wait for each subagent's deliverable summary. Synthesize results into a user-facing report.
**This direct-`Agent` path is the default** and is the right choice for small squads (≤3 roles).
#### Optional: dispatch as a dynamic Workflow (larger / cross-checked squads)
For a **larger One-time squad** (4+ active roles), or when you want deterministic fan-out, structured per-role hand-offs, and in-session resume, the dispatch can run as a dynamic **Workflow** instead of hand-issued `Agent` calls.
You (a skill) **cannot launch a workflow yourself** — the only triggers are the literal keyword `workflow` in a user prompt, `/effort ultracode`, a bundled command, or a saved `/<name>` command, and every run needs the user's approval. So do **not** try to invoke it. Instead, point the user at the dedicated command:
> *"This squad has N roles — it's a good fit for the Workflow dispatch path: deterministic fan-out, structured hand-offs, resumable in-session. Run `/squad-os:squad-workflow` to dispatch it that way (you'll be asked to approve the workflow run). Note: workflow subagents run with file edits auto-approved, so a role's writes are not gated by its file_scope on that path — it fans out read/analyze roles with self-policed scoped writes; keep code-mutating roles on this direct path. A role that hits a stop condition on this path returns `status: "blocked"` from its step AND still writes its engagement record with `status: escalated` — `verify.sh` trusts only the record, never the step's return value alone."*
Then stop, or proceed with the direct-`Agent` path if the user prefers it. See the ["Dynamic Workflows"](../../docs/ARCHITECTURE.md) section of `docs/ARCHITECTURE.md` for where this fits and the canonical script shape in `${CLAUDE_PLUGIN_ROOT}/templates/squad-dispatch.workflow.js`.
#### Optional: dispatch through Orca (one worker and worktree per role)
Check `command -v orca` (or `$ORCA_CLI_COMMAND`). Only when it resolves, offer this path once: each active role runs as an Orca worker in its own Git worktree, Claude Code or Codex, started in hand-off order. It needs `.squad/manifest.json` (written by the `squad-roster` export flow), which selects the agent CLI. You do **not** start any worker. Offer the plan instead:
```sh
PYTHONPATH="${CLAUDE_PLUGIN_ROOT}/src" python3 -m squad_portability.cli orca-dispatch \
--manifest .squad/manifest.json --roster .squad/roster.json --target "$PWD" \
--plan-file /tmp/squad-orca-plan.json
```
Show the preview, and only after the user confirms its `plan_id`, re-run with `--confirm-plan-id <plan_id>`. That writes `.squad/dispatch/orca/` (a `DISPATCH.md` with the exact `orca` commands, one self-contained spec per role built from the template above, and `dispatch.json`), and nothing else. The user, or an agent following Orca's orchestration skill, runs the commands. Tell the user plainly what this path loses: the PermissionRequest hook does not recognize an Orca worker as a role, so file ownership and the Step 0 gate are instructional there, and a worktree separates working copies without restricting writes. Full walkthrough: [`docs/orca.md`](../../docs/orca.md).
### Mode: Multi-use
1. **Check Agent Teams.** Read `$CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` from environment (use Bash: `echo "$CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS"`).
2. **If set to `1`:**
- **(Optional) pre-create worktrees.** Run `bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-spawn/scripts/spawn.sh" .squad/roster.json .squad/goal.md`. This *only* pre-creates one git worktree per active role under `.claude/worktrees/<role>/` (branch `squad-<role>`) and emits one JSON line per worktree. A line with `"branch_state": "kept"` means `squad-<role>` already held commits the current HEAD does not have and was attached as it stood, not reset — tell the human, because that role resumes earlier work instead of starting from HEAD. `"advanced"` means the branch already existed with nothing unmerged and was moved to HEAD; `"new"` means it was created. It launches **no** Claude session and bakes **no** prompt — it is a working-directory convenience, not the teammate launcher.
- **Spawn the teammates.** As the team lead, create the Agent Team and spawn one teammate per active role, referencing each role's definition at `.claude/agents/<role>.md` **by name** (the documented Agent Teams mechanism — teammates are spawned by the lead in natural language, not by a CLI flag). Pass each teammate the spawn prompt built from the template above as its initial instructions. There is no `--worktree <role>` teammate-launch flag; do not assert one.
- **File isolation** between teammates is enforced by **disjoint `file_scope`** per role (agent-teams doc: "two teammates editing the same file leads to overwrites — break the work so each teammate owns a different set of files"). The roster's per-role `file_scope` is that vehicle. If you want a teammate to work inside its pre-created worktree, point it there explicitly using the path from `spawn.sh`'s JSON; nothing wires that automatically.
- Per agent-teams doc: when a subagent definition is used as a teammate, `skills` and `mcpServers` frontmatter do **not** propagate; `tools` and `model` do; the body is appended to the teammate's system prompt as additional instructions rather than replacing it. A role's own `hooks:` frontmatter would not fire for a teammate either — enforcement on this path comes from the plugin's project-level hooks, which *do* fire because a teammate is a full session. A teammate also inherits the lead's `effort` level, not the role file's `effort:` and not the lead's `/model` selection.
- **Hand-offs:** teammates message each other live (Agent Teams mailbox), but the durable record of WHAT was handed off is still the manifest channel — each teammate publishes `.squad/role-comm-<name>--<consumer>.md` when a deliverable is ready and reads its own inbox (`.squad/role-comm-*--<name>.md`) on start. A message says "look"; the manifest says exactly what's ready, how to consume it, and what to distrust.
- Print the teammate names back to the user. They can address any teammate by name in subsequent turns.
3. **If unset, `0`, or anything else:**
- Print a one-paragraph explanation of what Agent Teams adds: shared task list, mailbox, direct teammate-to-teammate messaging, true parallel execution.
- Offer to write `{"env": {"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"}}` to `~/.claude/settings.json`. **Ask consent in the same turn.** Never write the setting silently. Format the proposed change so the user sees the exact JSON before accepting.
- If user accepts: write the setting (merge with existing JSON, don't clobber). Tell them to restart Claude Code. Stop — they'll resume `squad-spawn` after restart.
- If user declines: fall back to **One-time mode dispatch** (sequential subagents). Print a warning: *"Falling back to subagents — mailbox, shared task list, and direct teammate-to-teammate messaging are unavailable. File isolation now comes from each subagent honoring its `file_scope`, plus per-subagent worktrees where a role sets `isolation: worktree` in its frontmatter."* This fallback path uses the same spawn-prompt template as One-time mode — Step 0 is still baked in, unconditionally; nothing about the fallback exempts a role from publishing its engagement record first.
### Mode: Evergreen
The plugin cannot create durable scheduled work on the user's behalf. Surface three options and print exact instructions for each. Ask the user to pick one before proceeding.
**Option A — `/loop` (in-session, 7-day max):**
The recurring task lives in the current session, fires at the chosen interval, and auto-expires 7 days after creation (per scheduled-tasks doc). Requires the session to be open.
Print this for the user to copy:
```
/loop <interval> <prompt>
```
Where `<interval>` is e.g. `1w` for weekly, `1d` for daily, `1h` for hourly. The `<prompt>` is the dispatch directive for the squad — something like `dispatch the Squad OS squad against the current goal`.
**Option B — Cloud Routine (durable, Anthropic-managed):**
The user creates this themselves via the Claude Code routines surface. The plugin does not call any scheduling tool on their behalf. Print:
```
To set up a cloud routine for this squad:
1. Note your squad goal location: <absolute path to .squad/goal.md>
2. Open your Claude Code routines surface (CLI or dashboard, depending on your version)
3. Create a routine with:
- Schedule: <user's chosen cron expression>
- Prompt: "dispatch the Squad OS squad against .squad/goal.md"
- Repository: this project's git remote (so the routine clones and reads .squad/)
```
**Option C — Desktop scheduled task (durable, local):**
```
To set up a desktop scheduled task:
1. Open the Claude Code desktop app
2. Create a new scheduled task with:
- Schedule: <user's chosen cron expression>
- Working directory: <absolute path to this project>
- Initial prompt: "dispatch the Squad OS squad against the current goal"
```
After the user picks an option, confirm: *"Squad is set up for Evergreen mode via [option]. The next run will invoke the squad against the current `.squad/goal.md`."*
## Per-spawn synthesis
For One-time and Multi-use modes, after the squad finishes (or per-iteration in Evergreen):
1. **Collect worktree-isolated records first.** Run `bash "${CLAUDE_PLUGIN_ROOT}/skills/squad-spawn/scripts/spawn.sh" collect .squad/roster.json`. A role dispatched under `isolation: worktree` (hard rule #7) wrote its engagement record — and, if it asserted anything, its belief-ledger claims file (hard rule #13) — inside its worktree, invisible at the project root until this copies both in. Cheap and always safe to run even when no role used worktree isolation (it reports `skipped-no-worktree` per artifact and moves on); skipping this step means step 3 below silently sees "no record" for a worktree role that actually declared one, and means the world model a next dispatch's step 9 reads is missing whatever that role asserted.
2. Read each role's outputs from projected ownership includes, excluding every path matched by projected ownership excludes.
3. **Declared-vs-produced diff.** For each dispatched role, read its engagement record at `.squad/role-plan-<role.name>.md`, if it published one. Diff the record's `## Deliverables` list against what actually landed inside projected ownership: name every path the role declared but never produced, every in-scope path it produced but never declared, and any produced path matched by an exclusion. A role with no record has nothing to diff against — say so plainly in that role's row rather than skipping it silently.
4. **Quote every `[assumed]` bullet, verbatim.** Pull every `## Assumptions` bullet graded `[assumed]` out of each record into the summary, unedited — the claim and its `if wrong → …` clause together. These are the guesses the human should see even when nothing failed; do not paraphrase, summarize, or drop the `if wrong →` clause.
5. **Collect ask-first surfaces and belief-check reports (hard rule #12).** Only relevant when step 10's preflight found a non-empty `.squad/partner.md`. From each dispatched role's own final response — the text it returned to you (a One-time subagent's returned deliverable summary; a Multi-use teammate's own messages to you as team lead) — pull every `[surfaced-ask-first]`-tagged line and every `[belief-check: ...]`-tagged line, verbatim. Both live only in that conversational text — there is no `.squad/` file backing either one (a role's write to `.squad/partner.md` is structurally refused, hard rule #12), so this is the only place they exist, and only this run's own synthesis can capture them; nothing reads them back afterward. Keep both lists — one feeds the summary below, the other feeds the receipt.
6. Compose a user-facing summary: what each role produced, where the artifacts live, what's next. **Every `[belief-check: ...]` line collected in the step above goes here too, plainly, undigested** — it is the direct answer to a `## Beliefs to check` entry in `.squad/partner.md`, and the human should see the role's own verdict (confirmed / contradicted / could not test) in its own words, not your paraphrase of it.
7. Surface any role that failed or returned an error.
8. Suggest follow-up actions (replace a role, change a scope, replace the goal).
9. **Suggest `squad-partner update`, never write it (hard rule #12).** If anything from this run's own turns — a hand-off note, an escalation ruling, a direct correction the human gave mid-run — visibly contradicted something written in `.squad/partner.md` (a standing constraint that no longer held, a decide-vs-ask item where the human just decided the opposite of what the file says, or a `[belief-check: ...]` report that came back `contradicted`), say so plainly and suggest: *"This looks like it contradicts `.squad/partner.md`'s [section] — want me to run `squad-partner update`?"* **A suggestion only, in this same synthesis message.** Never write `.squad/partner.md` yourself, under any phrasing of consent — `squad-partner` is its only writer anywhere in this plugin (hard rule #12), and this skill writing it on the human's behalf, even with good intentions, would be exactly the inference that rule exists to forbid. Say nothing when nothing this run contradicted anything on file.
10. Hand off to `/squad-os:squad-verify` to check the goal's Definition of done and write `.squad/verification.md`. Synthesis summarizes; verification decides — never declare the goal met from the summary alone.
11. **The partnership receipt.** After the summary, compose at most one closing paragraph, built **only** from artifacts that already exist by this point in synthesis — never re-derived, never estimated:
- **N `[assumed]` bullets quoted** — the count from step 4 above (every `[assumed]` bullet pulled into this summary this run).
- **K blocking a PASS** — of those, how many `squad-verify`'s forcing rule actually capped a signal on. Read this back from `.squad/verification.md`'s "Assumptions surfaced to the human" section *if* step 10 already ran this synthesis; if verification hasn't run yet, drop this clause rather than guess it.
- **N escalations** — count of roles dispatched this run whose engagement record now shows `status: escalated`.
- **N ask-first decisions surfaced instead of auto-decided** — the count of `[surfaced-ask-first]` lines collected in step 5 above, across every role dispatched this run. This completes the partner-model tally an earlier draft of this receipt left as a placeholder; it exists now. When `.squad/partner.md` is absent or empty, or no dispatched role's task ever touched a "Decide vs. ask" item, the honest count is 0 — same treatment as the other three counts, folded into the same "at least one non-zero" check below rather than a ritual line of its own.
Format: `This run: N [assumed] bullets quoted, K blocking a PASS · N escalations · N ask-first decisions surfaced instead of auto-decided.`
Emit it only when **at least one of the four counted lines** is non-zero — a fully quiet run (nothing assumed, nothing capped, nothing escalated, nothing surfaced) gets no receipt at all. A line that prints "0 and 0 and 0 and 0" every time is the exact ritual hard rule #15 warns against; earn the sentence or skip it.
**The world model (hard rule #13) gets no counter here on purpose.** It exists as of this release, but its count belongs to `squad-verify` — `verify.sh` computes `world_conflicts` itself and the verdict report routes on it. Printing a second, independently-derived dispute count in the dispatch receipt would give the human two numbers for one fact, and the receipt's would be the staler of the two (it is read at synthesis time, before verification runs). Say nothing about beliefs here; `/squad-os:squad-verify` and `/squad-os:squad-world` both report them properly.
## Refusals
- No goal → refuse, point at `squad-onboard`.
- Empty roster → refuse, point at `squad-role`.
- Missing role files → refuse, list the gaps.
- Multi-use mode with Agent Teams env unset and user declines to enable → fall back to subagents (do not refuse).
- Evergreen mode without the user picking a scheduling option → wait; do not silently default.