Part XV opened with attention's context window growing quadratically expensive — but even a perfectly affordable window has a fixed size. What happens to a fact stated at the very start of a long conversation, by the time that conversation has gone on long enough?
the fact is still in the context window
Drag through the conversation. The fact stays highlighted while it's still inside the window — then, once enough new messages arrive, it drops out entirely. Nothing "forgot" it in any deep sense; it's simply outside the fixed-size slice the agent can see.
A context window holds only the most recent messages — a plain sliding window, identical in spirit to Part XV's fixed-size state, except here the eviction rule is FIFO (First In, First Out) rather than a learned decay:
- — the set of messages the agent can actually see at time .
- — the current time step, counted in messages.
- — the fixed window size: how many of the most recent messages are kept.
- — the message (or fact) at position in the conversation.
- A fact disappears once t outgrows it
A fact at position is visible at time exactly when — once grows past , it's gone, permanently, unless something else keeps a copy.
- Retrieval is that something else
Every message gets stored in an external index the window's size limit never touches, and a query searches that whole index directly instead of only the current window.
The context-only agent's window, right when the question is asked, contains nothing about a favorite color — the fact is six messages behind it. The retrieval-augmented agent isn't limited to the window at all; it searches every prior message and finds the one that actually answers the question.
A window of size 4, fact at message , question at message :
- The window at t=3
— the fact is still the oldest message in the window, but it's in there.
- The window at t=4
— one more message arrived, and is the one that had to go to keep the window at size 4.
- By t=6, it's long gone
— the question itself is in the window, but nothing that answers it is. Retrieval searches all 6 prior messages directly and returns regardless.
Find the smallest message index, among the candidates, where the fact has already fallen out of the context window.
This chapter's retrieval used the same keyword-overlap idea as a first pass at relevance — Part VI's retrieval-augmented-generation chapter built the real version, embedding-space nearest-neighbor search, which finds semantically related facts even when no words literally match. Real agents typically run both mechanisms together: a context window for the immediate back-and-forth, and a retrieval store for anything that needs to survive longer than the window does. The next chapter asks what happens when a single agent's context and tools aren't enough for the task at all — when the job genuinely needs more than one agent working together.