Safebots · grokonomics

The index never pays the n². Then it compounds.

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

Agentic exploration is quadratic, and it's mostly reading.measured

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.

↑ dimensions

02 · The correction

The index doesn't pay the n² once — it never pays it at all.theory

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 mechanical substrate is real

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.

work over time (sessions × repo size) → cost / latency → exploration · O(n²) prefill, every session ↑ one-time LLM residual (sparse) index · mechanical build, then O(1) lookups — flat ▲ build: AST/symbol/hash = $0 LLM
Exploration climbs the quadratic curve every session. The index is built off-curve by mechanical passes (with a thin, one-time LLM residual) and then answers flat.
↑ dimensions

03 · Build cost

What the index costs to build — decomposed.measured

PassMethodLLM?Cost
parse · symbols/calls/externstree-sitter AST walknone$0
cross-process / cross-repo resolutionregex + name matchnone$0 — caught Streams/check free
access model / text-value externsconfig + symbol-table querynone$0
contracts (invariants/sideEffects)LLM on the touched neighborhoodresidual only~$0.003 / fn, sparse
read a fact latergraph lookupnone$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.

↑ dimensions

04 · Read complexity

Answering a question: O(n²) prefill vs O(1) lookup.theory

DimensionExplorationIndex
Cost to answer "what calls X"re-read files into a growing contextone edge traversal
Prefill computeO(n²) in context lengthO(1) — tiny prompt
Tokens per answer153:1 input-heavy, re-ingestedthe fact, and little else
Latencygrows with context²flat
Determinism30× variance, unpredictablesame query, same answer
↑ dimensions

05 · Recurrence

Paid every stateless session vs paid once.measured

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.

↑ dimensions

06 · Model tier

Once the facts are structured, a cheap model suffices.measured

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.

TaskSonnet + grokOpus + grokFable (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)
↑ dimensions

07 · Cache stability

A tiny stable prompt caches; a fat one doesn't.modeled

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.

↑ dimensions

08 · Fleet economics

Run it a thousand times.modeled

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 daysExplorationIndex
Recurring model spend20×30×250×$0.14 ≈ $21,000/yr20×30×250×$0.015 ≈ $2,250/yr
Re-read costevery session, foreveronce (build), then ~0
Recurring billlinear in work, forever~9× lower, amortizing down
Tasks refused / never convergedtop-tier refusals; explorers hit turn capshanded 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.

↑ dimensions

09 · The compounding

The savings stack — watch the bar fall.measured modeled

$0.141frontier+explore1× · measured $0.041index, no re-read3.4× · measured $0.021cheap model6.7× · measured ~$0.015warm KV cache~9× · modeled → flooramortized build10×+ · modeled
Two measured cuts reach 6.7× on the first task; two modeled cuts push past 10× and keep falling with use. And two more never fit on a token bill: the O(n²) prefill the index sidesteps, and the exploration runs that simply never converge.
↑ dimensions

10 · Honest accounting

What's measured, what's modeled, what's theory.

ClaimBasis
Agents: 1000× tokens, 153:1 input, 30× variance, 0.39 self-predictionmeasured · 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-convergencemeasured · real agentic grep/read loop; real API stop-reasons & turn caps
Build is $0-LLM on AST/regex passes, ~⅓¢/fn on the residualmeasured · the mechanical passes; the 16 zero-LLM analyses
Warm KV steady state (~$0.015); fleet annual totalsmodeled · cache-read pricing on the stable prefix × a stated scenario
O(n²) context prefill compute/latencytheory · 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