Summary
On a clean v0.7.0 install -y --standard (and update), the Claude Code PreToolUse hook written to ~/.claude/hooks/cbm-code-discovery-gate is the old blocking shell gate (exit 2, gate file keyed on bare $PPID) — not the non-blocking augmenter shipped in the binary (src/cli/hook_augment.c, commit c29e6d5). So the exact symptom of #214 returns on every install/update, even though #214 is marked fixed in v0.7.0.
Why it misbehaves (same root as #214)
$PPID is the shell spawned for each hook invocation, so it rotates per tool call. The gate file /tmp/cbm-code-discovery-gate-$PPID therefore never matches a prior one → the "first call per session" check is always true → every Grep/Glob/Read is blocked with exit 2, not just the first.
The installed hook (v0.7.0):
#!/bin/bash
# Gate hook: nudges Claude toward codebase-memory-mcp for code discovery.
# First Grep/Glob/Read/Search per session -> block. Subsequent -> allow.
# PPID = Claude Code process PID, unique per session.
GATE=/tmp/cbm-code-discovery-gate-$PPID
...
touch "$GATE"
echo 'BLOCKED: ...' >&2
exit 2
Repro
codebase-memory-mcp install -y --standard (or update) on v0.7.0, Linux, Claude Code.
- In a session, issue several
Read/Grep calls.
- Each is blocked by the gate (not nudged once) — the
claude process reads the hook fresh each call and $PPID differs every time.
Expected
install/update should wire the non-blocking augmenter (the hook_augment path that's already in the binary), so Read is no longer gated and the nudge is emitted at most once per session — the behaviour #214 was closed as delivering.
Note
The binary genuinely has the fix; this is a packaging/install gap — the install template still emits the legacy blocking script. A session_id-keyed (from the PreToolUse stdin JSON) non-blocking augmenter that exit 0s avoids both the $PPID rotation and any ps/process-name assumptions.
Environment
- v0.7.0, Linux (cgroup v2), Claude Code, standard stdio variant.
Summary
On a clean v0.7.0
install -y --standard(andupdate), the Claude Code PreToolUse hook written to~/.claude/hooks/cbm-code-discovery-gateis the old blocking shell gate (exit 2, gate file keyed on bare$PPID) — not the non-blocking augmenter shipped in the binary (src/cli/hook_augment.c, commit c29e6d5). So the exact symptom of #214 returns on every install/update, even though #214 is marked fixed in v0.7.0.Why it misbehaves (same root as #214)
$PPIDis the shell spawned for each hook invocation, so it rotates per tool call. The gate file/tmp/cbm-code-discovery-gate-$PPIDtherefore never matches a prior one → the "first call per session" check is always true → every Grep/Glob/Read is blocked withexit 2, not just the first.The installed hook (v0.7.0):
Repro
codebase-memory-mcp install -y --standard(orupdate) on v0.7.0, Linux, Claude Code.Read/Grepcalls.claudeprocess reads the hook fresh each call and$PPIDdiffers every time.Expected
install/updateshould wire the non-blocking augmenter (thehook_augmentpath that's already in the binary), so Read is no longer gated and the nudge is emitted at most once per session — the behaviour #214 was closed as delivering.Note
The binary genuinely has the fix; this is a packaging/install gap — the install template still emits the legacy blocking script. A
session_id-keyed (from the PreToolUse stdin JSON) non-blocking augmenter thatexit 0s avoids both the$PPIDrotation and anyps/process-name assumptions.Environment