REM: What to Store, When to Recall, What to Forget in Experience Memory for Coding Agents
Xinyi Lisa Chen, Pedro Herrero-Vidal, Xiaohan Chen, Xiaojing Yu, Cris Liu, Bingqing Song, Bin Xu, Suleiman A. Khan, You-Lin Chen
Abstract
Large language model (LLM) agents now autonomously complete long-horizon tasks, such as repository-level coding, through hundreds of think-act steps, yet the experience each run produces is rarely reused on the next. Prior memory systems concentrate on retrieval, finding the most relevant past trajectory. Retrieval cannot observe the running agent, so it cannot decide whether the agent needs an experience, at which point, or for how long. We introduce REM (Reusable Experience Memory), a framework that manages the memory lifecycle from inside the agent's think-act loop through three explicit decisions. What to store: each completed trajectory is consolidated into a phase-structured document, two orders of magnitude smaller than the trajectory. When to recall: the document is injected at the start of the task; the costlier implementation record is withheld until an in-loop gate detects the agent struggling. What to forget: the record is evicted after a single exposure. On repository-level bug fixing (SWE-ContextBench Lite), REM retrieves the related trajectory more accurately than every state-of-the-art memory system (68.7% vs. 55.6% match@1) and improves, in every replicate, end-task resolution (27.6% vs. 24.9%) at 17% lower cost. Injecting the same experience as a summary or raw trajectory, even when oracle-retrieved, does not. Ablating any of the three decisions reduces resolution. Altogether, these results demonstrate that the bottleneck in experience reuse is not retrieval fidelity but how experience is stored and governed across its lifecycle, opening a control-theoretic perspective on agent memory.
Create a lesson
Metadata
- Comments
- Accepted at the NeurIPS 2026 Workshop on Continual Learning for Enterprise AI Agents (CLEA). 16 pages, 3 figures, 14 tables
Related papers
When Does Experience Memory Help Closed-Loop LLM Driving Agents? A Controlled Evaluation with Resampled Warmup Pools, Token-Matched Fillers, and Audited Baselines
Shared title terminologycs.AIYingxin Jia, Xuanyi Li
MemDev-Bench: Does Memory Help Code Agents?Benchmarking Memory Systems over Real Repository Histories
Shared title terminologycs.AIGuorui Chen, Tao Liu, Zhenzhen Huang et al.
Distilling Visual Agents from Limited Interaction Experience
Shared title terminologycs.AISiyu Zhou, Jing Jiang, Chengqi Zhang et al.
Internalized Experience: How Training Data Shapes Memory Formation in LLMs
Shared title terminologycs.AIXianxuan Long, Xinnan Dai, Kai Guo et al.
ESM-Bench: A Benchmark for Evaluating Whether AI Agents Understand Earth System Model Physics and Code
Shared title terminologycs.AIKoutian Wu, Yuxuan Cao, Gengchen Mai et al.
Engram: Multi-Stage Memory for Agentic Tuning of Heterogeneous Models
Shared title terminologycs.AIHuanran Li, Nhat X. T. Le, Kevin De Angeli et al.