cs.AIOct 16, 2026

When to Forget: Risk-Controlled Context Adaptation for Long-Horizon Agents

Authors: Chenle Chen, Yangbo Wei, Zhijie Zheng, Zhenyu Su, Qifan Wang, Junhong Qian, Chao Yao, Chen Wu, 

Organizations: University of California, Los Angeles · Shanghai Jiao Tong University · Arizona State University · Eastern Institute of Technology, Ningbo

Abstract

Long-horizon agents learn from failure, but the value of a failure record can change as execution progresses. We study when retaining, compressing, or removing the same history block improves subsequent execution relative to full-history KEEP. We introduce RECAP, a framework that combines matched context interventions, execution-relational prediction, and independent policy certification. Matched environment states and rollout seeds measure success and continuation prompt-cost differences; prefix-only relations between a failure block and the current execution propose promising edits. Independent task bundles then select a policy subject to harmful-intervention and non-positive-benefit risk constraints under a fixed measurement protocol. A five-seed longitudinal case holds both the failure block and its summary fixed: compression fails at an early state and becomes a cost-saving intervention at a later state. Across five backbones, RECAP produces positive paired-success saving estimates with backbone-specific reliability-efficiency tradeoffs. On Hunyuan-A13B, it edits 43.24% of retained checkpoints while matching KEEP's observed 91.89% continuation success and reducing unconditional mean continuation prompt cost by 4,619.8 tokens (2.13%). The framework provides an execution-level reference for deciding when to forget: retain history by its value to what comes next.

Explore similar work

CardsList
  1. AMBER: Training Long-Horizon Web Agents through Append-Only Memory

    Oct 5, 2026Chinmay Savadikar, Zhaoyu Zhang, Mingyu Zhao +4Long-Horizon LLM AgentsAgent Memory Management

  2. StateComp: Learning When to Compress History in Long Horizon Agents

    Sep 23, 2026Mingxuan Wang, Hongyue Chen, Yinglong Guo +6Context CompressionLong-Horizon LLM Agents

  3. AgentRewind: Recoverable Execution for Long-Horizon LLM Agents

    Aug 14, 2026Yu Zhuang, Kefei Chen, Yitong Duan +3Long-Horizon LLM AgentsLong-Horizon Agent Tasks