with one click
run-swarm
Execute plan tasks via fresh-context subagents (swarm mode)
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Execute plan tasks via fresh-context subagents (swarm mode)
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | run-swarm |
| description | Execute plan tasks via fresh-context subagents (swarm mode) |
| when_to_use | Plan with 10+ tasks, large implementation efforts, avoiding context bloat |
| argument-hint | [--max-tasks N] [--dry-run] [--worktrees] |
| allowed-tools | ["Read","Write","Edit","Grep","Glob","Bash","Bash(${CLAUDE_PLUGIN_ROOT}/scripts/*.sh:*)","Monitor","Agent","AskUserQuestion","TaskCreate","TaskUpdate","TaskList","Skill"] |
Execute plan tasks via fresh-context subagents. You are the orchestrator.
Bash hygiene: prefer quiet flags to minimize output (npm install --silent, git status -sb, pipe long output through | tail -n 20).
Monitor for validation commands: When the orchestrator runs test or build commands to validate phase completion, use Monitor for real-time streaming. Worker agents (swarm-worker, haiku-worker) also have Monitor available and should use it for long-running commands within their tasks.
Long-running commands that warrant Monitor: test suites (npm test, pytest, go test ./..., cargo test, make test), builds (npm run build, make, cargo build, tsc), and full-codebase linting (eslint ., ruff check ., golangci-lint run).
Orchestrator validation example:
Monitor({ description: "swarm validation tests", command: "npm test 2>&1 | grep --line-buffered -E 'PASS|FAIL|Error|passed|failed'", timeout_ms: 300000, persistent: false })
Fallback: if Monitor errors, use Bash directly.
Run ${CLAUDE_PLUGIN_ROOT}/scripts/check-plan-complete.sh .devloop/plan.md.
/devloop:plan) and STOP.--max-tasks N: Max tasks before pausing.--dry-run: List pending tasks and STOP.--worktrees: Run each worker with isolation: "worktree". Each worker gets an isolated git worktree; the orchestrator merges results back after each batch. Off by default.Also read the local config to detect git.worktree_isolation:
Bash: ${CLAUDE_PLUGIN_ROOT}/scripts/parse-local-config.sh
If git.worktree_isolation is true in the config, treat it as if --worktrees was passed.
The CLI flag always wins: --worktrees enables isolation regardless of config.
Extract max 100 lines from CLAUDE.md (code style, patterns) and plan's Overview/Considerations. Store as shared context.
Read all - [ ] tasks from plan.md. Group them:
[parallel:X] markers → batch together[depends:N.M] → schedule after dependency completesRun ${CLAUDE_PLUGIN_ROOT}/scripts/gather-task-context.sh or Grep/Glob for relevant files (max 20 per task).
Parse [model:X] from the task line:
[model:haiku]: Spawn with model: "haiku"[model:sonnet] or no annotation: Spawn with model: "sonnet" (default)For a parallel batch, spawn all workers simultaneously (multiple Agent calls in a single message).
Prompt caching: Static content (Instructions, Phase) goes FIRST -- it is identical across all workers in a batch and gets cached after the first spawn. Dynamic content (Task description, Context files) goes LAST -- it varies per worker and is not cached. This ordering maximizes cache hits when spawning multiple workers in a single batch.
Without --worktrees (default):
Agent:
subagent_type: "devloop:swarm-worker" # or devloop:haiku-worker for [model:haiku]
model: "haiku" # or "sonnet" per annotation
prompt: |
Instructions: Implement the task below. Do NOT modify plan.md or commit.
Phase: [phase name]
[STATIC: shared project conventions from CLAUDE.md or plan Overview -- same for all workers]
Task: [description]
Context: [relevant files and conventions -- dynamic, task-specific]
With --worktrees (or git.worktree_isolation: true in local.md):
Agent:
subagent_type: "devloop:swarm-worker" # or devloop:haiku-worker for [model:haiku]
model: "haiku" # or "sonnet" per annotation
isolation: "worktree"
prompt: |
Instructions: Implement the task below. Do NOT modify plan.md or commit.
Note: You are running inside an isolated git worktree. Use relative paths in your
summary. Your changes will be merged back to the main branch by the orchestrator.
Phase: [phase name]
[STATIC: shared project conventions from CLAUDE.md or plan Overview -- same for all workers]
Task: [description]
Context: [relevant files and conventions -- dynamic, task-specific]
After each batch completes in worktree mode, perform merge-back (Step 4c).
Skip this step if --worktrees was not used.
After all workers in a batch complete:
git merge <worktree-branch> --no-commit --no-ff
The --no-commit flag stages the merged changes without creating a commit,
preserving the existing auto_commit flow.git merge --abort and surface to user:
AskUserQuestion: "Merge conflict from worktree branch <branch>. Options:
(a) Resolve manually and continue, (b) Skip this task's changes, (c) Stop swarm."
git branch -d <worktree-branch>
git diff --stat and worker summary for each completed task.[x] in plan.md and update native task.auto_commit: true and phase complete, commit changes.--max-tasks reached.[depends:N.M] — if a just-completed task unblocks dependent tasks, add them to the next batch.When all [x], AskUserQuestion: Ship it, Archive, or Review.
If worker fails, AskUserQuestion:
[!], continue.Now: Check plan state and begin swarm.
Create or update the project security baseline, profile, suppressions file, and gitignore entries for security scans
Fix or guide remediation for a specific security finding from the latest scan report
Run a security assessment using deterministic static analysis tools with LLM-powered triage
Inspect and optionally install security scanning tools for the security plugin
Query ctx memory and inject results into context
Show ctx memory status (node counts, types, tiers, tokens)