When to reach for it
- Conversations or tasks outgrow the context window.
- Salient facts must survive across very long horizons.
- Which information is salient changes over the run.
The agent as its own memory manager: page facts in and out like an OS.
The agent treats its finite context window like RAM and an external store like disk, and pages information between the tiers under its own control — deciding what stays resident, what is evicted to long-term storage, and what is recalled on demand — so it can operate over histories far larger than the window.
In practiceA legal-research agent managing a 200-page contract pages out early clause summaries to an external store and pages them back in only when a downstream question references that section.
The context window is divided into fixed parts, and a queue manager watches how full it is. The model itself moves information out and back in, through function calls.
1 · Evict, when the window fills
2 · Recall, on demand
| Moment | Window | What happens |
|---|---|---|
| Turn 180 · ordinary chat | 68 % | Nothing. Everything is still in view. |
| Turn 181 · the user mentions a birthday | 71 % | The warning is inserted. The model writes “daughter Mia, birthday 4 March” to the working context. |
| Turn 240 | 100 % | Flush. The oldest messages leave the window, the summary is updated, the originals go to recall storage. |
| Turn 300 · “Which venue did we talk about in spring?” | 55 % | The model searches recall storage, reads two pages of results and answers. |
def step(window, event):
window.queue.append(event)
if window.tokens > 0.7 * LIMIT and not window.warned:
window.queue.append(system("memory pressure: save what you will need"))
window.warned = True
if window.tokens > LIMIT:
evicted = window.queue.pop_oldest(tokens=0.5 * LIMIT)
recall_storage.add(evicted) # out of view, not lost
window.summary = summarize(window.summary, evicted)
window.warned = False
return model(window, tools=[edit_working_context, write_archive,
search_archive, search_recall])When to reach for it
When it backfires
Self-editing memory means the agent decides what to drop. Under token pressure it can page out a fact that becomes critical several steps later, then confabulate a replacement.
Countermeasure
Pin invariant facts (task goal, constraints, identity) to a non-evictable region and only let the pager touch the discretionary tier.
Each eviction compresses already-compressed content. After many cycles the paged-back summary is a summary of a summary, and details mutate or invert relative to what was originally said.
Countermeasure
Page the verbatim content out to the store and summarize only the resident working view; recall the original on demand rather than re-compressing repeatedly.
Search patterns, frameworks, and pages.