auto-pr

A command for reviewing an open pull request, a proposed code change awaiting review, and merging it when its checks pass. It runs formatting, static checks, tests, project checks, and a dogfood check.

In plain words
What is it for?
Use it with a pull-request number to check out the proposed changes, inspect failures, fix code or project issues, rerun checks, and merge the request.
Why use it?
It gathers the main quality checks in one review process and identifies failures that must be fixed before merging. A clean result can complete the merge automatically.

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/cairn-framework/cairn/auto-pr
Clone the repo
git clone --depth 1 https://github.com/cairn-framework/cairn

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 759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00759
Opus 5 $0.00000 $0.00380
Sonnet 5 $0.00000 $0.00152
Haiku 4.5 $0.00000 $0.00076

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

Security

Grade A, and why

auto-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 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.

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/auto-pr.md · 80 lines

How it starts

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

/auto-pr — Review, fix, and merge an open PR

Review an open pull request, fix any quality gate failures, and merge when clean.

Usage

/auto-pr <pr-number>

Workflow

Phase 1: Assess

Run the assessment script to check out the PR and run all gates:

scripts/auto-pr.sh <pr-number>

This will:

  • Check out the PR branch
  • Run cargo fmt, clippy, test
  • Run cairn lint and cairn hook all
  • Run the dogfood gate

If all gates pass, the script will merge the PR automatically (squash + delete branch).

Phase 2: Review and Fix (if gates failed)

If any gate fails:

  1. Inspect failures: Read the gate output to understand what failed.
  2. Review the diff: Run git diff <base-branch>..HEAD to see the full change set.
  3. Fix issues:
    • cargo fmt failures → run cargo fmt
    • cargo clippy failures → fix the code; add #[allow(...)] with // Reason: comments only when justified
    • cargo test failures → fix the underlying code or test
    • cairn lint findings → fix blueprint/contract issues
    • cairn hook all findings → fix structural errors or update interface hashes with cairn scan
    • dogfood failures → usually cairn hook all or lint; fix the underlying issue
  4. Commit fixes: git add -A && git commit -m "fix: <concise description>"
  5. Push: git push
  6. Re-assess: Run scripts/auto-pr.sh <pr-number> --fix to re-run gates (does not merge).
  7. Loop: Repeat Phase 2 until all gates pass.

Phase 3: Merge

Once all gates pass, run:

scripts/auto-pr.sh <pr-number>

This will merge the PR with squash and delete the branch.

Safety rules (hard stops)

  • Do NOT proceed if the PR modifies .github/workflows/, Cargo.toml, or scripts/dogfood.sh. Escalate to the user.
  • Do NOT proceed if the PR has >30 files changed or >1000 total lines changed. Escalate to the user.
  • Do NOT proceed if the PR is a draft or from a fork.
  • Do NOT proceed if you cannot understand or fix a test failure. Escalate to the user.

Read the full file on GitHub · 80 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 · 80 lines · 0 tokens per session scan A 3a881d9860b9

Subscribe to this mod's changes

auto-pr is a command published in the GitHub repository cairn-framework/cairn (40 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 759 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.