🧠

Why This Exists

The Problem

Long-running Claude Code sessions inevitably hit context limits, triggering compaction that silently discards earlier conversation history. Decisions, debugging context, and architectural rationale vanish mid-session.

The Approach

Instead of fighting compaction, this project embraces it by capturing conversation snapshots at key lifecycle moments. A separate search agent can then retrieve past context on demand, keeping the main conversation window clean while making history accessible.

← Projects

Claude Reflections

Persistent context capture across Claude Code sessions

View on GitHub

How It Works

1

Hook triggers

Claude Code lifecycle events (PreCompact, SessionEnd, SessionStart) fire a shell script

2

Context captured

Full conversation transcript is dumped as timestamped JSONL and Markdown files

3

History searchable

A custom search agent greps through dumps to surface past decisions and context

4

Session analyzed

Python analyzer corrects metrics, filters idle time, and extracts signal from noise

Key Features

Automatic Context Capture

Hooks fire on PreCompact, SessionEnd, and SessionStart lifecycle events to generate timestamped dumps with full conversation transcripts in both raw JSONL and readable Markdown.

Context Search Agent

A custom agent that greps through historical dumps to retrieve previous decisions, debugging context, and session summaries without polluting the main conversation context.

Session Analysis

Python-based analyzer that corrects metrics from raw dumps, filters idle time gaps between sessions, and separates genuine user messages from tool result noise.

File-Based Storage

Simple, portable, and grep-able file-based storage. Each dump contains metadata, statistics, raw transcripts, and formatted conversations — no database dependencies.

Tech Stack

Shell ScriptPythonjqClaude Code HooksCustom AgentsJSONLMarkdown

Real-World Impact

In production testing, the system accumulated 479 context dumps over three weeks, enabling reliable context recovery, post-mortem analysis, and improved session handoffs. The file-based approach keeps everything simple, portable, and grep-able — no databases required.