swarm-pr

A way to create and control groups of AI coding agents from GitHub pull requests. A pull request is a proposed set of code changes for review and merging.

In plain words
What is it for?
Use it to start agents from pull-request details or labels, issue commands through pull-request comments, and automate responses to pull-request events.
Why use it?
It puts agent tasks and their status in the same place where developers already discuss and review code changes.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ruvnet/ruview/swarm-pr
Clone the repo
git clone --depth 1 https://github.com/ruvnet/RuView

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,850 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01850
Opus 5 $0.00000 $0.00925
Sonnet 5 $0.00000 $0.00370
Haiku 4.5 $0.00000 $0.00185

Measured 3d ago against content hash 9f364ea2a6b6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

swarm-pr scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

const { execSync } = require('child_process');
Origin

Copies of this mod

8 near-identical copies found in the catalogue:

  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
  • swarm-pr — 100% identical, 0 lines differ
.claude/commands/github/swarm-pr.md · 285 lines

How it starts

The opening of the file, as written. The whole thing — 285 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swarm PR - Managing Swarms through Pull Requests

Overview

Create and manage AI swarms directly from GitHub Pull Requests, enabling seamless integration with your development workflow.

Core Features

1. PR-Based Swarm Creation

# Create swarm from PR description using gh CLI
gh pr view 123 --json body,title,labels,files | npx ruv-swarm swarm create-from-pr

# Auto-spawn agents based on PR labels
gh pr view 123 --json labels | npx ruv-swarm swarm auto-spawn

# Create swarm with PR context
gh pr view 123 --json body,labels,author,assignees | \
  npx ruv-swarm swarm init --from-pr-data

2. PR Comment Commands

Execute swarm commands via PR comments:

<!-- In PR comment -->
/swarm init mesh 6
/swarm spawn coder "Implement authentication"
/swarm spawn tester "Write unit tests"
/swarm status

3. Automated PR Workflows

# .github/workflows/swarm-pr.yml
name: Swarm PR Handler
on:
  pull_request:
    types: [opened, labeled]
  issue_comment:
    types: [created]

jobs:
  swarm-handler:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Handle Swarm Command
        run: |
          if [[ "${{ github.event.comment.body }}" == /swarm* ]]; then
            npx ruv-swarm github handle-comment \
              --pr ${{ github.event.pull_request.number }} \
              --comment "${{ github.event.comment.body }}"
          fi

PR Label Integration

Automatic Agent Assignment

Map PR labels to agent types:

{
  "label-mapping": {
    "bug": ["debugger", "tester"],
    "feature": ["architect", "coder", "tester"],
    "refactor": ["analyst", "coder"],
    "docs": ["researcher", "writer"],
    "performance": ["analyst", "optimizer"]
  }
}

Label-Based Topology

# Small PR (< 100 lines): ring topology
# Medium PR (100-500 lines): mesh topology  
# Large PR (> 500 lines): hierarchical topology
npx ruv-swarm github pr-topology --pr 123

PR Swarm Commands

Initialize from PR

# Create swarm with PR context using gh CLI
PR_DIFF=$(gh pr diff 123)
PR_INFO=$(gh pr view 123 --json title,body,labels,files,reviews)

npx ruv-swarm github pr-init 123 \
  --auto-agents \
  --pr-data "$PR_INFO" \
  --diff "$PR_DIFF" \
  --analyze-impact

Read the full file on GitHub · 285 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 285 lines · 0 tokens per session scan A 9f364ea2a6b6

Subscribe to this mod's changes

swarm-pr is a command published in the GitHub repository ruvnet/RuView (92,289 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,850 tokens. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.