TokXray — AI skill for Claude Code
Find where AI coding sessions waste tokens.
How to install TokXray
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open Fly-Pluche/TokXray and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What TokXray does
Find where AI coding sessions waste tokens. TokXray scans local logs from Claude Code, Codex, Antigravity, and other coding agents to flag prompt cache misses, costly tool calls, repeated file reads, and subagent overhead.
Alternatives in AI
- Tokentab — A CLI that reads Claude Code, Codex, and Gemini CLI session logs and works out how much they cost, by model, p 226 ★
- Agf — Local-first TUI to find, search, and resume AI coding-agent sessions across Claude Code, Codex, Grok Build, Ki 148 ★
- AI Agent Session Center — Real-time dashboard that turns AI coding agent sessions (Claude Code, Gemini CLI, Codex) into animated 3D robo 82 ★
README
English | [简体中文](./README_CN.md)
TokXray
**CodexBar watches your quota. ccusage totals your bill. TokXray X-rays what you wasted — and prescribes how to fix it.**
TokXray is a cross-platform Token Waste & Cache Invalidation Profiler & Doctor for **Claude Code, Codex, Antigravity, DeepSeek Harness (DSH), Cursor, OpenCode, and Gemini CLI**. Run `npx tokxray` to find which turns rebuilt a warm cache, which tools returned expensive results, and how much of a session's cost came from delegated work.

*Example report generated from synthetic sessions.*
Quickstart
Requires **Node.js >= 22.5.0** for built-in `node:sqlite`. On early Node 22 releases that gate SQLite, set `NODE_OPTIONS=--experimental-sqlite` or use a newer runtime.
npx tokxray # Terminal report in English
npx tokxray --lang zh # Chinese report
npx tokxray --since 7 --html --redact # Explore the last seven days offline
npx tokxray --png # Terminal report and local burn checkup card
npx tokxray --json # Machine-readable report on stdout
npx tokxray --redact --since 7 # Shortened paths for recently active sessions
Dollar amounts are **API-equivalent estimates** based on logged usage and model pricing, and on Pro, Max, or Team subscriptions, avoidable usage consumes your 5-hour and weekly quotas faster.
From a local checkout, run `npm ci`, then `npm run build` and `node ./bin/tokxray.js`. The local command accepts the same flags.
How platform parsing and deduplication work
| Source | Status | What counts as one turn or session |
|---|---|---|
Claude Code · ~/.claude |
Verified | Reads projects//.jsonl and nested subagents/agent-*.jsonl. Streaming updates with the same message.id contribute the maximum of each usage counter once. The parser unions tool_use blocks by block.id and joins each tool_result by its matching `tool |
Related Skills
Image Read Cache
Agent Skill that caches LLM image descriptions as XMP metadata inside image files, reducing token usage by ~92
Echo Meter
Measure how much of the assistant's prose in this project's Claude Code sessions repeated earlier turns. Runs
Tokenscope
Find the money your AI coding agent wasted: cache rebuilds, loops, re-reads and giant tool outputs, with fixes
Claude Code Secret Guard
Claude Code mod that keeps API keys, tokens and passwords out of the model's context: gitleaks scans every too
ToolTax
Find wasted tokens, slow tools, duplicate calls, and expensive MCP servers in AI agent workflows.
AI Timeline
See what AI coding agents actually do, across one session or thousands. Timelines, tool calls, tokens and cost
Related Agents
Context Optimizer
Meta utility agent for token and context optimization. Spawn when needing to compress agent prompts, optimize
History Analyst
Analyzes git history for changed files to surface context: recent refactors, reverted changes, repeated bug fi
Shared Agent Protocols
Injected into agent context at spawn time. Do NOT add @decision annotations here — they waste agent tokens.