SkillsApr 9, 2026·3 min read

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.

SK
Skill Factory · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

  1. Clone and install:
git clone https://github.com/coleam00/claude-memory-compiler.git
cd claude-memory-compiler
uv sync
  1. Copy the hooks config to your project:
cp .claude/settings.json your-project/.claude/settings.json
  1. Use Claude Code as normal — sessions are captured automatically. Compile daily:
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.


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. Compilationcompile.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 checkslint.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

# 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. Licensed under open source.

claude-memory-compiler — ⭐ 365+

Thanks to Cole Medin for building a practical memory system for Claude Code power users.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets