# context-diff

> `git diff` for the Claude Code context window. Parses Claude Code's per-session JSONL, walks turn by turn, surfaces input/cache/output token deltas, and highlights which tool call caused the biggest context jump.

## Install
```
pip install context-diff
# or: uvx context-diff --auto
```

Zero dependencies. Pure Python ≥3.10.

## Use
```bash
context-diff --auto                # pick latest session under ~/.claude/projects/
context-diff <session.jsonl>
context-diff --top 10
context-diff --json | jq '.[] | select(.delta_input > 10000)'
```

## What it tells an AI agent
For any Claude Code session you have access to, context-diff reads the session JSONL and reports:
- Per-turn input/output/cache token counts and the delta vs. previous turn.
- Which tool calls were issued in each assistant turn.
- The top-N turns by token cost.
- Cumulative cache hit rate.

Use this output to identify and fix tool calls that consistently produce excessive output (giant Greps, full-file Reads, etc.).

## About the author
Built by yubinkim444, who also makes Kay's Records, an app for iOS and Android:
https://kay-s-record.web.app/get.html
