Never Block, Never Forget: Optimal Context Maintenance for LLM Agents
LLM agents exceed the size of their context window, and runtimes reduce this context by summarising older messages. A summary takes several seconds; runtimes therefore have the choice between waiting for it to be ready, which blocks the agent, and preparing it in advance. In session logs from a production deployment, summarisation proved slower than the interval between compactions in 8 out of 16 cases; the agent waited for up to 88 s, and the output from a single tool reached 246,854 tokens. We prove a lower bound for each runtime and each arrival sequence: what a session writes during one summarisation beyond its context budget can be neither verbatim nor summarised. A runtime whose record is its context must therefore either block or lose the history; a runtime built on an append-only log, in which the context is a view, only has a transient gap. We propose a sliding policy, comprising k staggered passes over independent segments, whose gap exceeds the bound by at most what the session writes in L/k, plus one message. In Digitorn, a production runtime, this policy never blocks the agent's loop and misses 36 per cent to 59 per cent less context than the previous non-blocking design at an equal budget, and 59 per cent to 83 per cent less on the arrivals of 73 production sessions. With real models writing the summaries and answering the questions, no out-of-view facts were recalled, and the blocking summarisation held up the agent for up to 236 s. Limiting the gap does not limit what a summary omits. In a conversation from the LoCoMo benchmark, recursive summaries halved the F1 score of a model's answers (from 0.471 to 0.24). Across 1,540 questions with an identical budget, views combining summaries and original messages achieve a score of 0.505 compared with 0.395 for summaries alone; with dense retrieval, the original messages alone achieve equally good results.
Authors
- Paul Mbathe
Institutions
- Dignity Health (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-01
- DOI
- https://doi.org/10.5281/zenodo.24731918
- Primary Topic
- Advanced Database Systems and Queries
- Type
- preprint