Mistral used AI agents to modernize 40,000 lines of Fortran 77 code for a European energy operator in 2026, ensuring numerical parity with the legacy system. The migration involved translating a physics-intensive reservoir simulator from a procedural language to object-oriented C++.
The project faced challenges due to the outdated nature of Fortran 77, which lacked modern features like modules, namespaces, and structured types. State was managed through COMMON blocks, and variable names were limited to six characters, making the code difficult to understand and maintain.
To address these issues, Mistral built a parity harness that allowed agents to export the state of the Fortran codebase and use a test framework to verify correctness in C++. This approach made long agent runs safer and provided a clear way to validate the migration.
"We first inserted a line into the Fortran code to dump the value of the RHOG variable, and then used that same value as the reference checkpoint when testing the migrated C++ module," said a Mistral engineer. The team used this method to ensure numerical agreement between the legacy and modern codebases.
The migration process involved a structured workflow where human reviewers checked the work of AI agents, ensuring code quality while allowing for autonomy in the translation process. Mistral did not say how long the migration would take in total, and noted that the complexity of the codebase could pose challenges for future projects.
Source: mistral