Skip to content

feat(skills): add pr-swarm parallel PR-loop skill + command - #84

Merged
Mathews-Tom merged 3 commits into
mainfrom
feat/pr-swarm
Aug 1, 2026
Merged

feat(skills): add pr-swarm parallel PR-loop skill + command#84
Mathews-Tom merged 3 commits into
mainfrom
feat/pr-swarm

Conversation

@Mathews-Tom

Copy link
Copy Markdown
Owner

Summary

Adds the pr-swarm skill + command pair: parallelizes two or more already-open, file-disjoint pull requests in the same repository to merge-ready at the same time, each driven by its own isolated git worktree and its own independent headless Claude Code session (claude -p) — no shared context/budget, no cross-lane diff or feedback leakage.

Three commits, each independently reviewable:

  1. feat(skills): add pr-swarm parallel PR-loop skillskills/pr-swarm/SKILL.md + references/{launch-mechanics,verification-gates,lane-prompt-template}.md + evals/cases.yaml. Owns the deep mechanics:

    • PR resolution (gh pr view), state/author checks
    • A mandatory changed-file independence check (git diff --name-only on each PR's merge-base) that hard-stops before creating any worktree if two requested PRs touch the same file — never a silent pass-through on the user's own assertion that they're unrelated
    • Branch/worktree short-name inference from headRefName (conventional-prefix stripping, kebab-case, PR-number disambiguation on collision) — never asks the user to name worktrees
    • claude -p launch mechanics: verified flags (--strict-mcp-config, --permission-mode bypassPermissions, --no-session-persistence, --session-id), the lack of a CLI timeout flag (external watchdog required), the zombie-PID liveness-check trap, and an explicitly flagged unverified caveat around background-process survival across tool-call boundaries — documented as an open risk to smoke-test, not asserted as fact
    • Verification gates: stale mergeStateStatus/mergeable (verify with git merge-tree before trusting "conflicting"), the body-only bot-review gap (reviewThreads alone misses findings embedded in a review's raw body with no inline comment), stale statusCheckRollup entries from superseded reruns, and the closed-PR trap (every other field can look healthy on a closed PR)
    • The literal per-lane task prompt template with termination conditions and cross-lane isolation instructions
  2. feat(commands): add pr-swarm slash-command wrappercommands/pr-swarm/COMMAND.md + evals/cases.yaml. Thin argument surface only: /pr-swarm <PR#> [PR# ...] parses PR numbers (with or without #, space- or comma-separated), resolves each against the current repo, and delegates everything else to skills/pr-swarm via a declared command.dependencies entry (mirrors the existing stack-pr/stacked-prs and handoff/handoff same-name command+skill pairing already in this repo). A single PR number is valid input and still runs the full isolated-worktree path — no inline fast path that would silently drop the session-isolation guarantee.

  3. chore: regenerate manifest for pr-swarm packagesmanifest.yaml via scripts/generate_manifest.py. Adds exactly the two new entries; no other package touched.

Design notes worth flagging for review

  • Targets Claude Code's claude -p headless mode, not any other agent CLI — matches this repo's stated Claude Code/Claude.ai scope (see prior issue Docs idea: quick-try link for agent-builder #79 precedent) and the existing agent-builder skill's own headless-mode guidance.
  • The independence check is intentionally a hard stop, not a warning — running two lanes concurrently against the same file is the exact failure mode this package exists to prevent.
  • references/launch-mechanics.md explicitly documents one mechanic as unverified: whether Claude Code's Bash tool preserves a nohup/disown-backgrounded child across tool-call/turn boundaries. No authoritative source was found either way; the skill instructs checking liveness a minute+ after launch (not immediately) and treats unexpected mid-run death as evidence worth investigating rather than silently retrying. This should be smoke-tested against a real multi-minute run before being treated as settled.

Skill Evaluator Results

skills/pr-swarm (via scripts/evaluate_package.py):

Package: pr-swarm (skill)
  D1 Frontmatter Quality:            20/20
  D2 Trigger Coverage:               18/18
  D3 Structural Completeness:        20/20
  D4 Content Depth:                  18/22
  D5 Consistency:                    12/12
  D6 Compliance:                       8/8
  Overall:                          96/100 (96%)
  Status: PASS

commands/pr-swarm:

Package: pr-swarm (command)
  D1 Frontmatter Quality:            20/20
  D2 Trigger Coverage:               18/18
  D3 Structural Completeness:        16/20
  D4 Content Depth:                  22/22
  D5 Consistency:                    12/12
  D6 Compliance:                       8/8
  Overall:                          96/100 (96%)
  Status: PASS

Zero CRITICAL/HIGH findings on either package.

Checklist

  • SKILL.md and COMMAND.md both have valid YAML frontmatter with name and description
  • Both package names are kebab-case, under 64 characters (pr-swarm)
  • Both descriptions are 200-1024 characters with trigger phrases and a "Use this ... when" clause
  • No angle brackets or pushy language in either description
  • No secrets, credentials, or internal URLs in any file
  • Tested locally: uv run python scripts/validate_evals.py and uv run scripts/generate_manifest.py both pass clean
  • All file references (references/*.md) resolve to existing files within skills/pr-swarm/
  • No cross-package ../ references; the only inter-package link is command.dependencies: [skills/pr-swarm], matching the existing stack-pr/stacked-prs convention
  • Eval cases: skill has 2 positive / 3 negative; command has 4 positive / 2 negative (both exceed the 1+/2+ minimum)
  • Skill evaluator score is 70% or above on both packages (96%/96%)
  • No CRITICAL or HIGH findings from skill evaluator

Drives two or more already-open, file-disjoint pull requests to
merge-ready concurrently: one isolated git worktree and one
independent headless Claude Code session per PR, with no cross-lane
diff or feedback leakage.

Owns the deep mechanics: PR resolution and author checks, a mandatory
changed-file independence check that hard-stops on any overlap before
touching git state, branch/worktree-name inference from headRefName,
claude -p launch mechanics (references/launch-mechanics.md),
verification gates covering stale mergeStateStatus, body-only bot
reviews, and stale statusCheckRollup entries
(references/verification-gates.md), and the per-lane task prompt
template (references/lane-prompt-template.md).

Includes eval cases (2 positive, 3 negative).
Thin argument surface for the pr-swarm skill: /pr-swarm <PR#>
[PR# ...] parses PR numbers (with or without a leading #,
space- or comma-separated), resolves each against the current
repository, and delegates independence checking, worktree naming,
launch mechanics, monitoring, and teardown to skills/pr-swarm.

A single PR number is valid and still runs the full isolated-worktree
path rather than collapsing to inline execution.

Includes eval cases (4 positive, 2 negative).
Adds the pr-swarm skill and command entries via
scripts/generate_manifest.py. No other packages affected.
@Mathews-Tom
Mathews-Tom merged commit 9ffdcbb into main Aug 1, 2026
3 checks passed
@Mathews-Tom
Mathews-Tom deleted the feat/pr-swarm branch August 1, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant