超级库代理:超越单一代码库的多个应用的联合生成与维护

·

研究论文 · 2026/09/01

组织经常开发和维护相关应用的组合:这些应用是独立可部署的代码库,但共享大量的领域逻辑、接口模式或操作约定。随着LLM编码代理越来越多地用于生成和维护此类软件,天真的逐应用工作流会在代码库之间重复共享逻辑,并允许长时间的代理维护积累冗余、死代码和结构侵蚀。我们引入了超级库代理问题,其中代理顺序生成N个相关应用的组合,同时维护一个共享的超级库,包含可复用的跨应用组件。一个最小的顺序脚手架原则上可以提取共享代码并将应用迁移到不断发展的库中,但在实践中存在提取召回率低和依赖迁移脆弱的问题。我们通过代码块摘要的候选引导提取、提取前代码库整合以及使用提取轨迹和调用图信息的上下文感知迁移来解决这些失败。在WebGen-Bench和PaperBench上,我们的方法在保持应用功能的同时,显著减少了冗余和令牌占用(冗余度、令牌长度),优于零样本方法,并避免了朴素库构建引入的结构侵蚀,进一步减少了代码行数和最小描述长度。我们的代码可在https://github.com/sbigstar0310/super-library-agent获取。

该论文针对LLM代理生成和维护多个相关应用时共享逻辑重复和结构侵蚀的问题,提出了一个系统性的解决方案,并通过实验验证了其有效性。对于研究LLM在软件工程中应用的研究人员和实践者,该工作提供了有价值的见解和方法。

Organizations often develop and maintain portfolios of related applications: independently deployable codebases that share substantial domain logic, interface patterns, or operational conventions. As LLM coding agents are increasingly used to generate and maintain such software, a naive application-by-application workflow duplicates shared logic across codebases and allows prolonged agentic maintenance to accumulate verbosity, dead code, and structural erosion. We introduce the Super Library Agent problem, where an agent sequentially generates a portfolio of N related applications while maintaining a shared Super Library of reusable cross-application components. A minimal sequential scaffold can in principle extract shared code and migrate applications to the evolving library, but in practice suffers from low extraction recall and fragile dependency migration. We address these failures with candidate-guided extraction over code chunk summaries, pre-extraction codebase consolidation, and context-aware migration using extraction traces and call-graph information. Across WebGen-Bench and PaperBench, our method preserves application functionality while significantly reducing redundancy and token footprint (verbosity, token length) over zero-shot, and avoiding the structural erosion introduced by naive library construction, with additional reductions in LOC and MDL. Our code is available at https://github.com/sbigstar0310/super-library-agent.

阅读原文

参与讨论