Pillar · Token economics

Stop paying to re-learn your codebase.

One observed session burned 8.59M tokens: 90% re-reading files. Memory is how you stop paying that tax every session.

The short answer

To reduce AI coding token usage, attack the three costs that dominate every session: stale conversation history (re-billed every turn), whole-file reads (tens of thousands of tokens for one-line answers), and re-learning project knowledge from zero each session.

Read the full answer

The canonical waste case is an observed 8.59M-token session: 97.2% cache, ~90% re-reading, 175:1 input-to-output. Anvaya’s answer is compounding memory: session outcomes become typed nodes (files ~20x, decisions ~16x, bugfixes ~24x, threads ~25x, per-node design estimates), and turns target 2–4K packed tokens instead of ~50K raw. What is measured today: micro-fold cut median uncached tokens −11.0% with verification 19/19 (n=5), and headless fix tasks landed −11%…−21% across 24/24 verified pairs. Prompt caching covers the stable layers at ~10% price; Phase 2 measures session-to-session compounding.

Where the tokens go

The budget is fixed. The value per token is not.

Re-reading files buys the same context every session; recall spends at most 4,096 tokens on what helps.

Token budget · liveillustrative
Served11 of 14
Tokens3,310 / 4,096
  1. 0.94decision keep WAL mode for the store180served
  2. 0.91bug fix retry loop double-charged on a 502420served
  3. 0.88pattern handlers return Result<_, ApiError>260served
  4. 0.86concept an invoice is immutable once issued140served
  5. 0.83synthesis billing failures cluster at the gateway edge610served
  6. 0.79approach tried: idempotency keys in Redis, dropped380served
  7. 0.74bug fix timezone drift in the nightly settlement job720served
  8. 0.71decision Postgres for ledgers, SQLite for local state230served
  9. 0.66pattern every migration ships with a down step160served
  10. 0.62concept settlement window is T+2 business days90served
  11. 0.55approach tried: batching webhooks per merchant540over budget
  12. 0.49bug fix flaky test: clock not frozen in fixtures310over budget
  13. 0.44pattern feature flags are read once per request120served
  14. 0.38synthesis the gateway owns retries; callers never do880over budget

11 of 14 served, 3,310 of 4,096 tokens.

Sample candidates under the real ceiling: 4,096 tokens at 0.85 fill, 12 nodes max. The shipped pack also weighs novelty.anvaya-mind-rs/crates/mind-services/src/quorum.rs · mind-types/src/config.rs

Per-node ratios

Where the 12-25x estimate comes from.

Design estimates per memory node type from Anvaya's memory design work, not benchmark results. The measured end-to-end lever is listed under Benchmarks.

Files · ~20x800 raw tokens compress to ~40 curated. Structure-first retrieval serves signatures and spans, not whole-file dumps.
Decisions · ~16x500 tokens of deliberation become a ~30-token node: what was chosen, why, and what it supersedes.
Bugfixes · ~24x1200 tokens of debugging trail become a ~50-token causal record: symptom, cause, fix, test signal.
Patterns · ~24x600 tokens of recurring shape become a ~25-token rule the agent applies without re-deriving.
Threads · ~25x2000 tokens of session history synthesize to an ~80-token causal thread with outcome attached.

Three levers

Spend fewer tokens today.

Works with any agent, including Claude Code and Cursor, no new tools required.

One task per sessionA 3-hour mega-session costs 3–5x the history tax of three focused 1-hour sessions. Reset deliberately; carry a written spec, not a transcript.
Ranges, not filesReference the function span, not the 400-line file. Pair with .claudeignore so generated dirs never enter autocomplete or globs.
Quiet commandsScoped test runs, --porcelain, head -n 50. The signal is the failing test and assertion, not 12K tokens of checkmarks.

Questions

Asked about token costs.

How do I reduce AI coding token usage?

Three levers dominate: split work into focused sessions (stale history is re-paid every turn), retrieve just-in-time instead of dumping files (spans, not whole files), and persist durable knowledge in a memory layer so sessions stop re-learning. Anvaya adds the compounding lever: calibrated memory that shrinks per-turn context from ~50K raw to 2–4K packed.

What does 12-25x token compression mean?

Per-node design estimates from Anvaya Mind's design work: each memory node type stores a fraction of the raw tokens that produced it (files ~20x, decisions ~16x, bugfixes ~24x, patterns ~24x, threads ~25x). A turn targets 2–4K curated tokens instead of ~50K raw, the 12–25x range. These are engineering estimates, not benchmark results. The measured end-to-end lever today is micro-fold at −11.0% median uncached tokens (n=5, verification 19/19); Phase 2 of the benchmark program measures session-level compounding.

Does prompt caching already solve this?

Caching cuts the price of repeated tokens ~90% but doesn't shrink what the model must attend to, noise still dilutes attention and degrades answers. Cache the stable layers (system prompt, conventions) and engineer the dynamic layers (retrieval, memory). Anvaya does both: cacheable system context plus packed per-turn memory.

Why do long sessions get expensive so fast?

Every token loaded is re-billed on every subsequent turn until compaction. A 10K file read at turn 3 costs another 10K at turns 4, 5, 6… A 30-message thread carries 29 dead messages into every call. Early-session discipline compounds across the whole session.

How much does the 8.59M-token session cost?

At 2026 Claude pricing (~$2–5 per million input tokens), an 8.59M-token session is roughly $17–43 of input, ~90% of it re-reading files. Multiply by sessions per week per developer and the memory layer pays for itself in attention alone, before counting accuracy.

Run agents that fit on your laptop.

23.4 MB median own-process memory, measured across 1030 runs (994 verified) and fourteen harnesses. One command installs the harness and the Mind together. Nothing leaves your machine on the Ollama path.

Developer beta. macOS on Apple Silicon and Linux on x86_64 or arm64. Memory figure: --no-mind, macOS/ARM, n=3 per cell. Pre-1.0, pricing not set.