49 lines
1.4 KiB
Markdown
49 lines
1.4 KiB
Markdown
# Hooks
|
|
|
|
Hooks integrate poc-memory into Claude Code's session lifecycle.
|
|
Two hook binaries fire on session events, providing memory recall
|
|
and notification delivery.
|
|
|
|
## Setup
|
|
|
|
Configured in `~/.claude/settings.json`:
|
|
|
|
```json
|
|
{
|
|
"hooks": {
|
|
"UserPromptSubmit": [{"hooks": [
|
|
{"type": "command", "command": "memory-search", "timeout": 10},
|
|
{"type": "command", "command": "poc-hook", "timeout": 5}
|
|
]}],
|
|
"PostToolUse": [{"hooks": [
|
|
{"type": "command", "command": "poc-hook", "timeout": 5}
|
|
]}],
|
|
"Stop": [{"hooks": [
|
|
{"type": "command", "command": "poc-hook", "timeout": 5}
|
|
]}]
|
|
}
|
|
}
|
|
```
|
|
|
|
## memory-search (UserPromptSubmit)
|
|
|
|
Fires on every user prompt. Two modes:
|
|
|
|
1. **First prompt or post-compaction**: loads full memory context
|
|
via `poc-memory load-context` — journal entries, identity nodes,
|
|
orientation file, configured context groups.
|
|
|
|
2. **Every prompt**: keyword search over the knowledge graph,
|
|
returns relevant memories as `additionalContext`. Deduplicates
|
|
across the session to avoid repeating the same memories.
|
|
|
|
## poc-hook (UserPromptSubmit, PostToolUse, Stop)
|
|
|
|
Signals session activity to `poc-daemon` and delivers pending
|
|
notifications:
|
|
|
|
- **UserPromptSubmit**: signals user activity, drains pending
|
|
notifications into `additionalContext`
|
|
- **PostToolUse**: signals assistant activity (tool use implies
|
|
the session is active)
|
|
- **Stop**: signals session end, triggers experience-mine
|