| name | swarm-batch-dispatcher |
| description | Use when the user says /swarm-batch-dispatcher, "batch these issues", "ship N PRs in parallel from issues X Y Z", "run a parallel swarm batch", "dispatch builders for issues #N #M", or asks to take a list of GitHub issues from "ready" to "merged PRs" in one coordinated pass. Owns the full pipeline: worktree creation, parallel builder dispatch, coordinator-side commit / push / PR opening, CI-poll-with-branch-update loop, sequential merge in dependency order, and worktree teardown. Use even when the user names a single issue โ the skill still applies (it just dispatches one builder). Do NOT use for one-shot code changes that don't start from a GitHub issue, and do NOT use for spec authoring alone (spec PRs ride a different workflow โ see "When NOT to use" below).
|
Swarm Batch Dispatcher
Takes a list of ready GitHub issues, ships each as its own PR through a
parallel builder swarm, and walks the batch to merge. Codifies the rote
coordination work that a manual swarm batch leaks tokens on: worktree
plumbing, builder briefs, fish-safe commit-msg writing, CI BEHIND ping-pong,
sequential merge order, and cleanup.
Why this exists
A typical batch hits ~50 manual coordination steps for 4 issues โ 4 worktree
creates, 4 builder briefs (~100 lines each), 4 commits via fish heredoc
temp-file pattern, 4 pushes, 4 PR opens, sequential merges with 2-3
BEHIND-state rebases mid-batch, plus teardown. The pattern recurs every
phase. This skill bundles it.
The skill also enforces three hard-learned constraints that a freshly-
dispatched coordinator easily forgets:
- Subagent sandbox: builders cannot run
git or gh, and cannot reach
paths outside the project. Worktrees MUST live at .worktrees/issue-N
inside the repo, and the coordinator is the only thing that pushes / opens
PRs.
- Full local CI before push:
lint + format:check + test + build โ
spec-only PRs that touch experiments/ or eslint.config.* still hit CI
gates.
- Specs ship as their own PR first: if an issue is
needs-spec, the
spec lands and merges before the implementation dispatch โ don't run them
back-to-back.
Arguments
<issues> โ one or more GitHub issue numbers (e.g., 10 11 26 29)
--topology <parallel|sequential> โ default parallel. Use sequential when
issues touch overlapping files or have ordered dependencies.
--builder <agent-name> โ default project-configured builder. Common values:
chrome-extension-engineer, coder, backend-dev. Read the project
CLAUDE.md "Agent routing" table to pick the right default; if multiple
apply, ask the user.
--base <branch> โ default main. The branch worktrees fork from and PRs
target.
--repo <owner/name> โ optional; default = current git remote.
Workflow
Step 1: Read each issue
For every issue number, fetch the body and labels:
gh issue view <N> --json title,body,labels,assignees,milestone
Skim for:
- Scope shape โ single file / single module / cross-boundary / new feature
needs-spec label โ triggers the spec-first detour in Step 2
- Dependencies โ issues that reference other issues or PRs as
prerequisites
- Acceptance criteria โ used in Step 5 (commit message + PR body) and
Step 8 (merge verdict)
Emit a one-line summary per issue so the user can intercept misreads cheaply:
#10: "Bundle OpenDyslexic scaffold + fix WAR matches" โ scope: src/chrome/manifest + WAR config, no spec needed.
#11: "Real 16/48/128 PNG icons from Safari upstream" โ scope: icons/, no spec needed.
Step 2: Risk-tier each issue (delegate to ring-review-tiered)
Before dispatching builders, classify each issue's risk tier using the same
table the ring-review-tiered skill uses. The tier determines:
- Builder brief intensity โ large/boundary/security issues get the
full adversarial-self brief; trivial issues get a minimal brief
- Post-PR ring intensity โ passed through to the eventual
ring-review-tiered call so the same dispatch sees consistent calibration
If an issue is needs-spec, run the spec-first detour now: dispatch the
architect subagent on a spec/<topic> branch, open a spec-only PR, wait for
merge to --base, THEN proceed to Step 3 for the implementation issue.
Verify the architect's "wrote spec at X" claim by inspecting
git log --oneline <branch> before declaring the detour done โ agent
summaries describe intent, not action.
Step 3: Create worktrees
For each issue, create a worktree INSIDE the repo at .worktrees/issue-<N>:
git worktree add -b feat/issue-<N> .worktrees/issue-<N> <base>
Ensure .worktrees/ is in .gitignore (add the line if missing). Do NOT use
~/.config/superpowers/worktrees/ or any path outside the repo โ the
subagent sandbox blocks those, and the symptom is a confusing
"sandbox-permission denial" mid-dispatch.
Step 4: Dispatch builders in parallel
Spawn N builder subagents in a single tool-use batch. Each brief includes:
Step 5: Coordinator-side commit + push + PR
When a builder reports clean state:
- Verify the claim before committing. Run
git status -s in the
worktree; the modified file list MUST match the builder's report. Builders
sometimes probe source files and restore โ verify the restoration.
- Write the commit message using the fish-safe temp-file pattern (no
bash heredocs โ they break under fish):
echo "feat(scope): subject
Body paragraph.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>" > /tmp/commit-<N>.msg
git -C .worktrees/issue-<N> commit -F /tmp/commit-<N>.msg
- Push and open the PR:
git -C .worktrees/issue-<N> push -u origin feat/issue-<N>
gh pr create --base <base> --head feat/issue-<N> --title "..." \
--body "$(cat /tmp/pr-body-<N>.md)"
- PR body template โ fish-safe, written via temp file. Include:
- Summary (1-3 bullets)
- Closes #
- Test plan (the verify commands that ran + any manual smoke items)
- Builder report excerpt
Step 6: CI poll loop with branch-update
For each open PR in the batch:
gh pr checks <PR> โ wait for CI verdict
gh pr view <PR> --json mergeStateStatus โ read state
- If
BEHIND: gh pr update-branch <PR> then loop back to step 1
- If
BLOCKED / DIRTY: surface to user; do NOT auto-resolve conflicts
- If
CLEAN and CI green: ready for Step 7
This loop is the single biggest manual-coordination cost in batch work. The
ping-pong of "merge A โ B goes BEHIND โ update-branch โ merge B โ C goes
BEHIND โ update-branch โ ..." compounds. Run it tight.
Step 7: Optional ring review
If the user invoked the batch with --ring (default off), pass the PR list
to ring-review-tiered. Calibrated tiers from Step 2 should match the tiers
that skill computes โ if they don't, prefer the tier-skill's reading
(it's the canonical one).
If any PR returns BLOCK or HOLD-with-fixes from the ring, dispatch a
fix-builder subagent in the same worktree, then loop back to Step 5.
Step 8: Sequential merge
Merge in dependency order (Step 1's "Dependencies" notes). After each merge,
the remaining PRs go BEHIND โ run gh pr update-branch on each, then resume.
If a rebase triggers a regression (fixtures, snapshot tests), dispatch a
fixture-backfill subagent in the affected worktree before retrying.
Default merge mode: squash. Override with --merge-mode <squash|rebase|merge>
if the project's convention is different.
Step 9: Teardown
For each merged PR:
git worktree remove .worktrees/issue-<N>
git branch -d feat/issue-<N>
Skip teardown for any PR that didn't merge โ leave the worktree so the user
can resume from where it stalled.
Emit a final batch summary:
Batch summary: 4 issues โ 4 PRs โ 4 merged.
Wall time: 18 min. Worktrees torn down: 4. Branches deleted: 4.
Follow-ups opened: #172, #173 (from ring findings).
When NOT to use
- One-shot code changes with no GitHub issue. Just edit and commit.
- Spec authoring alone โ that's an architect dispatch, not a batch. (A
needs-spec issue inside a batch IS handled; pure spec PRs aren't.)
- Issues that need genuine human design discussion โ
superpowers:brainstorming
first, file an issue with the resolved approach, THEN batch.
- Cross-repo work โ this skill assumes a single repo. Use
cross-project
for impact analysis first if changes ripple beyond one repo.
Common mistakes
- Putting worktrees outside the repo.
~/.config/superpowers/worktrees/
is the default of an adjacent skill and it fails silently in subagents.
Pin worktrees to .worktrees/issue-N always.
- Briefing builders to run
git/gh. They can't. The brief MUST say
"coordinator finalizes" โ otherwise the builder halts mid-task with a
sandbox denial and the user has to unstick it.
- Skipping
format:check locally. CI runs it; local "just tests" misses
it. The verify gate must include all four (lint + format + test + build).
- Running spec + implementation back-to-back. The spec file vanishes if it
was written in an agent worktree that gets cleaned up. Spec โ PR โ merge,
THEN dispatch.
- Trusting builder summaries without
git status verification. Agent
summaries describe intent, not action.
Linked policies
feedback-subagent-sandbox-constraints โ .worktrees/ inside repo;
coordinator owns git/gh
feedback-run-full-ci-locally โ lint + format:check + test + build
before push
feedback-specs-ship-as-pr-first โ spec โ PR โ merge โ implement
feedback-builders-self-pushback โ adversarial-self brief at build stage
ring-review-tiered โ risk-tier classifier used in Step 2 and (optionally)
Step 7
superpowers:dispatching-parallel-agents โ generic parallel-dispatch
primitives this skill specializes for the batch-to-PR pipeline