← /blog
· ACE Engineering#coding-agents #claude-code #context #cost #cache #scorecard #measurement #research #roadmap #sidecar #managed-api-stack

Context Optimization Benchmark: Empirical Ranking of Caching, Compaction, and Routing

Empirical breakdown of four context reduction levers across 149 AI coding agent sessions: measuring the real-world ROI of prompt caching (90.5% redundant input), age-out pruning, and Bash truncation.

Four context optimisations were specified, ranked and scheduled: de-duplicate repeat file reads, supersede stale tool results, age out old content, truncate oversized Bash output. This post is the backtest of each one against real sessions, with the arithmetic attached.

The corpus: one developer, one machine, 36 days. 149 sessions — 59 developer sessions plus the 90 subagent runs they spawned — 14,948 tool results, 14,385 API requests, 4.38 billion prompt tokens, $3,195.19 at Anthropic list price. Every figure is reproducible by re-running the script that produced it.

The dollar figures are list-price valuations, not money paid. The developer was on a subscription for the whole window; the figures are what a BYOK or API-billed team with this workload shape would be charged. The corpus was generated under zero marginal cost, so nothing in it was shaped by price and context growth is an upper bound.

One developer is one developer. The cost structure is a property of how agentic coding works. The magnitudes are this fleet's; §10 lists what that limits.


1. The unit, and the ceiling

The unit throughout is token-turns — tokens × turns resident. Content in the context is re-read on every subsequent request, so this is the quantity cache-read billing is proportional to. A 10,000-token file read at turn 100 of a 1,100-turn session costs 10 million token-turns, not 10,000 tokens.

Tool results resident 1,060,482,369 token-turns
Valued at each session's own cache-read rate $452.97
Share of the $3,195.19 billed 14.2%
Share of the 4.38B prompt tokens processed 24.2%

Where that occupancy sits:

Tool Resident token-turns Share
Bash 487,265,664 45.95%
Read 419,811,300 39.59%
Edit 46,134,368 4.35%
chrome/computer 38,729,141 3.65%
ExitPlanMode 18,816,234 1.77%
Agent 15,594,672 1.47%
Write 9,319,374 0.88%
AskUserQuestion 8,636,594 0.81%

Bash is the largest resident tool, ahead of Read, while the published ordering put Read work first.

Bar showing tool results are 24.2% of prompt-token volume against 75.8% invisible to a transcript, with each lever's removal drawn to the same scale: age-out at 100 turns 17.19%, age-out at 400 turns 7.45%, Bash truncate 2.90%, supersede 0.67%, read de-dup 0.03%

Every lever below reaches only that 24.2%. System prompt, tool definitions and message history are the other 75.8% and are not recorded in a transcript.


2. The ranking

Standalone — each lever alone against the full corpus, so the shares overlap and must not be summed:

Ranked bars of lever value with risk labels: age-out at 100 turns <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>304.66</mn><mi>h</mi><mi>i</mi><mi>g</mi><mi>h</mi><mi>r</mi><mi>i</mi><mi>s</mi><mi>k</mi><mo separator="true">,</mo><mi>a</mi><mi>g</mi><mi>e</mi><mo>−</mo><mi>o</mi><mi>u</mi><mi>t</mi><mi>a</mi><mi>t</mi><mn>400</mn><mi>t</mi><mi>u</mi><mi>r</mi><mi>n</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">304.66 high risk, age-out at 400 turns</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">304.66</span><span class="mord mathnormal">hi</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">h</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">i</span><span class="mord mathnormal">s</span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="katex-base"><span class="katex-strut" style="height:0.6444em;"></span><span class="mord mathnormal">o</span><span class="mord mathnormal">u</span><span class="mord mathnormal">t</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord">400</span><span class="mord mathnormal">t</span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span></span></span></span>122.57 medium, Bash truncate <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>54.94</mn><mi>l</mi><mi>o</mi><mi>w</mi><mo separator="true">,</mo><mi>s</mi><mi>u</mi><mi>p</mi><mi>e</mi><mi>r</mi><mi>s</mi><mi>e</mi><mi>d</mi><mi>e</mi></mrow><annotation encoding="application/x-tex">54.94 low, supersede</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">54.94</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">o</span><span class="mord mathnormal" style="margin-right:0.0269em;">w</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">u</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.0278em;">er</span><span class="mord mathnormal">se</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span></span></span></span>9.50 low, read de-dup $0.33 none

