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

singularity-claude: A Self-Evolving Skill Engine for Claude Code
singularity-claude is an open-source Claude Code plugin that adds a recursive evolution loop to prevent skill rot. It scores skill executions, auto-repairs low-scoring skills, crystallizes high-performing versions, and detects capability gaps.

OpenJet v0.4: Zero-Config Local Coding Agent with llama.cpp Backend
OpenJet v0.4 is an open-source terminal coding agent for local LLMs that auto-detects hardware, configures llama.cpp, and provides a Claude Code-style workflow with no API keys.

TruthGuard: Shell Script Hooks That Catch AI Coding Agent Lies
TruthGuard is an open-source tool that uses shell script hooks to verify what Claude Code and Gemini CLI actually do versus what they claim. It catches phantom edits, exit code lies, dangerous shortcuts, and blocks commits when tests fail.

read-once: A Claude Code Hook That Prevents Redundant File Reads
A developer built a PreToolUse hook called read-once that tracks files Claude Code has already read in a session, blocking re-reads of unchanged files and using diffs for changed files. The tool saves thousands of tokens per session by preventing Claude from repeatedly reading the same file content.