Token Efficiency
Token optimization for cost-effective sessions. From Delphine-L/claude_global token-efficiency (90-95% weekly saving) + Headroom integration.
When to use
- Default for all sessions — apply without being asked unless user says "verbose"
- Reading log files, large outputs, codebase navigation, debugging, system status
Workflow
Model routing (50% saving vs all-Opus):
- Opus: 10-15 min learning a new codebase (architecture, patterns)
- Sonnet: all implementation, debugging, routine work (default)
- Return to Opus only for deep architectural understanding or when Sonnet fails
Reading & execution (saves 70-80% vs full reads):
- Prefer
Grep/Glob+Bashfilters overReadentire files. Example:Grep "class Foo",head -100,jq '.metadata',head -20for CSV +wc -l. - For exploratory searches, dispatch a
tasksubagent — main context gets a paragraph back, not 40K tokens. - Use
--quiet/--silent,head/tailsampling for large output. Skills themselves are progressive disclosure: ~155 tokens per skill at start, body loads only when triggered.
| Approach | Tokens/Week |
|---|---|
| Wasteful (Read everything) | 500K |
| Moderate (filtered reads) | 200K |
| Efficient (bash + filters + subagents) | 30-50K |
Headroom (optional plugin): npm install @ngotrnghia1811/opencode-headroom and add to opencode.json plugin — 60-95% on large tool outputs with local cache (CCR).
Verification
- Default model is Sonnet; Opus only for learning/deep analysis
- Large files read via filters/subagents, not full
Read - Large command outputs sampled with
head/tail/jq - Skills body not assumed in-context — only frontmatter at start
References
- Source:
Delphine-L/claude_globaltoken-efficiency - See also:
productivity/prompt-enhancementfor input optimization,productivity/context-compressionfor long sessions