Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/coleam00/claude-memory-compiler/llms.txt

Use this file to discover all available pages before exploring further.

Claude Memory Compiler turns your Claude Code sessions into a self-organizing knowledge base. Each time a session ends, a background process extracts what’s worth saving — decisions, lessons, patterns — and appends it to a daily log. Those logs then compile into structured, cross-referenced articles that Claude reads at the start of every future session.
No API key required. Claude Memory Compiler uses Claude Code’s built-in credentials stored at ~/.claude/.credentials.json. Any Max, Team, or Enterprise Claude subscription is sufficient.
1

Clone the repo into your project

From your project’s root directory, clone Claude Memory Compiler alongside your existing code:
git clone https://github.com/coleam00/claude-memory-compiler
The repo contains the hook scripts, compiler, and all dependencies. It should live inside your project so the hook paths resolve correctly from the project root.
2

Install dependencies with uv

Claude Memory Compiler uses uv for dependency management. Run uv sync from the claude-memory-compiler directory:
cd claude-memory-compiler
uv sync
This installs the three required packages: claude-agent-sdk, python-dotenv, and tzdata. Python 3.12 or later is required.
3

Copy .claude/settings.json into your project

The hooks activate automatically once Claude Code finds .claude/settings.json in your project root. Copy it from the cloned repo:
cp claude-memory-compiler/.claude/settings.json .claude/settings.json
If you already have a .claude/settings.json, merge the hooks object into it. The full hook configuration is:
.claude/settings.json
{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "uv run python hooks/session-start.py",
            "timeout": 15
          }
        ]
      }
    ],
    "PreCompact": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "uv run python hooks/pre-compact.py",
            "timeout": 10
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "uv run python hooks/session-end.py",
            "timeout": 10
          }
        ]
      }
    ]
  }
}
The empty matcher field means the hooks fire for every session, regardless of what you’re working on.
4

Open Claude Code — hooks activate automatically

Start a new Claude Code session in your project. The SessionStart hook runs immediately and injects today’s date along with any existing knowledge base index into the conversation context.Work through your session normally. When the session ends, the SessionEnd hook fires and spawns flush.py as a detached background process to extract and save what matters.
5

Verify your first daily log was created

After your first session ends, check that a daily log file was created:
ls claude-memory-compiler/daily/
# Expected: YYYY-MM-DD.md
Open the file to see what was extracted. Each entry follows the structured format with sections for Context, Key Exchanges, Decisions Made, Lessons Learned, and Action Items.
6

Run your first compile

Compile the daily log into structured knowledge articles:
uv run python claude-memory-compiler/scripts/compile.py
This reads the daily log, extracts 3–7 concepts, and writes markdown articles to claude-memory-compiler/knowledge/concepts/. It also updates the master index at knowledge/index.md, which Claude reads at the start of every future session.Compilation costs roughly $0.45–0.65 per daily log and takes a minute or two to complete.
The fastest way to set this up is to tell your AI agent directly: “Clone https://github.com/coleam00/claude-memory-compiler into this project. Set up the Claude Code hooks so my conversations automatically get captured into daily logs, compiled into a knowledge base, and injected back into future sessions. Read the AGENTS.md for the full technical reference on how everything works.” The agent handles cloning, uv sync, and copying the settings file.

What to do next

After your first successful compile, your knowledge base is live. The cycle runs automatically from here: sessions flush to daily logs, daily logs compile after 6 PM, and the index injects into every new session. You can also query the knowledge base directly:
uv run python claude-memory-compiler/scripts/query.py "What patterns have I used for authentication?"
See the Guides section for compiling on demand, running health checks with lint.py, and integrating the knowledge directory with Obsidian.

Build docs developers (and LLMs) love