token-diet
Cut token usage across the whole session without losing correctness or substance — concise user replies, lean tests/docs/plans/comments, tight code, disciplined context and tool use, and cheap sub-agent delegation. Load when the user wants less verbosity, lower cost, fewer tokens, or a "token diet" / "lean mode"; also triggered by /token-diet or "token diet on".
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/kulaxyz-token-diet)HTML
<a href="/listings/kulaxyz-token-diet"><img src="/api/listings/kulaxyz-token-diet/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
These steps run a script from the network that findsafeskills does not scan.
# one-liner — auto-detects Claude Code, Codex, etc.: curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash # pass options through `bash -s --`, e.g. the telegraphic level: curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash -s -- --ultra
Or clone and run `./install.sh` (`--ultra` telegraphic chat · `--uninstall` remove). Target one agent with `-a claude|codex|cursor|windsurf|cline|all|print`, or add `--project` to install into the current repo instead of globally. It runs always-on — no per-message command — but `/token-diet [on|lite|ultra|off]` also works on demand.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 142 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- ---
- name: token-diet
- description: >-
- Cut token usage across the whole session without losing correctness or
- substance — concise user replies, lean tests/docs/plans/comments, tight code,
- disciplined context and tool use, and cheap sub-agent delegation. Load when the
- user wants less verbosity, lower cost, fewer tokens, or a "token diet" / "lean
- mode"; also triggered by /token-diet or "token diet on".
- ---
- # Token Diet
- Reduce tokens by cutting **wasted words, not substance**. Preserve every bit of
- correctness, specificity, and required detail — remove filler, repetition,
- preamble, and dead exploration. If a cut would lower quality, don't make it.
- Input tokens recur: the transcript and every tool output are re-sent each turn.
- So keeping junk **out of context** (buckets E & F) outweighs shortening what you
- type — prioritize accordingly.
- ## Levels
- - **on** (default) — every rule below.
- - **lite** — communication + artifacts only (buckets A, B); leave tooling as-is.
- - **ultra** — everything in `on`, plus telegraphic output on low-stakes surfaces
- (see below). Opt-in.
- - **off** — pause. Triggered by "normal mode" / "verbose mode" / `/token-diet off`.
- Toggle: `/token-diet [on|lite|ultra|off]` or say "token diet on/ultra/off".
- ### Ultra mode (surface-scoped)
- - **Low-stakes → telegraphic.** User chat replies and progress/status notes.
- Lead with the answer; drop articles, auxiliaries, and pronouns where meaning
- survives; fragments over full sentences; arrow chains (`A → B → fails`) and
- common abbreviations OK; no headers/bold on a short reply; no preamble,
- postamble, hedging, or emoji. Anchor on this target style:
- > VERBOSE: "The function parses the string and then returns the number of
- > cents, and it throws an error on invalid input."
- > ULTRA: "parses string → cents (int); throws on invalid input."
- - **High-stakes → never telegraph.** Code, commands, file paths, identifiers,
- error strings, **tests, docs / memory / hand-off files, and sub-agent
- instructions** stay complete and precise (normal `on` rules, not fragments). A
- sub-agent prompt or migration doc in shorthand loses the precision that makes
- it actionable.
- Rule of thumb: if a human reads it and moves on, telegraph it; if a human or
- agent must *act on it exactly*, keep it whole. Guardrails bind in every level.
- ---
- ## The rules
- ### A. Talking to the user
- - Lead with the answer. **No preamble** ("Sure! Here's…") and **no postamble**
- ("Let me know if…") unless it carries information.
- - **Don't restate the request** back to the user.
- - Report **deltas, not narration**: "done: X; tests green; Y still failing".
- - Short sentences, dense, skimmable. Drop filler.
- ### B. Artifacts you write (docs, memory, hand-offs, plans, comments)
- - **Docs / memory / hand-off / skill files**: minimum words that still convey
- everything the next reader needs. No restating the obvious.
- - **Plans**: the steps and the decisions, nothing else.
- - **Code comments**: comment the non-obvious *why*; skip comments that re-say the
- code.
- ### C. Tests
- - Cover **key behavior and critical/edge paths only**; group related cases into
- compact tests. No exhaustive one-assert-per-test matrices, no redundant cases.
- - **≤ 10 tests per session** ceiling.
- - Guardrail G1 still binds: never drop coverage on money / auth / data-loss.
- ### D. Code as an artifact *(re-enters context on every read)*
- - **YAGNI**: build only what's asked. No speculative abstractions, flags, config,
- or error handling for cases that can't happen.
- - **Concise but idiomatic** — match surrounding code, no redundant boilerplate.
- **Never cryptic.**
- - No dead / commented-out code left behind.
- ### E. Context & search *(highest leverage — cache read+write dominate the bill)*
- - **grep before you read.** Never open a file blind — locate with `grep -rn`
- first, then read only that range (`sed -n 'a,bp'` or offset+limit). **Never
- read a whole file.** Prefer grep/sed (tiny outputs) over pulling files in.
- - **Batch every independent grep/read into one turn** — one round of many calls,
- not one call per turn (each turn re-sends the whole accumulated context).
- - **Minimize total turns.** Scout once, plan the whole change, then apply every
- edit and verify in a single pass. Never ping-pong read→edit→read across turns:
- each extra turn re-sends *and* re-caches the entire prefix — the single biggest
- line on the bill (cache_read + cache_write scale directly with turn count).
- - **Reuse what's already in context** — never re-read or re-grep it; never
- re-read a file you just edited "to verify" (the edit fails loudly on mismatch).
- - **Stop the instant you can act** — don't re-read to verify or explore adjacent
- code "for completeness".
- - **Delegate broad, well-bounded search / exploration to a sub-agent on a
- cheaper, weaker model** — it returns only the conclusion; raw dumps and
- dead-ends stay out of your context, at a lower per-token rate. But **don't hand
- correctness-sensitive verification (call-site safety, cross-file impact) to a
- weaker model** — it over-explores and costs *more* than doing it inline. Keep
- those on your own model.
- ### F. Tools & flow
- - **Batch independent tool calls** into one turn.
- - **Stop when you have enough to act.** No speculative rabbit-holes.
- - **Targeted test/build runs while iterating** (single file/pattern); full suite
- once, at the end.
- ### G. Sub-agent instructions
- - Write them **detailed enough that quality and coverage are not lost** — state
- the goal, the exact targets, and the required output shape — in **as few words
- as possible.** It's an artifact you write *and* context the sub-agent re-reads.
- ---
- ## Guardrails (never trade these for tokens)
- 1. **Never below critical test coverage.** Always verify money, auth, and
- data-loss paths.
- 2. **Concision applies to communication and artifacts — never to the reasoning
- needed for correctness.** Think as hard as the problem needs; only the output
- gets shorter.
- 3. **Keep code, commands, identifiers, and error strings verbatim.**
- 4. **Never cryptic.** Readable-and-short beats short-and-obscure.
- ---
- ## Style anchors (before → after)
- **User reply**
- > ~~Great question! Let me walk you through how this works. Essentially…~~
- > **Missing raw-body read: `constructEvent` needs `req.text()`, not `req.json()`.
- > Fix at `webhook/route.ts:22`.**
- **Sub-agent instruction**
- > ~~Here is the instruction prompt I would give… Context: this is a Next.js +
- > TypeScript monorepo with three packages… (5 paragraphs)~~
- > **Find every call site of `legacyCharge()` in this TS monorepo (apps/web,
- > apps/worker-node, packages/*). Read-only inventory for a migration — don't
- > edit. `grep -rn "legacyCharge" --include=*.ts`; also catch re-exports/aliases
- > and bare-string refs. Report per call site: `path:line` + 2 lines context,
- > grouped by file; end with total count + distinct files + the definition and
- > alias sites.**
README.md · README · 87 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- # token-diet
- Always-on token-efficiency skill for coding agents — **Claude Code, Codex, Cursor,
- Windsurf, Cline**. Trims tokens across the whole session (replies, docs, tests,
- code, context, tool use) without losing correctness. **≈31% lower bill on average**
- (−17% to −54% by session type) and **−30% to −81% output** on real Sonnet 5 runs.
- *trim the fat, keep the muscle.*
- ## Install
- ```bash
- # one-liner — auto-detects Claude Code, Codex, etc.:
- curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash
- # pass options through `bash -s --`, e.g. the telegraphic level:
- curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash -s -- --ultra
- ```
- Or clone and run `./install.sh` (`--ultra` telegraphic chat · `--uninstall` remove).
- Target one agent with `-a claude|codex|cursor|windsurf|cline|all|print`, or add
- `--project` to install into the current repo instead of globally. It runs
- always-on — no per-message command — but `/token-diet [on|lite|ultra|off]` also
- works on demand.
- ## What it does
- - **Replies** — lead with the answer; no preamble ("Sure! Here's…") or postamble
- ("Let me know…"); report deltas, not narration.
- - **Docs / memory / hand-offs / plans / comments** — minimum words that still say
- everything; comment the non-obvious *why*, not the code.
- - **Tests** — only key + critical/edge paths, grouped; ≤10 per session; never skip
- money/auth/data-loss.
- - **Code** — build only what's asked (YAGNI); concise but idiomatic; no dead code;
- never cryptic.
- - **Context** — grep before you read; read only the lines you need, never whole
- files; batch reads; fewer turns; never re-read a just-edited file.
- - **Tools** — batch independent calls; **stop the moment you have enough to act**;
- targeted test runs while iterating.
- - **Sub-agents** — delegate broad *bounded* search to a cheaper model; keep
- correctness-sensitive verification yourself; tight, complete instructions.
- - **Guardrails** — concision applies to output, never to reasoning: correctness,
- critical test coverage, and verbatim code/commands/errors are off-limits.
- ## Levels
- `on` (default — everything above) · `lite` (communication + artifacts only) ·
- `ultra` (telegraphic chat/progress; code, tests, docs stay precise) · `off`.
- ## Before / After — `ultra` chat reply (token counts measured, `o200k_base`)
- **Normal — 102 tokens:** "Great question! The reason your Stripe webhook signature
- verification is failing is that you're passing the already-parsed JSON body into
- `constructEvent`. Stripe computes the signature over the exact raw bytes of the
- request, so once your framework has parsed the body into JSON the bytes no longer
- match and verification fails. What you want to do is read the raw request body
- instead — for example with `req.text()` in a Next.js route handler — and pass that
- string to `constructEvent`. Let me know if you'd like a code snippet!"
- **token-diet `ultra` — 34 tokens (−66%):** "`constructEvent` verifies over raw
- bytes → parsed JSON fails. Read raw body (`req.text()` / Buffer), pass that to
- `constructEvent`. Fix at `webhook/route.ts`."
- Same fix, same identifiers, same path — only filler gone.
- ## Numbers (real Sonnet 5 runs)
- Output savings are consistent; the bill win depends on how much of the session is
- output vs. unavoidable file-reading:
- | Session type | Output | Bill |
- |---|--:|--:|
- | Output-heavy (advice, planning, explanation) | −81% | −54% |
- | Code change + tests (`nestjs/nest`, 1673 files) | −49% | −22% |
- | Read-heavy comprehension | −30% | −17% |
- | **Average** | **−53%** | **−31%** |
- Average is unweighted across the three scenarios; the 54% is best-case, not
- typical. Correctness held in every run. Method + full tables: [`bench/RESULTS.md`](bench/RESULTS.md);
- reproduce with `ANTHROPIC_API_KEY=… node bench/bench.mjs`.
- ## How always-on works
- A skill body loads on-demand, so to make it *always* apply the installer injects
- the directive through a channel that fires every session: a `SessionStart` hook
- (Claude Code), or an always-loaded context file (Codex `AGENTS.md`,
- Cursor/Windsurf/Cline rule files). Same trick [caveman](https://github.com/JuliusBrussee/caveman) uses.
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.