Rank Lever?Token-turns % resident % prompt tokens $ % of billed Risk
1 age-out @100 turns 753,430,081 71.04% 17.19% $304.66 9.53% HIGH, unmeasured
1b age-out @200 turns 564,904,464 53.26% 12.89% $218.61 6.84% HIGH
1c age-out @400 turns 326,663,128 30.80% 7.45% $122.57 3.84% MEDIUM
2 Bash truncate @512 tok 127,078,244 11.98% 2.90% $54.94 1.72% LOW with head+tail
2b Bash truncate @256 tok 224,321,381 21.15% 5.12% $97.53 3.05% MEDIUM
2c Bash truncate @1024 tok 51,464,930 4.85% 1.17% $22.05 0.69% VERY LOW
3 supersede 29,306,846 2.76% 0.67% $9.50 0.30% LOW
4 read de-dup (verified) 1,155,720 0.11% 0.03% $0.33 0.01% NONE

The spread between first and last is 923×. Rows 1, 1b and 1c are the same lever at three settings, and the gap between them is larger than every other lever combined.


3. Both large levers are parameterised

Two facets on one dollar scale. Age-out window: 400 turns <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>122.57</mn><mo separator="true">,</mo><mn>200</mn><mi>t</mi><mi>u</mi><mi>r</mi><mi>n</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">122.57, 200 turns</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8389em;vertical-align:-0.1944em;"></span><span class="mord">122.57</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">200</span><span class="mord mathnormal">t</span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span></span></span></span>218.61, 100 turns <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>304.66.</mn><mi>B</mi><mi>a</mi><mi>s</mi><mi>h</mi><mi>o</mi><mi>u</mi><mi>t</mi><mi>p</mi><mi>u</mi><mi>t</mi><mi>c</mi><mi>a</mi><mi>p</mi><mo>:</mo><mn>2048</mn><mi>t</mi><mi>o</mi><mi>k</mi><mi>e</mi><mi>n</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">304.66. Bash output cap: 2048 tokens</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">304.66.</span><span class="mord mathnormal" style="margin-right:0.0502em;">B</span><span class="mord mathnormal">a</span><span class="mord mathnormal">s</span><span class="mord mathnormal">h</span><span class="mord mathnormal">o</span><span class="mord mathnormal">u</span><span class="mord mathnormal">tp</span><span class="mord mathnormal">u</span><span class="mord mathnormal">t</span><span class="mord mathnormal">c</span><span class="mord mathnormal">a</span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="katex-base"><span class="katex-strut" style="height:0.6944em;"></span><span class="mord">2048</span><span class="mord mathnormal">t</span><span class="mord mathnormal">o</span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span></span></span></span>5.85, 1024 tokens <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>22.05</mn><mo separator="true">,</mo><mn>512</mn><mi>t</mi><mi>o</mi><mi>k</mi><mi>e</mi><mi>n</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">22.05, 512 tokens</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">22.05</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">512</span><span class="mord mathnormal">t</span><span class="mord mathnormal">o</span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span></span></span></span>54.94, 256 tokens $97.53

Each of the two largest levers has exactly one parameter, and that parameter moves its value by 5–17×. Age-out at 400 turns is worth 40% of age-out at 100 turns.

The gap between the 400-turn and 100-turn windows is $182, larger than every other lever in the analysis combined. No session in this corpus was run with content removed, so the corpus contains no measurement of what a dropped result costs in task success.


4. Age-out

At turn 147 of a 1,317-turn session, a whole-file Read returned 10,003 tokens. The file's name does not appear anywhere in the session after turn 198 — not in a later tool call, not in a tool result; a manual scan including assistant text and thinking blocks puts the last occurrence at turn 199. The session then ran for another 1,118 turns.

Read at turn 147
Last mention of the file, anywhere 198
Session length 1,317 turns
Idle residency 1,118 turns
Dead token-turns 11,183,354
Cost of that dead residency (@ $0.50/MTok cache read) $5.59
Full residency cost from birth $5.85

96% of that read's lifetime cost accrued after the agent had stopped referring to the file. One read in one session is worth 17× the entire read de-dup lever across 36 days.

Restricting to reads ≥2,000 tokens that go ≥200 turns past their last mention finds 11 such reads worth $12.62. That filter is strict: it requires the filename to vanish from the transcript entirely, so a file mentioned once in passing at turn 900 is excluded even though its turn-9 read was unused throughout.

