- The paper introduces Repo0, a three-phase framework that evolves component boundaries through a dual-DAG architecture before generating tested code, improving repository-wide consistency.
- The paper shows Repo0 outperforms RPG by 4.55–20.08 percentage points in functionality coverage and 7.61–29.74 points in pass rate across six Python repositories.
- The paper finds that metric-guided convergence using cohesion and coupling thresholds is more effective than unconstrained LLM refinement, while dependency-aware generation order is critical for complex repositories.
Problem and Motivation
Repo0 addresses zero-to-all code generation: constructing an entire software repository directly from natural-language requirements, with no pre-existing architecture. The authors argue that existing repository-generation methods—Commit0, NL2Repo-Bench, CodeS, Paper2Code, and RPG—share a critical assumption: the architecture is produced once, during a single initial planning stage, and then executed as a fixed blueprint. In real development, however, component cohesion and dependency entanglement are only partially observable from requirements and emerge during implementation. Repo0 therefore reformulates repository generation as a continuous structural evolution problem, in which component boundaries are revised throughout the development lifecycle until structural convergence, after which the converged architecture guides test-driven code generation.
Architectural State: The Dual-DAG
Repo0 maintains a persistent architectural state St=(GtR,GtC,At). The requirement-level DAG GtR organizes high-level requirements and sub-requirements, with edges encoding functional coordination relations (requirements that must be jointly considered) rather than implementation dependencies. The component-level DAG GtC organizes bounded implementation responsibilities—modules, adapters, parsers, service layers—with edges encoding implementation dependencies such as inheritance, reuse, and containment. A many-to-many alignment relation At⊆VtR×VtC records which components realize which requirements, preserving end-to-end traceability from prompt to code. During evolution, GtR is fixed while GtC and At are continuously updated.
Three-Phase Framework
Phase I constructs the initial state. Candidate requirement items are extracted from the input document, merged to remove redundancy, decomposed into sub-requirements via an enrich-then-decompose-then-label process inspired by Atom of Thoughts, and organized into G0R. Sub-requirements are then grounded into components with explicit served-requirement lists, and implementation dependencies are inferred using requirement-level edges only as soft evidence.
Phase II runs the modularity-guided structural evolution loop. Four component-level actions are available: split, merge, revise, and save. Splitting is triggered when a component's cohesion—the density of requirement-DAG edges among its served sub-requirements, normalized by (2∣RS(c)∣)—falls below γsplit=2/3 while serving enough requirements; a round-adaptive size threshold GtR0 guards against over-splitting. Candidate splits are informed by graph partitioning over the induced requirement subgraph. Merging is triggered when a component pair's coupling, defined as Jaccard similarity of their served sub-requirement sets, exceeds GtR1 and at least one cross edge exists; an LLM then vetoes merges that reflect valid architectural layering rather than duplication. The loop terminates when a full round yields no eligible split or merge, followed by a final semantic alignment pass of revise actions.
Phase III converts the converged component DAG into package assignments, file paths, exported symbols, and dependency-aware generation order, then materializes code incrementally under a TDD workflow: skeletons fix the public API, tests are synthesized from aligned requirements, and implementations fill in to pass them. Validation failures (imports, interfaces, pytest execution) trigger localized repair, and revise actions can adjust inaccurate component descriptions without changing boundaries.
Experimental Setup
Evaluation uses RepoCraft—six real-world Python repositories (scikit-learn, pandas, sympy, statsmodels, requests, django) under paraphrased names—with task descriptions revised by two engineers to strip architectural and interface hints. Baselines are mini-SWE-agent, Paper2Code, and RPG (the strongest, graph-planning baseline), plus the gold repositories as a pipeline reference. Backbones are GPT-5 mini and DeepSeek V3.2 with temperature 0; cross-model evaluation mitigates evaluator bias. Crucially, all methods share an identical downstream TDD code-generation, validation, and repair scaffold, isolating the effect of architecture construction. Evolution thresholds were tuned on two held-out Commit0 Lite repositories (wcwidth, sphinx) not used in evaluation.
Main Results
Repo0 achieves the highest Functionality Coverage and Pass Rate in all settings. Under GPT-5 mini it reaches 100.00% coverage on requests, 80.68% on statsmodels, and 80.50% on django, and the highest Voting Rate in all six settings. Against RPG, improvements range from +4.55 to +20.08 percentage points in coverage and +7.61 to +29.74 points in Pass Rate; on requests under GPT-5 mini, Pass Rate rises from 31.51% (RPG) to 50.98%. Because the generation scaffold is held fixed, these gains are attributable to the continuously refined architecture rather than the coding phase. Baselines show complementary failure modes: mini-SWE-agent loses repository-wide consistency at scale, and Paper2Code's high Functionality Novelty does not translate into correctness.
Ablation and Convergence Analysis
Removing structural evolution causes the largest degradation (e.g., on requests: coverage −5.68, Pass Rate −8.47, Voting Rate −17.86; on django: Pass Rate −13.33), confirming that evolving the initial architecture matters more than any single representation choice. Removing requirement context (neighboring requirement nodes in GtR2) and replacing the Dual-DAG with a unified graph both reduce coverage or correctness, and removing dependency-aware component-graph ordering drops statsmodels Pass Rate by 30.00 points—generation order becomes critical as complexity grows.
The convergence analysis is the paper's most instructive finding: budgeted LLM-decided evolution (1, 3, or 5 rounds) underperforms metrics-guided convergence despite receiving extra refinement rounds, and degrades quality after one round. Unconstrained structural actions over-decompose the repository, indicating that explicit cohesion/coupling criteria—not merely more iterations—drive convergence. Action-distribution analysis shows split dominates, followed by save, and a controlled experiment (fixing the same initial state and swapping backbones) shows the revise/add frequency is determined by the initial architectural state rather than the evolving model.
Cost
Repo0's generation costs under DeepSeek V3.2 are GtR328.19 (statsmodels), and GtR49.32, +GtR58.83). Under GPT-5 mini, Repo0 has consistently lower generation cost, which the authors attribute to fewer TDD repair iterations when component responsibilities are unambiguous.
Limitations and Threats to Validity
The paper concedes two main limitations. First, structural update quality depends on the backbone LLM's architectural reasoning: metrics only select candidate actions, while the LLM instantiates boundary rewrites, and the framework's safeguards (iterative re-evaluation, revise, validation-driven repair) only partially mitigate this. Second, evaluation is restricted to six Python repositories on a single benchmark; generalization to other language ecosystems is asserted on design grounds (the metrics operate at the architecture level) but remains untested. The threshold tuning procedure—manual comparison of evolved architectures against golden ones on two held-out repositories—is acknowledged as empirical rather than principled, and the main table reports only three of the six repositories, with the rest deferred to supplementary material.
Conclusion
Repo0 demonstrates that treating repository architecture as a persistent, metric-guided evolving state—rather than a one-shot planning artifact—yields substantial gains in both functionality coverage and implementation correctness for zero-to-all code generation, at comparable or lower cost than the strongest graph-planning baseline. The central evidence, that unconstrained LLM-decided restructuring actively harms quality while metric-triggered convergence improves it, positions explicit modularity criteria as a necessary component of architecture-aware coding agents. Open questions include cross-language generalization and reducing dependence on backbone LLM architectural reasoning.