Coding agents solve repository issues through long sequences of exploration, editing, and validation. These trajectories are increasingly used as post-training data, so how they are collected shapes what the trained model learns. A common approach is to sample multiple trajectories independently for each issue and then select or curate them. However, as more trajectories are sampled independently, later trajectories become increasingly redundant, even though earlier trajectories could guide where subsequent collection effort should be spent. A natural way to use this history is to expose it to the coding agent as advice. But training on such trajectories can make the model rely on advice that is unavailable at test time, creating a train-test mismatch. Instead, we argue that history should guide where collection effort is spent, while the coding agent decides what to generate. We introduce SWE-Trail, a trajectory collector that uses earlier trajectories to guide subsequent collection while keeping that history outside the coding agent's context. During a new rollout, SWE-Trail uses history to identify a state where additional collection effort may be useful. There, the coding agent proposes candidate next actions from its ordinary context, and SWE-Trail briefly executes them from the same checkpoint to decide which route continues. We evaluate collection approaches by training student models on the trajectories they produce. For a 124B student initialized from Ling-3.0-flash-base, SWE-Trail improves mean resolution over independent sampling by 2.33 and 1.60 percentage points on SWE-bench Multilingual and SWE-bench Pro, respectively. Without history, the same pipeline produces more resolved trajectories than independent sampling, but improves by only 0.11 points on Multilingual. These results show the value of using history to guide collection without exposing it to the coding agent.
Figures & tables
Figure 1: Diminishing coverage gains from independent rollouts. A: expected number of issues solved with k attempts per issue. Gray labels show marginal additions. B: mean coverage of each issue’s five-attempt patch-target union, grouped by SeedBank outcomes. Both panels average over all k -attempt subsets of the five recorded attempts. The vertical axis in B starts at 65%.
Figure 2: SWE-Trail in two stages. Offline, the compiler reads the issue history, runs bounded read-only repository checks, and freezes an acquisition record Ri containing a detector Di , a comparison objective ui , and a sampling schedule λi . Online, when Di identifies a state for additional collection effort, the coding agent proposes candidate next actions from its ordinary context. SWE-Trail briefly executes two candidates from the same checkpoint, and an identity-blind selector retains the route better supported by repository evidence under ui . The coding agent then continues from the selected route. History never enters the coding agent’s context.
Multilingual
SWE-Pro
Coding-trajectory condition
Mean
Range
Mean
Range
SeedBank independent rollouts
63.33
[63.00, 63.67]
41.22
[41.18, 41.31]
SWE-Gym ( Pan et al., 2025 ) , outcome-conditioned transform
64.00
(+0.67)
[63.33, 65.00]
40.86
(−0.36)
[40.36, 41.59]
SWE-TRACE ( Han et al., 2026 ) , critical-path reduction
64.44
(+1.11)
[63.33, 65.33]
40.77
(−0.46)
[40.08, 41.72]
SWE-Lego ( Tao et al., 2026 ) , strict tool-error masking
64.56
(+1.22)
[63.00, 66.00]
41.63
(+0.41)
[39.81, 42.95]
SWE-Exp ( Chen et al., 2025 ) , agent-visible experience
62.00
(−1.33)
[61.00, 63.00]
38.44
(−2.78)
[38.30, 38.58]
Table 1: H5 improves downstream resolution on both benchmarks. Mean resolution over three independent training runs. Changes are relative to SeedBank, and ranges show the lowest and highest result. Rows named after prior work use the same SeedBank attempts as controlled adaptations. Table 13 defines all conditions.
Acquisition
Recorded compute
Student utility
Condition
Hist.
Res.
Issues
Acq.-only
Total
Multi.
Pro
SWE-Trail-H0
0
329
92
164M †
≥ 1.845B †
63.44
41.95
SWE-Trail-H5 (main)
5
345 (+16)
98 (+6)
307M (+143M † )
1.914B (+69M † )
65.67 (+2.22)
42.82 (+0.87)
SWE-Trail-H10
10
341 (+12)
94 (+2)
510M (+346M † )
2.160B (+315M † )
65.89 (+2.44)
42.95 (+1.00)
Table 2: H10 costs 12.9% more recorded tokens than H5 for a 0.22/0.14 point gain. Differences are relative to H0. Acquisition-only tokens exclude the ordinary rollout and total tokens include it. † : H0 omits offline compiler calls, so its compute is a lower bound and the differences are upper bounds.
Dataset
Multilingual
SWE-Pro
SeedBank
63.33
41.22
Top-5-of-10
64.11
41.86
SWE-Trail-H5
65.67
42.82
Top-5-hybrid
66.22
43.14
Table 3: Mean resolution (%) across three independently trained students per dataset.
Method
Resolved
Solved issues
Verified positive
SeedBank
292
88
263
SWE-Trail-H0
329
92
272
SWE-Trail-H5
345 (+16)
98 (+6)
285 (+13)
Table 4: Collection outcomes over 1,500 trajectories per method. Changes in the H5 row are relative to H0.
Figure 3: History leads to more comparisons. Conditional on candidate sampling, candidate diversity remains similar, as does the alternative-selection rate. Table 22 in Appendix F gives the full funnel and counts by history type.
Appendix figures & tables28 assets
Supplementary material from the paper’s appendix.
Appendix
Main text
Appendix
Section 2.1 : marginal coverage of independent rollouts
Appendix A.1
Section 2.2 : mixed-outcome audit and its replication
Section 4.1 : issue pool, conditions, training, evaluation
Appendices C and D
Section 4.2 : main runs, paired contrasts, language breakdown
Appendix E
Section 4.2 : second student
Appendix E.4
Appendix
Table 5: Where each main-text claim is documented in full.
History type
k=1
k=2
k=3
k=4
k=5
Stable-solved
89.96%
93.98%
96.58%
98.38%
100%
Mixed
73.20%
86.42%
92.96%
96.98%
100%
Never-solved
80.09%
88.89%
93.75%
97.19%
100%
Appendix
Table 6: Expected patch-target coverage over exact subsets of the five SeedBank attempts. Values are the mean fraction of each issue’s five-attempt union.
History type
Issues
Pairs
dfull
d25
Jexplore
Jpatch
Stable-solved
37
370
0.605
0.629
0.665
0.918
Mixed
51
510
0.491
0.560
0.625
0.745
Never-solved
212
2,120
0.503
0.571
0.642
0.841
Appendix
Table 7: Behavior-level redundancy of the five SeedBank attempts. Pairwise similarity is averaged within each issue and then across issues by history type. dfull and d25 are SequenceMatcher ratios over the full and first-25 action-token sequences. Jexplore and Jpatch are Jaccard overlaps of explored and modified targets, with Jpatch computed over issues with a defined value.
Stage
Count
Share of 51
Retention
Selected mixed-issue pairs
51
100.0%
100.0%
Naturally completed unresolved pair
43
84.3%
84.3%
Complete audit disposition
43
84.3%
100.0%
Localized divergence and dual-order audit
40
78.4%
93.0%
Decision point supporting comparison
31
60.8%
77.5%
Appendix
Table 8: Complete primary audit funnel. “Share” retains the original 51-issue denominator, while “Retention” uses the preceding row. The eight collector-censored pairs remain in Table 9 but do not enter the primary funnel after pair selection.
Family
Classification
All (51)
Primary (43)
Censored (8)
Stage 1
Localized divergence
44
40
4
No meaningful divergence
3
3
0
Not analyzed: API long tail
4
0
4
Divergence type
Hypothesis
3
3
0
Implementation
28
25
3
Validation
13
12
1
Appendix
Table 9: Complete aggregate audit classifications. Divergence type and outcome relevance partition the Stage-1 found rows, while final disposition partitions every pair. “Primary” uses naturally completed unresolved attempts, and “censored” contains collector failures or timeouts.
Track
Set
N
A +
B +
Both +
Raw
Pos.
Neg.
κ
AC1
End to end
Primary
43
31
26
20
60.5%
70.2%
41.4%
.129
.285
End to end
Censored
4
3
3
3
100.0%
100.0%
100.0%
1.000
1.000
Fixed boundary
Primary
28
24
16
15
64.3%
75.0%
37.5%
.205
.397
Fixed boundary
Censored
4
3
2
2
75.0%
80.0%
66.7%
.500
.529
Appendix
Table 10: Independent cross-model replication of the mixed-history audit. N is the common complete-disposition set for each row. Positive means strict or possible two reasonable routes. “Both” is the conservative positive intersection. Pos./Neg. are positive/negative agreement. Both auditors complete all 43 primary pairs end to end. Auditor A identifies 31 supported comparison points and Auditor B identifies 26. Raw, Pos., Neg., κ , and AC1 describe binary audit labels, not agreement on divergence localization or the full label vocabulary.
Component
Visible prefix
Prior attempts
Private record
Executed suffix pair
Offline compiler
issue only
H-dependent
yes
no
Candidate generation
yes
no
no
no
Private shortlist
yes
yes
yes
no
Blind suffix selector
yes
private
private
yes
Exported trajectory
selected route
no
no
selected only
Appendix
Table 11: Information boundary enforced during collection and export. “Private” means that information may inform the collector but never enters a coding-agent request. The last column contains the two executed suffixes used by the route selector.
shuffled suffixes, comparison objective, private record as prior
select A, select B, or tie with evidence
trajectory continuation
Appendix
Table 12: Inputs and outputs of the model-assisted collector stages. All outputs remain private to the collector and are never inserted into a coding-agent request.
Condition
Source
History visible to agent
New collection
Training record
Role
SeedBank
independent rollouts
no
complete rollout
generated trajectory
sampling baseline
SWE-Gym ( Pan et al., 2025 ) , outcome-conditioned transform
SeedBank
no
no
outcome-conditioned record
outcome control
SWE-Lego ( Tao et al., 2026 ) , strict tool-error masking
SeedBank
no
no
masked record
step control
SWE-TRACE ( Han et al., 2026 ) , critical-path reduction
SeedBank
no
no
compressed record
compression control
SWE-Exp ( Chen et al., 2025 ) , agent-visible experience
five attempts
yes
complete rollout
experience retained
visibility control
SWE-Trail-H0
no history
no
history-free collection
selected trajectory
no-history control
Appendix
Table 13: Experimental conditions. Every condition produces 1,500 training records. The controlled adaptations use the same SeedBank attempts and training protocol as our main experiments.
Table 14: Shared training settings for the 124B student. All listed settings are fixed across trajectory conditions.
Multilingual
SWE-Pro
Condition
R1
R2
R3
Mean
R1
R2
R3
Mean
SeedBank independent rollouts
63.00
63.67
63.33
63.33
41.18
41.31
41.18
41.22
SWE-Gym (outcome-conditioned transform)
63.67
65.00
63.33
64.00
40.36
41.59
40.63
40.86
SWE-TRACE (critical-path reduction)
65.33
64.67
63.33
64.44
41.72
40.08
40.49
40.77
SWE-Lego (strict tool-error masking)
66.00
63.00
64.67
64.56
39.81
42.13
42.95
41.63
SWE-Exp (agent-visible experience)
62.00
61.00
63.00
62.00
38.44
38.58
38.30
38.44
Appendix
Table 15: Independent downstream training runs, three per condition. Means are computed from integer resolved counts before rounding. Table 13 defines the experimental conditions.
Contrast
Multilingual Δ [95% CI]
W/L/T
SWE-Pro Δ [95% CI]
W/L/T
H5 − H0
2.22 [−0.2, 4.6]
55/35/210
0.87 [−0.8, 2.5]
130/111/490
H10 − H0
2.44 [−0.1, 4.9]
61/39/200
1.00 [−0.7, 2.7]
134/112/485
H10 − H5
0.22 [−2.0, 2.5]
51/49/200
0.14 [−1.3, 1.6]
117/114/500
Stricter selector − H5
−1.78 [−4.0, 0.4]
42/58/200
−0.91 [−2.6, 0.8]
105/125/501
Appendix
Table 16: Task-paired downstream contrasts conditional on the trained models. W/L/T counts tasks for which the first condition resolves more, fewer, or the same number of the three independently trained models. Intervals resample evaluation tasks rather than training runs.
Figure 4: Task-paired downstream contrasts conditional on the trained models. Points show mean differences across the three trained models, and bars show task-cluster 95% bootstrap intervals.
Language
Tasks
SeedBank
H0
H5
Δ SeedBank
Δ H0
C
30
60.0
56.7
68.9
(+8.9)
(+12.2)
C++
12
63.9
69.4
69.4
(+5.6)
0.0
Go
42
34.1
36.5
37.3
(+3.2)
(+0.8)
Java
43
72.9
72.1
72.9
0.0
(+0.8)
JavaScript
31
74.2
72.0
71.0
(−3.2)
(−1.1)
PHP
43
69.8
72.9
72.1
(+2.3)
(−0.8)
Appendix
Table 17: Multilingual resolution by repository language, in percent. Δ columns compare H5 with SeedBank and H0.
Multilingual
SWE-Pro
Training dataset
R1
R2
R3
Mean
Δ
R1
R2
R3
Mean
Δ
SeedBank
11.67
11.00
11.33
11.33
10.94
11.22
11.08
11.08
SWE-Trail-H0
12.67
13.00
12.67
12.78
+1.44
11.90
11.76
12.04
11.90
+0.82
SWE-Trail-H5
14.33
14.67
14.33
14.44
+3.11
13.27
13.54
13.68
13.50
+2.42
SWE-Trail-H10
15.33
15.33
15.67
15.44
+4.11
13.82
13.95
13.82
13.86
+2.78
Appendix
Table 18: Resolution of the Qwen3-14B-Base student in three independent training runs per trajectory set. Values are percentages over the 300 Multilingual and 731 SWE-Pro tasks. Means are computed from resolved counts before rounding, and Δ is relative to SeedBank in percentage points.
Figure 5: H5 shows the largest shift toward fewer repeated reads, while validation counts remain close to SeedBank. At each count, the curve gives the share of trajectories at or below that count minus the corresponding SeedBank share, in percentage points. SeedBank is the zero line. A positive value means that more trajectories fall at or below the displayed count. Panels A and C show repeated reads. H5 reaches 8.2 points above SeedBank for unresolved trajectories and 8.4 points for resolved trajectories, compared with 5.6 and 5.9 for H0. Panels B and D show validation actions, where all curves remain within about five points of SeedBank. The rightmost bin includes values at or above the displayed cap. Coding-action distributions are omitted for legibility.
Condition
Mean actions
Mean repeated reads
Post-edit validation
SeedBank
43.37
8.78
86.62%
SWE-Trail-H0
40.89
7.59
88.91%
SWE-Trail-H5
39.51
7.01
89.53%
SWE-Trail-H10
40.72
7.46
88.65%
Appendix
Table 19: Process means over all 1,500 collected trajectories per condition. Post-edit validation is the share of edited trajectories whose final edit is followed by an executable check.
Multilingual
SWE-Pro
Metric
H0
H5
Δ
H0
H5
Δ
Actions / trajectory
84.55
78.30
−6.25
77.84
75.34
−2.50
Repeated reads / trajectory
16.41
14.89
−1.52
15.17
14.52
−0.65
Repeated-read share (%)
48.12
46.61
−1.51
44.77
44.17
−0.61
Post-final-edit check rate (%)
81.43
80.57
−0.86
86.39
87.43
+1.04
Appendix
Table 20: Descriptive evaluation behavior of the 124B students. Metrics are computed separately for each independent training run and then averaged across the three runs per condition. Δ is H5 minus H0. Differences in rates are in percentage points.
Resolved trajectories
Solved issues
History type
H0
H5
Δ
H0
H5
Δ
Stable-solved
176
176
0
37
37
0
Mixed
130
143
+13
40
45
+5
Never-solved
23
26
+3
15
16
+1
All
329
345
+16
92
98
+6
Appendix
Table 21: H0/H5 collection yield by SeedBank history type. An issue is counted as solved when at least one of its five newly collected trajectories resolves.
Condition
History type
Traj.
Candidate sampling
Distinct actions
Executed comparison
Alt. selected
Semantic progress
Resolved
H0
stable-solved
185
36.22%
91.04%
86.89%
30.19%
21.08%
95.14%
H5
stable-solved
185
53.51%
90.91%
92.22%
43.37%
35.14%
95.14%
H0
mixed
255
53.73%
93.43%
95.31%
43.44%
35.29%
50.98%
H5
mixed
255
83.53%
94.37%
94.53%
41.05%
56.47%
56.08%
H0
never-solved
1,060
43.40%
88.91%
94.13%
38.80%
28.49%
2.17%
H5
never-solved
1,060
78.77%
88.50%
94.05%
35.68%
37.92%
2.45%
Appendix
Table 22: H0/H5 collection stages by SeedBank history type. H0 history labels are joined post hoc by issue ID and were never available during H0 collection. Candidate diversity is conditional on candidate sampling, executed comparison is conditional on candidate diversity, and alternative selection is conditional on a completed comparison. Candidate sampling, semantic progress, and resolution use all trajectories.
Compiler class
Issues
Mean rules
Active rules
Abstention
Stable-solved
37
2.38
0.62
37.84%
Mixed
41
2.22
1.61
7.32%
Never-solved
210
2.29
1.47
13.81%
Insufficient
12
2.33
0.00
100.00%
Appendix
Table 23: H5 acquisition-record statistics by compiler class. Per-class means are rounded to two decimals. Appendix B.4 gives the exact totals of 687 compiled and 397 active detector rules.
Figure 6: H10 adds little mean improvement over H5 while collection cost continues to increase. Collection outcomes and 124B-student gains are shown relative to H0. Recorded tokens are divided into ordinary rollout and acquisition-only usage. H0 is a lower bound because its offline compiler calls were not recorded.
Condition
Coding actions
Validations
Trajectory-hours
SeedBank
65,056
6,814
355.2
SWE-Trail-H0
61,329
6,760
196.2
SWE-Trail-H5
59,260
6,700
239.4
SWE-Trail-H10
61,085
6,721
208.1
Appendix
Table 24: Environment-side totals over the 1,500 collected trajectories in each condition.
Candidate set
Res.
Solved issues
Strict +
Never traj.
Never issues
10 SeedBank
394
99
313
15
11
5 SeedBank + 5 H5
413
104
321
26
16
Appendix
Table 25: Verifier-based Top-5 selection. Both candidate sets contain 3,000 trajectories and retain 1,500 trajectories for training.
Multilingual
SWE-Pro
Trajectory corpus
Mean
Range
Mean
Range
SeedBank
63.33
[63.00, 63.67]
41.22
[41.18, 41.31]
Top-5-of-10
64.11
[63.33, 65.00]
41.86
[41.45, 42.13]
SWE-Trail-H5
65.67
[64.00, 67.67]
42.82
[41.72, 43.37]
Top-5-hybrid
66.22
[65.33, 66.67]
43.14
[42.82, 43.37]
Appendix
Table 26: Student resolution after verifier-based selection. Each corpus has three independent training runs. Ranges give the lowest and highest run. SeedBank and H5 repeat the results in Table 1 .
Figure 7: History guides where additional collection effort is spent. In the schemars-304 example, both candidate suffixes are generated by the same coding agent from the same visible checkpoint. Candidate 0 continues reading, while candidate 6 runs the relevant Rust tests. The selector uses the resulting repository evidence to choose which route continues.
Training corpus
Multilingual
SWE-Pro
Independent SeedBank
63.33
41.22
Advice removed
63.00
42.23
Advice retained
64.56
41.63
SWE-Trail-H5
65.67
42.82
Appendix
Table 27: Three-run SFT means for two exports of the same advice-conditioned trajectories.
Use of prior attempts
Consumer
Effect on later computation
Primary goal
Retrieved reflection or memory
Coding agent
Adds previous feedback or experience to the visible context
Improve the current solve
Distilled skill or workflow
Coding agent or workflow
Supplies reusable procedural guidance
Improve the current solve
Inference-time replay or refinement
Search harness and coding agent
Reuses prefixes or conditions generation on prior summaries
Improve or select a current solution
History-guided collection (ours)
Collector
Guides where additional collection effort is spent while history remains outside the agent context
Collect training trajectories
Appendix
Table 28: How prior attempts are reused. The main distinction is whether history enters the coding agent’s context or remains private to an external collection procedure.
Code agents resolve 65-70% of SWE-bench Verified issues, but Pass@1 cannot tell us why the rest fail, and, as we show, capable-model failures are systematically misdiagnosed without trajectory data. We introduce TRAJEVAL, a training-free decomposition of agent trajectories into reference-patch-aligned search, read, and edit stages, and apply it across 16,758 trajectories spanning three architectures and seven models. The dominant failure of capable models is not localization: 60-69% of failures on SWE-Agent and OpenHands reach and edit the correct functions yet still produce incorrect patches, and the pattern persists for most models on the bash-only LiveSWEAgent. Within this Edit-Quality residual, we identify Coherence Collapse, where the agent reaches correct code and then overwrites or thrashes it, as the largest theme, replicating across SWE-bench Verified and the multilingual PolyBench Verified. In 5 cases, the agent produces a patch bit-identical to the gold reference mid-trajectory and destroys it later; an edit-commit checkpoint recovers all 5 against the SWE-bench Docker harness. A reference-free consensus-driven variant yields a directional +3.0 pp Pass@1 measurement on GPT-5 (p=0.08).
Supervised fine-tuning on agent trajectories is an effective way to improve coding agents, but selecting useful training examples requires more than identifying successful runs. A resolved patch may follow inefficient reasoning or unnecessary tool use, while a failed run may still contain useful intermediate steps. Training pipelines therefore rely on rules and qualitative assessments to filter trajectories, yet designing these filters typically requires substantial human expertise, and validating improvements through repeated training and evaluation is expensive. We introduce MetaCurate, a training-free framework that evolves executable trajectory curation filters using pairwise LLM judgments. Disagreements between the filter's rankings and the judge's preferences provide targeted feedback for jointly revising its rules, rubric, and aggregation policy. The resulting filter scores trajectories independently, so pairwise comparisons are required only during search. Starting from a blank filter, MetaCurate autonomously discovers a curation strategy that achieves competitive downstream performance without task-specific handwritten criteria. We validate downstream utility through controlled SFT experiments on our uncurated trajectory pool and the Nemotron v3 SWE dataset, with random selection and hand-authored filtering as baselines. In our experiments, MetaCurate achieves the highest mean SWE-Verified score among the compared methods, including hand-authored rule-based filtering and a training-loop baseline whose search costs 3.5x as much.
Supervised fine-tuning (SFT) of open-weight LLMs on expert agent trajectories has emerged as a prominent approach to building capable code agents without reliance on proprietary models. A central yet underexplored question is how trajectory quality and quantity jointly shape model performance. We present a systematic empirical study of trajectory data filtering for LoRA fine-tuning of Qwen2.5-Coder-7B-Instruct on the SWE-trajectory dataset (67,074 trajectories, of which 32,161 are resolved). We propose a two-axis quality scoring framework -- Efficiency and Style -- and evaluate it through 16 controlled experiments spanning strategy, scale, and ablation analyses. Since 7B-scale models attain near-zero SWE-bench resolve rates, we adopt cross-entropy (CE) loss on held-out trajectories as the primary metric, validated via first-action generation: CE loss and ROUGE-L are perfectly rank-correlated (Spearman ρ = -1.00), with limited-sample evidence supporting but not conclusively establishing this proxy. Our results reveal a scale-dependent quality-quantity trade-off: at small scales, doubling the dataset (500 to 1,000) yields ~12.7% CE-loss reduction whereas the TopQ-Random gap stays <1% (Mann-Whitney p > 0.10); at 2,000 trajectories this same gap widens to 3.6% (p = 0.016). Ablation further identifies error-retry rate as the dominant sub-dimension, performing comparably to the full composite (Δ < 0.2%). Together, these findings establish trajectory-level quality scoring as a viable but scale-sensitive lever for code-agent SFT and offer a proxy-validated evaluation protocol for the regime where end-to-end resolve rate is statistically infeasible.