Adapting Context Compression for Long-Horizon Agents with Counterfactual Continuations

Guanghui Min, Liang Wu, Mingjia Shi, Yinhan He, Mayank Darbari +2 more
9/29/2026
cs.LGcs.AIcs.CL

No official code found. Best implementation: GuanghuiMin/pair (1 star, last commit 2026-09-25).

Abstract

Long-horizon agents require context compression to manage growing interaction histories. Compression quality, however, is ultimately determined by downstream execution. Existing prompt-adaptation methods infer compression errors by comparing full-context and compressed trajectories. Such comparisons cannot isolate individual compressions and are confounded by agent stochasticity. We first find that compression degrades reliability before solvability. Using matched counterfactual continuations that compare execution from the same agent state with versus without compression, we further show that severe degradation concentrates at isolated compression events. Motivated by this finding, we propose PAIR (Prompt Adaptation using Interventional Rollouts) for adapting structured compression prompts. PAIR identifies individual compressions that degrade subsequent execution, diagnoses their effects, and revises the relevant sections of a fixed compression template. PAIR achieves the strongest cross-run reliability among compressed methods in every main benchmark-scope combination, consistently exceeding the competing prompt-adaptation baseline. Without modifying the downstream agent, PAIR brings compressed execution close to the no-compression baseline and sometimes numerically exceeds it.

View on arXivView PDF

Code Implementations(1)

GuanghuiMin/pairCommunity71%

Code for paper "Adapting Context Compression for Long-Horizon Agents with Counterfactual Continuations"

10Sep 13, 20263 weeks ago

Cite this paper

@article{min2026adapting,
  title  = {Adapting Context Compression for Long-Horizon Agents with Counterfactual Continuations},
  author = {Guanghui Min and Liang Wu and Mingjia Shi and Yinhan He and Mayank Darbari and Liangjie Hong and Chen Chen},
  year   = {2026},
  eprint = {2609.36526},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.36526v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2609.36526.svg)](https://codeofpaper.com/paper/2609.36526)

Discussion