token-efficiency
Skill2 starsChanged 51 days agoMITView on GitHub
Diagnose and cut token consumption in agentic coding workflows — context rot, the 40% rule, intentional compaction, subagents as context firewalls, effort and model selection, prompt-caching invalidation, tool-output hygiene, KPIs. Use when asked why an agent is expensive or slow, when a session is drifting or re-exploring files it already read, when caching is not hitting (cache_read_input_tokens 0 on an unchanged prefix), when MCP tool schemas eat the window in /context, when choosing effort or model per phase, when a CLAUDE.md or prompt needs slimming, or when measuring tokens per completed task.
13 other projects use a version of this.
Adopted by
Most recently taken up by
- HHU3637kr/skillstheir own version, first seen Nov 21, 2026
- REPOZY/superpowers-optimizedtheir own version, first seen Nov 8, 2026
- harshnag/agent-engineering-practicestheir own version, first seen Nov 1, 2026
- viasrijan/crazy-skillstheir own version, first seen Oct 20, 2026
- SmokerGreenOG/ToolCasetheir own version, first seen Oct 15, 2026
- romangalaxys10-spec/fabletheir own version, first seen Oct 13, 2026
Used with
Projects with it also use tdd.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkilltdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- rohitg00/pro-workflow★ 2.9ksame name
- HHU3637kr/skills★ 150same name
- REPOZY/superpowers-optimized★ 147same name
- prangishviliAbe/agent-skills★ 8same name
- romangalaxys10-spec/fable★ 4same name
- saitarrun/Devforge-ai★ 4same name
- JoaoEquer/Oficina★ 2same name
- SmokerGreenOG/ToolCase★ 2same name
- denfry/claude-skills★ 1same name
- Biznomad/claude-skills★ 0same name
3 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- handoffSkill
- qrspi-newSkill
- qrspi-nextSkill
- qrspi-reviewSkill
- qrspiSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
If you track only three, track the first three.
“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token efficiency for coding agents
Verified against the Claude API, reference model claude-opus-5. Every reference
closes with In Claude Code — the same lever as exercised from the CLI, for readers
who never call the API directly.
The mental model
With a 1M window, "does it fit?" is almost always yes. The right question is how much of that context is signal?
Quality degrades long before the window fills. The informal name is context rot: instructions given 200k tokens ago get ignored, the agent re-explores files it already read, mid-session decisions get contradicted, the loop fills with redundant tool calls. The heuristic: keep utilisation under ~40%, then stop and compact.
So the metric is not tokens spent but signal density = useful / total tokens in
context. Cost falls as a consequence. An agent at 20% context costs less, errs
less and finishes sooner; one at 70% costs more and produces work you redo — and
rework is the largest, least measured cost line.
The levers, in order
Order matters. Caching on a workflow that does not compact saves 10%;
intentional compaction saves 90%. Do not invert them. Before any of them:
measure — references/measuring.md (baseline, usage fields, instrumentation).
| # | Lever | Typical gain | Reference |
| 1 | Intentional compaction — artifacts on disk between phases | 10-20× | references/compaction.md |
| 2 | Subagents as context firewalls, programmatic tool calling | 5-10× on research | references/subagents.md |
| 3 | Effort calibrated per phase, model choice, task budgets | 2-3× on output tokens | references/effort.md |
| 4 | Prompt caching — the invariant, invalidation, gotchas | ~10× on repeated prefixes | references/caching.md (+ caching-api.md for your own loop) |
| 5 | Tool definitions and output, context editing, memory | 10-30k per avoided read | references/tool-hygiene.md |
The five KPIs
If you track only three, track the first three.
| # | KPI | Formula | Target |
| 1 | Context utilisation | peak total_input / window, per phase | < 40% |
| 2 | Compression ratio | tokens burned in phase / artifact tokens | > 15× |
| 3 | Tokens per completed task | sum across phases, per closed task | trend ↓ |
| 4 | Cache hit ratio | cache_read / (cache_read + input_tokens) | > 70% in Implement |
| 5 | Rework rate | phases re-run / total phases | < 15% |
- KPI 5 is the canary. High rework almost always means a badly written upstream artifact, not the model or the effort. Read the artifact before raising effort.
- KPI 4 is read per phase, never aggregated. Research is naturally low (content is always new); in Implement, under 70% means you have an invalidator.
- KPI 2 under 10× means the artifact carries material that should have stayed in the previous phase.
Beyond the five, load only what the question needs: references/anti-patterns.md
(the table) and references/playbook.md (4-week rollout, prices, beta headers).
Lever #1 as a workflow is the qrspi skill; the craft of the artifact it depends on
is handoff.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

