cs.CLSep 30, 2026

Persistent Context Graphs for Efficient Memory Compaction in LLM Agents

Authors: Jingbo Yang, Kwei-Herng Lai, Xiaowen Wang, Zhaoxuan Tan, Pei Zhou, Mengting Wan, Yaar Harari, Evgeniy Gabrilovich, 

Organizations: University of California, Santa Barbara · Microsoft · University of Notre Dame

Abstract

As LLM capabilities advance, agents are tackling increasingly complex tasks over longer horizons. Their growing interaction histories make memory compaction essential for staying within context windows and reducing prefill cost. Existing methods summarize the history or compress its KV cache, often adding model computation to preserve information for future requests. A new user request can change which history matters, but reassessing that history with the model requires re-encoding it if the KV cache has expired. Past attention provides signals of historical importance and dependencies between messages, while relevance to the current task must be assessed using the new user request. We introduce ReCAP, a memory compaction method that stores attention-derived importance scores and dependency links in a lightweight, persistent context graph. For each new request, ReCAP combines stored importance with relevance cues from the request and follows dependency links to select messages and their supporting context, without additional model calls for selection. Compared with Codex's default summarization-based compaction, ReCAP reduces estimated latency for compaction and cold restoration by approximately 95% on both Qwen3-Coder and gpt-oss. It also roughly halves the historical context per call on SWE-Together at comparable task quality and improves accuracy on the code tasks of Lost-in-Conversation over full history by 19.8 and 41.2 points.

Figures & tables

Appendix figures & tables5 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Addressable Recall Compaction for Long Context-Window Control in AI Agents

    Jul 27, 2026Thang Dang, Yuma Ichikawa, Sakina Fatima +1Long-Horizon LLM AgentsLLM Context Management

  2. Parallel Context Compaction for Long-Horizon LLM Agent Serving

    May 22, 2026Musa Cim, Burak Topcu, Chita Das +1LLM Inference EfficiencyLLM Agent Workflow Optimization

  3. LazyMem: Retrieve Broadly, Construct Selectively for Efficient Long-Term Agent Memory

    Jul 17, 2026Jing Yu, Yibo Zhao, Jiaming Zhang +1Persistent Memory for Language ModelsLong-Term Conversational Memory