AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Oct 26, 2026, 01:00 JST

Claude Code gets a one-time review gate before it stops

Send on LINE
Claude Code gets a one-time review gate before it stops

3 Key Points

  1. What happened

    The developer wired a Stop hook, Hook-CodexGate.js, that reads the conversation log and blocks Claude Code once if changes were made without a successful Codex review — then fixed misjudgments reproduced on 2026年9月24日, growing tests from 26 to 43.

  2. Why it matters

    The gate is not enforcement but a reminder for when the AI forgets a written rule, and its fixes — showing only changes made after the last Codex pass and waiting for the completion notice rather than the launch — suggest such reminders misfire unless they read the log's exact strings and order.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The rule the developer started from was simple: after implementing, have a different AI review the work. Written down as prose, it was not followed, so the rule became a Stop hook (Hook-CodexGate.js) that reads the conversation log and returns decision: block once with a reason. The gate counts file edits and writes, shell rewrites, and requests to implementation subagents as changes, while leaving HANDOFF.md, memory files and temp folders out. Only a successful Codex command counts as a review, and a stop already blocked once is always let through, so the loop cannot spin.

The misjudgments the developer reproduced on 2026年9月24日 all came from reading the log too loosely. The list of changes shown on a block covered the whole conversation rather than only what came after the last Codex pass. A background Codex run counted as done at launch, so the fix was to judge by the completion notice and to ignore notices quoted inside tool output. The phrase "usage limit" appearing in the gate's own text made it look satisfied, so the fix was to count only the limit display from the script that calls Codex. Together with the token cost of stacking block messages, these point at the same lesson: a deterministic check over log strings and order is only as good as the spans it reads.

The second problem was parallel hooks. A completion-notice hook and the gate hook do not know each other's results, so completion could fire while the gate was still blocking. The developer's answer was a shared StopVerdict.js component that dry-runs the three gates (Codex, quality, Japanese) with a 12-second cutoff and withholds completion while background work has no end notice yet. Some Codex review findings were adopted; a rare case where background work longer than 3 hours could yield early completion was not.

FAQ
How do you skip the review without tripping the gate?
Write a standalone line "【Codex省略: reason】" in the final reply, or turn the gate off in settings. The developer says the gate is a one-time reminder, not a forced review.
What counts as a change and as passing Codex?
Edits and writes, shell rewrites such as Set-Content and sed -i, and requests to implementation subagents count as changes. Only a successful run of a command like Invoke-Codex.ps1, New-CodexReview.ps1 or codex exec counts as passing Codex.
What went wrong when it was first run?
Already-reviewed commits were counted as unreviewed changes, a background Codex run counted as done just from being launched, and the word "usage limit" in the gate's own text made it look like a review had passed.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleAI wearables roundup: Bee, Friend, Muse Charm and more