token-efficiency
Skill0 starsChanged 46 days agoMITView on GitHub
How an agent gets the same work done for fewer tokens by measuring where spend goes, keeping a prompt cache warm across long waits only when the arithmetic says so, keeping context lean, and treating model choice as the largest cost decision. Use when about to wait on a test suite, build, sub-agent, session or command that may run for minutes; choosing a wait, poll, delay or timeout; deciding whether to delegate to a sub-agent; resuming a session after a break; choosing a model or reasoning effort; or when asked about token burn, credits, cache hits, cache TTL, or cost.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- REPOZY/superpowers-optimizedtheir own version, first seen Nov 8, 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
- JoaoEquer/Oficinatheir own version, first seen Oct 13, 2026
- rohitg00/pro-workflowtheir own version, first seen Sep 29, 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 versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- rohitg00/pro-workflow★ 2.9ksame name
- HHU3637kr/skills★ 146same name
- REPOZY/superpowers-optimized★ 146same 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
2 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 repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-concurrencySkill
- agent-handoverSkill
- bounded-iterationSkill
- checking-claimsSkill
- coordinating-agentsSkill
- durable-project-memorySkill
- external-data-claimsSkill
- measured-changesSkill
- project-agent-instructionsSkill
- resource-safe-toolingSkill
- shipping-changesSkill
- unslopSkill
- verify-in-the-real-thingSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 9 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
9
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 14
Every model call sends the whole context again.
- Distinctive: line 97
When the lifetime is long and misses inside it are probabilistic, check-ins rarely pay.
- Distinctive: line 105
Never let one wait run past the lifetime.
- Distinctive: line 116
Prefer a bounded wait to ending the turn.
- Distinctive: line 125
If the tool's own instructions or the user say not to poll, that instruction wins.
- Distinctive: line 136
Start long work in the background and do independent work meanwhile.
- Distinctive: line 138
When waits are long by nature, hours rather than minutes, one rebuild per wait is the correct price.
- Distinctive: line 156
Start a fresh session for unrelated work rather than resuming a large one.
- Distinctive: line 194
Every figure in this file comes from one person's six weeks with one agent tool, at October 2026 prices, measured as described in the …
“Common” is measured: kept by at least 6 in 10 of the 12 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
Every model call sends the whole context again. The provider bills the part it still holds in its prompt cache at a fraction of the input price, and the part it has to rebuild at a premium. So the price of a call is roughly:
context size × price per token, where the price depends on whether the cache is still warm. Model rate, context size, number of calls, and cache state are the levers. They are not the same size, and the one people talk about is rarely the largest.
Current rates make the gap large. Reading a cached prefix costs 0.025 to 0.1 of the input price, depending on the model; rebuilding it costs 1.25 times the input price where the provider charges for cache writes. The same prompt costs 12 to 50 times more when the cache has gone cold.
The cache lives for a fixed time after the last call that used it. Anthropic documents five minutes, measured from the start of the request, so time spent generating counts against it. OpenAI documents at least thirty minutes for GPT-5.6 and later. Nothing that happens between calls refreshes it: a test run, a build, a sub-agent working, a human reading. Only the next call does.
Measure before optimising
The claim that motivates most advice here, that a test suite running longer than
five minutes burns tokens, is true for some models and false for others reached
through the same tool. Run the report on your own sessions before changing
anything. From this skill's directory (~/.copilot/skills/token-efficiency once
installed):
python scripts/cache_report.py [--since 2026-10-01] [--session <id>]It opens the local session store read-only and prints its selection and definitions first, then:
- spend by token type and by model, with median and p90 prompt size;
- the cold-call rate by gap, per model. The column where the rate steps from near 0% to near 100% is that model's cache lifetime as you run it;
- cold-call cost split into compaction, short gaps, and long gaps;
- what filled each long gap: one tool call (with its wait setting), a human, or nothing the timeline can name;
- the expected net saving from checking in at several intervals, using each
model's measured curve of how much of the prompt gets rebuilt at each gap.
It prints
?rather than a number where the curve has too few samples.
scripts/test_cache_report.py covers it against a synthetic store with known
answers. Twenty-one deliberate mutations were each caught; see
the measurements.
In the one data set measured so far (40,000 calls over six weeks), the levers ranked like this:
| Lever | Measured size |
| Model rate | one model took 76% of spend at five to six times the per-call cost of the next two, at the same median prompt size |
| Context size | cache reads were 55% of spend; the median prompt was about 220K tokens |
| Cold cache with unchanged context, short gap | 15.4% of spend; provider or agent-runtime behaviour an agent mostly cannot change |
| Cold cache after a human break | 5.8% |
| Cold cache during a wait the agent chose | 3.0%, plus 1.0% in gaps no tool call explains |
So the five-minute rule is real, and in that data the avoidable part of it was under 4% of spend. Fix it, because the fix is nearly free. Do not mistake it for the main lever.
Know the cache lifetime of the model you are on
The lifetime is set by the provider and the tool that calls it, not by you, and models reached through the same tool differ by a factor of six. Read it from section 2 of the report or from a published measurement, and record the date. The values observed in GitHub Copilot CLI in October 2026 are in the measurements: about five minutes for Claude models, about thirty minutes for the GPT-6 family.
A wait longer than the lifetime: check in, or accept one rebuild
A check-in is one cheap call before the cache expires. It costs one cached read of the context plus a little output. One avoided rebuild pays for
break-even = (rebuild price − read price) / read pricecheck-ins. That is 24 for a model whose cached reads cost 0.05 of input, and about 12 at 0.1. With a five-minute lifetime and a check-in every four minutes, checking in pays for waits up to roughly 90 or 45 minutes respectively. Past that, one rebuild is cheaper; stop checking in and wait.
When the lifetime is long and misses inside it are probabilistic, check-ins rarely pay. On the two GPT-6 models, whose lifetime was about thirty minutes, no interval tested from 2 to 30 minutes saved more than 20 credits over six weeks, and the short ones lost thousands. On the five-minute Claude model, checking in every four minutes would have saved about 26,000 credits net.
On a model with a short lifetime:
- Never let one wait run past the lifetime. The clock starts when the previous
model call starts, so the wait plus that call's own duration must stay under
it. For a five-minute lifetime, budget 270 seconds minus the previous call's
duration: 240 seconds after a reply of a few seconds, which was about 95% of
measured calls, and 180 seconds when you cannot tell how long the call took.
In the measured data, waits written as
initial_wait=400ordelay=600caused 158 rebuilds. - A check-in reads a status line or the tail of the output. It does not re-read the log, re-plan, or re-open files. Its output tokens are billed at the output rate, and a check-in that reasons for 2,000 tokens can cost as much as the cached read it was protecting.
- Prefer a bounded wait to ending the turn. An agent that stops to await a notification sends nothing, so the cache expires whatever the wait.
- A synchronous sub-agent call is one wait the parent cannot cut short. If it may run past the lifetime, start it in the background and check in on it.
In GitHub Copilot CLI that means initial_wait, read_powershell delay and
read_agent timeout within that budget, and task in background mode for
anything that may take more than a few minutes.
If the tool's own instructions or the user say not to poll, that instruction wins. The measured saving was about 2% of spend: worth taking, never worth a conflict.
Make long waits rare
Cheaper than keeping a cache warm through a wait is not waiting.
- Iterate on the narrowest check and run the full suite once, as
bounded-iterationsets out. A suite longer than the lifetime, run after every edit, pays one full rebuild per run. - Start long work in the background and do independent work meanwhile. Each useful call refreshes the cache for nothing.
- When waits are long by nature, hours rather than minutes, one rebuild per wait is the correct price. Do not check in for hours.
Context is paid for on every call
A token in the context is billed again on every later call. At a 220K-token prompt and a cached read price of USD 0.20 per million tokens, re-reading the context costs 4.4 credits per call before the model does anything.
- Filter command output to the failing assertion and the summary line. Do not page whole logs into the conversation.
- View line ranges of large files, and do not re-read files that have not changed.
- Delegate verbose exploration to a sub-agent that returns a summary, when the parent still has many calls to make. A sub-agent starts cold: its first call wrote a median 24,000 tokens in the measured data. Delegation pays when tokens kept out of the parent × the parent's remaining calls × the read price exceeds that.
- Start a fresh session for unrelated work rather than resuming a large one. The first call after a break longer than the lifetime rebuilds the whole context, which for new work is paying to reload history it does not need.
Model rate is the largest lever, and it is a quality decision
At the same prompt size, per-call cost differed five- to sixfold between models. Spend on a model is a choice about output quality that the token numbers only price; they cannot make it for you. What they can show is where an expensive model is doing work a cheaper one does as well: searching, running and summarising tests, reading logs, mechanical edits. Make that a decision per task or per sub-agent rather than a session default. Reasoning effort is the same decision at a smaller scale, because reasoning tokens bill as output.
What not to chase
- Cold calls after short gaps with an unchanged context. They come from compaction, from the agent runtime rewriting history, from tool lists changing, or from the provider not reusing a prefix. Report them; do not invent rituals to prevent them.
- Spending to use up an allowance, or checking in past break-even "to be safe". Both are spending presented as saving.
- A check-in loop that exists so a dashboard shows a high cache-hit rate. The target is credits per unit of verified work, not the hit rate.
Signals
| Signal | Usual meaning |
| A single wait of five minutes or more on a short-lifetime model | The next call rebuilds the whole context |
delay, timeout or initial_wait of 300 seconds or more | The same, chosen in advance |
| Each check-in reads a full log | Context growing for nothing; read the tail |
| Prompt above 200K and rising during mechanical work | Delegate it, or start fresh for the next task |
| Many cold calls with unchanged context and short gaps | Runtime or provider; record it, do not fix it |
| One model dominating spend at several times the per-call cost | Decide per task whether it is earning that |
The numbers here are one operator's
Every figure in this file comes from one person's six weeks with one agent tool, at October 2026 prices, measured as described in the measurements. Cache lifetimes, prices and runtime behaviour change without notice. Run the report, and replace these numbers with yours before arguing from them.
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.

