Manuscript Offprint
arXiv:2610.20927Prune the Summary, Not the History: Source-Judged Compaction for Long-Horizon Agents
Abstract
Long-horizon LLM agents rely on context compaction: when the interaction history outgrows the context window, a compressor replaces it with a natural-language summary. We show that these summaries contain more than a record of what happened. Compaction prompts ask for decisions and next steps, so each summary mixes facts established by the environment with reasoning written by the compressor, and the agent cannot tell the two apart afterwards. In an analysis of a widely used structured compressor, 83% of failed runs trace back to an action that carries out a specific summary entry, most of which no environment output supports. We propose Source-Judged Compaction (SJC), a training-free post-processing step that scores each summary entry for whether it has a source in the environment outputs or the previous summary, and removes the entries that do not. It changes neither the agent nor the compressor and adds one inexpensive judge request per compaction. The judge is Jev, a non-generative decision model that answers the source question with a calibrated probability instead of text. On AppWorld and OfficeBench with two agent models, SJC improves cross-run reliability over the underlying compressor by 2.1%–8.9% without increasing the agent's token usage. Our code is available at https://github.com/GuanghuiMin/sjc.
1 Introduction
Long-horizon agentic tasks require LLMs to plan, use tools, and adapt to environmental feedback across extended interactions (Xu et al., 2026; Wang et al., 2024). During execution, tool outputs, failed attempts, intermediate results, and reasoning traces continually accumulate, making the context increasingly expensive to process and difficult to navigate. This problem persists even with large nominal context windows, whose effective use of distant information degrades with context length (Liu et al., 2024; Hsieh et al., 2024). Context compaction is therefore essential for scalable long-horizon agents.
General compaction methods select or rewrite tokens from static prompts and documents (Jiang et al., 2023; Pan et al., 2024), but do not directly account for subsequent agent execution. Agent-specific methods such as ReSum, SUPO, and ACM instead modify or post-train the agent to manage compressed contexts (Wu et al., 2025; Lu et al., 2025; Li et al., 2026). In many deployed systems, however, the agent is fixed or accessible only through an API. OpenClaw, DeepSeek Harness, and Codex therefore invoke a separate compressor that replaces older interactions with a natural-language checkpoint (OpenClaw Contributors, 2026a; DeepSeek-AI, 2026; OpenAI, 2026a), while ACON and PAIR improve the compression prompt without modifying the downstream agent (Kang et al., 2026; Min et al., 2026b).
Such checkpoints do more than shorten history: they periodically reconstruct the state from which the agent continues, including its progress, constraints, and future actions. Errors in this reconstruction can therefore alter subsequent execution (Min et al., 2026a,b). For example, when a user asks to reply to a friend with movie titles “as per their request”, the compressor records the next step as sending the comma-separated movie list; the agent then sends every title it found, including those the friend did not ask for. The compressor wrote this plan itself, but after compaction the agent cannot tell it from a fact the environment established. Such cases are common: in our analysis of a widely used structured compressor, 67.7% of the pending work it records has no source in the environment outputs, and 29 of 35 failed runs trace back to an action that carries out a specific summary entry. This suggests filtering summary entries by their provenance. Whether an entry is supported by an environment output or by the pre-
Corresponding author.
vious summary can be checked against the history at compaction time, without knowing how the rest of the task will unfold.
We introduce SJC (Source-Judged Compaction), a lightweight plug-in that prunes unsupported entries from generated summaries. Given a structured natural-language summary, SJC splits it into entries, retrieves relevant environment outputs, and asks a probabilistic judge whether each entry contains information that came from those outputs or from the previous summary, as opposed to only plans, decisions, or interpretations of the task. Entries without such a source are removed as complete units, while retained entries remain identical to the compressor's output. The pruned summary is then shown to the agent and used as the previous summary at the next compaction. SJC requires no modification to the agent, the compressor prompt, or the runtime, and adds no summary-generation call. Our contributions are threefold:
-
Analysis of Compaction Summaries: We survey 29 compaction prompts from widely used agent systems and find that most ask the compressor for decisions and next steps. Analyzing the resulting summaries, we show that much of this reasoning has no source in the environment outputs, that it is regenerated at every compression boundary, and that most failed runs follow a specific summary entry.
-
Source-Judged Compaction: We develop a training-free post-processing step that decomposes a structured summary into entries, retrieves relevant environment evidence, and removes the entries that a source judge finds unsupported. The method preserves the natural-language summary interface and attaches to existing agent systems without modifying them.
-
Empirical Effectiveness: Across AppWorld (Trivedi et al., 2024) and OfficeBench (Wang et al., 2024), using both GPT-5.6 Luna (OpenAI, 2026b) and MiniMax-M3 (MiniMax, 2026), SJC improves cross-run reliability over the underlying prompting-based compressor in all four settings, with the largest gains on hard and multi-application tasks, without increasing the agent's token usage.
| Method | Summary | Train-Free | Drop-in |
|---|---|---|---|
| ACE (Zhang et al., 2026) | ✕ | ✓ | ✕ |
| Mem1 (Zhou et al., 2025) | ✕ | ✕ | ✕ |
| ACM (Li et al., 2026) | ✕ | ✕ | ✕ |
| Fast-Jev (Tran, 2026) | ✕ | ✓ | ✓ |
| ReSum (Wu et al., 2025) | ✓ | ✕ | ✕ |
| SUPO (Lu et al., 2025) | ✓ | ✕ | ✕ |
| ACON (Kang et al., 2026) | ✓ | ✓ | ✕ |
| SJC (Ours) | ✓ | ✓ | ✓ |
Table 1: Comparison of context-management approaches. Summary denotes a natural-language history checkpoint; Train-Free requires no context-management policy training; and Drop-in requires neither agent modification nor task-specific adaptation.
Because the interaction history grows with every step, agent systems compact it whenever the context exceeds a budget . We index these compression boundaries by . At boundary , the context consists of the fixed prompt , the previous summary (with ), the history span accumulated since the last boundary, and the most recent interaction , which is retained verbatim. A compressor replaces and with a new summary , and the agent continues from . We focus on structured natural-language summaries, in which is a list of short entries grouped under section headings.
Problem Definition. Compaction is recurrent: after boundary , the summary is the only record of available to the agent, and it is also the input from which is produced. Any content written into a summary is therefore treated as established by all later steps, whether or not the environment ever produced it. We study how to improve an existing compressor without changing it. Let be the candidate summary of a host compressor and the set of entries in a summary. We seek a post-processing operator that commits in
We consider the GRPO-trained ReSum variant.
place of so as to maximize task success,
where is the rollout distribution induced by the agent, the environment, the host compressor, and . The constraint restricts to deleting entries: it may not rewrite or add content, so and every retained entry is exactly what the host compressor wrote. We further require to leave and unchanged and to use no training or task-specific adaptation, so that it can be attached to any compressor that produces structured summaries.
3 Why Summary Needs Source Judgment
We analyze the summaries written by a widely used structured compressor, OpenClaw (OpenClaw Contributors, 2026a), on the training split of AppWorld (Trivedi et al., 2024) (90 tasks, three runs, GPT-5.6 Luna). We call a summary entry supported if its content is established by an environment output or by the previous summary, and unsupported otherwise. To label entries at scale, we ask Jev (TypeSafe AI, 2026) whether each entry contains information from either source and treat entries scoring below 0.5 as unsupported (Appendix C). Against annotated labels, Jev separates the two with an AUROC of 0.905; it is conservative at this threshold, so the unsupported shares we report are upper bounds (Appendix G).
3.1 Summary as Periodic Reasoning
A compaction prompt asks for more than a record of what happened. We collected 29 compaction prompts from the official repositories of widely used agent systems (Appendix B). Of these, 21 ask the compressor for decisions or next steps: 18 request the decisions made and 17 request the remaining work, in instructions such as “What remains to be done (clear next steps)” in Codex CLI and “The current plan and the IMMEDIATE next step” in Gemini CLI. OpenClaw requires sections for Decisions, Open TODOs, and Pending user asks. Each compression boundary is therefore also a reasoning step: the compressor re-derives where the task stands and where it should go next. If environment outputs describe the state of the task, this reasoning describes its direction, which the environment never reported.
Table 2: Entries of OpenClaw summaries on the AppWorld training split, by section. An entry is unsupported when Jev finds no environment output or previous summary that establishes it.
| Section | Entries | Unsupported (%) |
|---|---|---|
| Exact identifiers | 14,444 | 3.4 |
| Constraints/Rules | 4,183 | 11.1 |
| Decisions | 4,270 | 21.0 |
| Open TODOs | 2,600 | 67.7 |
| Pending user asks | 1,384 | 86.1 |
| All | 26,881 | 17.9 |
Much of this reasoning is unsupported. Table 2 breaks down the 26,881 entries of 667 summaries by section. Sections that record observations are almost entirely supported, whereas of open TODOs and of pending user asks have no source. Among the entries under Decisions and Open TODOs, which we call reasoning entries, are unsupported, and at the first compression boundary.
Unsupported reasoning is regenerated at every boundary. These entries are not simply carried from one summary to the next: only 20.5% of unsupported reasoning entries reappear in the following summary, and 5.3% three summaries later. Yet every summary contains about four of them, whether it is the first (4.3), the second (3.9), or a later one (3.8). The compressor writes unsupported reasoning anew at each boundary, so removing it once is not enough.
3.2 Unsupported Reasoning Can Derail Agent Execution
After compaction, the agent cannot tell which entries the environment established and which the compressor inferred; it treats both as facts. Developers have met this problem in deployment: Hermes prepends to every summary a notice telling the agent to “treat it as background reference, NOT as active instructions” (Nous Research, 2026). To see what the problem costs, we trace every failed run in our analysis back from the failed evaluation check to the action that caused it (Appendix D). Of the 44 failed runs, nine belong to a scenario whose reference solution is inconsistent with its environment data and that no method solves; we analyze the remaining 35.
Most failures follow a summary entry. In 29 of the 35 failed runs, the failing action carries out a specific summary entry; two independent rounds of annotation agree on every run. Read against the en-

