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.

Direct 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. 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 that compress 12–25x per type (files ~20x, decisions ~16x, bugfixes ~24x, threads ~25x), and each turn assembles 2–4K packed tokens instead of ~50K raw. Sessions get cheaper and sharper with use, prompt caching covers the stable layers at ~10% price, and open measurement trials land Q3 2026.

Per-Node Ratios

Where the 12-25x Comes From.

Design estimates per memory node type, measured in the Mind repos — not benchmark runs.

01Files · ~20x800 raw tokens compress to ~40 curated. Structure-first retrieval serves signatures and spans, not whole-file dumps.
02Decisions · ~16x500 tokens of deliberation become a ~30-token node: what was chosen, why, and what it supersedes.
03Bugfixes · ~24x1200 tokens of debugging trail become a ~50-token causal record: symptom, cause, fix, test signal.
04Patterns · ~24x600 tokens of recurring shape become a ~25-token rule the agent applies without re-deriving.
05Threads · ~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.

01One 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.
02Ranges, not filesReference the function span, not the 400-line file. Pair with .claudeignore so generated dirs never enter autocomplete or globs.
03Quiet commandsScoped test runs, --porcelain flags, piped head -n 50. A failing suite's signal is the test name plus the broken assertion — not 12K tokens of passing checkmarks.

Questions

Asked About Token Costs.

Q

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.

Q

What does 12-25x token compression mean?

Per-node design estimates from the Anvaya Mind repos: 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 typical turn assembles 2–4K curated tokens instead of ~50K raw — the 12–25x range. These are engineering estimates, not benchmark runs; open trials arrive Q3 2026.

Q

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.

Q

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.

Q

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.

Stop Starting From Zero.

One binary. 11+9 Rust crates. 545 tests. Hand-written HNSW index. Three transport modes. Four providers, Ollama, Anthropic, OpenAI, Siemens. Zero API keys required to start. Mind remembers everything after the first session.