Summary
code-review-graph install (v2.3.2, skills.py → generate_hooks_config()) writes Claude Code hooks into .claude/settings.json that have two issues:
1. No install/PATH guard
The generated hooks call the bare binary:
{ "type": "command", "command": "code-review-graph update --skip-flows", "timeout": 30 }
When the package is installed in a project virtualenv (the common case), the binary is not on the PATH that Claude Code's /bin/sh sees, so every Edit/Write/Bash tool call surfaces:
PostToolUse:Edit hook error
Failed with non-blocking status code: /bin/sh: 1: code-review-graph: not found
Notably, the git pre-commit hook installed by the very same install command already does this correctly:
if command -v code-review-graph >/dev/null 2>&1; then
code-review-graph detect-changes --brief || true
fi
The Claude Code hooks just lack the same guard. Suggested fix in generate_hooks_config() — resolve the project venv binary first and exit silently when absent:
CRG="$CLAUDE_PROJECT_DIR/.venv/bin/code-review-graph"; command -v "$CRG" >/dev/null 2>&1 || CRG=code-review-graph; command -v "$CRG" >/dev/null 2>&1 || exit 0; "$CRG" update --skip-flows
2. Matcher is too broad
"matcher": "Edit |Write|Bash" means the graph update runs after every shell command — git status, ls, test runs, everything — not just file changes. Edit|Write covers the cases where the graph can actually become stale from within Claude Code; if Bash-driven file mutations are a concern, a scoped if filter (e.g. on git mutation commands) would be far cheaper than firing on all of Bash.
Environment
- code-review-graph 2.3.2 (PyPI), installed in a project venv
- Claude Code on Linux (WSL2), hooks executed via /bin/sh
Happy to provide more detail if useful.
Summary
code-review-graph install(v2.3.2,skills.py→generate_hooks_config()) writes Claude Code hooks into.claude/settings.jsonthat have two issues:1. No install/PATH guard
The generated hooks call the bare binary:
{ "type": "command", "command": "code-review-graph update --skip-flows", "timeout": 30 }When the package is installed in a project virtualenv (the common case), the binary is not on the PATH that Claude Code's
/bin/shsees, so every Edit/Write/Bash tool call surfaces:Notably, the git pre-commit hook installed by the very same
installcommand already does this correctly:The Claude Code hooks just lack the same guard. Suggested fix in
generate_hooks_config()— resolve the project venv binary first and exit silently when absent:2. Matcher is too broad
"matcher": "Edit |Write|Bash"means the graph update runs after every shell command —git status,ls, test runs, everything — not just file changes.Edit|Writecovers the cases where the graph can actually become stale from within Claude Code; if Bash-driven file mutations are a concern, a scopediffilter (e.g. on git mutation commands) would be far cheaper than firing on all of Bash.Environment
Happy to provide more detail if useful.