Token x ray
Ten Claude Code skills that fix bugs Anthropic closed as 'not planned'.
npx -y skills add dhruba-datta/claude-papercuts --skill token-x-rayAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
X-ray every source of auto-injected context Claude Code loads at session start — MCP servers, CLAUDE.md files, skills, subagents, and slash commands — and report estimated tokens per source. Use this skill when the user runs /claude-papercuts:token-x-ray, asks where their context tokens went, says Claude feels slow or expensive, mentions /context showing surprising numbers, or wants to know what to disable. Runs the audit.py script in this skill's directory and presents the result verbatim.
SKILL.md
4.1 KB, 952 tokens by cl100k_base, as published. Nobody here has run it
token-x-ray — see where your context tokens went
Fixes:
#39686
What this prevents
"43 claude.ai Skills (~3,950 tokens) and 26 Cowork plugins (~2,020 tokens) silently injected into Claude Code context — no opt-out, ~6k tokens wasted per session." — issue #39686
Claude Code's /context shows category totals but no per-item
breakdown. You see "Skills: 4,200 tokens" with no idea which of your
forty skills is doing the damage. token-x-ray itemizes every
auto-injected source so you can decide what to cut.
What this skill does
When invoked, run the bundled audit.py script (next to this
SKILL.md) and present its output verbatim. The script discovers:
| Source | Where it looks |
|---|---|
| MCP servers | ~/.claude.json, ~/.claude/settings.json, <cwd>/.claude/settings*.json, <cwd>/.mcp.json |
| CLAUDE.md | ~/.claude/CLAUDE.md, <cwd>/CLAUDE.md, <cwd>/.claude/CLAUDE.md |
| Skills | ~/.claude/skills/, <cwd>/.claude/skills/, ~/.claude/plugins/*/skills/ |
| Subagents | ~/.claude/agents/, <cwd>/.claude/agents/ |
| Slash commands | ~/.claude/commands/, <cwd>/.claude/commands/ |
For each source, it estimates tokens using the
4-chars-per-token heuristic. MCP servers are flagged separately
because their tool schemas can only be measured by invoking the
server — the script uses a per-server estimate and points the
user at /context for the authoritative number.
How to invoke (the actual procedure)
-
Run the audit script with the user's current settings:
${CLAUDE_PLUGIN_ROOT}/skills/token-x-ray/audit.py -
If the user passed arguments (e.g.
--json,--cwd,--home), forward them. -
Show the script's output verbatim. The bar chart, the per-source table, and the suggested cut commands are the value — reformatting them defeats the purpose.
-
After showing the output, if the user asks "what should I cut?":
- Point them at the "Top cuts" section
- Note that MCP servers are the highest-leverage cut (1500+ tokens each by heuristic) but require you to actually remove the server entry from settings
- Recommend cutting unused skills/agents/commands first if MCP servers are in active use
-
Never auto-disable anything. The suggested
mvand "remove from settings" hints are for the user to inspect and run themselves.
When to auto-invoke
- User runs
/claude-papercuts:token-x-ray - User asks "where did my context go" / "what's eating my tokens"
- User says Claude feels slow, expensive, or laggy
- User mentions
/contextshowing surprising numbers - User asks for a "context audit" or "token diet"
What this skill does NOT do
- It does not actually invoke MCP servers to measure their real tool schemas. That would be slow and can fail; we use a heuristic and flag it explicitly.
- It does not modify any files or settings. Suggestions are copy-paste, not auto-apply.
- It does not count the conversation/transcript itself — that's
visible in
/contextdirectly and changes every turn. - It does not count fixed prompt overhead (Anthropic's system prompt, tool catalog, etc.). Those are not user-controllable.
Configuration
# Machine-readable JSON for piping into other tools
${CLAUDE_PLUGIN_ROOT}/skills/token-x-ray/audit.py --json
# Audit a different project directory
${CLAUDE_PLUGIN_ROOT}/skills/token-x-ray/audit.py --cwd /path/to/project
Make it a habit
Run after every plugin/MCP install. If /context ever surprises you,
this is the first thing to run.