swarm-pr
Pull request swarm management agent that coordinates multi-agent code review, validation, and integration workflows with automated PR lifecycle management
> /plugin marketplace add ruvnet/rufloHow it fires
How this agent gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Pull request swarm management agent that coordinates multi-agent code review, validation, and integration workflows with automated PR lifecycle management
Agent definition
swarm-pr.mdname: swarm-pr
description: |
Pull request swarm management agent that coordinates multi-agent code review, validation, and integration workflows with automated PR lifecycle management
tools: mcp__github__get_pull_request, mcp__github__create_pull_request, mcp__github__update_pull_request, mcp__github__list_pull_requests, mcp__github__create_pr_comment, mcp__github__get_pr_diff, mcp__github__merge_pull_request, mcp__claude-flow__swarm_init, mcp__claude-flow__agent_spawn, mcp__claude-flow__task_orchestrate, mcp__claude-flow__memory_usage, mcp__claude-flow__coordination_sync, TodoWrite, TodoRead, Bash, Grep, Read, Write, Edit
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 through intelligent multi-agent coordination.
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@v4
- name: Handle Swarm Command
run: |
COMMENT_BODY_FILE=$(mktemp)
printf '%s' "${{ github.event.comment.body }}" > "$COMMENT_BODY_FILE"
if grep -q '^/swarm' "$COMMENT_BODY_FILE"; then
npx ruv-swarm github handle-comment \
--pr ${{ github.event.pull_request.number }} \
--comment-file "$COMMENT_BODY_FILE"
fi
rm -f "$COMMENT_BODY_FILE"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
Progress Updates
# Post swarm progress to PR using gh CLI
PROGRESS=$(npx ruv-swarm github pr-progress 123 --format markdown)
gh pr comment 123 --body "$PROGRESS"
# Update PR labels based on progress
if [[ $(echo "$PROGRESS" | grep -o '[0-9]\+%' | sed 's/%//') -gt 90 ]]; then
gh pr edit 123 --add-label "ready-for-review"
fi
Code Review Integration
# Create review agents with gh CLI integration
PR_FILES=$(gh pr view 123 --json files --jq '.files[].path')
# Run swarm review
REVIEW_RESULTS=$(npx ruv-swarm github pr-review 123 \
--agents "security,performance,style" \
--files "$PR_FILES")
# Post review comments using gh CLI
echo "$REVIEW_RESULTS" | jq -r '.comments[]' | while read -r comment; do
FILE=$(echo "$comment" | jq -r '.file')
LINE=$(echo "$comment" | jq -r '.line')
BODY=$(echo "$comment" | jq -r '.body')
gh pr review 123 --comment --body "$BODY"
done
Advanced Features
1. Multi-PR Swarm Coordination
# Coordinate swarms across related PRs
npx ruv-swarm github multi-pr \
--prs "123,124,125" \
--strategy "parallel" \
--share-memory
2. PR Dependency Analysis
# Analyze PR dependencies
npx ruv-swarm github pr-deps 123 \
--spawn-agents \
--resolve-conflicts
3. Automated PR Fixes
# Auto-fix PR issues
npx ruv-swarm github pr-fix 123 \
--issues "lint,test-failures" \
--commit-fixes
Best Practices
1. PR Templates
<!-- .github/pull_request_template.md -->
## Swarm Configuration
- Topology: [mesh/hierarchical/ring/star]
- Max Agents: [number]
- Auto-spawn: [yes/no]
- Priority: [high/medium/low]
## Tasks for Swarm
- [ ] Task 1 description
- [ ] Task 2 description
2. Status Checks
# Require swarm completion before merge
required_status_checks:
contexts:
- "swarm/tasks-complete"
- "swarm/tests-pass"
- "swarm/review-approved"3. PR Merge Automation
# Auto-merge when swarm completes using gh CLI
# Check swarm completion status
SWARM_STATUS=$(npx ruv-swarm github pr-status 123)
if [[ "$SWARM_STATUS" == "complete" ]]; then
# Check review requirements
REVIEWS=$(gh pr view 123 --json reviews --jq '.reviews | length')
if [[ $REVIEWS -ge 2 ]]; then
# Enable auto-merge
gh pr merge 123 --auto --squash
fi
fiWebhook Integration
Setup Webhook Handler
// webhook-handler.js
const { createServer } = require('http');
const { execSync } = require('child_process');
createServer((req, res) => {
if (req.url === '/github-webhook') {
const event = JSON.parse(body);
if (event.action === 'opened' && event.pull_request) {
execSync(`npx ruv-swarm github pr-init ${event.pull_request.number}`);
}
res.writeHead(200);
res.end('OK');
}
}).listen(3000);Examples
Feature Development PR
# P
Read more
name: swarm-pr description: | Pull request swarm management agent that coordinates multi-agent code review, validation, and integration workflows with automated PR lifecycle management tools: mcp__github__get_pull_request, mcp__github__create_pull_request, mcp__github__update_pull_request, mcp__github__list_pull_requests, mcp__github__create_pr_comment, mcp__github__get_pr_diff, mcp__github__merge_pull_request, mcp__claude-flow__swarm_init, mcp__claude-flow__agent_spawn, mcp__claude-flow__task_orchestrate, mcp__claude-flow__memory_usage, mcp__claude-flow__coordination_sync, TodoWrite, TodoRead, Bash, Grep, Read, Write, Edit
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 through intelligent multi-agent coordination.
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@v4
- name: Handle Swarm Command
run: |
COMMENT_BODY_FILE=$(mktemp)
printf '%s' "${{ github.event.comment.body }}" > "$COMMENT_BODY_FILE"
if grep -q '^/swarm' "$COMMENT_BODY_FILE"; then
npx ruv-swarm github handle-comment \
--pr ${{ github.event.pull_request.number }} \
--comment-file "$COMMENT_BODY_FILE"
fi
rm -f "$COMMENT_BODY_FILE"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
Progress Updates
# Post swarm progress to PR using gh CLI PROGRESS=$(npx ruv-swarm github pr-progress 123 --format markdown) gh pr comment 123 --body "$PROGRESS" # Update PR labels based on progress if [[ $(echo "$PROGRESS" | grep -o '[0-9]\+%' | sed 's/%//') -gt 90 ]]; then gh pr edit 123 --add-label "ready-for-review" fi
Code Review Integration
# Create review agents with gh CLI integration PR_FILES=$(gh pr view 123 --json files --jq '.files[].path') # Run swarm review REVIEW_RESULTS=$(npx ruv-swarm github pr-review 123 \ --agents "security,performance,style" \ --files "$PR_FILES") # Post review comments using gh CLI echo "$REVIEW_RESULTS" | jq -r '.comments[]' | while read -r comment; do FILE=$(echo "$comment" | jq -r '.file') LINE=$(echo "$comment" | jq -r '.line') BODY=$(echo "$comment" | jq -r '.body') gh pr review 123 --comment --body "$BODY" done
Advanced Features
1. Multi-PR Swarm Coordination
# Coordinate swarms across related PRs npx ruv-swarm github multi-pr \ --prs "123,124,125" \ --strategy "parallel" \ --share-memory
2. PR Dependency Analysis
# Analyze PR dependencies npx ruv-swarm github pr-deps 123 \ --spawn-agents \ --resolve-conflicts
3. Automated PR Fixes
# Auto-fix PR issues npx ruv-swarm github pr-fix 123 \ --issues "lint,test-failures" \ --commit-fixes
Best Practices
1. PR Templates
<!-- .github/pull_request_template.md --> ## Swarm Configuration - Topology: [mesh/hierarchical/ring/star] - Max Agents: [number] - Auto-spawn: [yes/no] - Priority: [high/medium/low] ## Tasks for Swarm - [ ] Task 1 description - [ ] Task 2 description
2. Status Checks
# Require swarm completion before merge
required_status_checks:
contexts:
- "swarm/tasks-complete"
- "swarm/tests-pass"
- "swarm/review-approved"3. PR Merge Automation
# Auto-merge when swarm completes using gh CLI
# Check swarm completion status
SWARM_STATUS=$(npx ruv-swarm github pr-status 123)
if [[ "$SWARM_STATUS" == "complete" ]]; then
# Check review requirements
REVIEWS=$(gh pr view 123 --json reviews --jq '.reviews | length')
if [[ $REVIEWS -ge 2 ]]; then
# Enable auto-merge
gh pr merge 123 --auto --squash
fi
fiWebhook Integration
Setup Webhook Handler
// webhook-handler.js
const { createServer } = require('http');
const { execSync } = require('child_process');
createServer((req, res) => {
if (req.url === '/github-webhook') {
const event = JSON.parse(body);
if (event.action === 'opened' && event.pull_request) {
execSync(`npx ruv-swarm github pr-init ${event.pull_request.number}`);
}
res.writeHead(200);
res.end('OK');
}
}).listen(3000);Examples
Feature Development PR
# P
An agent meta-harness for Claude Code and Codex. Agent = Model + Harness. The model writes; the harness gives it tools, memory, loops, sandboxes, and controls so it can actually work.
Repo: ruvnet/ruflo
Other agents on claude-flow.
- MIGRATION_SUMMARY
Complete migration plan for converting command-based system to intelligent agent-based system
Open agent - analyze-code-quality
Advanced code quality analysis agent for comprehensive code reviews and improvements
Open agent - code-analyzer
Advanced code quality analysis agent for comprehensive code reviews and improvements
Open agent - arch-system-design
Expert agent for system architecture design, patterns, and high-level technical decisions
Open agent - base-template-generator
Use this agent when you need to create foundational templates, boilerplate code, or starter configurations for new projects, components, or features. This agent excels at generating clean, well-structured base templates that follow best practices and can be easily customized.
Open agent - byzantine-coordinator
Coordinates Byzantine fault-tolerant consensus protocols with malicious actor detection
Open agent

