
AI in the migration of the railway mission-critical system
Executive Summary
One of Brazil's largest railway operators relied on a mission-critical system to control train traffic in a busy region of its national logistics operation.
The system's complexity, difficulty in maintenance, and integration indicated the need for modernization, but the operation could not stop.
To ensure the system's long-term sustainability and a gradual transition, Squadra was chosen as the digital partner to perform a Technological Migration (Lift-and-Shift), using AI through its Genius platform as a cognitive accelerator and amplifier for the team, allowing code modernization (as-is) and testing to be completed in just 90 days.
What would have been a manual migration taking years was completed in months using AI, with security, speed, and zero incidents after migration, resulting in a more modern, flexible architecture aligned with the operation's future demands.
The Challenge
The system controlled train traffic on one of the busiest railway sections in the country. Despite its high value to the operation, the technological challenge was significant:
1 Critical Dependency: the mission-critical system's maintenance was concentrated in a single small company, lacking the response and evolution capacity compatible with the operation's scale.
2 Undocumented Technical Complexity: the system was developed in C++ over a decade ago, with more than 300K lines of undocumented code. Furthermore, the company lacked a technical team with in-depth knowledge of the legacy system.
3 Validation Nearly Impossible: the core component processed everything in memory and altered the database with each execution. This required an innovative testing strategy. Any conventional testing approach was unfeasible. It was essential to ensure technological evolution without compromising current functional performance; any error could cause an irreversible accident.
The Solution
Genius AI Modernization in action: AI-assisted modernization for mission-critical systems
Evolve & Transform with AI
The journey was guided by Genius AI Modernization, using AI and specialized agents to transform the knowledge present in the legacy system into a technology base prepared for evolution.
The "software archaeology" approach used AI techniques to explore C++ code, extract rules, and understand the internal logic. AI assisted in source code analysis, documentation generation, dependency mapping, and modularization.
Discovery with Genius: opening the black box
The system understanding process was conducted with intensive support from AI tools. Two specialized artificial intelligence agents (Turing Bots) were created for this phase:
C++ Code Instrumenter: inserted logs into the legacy code to understand, at runtime, which parts of the system were actually used and how they behaved.
Log Visualizer: graphically analyzed the generated logs, making the system's actual flow visible – what the code actually did, not what it was supposed to do.
Design with AI: pattern-guided architecture
With the system understood, the design phase was conducted with the support of AI assistants specialized in architectural patterns. Fed with the knowledge extracted during Discovery, these assistants created diagrams and technical specifications, accelerating solution design, ensuring adherence to best practices, and reducing rework in subsequent phases.
Build with AI: from C++ to .NET at scale
With the map in hand, two other Turing Bots went into action during the build phase. The approach combined agent networks, LLMs, RAG, and specialized tools to support the migration strategy, code generation, and validation, with intervention from the development team when necessary:
Dependency Analyzer: mapped the complex relationships between the legacy code classes, enabling an incremental and secure migration plan.
Jack (Mass Migration): the core tool, responsible for translating C++ code to C# (.NET), applying semantic analysis, architectural pattern extraction, and advanced generative models. The solution was structured as an agent network, combining different specialists and knowledge bases to accelerate migration at scale.
Customized Testing: validating the impossible
To overcome validation challenges, the team developed its own AI-assisted testing tools. The QA strategy was structured to compare the behavior of the legacy and new systems under the same conditions and inputs, with traceability of discrepancies:
Spreadsheet Comparator (integrators): a utility that automatically cross-referenced data exported from the old and new databases, accurately listing discrepancies.
Genius DataCompare: a data validation solution for gray-box functional testing at the system level, which automates detailed data comparison between different executions, identifying discrepancies and missing information.
Validation followed a root cause analysis, correction, and confirmation flow for each identified discrepancy.
The solution required more than just AI tools; it demanded a deliberate strategic decision on how to tackle the problem. The Squadra team adopted a counterintuitive approach: starting with the simplest components and leaving the system's "heart" for last.
This inversion was intentional. Each partial delivery built confidence, gave the Genius team time to mature its own AI tools, and aligned the collaborative work processes, making the most critical phase much smoother when the time came.
Results
AI as an accelerator: Genius was strategically used in every project phase: discovery, design, and build, accelerating deliveries and ensuring quality. Its application was crucial in meeting the challenging 90-day deadline, compressing months of work into weeks. The approach also enabled the development of robust functionalities with calculated ROI and greater agility for the future roadmap.
AI as an accelerator: Genius was strategically used in every project phase: discovery, design, and build, accelerating deliveries and ensuring quality. Its application was crucial in meeting the challenging 90-day deadline, compressing months of work into weeks.
Technology base prepared for evolution: with 100% of users already on the migrated version, the new system now supports a highly complex operation, with over 90 terminals, +700 locomotives, and 1,643 km of railway network, built on a more modern architecture prepared for integration, roadmap evolution, and new operational capabilities.
Modernized operation at scale: with 100% of users already on the migrated version, the new system now supports a highly complex operation, over 90 terminals, +700 locomotives, and 1,643 km of railway network, built on a clean, documented, and independent foundation.
Metric
Result
Core component migration with Genius
From 9 months (traditional methods) to approximately 1 week
Reduction in code volume
70% less — from 1,300 to 400 functions
System delivered
Cleaner, documented, and independent
Total delivery timeframe
90 days
Code volume produced
300 thousand lines
Adoption of the new version
100% of users on the migrated version
Modules delivered
4 modules
Operational coverage
+90 terminals, +700 locomotives, 1,643 km of railway network
Migration acceleration with Genius
36x faster
Testimonials
Without Genius, it would have been impossible to perform the code migration in 90 days.
Liliane Braga
Delivery Manager de uma grande operadora ferroviária
A system developed with current technology, designed to evolve, connect, and communicate with other systems, creating space for more integration, more accessible data, more efficient processes, and increasingly intelligent operations.
Fernando Germano
Especialista em Operações Ferroviárias na MRS Logística
AI has allowed us to modernize in a much safer, faster, and more economical way.
Haroldo Santos
Delivery Director na Squadra
Want results like these?
Talk to our experts and find out how AI can transform your business.

