Safebots · grokonomics
Not "pay it once, reuse forever" — never. Exploration pays a quadratic prefill every session; the grok is built by cheap mechanical passes and calls an LLM only on the sparse residual. A deep cost analysis, across every dimension, with the compounding drawn out.
measured real runs / cited study · modeled arithmetic on measured inputs · theory a complexity fact
01 · The tax
The first systematic study of agent token consumption — Stanford Digital Economy Lab, MIT, Michigan, DeepMind, All Hands, Microsoft AI, across 8 frontier models and 500 SWE-bench tasks — found agentic workloads burn 1000× more tokens than chat, and the driver is input, not output: the input-to-output ratio for agents is 153:1 (vs 1.33 for chat). Your agent is expensive because it reads — repeatedly — as every loop iteration re-ingests the accumulated context. Same study: 30× cost variance on the same task, and a model's correlation predicting its own spend is 0.39. It cannot tell you what it is about to cost. (This backbone is laid out in why 300 LLM calls is the wrong unit of parallelism.)
And the re-reading isn't just linear tokens. Attention is O(n²) in prompt length, so a fat exploration context costs prefill compute and latency that grow with the square of what was stuffed in. The token meter hides this; the wall-clock and the FLOPs do not.
↑ dimensions02 · The correction
The tempting summary is "explore pays n² every time; the index pays it once and reuses." That undersells it. The index is not built by exploring. It's built by cheap mechanical passes — an AST walk, a symbol-table query, a hash — that are near-linear in the code and call no LLM at all. The LLM is pulled in only on the sparse residual: the handful of symbols where a contract or summary genuinely needs judgment. So the quadratic prefill of a growing exploration context is a curve the index never steps onto.
The Safebox U toolchain runs 16 analyses, none using an LLM — tokenizer, type/effect checker, effect inference, compile-time folding, relation graphs, supply-chain hashing — each reproducible and checkable. The grok runs the same discipline on any codebase: mechanical first, LLM only for the residual. A certain fact is an AST walk you can re-run, not a model that might be fluent and wrong. See groking for the full accounting.
03 · Build cost
| Pass | Method | LLM? | Cost |
|---|---|---|---|
| parse · symbols/calls/externs | tree-sitter AST walk | none | $0 |
| cross-process / cross-repo resolution | regex + name match | none | $0 — caught Streams/check free |
| access model / text-value externs | config + symbol-table query | none | $0 |
| contracts (invariants/sideEffects) | LLM on the touched neighborhood | residual only | ~$0.003 / fn, sparse |
| read a fact later | graph lookup | none | $0 |
The expensive primitive is touched only where judgment is genuinely needed — the sparse residual, priced at about a third of a cent per function on the semantic pass, and zero for the regex/AST passes that catch most structural facts. The build is near-linear in the code; the LLM share is a thin sliver, paid once.
↑ dimensions04 · Read complexity
| Dimension | Exploration | Index |
|---|---|---|
| Cost to answer "what calls X" | re-read files into a growing context | one edge traversal |
| Prefill compute | O(n²) in context length | O(1) — tiny prompt |
| Tokens per answer | 153:1 input-heavy, re-ingested | the fact, and little else |
| Latency | grows with context² | flat |
| Determinism | 30× variance, unpredictable | same query, same answer |
05 · Recurrence
The killer isn't the per-run cost — it's that exploration is stateless: every session re-reads the same files, caching against nothing, because the understanding was thrown away when the last session ended. The index is the understanding, kept. So the comparison isn't run-vs-run, it's a recurring tax vs a one-time fee that amortizes toward zero.
Measured on the render task: frontier + exploration $0.141 → index removes the re-reading $0.041 (3.4×) → cheap model now suffices $0.021 (6.7×). Two measured cuts, 6.7× on the very first task — before a single reuse.
↑ dimensions06 · Model tier
The grok hands the model proven facts, so "reason about an unfamiliar codebase" collapses to "apply a known fact." Measured across three real tasks: Sonnet + grok matched Opus and beat the top-tier Fable (which refused the browser/systems work outright), cheapest in every row — the full grid in The Substrate Ledger. This is the substrate thesis: the model is the rented engine, the grok is the rig that knows this codebase; capability is engine × rig, and you replace the engine next quarter while the rig compounds.
| Task | Sonnet + grok | Opus + grok | Fable (top tier) |
|---|---|---|---|
| Render · web | $0.021 ✓ | $0.041 ✓ | refused (cyber) |
| Rank · math | $0.014 ✓ | $0.025 ✓ | $0.057 ✓ |
| Sprint · systems | $0.032 ✓ | $0.072 ✓ | refused (cyber) |
07 · Cache stability
The index keeps the prompt small and stable — the same grok facts prefix many queries, so a per-safebot KV cache is re-read at a fraction of full price, and on sovereign/local inference that cache is indefinite (vs. capped at 4 checkpoints / 1-hour expiry on the big APIs). Exploration's context is different every session by construction — nothing to cache. Modeled: warm cache pushes the render task from $0.021 toward ~$0.015 (~9×), and amortizing the one-time build drives it to a floor.
↑ dimensions08 · Fleet economics
One task, once, understates it. The real setting is a fleet working a codebase all day. Exploration is paid per task, per stateless session: bots × tasks × sessions × ~$0.14, re-reading the same files each time. The index is built once (~⅓¢/fn semantic, $0 regex), then answered warm at bots × tasks × ~$0.015.
| 20 bots · 30 tasks · 250 days | Exploration | Index |
|---|---|---|
| Recurring model spend | 20×30×250×$0.14 ≈ $21,000/yr | 20×30×250×$0.015 ≈ $2,250/yr |
| Re-read cost | every session, forever | once (build), then ~0 |
| Recurring bill | linear in work, forever | ~9× lower, amortizing down |
| Tasks refused / never converged | top-tier refusals; explorers hit turn caps | handed the fact in one shot |
And that's the conservative reading — same model both sides. Insist on a frontier model for reliability and the multiple widens; reach for the top tier and it refuses the web and systems work. The curves don't converge: exploration is linear in work forever, the index is a fixed fee that amortizes toward zero.
↑ dimensions09 · The compounding
10 · Honest accounting
| Claim | Basis |
|---|---|
| Agents: 1000× tokens, 153:1 input, 30× variance, 0.39 self-prediction | measured · the Stanford/MIT/DeepMind study (500 SWE-bench tasks) |
| Per-task model+index cost ($0.141→$0.041→$0.021) | measured · single-shot API runs, output executed & checked |
| Exploration 3.4–9.2×; refusals / non-convergence | measured · real agentic grep/read loop; real API stop-reasons & turn caps |
| Build is $0-LLM on AST/regex passes, ~⅓¢/fn on the residual | measured · the mechanical passes; the 16 zero-LLM analyses |
| Warm KV steady state (~$0.015); fleet annual totals | modeled · cache-read pricing on the stable prefix × a stated scenario |
| O(n²) context prefill compute/latency | theory · attention is quadratic in prompt length |
The modeled and theoretical rows only sharpen the conclusion the measured rows already draw; none reverse it. And every measured number leans the safe way — the exploration runs were capped at ten turns, so their true cost to finish is higher than shown, not lower.
Exploration is a quadratic tax on every stateless session. The index is a near-linear, mostly-mechanical fee paid once — so it never climbs the curve, not even the first time, and every dimension after that compounds the gap.— grokonomics, in one line↑ dimensions