28 lines
842 B
Markdown
28 lines
842 B
Markdown
|
|
# How to Use MemPalace Hooks (Auto-Save)
|
||
|
|
|
||
|
|
MemPalace hooks act as an "Auto-Save" feature. They help your AI keep a permanent memory without you needing to run manual commands.
|
||
|
|
|
||
|
|
### 1. What are these hooks?
|
||
|
|
* **Save Hook** (`mempal_save_hook.sh`): Saves new facts and decisions every 15 messages.
|
||
|
|
* **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:
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"hooks": {
|
||
|
|
"Stop": [
|
||
|
|
{
|
||
|
|
"matcher": "",
|
||
|
|
"hooks": [{"type": "command", "command": "./hooks/mempal_save_hook.sh"}]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"PreCompact": [
|
||
|
|
{
|
||
|
|
"matcher": "",
|
||
|
|
"hooks": [{"type": "command", "command": "./hooks/mempal_precompact_hook.sh"}]
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
}
|