Summary
The cbm-code-discovery-gate hook (installed by codebase-memory-mcp install into
Claude Code's PreToolUse:Grep hook) calls codebase-memory-mcp.exe hook-augment on
every single Grep tool call. In practice this takes ~3 seconds per invocation, and
occasionally exceeds the client's hook execution timeout entirely, blocking the tool
call it's supposed to only augment.
Environment
- codebase-memory-mcp v0.10.8 (confirmed latest via GitHub releases at time of filing)
- Windows 11, Claude Code CLI
- Project graph DB: ~21MB (
C-Users-...-TC_PayrollChecker.db)
Observed behavior
Direct timing of codebase-memory-mcp.exe hook-augment run 3x consecutively from the
project directory: 2.98s / 3.32s / 2.98s — consistent, not a cold-start fluke.
~/.cache/codebase-memory-mcp/logs/cbm-daemon.log shows the daemon fully tearing down
and cold-restarting on each invocation:
level=info msg=daemon.runtime_stopping reason=last_committed_client_disconnected
level=info msg=watcher.unwatch project=...
level=info msg=daemon.lifetime_end reason=runtime_exited
level=info msg=watcher.stop
level=info msg=daemon.stop
level=warn msg=mem.allocator.preloading_completed ...
level=info msg=mem.init budget_mb=3572 total_ram_mb=14290 source=ram_fraction
level=info msg=watcher.start interval_ms=multi-sec
level=info msg=ui.serving url=http://127.0.0.1:9749 port=9749
level=info msg=daemon.start version=0.10.8 pid=...
Each hook call appears to pay full daemon cold-start cost: memory allocator init,
binding the HTTP UI server on :9749, and establishing a git-based file-watcher
baseline — before it can answer. Real-world impact observed in Claude Code transcripts:
3 recorded PreToolUse:Grep hook runs in a 15-day window all hit the hook timeout
(6.1s, 7.3s, 7.7s), blocking those Grep calls entirely.
Also noticed in the same log: an indexing worker failure
(index.supervisor.worker_failed outcome=exit_nonzero exit_code=1) and a stray
24MB .stage.a05564 staging file left in the cache dir, possibly from an
interrupted reindex — may or may not be related.
Expected behavior
hook-augment should reuse a warm/persistent daemon (or otherwise avoid full
daemon boot — allocator init, UI server, watcher baseline) for what's meant to be
a lightweight per-tool-call augmentation hook, so it doesn't add multi-second
latency to every Grep call in the host CLI.
Workaround
Disabled the exe call in ~/.claude/hooks/cbm-code-discovery-gate.cmd (early
exit /b 0) since no config flag (codebase-memory-mcp config list) exposes
daemon-reuse or a lighter-weight hook path. The MCP server tools themselves
(search_graph, trace_path, etc.) are unaffected and still used heavily.
Summary
The
cbm-code-discovery-gatehook (installed bycodebase-memory-mcp installintoClaude Code's
PreToolUse:Grephook) callscodebase-memory-mcp.exe hook-augmentonevery single Grep tool call. In practice this takes ~3 seconds per invocation, and
occasionally exceeds the client's hook execution timeout entirely, blocking the tool
call it's supposed to only augment.
Environment
C-Users-...-TC_PayrollChecker.db)Observed behavior
Direct timing of
codebase-memory-mcp.exe hook-augmentrun 3x consecutively from theproject directory: 2.98s / 3.32s / 2.98s — consistent, not a cold-start fluke.
~/.cache/codebase-memory-mcp/logs/cbm-daemon.logshows the daemon fully tearing downand cold-restarting on each invocation:
Each hook call appears to pay full daemon cold-start cost: memory allocator init,
binding the HTTP UI server on :9749, and establishing a git-based file-watcher
baseline — before it can answer. Real-world impact observed in Claude Code transcripts:
3 recorded
PreToolUse:Grephook runs in a 15-day window all hit the hook timeout(6.1s, 7.3s, 7.7s), blocking those Grep calls entirely.
Also noticed in the same log: an indexing worker failure
(
index.supervisor.worker_failed outcome=exit_nonzero exit_code=1) and a stray24MB
.stage.a05564staging file left in the cache dir, possibly from aninterrupted reindex — may or may not be related.
Expected behavior
hook-augmentshould reuse a warm/persistent daemon (or otherwise avoid fulldaemon boot — allocator init, UI server, watcher baseline) for what's meant to be
a lightweight per-tool-call augmentation hook, so it doesn't add multi-second
latency to every Grep call in the host CLI.
Workaround
Disabled the exe call in
~/.claude/hooks/cbm-code-discovery-gate.cmd(earlyexit /b 0) since no config flag (codebase-memory-mcp config list) exposesdaemon-reuse or a lighter-weight hook path. The MCP server tools themselves
(search_graph, trace_path, etc.) are unaffected and still used heavily.