To succeed in real-world long-horizon software development, coding agents must satisfy multi-dimensional task specifications, such as interface compatibility and error handling, and do so without breaking existing dependencies. However, current works lack specification in both quantity and diversity, often emphasizing primary goals while ignoring complex constraints. Synthesizing tasks to bridge this gap presents two challenges: naively adding specifications risks reducing tasks to trivial checklists rather than compelling joint reasoning, and verifying these subtle interactions risks overlooking hidden flaws or rejecting valid alternatives. To address these challenges, we introduce CodeSpecWeave, a framework for synthesizing tasks with rich, interdependent specifications. Grounded in real developer seeds, a synthesis agent iteratively develops both coupled task requirements and executable tests, while a review agent audits solution trajectories from multiple models to guarantee test reliability. Using this pipeline, we construct 4,670 training tasks across 2,865 repositories. Applying Reinforcement learning on these tasks significantly improves performance over the base model on DeepSWE-v1.1, largely outperforming existing baselines. Furthermore, we curate CodeSpecWeave-Bench, a rigorous benchmark comprising 100 tasks and 1,044 specifications, which clearly separates frontier models and reveals significant headroom in handling interdependent engineering constraints.
Figures & tables
Figure 1: Comparison of task specifications across datasets. Top: Mean extracted specifications and distinct behavioral categories per task across existing SWE training datasets and CodeSpecWeave , with 95% bootstrap confidence intervals. Category counts follow the taxonomy in Table 5 . Bottom: Example task structures. Prior datasets typically contain few independent rules (left), whereas CodeSpecWeave tasks feature multiple interdependent specifications tied together by shared execution contexts and lifecycle constraints (right).
Figure 2: Overview of CodeSpecWeave . The synthesis agent repeatedly consults specification seeds, explores the repository, and runs generated tests to refine a task and its verifier. Schematic links between specifications and test cases illustrate many-to-many coverage. Solver trials and trajectory review then assess difficulty and query–test alignment. Accepted task–verifier pairs are retained; selected candidates with false positives or false negatives are repaired and revalidated.
Figure 3: Specification distribution in CodeSpecWeave - Bench . (a) The five behavioral categories in Table 5 , with functional semantics expanded into three blue subcategories. Each of the 1,044 specifications contributes once to one of the seven segments. (b) Specifications per task across 100 tasks (mean: 10.44).
Issue
Tasks
%
False positives only
1,548
50.5
False negatives only
426
13.9
Both
293
9.6
None observed
800
26.1
Total with issues
2,267
73.9
Table 1: Test alignment breakdown on 3,067 candidates.
Figure 4: Pass rates and mean reported output tokens on CodeSpecWeave - Bench . Hatched bars show pass rates (left axis); the line shows mean output tokens (right axis). Colors identify agent frameworks.
Training Settings
CodeSpecWeave - Bench
DeepSWE- v1.1
SWE-bench Verified
SWE-bench Pro
Avg
MiMo-V2.5
w/ Vanilla
47.00
12.39
69.27
50.11
44.69
w/ SWE-PI
44.00
6.78
68.00
49.43
42.05
w/ MiMo Coding
50.00
18.62
73.63
53.81
49.01
w/ CodeSpecWeave
52.00
25.30
72.00
51.30
50.15
MiMo-V2.6-Flash-SFT
Table 2: Task success rates (%, higher is better). Avg is the unweighted mean across the four benchmarks. Within each model, the best results are in bold and the second-best are underlined .
Figure 5: Learning curves for CodeSpecWeave , SWE-PI, and MiMo Coding, trained from MiMo-V2.5 (left) and MiMo-V2.6-Flash-SFT (right).
Measure
MiMo-V2.5
MiMo-V2.6-Flash-SFT
Vanilla
CodeSpecWeave
Vanilla
CodeSpecWeave
Thinking tokens (k)
29.7
141.6
22.8
69.5
Modified files
4.47
9.79
4.09
6.17
Changed lines
451
3,632
350
667
Edit–test loops
3.48
4.34
2.96
4.90
Trajectories with ≥2 loops (%)
63.0
72.7
69.0
78.3
Table 3: Reasoning, code changes, and edit–test loops on CodeSpecWeave - Bench . The edit–test loop definition is given in Appendix E .
Figure 6: Task success rates on CodeSpecWeave - Bench for MiMo-V2.6-Flash-SFT before and after reinforcement learning on the 4,670-task CodeSpecWeave training set. Results cover all 100 benchmark tasks. (a) Tasks grouped by specifications per task, with annotations showing percentage-point gains over Vanilla. (b) Tasks grouped by specification category (each point denotes the success rate on tasks requiring that category).
Figure 7: Training dynamics through RL update for the two CodeSpecWeave runs. From left to right: mean task-group score, policy entropy, response length, and main-agent turns.
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
Setting
Value
Training batch size
128
Mini-batch size
128
Samples per task
16
Sampling temperature
1.0
Top- p
0.97
Prompt token limit
8,192
Appendix
Table 4: RL training hyperparameters.
Specification Type
Scope
Count
Functional Semantics
End-to-end data transformation and algorithmic logic
470
Parsing & Representation
Syntax matching, encoding, and format serialization
182
Computation & Algorithms
Mathematical calculations and core algorithmic logic
145
Domain & Protocol Rules
Business constraints and protocol-specific semantics
143
Interface & I/O Contracts
Public APIs, argument types and defaults, input/output schemas
108
Control Flow & Ordering
Conditional branching, execution order, and concurrency
98
Appendix
Table 5: Taxonomy and distribution of the 1,044 benchmark specifications. Functional specifications ( n=470 ) are partitioned into three fine-grained subcategories.
Figure 8: Query length distributions of CodeSpecWeave , Scale-SWE, SWE-rebench V2, SWE-Lego, and R2E-Gym.
Requirement
Expected behavior
Proportionality
Without change, allocate post-fee hours proportionally and resolve rounding ties by request order.
Change allocation
Split post-fee hours 50/50 between recipients and change, assigning the odd hour to change.
Minimum allocation
Give each recipient at least one hour whenever the recipient share permits it.
Output order
Keep recipients in request order and append non-zero-coin change last.
Compatibility
Preserve the single-recipient cap and its existing output values.
Appendix
Table 7: Requirements in the example task.
Model
Vanilla
CodeSpecWeave
MiMo-V2.5
77.1
86.0
Flash-SFT
77.7
87.1
Appendix
Table 8: Task-averaged rates of editing and retesting after a failed test (%).
Figure 9: Failure pattern (1): a specification is targeted but incompletely enforced. The patch includes link recognition and punctuation handling, and the agent’s probe recognizes a parenthesized URL. Yet a URL following the text prefix remains plain text in the final evaluation. The targeted requirement is satisfied in one boundary setting but violated in another. URL and email strings are abbreviated; underlining denotes a URI span.
Figure 10: Failure pattern (2): an update satisfies one requirement while violating another. The patch addresses both signature union and state isolation. After a whole-state copy, however, both states share a transaction. The update adds the required signature to the destination transaction while also changing the original, violating isolation. Thus the same update fails to satisfy both requirements together. The original-state count is measured by the verifier.