metaswarm: Command for Claude Code

.claude/commands/pr-shepherd.md

pr-shepherd is a command for Claude Code from dsifry/metaswarm. It costs 16 tokens per session (659 once invoked), scanned A, original, MIT.

A command that watches a GitHub pull request, which is a proposed set of code changes, until it is ready to merge. It checks automated tests, reviews, comments, and unresolved discussion threads.

In plain words
What is it for?
Use it to monitor CI results, find new review comments, fix simple linting or formatting errors, respond to review issues, and resolve routine pull-request problems.
Why use it?
It keeps track of the pull request after it is opened and handles routine problems without requiring repeated manual checks.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is dsifry/metaswarm's own configuration. It tells Claude Code how to work on metaswarm itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything metaswarm configures →

Part of the metaswarm plugin — 15 skills, 16 commands, 31 agents, 3 hooks shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to dsifry/metaswarm. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dsifry/metaswarm/main/.claude/commands/pr-shepherd.md
Clone the repo
git clone --depth 1 https://github.com/dsifry/metaswarm

Made for: Claude Code.

Or install metaswarm, the plugin that ships this one along with the rest of its 15 skills, 16 commands, 31 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pr-shepherd

README.md
[![agentmods](https://agentmods.dev/badge/commands/dsifry/metaswarm/pr-shepherd/github.svg)](https://agentmods.dev/commands/dsifry/metaswarm/pr-shepherd)
Your own site
<a href="https://agentmods.dev/commands/dsifry/metaswarm/pr-shepherd"><img src="https://agentmods.dev/badge/commands/dsifry/metaswarm/pr-shepherd/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pr-shepherd

Your own site · 80×15
<a href="https://agentmods.dev/commands/dsifry/metaswarm/pr-shepherd"><img src="https://agentmods.dev/badge/commands/dsifry/metaswarm/pr-shepherd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 659 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00016 $0.00659
Opus 5.5 $0.00006 $0.00264
Sonnet 5.5 $0.00003 $0.00132
Haiku 4.5 $0.00002 $0.00066

Measured 4d ago against content hash 00c3bda84526, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pr-shepherd scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/pr-shepherd.md · 77 lines

How it starts

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

PR Shepherd

Monitor a PR from creation through merge, handling CI failures, review comments, and thread resolution automatically.

Usage

/pr-shepherd [pr-number]

If no PR number is provided, uses the PR associated with the current branch.

What This Does

  1. Monitors CI/CD - Polls every 60 seconds for status changes
  2. Monitors Reviews - Watches for new comments and unresolved threads
  3. Auto-fixes simple issues - Lint, prettier, type errors
  4. Asks before complex fixes - Presents a decision request for approval: lettered options (A, B, C) under numbered questions (reply 1 A 2 C), each with its pros and cons, the recommended option marked, and why it is recommended (see Decision requests in the metaswarm plugin's guides/delivery-scope.md)
  5. Handles review comments - Delegates to handling-pr-comments skill
  6. Checkpoints at 4 hours - Asks if you want to continue or handoff

Steps

  1. Get PR information:

    PR_NUMBER=${1:-$(gh pr view --json number -q .number 2>/dev/null)}
    if [ -z "$PR_NUMBER" ]; then
      echo "No PR found. Provide PR number: /pr-shepherd 123"
      exit 1
    fi
    
  2. Activate the pr-shepherd skill: Load and follow the pr-shepherd skill definition.

  3. Begin monitoring loop (background, every 60s):

    • Check CI status
    • Check for new review comments
    • Check unresolved thread count
    • Take action based on state machine
  4. Handle issues as they arise:

    • Simple CI failures -> auto-fix with TDD
    • Complex failures -> present a decision request (lettered options, pros/cons, recommended and why; Decision requests in guides/delivery-scope.md); only the blocked failure waits for approval, and monitoring and review-comment handling continue meanwhile
    • New comments -> invoke handling-pr-comments skill
  5. Exit when done:

    • All CI green AND all threads resolved -> report success
    • 4-hour timeout -> checkpoint with user

Example

/pr-shepherd 695

> I'm using the pr-shepherd skill to monitor PR #695 through to merge.
> I'll watch CI/CD, handle review comments, and fix issues as they arise.
>
> Current status:
> - CI: Running (2/5 checks complete)
> - Threads: 0 unresolved
>
> Monitoring... (will check every 60 seconds)

Read the full file on GitHub · 77 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. 4d ago Changed 00c3bda84526
  2. 3mo ago First seen · 77 lines · 16 tokens per session scan A 374a47d14fae

Subscribe to this mod's changes

pr-shepherd is a command published in the GitHub repository dsifry/metaswarm (442 stars, last pushed yesterday), licensed MIT. It adds 16 tokens to every session and 659 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

pr-shepherd compared with commands from other repositories

pr-shepherd next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pr-shepherddsifry/metaswarmCommand442yesterdayMITA16Claude Code
merge-conflict-analysisrjmurillo/ai-agentsCommand50todayApache-2.0A0GitHub Copilot
release-notesOpenHands/extensionsCommand190todayMITA44Claude Code
commitechoVic/blade-codeCommand18116d agoMITA8Claude Code
repo-audittractorjuice/arc-kitCommand2.3kyesterdaynoneA29Claude Code
codex-reviewoalders/kitchen-sinkCommand5todayMITA41Claude Code
releaseparuff/uFawkesAICommand2yesterdayMITA39Claude Code