Risk: HIGH and unquantified. Age-out carries 71% of the BALANCED tier's value and 88% of AGGRESSIVE. With de-dup and supersede corrected downward, the token-removal thesis rests on a single parameter whose quality cost is unmeasured.


5. Bash truncation: the objection, tested

Bash truncation was rated HIGH risk on this objection:

"Bash output is the signal — stack traces, test failures, grep hits. A 2 KB cut removes most of a Python traceback."

Splitting the recovered value by whether the output's head carries a diagnostic (Traceback, FAILED, assert, panic:, an error line):

Grouped bars at three caps splitting recovered value into dumps versus diagnostics: at 1024 tokens <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>19.90</mn><mi>a</mi><mi>g</mi><mi>a</mi><mi>i</mi><mi>n</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">19.90 against</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.854em;vertical-align:-0.1944em;"></span><span class="mord">19.90</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">ain</span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span></span></span></span>2.15, at 512 tokens <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>49.30</mn><mi>a</mi><mi>g</mi><mi>a</mi><mi>i</mi><mi>n</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">49.30 against</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.854em;vertical-align:-0.1944em;"></span><span class="mord">49.30</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">ain</span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span></span></span></span>5.63, at 256 tokens <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>87.24</mn><mi>a</mi><mi>g</mi><mi>a</mi><mi>i</mi><mi>n</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">87.24 against</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.854em;vertical-align:-0.1944em;"></span><span class="mord">87.24</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">ain</span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span></span></span></span>10.29

Cap Dumps & listings Diagnostics
1024 tok $19.90 (90%) $2.15 (10%)
512 tok $49.30 (90%) $5.63 (10%)
256 tok $87.24 (89%) $10.29 (11%)

Nine tenths of the value is in file dumps, grep roll-ups, diffs and linter summaries. The risk is concentrated in the other tenth and is separable two ways: retain head and tail, so a traceback's exception line and its final frame both survive; or exempt anything matching the diagnostic predicate, which retains 90% of the value.

One call from turn 4 of the same 1,317-turn session: a command printing a section of a document returned 16,756 chars ≈ 4,189 tokens and stayed in context for all 1,313 remaining turns — 5,500,157 token-turns, $2.75. A 512-token cap recovers $2.41 from that single call, 7× the entire verified read de-dup lever across the corpus.

At 512 tokens this lever is 5.8× supersede and 166× verified read de-dup, bounded in the worst case, and the only one of the four whose risk profile is measurable before deployment.


6. Supersede

In a 411-turn session, five byte-for-byte identical browser screenshot calls were issued at turns 140, 142, 146, 148 and 150 — a UI-verification loop of screenshot, adjust, screenshot again. Each result costs ≈1,677 tokens. Once turn 142 fires, the turn-140 screenshot depicts a page state that no longer exists, and it continues to be re-read for the remaining 269 turns.

Superseded at turn Tokens Turns still resident Cost
turn 140 142 1,677 269 $0.45
turn 142 146 1,677 265 $0.44
turn 146 148 1,677 263 $0.44
turn 148 150 1,675 261 $0.44
$1.77

Corpus-wide: 228 hits, $9.50, 0.30% of billed, concentrated in this one behaviour. chrome/computer is $6.38 of the 9.50,againstRead9.50, against `Read`2.29, the other browser tools $0.36 combined, and Bash $0.17.

Risk: LOW. Identity is computed on the full tool input, so re-reading a different slice of the same file supersedes nothing, and the semantic claim — that running the identical command again makes the earlier output stale — holds for exactly the case it fires on.

A correction inside this lever. Screenshots were originally priced as text. A base64 blob charged at len(base64) / 4 bills a 1451×840 JPEG at 27,878 tokens; Anthropic bills it at roughly w·h/7501,625, a 17× overstatement. Because screenshots dominate this lever, that error accounts for most of its former size. It also moved the denominator for everything else: tool results are 24.2% of prompt volume, not the 40.1% previously published.


7. Read de-duplication: measured at $0.33

The lever was specified on one statistic: 59% of file reads are re-reads of a file already read in that session. That count reproduces at 57.1% here. The redundancy inference drawn from it does not hold.

Stacked bar: of 1,154 repeat reads, 97.6% request a different line range, 2.4% the same range, 0.2% are byte-identical

