The window
1,074 tokensChapter 1’s turn, counted by this site’s own token counter.
Module 8 · Context
Every turn, Larkspur’s app builds the model a window: the system prompt, the tools, the conversation so far, the documents and the question. It has one budget. Here you choose what goes in, in what order, and what is kept outside for later.
The whole idea in one example
Chapter 1’s turn, counted by this site’s own token counter.
“Above what order total is parcel shipping free?”
Parcel shipping is free on orders over $500. Freight is quoted per order by weight and distance.
The recorded answer to that window.
Anthropic: everything in the request counts toward the context window: the system prompt, every message (tool results and documents included), the tool definitions, and the reply the model writes. The counts here come from this site’s own token counter, so they show the mechanism, not any provider’s numbers. Source, checked 30 October 2026.
How it works
System, tools, history, documents and the reply share it
Anthropic: everything in the request counts toward the context window: the system prompt, every message (tool results and documents included), the tool definitions, and the reply the model writes.
Source, checked 30 October 2026
Look-alike passages around the fact make answers worse
Anthropic: more context isn't automatically better; as the token count grows, accuracy and recall degrade, which it calls context rot.
Source, checked 30 October 2026
Search for the passage instead of sending every document
Anthropic's context-engineering guide: agents can keep lightweight references (file paths, stored queries) and load the data just in time, when they need it.
Source, checked 21 October 2026
A start that repeats is read back cheaply from the cache
OpenAI: put stable instructions and shared reference material first and dynamic content, like timestamps, at the end, because a cache hit needs the whole prefix to match.
Source, checked 30 October 2026
Old search results go; the decisions stay
Anthropic's context editing (in beta) can clear old tool results once the context passes a threshold (100,000 input tokens by default), keeping the most recent ones (3 by default) and leaving a placeholder where each was.
Source, checked 30 October 2026
Notes in files, read in the next conversation
Anthropic's memory tool lets Claude create, read, update and delete files under /memories that persist between conversations.
Source, checked 30 October 2026
The story
Larkspur Supply Co.’s assistant now answers from documents, calls tools and holds long conversations, so the team has to choose what goes into its window each turn. You’re on the team that sets its context policy: what to retrieve, how to keep the history, where to cache and what to remember.
RAG chapter 2 showed why you can’t send everything; Agents chapter 5 summarised a long history. This module builds on both.
Your path

Chapter 1 · done
What does the model read on each turn, and how much room does each part take?


Chapter 3 · done
Should the assistant get every document up front, or look things up when it needs them?

Chapter 4 · done
How can Larkspur stop paying full price for the same text every call?

Chapter 5 · done
What can the assistant drop from a long conversation without losing what matters?

Chapter 6 · done
How can the assistant remember something from one conversation in the next?

Chapter 7 · done
Which context policy gives good answers for the least cost?
Product managers, engineers and analysts whose assistant already answers from documents and calls tools. RAG and Tool calling come first; no code or maths needed.