Lesson 04.03 · Phase 04 · Memory & Context Engineering
Summarization memory
Don't drop old messages, fold them into a summary. Then test the summary, because summaries forget too, and they forget silently.
Learning objectives
- Implement a summary buffer that keeps recent messages verbatim and folds older ones into a running summary.
- Explain the two ways a running summary fails: facts squeezed out by a size cap, and stale facts kept next to their updates.
- Compare a free-text summary with a structured one (one current value per slot).
- Measure fact recall with planted facts instead of trusting that a summary "looks right".
Lesson 2's token window keeps the newest messages and drops the rest. In a long conversation that means everything the user said early on is gone: name, budget, diet, the hotel you already booked together. A pinned first message helps only if all the important facts were in it, and they rarely are. People mention their diet at turn 5 and change their budget at turn 20.
Loading the full lesson…