Guide / Before you commit

AI code review before you commit or open a pull request.

Pre-commit as a point in your workflow, not a hook.

Yes, you can review a change with AI before it reaches a pull request, and it is the cheapest place to find a bug: the author still has the context, and no reviewer's time has been spent. Run the review when the change is finished, on your machine, against the working tree or the branch.

Pre-commit here means that point in the workflow. It does not mean a Git pre-commit hook. A review that writes and runs tests takes minutes and costs model calls. A hook runs on every commit and should finish in seconds.

Why not a Git pre-commit hook?

What does fit a hook or a CI job is rerunning tests you already accepted. That makes no model calls. See below.

What gets reviewed

With arnx, arnx review looks at what a pull request would show:

Uncommitted work means tracked files: staged and unstaged changes, and new files once you git add them. Untracked files are left out, and the review says how many. --untracked includes them. So you can review before the commit exists. Staging is enough.

A change of documentation only is skipped with exit 0. arnx review --docs reviews it anyway. Lockfiles and generated files do not count toward the 200 KB limit and are not in the diff sent to models.

A workflow that fits before the commit

Change finished, not yet committed
git add path/to/new_file.py
arnx review
arnx triage
arnx accept
arnx prompt
# fix the code, or hand the prompt to your agent
arnx check
git commit
  1. Review once per finished change, not per edit. The first review in a repository also sets up the projects the change touches, in at most 10 minutes.
  2. Triage while the change is fresh. You know what you meant the code to do, which is the one thing the tool cannot know.
  3. Commit the fix together with .arnx/tests/ and .arnx/accepted-tests.json. Reviewers of the pull request then see the bug's test next to its fix.

The pull request still gets its normal review, by people or by a PR-based tool. The two do different jobs. See arnx and CodeRabbit and arnx and Greptile.

The cheap step: arnx check, locally and in CI

arnx check runs the accepted tests in Docker, in a throwaway copy of the repository, with no model calls. That makes it the step to repeat: after each fix, before each push, and in CI if your runner has Docker.

arnx check exit codes
Exit Meaning
0 All accepted tests pass
1 Some accepted tests fail
2 Some tests did not report, are unproven or were not run
3 Nothing accepted yet
4 An accepted test changed since accept; nothing ran

Commit .arnx/config.toml, .arnx/review.yaml and .arnx/baseline.json so teammates and CI reuse the environment that was proven on your machine. If you gate CI on arnx review instead, read result in arnx review --json: exit 0 does not mean no findings. Confirmed findings are reported and do not fail the run. Exit 1 means a finding the second opinion could not check, 2 incomplete, 3 setup needed.

Limits and trade-offs

Try it: install arnx, or run the checkout demo, where the discount-codes branch is a ready-made unmerged change. Costs are covered in the quickstart.

Last reviewed 2026-11-12 against arnx 0.1.11. The release documentation is canonical for your installed version.