parallel-swarm
Skill2 starsChanged 5 months agoMITView on GitHub
Coordinator-led parallel feature development. 5-10 features built simultaneously via native `claude --bg --worktree feat-<N>`. Each stream has own subagent team; coordinator merges. Built on native CC v2.1.144+ primitives — no custom orchestrator.
- Commits and pushes
In this repository60 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- analyzeSkill
- animation-disciplineSkill
- api-versioningSkill
- autopilotSkill
- browser-e2eSkill
- characterizeSkill
- clarifySkill
- codemodSkill
- constitution-compactSkill
- constitutionSkill
- context-budgetSkill
- creative-webSkill
- db-migrationSkill
- debugSkill
- detect-stackSkill
- dispatch-criteriaSkill
- dreamSkill
- experimentSkill
- fastapiSkill
- flag-cleanupSkill
- flag-rolloutSkill
- flask-realtimeSkill
- framework-detectorSkill
- front-end-designSkill
- grill-meSkill
- handoffSkill
- image-generationSkill
- implementSkill
- initiativeSkill
- instinctSkill
- loopSkill
- nextjsSkill
- observabilitySkill
- okr-alignSkill
- pivotSkill
- planSkill
- pr-bodySkill
- prime-disciplineSkill
- prod-observabilitySkill
- react-nodeSkill
- react-viteSkill
- release-trainSkill
- researchSkill
- reviewSkill
- security-guardSkill
- self-healSkill
- shipSkill
- skill-creatorSkill
- specifySkill
- tailwind-disciplineSkill
- tasksSkill
- tdd-loopSkill
- token-budgetSkill
- typographySkill
- verify-loopSkill
- verifySkill
- wip-checkpointSkill
- <kebab-case-skill-name>Skill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 51
Read tasks/TASKS.md. Identify independent streams (tasks with parallel: yes and no cross-deps).
- Very specific: line 58
Write brief.md for each stream (this becomes the system-prompt extension for the background session).
- Very specific: line 72
Update .swarms/coordinator/fleet.json with each session ID.
- Very specific: line 75
Use claude agents (TUI) or claude agents --json (scriptable).
- Very specific: line 77
If a stream hits QA-FAIL 3x, mark it for escalation.
- Very specific: line 80
When a stream reports QA-PASS and writes its final handoff:
- Distinctive: line 82
Wait for CI (claude-review + claude-security + ci + e2e-preview)
- Very specific: line 84
Delete the worktree: git worktree remove .claude/worktrees/feat-<N>
- Distinctive: line 88
If two streams need to write to the same file: only the *designated owner* writes.
- Distinctive: line 89
If conflicts arise anyway: coordinator merges manually with the human in the loop (do not auto-resolve code conflicts).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Parallel Swarm
Native Claude Code primitives do the heavy lifting; we provide the content (briefs, state files, handoff format).
Topology
COORDINATOR SESSION (foreground, you)
│
├── claude --bg -w feat-001 --agent feature-stream [streamId 1]
├── claude --bg -w feat-002 --agent feature-stream [streamId 2]
├── claude --bg -w feat-003 --agent feature-stream [streamId 3]
├── claude --bg -w feat-004 --agent feature-stream [streamId 4]
└── claude --bg -w feat-005 --agent feature-stream [streamId 5]Each --bg is a native daemon-supervised background session. Each -w feat-<N> creates a native git worktree at .claude/worktrees/feat-<N>/. Coordinator monitors via claude agents --json.
State files
Everything lives under .swarms/:
.swarms/
├── coordinator/
│ ├── plan.md # Overall plan
│ ├── fleet.json # {streamId: {sessionId, worktree, status, branch, taskIds}}
│ └── decisions.log # Append-only
└── streams/
└── <stream-id>/
├── brief.md # Loaded into the background session via --append-system-prompt-file
├── task.json # ccg-workflow schema
├── analysis.md # ccpm-style: scope, files-owned, files-shared-with-owner
├── progress.md # Updated by stream
├── context.jsonl # Spec refs auto-injected into subagents
└── handoff-<ts>.yaml # NEXUS v1.0Process
1. Plan (coordinator)
- Read
tasks/TASKS.md. Identify independent streams (tasks withparallel: yesand no cross-deps). - Group tasks into 5-10 streams. Each stream owns a coherent feature area.
- For each stream, write
analysis.md:- Scope (1 paragraph)
- Files owned (this stream is the only writer)
- Files shared (one designated owner per file — see CCPM)
- Acceptance commands (machine-verifiable)
- Write
brief.mdfor each stream (this becomes the system-prompt extension for the background session).
2. Dispatch (coordinator)
- For each stream:
sid=$(claude --bg -w feat-<N> \ --agent feature-stream \ --append-system-prompt-file .swarms/streams/<N>/brief.md \ --max-turns 200 \ --max-budget-usd 5 \ --output-format stream-json \ -p "Begin stream <N>. Read .swarms/streams/<N>/brief.md and execute.") echo "Spawned stream <N>: $sid" - Update
.swarms/coordinator/fleet.jsonwith each session ID.
3. Monitor (coordinator, interactive)
- Use
claude agents(TUI) orclaude agents --json(scriptable). - Watch for handoff files appearing in
.swarms/streams/<N>/. - If a stream hits
QA-FAIL3x, mark it for escalation; consider re-dispatching with refined brief.
4. Merge (coordinator)
- When a stream reports
QA-PASSand writes its final handoff:- Coordinator: use pr-body to compose all applicable evidence and open from the stream's branch with
gh pr create --body-file <complete-body-file>; read back the published body. - Wait for CI (claude-review + claude-security + ci + e2e-preview)
- Squash-merge once green
- Delete the worktree:
git worktree remove .claude/worktrees/feat-<N>
- Coordinator: use pr-body to compose all applicable evidence and open from the stream's branch with
5. Conflict resolution (coordinator)
- Streams should not collide because each owns its file set.
- If two streams need to write to the same file: only the designated owner writes; other streams
git pull --rebaseafter the owner commits. - If conflicts arise anyway: coordinator merges manually with the human in the loop (do not auto-resolve code conflicts).
Hard rules
- One implementer per file at a time. Worktree isolation isn't enough — if two streams need file X, designate an owner.
tasks/TASKS.mdis coordinator-owned. Feature-streams report task completion via their NEXUS handoff; only the coordinator marks[x]/[!]/[s]in the livetasks/TASKS.md. This prevents merge conflicts when multiple streams finish tasks concurrently.- No nested swarms. A feature stream never spawns its own swarm. Spawn subagents in-stream, not streams-in-streams.
- Budget per stream.
--max-budget-usdis mandatory. Default 5 USD per stream. - Resumable. Streams write WIP checkpoints continuously (per
wip-checkpointskill). If a stream session crashes,claude respawn <id>brings it back. - Coordinator never edits code. It only orchestrates, monitors, merges. Code edits happen inside the streams.
Commands
/swarm-plan <N>— plan N independent streams from the backlog/swarm-dispatch— spawn the planned streams as--bgsessions/swarm-status— pretty-printclaude agents --json+ fleet.json/swarm-merge— for each PASS stream, open PR and merge/swarm-stop <stream>— stop one stream cleanly/swarm-respawn <stream>— restart a crashed stream
References
- Native Claude Code v2.1.144+ CLI (--bg, -w, agents, attach/logs/stop/respawn, --teammate-mode)
- automazeio/ccpm (stream-analysis schema, designated owner for shared files)
- ccg-workflow/templates (task.json schema, hooks)
- obra/superpowers/skills/using-git-worktrees (native-first principle)
- obra/superpowers/skills/dispatching-parallel-agents (when to fan out, when not to)
- msitarzewski/agency-agents (NEXUS handoff format)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

