diff --git a/examples/HOOKS_TUTORIAL.md b/examples/HOOKS_TUTORIAL.md index 3a34b81..7818e59 100644 --- a/examples/HOOKS_TUTORIAL.md +++ b/examples/HOOKS_TUTORIAL.md @@ -7,27 +7,42 @@ MemPalace hooks act as an "Auto-Save" feature. They help your AI keep a permanen * **PreCompact Hook** (`mempal_precompact_hook.sh`): Saves your context right before the AI's memory window fills up. ### 2. Setup for Claude Code -Add this to your configuration file to enable automatic background saving: +Add this to `~/.claude/settings.local.json` (global) or `.claude/settings.local.json` (project-scoped) to enable automatic background saving: ```json { "hooks": { "Stop": [ { - "matcher": "", - "hooks": [{"type": "command", "command": "./hooks/mempal_save_hook.sh"}] + "matcher": "*", + "hooks": [{ + "type": "command", + "command": "/absolute/path/to/hooks/mempal_save_hook.sh", + "timeout": 30 + }] } ], "PreCompact": [ { - "matcher": "", - "hooks": [{"type": "command", "command": "./hooks/mempal_precompact_hook.sh"}] + "hooks": [{ + "type": "command", + "command": "/absolute/path/to/hooks/mempal_precompact_hook.sh", + "timeout": 30 + }] } ] } } ``` +Make the hooks executable: +```bash +chmod +x /absolute/path/to/hooks/mempal_save_hook.sh +chmod +x /absolute/path/to/hooks/mempal_precompact_hook.sh +``` + +**Note:** Replace `/absolute/path/to/hooks/` with the actual path where you cloned the MemPalace repository (e.g., `~/projects/mempalace/hooks/`). + ### 3. What changed (v3.1.0+) Both hooks now have **two-layer capture**: @@ -48,4 +63,4 @@ mempalace mine ~/.claude/projects/ --mode convos - **`SAVE_INTERVAL=15`** — How many human messages between saves - **`MEMPALACE_PYTHON`** — Python interpreter with mempalace + chromadb. Auto-detects: env var → repo venv → system python3 -- **`MEMPAL_DIR`** — Optional directory for auto-ingest via `mempalace mine` \ No newline at end of file +- **`MEMPAL_DIR`** — Optional directory for auto-ingest via `mempalace mine`