ArchAgent: Scalable Legacy Software Architecture Recovery with LLMs
Rusheng Pan, Bingcheng Mao, Tianyi Ma, Zhenhua Ling
TL;DR
ArchAgent tackles the challenge of recovering scalable, business-aligned architectures from massive legacy codebases by fusing static analysis, adaptive code segmentation, and LLM-based semantic synthesis. Its pipeline—comprising adaptive grouping, cross-repository signal integration, and Readme/Mermaid diagram generation—addresses context-window limits and missing business semantics that hinder prior methods. Key contributions include scalable architecture understanding, cross-repository business context integration, and an ablation demonstrating dependency context enhances accuracy across models, plus a real-world case study on SQL transformation logic. The results show ArchAgent outperforming industrial baselines and validating the value of dependency context for practical, store-ready architectural recovery in production environments.
Abstract
Recovering accurate architecture from large-scale legacy software is hindered by architectural drift, missing relations, and the limited context of Large Language Models (LLMs). We present ArchAgent, a scalable agent-based framework that combines static analysis, adaptive code segmentation, and LLM-powered synthesis to reconstruct multiview, business-aligned architectures from cross-repository codebases. ArchAgent introduces scalable diagram generation with contextual pruning and integrates cross-repository data to identify business-critical modules. Evaluations of typical large-scale GitHub projects show significant improvements over existing benchmarks. An ablation study confirms that dependency context improves the accuracy of generated architectures of production-level repositories, and a real-world case study demonstrates effective recovery of critical business logics from legacy projects. The dataset is available at https://github.com/panrusheng/arch-eval-benchmark.
