Claude Code context window analyzer with MCP server and dashboard
Context Analyzer is an open-source tool by manavgup that hooks into Claude Code to track context window usage across tools, compaction events, and sessions, then visualizes the data in an interactive dashboard.
Score breakdown
The tool surfaces granular, per-token context consumption data for Claude Code sessions that is not otherwise directly visible, enabling cross-session analysis of compaction and cache behavior.
- 01Hooks into Claude Code via `~/.claude/settings.json` to capture tool calls, compaction events, session lifecycle, and subagent activity
- 02Parses transcripts for exact API token usage: input, output, `cache_read`, and `cache_creation`
- 03Uses SQLite persistence with 9 tables, generating 2,900+ rows per session
Context Analyzer is an open-source tool posted to Hacker News by manavgup that provides visibility into how Claude Code consumes its context window during a session. It integrates with Claude Code by modifying `~/.claude/settings.json` to capture tool calls, compaction events, session lifecycle events, and subagent activity, then parses session transcripts to extract exact API token counts across four categories: input, output, `cache_read`, and `cache_creation`.
All session data is stored in a SQLite database using a 9-table schema, with each session generating 2,900+ rows, enabling both fast queries and cross-session analysis.
All session data is stored in a SQLite database using a 9-table schema, with each session generating 2,900+ rows, enabling both fast queries and cross-session analysis. The tool ships with two web views served on `localhost:8080`: a single-session dashboard at `/` showing context growth, cache churn, composition breakdowns, and a message inspector, and a cross-session analytics page at `/sessions` for comparing patterns such as cost-per-call versus context size across multiple sessions. The project requires Python 3.11+ and the `uv` package manager, and provides a `Makefile`-based quick-start workflow.
Key facts
- 01Hooks into Claude Code via `~/.claude/settings.json` to capture tool calls, compaction events, session lifecycle, and subagent activity
- 02Parses transcripts for exact API token usage: input, output, `cache_read`, and `cache_creation`
- 03Uses SQLite persistence with 9 tables, generating 2,900+ rows per session
- 04Single-session dashboard at `/` shows context growth, cache churn, composition, and a message inspector
- 05Cross-session analytics at `/sessions` compares cost/call vs. context size and surfaces trends across sessions
- 06Requires Python 3.11+ and the `uv` package manager; dashboard served on `localhost:8080`
- 07Hook installation is optional — the dashboard works without it
Topics
Summary and scoring are generated automatically from the original article. We always link back to the publisher and never republish images or paywalled content. Last processed Jun 10, 2026 · 15:34 UTC. How this works →