Legacy Modernisation

Modernising legacy systems with artificial intelligence

Legacy systems are the operational core of thousands of Italian companies. But when the code is 15, 20 or 30 years old, every change becomes a risk. AI-driven modernisation changes the rules: automated analysis of the source code, extraction of hidden business logic, dependency mapping and generation of migration roadmaps. It is not about replacing developers, but about giving them tools that turn months of manual analysis into weeks of guided work.

The legacy system problem in Italian companies

Italy's industrial fabric has a peculiarity that sets it apart from the rest of Europe: a heavy dependence on software built between the 1990s and the early 2000s, often on technologies that are no longer supported. Think of applications in Visual Basic 6, .NET Framework 2.0-3.5 platforms, custom ERP systems in COBOL or PL/SQL, classic ASP web portals, and point-to-point integrations that nobody dares to touch any more.

The problem is not only technological. These systems work — often surprisingly well — and companies have built their operating processes on them for decades. The business logic is trapped in the code: calculation rules, exceptions, approved workflows, integrations with external systems. No document describes all of it completely. The original developers have often retired or moved on. The result is what in the industry we call opaque technical debt: a risk the organisation cannot even quantify.

The consequences are concrete: maintenance costs that rise every year, the inability to deliver new features the market asks for, security vulnerabilities in components that are no longer patched, difficulty finding developers willing to work on obsolete stacks, and a growing risk of catastrophic failure when a critical dependency reaches end-of-life.

How AI transforms reverse engineering of legacy code

Traditionally, reverse engineering a legacy system is a manual, slow and expensive process. A team of analysts has to read the source code line by line, interview users, reconstruct data flows and document the business logic — work that for complex systems can take months. With AI, that paradigm changes radically.

Our pipeline uses a RAG (Retrieval-Augmented Generation) architecture built on Weaviate, a vector database that indexes the entire codebase — source code, stored procedures, configuration, existing documentation, bug-tracking tickets, technical email — into a semantic vector space. That means an LLM can answer questions such as "which modules handle the discount calculation for gold customers?" by querying not just the code but the whole business context around it.

On top of the RAG layer runs a multi-agent system orchestrated with n8n. Not a single prompt, but a pipeline of specialised agents: one for static code analysis, one for extracting business rules, one for dependency mapping, one for identifying architectural patterns. Each agent produces structured output that is aggregated into a coherent view of the system. The result is an analysis that a human team would take months to produce, generated in weeks and at a greater level of detail. For a technical deep dive, see our research article on AI-driven reverse engineering.

The methodology: from automated analysis to guided rewrite

Our approach to legacy modernisation follows a methodology structured in four phases, each supported by specific AI tools.

Phase 1 — Ingestion and indexing. The system's entire information estate is indexed in the vector database: source code, database schemas, configuration, technical and functional documentation, tickets, internal wikis. This phase typically takes 3-5 days and produces the system's "knowledge graph", on which every subsequent agent works.

Phase 2 — Multi-agent analysis. The AI agents analyse the system from different, complementary angles. The static analysis agent identifies the code structure, cyclomatic complexity metrics, code smells and recurring patterns. The business logic extraction agent reconstructs the business rules implicit in the code. The dependency mapping agent traces every internal and external dependency. The architecture agent identifies bounded contexts and proposes a decomposition into independent modules.

Phase 3 — Roadmap generation. The agents' findings are synthesised into a roadmap document that includes: a visual dependency map, a risk matrix for each component, a proposed migration sequence based on the strangler fig pattern, and a time and cost estimate for each phase. This roadmap is the main deliverable of the analysis phase.

Phase 4 — Assisted rewrite. The code is rewritten with continuous support from the RAG pipeline. Developers can query the system to understand how the original code behaves, generate regression tests from the extracted business logic, and validate that the new code faithfully reproduces the legacy system's business rules. Every design decision is traceable and documented.

The obsolescence engine: finding technical debt before it becomes critical

A key component of our pipeline is the obsolescence engine, a system that continuously monitors the technological health of an application. It is not a simple dependency checker: it is an analysis engine that correlates data from multiple sources to produce a complete picture of technology risk.

The engine analyses the versions of every component of the system — frameworks, libraries, databases, runtimes — and compares them with vendors' official roadmaps to identify end-of-life dates. In parallel, it queries the CVE (Common Vulnerabilities and Exposures) databases to identify known vulnerabilities in the components in use. Finally, it analyses how many developers are available on the market for the technologies in use, an indicator that is often overlooked but crucial for long-term sustainability.

The result is an obsolescence score for every component of the system, classified on three levels: green (no intervention needed in the next year), amber (intervention recommended within 12 months), red (urgent intervention — the component is already end-of-life or has critical vulnerabilities that cannot be patched). The score updates automatically and lets CTOs plan modernisation investment on objective data rather than perception.

The obsolescence engine is integrated into our Nexus MDS Core platform and can be deployed on-premise for organisations in regulated sectors, where data about their own technology stack cannot leave the company perimeter.

Case study: IATP — AI-driven reverse engineering of a legacy platform

