Long‑horizon language‑model agents continuously accumulate reasoning traces, tool interactions, and observations, whose relevance shifts with the current decision. Existing compression methods usually score historical units independently, yet the safety of deleting multiple units cannot be inferred from their singleton scores alone—redundant evidence, accumulated small effects, and the information that remains after deletion all matter.
We introduce Direct Relational Set‑Risk Pruning (DRSR), which formulates history compression as a risk‑constrained selection problem over deletion sets. In the offline phase, DRSR constructs exact counterfactual supervision by jointly deleting protocol‑valid history blocks and measuring the change in teacher‑forced likelihood of the same recorded next output. A lightweight scorer is then trained to predict set‑level harm using online‑visible relations between candidate history and the current pre‑action state, together with deleted‑retained and pairwise set structure.
At deployment, DRSR evaluates a small set of structurally valid deletion candidates with the scorer and removes the largest feasible set under recency, protocol, budget, and learned‑risk constraints, abstaining when no set is sufficiently safe. On WorkBuddyBench Full260, DRSR raises mean reward from 0.699 to 0.802 while cutting total model tokens by 20.820%. On the fixed Eval40 benchmark, it achieves 0.794 reward at 1.211 M tokens per task, using 35.850% fewer tokens than the uncompressed agent. Mechanistic analyses and ablations show that decision‑conditioned relations, retained‑context information, pairwise interactions, and abstention each contribute to reliable pruning.
Review: DRSR’s set‑level risk modeling overcomes the limitations of traditional point‑wise scoring, achieving substantial token savings without sacrificing—and even improving—task performance, thus offering a practical pathway for scalable long‑horizon agents.