Lune

ACL Findings2026

Context as a Tool: Context Management for Long-Horizon SWE-Agents

Shukai Liu, Bo Jiang, Jian Yang, Yizhi Li, Jinyang Guo, Xianglong Liu, Bryan Dai

Abstract

Agents based on large language models have recently shown strong potential on real-world software engineering (SWE) tasks that require long-horizon interaction with repository-scale codebases. However, most existing agents rely on append-only context maintenance or passively triggered compression heuristics, which often lead to context explosion, semantic drift, and degraded reasoning in long-running interactions. We propose CAT, a new context management paradigm that elevates context maintenance to a callable tool integrated into the decision-making process of agents. CAT formalizes a structured context workspace consisting of stable task semantics, condensed long-term memory, and high-fidelity shortterm interactions, and enables agents to proactively compress historical trajectories into actionable summaries at appropriate milestones. To support context management for SWEagents, we propose a trajectory-level supervision framework, CAT-GENERATOR, based on an offline data construction pipeline that injects context-management actions into complete interaction trajectories. Using this framework, we train a context-aware model, SWE-Compressor. Experiments on SWE-Bench-Verified demonstrate that SWE-Compressor reaches a 57.6% solved rate and significantly outperforms ReAct-based agents and static compression baselines, while maintaining stable and scalable long-horizon reasoning under a bounded context budget.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

4 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • PACE: Predictive Adaptive Context Extraction for Long-Horizon LLM Agents cites Reflexion: language agents with verbal reinforcement learning
  • SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution cites SWE-bench: Can Language Models Resolve Real-world Github Issues?
  • GXPO: Group Cross-Lingual Relative Policy Optimization for Code Generation cites SWE-bench: Can Language Models Resolve Real-world Github Issues?
  • Scaling Long-Horizon Agent via Context Folding cites SWE-bench: Can Language Models Resolve Real-world Github Issues?
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers4

  1. On Training Large Language Models for Long-Horizon Tasks: An Empirical Study of Horizon LengthSunghwan Kim, Junhee Cho, Beong-woo Kwak, Taeyoon Kwon et al.ICML 2026 · 3 citations
  2. PACE: Predictive Adaptive Context Extraction for Long-Horizon LLM AgentsLei Wei, Xiao Peng, TT, Guannan Zhang et al.ACL 2026
  3. GXPO: Group Cross-Lingual Relative Policy Optimization for Code GenerationLinzheng Chai, Jian Yang, Jiajun Wu, Ensheng Shi et al.ICML 2026
  4. Agent-Omit: Adaptive Context Omission for Efficient LLM AgentsYansong Ning, Jun Fang, Naiqiang Tan, Hao LiuICML 2026

Builds on22

  1. Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan et al.NeurIPS 2023 · 5,828 citations
  2. SWE-bench: Can Language Models Resolve Real-world Github Issues?Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao et al.ICLR 2024 · 2,082 citations
  3. SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software EvolutionYuxiang Wei, Olivier Duchenne, Jade Copet, Quentin Carbonneaux et al.NeurIPS 2025 · 291 citations
  4. InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context MemoryChaojun Xiao, Pengle Zhang, Xu Han, Guangxuan Xiao et al.NeurIPS 2024 · 223 citations
  5. Scaling Long-Horizon Agent via Context FoldingWeiwei Sun, Lu Miao, Zhan Ling, Kang Liu et al.ICML 2026 · 104 citations

Related papers

  1. AttnCompress: Dynamic Attention-Guided Trajectory Compression for Software Engineering AgentsZhengran Zeng, Yixin Li, Rui Xie, Wei Ye et al.ISSTA 2026
  2. Structurally Aligned Subtask-Level Memory for Software Engineering AgentsKangning Shen, Jingyuan Zhang, Chenxi Sun, Wencong Zeng et al.ICML 2026 · 9 citations
  3. ACON: Optimizing Context Compression for Long-horizon LLM AgentsMinki Kang, Wei-Ning Chen, Dongge Han, Huseyin Inan et al.ICML 2026
  4. CoMem: Context Management with A Decoupled Long-Context ModelYuwei Zhang, Chengyu Dong, Shuowei Jin, Changlong Yu et al.ICML 2026
  5. SE-Agent: Self-Evolution Trajectory Optimization in Multi-Step Reasoning with LLM-Based AgentsYifu Guo, Jiaye Lin, Huacan Wang, Yuzhen Han et al.NeurIPS 2025 · 73 citations
Dusk over the sea between two cliffs drawn in fine vertical lines