The IATP project (Intelligent Application Transformation Platform) is the most complete application of our AI-driven modernisation methodology. The client had an enterprise platform developed over more than 15 years, with hundreds of thousands of lines of code, fragmentary documentation and a development team that only partly understood the system.

The AI pipeline indexed the entire codebase in Weaviate, including database schemas, stored procedures, configuration files and existing documentation. The multi-agent system then analysed the code and produced 47 functional specifications, covering more than 180 tables and 12 integration points. The analysis phase went from an estimated 3-4 months to under two weeks.

The roadmap it produced let the development team proceed with incremental modernisation, starting with the highest-risk, lowest-coupling modules. The new system was built on a modern architecture with REST APIs, event sourcing, and an integration layer that allowed the old and new systems to coexist during the transition. The full case study is on the page dedicated to IATP — AI-driven reverse engineering.

A similar approach, applied to the pharmaceutical sector, guided the modernisation project for Federfarma, where automated analysis made it possible to identify and resolve critical dependencies in a highly regulated ecosystem of services.

From understanding to rewrite: a complete AI-driven pipeline

The real power of AI-assisted modernisation lies not only in the analysis, but in the continuity of the pipeline. Once the legacy system has been understood and mapped, the same RAG infrastructure becomes the development team's day-to-day working tool during the rewrite.

Developers can query the system in natural language: "How is the margin calculated for products in category X when the customer has a multi-year contract?" The RAG pipeline retrieves the relevant code fragments, the associated documentation and the historical tickets, producing a contextualised answer that lets the developer implement the same logic in the new stack without ambiguity.

This approach solves one of the most underestimated problems in legacy modernisation: the loss of tacit knowledge. Every legacy system has a layer of knowledge that is neither in the code nor in the documentation, but in people's heads. The RAG pipeline captures that knowledge during the analysis phase — through structured sessions with key users — and makes it queryable for the whole life of the project.

The result is an end-to-end pipeline that runs from the initial analysis to the validation of the new system, with full traceability of decisions and a check, rule by rule, that the business logic is carried across in the transition. This pipeline is an integral part of our enterprise integration and applied AI services.

The ROI of AI-assisted modernisation vs a manual rewrite

The question every CTO and IT director asks is a fair one: does AI-driven modernisation deliver a real, measurable return on investment? The answer depends on the system and has to be measured case by case; this is where the savings come from.

The first saving is in the analysis and comprehension phase, which carries a significant share of the total cost of a modernisation project. Our pipeline shortens this phase, while producing a more complete and structured output than a manual audit can. How much that saves depends on the system and has to be measured on the case.

The second saving comes from fewer defects during the rewrite. Having the RAG pipeline available during development reduces misinterpretations of the original business logic, which are the main cause of critical bugs in modernisation projects.

The third benefit, less quantifiable but strategically decisive, is lower project risk. Many legacy modernisation projects fail, mainly because complexity was underestimated and business logic was lost. AI-driven analysis gives a complete view of the system before the rewrite starts, allowing an accurate estimate of time and cost and reducing the risk of scope creep.

For organisations that want to explore our approach further, we offer a free initial consultation to assess feasibility and the expected ROI.

Frequently asked questions about modernising legacy systems with AI

How long does it take to modernise a legacy system with AI?

With our AI pipeline the automated analysis phase is measured in weeks, not the months of a traditional manual audit. How long the full rewrite takes depends on the complexity of the system; the roadmap generated by the AI lets you estimate it for your specific case before work starts.

Which legacy languages and technologies do you support in reverse engineering?

Our RAG pipeline is language-agnostic. We have worked on COBOL, Visual Basic 6, .NET Framework, legacy Java EE, PL/SQL and proprietary codebases. The Weaviate vector database indexes any kind of source code, documentation and configuration.

How does the Dynamics Consulting obsolescence engine work?

The obsolescence engine automatically analyses the system's dependencies, framework versions, known vulnerabilities (CVEs) and component end-of-life dates. It produces a risk score for each component and a prioritised roadmap of interventions based on business impact.

Can you modernise only part of a legacy system without rewriting everything?

Absolutely. Our approach relies on modular decomposition: the AI analysis identifies the boundaries of functional domains and the dependencies between modules, enabling incremental modernisation. Critical modules can be extracted and modernised one at a time with patterns such as the strangler fig.

How much does AI-assisted modernisation cost compared with a traditional rewrite?

The saving against a complete manual rewrite has to be measured case by case. It comes mainly from shorter code analysis and comprehension, which is a significant share of the total cost of a modernisation project.

Does Dynamics Consulting work only with large enterprises or also with the mid-market?

Our focus is specifically the Italian mid-market: companies with 50-500 employees, often in regulated sectors such as healthcare, pharmaceuticals, logistics and manufacturing. We offer the expertise of an enterprise consultancy with the flexibility and costs of a specialist partner.

Pipeline technologies

WeaviateRAG Pipelinen8n Multi-AgentLLM InferencevLLMKubernetesDockerPostgreSQLNexus MDS CoreEvent SourcingStrangler Fig PatternObsolescence Engine

Let's talk about your project

AI infrastructure to build, a legacy system to modernise, or an ERP to connect to the future? Get in touch.