Build1 publisher3 min readPublished
Every token admitted to a full context window evicts one already there
A field-notes post on production LLM agents argues the context window behaves like a cache under eviction pressure, and that the real work is deciding every turn what earns space and which failed turns to scrub.
The Engineer · Build desk

What happened
- The post separates the system prompt, decided once, from context engineering. That, it says, is a decision made every turn under a budget, about a working set that keeps changing while the run is live.
- A context window is a fixed token count for one call, and system prompt, tool results and prior turns all compete inside it, so at the limit admitting one token evicts one already there.
- Its central claim is that teams model the window as memory when it behaves like a cache, where what stays and what goes is decided continuously, and a miss costs whatever happened to be evicted.
- It names contamination as the first failure mode, in the specific form of a failed attempt left as the most recent turn. The next attempt then reads that as a template.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- constraint An agent loop whose only verb is append still evicts. The runtime picks the victim, and it has no view of which fact turn eighty will need.
- decision Retry handling becomes a classification problem before it becomes a context problem. A resend is correct and cheap for a transient failure and wrong for a semantic one, so one code path cannot serve both.
- cost Just-in-case padding is charged twice: once in tokens, and once in retrieval accuracy, because the filler pushes the needed fact toward the position the cited study says models handle worst.
The post's split between memory and a cache is a claim about which verbs you get. Memory gives you append, plus the promise that what you put there is still there later [7]. A cache gives you admission, eviction, and a miss whose cost depends entirely on which entry left [7]. A loop that only implements append has an eviction policy anyway. It is whatever the runtime does when the request exceeds the limit [5]. That is inconvenient for the many agent loops written as though there were an append-only mode.
The figures in the post are turn counts. Append is fine at six turns and catastrophic at two hundred, because the window does not grow to match and something the developer did not choose starts falling out [8]. On turn one you do not know which of today's facts will matter on turn eighty [3]. That is roughly 33 times as many turns competing for the same fixed token budget [17].
The one external result the post leans on is "Lost in the Middle" (Liu et al., 2023). It is cited for the finding that retrieval accuracy over a long input degrades measurably when the relevant fact sits in the middle of the context instead of at the start or end [9]. The post does not quote a figure from it. Two conditions have to hold before that result says anything about a given run: the packed input has to be long enough to have a middle, and the fact you need has to land in it. A loop that repacks the window each turn and keeps the working set at the edges sits outside the case the study describes.
Contamination is the failure mode the post documents in detail, and the case is narrower than junk accumulating in the window. It is a failed attempt sitting in the transcript as the most recent turn, quietly serving as a template for the next one [11]. The post describes a naive retry that resends the full transcript including the model's own wrong answer. On the post's account, that does not hand the model a clean second attempt; it hands the model a context window holding up a plausible-looking answer as the thing to produce again [12]
According to the post, plenty of retries are transient failures where the original context was fine and a resend is correct and cheap [13]. The fix was classifying why the attempt failed, and for the semantic failures, scrubbing the specific wrong turns while keeping a named statement of what is now ruled out [14]. Keeping the literal failed reasoning around because it might still be useful is, in the post's words, "it's not useful, it's an anchor" [15].
Adopting that costs two things. Your retry path needs a failure taxonomy before it needs anything else, and the transcript has to be yours to edit turn by turn: deleting turn 41 while keeping turn 42 is not the same operation as clearing the conversation [14].
This is one team's field notes, published on dev.to and originally on Loop and Retry [16]. The author says both failure modes on either side of the packing decision have broken real runs [19], and the available text breaks off while introducing the second [18].
What to watch
- The rest of the post: the second failure mode, on the dropping side of the packing decision, is not in the available text.
- Whether agent SDKs expose transcript APIs that delete named turns, instead of only resetting a conversation.
- A published failure taxonomy with hit rates for transient versus semantic retries would make this budgetable.