Of 2,022 Read calls with a path
First read of that path 868 42.9%
Repeat read of an already-read path 1,154 57.1%
→ same line range (identical tool input) 28 2.4% of repeats
different line range (pagination, adjacent slice) 1,126 97.6% of repeats
→ byte-identical to an earlier read 2 0.2% of repeats

A repeat read of a file is rarely a repeat read of the same bytes. 97.6% of the re-reads are the agent requesting a different part of a file it had already opened — new content, which cannot be collapsed to a pointer.

The cause was the fingerprint: a tool call was hashed on its file path alone. One session read a 1,119-line file at offset 1 limit 470, then offset 470 limit 450, then offset 920 limit 200 — three disjoint slices of a single walk. Scored as three reads of the same target, that walk contributed $2.89 of "de-duplication value". The largest figure in the original analysis, "73 reads of one file in one session", reproduces exactly and resolves to 73 different offsets into one large file. No identical range is re-read more than 4 times in any session in the corpus.

Keying on the whole tool input and requiring the bytes to already be resident collapses the lever:

Column chart on a square-root scale showing the read de-dup lever measured at <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>178.10</mn><mo separator="true">,</mo><mi>t</mi><mi>h</mi><mi>e</mi><mi>n</mi></mrow><annotation encoding="application/x-tex">178.10, then</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">178.10</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">t</span><span class="mord mathnormal">h</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span></span></span></span>43.27, then <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>37.58</mn><mo separator="true">,</mo><mi>t</mi><mi>h</mi><mi>e</mi><mi>n</mi></mrow><annotation encoding="application/x-tex">37.58, then</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">37.58</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">t</span><span class="mord mathnormal">h</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span></span></span></span>0.33 across four successive measurement passes

Variant Hits Token-turns $
Verified (identical or contained bytes, write-gated) 13 1,155,720 $0.33
Naive (same file path, write-gated) 513 87,884,001 $36.88

The largest single verified hit in 36 days is five cents: one file read whole at turn 715 and again at turn 895 of a 1,128-turn session, both hashing identically, with writes landing at turns 896–898 — the agent re-reading a file immediately before editing it, the most common repeat-read shape in the corpus and the reason the staleness gate exists.

At $0.33 over 36 days the lever does not cover the per-path staleness tracking it requires, and that tracking is the correctness-critical part.


8. Composed tiers

Applied together, first-match-wins, so no lever double-counts another's tokens:

Tier Levers % resident % prompt tokens $ % of billed
SAFE de-dup + supersede 2.85% 0.69% $9.77 0.31%
BALANCED + age-out 400 + 512-tok cap 41.00% 9.92% $169.92 5.32%
BALANCED-2 + age-out 200 + 512-tok cap 60.02% 14.52% $251.67 7.88%
AGGRESSIVE + age-out 100 + 256-tok cap 77.71% 18.80% $339.10 10.61%

Stacked bar of the BALANCED tier's <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>169.92</mn><mo>:</mo><mi>a</mi><mi>g</mi><mi>e</mi><mo>−</mo><mi>o</mi><mi>u</mi><mi>t</mi><mi>a</mi><mi>t</mi><mn>400</mn><mi>t</mi><mi>u</mi><mi>r</mi><mi>n</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">169.92: age-out at 400 turns</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.6444em;"></span><span class="mord">169.92</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="katex-base"><span class="katex-strut" style="height:0.7778em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="katex-base"><span class="katex-strut" style="height:0.6444em;"></span><span class="mord mathnormal">o</span><span class="mord mathnormal">u</span><span class="mord mathnormal">t</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord">400</span><span class="mord mathnormal">t</span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span></span></span></span>120.50 or 71%, Bash truncation <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>39.64</mn><mi>o</mi><mi>r</mi><mn>23</mn></mrow><annotation encoding="application/x-tex">39.64 or 23%, supersede</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.6444em;"></span><span class="mord">39.64</span><span class="mord mathnormal" style="margin-right:0.0278em;">or</span><span class="mord">23</span></span></span></span>9.45 or 6%

The SAFE token-removal tier is near-empty. De-dup + supersede were published at 6.84% of tokens; verified, they are 0.69%, worth $9.77. Every larger token-volume figure involves truncation or age-out.

One experiment gates 71–88% of the remaining value: replay a session with aged context and measure task success. Until it runs, the measured position is balanced-minusBash truncation at 512 tokens with head+tail retention and a diagnostic exemption ($55, LOW risk), supersede alongside it ($9), age-out held.


