Skip to content

Releases: manavgup/context-analyzer

v1.0.0 — Context Window Usage Analyzer for Claude Code

08 Jun 21:09
24b15ff

Choose a tag to compare

Context Analyzer v1.0.0

Context window usage analyzer for Claude Code. Tracks how context is consumed across tools, compaction, skills, and user interactions — then visualizes it so you can optimize your sessions.

Demo

Features

Single-Session Dashboard (/)

  • Context Growth chart with stale/active/system breakdown, budget line, danger band, and autocompact threshold
  • Budget toggle (200K / 500K / 700K / 1M) to visualize where you exceed targets
  • Cache-Read Churn chart showing per-call re-read cost and cumulative churn
  • Scrubber with playback — step through API calls or auto-play at 1x/2x/4x
  • Composition breakdown with API-reported token counts (System, CLAUDE.md, Conversation, Tool I/O, Buffer)
  • Token breakdown donut chart updating live per turn
  • Top Growth Turns — which conversation turns added the most context
  • Dead Weight analysis — blocks that became stale but remain in context
  • Messages pane — per-turn message list with role badges, tool type badges, and token sizes
  • Message inspector — click "View All" to see full content of any conversation turn
  • Image support — surface screenshots and images from tool results with lazy-loaded thumbnails
  • Error highlighting — tool failures, retry patterns, and self-correction detection
  • Tool intelligence — categorize tool calls as MCP, Skill, Agent, or regular Tool
  • Subagent visualization — see agent spawns, their API calls, and peak context
  • Health score — overall session health with signals and urgency classification
  • Clickable recommendations — actionable cards that navigate to the relevant turn
  • Session dropdown to switch between sessions without restarting

Cross-Session Analytics (/sessions)

  • Summary cards: total sessions, API calls, cache read, total cost, avg $/call
  • Cost/Call vs Peak Context scatter plot
  • Session comparison bar chart
  • Auto-generated insights (cost patterns, expensive sessions, efficiency metrics)
  • Sortable session table with $/call color coding
  • Click any session to drill into its single-session view

Session Discovery

  • Discovers sessions from both Claude Code transcripts (~/.claude/projects/) and hook traces (~/.claude/context-trace/)
  • Automatically deduplicates and sorts by recency
  • Excludes subagent transcripts

Hooks

  • PostToolUse, PostToolUseFailure, PreCompact, PostCompact
  • SessionStart, SessionEnd, UserPromptSubmit
  • SubagentStart, SubagentStop, InstructionsLoaded

MCP Server

  • FastMCP-based server for programmatic access to session data

Getting Started

curl -LsSf https://astral.sh/uv/install.sh | sh   # install uv
git clone https://github.com/manavgup/context-analyzer.git
cd context-analyzer
make install-dev
make dev

Open http://localhost:8080

Verified

  • 211 tests (196 pass, 15 skip)
  • Lint, format, typecheck all clean
  • Tested end-to-end on fresh Ubuntu 26.04 VM (Python 3.14)