Pre-commit hooks for AI agents

Your pre-commit hooks run the same checks whether you commit or Claude does. That's the problem. Agents need thorough checks. Humans need fast feedback. Now you can have both.

cargo install agent-precommit
Human commits
~3s
Fast checks on staged files. Lint, format, type-check. You get feedback instantly and keep your flow.
Agent commits
~5m
Full test suite, security scans, build verification. The agent waits. You get merge-ready code that passes CI.

How it works

git commit
|
v
.git/hooks/pre-commit # installed by apc
|
v
detect commit source # env vars, TTY, process tree
|
+---> human ---> fast checks (staged files only)
|
+---> agent ---> thorough checks (parallel execution)
Claude Code Cursor Aider Cline Devin Codex

Features

Auto-detection

Recognizes agent environments automatically. No manual flags needed in most cases.

Pre-commit compatible

Wraps your existing .pre-commit-config.yaml. Keep your setup, add agent awareness.

Parallel execution

Agent checks run concurrently. Thorough doesn't have to mean slow.

Single binary

Written in Rust. No runtime dependencies. Ships as one executable.

Built-in checks

Tests, security scans, merge conflicts, build verification out of the box.

TOML config

Define checks, timeouts, parallel groups. Everything in one file.

Setup

# install
cargo install agent-precommit

# init config (detects your stack)
apc init --preset=rust

# install git hook
apc install

# add to your agent instructions (CLAUDE.md, .cursor/rules):
# "Use AGENT_MODE=1 git commit when committing"

Presets

Sensible defaults for common stacks.

python node rust go

Stop fixing CI in review.

View on GitHub