MemPalace hooks act as an "Auto-Save" feature. They help your AI keep a permanent memory without you needing to run manual commands.
- 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.
Add this to your configuration file to enable automatic background saving:
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [{"type": "command", "command": "./hooks/mempal_save_hook.sh"}]
}
],
"PreCompact": [
{
"matcher": "",
"hooks": [{"type": "command", "command": "./hooks/mempal_precompact_hook.sh"}]
}
]
}
}Both hooks now have two-layer capture:
-
Auto-mine: Before blocking the AI, the hook runs the normalizer on the JSONL transcript and upserts chunks directly into the palace. This captures raw tool output (Bash results, search findings, build errors) that the AI would otherwise summarize away.
-
Updated reason messages: The block reason now explicitly tells the AI to save tool output verbatim — not just topics and decisions.
The hooks capture conversations going forward, but you probably have months of past sessions. Run this once to mine them all:
mempalace mine ~/.claude/projects/ --mode convosSAVE_INTERVAL=15— How many human messages between savesMEMPALACE_PYTHON— Python interpreter with mempalace + chromadb. Auto-detects: env var → repo venv → system python3MEMPAL_DIR— Optional directory for auto-ingest viamempalace mine