Optional hooks that integrate Engram with Claude Code's native hook system. Turns Engram from a passive MCP tool into active memory capture.
Inspired by claude-subconscious (Letta's background agent pattern), but keeps everything local and zero-LLM.
| Hook | Purpose | Token cost |
|---|---|---|
session_start.sh |
Inject brain overview at session start | ~200 |
user_prompt_submit.sh |
Whisper top 2 relevant memories before each prompt (opt-in) | ~150 |
Add to ~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "/absolute/path/to/Engram/hooks/session_start.sh"
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "/absolute/path/to/Engram/hooks/user_prompt_submit.sh"
}
]
}
]
}
}Replace /absolute/path/to/Engram with your actual clone path.
Whisper mode injects ~150 tokens per prompt. If you prefer zero auto-inject:
export ENGRAM_WHISPER=0Or just don't install user_prompt_submit.sh.
- Graceful degradation: Hooks silently exit if Engram isn't installed or if
uvis missing - Zero LLM calls: All hooks use
engramCLI (SQL-only) - Opt-in everything: No hook is installed by default. Users choose their level of automation
- No background daemons: Unlike claude-subconscious, no persistent agents or cloud services
- Stop hook for auto-remember: Considered but deferred. Auto-extraction from transcripts requires LLM judgment, which violates zero-token principle. Instead: rely on CLAUDE.md instructions for agent to call
remember()explicitly when it discovers something worth storing. - PreToolUse hook: Too noisy. Engram's
proactive()MCP tool is called by the agent at meaningful moments, not before every tool use.