Agent4cs: A Multi-agent System for Code Summarization in Large Hierarchical Codebases
06:00 · July 3, 2026 · arXiv cs.AI RSS

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.
Summary
Agent4cs addresses the persistent difficulty of producing usable documentation for large industrial codebases that often exceed several hundred thousand tokens and contain incomplete or outdated comments. Conventional single-model approaches flatten source files into token sequences and therefore miss folder-level dependencies and cross-module relationships that become visible only when summaries are constructed hierarchically.
The framework decomposes the task into three cooperating agents that operate bottom-up. A summarization agent generates concise descriptions at the function and file level; a keyword-extraction agent surfaces latent domain terms from subfolders that would otherwise remain hidden; and a quality-assurance agent iteratively scores and revises the emerging folder summaries for coherence, completeness, and readability. This staged process preserves structural information that flat prompting discards.
When tested across seven frontier language models, Agent4cs raised semantic consistency between parent-folder and child-folder summaries by an average of eight percent relative to two structured prompting baselines that already received code-segment context. On filtered real-world repositories and their deliberately obfuscated counterparts, the same system improved normalized keyword coverage by as much as 38 percent while keeping summary length comparable and often increasing measured readability.
Why it matters
This research provides a novel, actionable multi-agent methodology for AI-assisted software engineering, directly applicable by Dutch tech companies and researchers. Its acceptance at a major European conference (EUMAS) highlights its significance within the EU AI research community.





