Context & efficiencyToken-optimization techniques

Token-optimization techniques

Measured techniques for reducing coding-agent token use while preserving task quality, with evidence, limits, and adoption guidance.

Research state: Needs refresh

Verification cutoff: 2026-08-12. Revalidate provider models, prices, quotas, and cache behavior after this date.

This dossier evaluates coding-agent token-efficiency techniques. Every external claim has a source in its chapter, every local number names its method, and every recommendation remains subject to the validation harness. Research brief: prompts/research/context-techniques.md.

Research question

Which context, caching, retrieval, output, routing, infrastructure, and governance techniques reduce coding-agent resource use without weakening task quality?

The dossier distinguishes API-priced work from subscription-quota work. It also treats latency, operator time, and quality risk as separate decision axes rather than reducing every choice to token price.

Headline findings

  • A defensible 10× reduction at equal quality is not supported. The modeled ceiling is about 2.4–2.5× with validated techniques, or 5–6.2× if a lower-tier-main-plus-advisor routing pattern passes the workload-specific harness. Frontier-model thinking and genuinely required cache reads remain binding floors.
  • In the measured heavy session, dollar share was 32% cache reads, 29% cache writes, about 20% thinking, 17% visible output, and 2% uncached input. Cache reads dominate token volume; output and cache writes dominate dollars. A separate session was more output-heavy, so the exact split is workload-specific.
  • Existing defaults already provide much of the available input-side reduction: prompt caching measured 86.3%, tool schemas can defer, and edit-style diffs avoid full rewrites.
  • Concise output helps, but its reach is bounded. Caveman ultra reduced visible prose by 58.5% in the local sample, while tool-heavy sessions exposed a much smaller total-session ceiling.
  • Strong high-confidence levers are context architecture, tool deferral, context editing, effort control, model pinning for delegated work, cache-prefix stability, and edit-over-rewrite behavior.
  • Subscription users need a quota model as well as a dollar model. Prefix stability, context-window pressure, and request volume can matter more than API-price savings when a usage window is the binding constraint.
  • Images, screenshots, and PDFs have distinct token economics. Measured high-resolution image costs differed by about 3.0–3.1× across model families; PDFs cost roughly equivalent text in the tested samples.
  • Cache-compression and semantic-cache mechanisms can help self-hosted fleets, but most do not reduce hosted-provider billed tokens and can introduce correctness or isolation risks.

Method and evidence

  • Provider behavior and prices come from the primary sources recorded in each chapter's verification ledger.
  • Local token counts use the checked-in scripts under measurement tools and the provider token-counting endpoint.
  • Cost conclusions compose savings per token class; they do not multiply unrelated headline percentages.
  • Quality claims are bounded by the paired-task validation harness, objective checkers, canaries, latency measurements, and rollback criteria.
  • Current tool versions and their evidence boundaries live in the separate token-optimization tools dossier.

Limitations and open questions

  • Local session decomposition is environment-specific and does not establish a universal workload distribution.
  • The exact subscription-cap denominator and cache-read weighting are unpublished; community estimates remain indirect evidence.
  • The effort-to-thinking-share curve needs measurements across multiple effort levels on the same tasks.
  • Model-specific tokenizer, price, quota, and feature claims require revalidation at the chapter cutoff before implementation.
  • Modeled stack totals remain estimates until reproduced on representative jackin tasks with the validation harness.

How to read

Orientation and measurement

Core techniques

Decision and validation

Additional decision axes

On this page