Agent4cs: A Multi-agent System for Code Summarization in Large Hierarchical Codebases
Agent4cs: A Multi-agent System for Code Summarization in Large Hierarchical Codebases
Agent4cs:用于大型分层代码库代码摘要的多智能体系统
Understanding large, complex codebases, especially those with obfuscated structures and incomplete documentation, remains a significant challenge. Existing code summarization solutions often rely on a single language model or coding assistant like Claude Code, and treat source code as flat text, underutilizing the rich interdependencies and hierarchical information within a repository.
理解大型、复杂的代码库,尤其是那些结构晦涩且文档不完整的代码库,仍然是一项重大挑战。现有的代码摘要解决方案通常依赖于单一语言模型或类似 Claude Code 的编程助手,并将源代码视为扁平文本,未能充分利用代码仓库中丰富的相互依赖关系和分层信息。
To address these shortcomings, we propose Agent4cs - a multi-agent framework that summarizes large codebases in a bottom-up fashion, where a summarization agent focuses on producing robust summaries; a keyword-extraction agent proactively identifies critical information from subfolders; and a quality-assurance agent iteratively refines the outputs for readability, coherence, and completeness.
为了解决这些缺陷,我们提出了 Agent4cs——一个以自下而上的方式总结大型代码库的多智能体框架。在该框架中,摘要智能体专注于生成稳健的摘要;关键词提取智能体主动从子文件夹中识别关键信息;质量保证智能体则对输出结果进行迭代优化,以确保其可读性、连贯性和完整性。
Evaluated on 7 frontier models, Agent4cs improves semantic consistency across all folder levels by average 8% compared to two structured prompting baselines with code segments. Furthermore, extensive evaluation on real-world datasets demonstrates up to 38% gains in normalized keyword coverage rate over the same baselines.
在 7 个前沿模型上的评估结果显示,与两个基于代码片段的结构化提示基准相比,Agent4cs 在所有文件夹层级上的语义一致性平均提高了 8%。此外,在真实世界数据集上的广泛评估表明,其归一化关键词覆盖率较上述基准提升了高达 38%。