Persistent memory for Claude Code — across sessions, across projects.
Claude Code starts fresh every session. No memory of what you built yesterday, what decisions you made, or what your codebase looks like. You re-explain everything. Every time.
hooks/memory/
├── git-memory.py # G1 — time memory
├── g2-augment.py # G2 — space memory
└── chat-memory.py # CM — conversation memory
Runs on every prompt. Reads the last 7 days of git history and injects a structured summary — commits, changed files, project state — so Claude always knows what you've been working on.
Runs after Grep/Glob tool calls. Queries a SQLite codebase graph to find related entities (files, functions, classes) and surfaces them automatically. Requires a pre-built graph index.
Runs on every prompt. Searches past Claude Code conversations using BM25 (FTS5) + vector hybrid retrieval. Recalls relevant decisions, context, and notes from previous sessions instantly.
Copy the hooks to your Claude Code hooks directory:
cp hooks/memory/*.py ~/.claude/hooks/Register them in ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{ "type": "command", "command": "python3 ~/.claude/hooks/git-memory.py" },
{ "type": "command", "command": "python3 ~/.claude/hooks/chat-memory.py" }
]
}
],
"PostToolUse": [
{
"matcher": "Grep|Glob|Read",
"hooks": [
{ "type": "command", "command": "python3 ~/.claude/hooks/g2-augment.py" }
]
}
]
}
}pip install rank-bm25 sqlite-utilsG2 requires a pre-built SQLite codebase graph. See g2-augment.py for indexing instructions.
MIT — free to use, modify, and distribute. See LICENSE for details.