RPG: A Repository Planning Graph for Unified and Scalable Codebase Generation

  • 2025-09-19 17:58:14
  • Jane Luo, Xin Zhang, Steven Liu, Jie Wu, Yiming Huang, Yangyu Huang, Chengyu Yin, Ying Xin, Jianfeng Liu, Yuefeng Zhan, Hao Sun, Qi Chen, Scarlett Li, Mao Yang
  • 0

Abstract

Large language models excel at function- and file-level code generation, yetgenerating complete repositories from scratch remains a fundamental challenge.This process demands coherent and reliable planning across proposal- andimplementation-level stages, while natural language, due to its ambiguity andverbosity, is ill-suited for faithfully representing complex softwarestructures. To address this, we introduce the Repository Planning Graph (RPG),a persistent representation that unifies proposal- and implementation-levelplanning by encoding capabilities, file structures, data flows, and functionsin one graph. RPG replaces ambiguous natural language with an explicitblueprint, enabling long-horizon planning and scalable repository generation.Building on RPG, we develop ZeroRepo, a graph-driven framework for repositorygeneration from scratch. It operates in three stages: proposal-level planningand implementation-level refinement to construct the graph, followed bygraph-guided code generation with test validation. To evaluate this setting, weconstruct RepoCraft, a benchmark of six real-world projects with 1,052 tasks.On RepoCraft, ZeroRepo produces repositories averaging nearly 36K LOC, roughly3.9$\times$ the strongest baseline (Claude Code) and about 64$\times$ otherbaselines. It attains 81.5% functional coverage and a 69.7% pass rate,exceeding Claude Code by 27.3 and 35.8 percentage points, respectively. Furtheranalysis shows that RPG models complex dependencies, enables progressively moresophisticated planning through near-linear scaling, and enhances LLMunderstanding of repositories, thereby accelerating agent localization.

 

Quick Read (beta)

loading the full paper ...