Context Inspector

Find what is wasting your Claude Code context

·

source at 93fa0f7

·

Apache-2.0 license

Shows what fills your context window, which files Claude re-read, near-duplicate tool outputs and what compaction kept, with advice on cutting waste.

What this mod can do

  • Reviewed at commit 93fa0f7
  • Writes files
  • Sees each message added to the conversation and can change it
  • Reads environment variables
  • Sees each tool call before it runs and can block or change it
5 more things it can do
  • Reads the conversation
  • Adds the /context-export command
  • Adds the /context-inspect command
  • Adds the /context-pane command
  • Runs on a timer
Good to know (3)
  • /context-export saves metadata only, no raw content, as JSONL under ~/.claude/context-inspector.
  • Exports keep file paths and only mask secrets on a best-effort basis, so review them before sharing.
  • After a reload, resume or /clear, only the main conversation is recovered, without subagents.
Are mods safe?

Preview

Terminal

⎿ context-inspector: Context Inspector pane opened (shown in the terminal and the desktop app). ╭────────────────────────────────────────────────────────────────────────────────────────────────✕─╮ │ Context Inspector — main context │ │ Live ≈3.0k tokens in 12 items · 1 turn(s) · 0 compaction(s) · waste ≈0 │ │ ≈ = estimate (chars/4 × k=1.00, 0 calibration segment(s)); figures without ≈ are measured or en… │ │ │ │ Top occupants (live, by category) │ │ attachment:skill_listing ≈1.5k 50% █████░░░░░ 1 item(s) │ │ attachment:agent_listing_de… ≈685 23% ██░░░░░░░░ 1 item(s) │ │ attachment:environment ≈180 6% █░░░░░░░░░ 1 item(s) │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ⚠ context-inspector: ctx 22% · waste≈0

Claude Desktop

Context Inspector in Claude Desktop

What it does

In the author's words

Context waste analyzer for Claude Code: what fills the window, re-reads, near-duplicate outputs, what compaction kept, advice

What you see
A live pane, a status entry and an advice toast
Works in
Terminal and Claude Desktop
Slash commands
/context-export, /context-inspect, /context-pane
Uses your tokens
No
Changes files
JSONL exports, only when you run /context-export
Network access
None
Reviewed commit
93fa0f7
Preview recorded with
Claude Code 2.1.309

How it works

  1. Watches each row that enters the conversation and each tool call, without changing them
  2. Estimates each item's tokens from its characters, calibrated against measured input growth
  3. Keeps a status entry like ctx 22% · waste≈0 and toasts once per session for top advice
  4. /context-inspect prints a report, and /context-pane opens a live pane

Common questions

Why does Claude Code keep re-reading the same file?

context-inspector sorts every repeat read by cause: a different line range, after an edit, after compaction, a file changed outside, or an unchanged copy still in the window. That last kind is pure waste. Run /context-inspect rereads to see them.

What does Claude Code lose when it compacts?

Run /context-inspect compactions. It checks whether edited files, read files, errors and identifiers from before compaction still appear in the summary and kept messages, and lists edited files that dropped out. It matches strings, so a paraphrase counts as lost.

How accurate are its token numbers?

Window occupancy comes from input tokens the API reported. Per-item counts are estimates (characters divided by 4, calibrated against measured growth) and carry a ≈ in the report.

Does it change my conversation or block tools?

No. The README says it only observes and never changes rows, tool calls or compaction, though the validator lists that its hooks could.

Badge for your README

Own this listing? Add it to your README. The badge shows the install count as it grows.

Reviewed on statuslin.es
[![Reviewed on statuslin.es](https://staging.statuslin.es/badge/mods/context-inspector.svg)](https://staging.statuslin.es/mods/context-inspector?utm_source=readme-badge)

Or show the preview card:

Preview on statuslin.es
[![Preview on statuslin.es](https://staging.statuslin.es/og/mods/context-inspector.png)](https://staging.statuslin.es/mods/context-inspector?utm_source=readme-badge)

More like this

Context Bar in Claude Desktop

Your context window as a stacked bar above the prompt, a color per category, with token counts and the compaction point. /context-bar shows or hides it.

⎿ cache-tax: keepwarm on for 6h00m, a ping 50m after each idle stretch keeps the cache read, not re-written ⎿ cache-tax: claude-opus-5-5 state warm, 1h00m left context 44,000 tokens cold cost $0.35 to re-write it (warm turn $0.01) keepwarm on, 6h00m left · ping in 50m break-even up to 40 pings at the read rate cost one cold write, about 33h20m of idle at one ping per 50m guard ask first (/cache-tax guard warn to only show the price) session 0 cold writes paid, $0.00 [>] cache-tax · warm · keepwarm 6h00m left · ping in 50m [-]

A Claude Code mod that keeps the one-hour prompt cache warm during breaks and asks before a cold send, showing its estimated rewrite cost. Warming uses model requests and costs tokens. Requires Claude Code 2.1.287+.

Context Meter in Claude Desktop

The session's context window fill, right above the prompt: gray while there is room, yellow when it is time to /compact, red when a new session is better.

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Opus 4.8 ▓▓░░░░░░░░ 22%

Model plus a 10-block context-usage bar. Example statusline inspired by the Claude Code docs (code.claude.com/docs/en/statusline).

Opus 4.8 high ✦ │ ctx 22% │ app (main) │ PR #1287 ● │ $0.41 · 10m +128 -34 Session ● ● ● ● ● ● ● ● ○ ○ ○ 74% left Resets in 2h 6m Weekly ● ● ● ● ● ● ● ● ● ● ○ 93% left Resets in 2d 0h

Feature-rich bash status line with model, context bar, session cost (read live from Claude Code, so it stays correct on any model), rate-limit bars, and live tool/agent activity that adapts to terminal width. Source: github.com/JungHoonGhae/claude-statusline

✧ ███████████▋ 73% 🗝 Ultima Weapon ✦ app ∙ main ♥ ████████████████████████ 100% 「SAVE POINT」 ✶ Limit Form ◉ 41

Claude Code plan-usage HP bar that reads the Claude auth token to show remaining usage.

Opus 4.8 │ main │ app │ ▓▓░░░░░░░░ 44k/200k │ $0.41

Catppuccin Frappé–themed status line with model, git branch and dirty flag, folder, a block context bar, and session cost. Source: github.com/danjdewhurst/cc-status-line