Step 1 of 82 · Host app → Modeltask + 5 toolsTurn 0 of 12 · context 0 of 2,000 tokens · 0 tokens in all · history: 0 papers
Chapter 5 of 7
Memory, and what survives it
In chapter 4 the host stopped a stuck loop, and every turn re-sent the whole history, so each one cost more. Now Monday’s storm brings five damaged orders at once. The history grows with every one, and one customer has asked for something the agent must not forget.
This chapter: What does an agent remember from turn to turn, and what is lost when the host cuts its history down?
You will learn
- Why the context grows with every result the agent gets back
- What compaction saves, and what a summary can drop
- How pinning keeps the line that has to survive
Words you’ll meet (4)
- Context window
- How much text a model can read in one request, counted in tokens (a token is about ¾ of a word). You met it in RAG, chapter 2.
- Context budget
- The most tokens this host lets one turn send the model. Larkspur’s team set it; it is not the size of any model’s context window.
- Compaction
- The host replacing older history with a short summary, so later turns send less.
- Pinning
- Keeping a line outside the summary: the host sends it every turn and never compacts it.
The picture on the left is live. Each step below asks you to do one thing in it; the story continues here as you go.
Step 1 of 6
A new case: Monday’s storm soaked a delivery van. Five customers say their orders arrived damaged: 2101, 2102, 2103, 2104 and 2105. For each one, ship a replacement if we have stock, otherwise refund it, and email the customer. One order, 2101, carries a note from Fenwick Farm Supply: “Email only, please. No phone calls: our phone line is down until November.” The host keeps the whole history and re-sends it every turn, as in chapter 4. It also sets a context budget: one turn may send the model at most 2,000 tokens. That number is Larkspur’s setting for this host, not the context window of any model. Before you run it: