Swarm Orchestration Skill
Turn the current session into a coordinator that extracts repo rules up front, splits a broad task into independent slices, delegates them to parallel workers, integrates their results, and runs an adversarial independent verifier before reporting done.
When to Use (and Skip)
- Use when work splits cleanly into 2–6 independent slices: separate packages/modules, multi-file migrations, parallel read-only codebase audits, or concurrent implementation + test + documentation tracks.
- Skip for single-file edits, tightly coupled refactors where every step depends on the previous one, or trivial 1–2 step tasks — handle those directly instead of burning extra quota.
Pre-Flight: Repo Charter & Context Extraction
Fresh-context workers and subagents do not inherit your earlier conversation. Before spawning anyone:
- Read project instruction and charter files if present:
AGENTS.md,CLAUDE.md,.kiro/steering/*,README.md, and relevant build manifests (package.json,Cargo.toml,pyproject.toml, etc.). - Extract:
- Exact build, typecheck, lint, and targeted test commands
- Forbidden commands (e.g., heavy full test suites, restarting running daemons)
- Shared conventions and coordinator-only files
- Record all of these in the shared board (
/tmp/kiro-swarm-<slug>.md) and embed the relevant subset in every worker brief.
Swarm Modes
Pick the mode that matches the user's goal:
1. Read-Only Audit Swarm (/swarm audit ...)
- Fan out 2–5 parallel
swarm-researchertracks by domain (e.g., architecture/data-flow, bugs/edge cases, security, test coverage gaps, performance). - Zero file edits and no worktrees needed (all tracks run in the current workspace).
- Synthesize findings into one executive report backed by exact
file:linecitations, and manually spot-check top findings before reporting.
2. Build / Migration Swarm (/swarm build ... / /swarm migrate ...)
- Fan out 2–5 parallel
swarm-workerslices (do not exceed 6 unless the user explicitly asks). - Isolate concurrent authors in separate git worktrees (or strictly disjoint paths when builds cannot conflict).
- Merge worker branches into the target branch in dependency order, then run
swarm-verifierbefore declaring done.
Roles & Model Tiering
- Coordinator (you): Breaks the goal into disjoint slices, defines shared interfaces/contracts up front, maintains the shared board, relays decisions, integrates branches, and drives verification. Avoid doing heavy parallel coding while workers are active.
- Workers (
swarm-worker/swarm-researcher): Own bounded files, directories, or research tracks. Two authoring workers must never own overlapping files in the same working tree. - Verifier (
swarm-verifier): Fresh-context, read-only auditor invoked after all worker changes are integrated.
Role-Based Model Tiering (Vendor-Agnostic)
- Coordinator & Verifier: Prefer a stronger reasoning model for planning, slicing, contract judgment, and adversarial diff review.
- Workers & Researchers: Prefer a faster, cost-efficient coding model for parallel bulk execution and exploration.
- In Paseo, inspect
list_profilesand pick a strong profile for coordinator/verifier and a fast/worker profile for parallel slices. In standalonekiro-cli, pass--coordinator-model,--worker-model,--researcher-model, or--verifier-modeltoinstall.sh(or leave unset to inherit the active session model).
Custom Agents
Companion global agents are installed under ~/.kiro/agents/:
swarm-coordinator— orchestrator profile (tools: ["*"]); select directly via/agent swarm-coordinatororkiro-cli --agent swarm-coordinatorswarm-researcher— strictly read-only exploration and audit (read,grep,glob,web_search,web_fetch)swarm-worker— scoped implementation worker (read,write,shell,grep,glob,web_search,web_fetch)swarm-verifier— read-only diff auditor and test runner (read,shell,grep,glob)
Shared Swarm Board
To give all workers shared visibility without polluting the git repository, create a temporary board file at /tmp/kiro-swarm-<slug>.md before spawning workers:
- Record: Goal, Base Branch / Commit, Repo Charter (verification + forbidden commands + conventions), Shared Contracts & Interfaces, Roster (worker → owned paths / branch / status), and Open Decisions.
- Tell every worker the board path so they can read shared decisions.
- As coordinator, keep the board updated as workers complete or when an interface changes.
Backend Selection
Check which orchestration tools exist in your current session and pick the matching mode:
Mode A: Paseo MCP Backend (Preferred when running inside Paseo)
Use this mode when Paseo MCP tools (create_agent, create_workspace, send_agent_prompt, list_profiles, list_providers) are available.
- Discover providers/profiles:
- Call
list_profiles(andlist_providersif needed). - Pick the profiles/providers the user requested, or apply role-based tiering (stronger profile for verifier, fast/worker profile for parallel workers/researchers). Default to
kirowhen no override is requested.
- Call
- Isolate workspaces:
- Read-only workers (researchers, auditors, reviewers): omit
workspaceIdso they share your current workspace. - Authoring workers (editing/building code in parallel): call
create_workspacewith:isolation: "worktree"mode: "branch-off"branchName:swarm/<slug>/<worker-name>baseBranch: the current branch (or explicit base ref)
- Pass the returned
workspaceIdtocreate_agent.
- Read-only workers (researchers, auditors, reviewers): omit
- Spawn workers in parallel:
- Call
create_agentonce per slice in parallel:title:[Swarm] <worker-name>provider: chosenprovider/model(from profile or provider catalog)workspaceId: isolated worktree ID for authors, omitted for readersnotifyOnFinish: true(default)initialPrompt: include the target role expectations (swarm-researcherorswarm-worker) and use the Worker Brief Template below (or select the matching Kiro custom agent/mode viasettings.modeIdwhen exposed by the provider).
- Call
- Wait reactively — never poll:
- Finish your turn and wait for Paseo's automatic finish notifications (which fire on completion, error, or permission request).
- If a worker needs steering, clarification, or a cross-worker contract update, use
send_agent_prompt(activeTurnBehavior: "queue"by default; use"steer"or"interrupt"only if it cannot wait). - If two workers need to coordinate directly, relay the decision yourself (preferred) or share the peer's
agentIdso they can message viasend_agent_prompt.
- Land, adversarially verify (max 2 retry rounds), and clean up:
- Inspect each authoring worker's branch/commits.
- Merge or cherry-pick each worker branch into your working branch in dependency order, resolving any integration conflicts.
- Spawn
[Swarm] verifierin your workspace (usingswarm-verifierexpectations and a strong reasoning profile if available). Instruct it to never trust worker-claimed results, independently re-run typecheck/lint/targeted tests, and evaluate every requirement item-by-item (PASS/FAIL+ overallVERDICT: PASSorVERDICT: FAIL). - Bounded retry loop (max 2 rounds): If the verifier returns
VERDICT: FAIL, send targeted fix prompts to the owning worker (or fix small integration glue directly), re-merge, and re-run the verifier. If it still fails after 2 fix-and-reverify rounds, stop and escalate to the user with the verifier's exact diagnostics. - Only after
VERDICT: PASS, archive worker agents (archive_agent) and archive temporary worktrees (archive_workspace). Delete/tmp/kiro-swarm-<slug>.mdwhen finished.
Mode B: Standalone kiro-cli Backend (Fallback)
Use this mode when Paseo MCP tools are not present and you are running standalone kiro-cli.
- Choose isolation level:
- Read-only tracks or strictly disjoint files without conflicting builds: Spawn parallel subagents in the current repo, enforcing non-overlapping file lists in each brief.
- Concurrent code edits that run builds/tests: Create one git worktree per authoring worker before spawning:
Instruct each subagent to work strictly insidegit worktree add -b swarm/<slug>/<worker-name> /tmp/kiro-swarm-<slug>/<worker-name> HEAD/tmp/kiro-swarm-<slug>/<worker-name>and commit its changes on its branch when done.
- Spawn workers in parallel:
- Invoke subagent delegation in parallel with the Worker Brief Template below, targeting
swarm-researcherfor read-only exploration/audits andswarm-workerfor implementation (falling back to built-incontext-gatherer/general-task-executiononly if custom agents are unavailable).
- Invoke subagent delegation in parallel with the Worker Brief Template below, targeting
- Integrate, adversarially verify (max 2 retry rounds), and clean up:
- Merge worker branches into your current branch (
git merge --no-ff swarm/<slug>/<worker-name>or cherry-pick), resolving conflicts cleanly. - Spawn a fresh
swarm-verifiersubagent (falling back tovalidationonly if unavailable) to audit every requirement against the integrated diff and independently re-run typecheck, lint, and targeted tests. - Bounded retry loop (max 2 rounds): If the verifier returns
VERDICT: FAIL, dispatch targeted fixes and re-verify up to 2 rounds; escalate to the user with exact diagnostics if it still fails. - Only after
VERDICT: PASS, clean up temporary worktrees and branches:
and removegit worktree remove /tmp/kiro-swarm-<slug>/<worker-name> git branch -d swarm/<slug>/<worker-name>/tmp/kiro-swarm-<slug>.md.
- Merge worker branches into your current branch (
Worker Brief Template
Include every section below in each worker's prompt so it starts with zero ambiguity:
## Swarm Assignment: <worker-name>
- **Overall Goal:** <1–2 sentence objective>
- **Swarm Board:** `/tmp/kiro-swarm-<slug>.md` (read before starting for shared contracts)
- **Working Directory / Branch:** `<path and branch, or "read-only in current workspace">`
- **You Own:** <exact files, directories, or research questions>
- **Out of Scope (DO NOT EDIT):** <files owned by other workers or shared files reserved for the coordinator>
- **Contracts / Interfaces to Match:** <types, schemas, APIs, naming conventions>
- **Repo Rules & Forbidden Commands:** <extracted from AGENTS.md / charter>
- **Verification Required Before Finishing:** <exact targeted build/typecheck/lint/test commands>
- **Done Looks Like:** <concrete deliverable; for worktree authors: commit your changes on your branch>
When finished, reply concisely with:
1. Summary of changes or findings
2. Exact files touched (or commit hash)
3. Verification commands run and their results
4. Any blockers, assumptions, or follow-ups for other workers
Guardrails
- Never delete or archive a worktree until its commits are merged/landed into the target branch.
- Never push to a remote or open a PR unless the user explicitly requested it.
- Never skip integrated verification — passing isolated worker checks does not prove the merged result builds and passes together.
- Never exceed 2 fix-and-reverify loops — escalate to the user with diagnostics instead of burning quota.
- Respect repository test rules — run targeted test files, typecheck, and lint rather than blindly running full heavy test suites unless asked.
- Be honest about quota — announce the proposed worker roster (count + slices) before spawning if the task would require more than 4 workers.