pre-commit-reviewer

pre-commit-reviewer is an agent for coding agents from costajohnt/oss-autopilot. It costs 67 tokens per session (2,772 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

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

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 agents/costajohnt/oss-autopilot/pre-commit-reviewer
Clone the repo
git clone --depth 1 https://github.com/costajohnt/oss-autopilot

Or install oss-autopilot, the plugin that ships this one along with the rest of its 3 skills, 8 commands, 7 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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 67 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,772 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.1 $0.00067 $0.02772
Opus 5 $0.00034 $0.01386
Sonnet 5 $0.00013 $0.00554
Haiku 4.5 $0.00007 $0.00277

Measured 5d ago against content hash 2e7dc89a29b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 5d 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 · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 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 · 218 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. 5d 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 (12 stars, last pushed 3d ago), licensed MIT. It adds 67 tokens to every session and 2,772 once invoked, about $0.0003 per session on Opus 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.