-
Notifications
You must be signed in to change notification settings - Fork 137
PreToolUse hook blocks Read/Grep on non-code files (docs, markdown, configs) #188
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingeditor/integrationEditor compatibility and CLI integrationEditor compatibility and CLI integration
Description
Problem
The cbm-code-discovery-gate hook installed by codebase-memory-mcp install blocks all Read and Grep tool calls, including on non-code files like markdown docs, JSON configs, and spec documents. This makes it impossible to read or search documentation files without going through the MCP server.
Reproduction
- Install via
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash - Restart Claude Code
- Try to read a markdown file:
Read docs/README.md - Result:
BLOCKED: For code discovery, use codebase-memory-mcp tools first... - Same for
Grepon any file
Expected Behavior
The hook should only gate code file reads (.ts, .js, .py, etc.), not documentation, configuration, or other non-code files. Markdown, JSON, YAML, TOML, and other config/doc formats should pass through to Read/Grep without blocking.
Workaround
Remove the hook from ~/.claude/settings.json:
import json
with open('~/.claude/settings.json') as f:
settings = json.load(f)
hooks = settings.get('hooks', {})
for event in list(hooks.keys()):
hooks[event] = [h for h in hooks[event] if 'cbm-code-discovery' not in str(h.get('command', ''))]
settings['hooks'] = hooks
with open('~/.claude/settings.json', 'w') as f:
json.dump(settings, f, indent=2)Environment
- codebase-memory-mcp 0.5.7
- Claude Code 2.1.87
- Linux amd64
Suggestion
The hook script should check the file extension or path pattern before blocking. Something like:
# Only block for code files, not docs/configs
if [[ "$FILE_PATH" =~ \.(ts|js|py|go|rs|java|c|cpp|h)$ ]]; then
# suggest MCP tools
else
# allow Read/Grep to proceed
fiReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingeditor/integrationEditor compatibility and CLI integrationEditor compatibility and CLI integration