Turn ignored pre-review steps into hooks that block agent PRs

Hiroki Kondo found Claude Code ran a written local-review step in 1 of about 290 PR sessions on karasu, so he is moving those steps into hooks that refuse to mark a PR ready.

Done withClaude CodeinGitHub· Oct 25, 2026

What they did

Kondo builds karasu, a C4-style architecture modelling language, without writing code by hand: Claude Code opens every pull request, and CodeRabbit reviews them on GitHub. Each fix the agent pushed set off another CodeRabbit review, and at 2 reviews an hour PRs sat waiting about 38 minutes per round. He wrote a procedure for the agent: run a local code-review skill before leaving draft, then run the CodeRabbit CLI once (it has its own quota), and only then mark the PR ready. When the agent skipped the steps, he started turning them into Claude Code hooks: one that refuses `gh pr ready` until the local review has run, and one that hands straight over to working through CodeRabbit's findings once a PR is ready. He also replaced a session Stop hook with a lefthook pre-commit check that refuses commits on main.

How it went

Across the 37 CodeRabbit-reviewed PRs among the last 60 merged there were 80 reviews, 43 of them re-reviews, and re-reviews still caught 10 new findings on 5 PRs, so he kept them. The written step was mostly ignored: of about 290 sessions since October 1 that created or readied a PR, one ran the CLI, and the hand-off to CodeRabbit's findings ran in about 7 of 40 sessions, usually because he typed it. One hook is merged and the blocking one is in review, so there is no result for the hooks yet. The week still landed 50 merged PRs.

Worth knowing

Steps kept in an agent's memory note or a procedure file were not reliable; only something that runs on its own, like a hook or a Git hook, enforced them. The old Stop hook only reported problems at session end and once kept a session from exiting. Git hooks can still be bypassed with cherry-pick or --no-verify, which he recorded in an ADR.

Try it

With Claude Code· 7 parts to fill in

Agent sessions in [my repo] keep skipping the review steps I wrote down before a PR goes out: [step 1, e.g. run the local review skill] and [step 2, e.g. run the review CLI once]. Read how PRs are created and readied here, then propose hooks for [Claude Code or my agent tool] that enforce the steps: block [the command that marks a PR ready] until the steps have run on the current commit, and start [the follow-up step] right after it succeeds. Keep each hook small and give it a clear error message. Add a Git pre-commit hook that refuses commits on [main branch]. Show me the hook code and config and wait for my approval before installing anything.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related