You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v0.7.0 install/update wires the legacy blocking PreToolUse gate, not hook_augment (regresses #214) #409
On a clean v0.7.0install -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.
$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: ...'>&2exit 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.
Thanks for the detailed write-up — the $PPID analysis is spot-on for the old gate.
I'm having trouble reproducing this on a clean v0.7.0. On main (and in v0.7.0, which already contains the augmenter fix c29e6d5), both install and update write ~/.claude/hooks/cbm-code-discovery-gate as the non-blocking augmenter shim, not the old gate:
No $PPID, no exit 2; settings.json's PreToolUse command points at that script; the file is written with fopen(..., "w") (truncate, so it overwrites any older gate); and a regression test guards it (cli_hook_gate_script_no_predictable_tmp_issue384 — asserts no PPID, delegates to hook-augment).
To pin down what's different in your environment, could you share:
The verbatim contents of your installed ~/.claude/hooks/cbm-code-discovery-gate.
codebase-memory-mcp --version.
The PreToolUse block (matcher + command) from ~/.claude/settings.json.
Was this a fresh install or an upgrade from a pre-v0.7.0 version (roughly which)?
Leading suspicion: a stale PreToolUse entry in settings.json from an older install still pointing at an inline/$PPID gate rather than the rewritten shim — (3) + (4) would confirm it.
This is fixed. The installer now wires the non-blockinghook-augment shim rather than the legacy blocking PreToolUse gate, and the gate-script writer truncates and rewrites the non-blocking content on upgrade (so a stale blocking script from a pre-0.7.0 install is replaced). We've added a regression guard for the upgrade/overwrite path specifically.
Closing as fixed — reopen if a fresh install or upgrade still wires a blocking gate for you. Thanks!
Activity
DeusData commentedon Jun 6, 2026
Thanks for the detailed write-up — the
$PPIDanalysis is spot-on for the old gate.I'm having trouble reproducing this on a clean
v0.7.0. Onmain(and inv0.7.0, which already contains the augmenter fixc29e6d5), bothinstallandupdatewrite~/.claude/hooks/cbm-code-discovery-gateas the non-blocking augmenter shim, not the old gate:No
$PPID, noexit 2;settings.json'sPreToolUsecommand points at that script; the file is written withfopen(..., "w")(truncate, so it overwrites any older gate); and a regression test guards it (cli_hook_gate_script_no_predictable_tmp_issue384— asserts noPPID, delegates tohook-augment).To pin down what's different in your environment, could you share:
~/.claude/hooks/cbm-code-discovery-gate.codebase-memory-mcp --version.PreToolUseblock (matcher +command) from~/.claude/settings.json.v0.7.0version (roughly which)?Leading suspicion: a stale
PreToolUseentry insettings.jsonfrom an older install still pointing at an inline/$PPIDgate rather than the rewritten shim — (3) + (4) would confirm it.test(repro): install/UX reproductions for #570, #409, #431
DeusData commentedon Jun 26, 2026
This is fixed. The installer now wires the non-blocking
hook-augmentshim rather than the legacy blockingPreToolUsegate, and the gate-script writer truncates and rewrites the non-blocking content on upgrade (so a stale blocking script from a pre-0.7.0 install is replaced). We've added a regression guard for the upgrade/overwrite path specifically.Closing as fixed — reopen if a fresh install or upgrade still wires a blocking gate for you. Thanks!