PRODUCTION SCENARIO
A customer onboarding assistant runs multi-hour chat sessions with no tool calls. The conversation grows past 100,000 tokens, raising latency and cost and degrading the model's attention to constraints set early in the session.
Which strategy keeps the thread coherent as it grows?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Compact the older turns into a summary block and keep recent turns verbatim
Compaction summarizes older context as the conversation approaches the limit and continues from the compacted history, so token growth is bounded while the recent turns stay verbatim. Dropping the oldest messages bounds tokens too, but throws away exactly the early constraints the assistant is already losing track of. A memory tool keeps the history retrievable but out of context, so those constraints only return if the model thinks to ask for them. And moving history into the system prompt changes where the tokens sit rather than how many, and rewriting that field invalidates the cache every turn.
Official Source: https://platform.claude.com/docs/en/build-with-claude/compaction ↗