From b3c48d0775bff50210dd356e50085cc415dba198 Mon Sep 17 00:00:00 2001 From: Oussama Date: Tue, 7 Apr 2026 17:13:39 +0100 Subject: [PATCH] docs: add beginner-friendly hooks tutorial for issue #20 --- examples/HOOKS_TUTORIAL.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/HOOKS_TUTORIAL.md diff --git a/examples/HOOKS_TUTORIAL.md b/examples/HOOKS_TUTORIAL.md new file mode 100644 index 0000000..1b09467 --- /dev/null +++ b/examples/HOOKS_TUTORIAL.md @@ -0,0 +1,28 @@ +# 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"}] + } + ] + } +} \ No newline at end of file