Tokenmining
Tokenmining (Sam Black, Towards Data Science, 2 July 2026) is the named discipline of minimizing token consumption while holding or improving output quality — the deliberate inverse of “tokenmaxxing” (spending tokens freely). Tier T3 — a practitioner how-to with anecdotal cost figures ($40/day personal spend; “some engineers $10k+/week”), not a controlled study. It crystallizes the cost/token levers this spoke had been tracking scattered across headroom, tail-control-agentic-workflows, claw-code, and claude-apps-gateway into one framing.
The thesis — more tokens ≠ better
Black’s core claim is that maximizing token use is a false proxy for quality — “like ranking
engineers by lines of code.” Beyond cost and latency, quality itself declines: context rot
degrades effectiveness at large context sizes and attention deteriorates in the middle of long
prompts (lost-in-the-middle), so irrelevant context actively competes for the model’s focus. Token
discipline is therefore a quality argument, not only a cost one — the generative-side echo of the
retrieval-side finding in ../research-wiki’s long-context-vs-chunking (a longer window is
quadratically expensive and usually loses to cheaper segmentation).
The two levers
- Routing (an LLM gateway). Classify each prompt by intent and complexity, then route simple requests to a cheaper or local quantized model and only hard ones to the frontier tier. Black reports ~60% cost reduction from routing alone. This is the same routing dial the spoke sees elsewhere pulled for different motives: tail-control-agentic-workflows downshifts to a faster model on a stall (latency), claude-apps-gateway routes through one identity with spend caps (governance/cost), and claw-code is provider-agnostic by construction — tokenmining pulls it for per-request cost/complexity fit.
- Context compaction. Lossy summarization as an agent nears its token limit — preserving architectural decisions and key details while discarding redundant tool outputs, with structured memory extraction to avoid hallucinating during compression. This is the runtime cousin of headroom (compress tool outputs/logs/RAG before the model, 60–95% fewer tokens) and the flip side of memory-vault (externalize the context otherwise lost to auto-compaction).
Why it’s here
It gives the spoke’s token-budget / progressive-disclosure thread a name and a why: progressive disclosure (agentskills-spec), token-efficient DSLs (openui), and pre-model compression (headroom) are all tokenmining moves, and “context rot / lost-in-the-middle” is the mechanism that makes them quality-preserving rather than merely cheap. It sits alongside agentsys‘s “structure substitutes for capability” (Sonnet+harness > raw Opus on cost) as the cost face of the spoke’s through-line: the value is in the disciplined layer around the model, not in spending more tokens through it.
Cross-spoke
../llm-inference-wiki owns the mechanism the quality argument rests on — attention cost and the
context-window internals behind context rot / lost-in-the-middle. ../research-wiki’s
long-context-vs-chunking makes the same “long context isn’t free or better” case on the
retrieval/embedding side. Here the subject is the agent/LLM-app cost discipline (routing +
compaction); the mechanism and the retrieval angle are cross-linked.
Related
headroom · tail-control-agentic-workflows · claw-code · claude-apps-gateway · memory-vault · agentsys · synthesis