swarm: Command for Claude Code

.claude/commands/pr.md

pr is a command for Claude Code from swarm-ai-research/swarm. It costs 0 tokens per session (1,026 once invoked), scanned A, original, MIT.

A command that creates a feature branch, commits local changes, pushes them to GitHub, and opens a pull request against the main branch. A pull request is a request for others to review and merge changes.

In plain words
What is it for?
Use it for creating a new pull request from local changes or for cleaning up branches with the cleanup option.
Why use it?
It turns unreviewed local work into a reviewable GitHub change and can also clean up merged or stale remote branches.

Command for Claude Code

Written for Claude Code: installed under .claude/. 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/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 pr

README.md
[![agentmods](https://agentmods.dev/badge/commands/swarm-ai-research/swarm/pr.svg)](https://agentmods.dev/commands/swarm-ai-research/swarm/pr)
Your own site
<a href="https://agentmods.dev/commands/swarm-ai-research/swarm/pr"><img src="https://agentmods.dev/badge/commands/swarm-ai-research/swarm/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 1,026 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.00000 $0.01026
Opus 5 $0.00000 $0.00513
Sonnet 5 $0.00000 $0.00205
Haiku 4.5 $0.00000 $0.00103

Measured 7d ago against content hash 1cc1629fd86d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pr 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 7d 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.md · 102 lines

How it starts

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

/pr

Create a feature branch, commit staged/unstaged changes, push, and open a GitHub PR against main — use when you have local changes not yet on any branch and want a reviewable PR. Distinct from /ship (commit + push to current branch, no PR) and /fix_pr (resolve conflicts or run quality gates on an existing PR).

Also handles branch lifecycle cleanup via --cleanup.

Usage

/pr [branch-name] [commit message] /pr --cleanup

Examples:

  • /pr (auto-generates branch name and commit message from changes)
  • /pr fix/loader-crash
  • /pr add/track-b-pipeline "Add Track B research pipeline"
  • /pr --cleanup (delete all merged/stale remote branches)

Behavior

  1. Determine the starting point:
  • Detect worktree context: run git rev-parse --git-dir vs git rev-parse --git-common-dir. If they differ and the current branch starts with session/, you are in a session worktree.
  • Session worktree (session/* branch): do NOT git checkout main (it will fail because main is checked out in the main worktree). Instead: git fetch origin main.
  • Main worktree on main: git pull origin main as before.
  • Other branch: use it directly as the base for the feature branch.
  • If there are no uncommitted changes and no untracked files, abort with a message.
  1. Create and switch to a feature branch:
  • If <branch-name> is provided, use it.
  • Otherwise, generate one from the change summary (e.g. fix/pre-commit-scoped-lint).
  • Session worktree: git checkout -b <branch-name> origin/main (branch from remote main without switching to it).
  • Main worktree: git checkout -b <branch-name> (already on updated main).
  1. Stage changes:
  • Run git status to identify modified and untracked files.
  • Stage all modified and untracked files, but exclude: .DS_Store, *.db, files matching secret patterns (.env, credentials*).
  • Show the user what will be committed and confirm before proceeding.
  1. Commit:
  • If <commit message> is provided, use it.
  • Otherwise, analyze the diff and draft a concise commit message.
  • Always append Co-Authored-By: Claude Opus 4.6 <[email protected]>.
  • Use SKIP_SWARM_HOOKS=1 only if the hook itself is being modified (chicken-and-egg), otherwise let the hook run.

Read the full file on GitHub · 102 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. 7d ago First seen · 102 lines · 0 tokens per session scan A 1cc1629fd86d

Subscribe to this mod's changes

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 1,026 tokens. 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.