Token Defrag — Development skill for Claude Code
See what Claude Code and OpenCode spend re-reading their own context, and estimate what you could save.
How to install Token Defrag
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open yuseferi/token-defrag and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Token Defrag does
See what Claude Code and OpenCode spend re-reading their own context, and estimate what you could save. Offline estimate + shadow mode, one static Go binary, no telemetry.
Alternatives in Development
README

**Most of what a long coding-agent session costs goes to re-reading itself.**
TokenDefrag shows how much of that you could cut, and measures it live without changing a thing.
[](https://github.com/yuseferi/token-defrag/actions/workflows/ci.yml) [](https://github.com/yuseferi/token-defrag/releases) [](go.mod) [](LICENSE) [](#roadmap)
Works with **Claude Code** and **OpenCode** (any provider, Bedrock included) · one static Go binary · no account · no telemetry
[Quick start](#quick-start) · [Benchmarks](#benchmarks) · [How it works](#how-it-works) · [Why trust the number](#why-trust-the-number) · [Compared](#how-it-compares) · [Roadmap](#roadmap)
Real CLI output on the synthetic benchmark corpus, not on private sessions.
[!IMPORTANT] **TokenDefrag measures; it does not rewrite yet.** `estimate` replays your past sessions offline, and shadow mode (`tokendefrag claude`, the OpenCode plugin) measures real requests while forwarding them unchanged. Live rewriting comes after shadow numbers and a paired eval back it up, so every saving below is an estimate or a would-be measurement, not a reduced bill.
The problem
Every turn of an agent session sends the whole conversation again. With prompt caching that re-read is cheaper per token, but it happens on every call, and the conversation only grows.
![The re-reading tax:
Related Skills
Justsaydone
Shorter replies with Claude Code. Save output token spend.
Extended Manners
Activates the full Trinity Protocol (v2) — the extended output ruleset with Sheggoth/Mask/Weego framework, ass
Ctxfire
Static cost analyzer for multi-agent context graphs: explain what agents load and estimate tokens per fire and
Static
/static — Static Ad Build (fast, no video spend)
Desktop Electron
Desktop application hunting — Electron / Tauri / WebView2. Static binary inspection + IPC fuzzing + proxied tr
Noob CLI
Compact Rust coding agent for local OpenAI-compatible models: one static binary, kernel folder lock (Landlock)
Related Agents
Neo Shadow
Memory keeper. MUST BE USED to save session context into the second brain (.neo/brain/) — at task boundaries,
Finance Unit Economics Analyst
Hemant Goyal, Finance & Unit Economics Analyst. Use to estimate or track Claude/API and infrastructure costs,
Cost Forecaster
Forecasts GDD spend over the next N design cycles. Reads .design/telemetry/costs.jsonl (grouping est_cost_usd