9. What this changes in the product

The ACE sidecar is a local reverse proxy that sits between a coding agent and the model provider, relays traffic unchanged, prices every request, reads existing transcripts off disk, and renders the result on a local dashboard. Its first release ships zero levers — it reports "levers": [] on its health endpoint and relays every request byte-for-byte.

The dashboard ranks levers on the reader's own corpus

The lever list used to render in a fixed order. It now scores each lever alone against the reader's own sessions over the selected date range, and orders them by measured value:

The ACE sidecar's left rail, showing four levers ranked by headroom with an estimated saving beside each: age-out <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>124.69</mn><mi>a</mi><mi>t</mi><mn>3.76</mn></mrow><annotation encoding="application/x-tex">124.69 at 3.76% of billed and HIGH risk, bash truncate</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.6444em;"></span><span class="mord">124.69</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord">3.76</span></span></span></span>57.95 at 1.75% and LOW, supersede <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>13.70</mn><mi>a</mi><mi>t</mi><mn>0.41</mn></mrow><annotation encoding="application/x-tex">13.70 at 0.41% and LOW, read de-dup</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="katex-base"><span class="katex-strut" style="height:0.6444em;"></span><span class="mord">13.70</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord">0.41</span></span></span></span>1.58 at 0.05% and NONE

Each row carries the dollars, the share of the bill, a bar proportional to the largest lever, and the risk class. Those figures are one machine's, over a corpus that has since grown to 162 sessions and $3,315.90, which is why the panel computes rather than hardcodes. Three properties:

  • Standalone, not composed. Under the tier scorecards a lever is applied first-match-wins, so its contribution depends on which levers ran before it. Scored alone the shares overlap, so the panel states that and links to the composed version rather than presenting four numbers that do not sum.
  • The operating points are the conservative ones — age-out at 400 turns rather than 100, a 512-token cap rather than 256. The tooltip states the value of each further setting and the risk attached.
  • Every row renders disabled. Phase 0 measures only.

The corrections were made in the instrument as well

Three fixes went into the sidecar's scanner alongside this analysis: tool calls are keyed on the whole tool input rather than the target path, so a paginated walk no longer registers as duplication; de-duplication requires a matching content digest, so redundancy is proved rather than inferred; and images are priced at w·h/750 rather than base64 length. On that machine's corpus the corrected panel puts age-out at 124.69andtruncationat124.69 and truncation at57.94, against $122.57 and $54.94 in the analysis above — the same conclusions, independently computed, on a corpus 13 sessions larger.

Roadmap ordering, before and after

Was Is
Read de-duplication ships first dropped — $0.33 does not cover the staleness tracking
Bash truncation rated HIGH risk, deferred first, at 512 tokens with head+tail and a diagnostic exemption
age-out, one of four levers 71–88% of remaining value, gated on one experiment
supersede, minor unchanged in size, reordered because it is nearly free

The published ordering was inverted. Bash truncation is first by 166×; Read de-duplication is last by two orders of magnitude.


10. Limits of this measurement

  • One developer, one machine, 36 days. The cost structure should generalise; the magnitudes are one fleet's. A second corpus is the outstanding requirement.
  • Tool results only — 24.2% of prompt volume. Everything here is a lower bound on what context reduction could reach, and says nothing about the other 75.8%.
  • Residency is modelled, not observed. A result is assumed resident from its turn to the end of the session. Compaction truncates that in real sessions and fires late; where it fires, these figures overstate residency.
  • The verified de-dup floor is a floor. Byte-identity and verbatim containment are provable; semantic redundancy is not measurable from a transcript and is larger than $0.33. The subset a sidecar could suppress without risking stale content is not.
  • chars / 4 for text. Adequate in aggregate, wrong for any individual result.

Every number in this post moved downward at least once, and every revision was a correction to the analysis rather than new information about the workload. The pattern was identical each time: a proxy was measured instead of the quantity itself — a file path instead of a tool call, a base64 length instead of an image, a re-read instead of a re-read of the same bytes. Per-path staleness tracking, the correctness-critical kind, would have been built for 33 cents.


The sidecar runs locally, uploads nothing, and works with Claude Code today. The beta is opening in batches — details and signup here. The broader cost breakdown this analysis sits inside is in What 13,000 coding-agent requests actually cost.


Sign up to ACE now