Stop the Token Bleed: Why `token-diet` is Essential for AI Agents
This article argues that `Kulaxyz/token-diet` is a critical, always-on solution for developers to prevent context bloat and reduce hidden token costs…

AI coding agents get expensive faster than most people expect. Not because they write code, but because they never stop talking, and they keep dragging the whole session along with them every turn.
That is why I keep recommending Kulaxyz/token-diet if you use Claude Code, Codex, Cursor, Windsurf, or Cline regularly.
It cuts waste in a place that actually matters, the full session context, not just the final reply.
The problem is context bloat. Every request to an agent sends your current prompt, plus conversation history, system instructions, tool output, and any files already pulled into the context window. That pile grows every turn. Token usage goes up with it, your API bill climbs, latency gets worse, and the agent gets less sharp.
I have seen sessions where one task hits a dollar or two. Do that often enough and the daily cost gets ugly.
token-diet fixes this in a way I like because it is always on.
You install it with a simple curl command, and it injects directives through things like SessionStart hooks or agent-specific context files, similar to how caveman works.
After that, it keeps doing the boring cleanup work in the background.
Here is what it changes:
- Replies: It tells the agent to lead with the answer and drop filler like “Sure! Here’s…” or “Let me know…”. The
READMEshows a before-and-after example with a 66% token reduction for the same fix. - Context: This is the big one. Instead of reading full files blindly,
token-dietpushes the agent togrepfirst, pull only the needed lines, batch reads, and avoid re-reading files it already edited. - Tool use: It pushes agents to batch independent calls and stop once they have enough information to act. That cuts a lot of tool-output spam.
- Code, tests, docs: It applies a YAGNI mindset to code, keeps style concise but idiomatic, limits tests to key paths,
≤10per session with critical ones never skipped, and keeps docs and comments to the fewest words that still explain why something exists.
The numbers are hard to ignore.
token-diet reports an average ≈31% lower bill across session types, with reductions from -17% to -54%.
Output drops by −30% to −81% on real Sonnet 5 runs.
The part I keep coming back to is this, it claims those savings come without any loss of correctness.
If that holds, that is the whole point.
Sure, you can try to fix this with discipline. You can write tighter prompts, summarize chats, start fresh threads for unrelated work, group questions, or use smaller models when the task is simple. You should do that anyway.
But discipline slips. That is the part people gloss over. When you are in the middle of real work, you will forget to prune a chat or clean up a prompt. I do too.
So my take is simple.
token-diet is not a replacement for good prompting habits.
It is the baseline.
It automates the habits you already know you should have, and it does it every session.
The obvious pushback is that shorter output can get vague.
That concern is fair.
What I like here is that token-diet draws a clear line, concision applies to output, not to reasoning, correctness, critical test coverage, or verbatim commands and errors.
Even the “ultra” mode keeps code, tests, and docs precise.
That makes the tradeoff feel a lot less sketchy.
With frontier model pricing where it is, including GPT-5.2 Codex at $14.00/1M output tokens, I do not see this as optional if you lean on coding agents heavily. It is a practical guardrail. You get to move fast without babysitting token usage on every task.
That is the pitch. If you are paying real money for agent sessions, this is one of the first things I would install.
Until next time, happy coding 👨💻
– Patricio Marroquin 💜
Related articles

Why the AI Inference Layer Is Your Next Strategic Battleground
The new frontier in AI development isn't just model quality; it's about controlling the inference layer for cost optimization, resilience, and technical

Agentic AI Coding: The Hidden Cost of Claude Code's Token Overhead
Claude Code consumes significantly more tokens than OpenCode due to harness design and caching, impacting costs and developer control.

Beyond Benchmarks: Why We Must Re-Evaluate AI Code with Human Eyes
OpenAI's recent findings expose critical flaws in AI coding benchmarks, urging developers to adopt rigorous, human-validated evaluations for trustworthy