token-diet logo

token-diet

Always-on token-efficiency skill for coding agents (Claude Code, Codex, Cursor, Windsurf, Cline). ~31% lower bill on average, no loss of correctness.

ShellAI AgentsRAGShell 532 4Health 63
GitHub

What is it?

What it is

An always-on token‑efficiency skill for coding agents (Claude Code, Codex, Cursor, Windsurf, Cline) that trims token usage across replies, docs, tests, code, context, and tool use while preserving correctness.

Why it exists

To reduce LLM API costs and output verbosity for coding agents without sacrificing correctness, delivering ~31% lower bills on average.

Who should use it

Developers and teams using Claude Code, Codex, Cursor, Windsurf, or Cline who want to reduce token consumption, lower costs, and keep output concise without sacrificing correctness.

Who should avoid it

Users who rely on verbose, explanatory output for training or debugging, or who do not use the supported AI agents and cannot integrate the always‑on shell skill.

How it works

A quick walkthrough in plain English

How token-diet works

Step 1 of 3

You interact with it

Open token-diet, send a request, or connect it to your stack.

Features

Always-on token efficiency for coding agents (Claude Code, Codex, Cursor, Windsurf, Cline)
Trims tokens in replies, docs, tests, code, context, and tool use
Multiple concision levels: on (default), lite, ultra, off
Injects directive via SessionStart hook or always-loaded context file (e.g., AGENTS.md, rule files)
Supports per‑agent or project‑specific installation
Guardrails preserve correctness, critical test coverage, and verbatim code/commands/errors
Enables batching of independent tool calls and early stopping when enough info is gathered
Delegates bounded search to cheaper models via sub‑agents while keeping verification on the main agent

Advantages

  • Reduces output tokens by 30%–81% depending on session type
  • Lowers bill by ~31% on average (−17% to −54%)
  • Maintains correctness and critical test coverage in all runs
  • No per‑message command needed; works automatically every session
  • Works across multiple popular AI coding agents
  • Simple one‑liner install script
  • Configurable verbosity levels let users balance brevity and clarity
  • Preserves essential information while removing filler and narration

Disadvantages

  • Requires installation and shell access to run the installer
  • Effectiveness is lower for read‑heavy sessions where file‑reading dominates
  • Savings vary widely by session type (output‑heavy vs code change vs comprehension)
  • Relies on agent‑specific integration points (SessionStart hook, AGENTS.md, rule files)
  • Ultra level may remove explanatory detail that some users find helpful
  • No explicit license specified (license: null) may concern some users

Installation

FAQ

How do I install token-diet?

Run the one‑liner installer: `curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash`. You can also pass options like `--ultra` for telegraphic mode or `--uninstall` to remove it. If you prefer cloning, run `./install.sh` after cloning the repo.

What are the different levels of token-diet and what do they change?

`on` (default) applies all optimisations. `lite` keeps only concise communication and artifacts. `ultra` uses telegraphic chat while still keeping code, tests, and docs precise. `off` disables the skill entirely.

How does token-diet trim token usage?

It removes unnecessary preambles and postambles from replies, shortens docs and comments, limits tests to essential paths, reads only needed file lines, batches tool calls, and delegates broad searches to cheaper models. All of this keeps output concise without sacrificing correctness.

Can I target a specific agent or install it only for a project?

Yes. Use the `-a` flag to target an agent (`claude`, `codex`, `cursor`, `windsurf`, `cline`, or `all`). Add `--project` to install into the current repository instead of globally.

How do I enable or disable token-diet during a session?

The skill is always‑on by default, but you can toggle it on demand with the command `/token-diet [on|lite|ultra|off]` within a session.

Loading documentation…
View on GitHub

Featured in Videos

YouTube tutorials and walkthroughs for token-diet

t5

70,223,459 views

Starts at 00:00

Share

Alternatives

Similar projects ranked by category, topics, and text overlap.

Compare
token-diet | MushyBook