Paper 2602.02084
Closing the Loop: Universal Repository Representation with RPG-Encoder
- Published
- Feb 2026
- Research lab
- Independent
- Citations
- 0
- GitHub
- 588 stars
01 In brief
Summary
RPG-Encoder generalizes the Repository Planning Graph (RPG) into a unified, high-fidelity representation for repository reasoning, closing the loop between comprehension and generation.
It addresses the disconnect caused by fragmented representations (API documentation lacks structure, dependency graphs lack semantics) by encoding raw code into a dual-view graph with semantic features and structural metadata, evolving it incrementally via commit diffs (reducing maintenance cost by 95.7%), and operating as a unified interface for structure-aware navigation.
Evaluations show state-of-the-art localization on SWE-bench Verified (93.7% Acc@5 function-level with Claude-4.5-Sonnet) and SWE-bench Live Lite (exceeding best baseline by over 10%), and 98.5% reconstruction coverage on RepoCraft with GPT-5-mini, surpassing documentation-based baselines.
Ablations confirm that both semantic features and topological constraints are essential, and incremental maintenance preserves fidelity with negligible degradation.
The framework enables efficient, structured exploration and reduces search failures, establishing a robust foundation for closed-loop software engineering.
02 From the paper
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 localization performance on SWE-bench Verified with 93.7% Acc@5 and exceeds the best baseline by over 10% in localization accuracy on SWE-bench Live Lite. These results highlight our superior fine-grained precision 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.