Lv.1 0 XP

Token Management — Practical Techniques for Long-Running Agents

Core 7 min +30 XP
💡
THE ANALOGY

Managing a long road trip on a tank of gas. You don't wait until you're empty — you watch the gauge and top up before you run out. You also drive efficiently: highway speed, not jack-rabbit starts. Token management is both watching the gauge AND driving efficiently.

⚠️ EXAM TRAP — The Wrong Answer People Choose

Token management is about more than staying under the limit. The exam tests specific techniques: /compact, subagent delegation for context isolation, scratchpad files, and structured fact extraction — not just 'use fewer tokens'.

KEY POINTS
1 /compact in Claude Code: compresses conversation history while preserving key decisions and findings.
2 Subagent delegation for isolation: offload verbose tasks to subagents — main context only receives the summary.
3 Scratchpad files: intermediate computation results written to files instead of conversation.
4 Structured fact extraction: extract key facts from tool results into a compact facts block rather than keeping raw results.
5 Token cost vs quality tradeoff: aggressive compression can lose precision — preserve exact values, summarize narrative.