{ "_comment": "Merge into your Claude Code settings.json (user-level %USERPROFILE%/.claude/settings.json or project .claude/settings.json). This uses the EXEC form ('command' = the interpreter, 'args' = its arguments): Claude Code spawns it directly with NO shell, so the script path in args is passed literally (no backslash-escaping and no quoting), even under 'Program Files' or on Windows. Set 'command' to the Python that should run the script: 'python3' on most macOS/Linux (a bare 'python' often does not exist there), 'python' on Windows, or -- most robust on any OS -- the absolute interpreter path from `python -c \"import sys; print(sys.executable)\"`. Replace the args path with the absolute path to engramory_index_guard.py. WARNING: if the interpreter cannot be spawned (e.g. 'python3' on stock Windows), Claude Code fail-opens (non-blocking hook error, the edit proceeds) and the guard silently never fires -- after installing, verify a 250-line Write to a scratch MEMORY.md is DENIED (see hooks/INSTALL.md).", "hooks": { "PreToolUse": [ { "matcher": "Edit|Write|MultiEdit", "hooks": [ { "type": "command", "command": "python3", "args": ["/ABSOLUTE/PATH/TO/engramory/hooks/engramory_index_guard.py"] } ] } ] } }