RepoNav helps AI navigate code files to find the right functions
RepoNav: From Snippet Retrieval to File-Centered Repository Navigation for Code Agents
Software EngineeringComputation and Language
Summary
Finding the right piece of code in a big project is hard, especially when code search tools return many separate snippets without clear context. To fix this, the authors created RepoNav, which organizes retrieved code snippets by the files they come from, showing structure and helping AI agents browse code more like a person would. This makes it easier for AI to pick the exact function needed and improves performance on tasks asking questions about code. The benefit comes from better organization of results, not just showing more file structure.
What this means in practice
- •For software development teams: Help AI coding assistants find and understand relevant code functions within large repositories faster and more accurately.
- •For technical support teams: Improve automated tools that answer questions about customer code bases by better locating the right functions and files.
Authors
Hongzheng Chai, Jiakun Li, Hongyue Yu, Yuan Yuan
Abstract
Solving repository-level code tasks requires LLM-based agents to use code search tools to navigate large codebases and identify a small set of relevant files and functions. However, current retrieval tools typically return flat lists of isolated code snippets: such lists can surface relevant files, but provide insufficient structure for agents to distinguish the target function from semantically similar alternatives in the same file. We introduce RepoNav, a lightweight post-retrieval interface that reorganizes retrieved snippets into a file-centered navigation scaffold. By presenting compact structural cues and candidate targets, this scaffold guides on-demand file-structure browsing, helping agents compare sibling symbols before selecting a target function. Across diverse models on LocBench, RepoNav improves function-level localization and narrows the file-to-function gap. Controlled ablations demonstrate that these gains come from structured evidence organization rather than simply exposing additional file structure, and the approach also improves performance on a repository-level question-answering benchmark.