Hook contract

Updated Jul 21, 2026

The console script is:

post-turn-quality-stop-hook

The command reads Claude Code's stop-hook JSON payload from standard input. The payload may include a cwd field. Repository discovery uses this order:

  1. The payload cwd, when present and non-empty.
  2. The CLAUDE_PROJECT_DIR environment variable, when present and non-empty.
  3. The process current working directory.

Invalid or missing JSON is treated as an empty payload. If the selected working directory is not inside a Git repository, the hook exits successfully and prints nothing. That keeps stop-hook behaviour quiet for unrelated invocations.

The hook follows Claude Code's blocking contract:

  • Successful checks print nothing and exit with status 0.
  • Failed checks print JSON with {"decision": "block", "reason": "..."} and also exit with status 0.

The command accepts one CLI option:

post-turn-quality-stop-hook --config /path/to/config.toml

An explicit config file has the highest precedence. Invalid CLI arguments are reported as a blocking JSON payload and still exit with status 0.