arXiv:2602.20048cs.AIcs.SE2026-02被引 1

用依赖图导航解决代码智能体找错文件的难题

CodeCompass: Navigating the Navigation Paradox in Agentic Code Intelligence

  • 通过依赖图结构实现精准代码文件定位
  • 在隐藏依赖任务上达成99.4%完成率,显著超越传统方法
  • 适合需要精准导航的大型项目开发人员

现代代码智能体面临超过百万词元的上下文规模,远超人类手动定位文件的能力。然而在真实编码任务中,智能体仍难以发现关键文件。我们识别出‘导航悖论’:失败并非因上下文限制,而是导航与检索本质不同。在30个基准任务上对生产级FastAPI仓库进行258次自动化测试表明,基于代码依赖图的CodeCompass(通过模型上下文协议服务器暴露图结构)在隐藏依赖任务上实现99.4%的任务完成率,较普通代理(76.2%)提升23.2个百分点,较BM25检索(78.2%)提升21.2个百分点。但发现关键采纳差距:58%使用图信息的试验未调用任何工具,需显式提示工程才能持续使用。结果表明瓶颈不在工具可用性,而在行为对齐——智能体需被明确引导以利用结构化上下文而非词法启发式。贡献包括:(1) 区分语义搜索、结构导航与隐藏依赖场景的任务分类体系;(2) 实证证明当依赖无词法重叠时,图导航优于检索;(3) 开源评估基础设施支持导航工具可复现评测。

原文摘要 · Abstract (English)

Modern code intelligence agents operate in contexts exceeding 1 million tokens--far beyond the scale where humans manually locate relevant files. Yet agents consistently fail to discover architecturally critical files when solving real-world coding tasks. We identify the Navigation Paradox: agents perform poorly not due to context limits, but because navigation and retrieval are fundamentally distinct problems. Through 258 automated trials across 30 benchmark tasks on a production FastAPI repository, we demonstrate that graph-based structural navigation via CodeCompass--a Model Context Protocol server exposing dependency graphs--achieves 99.4% task completion on hidden-dependency tasks, a 23.2 percentage-point improvement over vanilla agents (76.2%) and 21.2 points over BM25 retrieval (78.2%).However, we uncover a critical adoption gap: 58% of trials with graph access made zero tool calls, and agents required explicit prompt engineering to adopt the tool consistently. Our findings reveal that the bottleneck is not tool availability but behavioral alignment--agents must be explicitly guided to leverage structural context over lexical heuristics. We contribute: (1) a task taxonomy distinguishing semantic-search, structural, and hidden-dependency scenarios; (2) empirical evidence that graph navigation outperforms retrieval when dependencies lack lexical overlap; and (3) open-source infrastructure for reproducible evaluation of navigation tools.

代码智能依赖图导航优化AI开发

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。