Services

Spec-Driven Legacy Migration: Using Knowledge Graphs to Move from COBOL Mainframes to Modern Architecture

How a leading IT service provider in the financial sector is using large language models and code knowledge graphs to analyze over a million lines of legacy code, extract business logic, and prepare for a secure, incremental migration without the risks of a big-bang approach.
A monitor displaying old code next to a monitor displaying new code on a desk.

Initial Situation

A leading IT service provider faced the strategic challenge of future-proofing a central, business-critical master data system. The existing system—a legacy modular code monolith containing over a million lines of C++, COBOL, and Assembler—was a vital component of the company's ecosystem. With the planned decommissioning of the existing mainframe infrastructure, it had to be transitioned to a modern Java Spring Bootarchitecture.

The primary challenge lay in the immense complexity and incomplete documentation of dependencies. The company saw an opportunity to avoid a risky big-bang migration by using systematic, AI-supported analysis to precisely extract business logic and create a sound foundation for incremental modernization.

Our Solution

To bring transparency to the complex legacy architecture and ensure a secure migration, our strategy combined a code knowledge graph with a spec-driven development approach. First, the existing codebase is deterministically parsed and converted into a knowledge graph, which is then semantically enriched by modern AI agents. This graph serves as a reliable foundation for extracting business logic as specifications and designing the target architecture accordingly.

The core components of our solution include:

  • Hierarchical codebase analysis and deterministic base graph: To structure the analysis of over a million lines of code across heterogeneous languages like C++, COBOL, and Assembler, we developed a deterministic parsing approach. Using abstract syntax trees and initial specialized regular expression scripts, we built a base graph of code structures and dependencies. We reviewed this with experts to identify communication patterns not yet captured, then added targeted specialized parsers to ensure these interactions were also reflected in the graph. The result is a robust base graph that serves as the foundation for all further analysis, enabling reliable structuring of complex legacy systems.
  • AI-supported enrichment via specialized sub-agents: Building on the deterministic graph, we deployed specialized AI agents powered by modern large language models. These agents analyze the code at a semantic level, describe modules and their functions in a dedicated description field, and assign them to specific domains. This AI enrichment is then merged with the base graph in a separate step, creating a deep code knowledge graph that visualizes both technical and business-related relationships.
  • Interactive codebase Q&A and migration planning for developers: To make the extracted knowledge directly accessible to the development team, we developed an agent skillthat automatically generates relevant graph queries from natural language questions, retrieving answers directly from the knowledge graph—for example, regarding specific table access or module dependencies. Additionally, a UI dashboard is available to visualize, search, and filter the knowledge graph. Furthermore, migration candidates can be automatically generated based on natural language queries and descriptions, serving as the basis for creating specifications and significantly simplifying the planning of the incremental migration.

This toolchain provides the transparency needed to plan the target architecture with confidence.

Results & Business Impact

By leveraging the AI-powered analysis toolchain, the company gained transparency into its complex legacy business logic and extensive system dependencies. The previously poorly documented codebase was structured into a code knowledge graph, making hidden dependencies visible and allowing the business logic to be extracted as a specification. Instead of a high-risk "big bang" project, this created a solid foundation for a step-by-step modernization. In addition, the spec-driven migration approach was validated through prototypes on specific modules.

Table of contents
Branche
Services
Thema
Agentic AI
Generative AI
Large Language Models (LLMs)
AI-Assisted Software Development
Natural language processing
Dauer
3 months
Share now
Link kopiert!
Dr. Jürgen Stumpp

Ready for the next step?

Let's find out together how we can support your business with customized AI.

Dr. Jürgen Stumpp
Managing Partner | AI Strategy Consultant
+49 170 9374842
Contact us