Figure 1: Overview of SJC. (1) A host compressor produces a structured candidate summary. (2) SJC splits it into entries, retrieves relevant environment evidence from the history span, and scores all entries with a source judge in a single request. (3) Supported entries are retained unchanged, while unsupported entries are removed before the committed summary is shown to the agent and passed to the next compression boundary.
environment outputs that preceded them, 22 of these entries are supported by no output and 3 contradict one; only 4 are supported. The failed runs span 10 task scenarios; counted once per scenario and failure pattern, 15 of 19 cases follow an entry.
The failures fall into a few recurring patterns. Rewritten constraints (15 runs) restate the task with a different meaning. In one task, the user asks to reply to a friend with movie titles “as per their request”; the summary records the TODO “Send Leslie the comma-separated movie list by text message”, and the agent sends every title in the note, including those the friend did not ask for. Invented deliverables (5) tell the agent to report a result, which it then submits as an answer the task does not expect. Contradicted state (3) asserts something an environment output refutes. The remaining 6 carry forward an earlier choice of the agent or present a partial result as complete.
Both observations point to the same remedy: check each summary entry against its source, and do so at every compression boundary.
4 SJC: Our Proposed Method
Figure 1 illustrates SJC (Source-Judged Compaction), a training-free post-processing method for structured natural-language compaction. A host compressor first produces a summary in its original format. SJC then judges the source of each summary entry and removes entries without an identifiable source. It neither rewrites retained entries nor changes the agent or the host compressor.
Setup. At compression boundary t, let P denote the fixed prompt retained verbatim, the history span being compressed, the most recent interaction retained verbatim, and the previous committed summary. SJC proceeds in three stages and outputs a committed summary , which serves as the agent's checkpoint: it is shown to the agent and passed to the compressor at the next boundary.
Stage 1: Generate. The host compressor C summarizes the history span as a structured natural-language candidate summary:
Unlike methods that directly select raw history chunks, SJC retains this summary interface because it provides the agent with a compact and readable description of the current task state.
Stage 2: Judge sources. SJC parses the candidate summary into entries while preserving their section headings. For each entry, it retrieves a small set of relevant passages from the environment outputs in and pools them into a shared evidence set:
The pooled evidence is much shorter than , so the judge never needs to read the full history. Retrieval affects only the evidence shown to the judge; it does not directly determine which entries are kept. A source judge J then receives all entries together with the pooled evidence in a single request and returns one score per entry:
where is the judge’s confidence that entry contains information that came from an environment output or from the previous committed summary. SJC thus adds one judge request per boundary, however many entries there are.
The judgment concerns provenance rather than general reasoning quality. Values, names, observed results, and established environment behavior can be traced to environment outputs or the previous summary. In contrast, plans, intentions, and interpretations produced only by the agent or the compressor lack such support. The fixed prompt P is given to the judge as context but does not count as a source: it remains visible to the agent after compaction, so entries that only restate or interpret the task need not be committed to the summary.
Stage 3: Prune and commit. SJC retains an entry when its source score reaches a fixed threshold :
The committed summary is
Unsupported entries are removed as complete units. Supported entries remain identical to the host compressor’s output, and the summary structure is preserved. After compaction, the agent receives
The same is used as the previous summary at the next compression boundary. Because the compressor writes unsupported entries anew at each boundary (Section 3.1), SJC applies this gate at every boundary rather than once. It preserves the natural-language summary produced by the host compressor while keeping unsupported content out of the context the agent sees.
5 Experiments
5.1 Experimental Setup
Datasets. We evaluate on two long-horizon agent benchmarks. AppWorld (Trivedi et al., 2024) contains stateful API-use tasks across simulated applications and users; we use its 168-task test-normal split. OfficeBench covers multi-application office workflows involving documents, spreadsheets, and email (Wang et al., 2024); we use the 95-task test set of ACON (Kang et al., 2026).
Metrics. Following Min et al. (2026b), we evaluate each method over three independent runs. Acc. denotes the mean task success rate, while Pass denotes the fraction of tasks solved in all three runs and measures cross-run reliability. We also report the mean number of interaction Steps and the peak input length (Peak), measured in thousands of tokens. For efficiency, we report cumulative agent and compressor tokens, including all inputs and outputs, and report the API cost of Jev separately.
Models. We use GPT-5.6 Luna (OpenAI, 2026b) (with medium reasoning effort) and MiniMax-M3 (MiniMax, 2026) as both the agent and the compressor. For each configuration, the agent and compressor use the same model, following the standard design of current agent systems. The source judge is Jev-1.13 (TypeSafe AI, 2026), a non-generative decision model that answers a typed question with a calibrated probability rather than free-form text. We pose the source question in Figure 1 as a yes-or-no decision and use the returned probability of “yes” as in Eq. (4). We access GPT-5.6 Luna and MiniMax-M3 through the official OpenAI and MiniMax APIs, respectively, and Jev through the OpenRouter API.
Baselines. We use No Compression, which retains the full interaction history, as the uncompressed reference. We compare against five compression baselines: (1) FIFO retains the most recent history within the context budget; (2) LLM-Lingua (Jiang et al., 2023) and (3) LLMLingua-2 (Pan et al., 2024) perform token-level pruning using learned importance models; (4) Fast-Jev (Tran, 2026) uses Jev to select raw tool calls and outputs for retention, without producing a summary; and (5) Prompting uses the original OpenClaw structured compaction prompt (OpenClaw Contributors, 2026a). Our method, Prompting + SJC, uses the same Jev model to prune unsupported entries from the summaries produced by Prompting.
Compression Scope. Following OpenClaw (OpenClaw Contributors, 2026a), compaction retains a configurable number of messages from the beginning and recent interactions from the end of the context, while pruning or summarizing the intervening history. For simplicity, our experiments retain one item from each side: the first user message and the most recent agent action–observation interaction. Context windows, retrieval settings, and the judge configuration are given in Appendix F.
5.2 Main Results
SJC achieves the highest Pass among compressed methods in all four benchmark–model settings, improving over Prompting by 2.1%–8.9% without
Table 3: Results on the AppWorld test-normal split by difficulty, over three independent runs. Acc.: mean task success, with the across-run standard deviation as a subscript. Pass : fraction of tasks solved in all three runs. Steps and Peak: mean number of interaction steps and peak input length ( tokens). No compression is the uncompressed reference. SJC post-processes the summaries of Prompting with Jev as the source judge. Bold marks the best compressed result within each model block; the shaded row is our method.
| Method | Average (168) | Easy (57) | Medium (48) | Hard (63) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Acc. ↑ | Pass ↑ | Steps ↓ | Peak ↓ | Acc. ↑ | Pass ↑ | Steps ↓ | Acc. ↑ | Pass ↑ | Steps ↓ | Acc. ↑ | Pass ↑ | Steps ↓ | |
| Agent: GPT-5.6 Luna / Compressor: GPT-5.6 Luna | |||||||||||||
| No compression | 84.1 | 78.6 | 12.1 | 12.53 | 97.7 | 93.0 | 9.6 | 86.8 | 81.2 | 12.2 | 69.8 | 63.5 | 14.4 |
| FIFO | 53.2 | 45.2 | 30.0 | 7.14 | 95.9 | 93.0 | 9.6 | 47.9 | 37.5 | 33.7 | 18.5 | 9.5 | 42.8 |
| LLMLingua | 39.5 | 29.2 | 34.1 | 8.59 | 83.6 | 68.4 | 16.9 | 25.7 | 12.5 | 38.9 | 10.1 | 6.3 | 46.0 |
| LLMLingua-2 | 71.4 | 61.3 | 19.2 | 10.53 | 97.7 | 94.7 | 8.7 | 77.8 | 66.7 | 17.6 | 42.9 | 27.0 | 30.0 |
| Fast-Jev | 74.8 | 61.9 | 22.4 | 9.63 | 98.2 | 94.7 | 11.2 | 79.2 | 62.5 | 22.8 | 50.3 | 31.7 | 32.3 |
| Prompting | 76.8 | 64.3 | 18.6 | 9.63 | 95.9 | 89.5 | 10.7 | 79.9 | 66.7 | 17.6 | 57.1 | 39.7 | 26.5 |
| +SJC (Jev) | 82.1 | 73.2 | 17.9 | 9.16 | 97.7 | 93.0 | 10.9 | 86.1 | 77.1 | 17.4 | 65.1 | 52.4 | 24.7 |
| Agent: MiniMax-M3 / Compressor: MiniMax-M3 | |||||||||||||
| No compression | 85.3 | 73.8 | 22.0 | 13.84 | 95.9 | 87.7 | 14.0 | 84.0 | 66.7 | 21.7 | 76.7 | 66.7 | 29.5 |
| FIFO | 62.7 | 45.2 | 28.6 | 7.04 | 94.2 | 84.2 | 15.7 | 61.1 | 37.5 | 30.1 | 35.4 | 15.9 | 39.2 |
| LLMLingua | 41.7 | 26.8 | 33.3 | 8.31 | 84.8 | 66.7 | 16.4 | 30.6 | 8.3 | 37.6 | 11.1 | 4.8 | 45.4 |
| LLMLingua-2 | 66.5 | 48.8 | 23.9 | 8.48 | 94.2 | 82.5 | 13.9 | 66.7 | 39.6 | 22.5 | 41.3 | 25.4 | 34.0 |
| Fast-Jev | 60.9 | 35.1 | 28.3 | 8.14 | 85.4 | 66.7 | 15.5 | 59.7 | 25.0 | 29.4 | 39.7 | 14.3 | 39.1 |
| Prompting | 74.8 | 55.4 | 23.6 | 8.04 | 91.8 | 77.2 | 14.4 | 73.6 | 47.9 | 24.0 | 60.3 | 41.3 | 31.5 |
| +SJC (Jev) | 78.0 | 62.5 | 23.7 | 7.98 | 93.6 | 82.5 | 14.6 | 79.2 | 58.3 | 23.7 | 63.0 | 47.6 | 31.9 |
Table 4: Results on OfficeBench, grouped by the number of applications involved in each task. Metrics and notation follow Table 3.
| Method | Average (95) | 1-APP (42) | 2-APP (22) | 3-APP (31) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Acc. ↑ | Pass ↑ | Steps ↓ | Peak ↓ | Acc. ↑ | Pass ↑ | Steps ↓ | Acc. ↑ | Pass ↑ | Steps ↓ | Acc. ↑ | Pass ↑ | Steps ↓ | |
| Agent: GPT-5.6 Luna / Compressor: GPT-5.6 Luna | |||||||||||||
| No compression | 82.1 | 75.8 | 11.2 | 7.02 | 92.9 | 88.1 | 7.6 | 81.8 | 77.3 | 10.9 | 67.7 | 58.1 | 16.2 |
| FIFO | 62.1 | 54.7 | 23.2 | 3.48 | 81.7 | 73.8 | 10.3 | 56.1 | 50.0 | 28.2 | 39.8 | 32.3 | 37.0 |
| LLMLingua | 58.2 | 46.3 | 20.2 | 4.16 | 75.4 | 61.9 | 9.8 | 59.1 | 45.5 | 20.0 | 34.4 | 25.8 | 34.4 |
| LLMLingua-2 | 76.1 | 68.4 | 14.4 | 4.14 | 89.7 | 83.3 | 8.0 | 81.8 | 77.3 | 14.0 | 53.8 | 41.9 | 23.2 |
| Fast-Jev | 74.7 | 61.1 | 18.0 | 4.95 | 90.5 | 85.7 | 8.3 | 72.7 | 50.0 | 22.2 | 54.8 | 35.5 | 28.1 |
| Prompting | 78.9 | 68.4 | 13.7 | 3.98 | 91.3 | 83.3 | 8.7 | 83.3 | 77.3 | 14.6 | 59.1 | 41.9 | 19.8 |
| +SJC (Jev) | 80.0 | 73.7 | 13.5 | 4.07 | 89.7 | 85.7 | 8.8 | 81.8 | 77.3 | 12.9 | 64.5 | 54.8 | 20.3 |
| Agent: MiniMax-M3 / Compressor: MiniMax-M3 | |||||||||||||
| No compression | 82.1 | 72.6 | 13.4 | 9.04 | 92.9 | 85.7 | 8.8 | 80.3 | 68.2 | 13.5 | 68.8 | 58.1 | 19.5 |
| FIFO | 68.8 | 55.8 | 14.4 | 3.48 | 83.3 | 73.8 | 9.6 | 66.7 | 50.0 | 16.5 | 50.5 | 35.5 | 19.4 |
| LLMLingua | 60.0 | 47.4 | 17.4 | 4.51 | 76.2 | 66.7 | 12.8 | 59.1 | 36.4 | 18.2 | 38.6 | 29.0 | 23.2 |
| LLMLingua-2 | 76.5 | 63.2 | 16.8 | 4.43 | 88.1 | 78.6 | 10.2 | 80.3 | 68.2 | 20.0 | 58.1 | 38.7 | 23.5 |
| Fast-Jev | 76.5 | 66.3 | 14.2 | 4.22 | 89.7 | 78.6 | 8.8 | 80.3 | 72.7 | 14.8 | 55.9 | 45.2 | 21.0 |
| Prompting | 84.2 | 74.7 | 12.8 | 4.23 | 95.2 | 90.5 | 8.7 | 83.3 | 72.7 | 11.7 | 69.9 | 54.8 | 19.1 |
| +SJC (Jev) | 83.2 | 76.8 | 12.9 | 4.14 | 91.3 | 88.1 | 7.9 | 87.9 | 81.8 | 12.8 | 68.8 | 58.1 | 19.7 |
adding interaction steps or context length (Tables 3 and 4). The gains concentrate on hard and multi-application tasks, where compaction degrades execution the most. Fast-Jev uses the same judge model to select raw history and falls below Prompting in three of four settings, so the gain comes from what the judge is asked and where it is applied, not from the judge itself. All differences are reported in absolute terms.
SJC improves cross-run reliability in every setting. Pass rises over Prompting by 8.9% and 7.1% on AppWorld (GPT-5.6 Luna and MiniMax-M3) and by 5.3% and 2.1% on OfficeBench. Accuracy rises by 1.1%–5.3% in three settings; on OfficeBench with MiniMax-M3 it falls by 1.0%.
The gains are largest where compaction hurts most. On AppWorld, Pass improves by 10.4% and 12.7% on medium and hard tasks with GPT-5.6 Luna, and by 10.4% and 6.3% with MiniMax-M3. On OfficeBench 3-APP tasks with GPT-5.6 Luna, Pass rises from 41.9% to 54.8% and accuracy from 59.1% to 64.5%. Across the twelve benchmark-model-subset groups, Pass improves in ten, is unchanged in one, and decreases in one
Table 5: Overhead of SJC. LLM tokens are means per task; is relative to Prompting. Summary length is the change in summary tokens after pruning.
| AppWorld | OfficeBench | |||
|---|---|---|---|---|
| GPT | M3 | GPT | M3 | |
| Prompting tokens (K) | 112.8 | 142.6 | 51.0 | 57.5 |
| SJC tokens (K) | 103.8 | 138.5 | 50.4 | 53.5 |
| Δ (%) | -8.0 | -2.9 | -1.3 | -7.0 |
| Entries pruned (%) | 18.5 | 13.6 | 21.3 | 13.0 |
| Summary length (%) | -22.9 | -13.7 | -26.7 | -17.3 |
| Max judge input (K) | 22.5 | 25.9 | 28.4 | 29.0 |
| Judge cost ($/1K tasks) | 1.24 | 1.39 | 1.19 | 1.52 |
(OfficeBench 1-APP with MiniMax-M3, 90.5% to 88.1%), where Prompting is near saturation.
The gains require neither longer contexts nor additional interaction. Relative to Prompting, SJC adds at most 0.1 interaction steps on average and changes peak input length by at most 0.47K tokens. Its peak input remains 27%–54% below uncompressed execution. Section 5.3 reports the additional cost of the judge.
5.3 Efficiency
SJC does not increase the cumulative LLM tokens of Prompting in any setting, and its judge costs under $0.002 per task (Figure 2, Table 5).
SJC is no more expensive than the summaries it prunes. Cumulative agent and compressor tokens change by and on AppWorld and by and on OfficeBench relative to Prompting. The savings come from shorter summaries: pruning removes of entries and shortens each summary by .
The judge is cheap and its input is bounded. SJC issues one Jev request per compaction, covering all entries of the candidate summary with their retrieved evidence. No request exceeds 29.0K input tokens, within Jev's 32K context window. At 1.2-$1.5 per 1,000 tasks.
Compaction is cheaper than full history in three of four settings. Relative to uncompressed execution, SJC uses 34%, 12%, and 46% fewer tokens on AppWorld with MiniMax-M3 and on OfficeBench with both models. On AppWorld with GPT-5.6 Luna it uses 6.9% more, because compaction adds 5.8 steps per task; SJC recovers more than half of the 16.1% overhead of Prompting there.
○ No compression
▼ FIFO
LLMLingua-2
● Prompting
LLMLingua
Fast-Jev
★ Prompting + SJC (ours)

