用记忆机制统一生成代码库文档,避免重复和矛盾。
Remember Your Trace: Memory-Guided Long-Horizon Agentic Framework for Consistent and Hierarchical Repository-Level Code Documentation

- 按依赖与层级顺序遍历代码,确保上下文连贯。
- 通过共享记忆累积历史记录,提升文档一致性。
- 适合需要结构化文档的大型项目维护者。
自动化代码文档对现代软件开发至关重要,为开发者和编码代理提供理解大型代码库所需的上下文。现有仓库级方法独立处理组件,导致重复检索、文档间描述冲突,且输出缺乏层级结构。为此,我们提出 MemDocAgent,一种长时程智能体框架,在整个仓库的单一集成上下文中生成文档。其包含两个组件:(i) 依赖感知遍历引导,预先确定符合依赖与粒度层级的遍历顺序;(ii) 基于记忆的智能体交互,智能体与 RepoMemory(一个通过读、写、验证操作积累先前工作痕迹的共享记忆)交互。通过多维度深入评估,MemDocAgent 在开源与闭源基线中均表现最优,并在真实软件开发流程中展现实际应用价值。
原文摘要 · Abstract (English)
Automated code documentation is essential for modern software development, providing the contextual grounding that both human developers and coding agents rely on to navigate large codebases. Existing repository-level approaches process components independently, causing redundant retrieval and conflicting descriptions across documents while producing outputs that lack hierarchical structure. Therefore, we propose MemDocAgent, a long-horizon agentic framework that generates documentation within a single, integrated context spanning the entire repository. It combines two components: (i) Dependency-Aware Traversal Guiding that predetermines a traversal order respecting dependency and granularity hierarchies; (ii) Memory-Guided Agentic Interaction, in which the agent interacts with RepoMemory, a shared memory accumulating prior work traces through read, write, and verify operations. Through an in-depth multi-criteria evaluation, MemDocAgent achieves the best performance over both open and closed-source baselines and demonstrates practical applicability in real software development workflows.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。