Local hooks
What the post-commit and pre-push hooks do, what blocks a push, and how to skip or bypass them.
cerebe install writes two git hooks, post-commit and pre-push. cerebe init
writes them too, for example in a teammate's clone or a new worktree. You do
not write or maintain them yourself. They are plain sh scripts with no Node
runtime and no Husky.
The hooks go where git runs hooks: .git/hooks/, or your core.hooksPath if
you set one. If you set core.hooksPath after installing, run cerebe init
again so the hooks are written to the new location. Another hook manager can
coexist, because cerebe init writes into whatever directory git resolves.
Each hook finds the cerebe binary in this order: the CEREBE_BIN environment
variable, an executable cerebe at the repository root, then PATH. If none is
found, the hook prints a message and exits without blocking.
The local critic is advisory. It is a fast inner loop before the pull request
exists, not the merge gate. The hosted cerebe/critic check is the gate, and it
runs a different panel, so a local pass does not guarantee a Platform pass.
post-commit: review in the background
After each commit, the hook runs cerebe review --commit <sha> in the
background, so committing stays instant. It never blocks a commit. The review's
output goes to the file git rev-parse --git-path cerebe-review.log names.
Run cerebe watch in another terminal to follow it. To skip one commit's
review:
CEREBE_SKIP_REVIEW=1 git commit -m "wip"With no critics enabled, the review writes
local review is off (no critics enabled) to that file and reviews nothing.
The pre-push gate then does not require a review, but its other conditions
below still apply.
pre-push: the gate
The hook runs cerebe gate-push --wait. It reads the review artifact for
HEAD, the commit you have checked out, and blocks the push when:
- a completed critic reported an unresolved finding at a severity in
aggregation.blockingSeverities(defaultblockerandhigh); - the commit has no review and
aggregation.blockOnMissingReviewis on. An empty fleet skips this check; - a critic ended in error and
aggregation.blockOnReviewErroris on (the default). A partial verdict counts as a missing one; - a verification route the change triggers has no passing evidence for this exact diff;
- the push adds or changes a generated runtime path under
cerebe/, such ascerebe/reviews/orcerebe/runs.ndjson. Deleting one is allowed.
--wait covers the usual case of pushing right after committing: while the
background review is still running, the gate waits for it to finish and then
gates on the real verdict. Waiting never passes a push on its own. If the review
does not finish in time, the missing-review rule applies.
Only the final commit of each push is gated. Earlier commits keep their own
review artifacts, which cerebe findings --range origin/main..HEAD lists.
Fix a finding
Fix it in a new commit. Do not amend. A verdict is bound to its commit's SHA and diff, so an amend detaches the evidence instead of clearing it, and the amended commit needs a review of its own.
Bypass the gate
When a push is blocked by something outside your change:
CEREBE_BYPASS="flaky upstream test, tracked in #123" git pushCEREBE_BYPASS is the name the gate reads. AGENT_REVIEW_BYPASS still works;
if both are set, CEREBE_BYPASS is recorded. An empty reason is refused.
cerebe stats lists every bypass. A bypass clears only the local hook.
It never clears cerebe/critic or any other required check.
What the critic reads
The critic reviews the commit's diff against your repository's rules: the files
in context.guidanceFiles (list AGENTS.md first) and any
context.promptFragments. For coding-session support, see
Load your guidance files.
Each critic runs in an isolated workspace with its own
home directory. Cerebe copies only that vendor's credential files into it, not
your harness settings, hooks, or MCP configuration.
To see exactly what a critic is sent, without calling any model:
cerebe packet show --critic claude
cerebe packet show --hash # just the SHA-256 of each critic's packetRead a review loop back
cerebe postmortem HEADpostmortem walks the review rounds behind a commit and reports which critic
raised the blocking findings each round, which findings survived unchanged, and
whether a different timeout, quorum, or missing-review setting would have
changed the loop. It changes nothing.