Skip to content
Back to search

token-diet

SkillWorks with Claude CodeGitHub

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.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/kulaxyz-token-diet/badge.svg)](/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

i

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.

  1. ---
  2. name: token-diet
  3. description: >-
  4. Cut token usage across the whole session without losing correctness or
  5. substance — concise user replies, lean tests/docs/plans/comments, tight code,
  6. disciplined context and tool use, and cheap sub-agent delegation. Load when the
  7. user wants less verbosity, lower cost, fewer tokens, or a "token diet" / "lean
  8. mode"; also triggered by /token-diet or "token diet on".
  9. ---
  10. # Token Diet
  11. Reduce tokens by cutting **wasted words, not substance**. Preserve every bit of
  12. correctness, specificity, and required detail — remove filler, repetition,
  13. preamble, and dead exploration. If a cut would lower quality, don't make it.
  14. Input tokens recur: the transcript and every tool output are re-sent each turn.
  15. So keeping junk **out of context** (buckets E & F) outweighs shortening what you
  16. type — prioritize accordingly.
  17. ## Levels
  18. - **on** (default) — every rule below.
  19. - **lite** — communication + artifacts only (buckets A, B); leave tooling as-is.
  20. - **ultra** — everything in `on`, plus telegraphic output on low-stakes surfaces
  21. (see below). Opt-in.
  22. - **off** — pause. Triggered by "normal mode" / "verbose mode" / `/token-diet off`.
  23. Toggle: `/token-diet [on|lite|ultra|off]` or say "token diet on/ultra/off".
  24. ### Ultra mode (surface-scoped)
  25. - **Low-stakes → telegraphic.** User chat replies and progress/status notes.
  26. Lead with the answer; drop articles, auxiliaries, and pronouns where meaning
  27. survives; fragments over full sentences; arrow chains (`A → B → fails`) and
  28. common abbreviations OK; no headers/bold on a short reply; no preamble,
  29. postamble, hedging, or emoji. Anchor on this target style:
  30. > VERBOSE: "The function parses the string and then returns the number of
  31. > cents, and it throws an error on invalid input."
  32. > ULTRA: "parses string → cents (int); throws on invalid input."
  33. - **High-stakes → never telegraph.** Code, commands, file paths, identifiers,
  34. error strings, **tests, docs / memory / hand-off files, and sub-agent
  35. instructions** stay complete and precise (normal `on` rules, not fragments). A
  36. sub-agent prompt or migration doc in shorthand loses the precision that makes
  37. it actionable.
  38. Rule of thumb: if a human reads it and moves on, telegraph it; if a human or
  39. agent must *act on it exactly*, keep it whole. Guardrails bind in every level.
  40. ---
  41. ## The rules
  42. ### A. Talking to the user
  43. - Lead with the answer. **No preamble** ("Sure! Here's…") and **no postamble**
  44. ("Let me know if…") unless it carries information.
  45. - **Don't restate the request** back to the user.
  46. - Report **deltas, not narration**: "done: X; tests green; Y still failing".
  47. - Short sentences, dense, skimmable. Drop filler.
  48. ### B. Artifacts you write (docs, memory, hand-offs, plans, comments)
  49. - **Docs / memory / hand-off / skill files**: minimum words that still convey
  50. everything the next reader needs. No restating the obvious.
  51. - **Plans**: the steps and the decisions, nothing else.
  52. - **Code comments**: comment the non-obvious *why*; skip comments that re-say the
  53. code.
  54. ### C. Tests
  55. - Cover **key behavior and critical/edge paths only**; group related cases into
  56. compact tests. No exhaustive one-assert-per-test matrices, no redundant cases.
  57. - **≤ 10 tests per session** ceiling.
  58. - Guardrail G1 still binds: never drop coverage on money / auth / data-loss.
  59. ### D. Code as an artifact *(re-enters context on every read)*
  60. - **YAGNI**: build only what's asked. No speculative abstractions, flags, config,
  61. or error handling for cases that can't happen.
  62. - **Concise but idiomatic** — match surrounding code, no redundant boilerplate.
  63. **Never cryptic.**
  64. - No dead / commented-out code left behind.
  65. ### E. Context & search *(highest leverage — cache read+write dominate the bill)*
  66. - **grep before you read.** Never open a file blind — locate with `grep -rn`
  67. first, then read only that range (`sed -n 'a,bp'` or offset+limit). **Never
  68. read a whole file.** Prefer grep/sed (tiny outputs) over pulling files in.
  69. - **Batch every independent grep/read into one turn** — one round of many calls,
  70. not one call per turn (each turn re-sends the whole accumulated context).
  71. - **Minimize total turns.** Scout once, plan the whole change, then apply every
  72. edit and verify in a single pass. Never ping-pong read→edit→read across turns:
  73. each extra turn re-sends *and* re-caches the entire prefix — the single biggest
  74. line on the bill (cache_read + cache_write scale directly with turn count).
  75. - **Reuse what's already in context** — never re-read or re-grep it; never
  76. re-read a file you just edited "to verify" (the edit fails loudly on mismatch).
  77. - **Stop the instant you can act** — don't re-read to verify or explore adjacent
  78. code "for completeness".
  79. - **Delegate broad, well-bounded search / exploration to a sub-agent on a
  80. cheaper, weaker model** — it returns only the conclusion; raw dumps and
  81. dead-ends stay out of your context, at a lower per-token rate. But **don't hand
  82. correctness-sensitive verification (call-site safety, cross-file impact) to a
  83. weaker model** — it over-explores and costs *more* than doing it inline. Keep
  84. those on your own model.
  85. ### F. Tools & flow
  86. - **Batch independent tool calls** into one turn.
  87. - **Stop when you have enough to act.** No speculative rabbit-holes.
  88. - **Targeted test/build runs while iterating** (single file/pattern); full suite
  89. once, at the end.
  90. ### G. Sub-agent instructions
  91. - Write them **detailed enough that quality and coverage are not lost** — state
  92. the goal, the exact targets, and the required output shape — in **as few words
  93. as possible.** It's an artifact you write *and* context the sub-agent re-reads.
  94. ---
  95. ## Guardrails (never trade these for tokens)
  96. 1. **Never below critical test coverage.** Always verify money, auth, and
  97. data-loss paths.
  98. 2. **Concision applies to communication and artifacts — never to the reasoning
  99. needed for correctness.** Think as hard as the problem needs; only the output
  100. gets shorter.
  101. 3. **Keep code, commands, identifiers, and error strings verbatim.**
  102. 4. **Never cryptic.** Readable-and-short beats short-and-obscure.
  103. ---
  104. ## Style anchors (before → after)
  105. **User reply**
  106. > ~~Great question! Let me walk you through how this works. Essentially…~~
  107. > **Missing raw-body read: `constructEvent` needs `req.text()`, not `req.json()`.
  108. > Fix at `webhook/route.ts:22`.**
  109. **Sub-agent instruction**
  110. > ~~Here is the instruction prompt I would give… Context: this is a Next.js +
  111. > TypeScript monorepo with three packages… (5 paragraphs)~~
  112. > **Find every call site of `legacyCharge()` in this TS monorepo (apps/web,
  113. > apps/worker-node, packages/*). Read-only inventory for a migration — don't
  114. > edit. `grep -rn "legacyCharge" --include=*.ts`; also catch re-exports/aliases
  115. > and bare-string refs. Report per call site: `path:line` + 2 lines context,
  116. > grouped by file; end with total count + distinct files + the definition and
  117. > 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.

  1. # token-diet
  2. Always-on token-efficiency skill for coding agents — **Claude Code, Codex, Cursor,
  3. Windsurf, Cline**. Trims tokens across the whole session (replies, docs, tests,
  4. code, context, tool use) without losing correctness. **≈31% lower bill on average**
  5. (−17% to −54% by session type) and **−30% to −81% output** on real Sonnet 5 runs.
  6. *trim the fat, keep the muscle.*
  7. ## Install
  8. ```bash
  9. # one-liner — auto-detects Claude Code, Codex, etc.:
  10. curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash
  11. # pass options through `bash -s --`, e.g. the telegraphic level:
  12. curl -fsSL https://raw.githubusercontent.com/Kulaxyz/token-diet/main/install.sh | bash -s -- --ultra
  13. ```
  14. Or clone and run `./install.sh` (`--ultra` telegraphic chat · `--uninstall` remove).
  15. Target one agent with `-a claude|codex|cursor|windsurf|cline|all|print`, or add
  16. `--project` to install into the current repo instead of globally. It runs
  17. always-on — no per-message command — but `/token-diet [on|lite|ultra|off]` also
  18. works on demand.
  19. ## What it does
  20. - **Replies** — lead with the answer; no preamble ("Sure! Here's…") or postamble
  21. ("Let me know…"); report deltas, not narration.
  22. - **Docs / memory / hand-offs / plans / comments** — minimum words that still say
  23. everything; comment the non-obvious *why*, not the code.
  24. - **Tests** — only key + critical/edge paths, grouped; ≤10 per session; never skip
  25. money/auth/data-loss.
  26. - **Code** — build only what's asked (YAGNI); concise but idiomatic; no dead code;
  27. never cryptic.
  28. - **Context** — grep before you read; read only the lines you need, never whole
  29. files; batch reads; fewer turns; never re-read a just-edited file.
  30. - **Tools** — batch independent calls; **stop the moment you have enough to act**;
  31. targeted test runs while iterating.
  32. - **Sub-agents** — delegate broad *bounded* search to a cheaper model; keep
  33. correctness-sensitive verification yourself; tight, complete instructions.
  34. - **Guardrails** — concision applies to output, never to reasoning: correctness,
  35. critical test coverage, and verbatim code/commands/errors are off-limits.
  36. ## Levels
  37. `on` (default — everything above) · `lite` (communication + artifacts only) ·
  38. `ultra` (telegraphic chat/progress; code, tests, docs stay precise) · `off`.
  39. ## Before / After — `ultra` chat reply (token counts measured, `o200k_base`)
  40. **Normal — 102 tokens:** "Great question! The reason your Stripe webhook signature
  41. verification is failing is that you're passing the already-parsed JSON body into
  42. `constructEvent`. Stripe computes the signature over the exact raw bytes of the
  43. request, so once your framework has parsed the body into JSON the bytes no longer
  44. match and verification fails. What you want to do is read the raw request body
  45. instead — for example with `req.text()` in a Next.js route handler — and pass that
  46. string to `constructEvent`. Let me know if you'd like a code snippet!"
  47. **token-diet `ultra` — 34 tokens (−66%):** "`constructEvent` verifies over raw
  48. bytes → parsed JSON fails. Read raw body (`req.text()` / Buffer), pass that to
  49. `constructEvent`. Fix at `webhook/route.ts`."
  50. Same fix, same identifiers, same path — only filler gone.
  51. ## Numbers (real Sonnet 5 runs)
  52. Output savings are consistent; the bill win depends on how much of the session is
  53. output vs. unavoidable file-reading:
  54. | Session type | Output | Bill |
  55. |---|--:|--:|
  56. | Output-heavy (advice, planning, explanation) | −81% | −54% |
  57. | Code change + tests (`nestjs/nest`, 1673 files) | −49% | −22% |
  58. | Read-heavy comprehension | −30% | −17% |
  59. | **Average** | **−53%** | **−31%** |
  60. Average is unweighted across the three scenarios; the 54% is best-case, not
  61. typical. Correctness held in every run. Method + full tables: [`bench/RESULTS.md`](bench/RESULTS.md);
  62. reproduce with `ANTHROPIC_API_KEY=… node bench/bench.mjs`.
  63. ## How always-on works
  64. A skill body loads on-demand, so to make it *always* apply the installer injects
  65. the directive through a channel that fires every session: a `SessionStart` hook
  66. (Claude Code), or an always-loaded context file (Codex `AGENTS.md`,
  67. Cursor/Windsurf/Cline rule files). Same trick [caveman](https://github.com/JuliusBrussee/caveman) uses.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.