Merge pull request #1101 from wahajahmed010/fix/hooks-tutorial-1037
docs: fix HOOKS_TUTORIAL.md paths, matcher, and missing timeout (#1037)
This commit is contained in:
@@ -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.
|
* **PreCompact Hook** (`mempal_precompact_hook.sh`): Saves your context right before the AI's memory window fills up.
|
||||||
|
|
||||||
### 2. Setup for Claude Code
|
### 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
|
```json
|
||||||
{
|
{
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"Stop": [
|
"Stop": [
|
||||||
{
|
{
|
||||||
"matcher": "",
|
"matcher": "*",
|
||||||
"hooks": [{"type": "command", "command": "./hooks/mempal_save_hook.sh"}]
|
"hooks": [{
|
||||||
|
"type": "command",
|
||||||
|
"command": "/absolute/path/to/hooks/mempal_save_hook.sh",
|
||||||
|
"timeout": 30
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"PreCompact": [
|
"PreCompact": [
|
||||||
{
|
{
|
||||||
"matcher": "",
|
"hooks": [{
|
||||||
"hooks": [{"type": "command", "command": "./hooks/mempal_precompact_hook.sh"}]
|
"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+)
|
### 3. What changed (v3.1.0+)
|
||||||
|
|
||||||
Both hooks now have **two-layer capture**:
|
Both hooks now have **two-layer capture**:
|
||||||
|
|||||||
Reference in New Issue
Block a user