cairn: Command for Claude Code

.claude/commands/auto-pr.md

auto-pr is a command for Claude Code from cairn-framework/cairn. It costs 0 tokens per session (759 once invoked), scanned A, original, Apache-2.0.

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

Written for Claude Code: installed under .claude/.

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

Reuse

Borrowing it

Nothing to install: this file belongs to cairn-framework/cairn. 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/cairn-framework/cairn/main/.claude/commands/auto-pr.md
Clone the repo
git clone --depth 1 https://github.com/cairn-framework/cairn

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/cairn-framework/cairn/auto-pr/github.svg)](https://agentmods.dev/commands/cairn-framework/cairn/auto-pr)
Your own site
<a href="https://agentmods.dev/commands/cairn-framework/cairn/auto-pr"><img src="https://agentmods.dev/badge/commands/cairn-framework/cairn/auto-pr/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 auto-pr

Your own site · 80×15
<a href="https://agentmods.dev/commands/cairn-framework/cairn/auto-pr"><img src="https://agentmods.dev/badge/commands/cairn-framework/cairn/auto-pr.svg" alt="Reviewed on agentmods" width="80" 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 759 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.00759
Opus 5.5 $0.00000 $0.00304
Sonnet 5.5 $0.00000 $0.00152
Haiku 4.5 $0.00000 $0.00076

Measured 2mo ago against content hash 3a881d9860b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (53 stars, last pushed yesterday), 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.

Related

auto-pr compared with commands from other repositories

auto-pr next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
auto-prcairn-framework/cairnCommand53yesterdayApache-2.0A0Claude Code
speckit.spex.submitrhuss/cc-spexCommand1223d agoApache-2.0A15Claude Code
merge-conflict-analysisrjmurillo/ai-agentsCommand49yesterdayMITA0GitHub Copilot
gitazrtydxb/procoderCommand21111d agoApache-2.0A20Claude Code
factoryfelvieira/claude-skills-fvCommand282d agoApache-2.0A47Claude Code
repo-audittractorjuice/arc-kitCommand2.3k2d agononeA29Claude Code
advanced-code-review-contextaxiomantic/spellbookCommand112d agoMITA19Claude Code