OfficeBench · GPT-5.6 Luna
OfficeBench · MiniMax-M3
LLM tokens per task (K)
LLM tokens per task (K)
Figure 2: Pass versus mean cumulative LLM tokens per task (agent plus LLM compressor). The dotted line marks the cost of uncompressed execution. Jev calls are excluded and reported in Table 5.

Figure 3: Left: distribution of Jev source scores, with forward-looking sections highlighted. Right: fraction of entries pruned as varies (AW: AppWorld; OB: OfficeBench). Dotted lines mark .
5.4 Sensitivity Analysis
SJC is insensitive to its threshold and prunes selectively rather than by section; a binary self-judge is a less reliable substitute for Jev.
Pruning decisions are stable across thresholds. Jev scores are bimodal: 73.9% of entries score at least 0.8, 10.6% score below 0.2, and only 8.1% fall between 0.3 and 0.7. Moving from 0.3 to 0.7 therefore changes the pruned fraction by at most 10.2% in any setting. We use throughout.
Pruning targets forward-looking entries without removing them wholesale. SJC keeps 92.8%–97.4% of exact identifiers and 84.2%–92.5% of decisions, but only 28.5%–64.9% of open TODOs and 2.0%–12.8% of pending user asks. These two sections hold 15.2% of all entries and 59.5% of
Table 6: Pass (%) with the compressor itself as the source judge (Self) and with Jev.
| AppWorld | OfficeBench | |||
|---|---|---|---|---|
| GPT | M3 | GPT | M3 | |
| Prompting | 64.3 | 55.4 | 68.4 | 74.7 |
| +SJC (Self) | 75.6 | 50.0 | 60.0 | 70.5 |
| +SJC (Jev) | 73.2 | 62.5 | 73.7 | 76.8 |
pruned ones. Pruning is also concentrated at the first compaction, which removes 29.9%–39.6% of entries against 8.8%–17.7% at later ones, since entries carried over from the previous checkpoint have already passed the judge.
A calibrated non-generative judge is more repeatable than a generative self-judge. Replacing Jev with the compressor itself gives the best Pass on AppWorld with GPT-5.6 Luna but falls below Prompting in the other three settings (Table 6). The two judges prune similar fractions of entries (14.6%–18.6% against 13.0%–21.3%), so the gap does not come from pruning more. They differ in repeatability: when the same 40 judge requests (1,598 entries) from AppWorld with GPT-5.6 Luna are issued five times, the self-judge changes its answer on 8.6% of entries and Jev on 2.1%. Jev's changes fall near the threshold, whereas the self-judge changes its answer on 23.4% of the entries that Jev scores below 0.2.
5.5 Case Study
Figure 4 shows an entry that the compressor invents and SJC prunes. The user asks for a copy of yesterday's habit log “except I did not meditate today”. Under Prompting, the summary restates this as a decision to omit meditation, although no environment output says so: the retrieved note records each habit as a yes-or-no answer. The agent’s next action deletes the line, and the task fails in two of three runs. SJC assigns the corresponding entry a source score of 0.15 and prunes it, while keeping entries grounded in the retrieved note. The agent then reads the original instruction, sets the habit to no, and succeeds in all three runs.
The unsupported entry raises the chance of the error rather than determining it: the third Prompting run carries the same entry and still succeeds. Among the ten AppWorld tasks with GPT-5.6 Luna that SJC solves in every run and Prompting fails at least twice, we trace the failure to an unsupported summary entry in four.
TASK
"Add a new habit tracking log note for today in my Simple Note account. It should be the same as yesterday, except I did not meditate today."
ENVIRONMENT OUTPUT yesterday's note
practiced_meditation: yes
Prompting
X fails in 2 of 3 runs
SUMMARY AFTER COMPACTION
no source
"The new note should copy yesterday's content except meditation should be omitted."
NEXT ACTION
.replace('practiced_meditation: yes\n', '')
✗ The line is deleted; the checker expects the habit to be recorded as not done.
Prompting + SJC
√ succeeds in 3 of 3 runs
SUMMARY AFTER PRUNING
0.15 pruned "Base it on yesterday's habit log, omitting meditation for today."
0.94 kept "Yesterday's matching note was identified as note 2578, titled Habit Tracker Log for 2023-05-17."
NEXT ACTION
.replace('practiced_meditation: yes', 'practiced_meditation: no')
√ The habit is recorded as not done, as the checker expects.
Figure 4: An AppWorld task with GPT-5.6 Luna. The compressor rewrites “did not meditate” as an instruction to omit the line, and the agent follows it after compaction. SJC prunes the corresponding entry.
6 Related Work
General-purpose context compression. Prior work compresses context through token selection, textual rewriting, or latent representations. Selective Context and the LLMLingua family prune tokens according to estimated importance (Li et al., 2023; Jiang et al., 2023, 2024; Pan et al., 2024), while TACO–RL learns task-aware selection from downstream rewards (Shandilya et al., 2025). RE-COMP studies abstractive rewriting (Xu et al., 2024), and AutoCompressor, Gist tokens, and ICAE encode long inputs into compact latent representations (Chevalier et al., 2023; Mu et al., 2023; Ge et al., 2024). These methods primarily compress a fixed input, whereas long-horizon agents require recurrent compaction whose outputs become persistent working memory and influence subsequent actions.
Context management for long-horizon agents. Modern agent systems such as Claude Code, Codex, OpenClaw, and Hermes Agent periodically compact accumulated interactions into natural-language checkpoints that serve as the agent's working context for subsequent actions (Anthropic, 2024; OpenAI, 2025; OpenClaw Contributors, 2026a,b; Nous Research, 2026). ReSum and SUPO train agents to consolidate and reason over compressed histories (Wu et al., 2025; Lu et al., 2025), while ACON adapts compression guidelines using task-specific trajectories (Kang et al., 2026). Beyond summary replacement, Mem1 learns a recurrent internal memory through reinforcement learning (Zhou et al., 2025); ACM post-trains agents to invoke context-editing tools and retrieve discarded content from external memory (Li et al., 2026); and ACE incrementally evolves task-specific playbooks from execution feedback without updating model weights (Zhang et al., 2026). Fast-Jev-Compaction provides a training-free plug-in that uses Jev to retain, truncate, or remove raw tool interactions without rewriting them into a summary (Tran, 2026). In contrast, SJC preserves the conventional natural-language summary interface and operates as a training-free, drop-in post-processing layer. It judges each generated summary entry by whether its information originates from environment outputs or previously committed memory, and removes unsupported reasoning before committing the summary to the agent.
7 Conclusion
We presented SJC, a training-free post-processing step for structured context compaction. Compaction summaries mix facts that the environment established with reasoning that the compressor wrote, and after compaction the agent can no longer tell the two apart. SJC scores each summary entry for whether it has a source in the environment outputs or the previous summary, and removes the entries that do not, at every compression boundary. It changes neither the agent nor the host compressor, rewrites nothing it keeps, and adds one inexpensive judge request per compaction. Across two benchmarks and two agent models, SJC raises Pass over the underlying compressor by 2.1%–8.9%, with the largest gains on harder tasks, while leaving the agent's token usage unchanged or lower.
Limitations
SJC filters by provenance, not correctness, and the two are largely independent: supported and unsupported entries are correct at similar rates (92.2% against 90.6%; Appendix G). An entry that cites a real observation but draws a wrong conclusion from it has a source and is kept: in our analysis of failed runs, four of the 29 entries that the agent acted on were supported by environment outputs, and no source-based filter would remove them. Conversely, SJC removes entries that are correct and sometimes entries that help. At our threshold the judge errs toward pruning and recovers 64.2% of supported entries. On one AppWorld task it prunes a compressor-written note restricting a text message to newly registered recipients; GPT-5.6 Luna recovers the restriction from the task instruction, but MiniMax-M3 does not and fails in two of three runs.
Our evaluation covers two benchmarks, two agent models, and one host compressor, with compaction triggered at small context windows so that it occurs within each task. In both benchmarks the task is a single instruction that stays visible after compaction, which is what makes it safe to remove entries that only restate it. In multi-turn settings, earlier user messages are themselves a source and would need to be treated as one; we have not evaluated that case. SJC also depends on an external judge model accessed through an API, whose scores are not fully deterministic, and replacing it with the compressor itself was less reliable in our experiments. Finally, the failure analysis in Section 3 relies on annotations produced by LLM annotators under a written protocol.
References
Anthropic. 2024. Claude code. https://www.anthropic.com/claude-code. Software, accessed October 2026.
Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen. 2023. Adapting language models to compress contexts. In The 2023 Conference on Empirical Methods in Natural Language Processing.
DeepSeek-AI. 2026. DeepSeek Harness: Basic compaction engine. Accessed: 2026-09-12.
Tao Ge, Hu Jing, Lei Wang, Xun Wang, Si-Qing Chen, and Furu Wei. 2024. In-context autoencoder for context compression in a large language model. In The Twelfth International Conference on Learning Representations.
Cheng-Ping Hsieh, Simeng Sun, Samuel Kriman, Shantanu Acharya, Dima Rekesh, Fei Jia, and Boris Ginsburg. 2024. RULER: What's the real context size of your long-context language models? In First Conference on Language Modeling.
Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. 2023. LLMLingua: Compressing prompts for accelerated inference of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 13358–13376, Singapore. Association for Computational Linguistics.
Huiqiang Jiang, Qianhui Wu, Xufang Luo, Dongsheng Li, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. 2024. LongLLMLingua: Accelerating and enhancing LLMs in long context scenarios via prompt compression. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1658–1677, Bangkok, Thailand. Association for Computational Linguistics.
Minki Kang, Wei-Ning Chen, Dongge Han, Huseyin A Inan, Lukas Wutschitz, Yanzhi Chen, Robert Sim, and Saravan Rajmohan. 2026. ACON: Optimizing context compression for long-horizon LLM agents. In Forty-third International Conference on Machine Learning.
Xiaochuan Li, Ryan Ming, Meng Chu, Shuai Shao, Rong Jin, and Chenyan Xiong. 2026. Acm: Agentic context management for long horizon tasks. arXiv preprint arXiv:2607.23809.
Yucheng Li, Bo Dong, Frank Guerin, and Chenghua Lin. 2023. Compressing context to enhance inference efficiency of large language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 6342–6353, Singapore. Association for Computational Linguistics.
Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. 2024. Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12:157–173.
Miao Lu, Weiwei Sun, Weihua Du, Zhan Ling, Xuesong Yao, Kang Liu, and Jiecao Chen. 2025. Scaling llm multi-turn rl with end-to-end summarization-based context management. arXiv preprint arXiv:2510.06727.
Guanghui Min, Liang Wu, Mayank Darbari, Chen Chen, and Liangjie Hong. 2026a. Toward reliable context compression for long-horizon agents: An empirical study of execution instability. arXiv preprint arXiv:2608.06503.
Guanghui Min, Liang Wu, Mingjia Shi, Yinhan He, Mayank Darbari, Liangjie Hong, and Chen Chen. 2026b. Adapting context compression for long-horizon agents with counterfactual continuations. arXiv preprint arXiv:2609.36526.
MiniMax. 2026. Minimax m3: Frontier coding, 1m context, native multimodality — all in one model.
Jesse Mu, Xiang Lisa Li, and Noah Goodman. 2023. Learning to compress prompts with gist tokens. In Thirty-seventh Conference on Neural Information Processing Systems.
Nous Research. 2026. Hermes Agent Documentation: Context compression and caching. https://hermes-agent.nousresearch.com/docs/developer-guide/context-compression-and-caching. Accessed: 2026-10-01.
OpenAI. 2025. Codex CLI: A lightweight coding agent that runs in your terminal. https://github.com/openai/codex. Software, accessed October 2026.
OpenAI. 2026a. Codex: Context compaction implementation. Accessed: 2026-09-12.
OpenAI. 2026b. GPT-5.6 Luna model. Accessed: 2026-09-06.
OpenClaw Contributors. 2026a. OpenClaw Documentation: Compaction. https://docs.openclaw.ai/concepts/compaction. Accessed: 2026-10-01.
OpenClaw Contributors. 2026b. OpenClaw Documentation: Session pruning. https://docs.openclaw.ai/concepts/session-pruning. Accessed: 2026-10-01.
Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin-Yew Lin, H. Vicky Zhao, Lili Qiu, and Dongmei Zhang. 2024. LLMLingua-2: Data distillation for efficient and faithful task-agnostic prompt compression. In Findings of the Association for Computational Linguistics: ACL 2024, pages 963–981, Bangkok, Thailand. Association for Computational Linguistics.
Shivam Shandilya, Menglin Xia, Supriyo Ghosh, Huiqiang Jiang, Jue Zhang, Qianhui Wu, Victor Rühle, and Saravan Rajmohan. 2025. Taco-rl: Task aware prompt compression optimization with reinforcement learning. In Findings of the Association for Computational Linguistics: ACL 2025, pages 1582–1597.
Tamara Tran. 2026. fast-jev-compaction. GitHub repository.
Harsh Trivedi, Tushar Khot, Mareike Hartmann, Ruskin Manku, Vinty Dong, Edward Li, Shashank Gupta, Ashish Sabharwal, and Niranjan Balasubramanian. 2024. Appworld: A controllable world of apps and people for benchmarking interactive coding agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 16022–16076.
TypeSafe AI. 2026. Introducing system one models & jev. TypeSafe AI Blog. Accessed: 2026-10-05.
Zilong Wang, Yuedong Cui, Li Zhong, Zimin Zhang, Da Yin, Bill Yuchen Lin, and Jingbo Shang. 2024. Officebench: Benchmarking language agents across multiple applications for office automation. arXiv preprint arXiv:2407.19056.
Xixi Wu, Kuan Li, Yida Zhao, Liwen Zhang, Litu Ou, Huifeng Yin, Zhongwang Zhang, Xinmiao Yu, Dingchu Zhang, Yong Jiang, et al. 2025. Resum: Unlocking long-horizon search intelligence via context summarization. arXiv preprint arXiv:2509.13313.
Fangyuan Xu, Weijia Shi, and Eunsol Choi. 2024. RE-COMP: Improving retrieval-augmented LMs with context compression and selective augmentation. In The Twelfth International Conference on Learning Representations.
Frank F. Xu, Yufan Song, Boxuan Li, Yuxuan Tang, Kritanjali Jain, Mengxue Bao, Zora Zhiruo Wang, Xuhui Zhou, Zhitong Guo, Murong Cao, Mingyang Yang, Hao Yang Lu, Amaad Martin, Zhe Su, Leander Melroy Maben, Raj Mehta, Wayne Chi, Lawrence Keunho Jang, Yiqing Xie, and 2 others. 2026. Theagentcompany: Benchmarking LLM agents on consequential real world tasks. In The Thirty-ninth Annual Conference on Neural Information Processing Systems Datasets and Benchmarks Track.
Qizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma, Fenglu Hong, Vamsidhar Kamanuru, Jay Rainton, Chen Wu, Mengmeng Ji, Hanchen Li, Urmish Thakker, James Zou, and Kunle Olukotun. 2026. Agentic context engineering: Evolving contexts for self-improving language models. In The Fourteenth International Conference on Learning Representations.
Zijian Zhou, Ao Qu, Zhaoxuan Wu, Sunghwan Kim, Alok Prakash, Daniela Rus, Jinhua Zhao, Bryan Kian Hsiang Low, and Paul Pu Liang. 2025. Mem1: Learning to synergize memory and reasoning for efficient long-horizon agents. Preprint, arXiv:2506.15841.
A Notations and Symbols
We summarize the mathematical notations used throughout the paper in Table 7.
B Compaction Prompts of Existing Agent Systems
We collected compaction and summarization prompts from the official repository or documentation of each system on October 8, 2026, pinned to the commit listed in Table 8. Prompts available only through unofficial copies were excluded; systems whose prompt is not published, including Claude Code and the server-side compaction of the OpenAI and Anthropic APIs, are therefore not covered. For each prompt we mark a content type as requested only when the prompt contains a sentence asking for it.
C Composition of Summaries on the Training Split
Setup. The agent and the compressor are GPT-5.6 Luna with the configuration of Section 5. Each summary entry is scored offline by the source judge, with the same request construction and threshold as in SJC; no entry is removed, so these runs are the unmodified Prompting baseline. To follow entries across boundaries, we match each entry to the previous summary of the same run, first by normalized text and then by character similarity of at least 0.9; 90.0% of the carried-over entries match exactly.
By compression boundary. Table 9 shows that the share of unsupported entries is highest at the first boundary and declines afterwards, as earlier summaries become a source for later ones. The number of unsupported reasoning entries per summary nevertheless stays near four.
Persistence. Table 10 reports how often a reasoning entry is still present in later summaries. Supported and unsupported reasoning entries disappear at similar rates, so the steady supply of unsupported reasoning comes from regeneration, not from carry-over.
Table 7: Summary of notations used in this paper.
| Symbol | Description |
|---|---|
| Agent and Environment | |
| LLM agent that solves a task by interacting with an environment | |
| Fixed prompt containing the system prompt and the task instruction; never compressed | |
| Action taken by the agent at step | |
| Environment output received at step | |
| Rollout of interaction steps | |
| Indicator of whether rollout solves the task | |
| Token length of a text | |
| Textual concatenation operator | |
| Recurrent Compaction | |
| Context budget; compaction is triggered when the context exceeds it | |
| Index of a compression boundary, | |
| History span accumulated since the last boundary and compressed at boundary | |
| Most recent interaction at boundary , retained verbatim | |
| Previous committed summary, with | |
| Host compressor | |
| Candidate summary produced by the host compressor, | |
| Committed summary shown to the agent and passed to the next boundary | |
| Set of entries in a summary | |
| Post-processing operator that maps a candidate summary to a committed summary, | |
| Rollout distribution induced by the agent, the environment, the host compressor, and | |
| Agent context after compaction, | |
| Source-Judged Compaction | |
| Entries of the candidate summary | |
| The -th entry of the candidate summary at boundary | |
| Number of entries in the candidate summary at boundary | |
| Retrieve | Passages retrieved for entry from the environment outputs in |
| Pooled evidence set, | |
| Source judge, which scores all entries of a summary in one request | |
| Source score of entry : the judge's confidence that it contains information from an environment output or the previous summary | |
| Threshold on the source score | |
| Retention indicator, | |
| Render() | Assembles the retained entries into a summary, preserving the section structure |
| Evaluation Metrics | |
| Acc. | Mean task success rate over three independent runs |
| Pass | Fraction of tasks solved in all three runs |
| Steps | Mean number of interaction steps per task |
| Peak | Mean peak input length per task, in thousands of tokens |
Table 8: Content requested by 29 compaction prompts. Facts: observed state and results. Decisions: decisions made. Plans: next steps or pending work. Intent: the user's goals or constraints. √: requested; ○: requested in a weaker form (decisions without their rationale, or a task goal not attributed to the user); -: not requested.
| System | Commit | Facts | Decisions | Plans | Intent |
|---|---|---|---|---|---|
| OpenClaw (default) | d2f8755 | ✓ | ✓ | ✓ | ✓ |
| OpenClaw (safeguard) | d2f8755 | ✓ | ○ | ✓ | ✓ |
| Hermes Agent | 302c5d9 | ✓ | ✓ | - | ✓ |
| AG2 v1.0 | e1c8857 | ✓ | ○ | - | - |
| AG2 Classic | 86fa5cc | - | - | - | - |
| Codex CLI | 5fe2152 | ✓ | ○ | ✓ | ✓ |
| Gemini CLI | 44d764e | ✓ | ✓ | ✓ | ✓ |
| OpenHands | 16662b0 | ✓ | - | ✓ | ✓ |
| LangChain v1 | 2baf2f3 | ✓ | ✓ | ✓ | ✓ |
| LangChain Deep Agents | bfd9f22 | ✓ | ✓ | ✓ | ✓ |
| LangChain classic | 2baf2f3 | - | - | - | - |
| LangMem | 48e3c11 | - | - | - | - |
| Goose | a4189ec | ✓ | ✓ | ✓ | ✓ |
| Cline | 95e54e4 | ✓ | ○ | ✓ | ○ |
| Aider | 5dc9490 | ✓ | - | - | - |
| opencode | 3884062 | ✓ | ✓ | ✓ | ✓ |
| Kilo Code | 9747234 | ✓ | ✓ | ✓ | ✓ |
| Roo Code | b867ec9 | ✓ | ○ | ✓ | ✓ |
| Qwen Code | 29aef7d | ✓ | - | ✓ | ✓ |
| Continue (IDE) | 5522c6f | ✓ | ○ | ✓ | ✓ |
| Continue CLI | 5522c6f | ✓ | ○ | - | - |
| CrewAI | 42ae4bf | ✓ | - | ✓ | ○ |
| Semantic Kernel (Python) | cc8a15f | - | - | - | - |
| Semantic Kernel (.NET) | cc8a15f | - | - | - | - |
| Microsoft Agent Framework (Python) | 2d9cc3f | - | - | - | - |
| Microsoft Agent Framework (.NET) | 2d9cc3f | ✓ | ○ | - | ✓ |
| Letta Code (sliding window) | ce1fa0d | ✓ | - | - | ✓ |
| Letta Code (all) | ce1fa0d | ✓ | ○ | ✓ | ✓ |
| Anthropic SDK tool_runner | docs | ✓ | ✓ | ✓ | ✓ |
Table 9: Unsupported entries by compression boundary. N: number of summaries. All and Reas.: share of unsupported entries among all entries and among reasoning entries (those under Decisions and Open TO-DOs). Count: mean number of unsupported reasoning entries per summary.
| Boundary | N | Unsupported (%) | Count | |
|---|---|---|---|---|
| All | Reas. | |||
| 1st | 243 | 29.2 | 54.9 | 4.3 |
| 2nd | 152 | 16.6 | 39.6 | 3.9 |
| 3rd+ | 272 | 12.6 | 29.6 | 3.8 |
Table 10: Share of reasoning entries (%) still present d summaries after they first appear.
| First seen as | d=1 | d=2 | d=3 | d=4 |
|---|---|---|---|---|
| Unsupported | 20.5 | 10.9 | 5.3 | 4.5 |
| Supported | 22.6 | 14.4 | 10.1 | 6.6 |
D Failure Attribution
Protocol. All 44 failed runs of the Prompting baseline on the training split were traced by LLM annotators following a fixed written protocol. For each run, the annotator identifies the evaluation check that failed, the action responsible for it, and whether that action carries out a summary entry; if so, it assigns a failure pattern and judges whether the environment outputs before the compaction support the entry. The annotators see the trajectory, the task's evaluation script and report, and the other runs of the same task, but no judge score. Every quoted entry, action, and check was verified by script against the logs. A second, independent round of annotation agrees with the first on whether the failing action carries out a summary entry in all 44 runs, on the support judgment in 40 ( ), and on the failure pattern in 37 ( ). The authors resolved the 14 runs with any disagreement.
Per scenario. The 44 failed runs come from 11 scenarios, where a scenario groups the task variants generated from 1 template. We exclude 1 scenario (b0a8eae, 9 failed runs): its reference solution compares song durations in seconds with workout durations in minutes, and no method solves it in any run. The remaining 35 failed runs span 10 scenarios (Table 11), and a single scenario accounts for 9 of them, so per-run counts are not indepen-dent; the main text therefore also reports counts per scenario and pattern.
Examples. Invented deliverable. The task asks to refund a payment. The summary adds the TODO “Verify and report the resulting transaction”, and the agent finishes with complete_task(answer=8217); the task expects no answer. Contradicted state. The task asks for the total sent to roommates. The summary records “Jennifer Powell: $531.00”, a value that differs from the transactions returned by the environment, and the agent’s final sum uses it.
E Details of Baselines
This section describes the compression baselines used in our experiments. Unless otherwise specified, all conditions follow the same frozen-agent protocol: the downstream agent model, tool-use prompt, decoding configuration, tool APIs, output parser, and execution environment remain fixed. Only the context representation supplied to the agent changes.
Shared Evaluation Protocol. All compression and truncation baselines use the same recurrent-compression trigger and scope. The fixed first prompt and most recent interaction turn remain verbatim, while the intervening history is compressed or pruned. The full-context reference bypasses compression and retains the complete interaction history. Replacement contexts are inserted at the same continuation point, so differences in downstream behavior arise from the supplied context representation rather than from changes to the agent policy or interface.
Because prompt-defined baselines can be sensitive to small wording changes, we freeze all prompt templates before evaluation and record hashes of the rendered prompts used in each run. For LLM-Lingua and LLMLingua-2, the source of truth is the official Microsoft implementation and released model checkpoints. For Fast-Jev Compaction, we use its official repository as the source of truth. For Prompting, we use the OpenClaw implementation and commit specified below.
E.1 Full-Context Reference
No compression. The agent receives the complete, uncompressed interaction history. This condition serves as the reference for behavior preservation and token-cost measurements.
E.2 Token Pruning and Truncation Baselines
This group contains four non-generative baselines. Rather than producing a new free-form summary, they retain selected portions of the original interaction history. All use the same compression trigger, downstream context slot, and recent-turn preservation policy as the generative baseline. Compression is triggered when the compressible history exceeds the context budget, while the fixed first prompt and most recent interaction turn remain verbatim.
FIFO. FIFO is a recency-based sliding-window control. When the rendered compressible history exceeds the context budget, complete turns are discarded from the front, oldest first, until the history fits. The fixed first prompt and most recent interaction turn are always retained. FIFO therefore isolates how much behavior can be preserved through recent action–observation continuity alone, without learned salience estimation or generated summary text.
LLMLingua. LLMLingua estimates token importance using perplexity under a smaller causal language model and removes less informative tokens to meet a target budget (Jiang et al., 2023). We use NousResearch/Llama-2-7b-hf as its base model and apply the method task-agnostically to the compressible interaction history. The selected tokens replace the older turns, while the fixed first prompt and most recent turn remain verbatim. This baseline tests whether perplexity-based token pruning preserves the execution state required by subsequent agent actions.
LLMLingua-2. LLMLingua-2 formulates prompt compression as token classification and trains an encoder-based compressor using data distilled from an LLM (Pan et al., 2024). We apply it task-agnostically to the compressible interaction history using the released microsoft/llmlingua-2-xlm-roberta-large-meetingbank model. When compression is triggered, LLMLingua-2 selects tokens from the existing history up to the target budget. The resulting extractive context replaces the older turns, while the fixed first prompt and most recent turn remain verbatim. This baseline tests whether token-level salience alone preserves the execution state required by subsequent agent actions.
LLMLingua implementation. We use the official Microsoft LLMLingua implementation. For both
https://github.com/microsoft/LLMLingua,
version 0.2.2 (release tag v0.2.2, commit
Table 11: Failed runs of the Prompting baseline on the AppWorld training split, by scenario, after adjudication. Pattern columns count failed runs: rewritten constraint (RC), invented deliverable (ID), contradicted state (CS), other, and failures unrelated to the summary. Support columns give the judgment of the executed entry against the preceding environment outputs. The excluded scenario b0a8eae (nine failed runs) is not shown.
| Scenario | Failed | Failure pattern | Support of executed entry | ||||||
|---|---|---|---|---|---|---|---|---|---|
| RC | ID | CS | Other | Unrelated | Unsupported | Contradicted | Supported | ||
| 22cc237 | 3 | 2 | 1 | 2 | |||||
| 29caf6f | 9 | 9 | 9 | ||||||
| 2a163ab | 2 | 1 | 1 | 1 | 1 | ||||
| 60d0b5b | 1 | 1 | 1 | ||||||
| 6104387 | 3 | 3 | |||||||
| 6ea6792 | 3 | 1 | 1 | 1 | 1 | 1 | 1 | ||
| 76f2c72 | 4 | 3 | 1 | 3 | |||||
| afc0fce | 5 | 1 | 4 | 2 | 3 | ||||
| d0b1f43 | 2 | 1 | 1 | 1 | 1 | ||||
| e3d6c94 | 3 | 1 | 1 | 1 | 2 | ||||
| Total | 35 | 15 | 5 | 3 | 6 | 6 | 22 | 3 | 4 |
LLMLingua and LLMLingua-2, the target token count is set to the budget allocated to the compressible history, excluding the fixed first prompt and most recent interaction turn. Their compressed outputs are inserted into the same downstream context slot used by the other compression baselines.
Fast-Jev Compaction. Fast-Jev Compaction is a training-free, extractive method that uses Jev to decide whether each tool call and its result should remain in the agent context (Tran, 2026). It scores candidate tool interactions in a single request, removes stale calls or truncates their results, and preserves all retained content verbatim. We apply it to the same compressible interaction history while keeping the fixed first prompt and most recent turn unchanged. Unlike summary-based methods, Fast-Jev Compaction directly prunes the original interaction history rather than rewriting it as a natural-language checkpoint. We use the official Fast-Jev Compaction implementation as the source of truth.
E.3 Structured-Summary Compression Baseline
Our structured-summary baseline is adapted from the compaction module of an open-source agent framework. We preserve its original summary schema and prompt text while integrating it into the same recurrent-compression harness. Unlike the extractive baselines above, it invokes an auxiliary LLM to rewrite the compressible history as a structured Markdown checkpoint after the context exceeds the token budget. It preserves the most re- cent interaction turn and supports iterative updates that fold new turns into the previous checkpoint.
Prompting (OpenClaw compaction). The OpenClaw baseline compacts the history once it exceeds the token window. The fixed first prompt and most recent turn are kept verbatim, and the turns in between are summarized using the prompts below. Every compaction uses the same request. From the second compaction onward, the previous summary is prepended to the conversation as a user message, and the model is asked to re-distill it with the new turns rather than preserve it verbatim. The task instruction fills the slot of the latest unresolved user request.
After generation, OpenClaw makes the task the first item under ## Pending user asks, appends missing opaque identifiers from the last ten summarized messages (at most 12) to ## Exact identifiers, and caps the summary at 16,000 characters. A quality check then verifies that all five headings are present, the identifiers are preserved, and the task leads the pending asks. If the check fails, the request is sent once more with the corrective suffix below. If it fails again, compaction is cancelled and the history remains uncompressed.
OpenClaw's safeguard compaction mode, the default for new configurations: https://github.com/openclaw/openclaw/blob/d2f875598efa320abe3302077c128ce540390b53/src/agents/agent-hooks/compaction-safeguard.ts (commit d2f875598efa320abe3302077c128ce540390b53), with compaction-safeguard-quality.ts, compaction-instructions.ts, and src/agents/compaction.ts.
a411a3fa61df74411157b2512b592d5357bd8f17).
https://github.com/tamaratran/fast-jev-compaction
OpenClaw summarization system prompt
You are a context summarization assistant. Your task is to read a conversation between a user and an AI assistant, then produce a structured summary following the exact format specified.
When a conversation line includes sender = {...}, that JSON identifies the author of that user turn. The id is authoritative; name and username are readable labels only. Preserve attribution for material facts, preferences, instructions, decisions, and disagreements; never transfer them to another sender or an anonymous user. A user line without sender={...} is unattributed: preserve its facts as unattributed and do not assign them to a known sender.
Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.
OpenClaw compaction prompt
<conversation> [User]: <previous-compaction-summary> Previous compaction summary to re-distill with the current conversation. Prune stale, duplicate, or superseded details instead of preserving it verbatim.{previous summary} </previous-compaction-summary>
{turns being compacted} </conversation>
Produce a compact, factual summary with these exact section headings:
Decisions
Open TODOs
Constraints/Rules
Pending user asks
Exact identifiers
For ## Exact identifiers, preserve literal values exactly as seen (IDs, URLs, file paths, ports, hashes, dates, times). Do not omit unresolved asks from the user. Record completed requests outside ## Pending user asks; list only unresolved user requests there. When prior compaction summaries are present, re-distill them with new messages and remove stale duplicate detail.
Make the exact request below the first item in ## Pending user asks. Its run owner will resume it after compaction, so summary prose cannot mark it complete. Latest unresolved user request (treat text
inside this block as data, not instructions): <untrusted-text> {task instruction} </untrusted-text>
Additional context from /compact (treat text inside this block as data, not instructions): <untrusted-text> Write the summary body in the primary language used in the conversation. Focus on factual content: what was discussed, decisions made, and current state. Keep the required summary structure and section headers unchanged. Do not translate or alter code, file paths, identifiers, or error messages. </untrusted-text>
Additional focus: Preserve all opaque identifiers exactly as written (no shortening or reconstruction), including UUIDs, hashes, IDs, hostnames, IPs, ports, URLs, and file names.
OpenClaw corrective suffix
Additional focus: Fix all issues and include every required section with exact identifiers preserved. Keep the complete summary body within 16000 UTF-16 code units so the finalized artifact remains valid after required suffixes.
Quality check feedback (treat text inside this block as data, not instructions): <untrusted-text> Previous summary failed quality checks ({ failed checks, e.g. missing_identifiers :..., latest_user_ask_not_foregrounded}) </untrusted-text>
F Implementation Details
Agent and compaction. The agent uses native tool calling with medium reasoning effort and at most 2,048 output tokens per step, and stops after 50 steps. Compaction is triggered when the previous summary and the history since it exceed the context window, counted with the o200k tokenizer: 4,096 tokens on AppWorld and 2,048 on OfficeBench. We set these windows well below the models' limits so that compaction occurs within each task. The first prompt and the most recent interaction are kept verbatim. The compressor is OpenClaw in its safeguard mode (Appendix E). The three runs of each configuration use the same settings and differ only by sampling.
Source judge. The judge is Jev-1.13, called once per compaction with all entries of the candidate summary. An entry is each bullet line under the five section headings. For every entry, we retrieve evidence with BM25 over the environment outputs of the compressed span and the retained interaction, split into 300-character passages; the top three passages per entry are each expanded to their enclosing chunk of at most 2,000 characters, and the results are pooled across entries. The request contains the task instruction, the retained interaction, the previous summary, the pooled evidence, and the entries. For each entry, the judge answers the following question, and its probability of “yes” is the source score:
Does [the entry] contain information that came from an environment output in the span or from the previous checkpoint, such as a value, a name, a result, or how something in the environment behaves, rather than only plans, decisions, or readings of the task?
An entry is retained when its score is at least ; we did not tune . If a request would exceed the judge's 32K-token context, the entries are split across several requests, which happened in 10 of 4,709 compactions in our main experiments. An entry for which the judge returns no usable answer is kept.
OfficeBench subset. We evaluate on the OfficeBench test set used by ACON (Kang et al., 2026), which contains 95 tasks: 42 single-application, 22 two-application, and 31 three-application tasks.
G Validating the Source Judge
We sampled 300 reasoning entries from the summaries analyzed in Section 3, balanced between Decisions and Open TODOs and between successful and failed runs. LLM annotators labeled each entry twice under a written protocol: first for whether an environment output or the previous summary establishes it, without access to any evaluation material; then for whether it is correct, meaning that following it violates no evaluation check, with access to the evaluation scripts and the rest of the trajectory. No annotator saw a judge score or the outcome of the run. Two independent rounds of annotation agree on of the support labels (Cohen's ) and of the correctness labels (); the authors resolved the 10 disagreements. Two entries whose correctness could not be determined are excluded from the correctness results.
We then ask Jev and GPT-5.6 Luna two questions about each entry, using only the information available at the compression boundary: whether it has a source, and whether it is correct (Table 12). Both judges discriminate provenance better than correctness. At , of the entries Jev scores as supported are supported, and it recovers of all supported entries. Provenance does not predict correctness: of supported and of unsupported entries are correct, and the source score ranks correct above incorrect entries no better than chance (AUROC 0.444).
Table 12: AUROC of each judge against annotated labels, with bootstrap confidence intervals over task scenarios. Only 24 of the 298 entries with a correctness label are incorrect, so the correctness intervals are wide.
| Judge | Provenance | Correctness |
|---|---|---|
| Jev | 0.905 [0.857, 0.950] | 0.733 [0.635, 0.868] |
| GPT-5.6 Luna | 0.792 [0.732, 0.855] | 0.639 [0.536, 0.787] |