SuperAPIAI Directory

verify-gate-hook

github.com · AI coding

verify-gate-hook is a Stop hook for Claude Code: whenever Claude tries to end a turn, it runs a user-configured verification command; if the command fails, Claude receives the failure information and keeps working instead of stopping directly. The project is used to turn "give Claude a runnable check" from a prompt habit into a hook that executes every time. To install, place verify-gate.py in the project's .claude/hooks/ directory, add the configuration in .claude/settings.json, and write the check command into .claude/verify.txt. It has no effect when unconfigured; it is skipped when the Git working tree is clean or there have been no changes since the last pass; after 4 consecutive blocks, stopping is allowed; the default timeout is 300 seconds. It depends only on the Python 3 standard library, supports Windows, macOS, and Linux, is MIT licensed, and is not affiliated with Anthropic.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Windows · Linux

About this tool

Project address:https://github.com/elijahmanlockedin112/verify-gate-hook

Purpose verify-gate-hook is a Stop hook for Claude Code. Its goal is to run a verification command first when Claude tries to say "done" and end the turn; if the command does not pass, the failure result is handed back to Claude so it continues working. The project description notes that Anthropic's Claude Code best practices place "give Claude a runnable check" in an important position: asking for checks in the prompt works most of the time, while a hook can make it take effect every time.

Main capabilities

  • Execute the check command in .claude/verify.txt when Claude tries to end the turn, or use the LOCKED_IN_VERIFY environment variable when it is provided.
  • When the check fails, block the end and return the failure information to Claude so it continues working.
  • Have no effect when unconfigured; when there is no .claude/verify.txt or LOCKED_IN_VERIFY environment variable, do nothing and do not guess a command.
  • Skip when there are no changes: when the Git repository working tree is clean, or there have been no changes since the last pass, do not run the check repeatedly.
  • Prevent infinite loops: after 4 consecutive blocks, allow Claude to stop and prompt the user to run the command themselves; Claude Code itself also has corresponding limits.
  • Timeout control: default 300 seconds, modifiable via LOCKED_IN_VERIFY_TIMEOUT; a hanging command is terminated together with its child processes and treated as a failure.
  • Exception safety: any unexpected error exits cleanly and does not break the session.
  • Uses only the Python 3 standard library, and supports Windows, macOS, and Linux.

Usage

  1. Copy verify-gate.py to .claude/hooks/verify-gate.py in the project.
  2. Add the configuration in .claude/settings.json; the material does not show the specific JSON configuration content of this file, so it is not provided for now. The material notes that on Windows, use python instead of python3.
  3. Write a one-line check command in .claude/verify.txt. Examples include: pytest -q && ruff check .; go test ./... && go vet ./...; cargo test .
  4. Delete .claude/verify.txt to disable the gate.
  5. Checks can also be provided via the LOCKED_IN_VERIFY environment variable; the specific format for setting it is not covered in the materials and is not provided here.

Windows notes On Windows, the commands in verify.txt are run through cmd.exe, so double quotes should be used inside commands, not single quotes. The project provides a "Test it yourself" section, but the materials do not show the specific test steps or expected output, so they are not provided here.

Use cases Suitable for developers using Claude Code who want to force tests, lint, builds, or other verification commands to run before Claude ends a turn. Suitable for cases where checks need to be executed more reliably than prompts allow, reducing "ending without verification," and for projects that need a lightweight Python hook on Windows, macOS, and Linux.

Limitations and notes The hook does not infer verification commands on its own; it does nothing when not configured. Checks are skipped on a clean workspace or when there are no changes, so commands do not necessarily run at every turn end. After 4 consecutive blocks, it lets the turn proceed and prompts the user to run manually; Claude Code also has its own limits. The default timeout is 300 seconds, and hanging commands are terminated and counted as failures. The project is MIT licensed, is an independent project, and is not affiliated with Anthropic. The hook is part of Locked In Kit; the suite includes 18 skills, 6 subagents, 5 hooks, 8 CLAUDE.md templates, and the Locked In Method playbook, in which /lock-in can write specs and verification commands.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools