v1 shipped · open source · MIT

A receipt for your
Claude Code session.

Anthropic's /context shows you "60% used." It won't tell you that 50,000 of those tokens went to MCP tools you never called. tokenlens itemizes the bill.

$ npx -y @bouncei/tokenlens status
$ npm install -g @bouncei/tokenlens
~/your-project · tokenlens status
$ tokenlens status
session ~/.claude/projects/<cwd>/<uuid>.jsonl
turns 263 assistant
Tokens consumed by Anthropic
input (uncached)38.9k·
cache writes2.06M← bloat lives here
cache reads41.21M← cheap
output298.4k·
cache hit rate95.2%·
MCP servers (loaded vs. invoked)
(~50.5k estimated on tools never called)
linear-mcp~10.3k● never called
playwright~5.8k● never called
filesystem~3.5k● never called
memory~2.3k● never called
…6 more servers, 202 dead tools total

What /context hides.

You're paying $200 a month for Claude Max. Your weekly limit feels tighter than the number on the bill should allow. The built-in /context command shows a friendly percentage and nothing else.

Anthropic shipped Claude Code with a context inspector that undercounts. MCP server definitions, re-injected memory files, skill listings, dead tool schemas — all loaded into the cache, none of them surfaced as line items. The percentage is honest only about the part the vendor wants to be honest about.

A developer named Ryan filed Issue #29971 in March, documenting the undercount with reproductions. Anthropic closed it as not planned. tokenlens exists because their closure was your invitation.

263 assistant turns.
2,400,000 invisible tokens.

tokenlens, inc.
— context itemization —
SESSION · 63833e5d 5 days · 263 turns
cache_creation_input_tokens(bloat)2,060,000
— skill_listing(44 skills × 1 ev)15,600
— hook_additional_context(superpowers)6,510
— deferred_tools_added(2 deltas)21,200
— todo_reminder(× 11)825
— date_change(× 2)150
DEAD MCP TOOL DEFINITIONS~50,500
linear-mcp(41 tools, 0 called)10,250
plugin_playwright(23 tools)5,750
Claude_in_Chrome(22 tools)5,500
filesystem · memory · …28,950
INVISIBLE TO /context≈ 570,800
worth your week's rate limit REF #ISSUE-29971 · NOT PLANNED · 2026

Read the bill.
Then trim it.

i.

Read the meter status

One-shot breakdown of the active session. Anthropic's exact per-turn usage from message.usage, attributed by skill, and a share-by-weight split of what each injected source contributed to cache writes. Honest about what we can't attribute.

$ tokenlens status

Output by attributionSkill
  <unattributed>          ████████████████   208.7k   (213 turns)
  idea-scout              ██████░░░░░░░░░░    92.6k   (65 turns)

Injected context by source
  cache_invalidation_or_growth  ████ ! 520.3k across 16 turns
  deferred_tools_added          █░░░ ~25.0k
  skill_listing                 ░░░░     1.5k
  hook_additional_context       ░░░░       791
$ tokenlens watch

Usage
  turns                       263
  input (uncached)           38.9k
  cache writes                2.06M   ← bloat
  cache reads                41.21M   ← cheap
  cache hit rate              95.2%

updated 02:14:38 · 1.4 MB on disk
ctrl-c to stop
ii.

Watch it live watch

Same view as status, refreshed as the session jsonl grows. Pin it in a side pane while you work and watch the cache_creation column climb in real time. The number you wish /context showed you, exposed.

iii.

Trim the fat doctor

Detects the two pathologies the upstream issue documented but the vendor declined to fix — stale plugin versions still being injected, and duplicate skill symlinks paying double rent. Dry-run by default. --fix to apply. Refuses to touch anything outside ~/.claude/.

$ tokenlens doctor

tokenlens doctor
  ~/.claude → /Users/you/.claude
  mode: dry-run (pass --fix to apply)

Stale plugin versions
   none found

Duplicate skill symlinks
   none found

Nothing to do.
$ tokenlens budget

  decision          ●  DENY  (at or above block threshold)
  consumed              4.00M   (input + cache_creation + output)
  budget                2.50M   tier=max5
  used               ████████████████████████   159.9%

  warn at                  50%
  ask at                   80%
  block at                 95%   hardCap=false
iv.

Read the threshold budget

What the v2 plugin enforces in-session: a 50/80/95 ladder against your configured weekly cap. Surfaceable from the CLI before you spend the next turn. Tier presets for Pro, Max 5×, Max 20×, and direct API.

v.

The v2 plugin tokenlens-cc

A Claude Code plugin that wires into the PreToolUse hook. Every tool call is checked against your weekly budget. Below 50% it's silent. Above 80% it asks. Above 95% it denies. Fail-allow on every error path — a broken hook never breaks your workflow.

Pending community marketplace review.

$ claude --plugin-dir ./tokenlens-cc

[tokenlens] loaded · weekly budget 2.5M (max5)

 read the auth module
tokenlens: this turn will push you to ~91% of
your weekly cap (2.27M / 2.50M tokens).
Continue?  [ y/n ]

not planned.

Issue #29971 · closed by Anthropic · March 2026

We did it anyway.

Shipped. Building. Owed.

v0.1 · shipped
The receipt.
  • status · post-hoc breakdown
  • watch · live tail
  • doctor · Issue #29971 fixes
  • budget · threshold preview
  • init · config scaffold
  • npm @bouncei/tokenlens
v0.2 · in flight
The intervention.
  • tokenlens-cc plugin
  • PreToolUse threshold ladder
  • community marketplace sub
v0.3 · next year
Other surfaces.