The Token Efficiency Encyclopedia
This is the encyclopedia of token efficiency, provided to you by superleanai.com.
Live at superleanai.com/encyclopedia, rebuilt and deployed on every push to main (see .github/workflows/deploy.yml).
All Articles
- Cache-aware Routing — switch models only at natural cache boundaries.
- Compaction — replace a long raw transcript with a smaller representation that preserves task state.
- Context Isolation via Subagents — let a subagent hold the bulk material in its own context and return only the answer.
- Diff-Based Tool Output — return changed lines instead of full files.
- Dynamic Tool Loading — load tool definitions on demand instead of inlining every schema on every turn.
- Effort Calibration — pick the cheapest reasoning-effort level, per task, from measured cost/accuracy data.
- Event-Driven Waiting — block until background work completes instead of spending a turn per poll.
- Fail Fast Validation — validate inputs before sending a long prompt to the model.
- Fusion Routing — run the loop on a cheap build model and consult an expensive advisor model only for the hard parts.
- Generator Invocation — emit the call to a deterministic generator instead of emitting the generated code.
- Grep-Result Tool Output — return matching snippets instead of full listings.
- Hierarchical Memory — layered memory with working, episodic, and semantic stores.
- Incremental Plan Updates — update the plan incrementally instead of re-planning from scratch.
- Model Routing — send each subtask to the cheapest model capable of handling it.
- Model-Migration Prompt Pruning — remove stale instructions written to patch an older model's weaknesses.
- Operation Batching — group related tool calls into a single turn.
- Output Spooling to Disk — redirect verbose command output to a file and read only a deliberate slice.
- Permission-Aware Context Retrieval — filter context by access controls and security boundaries.
- Progressive Disclosure — preload only a name and description; load instructions on selection and references on demand.
- Prompt Caching — cache stable prefixes to avoid re-processing repeated tokens.
- Prompt Summarization — replace long passages with shorter paraphrases.
- Prompt Truncation — cut input at a fixed token limit.
- Provider Pinning — keep every turn on the same backend provider so its prompt cache survives.
- Reasoning Suppression — strip or route chain-of-thought that is not needed in the final output.
- Rolling Summarization — replace dropped turns with a running summary.
- Selective Context Inclusion — send only files or sections relevant to the current query.
- Signal-per-Token Optimization — maximize useful context density per token.
- Sliding Window — keep only the newest N turns.
- Stateful Tracking in Agent Loops — track what the agent already knows to avoid redundant re-reads.
- Structured State Extraction — replace the transcript with an explicit, schema-validated state object patched at each step.
- Structured Tool Output — use JSON or tight schemas instead of verbose prose.
- Subagents as Context Firewalls — children never inherit the parent's history; the parent constructs exactly their input.
- Token-Aware Formatting — remove unnecessary whitespace, comments, and metadata.
- Tokenization Efficiency — choose equally capable models that encode the workload in fewer billable tokens.
- Write-Path Delegation — have a worker model write the generated file straight to disk, unseen by the caller.
Articles by Theme
Prompt / Input Compression
- Prompt Truncation — cut input at a fixed token limit.
- Prompt Summarization — replace long passages with shorter paraphrases.
- Selective Context Inclusion — send only files or sections relevant to the current query.
- Token-Aware Formatting — remove unnecessary whitespace, comments, and metadata.
- Tokenization Efficiency — choose equally capable models that encode the workload in fewer billable tokens.
- Model-Migration Prompt Pruning — remove stale instructions written to patch an older model's weaknesses.
Context Management
- Sliding Window — keep only the newest N turns.
- Rolling Summarization — replace dropped turns with a running summary.
- Hierarchical Memory — layered memory with working, episodic, and semantic stores.
- Prompt Caching — cache stable prefixes to avoid re-processing repeated tokens.
- Cache-aware Routing — switch models only at natural cache boundaries.
- Provider Pinning — keep every turn on the same backend provider so its prompt cache survives.
Tool & Output Design
- Diff-Based Tool Output — return changed lines instead of full files.
- Grep-Result Tool Output — return matching snippets instead of full listings.
- Structured Tool Output — use JSON or tight schemas instead of verbose prose.
- Reasoning Suppression — strip or route chain-of-thought that is not needed in the final output.
- Output Spooling to Disk — redirect verbose command output to a file and read only a deliberate slice.
Model Routing
- Model Routing — send each subtask to the cheapest model capable of handling it.
- Effort Calibration — pick the cheapest reasoning-effort level, per task, from measured cost/accuracy data.
- Fusion Routing — run the loop on a cheap build model and consult an expensive advisor model only for the hard parts.
Agentic Loop Design
- Operation Batching — group related tool calls into a single turn.
- Stateful Tracking in Agent Loops — track what the agent already knows to avoid redundant re-reads.
- Fail Fast Validation — validate inputs before sending a long prompt to the model.
- Incremental Plan Updates — update the plan incrementally instead of re-planning from scratch.
- Context Isolation via Subagents — let a subagent hold the bulk material in its own context and return only the answer.
- Subagents as Context Firewalls — children never inherit the parent's history; the parent constructs exactly their input.
- Event-Driven Waiting — block until background work completes instead of spending a turn per poll.
- Write-Path Delegation — have a worker model write the generated file straight to disk, unseen by the caller.
- Generator Invocation — emit the call to a deterministic generator instead of emitting the generated code.
Compaction
- Compaction — replace a long raw transcript with a smaller representation that preserves task state.
- Structured State Extraction — replace the transcript with an explicit, schema-validated state object patched at each step.
Dynamic Tool Loading
- Dynamic Tool Loading — load tool definitions on demand instead of inlining every schema on every turn.
- Progressive Disclosure — preload only a name and description; load instructions on selection and references on demand.
Enterprise Context Readiness
- Permission-Aware Context Retrieval — filter context by access controls and security boundaries.
- Signal-per-Token Optimization — maximize useful context density per token.
Speculative / Parallel Execution
- (Speculative decoding is mostly at the infrastructure level and not yet covered.)
- Parallel tool calls are covered by Operation Batching.
Rules
One file per article, in folder articles/.
An article is a single, sharp concept — something you could ask about a specific agent: "is X implemented in agent Y?" If the answer would be meaningless or always "yes," it is not a sharp concept. Articles should not be categories, design guides, or families of techniques.
Each article contains at the end a list of tools that implement this concept, ideally with links to code (GitHub immutable links).
We encourage rich hyperlinking between articles.