# Claude Memory Compiler — Evolving Knowledge Base > Auto-capture Claude Code sessions into a structured knowledge base. Hooks extract decisions and lessons, compiler organizes into cross-referenced articles. No vector DB needed. 365+ stars. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use 1. Clone and install: ```bash git clone https://github.com/coleam00/claude-memory-compiler.git cd claude-memory-compiler uv sync ``` 2. Copy the hooks config to your project: ```bash cp .claude/settings.json your-project/.claude/settings.json ``` 3. Use Claude Code as normal — sessions are captured automatically. Compile daily: ```bash uv run python scripts/compile.py ``` --- ## Intro Claude Memory Compiler is an evolving personal knowledge base for Claude Code with 365+ GitHub stars. It automatically captures your Claude Code sessions via hooks, extracts key decisions and lessons using the Claude Agent SDK, and compiles them into structured, cross-referenced knowledge articles. No vector database needed — uses a structured `index.md` approach that works better at personal scale. Inspired by Karpathy's LLM Knowledge Base architecture. Best for power users of Claude Code who want persistent memory across sessions. See also: [Claude Code Skills on TokRepo](https://tokrepo.com/en/collections/skills). --- ## Claude Memory Compiler — Build Memory from Your AI Sessions ### The Problem Claude Code sessions are ephemeral — valuable decisions, debugging insights, and architectural choices are lost when the session ends. You end up re-explaining the same context over and over. ### The Solution Claude Memory Compiler hooks into your Claude Code workflow and builds a growing knowledge base automatically: 1. **Session End** → hooks trigger `flush.py` 2. **Extraction** → Claude Agent SDK identifies decisions, patterns, and lessons 3. **Daily Logs** → insights saved to timestamped daily files 4. **Compilation** → `compile.py` organizes into cross-referenced articles 5. **Injection** → SessionStart hook loads `index.md` into next session ### Key Features - **Automatic capture** — hooks fire on session end + pre-compaction safety net - **Knowledge extraction** — AI identifies decisions, patterns, and lessons learned - **No vector database** — structured `index.md` works better at personal scale - **Health checks** — `lint.py` runs 7 checks (broken links, orphans, contradictions, staleness) - **Daily compilation** — automatically triggers after 6 PM local time - **Query interface** — search your knowledge base from the command line ### Setup ```bash # Install dependencies uv sync # Copy hooks config to your project cp .claude/settings.json your-project/.claude/settings.json # Compile knowledge base uv run python scripts/compile.py # Query your knowledge base uv run python scripts/query.py "How did I handle the auth migration?" # Run health checks uv run python scripts/lint.py ``` ### How Knowledge Is Organized ``` knowledge/ index.md # Master index, injected into each session architecture/ # System design decisions debugging/ # Bug patterns and solutions conventions/ # Code style and project rules integrations/ # Third-party service patterns ``` ### FAQ **Q: What is Claude Memory Compiler?** A: An open-source tool that automatically captures Claude Code sessions and compiles them into a structured, searchable knowledge base that persists across conversations. **Q: Does it require a vector database?** A: No. It uses a structured `index.md` approach inspired by Karpathy's LLM Knowledge Base architecture, which works better than RAG at personal scale. **Q: How does it integrate with Claude Code?** A: Via Claude Code hooks — it captures sessions automatically on end, extracts insights, and injects the knowledge index at session start. --- ## Source & Thanks > Created by [Cole Medin](https://github.com/coleam00). Licensed under open source. > > [claude-memory-compiler](https://github.com/coleam00/claude-memory-compiler) — ⭐ 365+ Thanks to Cole Medin for building a practical memory system for Claude Code power users. --- ## Quick Use 1. Clone and install: ```bash git clone https://github.com/coleam00/claude-memory-compiler.git cd claude-memory-compiler uv sync ``` 2. Copy the hooks config to your project: ```bash cp .claude/settings.json your-project/.claude/settings.json ``` 3. Use Claude Code as usual — sessions are captured automatically. Compile daily: ```bash uv run python scripts/compile.py ``` --- ## Introduction Claude Memory Compiler is a personal knowledge base tool for Claude Code, with 365+ GitHub stars. It automatically captures Claude Code sessions via hooks, uses the Claude Agent SDK to extract key decisions and lessons learned, and compiles them into structured, cross-referenced knowledge articles. No vector database — it uses a structured index.md approach. Inspired by Karpathy's LLM knowledge base architecture. Ideal for heavy Claude Code users. --- ## Claude Memory Compiler — Build Memory from AI Sessions ### Workflow 1. **Session ends** → hooks trigger flush.py 2. **Knowledge extraction** → Claude Agent SDK identifies decisions, patterns, lessons 3. **Daily log** → saved to timestamped files 4. **Compilation** → compile.py organizes into cross-referenced articles 5. **Injection** → SessionStart hook loads index.md into the next session ### Core Features - **Auto-capture** — hooks trigger at session end - **No vector DB required** — structured index.md works better at personal scale - **Health checks** — lint.py runs 7 checks - **Query interface** — command-line search of the knowledge base ### FAQ **Q: What is Claude Memory Compiler?** A: An open-source tool that auto-captures Claude Code sessions and compiles them into a structured, searchable knowledge base. **Q: Do I need a vector database?** A: No — the structured index.md approach outperforms RAG at personal scale. --- ## Source & Thanks > Created by [Cole Medin](https://github.com/coleam00). Licensed under open source. > > [claude-memory-compiler](https://github.com/coleam00/claude-memory-compiler) — ⭐ 365+ --- Source: https://tokrepo.com/en/workflows/claude-memory-compiler-evolving-knowledge-base-4388e2e8 Author: Skill Factory