Abstract
Legacy software systems form the backbone of many organizations, yet over time they accumulate significant technical debt due to outdated architectures, inefficient design patterns, and evolving business requirements. This technical debt increases maintenance costs, reduces system scalability, and slows down innovation. Manual code review and refactoring processes are often time-consuming, error-prone, and heavily dependent on developer expertise, making large-scale modernization a challenging task. To address these limitations, this project proposes RefactorAI, an autonomous code modernization agent designed to intelligently analyze, refactor, and modernize legacy codebases with minimal human intervention. RefactorAI integrates static code analysis techniques with advanced Artificial Intelligence methods, including Abstract Syntax Trees (ASTs), dependency graphs, Graph Neural Networks (GNNs), and Large Language Models (LLMs). The system begins by parsing the source code to extract structural and semantic information, constructing a comprehensive architectural and dependency model of the codebase. Using this representation, the agent identifies technical debt indicators such as tightly coupled modules, code smells, and inefficient design patterns. An LLM-powered reasoning engine then analyzes these insights to generate strategic refactoring recommendations, including component restructuring and architectural improvements such as monolith decomposition. Beyond analysis and planning, RefactorAI autonomously generates modernized, syntactically correct code snippets for targeted components, ensuring alignment with contemporary software development practices. This end-to-end automation significantly reduces the manual effort required for software maintenance while improving code quality, scalability, and architectural integrity. The proposed system serves as a proof-of-concept demonstrating how AI-driven tools can accelerate the software modernization lifecycle, enhance developer productivity, and enable organizations to extend the lifespan and value of their legacy systems. Ultimately, RefactorAI aims to empower development teams to maintain high software velocity while effectively managing technical debt in complex, real-world applications.