Hooks should be fast, deterministic and identical for humans and agents.
The decision behind the technique
Codex can remember to run checks, but an executable gate is more reliable than a reminder. Pre-commit is best for cheap checks; expensive integration tests still belong elsewhere.
Hooks should be fast, deterministic and identical for humans and agents.
A practical step-by-step workflow
Use this sequence as a default, then tighten or expand it only when the evidence changes.
- Select formatting, lint and secret checks that finish quickly
- Pin tool versions
- Run all hooks once before enabling them
- Keep CI as the final independent enforcement layer
Failure boundary and finish line
Do not place slow or flaky network tests in a hook that developers will learn to bypass.
Finish when another person can reproduce the check against the exact final state.
Frequently asked questions
What should I do first?+
Select formatting, lint and secret checks that finish quickly
What is the main failure mode?+
Do not place slow or flaky network tests in a hook that developers will learn to bypass.
OFFICIAL SOURCES
Verify against the source
pre-commit documentationThis guide provides general information, not an OpenAI allowance promise or support decision. Your account and official pages govern actual usage, benefits and recovery times.