arXiv:2505.21577cs.SEcs.AI2025-05NeurIPS被引 26

让AI自主探索GitHub仓库,高效复用代码解决复杂任务

RepoMaster: Autonomous Exploration and Understanding of GitHub Repositories for Complex Task Solving

  • 构建代码图谱精准提取核心模块,减少上下文负担
  • 在新基准上任务通过率提升至62.9%,令牌使用量降低95%
  • 适合需要复用真实开源项目的复杂任务自动化场景

代码智能体的终极目标是自主解决复杂任务。尽管大语言模型在代码生成方面取得显著进展,但现实任务通常需要完整的代码仓库而非简单脚本。从零构建此类仓库仍是重大挑战。幸运的是,开发者常将GitHub上的开源仓库作为模块化组件复用于复杂任务。然而,现有框架如OpenHands和SWE-Agent仍难以有效利用这些资源。仅依赖README文件信息不足,深层探索揭示两大障碍:仓库信息过载与依赖关系错综复杂,均受限于当前大模型上下文窗口。为此,我们提出RepoMaster——一个自主探索并复用GitHub仓库的智能体框架。为高效理解,它构建函数调用图、模块依赖图与层级代码树,仅向大模型提供识别出的核心组件,而非整个仓库。在自主执行中,通过探索工具逐步挖掘相关组件,并修剪信息以优化上下文使用。在调整后的MLE-bench上,相比最强基线OpenHands,有效提交数提升110%。在新发布的GitTaskBench上,任务通过率从40.7%升至62.9%,同时令牌消耗减少95%。代码与演示材料已公开于https://github.com/QuantaAlpha/RepoMaster。

原文摘要 · Abstract (English)

The ultimate goal of code agents is to solve complex tasks autonomously. Although large language models (LLMs) have made substantial progress in code generation, real-world tasks typically demand full-fledged code repositories rather than simple scripts. Building such repositories from scratch remains a major challenge. Fortunately, GitHub hosts a vast, evolving collection of open-source repositories, which developers frequently reuse as modular components for complex tasks. Yet, existing frameworks like OpenHands and SWE-Agent still struggle to effectively leverage these valuable resources. Relying solely on README files provides insufficient guidance, and deeper exploration reveals two core obstacles: overwhelming information and tangled dependencies of repositories, both constrained by the limited context windows of current LLMs. To tackle these issues, we propose RepoMaster, an autonomous agent framework designed to explore and reuse GitHub repositories for solving complex tasks. For efficient understanding, RepoMaster constructs function-call graphs, module-dependency graphs, and hierarchical code trees to identify essential components, providing only identified core elements to the LLMs rather than the entire repository. During autonomous execution, it progressively explores related components using our exploration tools and prunes information to optimize context usage. Evaluated on the adjusted MLE-bench, RepoMaster achieves a 110% relative boost in valid submissions over the strongest baseline OpenHands. On our newly released GitTaskBench, RepoMaster lifts the task-pass rate from 40.7% to 62.9% while reducing token usage by 95%. Our code and demonstration materials are publicly available at https://github.com/QuantaAlpha/RepoMaster.

代码生成智能体GitHub自动探索

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