pre-commit-reviewer

pre-commit-reviewer is an agent for Claude Code from costajohnt/oss-autopilot. It costs 243 tokens per session (2,884 once invoked), scanned A, original, MIT.

An agent that reviews code changes before they are committed and pushed to an open-source pull request, a proposed code change for a project.

In plain words
What is it for?
Use it for standalone pre-commit reviews or as a fallback when pull-request review tools are unavailable.
Why use it?
It helps catch bugs, style problems, unused code, missing tests, and conflicts with the repository's conventions before submission.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; names the AskUserQuestion tool.

Part of the oss-autopilot plugin — 3 skills, 9 commands, 8 agents, 2 MCP servers shipped together

Good fit Use it for standalone pre-commit reviews or as a fallback when pull-request review tools are unavailable.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/costajohnt/oss-autopilot/pre-commit-reviewer
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.

Clone the repo
git clone --depth 1 https://github.com/costajohnt/oss-autopilot

Made for: Claude Code.

Or install oss-autopilot, the plugin that ships this one along with the rest of its 3 skills, 9 commands, 8 agents, 2 MCP servers.

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 pre-commit-reviewer

README.md
[![agentmods](https://agentmods.dev/badge/agents/costajohnt/oss-autopilot/pre-commit-reviewer/github.svg)](https://agentmods.dev/agents/costajohnt/oss-autopilot/pre-commit-reviewer)
Your own site
<a href="https://agentmods.dev/agents/costajohnt/oss-autopilot/pre-commit-reviewer"><img src="https://agentmods.dev/badge/agents/costajohnt/oss-autopilot/pre-commit-reviewer/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 pre-commit-reviewer

Your own site · 80×15
<a href="https://agentmods.dev/agents/costajohnt/oss-autopilot/pre-commit-reviewer"><img src="https://agentmods.dev/badge/agents/costajohnt/oss-autopilot/pre-commit-reviewer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 243 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,884 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 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.00243 $0.02884
Opus 5.5 $0.00097 $0.01154
Sonnet 5.5 $0.00049 $0.00577
Haiku 4.5 $0.00024 $0.00288

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

Security

Grade A, and why

pre-commit-reviewer scanned grade A 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- **Injection:** string concat passed to `child_process` or shell; string concat in SQL; unescaped user input rendered as HTML
agents/pre-commit-reviewer.md · 220 lines

How it starts

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

Input validation: See "AskUserQuestion Validation Protocol" in workflows/reference.md.

You are a Pre-Commit Code Reviewer for open source contributions. Your job is to catch issues BEFORE code is committed and pushed to a PR.

Phase Execution Order

The phases below have this dependency graph (#1274 Improvement 2):

Phase 1 ──► Phase 2 ──► Phase 3 ──► Phase 5 ──► Phase 6
        ├─► Phase 2.5 ─────────────► (joins at Phase 5)
        ├─► Phase 4 ───────────────► (joins at Phase 5)
        └─► Phase 4.5 ─────────────► (joins at Phase 5)

Phase 1 must complete first (every other phase reads its outputs). After Phase 1 is done, fan out: run Phase 2, Phase 2.5, Phase 4, and Phase 4.5 concurrently — they read the diff and repo state but do not depend on each other. Phase 3 starts after Phase 2 completes (it consumes the convention-detection findings). Phase 5 waits on all of 2 / 2.5 / 3 / 4 / 4.5 before assembling the report. Phase 6 is sequential after Phase 5.

Concrete tactic for the fan-out: interleave the four phases within this session rather than walking them strictly in order — read the diff once, then form findings for all four categories (conventions, security, tests, docs) before producing Phase 5.

The numbering stays sequential below for backwards compatibility with prior references — read it as a logical structure, not a strict execution order.

Phase 1: Context Gathering

git rev-parse --is-inside-work-tree   # verify inside a repo

If that fails: tell the user this directory isn't a git repo and stop.

Gather the change state:

git diff               # unstaged
git diff --cached      # staged
git status --porcelain

If all three are empty, check for committed-but-not-pushed changes:

git log --oneline @{upstream}..HEAD 2>/dev/null \
  || git log --oneline origin/$(git rev-parse --abbrev-ref HEAD)..HEAD 2>/dev/null \
  || git log --oneline origin/main..HEAD 2>/dev/null

If this shows commits, save the working range as diffRange (the first of the three above that succeeded) and use git diff $diffRange throughout. If all three fail, ask the user for the base branch. If nothing at all, report "no changes to review" and stop.

Read the full file on GitHub · 220 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 Changed · +1 lines 40d291d7b295
  2. 1mo ago Changed · +1 lines · +176 tokens per session fc74d812ec42
  3. 1mo ago First seen · 218 lines · 67 tokens per session scan A 2e7dc89a29b0

Subscribe to this mod's changes

pre-commit-reviewer is an agent published in the GitHub repository costajohnt/oss-autopilot (22 stars, last pushed yesterday), licensed MIT. It adds 243 tokens to every session and 2,884 once invoked, about $0.0010 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.