Table of Contents
Fetching ...

Closing the Loop: Universal Repository Representation with RPG-Encoder

Jane Luo, Chengyu Yin, Xin Zhang, Qingtao Li, Steven Liu, Yiming Huang, Jie Wu, Hao Liu, Yangyu Huang, Yu Kang, Fangkai Yang, Ying Xin, Scarlett Li

TL;DR

The paper addresses the fragmentation of repository representations that hampers reasoning in software engineering agents. It introduces RPG-Encoder, which generalizes the Repository Planning Graph into a bidirectional, high-fidelity substrate through semantic lifting, incremental evolution, and unified reasoning tooling. Empirical results show state-of-the-art performance in repository understanding and high reconstruction fidelity, with substantial gains over baselines and sustainable maintenance costs. By closing the loop between architectural intent and concrete implementation, RPG-Encoder offers a practical, scalable foundation for structured, automated repository navigation and reconstruction.

Abstract

Current repository agents encounter a reasoning disconnect due to fragmented representations, as existing methods rely on isolated API documentation or dependency graphs that lack semantic depth. We consider repository comprehension and generation to be inverse processes within a unified cycle: generation expands intent into implementation, while comprehension compresses implementation back into intent. To address this, we propose RPG-Encoder, a framework that generalizes the Repository Planning Graph (RPG) from a static generative blueprint into a unified, high-fidelity representation. RPG-Encoder closes the reasoning loop through three mechanisms: (1) Encoding raw code into the RPG that combines lifted semantic features with code dependencies; (2) Evolving the topology incrementally to decouple maintenance costs from repository scale, reducing overhead by 95.7%; and (3) Operating as a unified interface for structure-aware navigation. In evaluations, RPG-Encoder establishes state-of-the-art repository understanding on SWE-bench Verified with 93.7% Acc@5 and exceeds the best baseline by over 10% on SWE-bench Live Lite. These results highlight our superior fine-grained localization accuracy in complex codebases. Furthermore, it achieves 98.5% reconstruction coverage on RepoCraft, confirming RPG's high-fidelity capacity to mirror the original codebase and closing the loop between intent and implementation.

Closing the Loop: Universal Repository Representation with RPG-Encoder

TL;DR

The paper addresses the fragmentation of repository representations that hampers reasoning in software engineering agents. It introduces RPG-Encoder, which generalizes the Repository Planning Graph into a bidirectional, high-fidelity substrate through semantic lifting, incremental evolution, and unified reasoning tooling. Empirical results show state-of-the-art performance in repository understanding and high reconstruction fidelity, with substantial gains over baselines and sustainable maintenance costs. By closing the loop between architectural intent and concrete implementation, RPG-Encoder offers a practical, scalable foundation for structured, automated repository navigation and reconstruction.

Abstract

Current repository agents encounter a reasoning disconnect due to fragmented representations, as existing methods rely on isolated API documentation or dependency graphs that lack semantic depth. We consider repository comprehension and generation to be inverse processes within a unified cycle: generation expands intent into implementation, while comprehension compresses implementation back into intent. To address this, we propose RPG-Encoder, a framework that generalizes the Repository Planning Graph (RPG) from a static generative blueprint into a unified, high-fidelity representation. RPG-Encoder closes the reasoning loop through three mechanisms: (1) Encoding raw code into the RPG that combines lifted semantic features with code dependencies; (2) Evolving the topology incrementally to decouple maintenance costs from repository scale, reducing overhead by 95.7%; and (3) Operating as a unified interface for structure-aware navigation. In evaluations, RPG-Encoder establishes state-of-the-art repository understanding on SWE-bench Verified with 93.7% Acc@5 and exceeds the best baseline by over 10% on SWE-bench Live Lite. These results highlight our superior fine-grained localization accuracy in complex codebases. Furthermore, it achieves 98.5% reconstruction coverage on RepoCraft, confirming RPG's high-fidelity capacity to mirror the original codebase and closing the loop between intent and implementation.
Paper Structure (133 sections, 9 equations, 13 figures, 18 tables, 4 algorithms)

This paper contains 133 sections, 9 equations, 13 figures, 18 tables, 4 algorithms.

Figures (13)

  • Figure 1: Comparison of code representations regarding semantic abstraction and structural explicitness. Unlike approaches limited to a single dimension, RPG achieves dual-view alignment, combining semantic richness with structural actionability.
  • Figure 2: Overview of the RPG-Encoder. The pipeline bridges Code and RPG via three stages: Encoding lifts code into a semantic topology; Evolution handles incremental updates via commits; and Operation provides a unified interface for agentic reasoning.
  • Figure 3: Cost Efficiency Comparison: RPG Rebuilding versus Incremental Updates across Commit History.
  • Figure 4: Distribution of Failure Modes on SWE-bench Verified. We analyze 100 failed trajectories per method with GPT-4o. Errors fall into four macro-groups: Tool & Execution, Search & Exploration, Reasoning & Interpretation, and Context & Scope, with 12 sub-types (T1–T12). See Appendix \ref{['app:err_analysis']}.
  • Figure 5: Illustration of raw code snippets and their corresponding semantic features extracted via semantic parsing.
  • ...and 8 more figures