swarm: Command for Claude Code

.claude/commands/fix_pr.md

fix_pr is a command for Claude Code from swarm-ai-research/swarm. It costs 0 tokens per session (2,317 once invoked), scanned C, original, MIT.

A command for working with GitHub pull requests, which are proposed code changes submitted for review. It can create a pull request, resolve conflicts, merge one, or review it with quality checks.

In plain words
What is it for?
Use it to submit local changes, repair or merge an existing pull request, or check out a pull request, run quality gates, apply fixes, and report the results.
Why use it?
It brings several pull-request tasks into one command instead of requiring separate steps for branches, conflicts, merging, testing, and fixes.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions Claude Code.

This is swarm-ai-research/swarm's own configuration. It tells Claude Code how to work on swarm 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 swarm configures →

Reuse

Borrowing it

Nothing to install: this file belongs to swarm-ai-research/swarm. 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/swarm-ai-research/swarm/main/.claude/commands/fix_pr.md
Clone the repo
git clone --depth 1 https://github.com/swarm-ai-research/swarm

Made for: Claude Code.

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 fix_pr

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/fix_pr.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/fix_pr)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/fix_pr"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/fix_pr.svg" alt="Measured on agentmods" height="20"></a>
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 2,317 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00000 $0.02317
Opus 5 $0.00000 $0.01158
Sonnet 5 $0.00000 $0.00463
Haiku 4.5 $0.00000 $0.00232

Measured 8d ago against content hash f5872774dc34, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade C, and why

fix_pr scanned grade C 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 8d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- If a `/tmp/fix-pr-*` clone was created, remove it: `rm -rf /tmp/fix-pr-<pr_number>`.
.claude/commands/fix_pr.md · 205 lines

How it starts

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

/fix_pr

Multi-mode PR operations: create a PR from local changes, resolve merge conflicts on an existing PR, or run quality gates on an external PR. Consolidates the former /review_external_pr command (now /fix_pr --review).

Usage

/fix_pr [branch-name]                          # Mode A: create PR from local changes
/fix_pr <pr-number-or-url> [fix|merge]          # Mode B: resolve conflicts / merge existing PR
/fix_pr --review <pr-number>                    # Mode C: run quality gates on a PR

Examples:

  • /fix_pr (auto-generates branch name from changes)
  • /fix_pr fix/circuit-breaker-reset
  • /fix_pr 239 (resolve conflicts on PR #239)
  • /fix_pr https://github.com/swarm-ai-research/swarm/pull/239 merge (resolve conflicts and merge)
  • /fix_pr 239 merge (resolve + merge)
  • /fix_pr --review 220 (check out PR, run quality gates, auto-fix, report)

Argument parsing

Parse $ARGUMENTS to extract:

  • --review: Quality gate review mode (Mode C)
  • If first non-flag arg is a number or GitHub PR URL → Mode B (conflict resolution)
  • Otherwise → Mode A (create PR from local changes)

Mode A: Create PR from Local Changes

Unlike /pr which expects you to describe what changed, this mode is for when you've already made edits and just want to ship them on a clean branch.

Behavior

  1. Sanity check:

    • Run git status to identify modified and untracked files.
    • If there are no changes, abort with a message.
  2. Identify relevant files:

    • Show the user the list of modified/untracked files.
    • Ask which files to include if it's ambiguous (e.g. mix of unrelated changes).
    • Exclude: .DS_Store, *.db, .env*, credentials*.
  3. Create a clean branch:

    • Stash all changes: git stash push --include-untracked -m "fix_pr: temp stash".
    • Ensure main is up to date: git checkout main && git pull origin main (skip if in a session worktree — use git fetch origin main and branch from origin/main instead).
    • Create the feature branch: git checkout -b <branch-name> (or git checkout -b <branch-name> origin/main in a worktree).
    • Pop the stash: git stash pop.

Read the full file on GitHub · 205 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. 8d ago First seen · 205 lines · 0 tokens per session scan C f5872774dc34

Subscribe to this mod's changes

fix_pr is a command published in the GitHub repository swarm-ai-research/swarm (41 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,317 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.