Claude Code Logs Every Session to Disk — Here's How to Index and Recall Them

Claude Code has been writing an append-only JSONL log of every session to ~/.claude/projects/ since day one. Each line is a structured JSON object — role, timestamp, content, tool calls — forming a complete episodic record going back to your first session. One user found 1,026 sessions totaling 57MB and 76,000 turns, all sitting on disk with no built-in way to query them.
Building a Recall Layer
The solution is an open-source indexer (continuity-v2, MIT) that ingests these logs into SQLite+FTS5 with temporal edges between turns, plus an MCP server. From inside any Claude Code session, you can now run:
search_sessions("remember when we fixed that auth bug last month")
recall_session("a8f2c441")
thread_recall(root_id, depth=8)The thread_recall function performs a BFS traversal through the temporal edge graph to reconstruct a thread across session boundaries. The indexer also supports importing conversations.json from the claude.ai data export, so web chat history lives in the same index as CLI sessions.
Fixing Compaction's Hard Reset
Compaction fires when context fills up, but the transcript_path in the PreCompact payload isn't always populated at hook fire time. The fix: write a checkpoint on every single turn (not just at session end) so PreCompact always has fresh data to fall back to. Then SessionStart reads the source field — "compact" means compaction fired, "resume" means app restart, "startup" is a fresh session, "clear" is intentional. Each gets different behavior. Net result: compaction becomes a cache miss, not a hard reset.
Upstream Conversation & Similar Projects
Track the ongoing discussion at anthropics/claude-code#47023. Seven independent memory projects (Bella, NEXO Brain, Cozempic, world-model-mcp, etc.) all independently hit the same requirements. A formal hook spec is being worked out there.
The hooks take about five minutes to set up; the MCP server is a single Python file. Repo is MIT licensed.
📖 Read the full source: r/ClaudeAI
👀 See Also

Brain-MCP Developer Documents Tools for Claude AI Instead of Humans
A developer maintaining the Brain-MCP server added a 'For AI Assistants' section to documentation with behavioral instructions, resulting in Claude using tools more intelligently and proactively injecting context when topics change.

ai-codex: Pre-index your codebase to save Claude tokens
ai-codex is a tool that generates compact markdown indexes of your codebase, allowing Claude Code to skip the initial exploration phase that typically consumes 30-50K tokens per conversation. It creates five files covering routes, pages, libraries, schemas, and components.

AlphaCreek: An MCP Server That Chunks SEC Filings to Cut Token Usage by 85%
AlphaCreek is a free MCP connector for Claude that reduces token consumption by ~85% when working with SEC filings by first returning a table of contents, then fetching only the sections the agent requests.

Claude Code Remote Control: Continue Local Sessions from Any Device
Claude Code Remote Control lets you continue local Claude Code sessions from other devices like phones or browsers while keeping everything running on your machine. It's available as a research preview on Pro and Max plans, requiring authentication and workspace trust setup.