Domain 5 · Context Management & Reliability

Compaction & memory

A long agent run or chat keeps growing until it threatens the context window. Compaction is summarising the older turns into a compact note so the work can continue — but summarise carelessly and you lose the one fact you needed. The exam's sharpest angle: progressive summarisation can quietly drop precise, transactional data.

compactionprogressive summarisation lossy vs losslessexternal memory structured notes
Explain like I'm 10
Your desk is filling up with pages, so you write a short summary and throw the old pages away to make room. Smart! But if your summary says "we talked about the order" and forgets the exact order number #4471, you've thrown away the one thing you actually needed. Good summarising keeps the important exact details and only blurs the chit-chat.

Watch a summary lose something important

An agent has been handling a refund. The conversation is getting long, so it compacts. Choose how it summarises and see what survives — and what silently vanishes:

before (full history)
after compaction

Strategies, from cheap to robust

ApproachHowRisk
TruncationDrop the oldest turns.Loses early context entirely (the goal!).
Progressive summarisationReplace old turns with an LLM summary.Lossy — precise/transactional facts (IDs, amounts) get blurred away.
Structured memory noteMaintain a running, schema'd scratchpad (decisions, IDs, open tasks) that survives compaction verbatim.Needs discipline, but keeps the critical bits exact.
External memory / retrievalStore facts outside the window; retrieve on demand.Adds a retrieval step; must fetch the right thing.
Exam trap: progressive summarisation is lossy — never rely on it to carry exact, transactional data (order numbers, dollar amounts, approval flags). The right design keeps those in a structured note or external store that compaction preserves verbatim, and summarises only the narrative. "Just summarise everything" is the wrong answer whenever precise values matter.
Takeaways: long runs need compaction, but summarisation is lossy — it can silently drop precise transactional data. Protect critical facts (IDs, amounts, decisions, open tasks) in a structured memory note or external store that survives verbatim; summarise only the conversational narrative. Match the strategy to how exact the data must stay.

Curated companion: Anthropic — Context engineering (compaction & memory).