Long-horizon agents continuously accumulate interaction history during task execution, yet the importance of past interactions changes as the agent state evolves. Existing context management methods largely compress history based on fixed windows, periodic schedules, or current relevance, overlooking a more fundamental question: when has a past interaction become safe to replace? Premature compression may remove information still needed for future actions, while overly conservative retention leads to substantial context overhead. To address this, we propose State Conditioned Compression (StateComp), a framework that determines when historical interactions can be safely compressed according to the current agent state. StateComp constructs KEEP and READY supervision through a two-stage annotation procedure and trains an imbalance-aware router on hidden representations from a frozen language model. A bounded state representation further reduces the cost of evaluating long histories, while adjacent READY interactions are grouped into continuous spans and replaced with compact summaries during execution. Experiments on WorkBuddyBench show that StateComp reduces total agent and summarization tokens by 52.27% while maintaining task performance, and achieves a 12.67-fold speedup in representation extraction.
Figures & tables
Figure 1: Overview of StateComp . Structured annotations and a second boundary review produce supervision. A router learns from hidden states of a frozen representation model. Online predictions are combined with span length and token gates before summaries replace raw interactions. Historical and current state features are used jointly, as described in Section 4.1 .
Figure 2: Compression dynamics across checkpoints in an example trajectory.
Method
Max. tokens
Wall clock (s)
Peak GPU (GiB)
Workspace (GiB)
Test F1
Full history
203,675
76.40
29.426
11.867
0.7000
Bounded
5,120 (-97.49%)
6.03 (12.67 × )
18.620 (-36.72%)
1.062 (-91.05%)
0.7818 (+0.08)
Table 1: Efficiency and quality of bounded state representations. Max. tokens reports the largest recorded input; runtime and memory are measured on the same seven paired states.
Figure 3: Compression opportunities over different trajectory stages.
Figure 4: Router score distributions.
Method
Code
Office
Sec.
Web
Avg.
Tokens (M)
Baseline
76.99
81.84
47.76
72.14
69.87
698.17
StateComp
77.12 ↑ 0.13
82.77 ↑ 0.93
47.31 ↓ 0.45
73.14 ↑ 1.00
70.26 ↑ 0.39
333.24
Table 2: Full WorkBuddyBench comparison on 260 tasks. Scores are mean reward multiplied by 100. Tokens include the main agent and summary calls. Colored changes show score differences relative to the baseline for all domains.
Method
Code
Office
Sec.
Web
Avg.
Tokens (M)
Baseline
72.93
81.64
44.58
71.00
67.54
75.50
Sliding Window ( K=5 )
66.81 ↓ 6.12
67.43 ↓ 14.21
32.32 ↓ 12.26
59.00 ↓ 12.00
56.39 ↓ 11.15
118.08
Sliding Window ( K=10 )
74.37 ↑ 1.44
73.05 ↓ 8.59
40.07 ↓ 4.51
61.00 ↓ 10.00
62.12 ↓ 5.42
79.39
Sliding Window ( K=20 )
79.31 ↑ 6.38
85.11 ↑ 3.47
40.28 ↓ 4.30
70.00 ↓ 1.00
68.67 ↑ 1.13
80.82
Periodic Summary ( n=3 )
65.44 ↓ 7.49
67.66 ↓ 13.98
26.32 ↓ 18.26
82.66 ↑ 11.66
60.52 ↓ 7.02
88.57
Periodic Summary ( n=5 )
83.60 ↑ 10.67
75.74 ↓ 5.90
40.03 ↓ 4.55
81.32 ↑ 10.32
70.17 ↑ 2.63
94.85
Table 3: Context management results on Eval40. Scores are reward multiplied by 100. Small colored arrows show changes relative to the DeepSeek baseline. Bold and underlined values indicate the best and second best results.
Backbone
Method
Code
Office
Sec.
Web
Avg.
Tokens (M)
Base
55.30
79.24
60.24
46.00
60.19
41.00
Hunyuan
StateComp
64.31 ↑ 9.01
82.20 ↑ 2.96
60.14 ↓ 0.10
49.00 ↑ 3.00
63.91 ↑ 3.72
12.83
Base
75.25
83.42
45.28
86.00
72.49
49.75
Qwen3.8-Flash
StateComp
93.46 ↑ 18.21
88.71 ↑ 5.29
41.20 ↓ 4.08
88.00 ↑ 2.00
77.84 ↑ 5.35
38.23
Base
79.49
66.13
34.67
66.51
61.70
47.58
GLM-5.3-Flash
StateComp
66.15 ↓ 13.34
69.90 ↑ 3.77
38.64 ↑ 3.97
85.00 ↑ 18.49
64.92 ↑ 3.22
38.49
Table 4: Cross-model evaluation on Eval40. Scores are reward multiplied by 100. Colored arrows show changes relative to the same backbone without StateComp. Tokens report the total model usage in millions. Each domain contains ten tasks, so Avg. is the mean of the four domain scores.
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
Symbol
Meaning
Si
Complete historical interaction
Pk
Uncompressed reference prefix before interaction k
Hk,Ik
Effective history and identifiers of surviving raw interactions
yi,k
Reference label: KEEP =0 , READY =1
ti∗
Earliest supported compression checkpoint
Fϕ,gθ
Frozen representation model and trained router
Appendix
Table A1 : Notation for supervision and online compression.
Quantity
Value
Trajectories
300
Recorded states
7,931
Checkpoint groups
7,631
Interaction–state pairs
244,526
KEEP pairs
228,893
READY pairs
15,633
Appendix
Table A2 : Compression supervision and evaluation partitions.
Figure A1 : Variation in compression opportunities. Mean and median READY fractions and the 10th–90th percentile range across trajectories.
Figure A2 : Compression delay and span dynamics. Left: normalized delay to READY by interaction position. Right: relative span count, span length, and coverage over task progress.
Figure A3 : Prediction across training fractions and trajectory-length groups. Thin curves show individual folds and the thick curve their mean.
Figure A4 : Held-out precision and coverage. The 98% line is a reference target, not an attained guarantee.
Figure A5 : Calibration diagnostics. The displayed ECE values are 0.035, 0.038, and 0.011 for raw, temperature-scaled, and Platt-calibrated scores.
Method
Total tokens (M)
Summary tokens (M)
Baseline
75.50
0
StateComp
43.76
0.077
Sliding Window K=5
118.08
0
Sliding Window K=10
79.39
0
Sliding Window K=20
80.82
0
Periodic Summary n=3
88.57
4.50
Appendix
Table A9 : Eval40 total tokens and summary overhead. Counts are in millions. Summary tokens are included in the total; totals follow the precision of the main-text comparison.
Model
Method
Total tokens (M)
Summary tokens (M)
Hunyuan
Base
41.00
0
Hunyuan
StateComp
12.83
0.130
Qwen3.8-Flash
Base
49.75
0
Qwen3.8-Flash
StateComp
38.23
0.236
GLM-5.3-Flash
Base
47.58
0
GLM-5.3-Flash
StateComp
38.49
0.101
Appendix
Table A11 : Cross-model total tokens and summary overhead. Counts are in millions. Summary tokens are included in the total.
Long horizon language model agents continually accumulate reasoning history, increasing context length and inference cost even after earlier decisions have been executed and observed. Unlike static Chain of Thought compression, removing historical reasoning can change future actions and the resulting interaction trajectory. We study when such reasoning can be safely forgotten. We propose Interaction Aware Compression for Long Horizon Reasoning (ICLR), a training free online method that ranks reasoning blocks using frozen proxy entropy while preserving actions, tool calls, and observations. On 260 WorkBuddyBench tasks, ICLR improves average reward from 0.699 to 0.718, while reducing input, output, and cache read tokens by 25.5%, 14.4%, and 33.3%, respectively. Ablations reveal trajectory amplification, where local reasoning deletion produces nonlinear changes in total computation by altering subsequent interaction. Representation probing, activation patching, and controlled trajectory analyses further suggest that historical reasoning becomes more replaceable once task relevant derived state has been reliably externalized into code, files, tool outputs, or environmental feedback. These results characterize agent reasoning as dynamic working state rather than permanent interaction history.
Mingxuan Wang, Fei Luo, Bo Wang +6
TierFlow Team · Gaoling School of Artificial Intelligence, Renmin University of China · Tsinghua University
Long horizon language model agents continuously accumulate interaction history, increasing computational cost while making relevant information harder to preserve and reuse. Existing context management methods mainly focus on how to compress or retrieve history, but largely leave open whether the model itself already represents the need for these memory operations before they occur. We study the hidden state immediately before each agent action and find that compression and recall needs are already encoded in the model's internal representations. These signals cannot be explained by simple context length or interaction progress, and they exhibit distinct formation patterns across model depth. We further show that most memory decision information is preserved in a compact recent context, while selectively restored historical evidence complements the long range dependencies that recent context misses. Based on these findings, we propose Preaction Memory with Evidence Retrieval (PaMER), which combines state guided compression with external evidence retrieval. PaMER+ further introduces step level evidence selection to recover only the historical information required by the current task. Experiments on WorkBuddyBench, across multiple context management baselines and model backbones, show that our framework substantially reduces context consumption while maintaining competitive task performance.
Mingxuan Wang, Guorun Yao, Fei Luo +6
TierFlow Team · Gaoling School of Artificial Intelligence, Renmin University of China · Tsinghua University
Recurrent context compression controls context growth in long-horizon agents, but its behavioral effects remain poorly understood. In this preliminary empirical study, we show that compression can weaken the influence of recent interactions, increasing blocked actions, repeated exploration, and instability across runs. Motivated by these observations, we introduce TRACE, a verifier-guided framework that evaluates individual compaction events through paired closed-loop continuations from the same environment state and uses summary preferences to optimize a natural-language compression prompt while keeping all models frozen. Initial results on AppWorld show improvements over existing compression baselines in task performance, multi-run reliability, and context--execution efficiency. These findings provide early evidence for boundary-local evaluation as a promising direction for reliable agent context compression.
Guanghui Min, Liang Wu, Mayank Darbari +2
Department of Computer Science, University of Virginia, Charlottesville, VA, USA · Nokia, Sunnyvale, CA, USA