# How We Mapped a 35-Million-Line Mainframe in 4 Days - Stephen Chin, Neo4j & Neeraj Deshmukh, Blitzy

## Executive summary

The talk addresses the challenge of modernizing decades-old, mission-critical mainframe systems (e.g., those running COBOL) that underpin modern finance. Traditional AI approaches fail because they cannot capture the full, complex context—including batch jobs, data layouts, and interdependencies—where business logic is used. The solution presented is mapping the entire codebase into a Knowledge Graph. This graph provides AI agents with multi-hop, accurate context, enabling the safe, automated, and fully validated migration of massive codebases (up to 35 million lines) to modern stacks while preserving critical business behaviors, such as financial precision and rounding rules.

## Key takeaways

- The limitations of current AI context windows: AI models, even those with large token windows, are limited in usable context. The speakers argue that context is serial, but code information has relationships, necessitating a graph structure for accurate understanding.
- Knowledge Graphs enable 'infinite' code context: By mapping the entire software estate into a graph, the system provides agents with access to the right information at the right time, effectively acting as a compiler for the enterprise knowledge base.
- The modernization process is highly controlled and validated: The process requires human approval at every key decision point. Validation is continuous, involving testing at every stage of code generation, ensuring data parity (e.g., matching the 'golden mainframe baseline' output byte-for-byte), and preserving existing behaviors.
- Modernization leads to transformation: The knowledge layer built during modernization is not just for migration; it allows for subsequent development, such as adding new features (e.g., promotional rates) or implementing compliance checks (e.g., GDPR compliance), making the system more agile.

## Technical details

- Legacy Systems & Challenges: Modern finance relies on old systems (mainframes) running business rules and batch jobs. Changes are high-risk because logic is spread across multiple components (e.g., copybooks, VSAM data, batch contracts).
- Knowledge Graph Implementation: The codebase is mapped as a graph, where every edge retains its identity (source, revision, symbols touched). This graph is continuously updated on every merge to keep the context fresh.
- Agentic Workflow (Blitzy's Approach): Each agent receives a specific task context packet, including the task description, its location in the graph, constraints, and evidence. The process involves reverse engineering the estate, defining an agent action plan (reviewed by a human), code generation, and continuous validation.
- Validation and Parity Testing: Validation is critical and includes testing the baseline, equivalent testing on the modern system, and verifying inputs, outputs, persisted states, and error outcomes. The goal is to prove parity, especially for financial calculations (e.g., rounding differences between COBOL and Java).
- Modern Stack Example: A monolith with cross-database stored procedures was converted into six capability modules using a modern stack: PostgreSQL, Java, TypeScript, and Python.

## Practical implications

- Organizations can safely modernize massive, mission-critical legacy systems (e.g., 35-million-line mainframes) that were previously too risky to touch.
- The process shifts from simple code conversion to full system transformation, allowing for new feature development and compliance remediation on the modernized platform.
- The use of Knowledge Graphs ensures that AI agents maintain awareness of the entire system's dependencies, preventing the loss of critical business logic or state.

## Topics

Mainframe Modernization, Knowledge Graphs, AI Agents, COBOL, Software Architecture, Data Parity, Build Engineering, Neo4j, Blitzy, AIE CODE summit, Nodes conference

Source: https://www.youtube.com/watch?v=oWqsBuhRRZ4
