Compact agent context by hand
Shrinking an agent's conversation into a summary yourself to save cost, instead of letting the agent do it when its memory is full.
Konstantin's verdict: Hold
An agent works inside a context: all the text of the conversation so far. When the context gets long, the agent can compact it. It replaces the old text with a short summary.
I used to compact my agent context by hand at about 200,000 tokens, out of habit. A token is a small piece of text. I thought this saved money. A cost analysis showed it rarely does. With prompt caching, the model reads the earlier text again at a small fraction of the normal price. A manual compaction paid back only after about 30 more requests.
So I stopped. Now the agent compacts by itself when its context fills. A change in prices or caching would make me look again.
What moved
On other radars
No community radar places this yet.
Sources
- Anthropic's prompt caching page says cache reads cost 0.1 times the base input price by default, 0.05 times on Claude Opus 5.5 and Sonnet 5.5, and 0.025 times on Claude Fable 5.2 and Fable 5.1. checked 13 Nov 2026
- Anthropic's context windows page says server-side compaction is the primary strategy for long-running conversations and agentic workflows. checked 13 Nov 2026
Share and embed
Also in Practices · Hold
- Home-built agent systemBuilding your own system of rules, files and tools to run and coordinate your AI agents.