🤖 AI Summary
This work addresses the limitations of existing code summarization approaches, which treat source code as flat text and neglect the hierarchical structure and module dependencies inherent in large-scale codebases—particularly problematic for complex, poorly documented projects. To overcome this, the authors propose a novel bottom-up multi-agent framework that introduces collaborative multi-agent mechanisms into code summarization for the first time. The framework coordinates three specialized agents—responsible for summary generation, keyword extraction, and quality evaluation—to explicitly model the hierarchical organization of code repositories. By integrating structured prompt engineering with an iterative refinement mechanism, the approach enhances summary coherence, completeness, and coverage of critical information. Experimental results demonstrate consistent improvements across seven mainstream large language models, yielding an average 8% gain in semantic consistency and up to a 38% increase in normalized keyword coverage on real-world datasets.
📝 Abstract
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. 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. 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.