HackerPapers

arXiv:2606.11213cs.CL

Beyond Compaction: Structured Context Eviction for Long-Horizon Agents

Andrew Semenov, Svyatoslav Dorofeev

HN submission. Found in a submission link or body. Submitters do not count as commenters in the main ranking; a submission is not an endorsement.

Abstract

We present Context Window Lifecycle (CWL), a context-management scheme that gives long-horizon LLM agents an effectively unbounded working horizon. As a session accumulates history, CWL keeps the context within budget through graduated, semantically-aware eviction: the agent annotates its trajectory as typed, dependency-linked episodes as work proceeds, and a deterministic, LLM-free policy evicts content in priority order within that structure when a token budget is exceeded. CWL preserves user turns and the exploratory context the agent is actively reasoning over, while aggressively shedding action episodes whose effects are already persisted in the environment, keeping active context near a stable ceiling that also avoids the performance degradation associated with very large prompts. Compared to summarization-based compaction, CWL avoids four well-known limitations: unpredictable lossiness, destruction of causal structure, blocking model cost, and compression-induced hallucination. Compared to recency truncation, CWL is semantically aware: it drops the oldest-and-most-recoverable content according to the dependency graph rather than oldest-in-time regardless of relevance. We describe the annotation protocol, the episode graph, the eviction policy, and the token-accounting loop, and evaluate CWL on long-horizon agentic benchmarks: a single agent session completing 89 sequential tasks across 80 million tokens with no measurable degradation in task accuracy relative to per-task isolated sessions

arXiv comments
Journal reference
DOI
Subjects
cs.CLComputation and Language

On Hacker News

No comments linking this paper were found in the collected sources. Found in 1 HN submission from Jul 2026 to Jul 2026. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments0 threads

No comments linking this paper were found in the collected sources. Open submission discussions.

Submitted to Hacker News

  • Show HN: Running over 80M tokens in one agent session with no compaction

    We ran a single agent session through all 89 sequential tasks of Terminal Bench 2.0 or over 80 million tokens, with no measurable accuracy loss versus running each task in its own fresh session. We didn't use compaction. Compaction is the standard fix for finite context windows, but it has problems. The obvious one is context loss - you can't compress 300,000 tokens of work into a sub-20,000 summary. Only the most salient information survives, and a single model unanimously decides what's worth…

Connected through shared HN threads, not inferred similarity or a recommendation.