ReCompact: Learning to Act and Compact from Graph-Guided Trajectory Supervision
Anonymous authors
ICLR 2027
TL;DR. ReCompact uses trajectory dependency graphs to derive step-weighted supervision and teach coding agents to compact their histories and continue execution after context resets.
Abstract. Long-horizon software agents compress interaction histories to operate within a finite context window. However, a mistaken edit is a poor imitation target, even though it remains part of the working tree after a history reset. We introduce ReCompact, which separates action weighting from state retention through graph-guided trajectory supervision. A supervised neural graph module assigns contribution labels to weight action targets and prioritize key and supporting information in compact training targets and online compaction. Two complementary training views jointly supervise compact generation and continuation after a history reset. Remarkably, on the same 500 SWE-bench Verified tasks, ReCompact resolves 49.8% of tasks, substantially outperforming standard supervised fine-tuning (29.0%), step-aware training (43.4%), and compact-only training (39.4%). While achieving a 62.4% median input reduction, comparable to the 61.2% reduction of compact-only baselines, ReCompact nearly halves repetitions of previously failed commands, reducing them from 7.64 to 4.01 per 100 post-compaction tool actions. Ablations further confirm the importance of each component: disabling online compaction and reset reduces task resolution by 5.8 percentage points, while removing continuation training or retention-label guidance causes drops of 4.6 and 3.4 percentage points, respectively. ReCompact is also more inference-efficient, using 10.1% fewer total inference tokens per task than compact-only alternatives.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
ICLR 2027
Under review · 3 reviews · OpenReview
Updated 24 Nov 2026, 16:43 UTC.
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
Strengths
The distinction between action imitation and state retention is useful and well motivated. An unsuccessful edit can be a poor imitation target while remaining essential context because its effects persist after a history reset. Explicitly addressing this distinction provides a meaningful perspective on agent context management.
The controlled component study and targeted ablations examine both task outcomes and execution behavior. In particular, evaluating continuation training, retention guidance, context exhaustion, and repeated failed commands provides more informative evidence than resolution alone.
Weaknesses
The central graph-guided supervision pipeline is insufficiently specified. Section 3.1 introduces a supervised neural graph module without describing its architecture, graph construction procedure, annotation source, training objective, or predictive performance. The paper also does not sufficiently explain how prefix-only online labels are obtained when offline action weighting uses trajectory hindsight. The origins of the training trajectories and compact targets are unclear. These omissions prevent reproduction and make it difficult to assess whether graph structure, rather than generic importance labeling or target construction, accounts for the gains.
Important experimental comparisons remain difficult to interpret. Table 2 does not sufficiently document the external baselines’ checkpoints, training data, adaptation procedures, and evaluation budgets. The discrepancy between the webpage and PDF resolution rates materially changes the comparison with the strongest baselines. Furthermore, the no-continuation ablation does not explain whether suffix actions retain supervision under their original histories; otherwise, its performance drop could reflect reduced action supervision rather than the absence of compact-conditioned training. These issues limit the strength of the empirical conclusions.
Questions for the authors
Which full-model resolution is correct: 49.8% in the submission-page abstract or 54.8% in the PDF? Please reconcile the associated ablation drops and baseline comparisons.
Please specify the graph module’s architecture, node and edge construction, supervision source, training procedure, and labeling performance. How are online prefix-only labels produced, and what evidence demonstrates the benefit of dependency edges over a graph-free label predictor?
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 3/3
- Informativeness
- 2/3
Read review
Summary
This paper proposes ReCompact, a graph-guided trajectory supervision framework for training long-horizon software agents to perform actions and manage their context through compaction. The central idea is to distinguish between actions that should be imitated during training and information that should be preserved for future execution. A supervised neural graph module assigns contribution labels to trajectory steps, which are used to weight action supervision and guide the construction of compact memory states. The method further introduces two training views: one for generating compact states from interaction histories and another for continuing task execution after the history has been replaced by the compact. At inference time, the agent generates a compact representation and continues execution while preserving the underlying repository and runtime state.
Strengths
S1. I think the motivation is convincing. In long-horizon software engineering tasks, actions that should not be imitated can still produce important changes to the environment that need to be preserved after context compaction. The proposed separation between action weighting and state retention addresses this issue in a reasonable way. I also appreciate the two-view training design, which explicitly teaches the model to generate compact states and continue execution from them. This is a practically relevant direction for improving long-horizon agents under limited context windows.
s2. The paper demonstrates substantial improvements over the standard SFT baseline and the two individual component baselines on SWE-bench Verified. The 2×2 experimental design is useful for distinguishing the effects of step-aware training and compaction. I also appreciate the targeted ablations, which show that removing continuation training or retention-label guidance reduces task resolution by 9.6 and 8.4 percentage points, respectively. The additional analysis of repeated failed commands and inference-token consumption provides useful evidence beyond final task success.
Weaknesses
My main concern is that the graph-guided supervision mechanism, which appears to be a central contribution of the paper, is not described in sufficient detail. Section 3.1 introduces a supervised neural graph module that assigns key, supporting, and redundant labels to trajectory actions. However, I could not find a sufficiently detailed explanation of how the graph structures and contribution annotations are constructed, how the neural module is trained, or how its prediction quality is evaluated. It is also unclear how the supervision labels and compact targets are generated from raw trajectories and how the online module operates using only the available prefix information. These details are important because the reported improvements depend substantially on the quality of the contribution labels. Although the ablation results support the usefulness of label-guided supervision, they do not establish whether the neural graph mechanism provides advantages over simpler alternatives, such as heuristic contribution scoring or LLM-based importance labeling.
Questions for the authors
Q1. Could the authors provide more details about the supervised neural graph module, particularly the graph construction process, the source of contribution-label annotations, the model architecture, and the training objective? How accurately does the module predict key, supporting, and redundant actions? Additionally, would a heuristic or LLM-based contribution-labeling baseline achieve similar improvements under the same training setup?
Q2. I would appreciate clarification of whether the external baselines, especially SWE-MeM-RL, use comparable base models, training data, and inference budgets. This seems important given the relatively small difference between the two strongest methods.
Q3. I noticed that Appendix B reports a median training compact length of 732 tokens, while the online compacts in Table 7 have a median length of approximately 2,200 tokens. Could the authors explain this difference and whether it affects the alignment between compact-generation training and actual inference-time compaction? A discussion of how compact boundaries are selected during training and inference would also be helpful.
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 3/3
- Presentation
- 3/3
- Informativeness
- 2/3
Read review
Summary
The paper addresses context management for long-horizon software agents by separating "actions worth imitating" from "execution states that must be retained." It uses graph-contribution labels to weight action supervision and guide compaction, and jointly trains compaction generation and post-reset continuation. For the 4B model on 500 SWE-bench Verified tasks, the paper reports a 54.8% resolution rate.
Input text to the LLM " explain this paper to me".
Strengths
- The motivation is reasonable: although erroneous edits should not be imitated, they have already changed the workspace. Retaining their state rather than simply deleting them helps avoid losing the basis for execution after compaction.
- The controls and ablations are relatively thorough: the four groups share trajectories and the number of optimization steps. Removing continuation, retention labels, and online resets reduces performance by 9.6, 8.4, and 10.8 percentage points, respectively.
Weaknesses
- The core graph module is difficult to reproduce. Section 3.1 describes only the nodes, relations, and three-level labels, without specifying the network architecture, features, annotation procedure, or label quality. Operational details are also missing for compaction-target generation and boundary selection.
- Data auditability is insufficient: Section 4.1 and Table 4 report 4,617/392 training/development trajectories, but do not explain their provenance, generation and filtering, or how they are kept separate from Verified.
- The evidence for superiority over external systems is relatively weak: Table 2 shows only 4 more tasks solved than SWE-MeM-RL. The main text specifies matched settings only for the four groups of internal experiments and does not adequately describe the base models, training, and budget configurations of the systems in Table 2.
Questions for the authors
1.Could the authors provide a reproducible description of the graph predictor and label construction, and explain how offline hindsight labels are converted into online labels that depend only on the prefix? 2. Could the authors clarify the provenance of the trajectories, their separation from evaluation data, and the alignment of configurations in Table 2, and use per-task results or task-level intervals to establish the reliability of the small advantage?
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
ReCompact studies history compaction for long-horizon coding agents, distinguishing an action’s value as an imitation target from the need to retain its consequences in the persistent workspace. A supervised graph module predicts contribution labels that weight action-level SFT and guide information retention. Two training views supervise compact generation from a trajectory prefix and continuation conditioned on the resulting compact. The paper evaluates the approach on SWE-bench Verified using a four-condition component study, targeted ablations, and measurements of post-reset repetition and inference cost. However, the reported full-model resolution differs between the submission-page abstract (49.8%) and the PDF (54.8%) and requires clarification.