Mistral AI has published details of a project migrating 40,000 lines of legacy Fortran 77 code to C++ for a European energy operator, offering lessons on using AI agents for large-scale code modernisation.
In a blog post published on 9 September, Mistral said the codebase, a physics-intensive reservoir simulator with no test suite or centralised documentation, presented particular challenges because Fortran 77's structure, including global COMMON blocks and implicit variable typing, does not map cleanly onto modern object-oriented C++. The company said it first built a "parity harness" to numerically verify that migrated code matched the original's outputs, calling this the most convincing proof that a module had been correctly converted.
Mistral said giving agents full autonomy to translate code independently produced functional but poorly structured results, which it described as "Fortran retyped in C++ syntax", while a rigid multi-agent workflow of planner, coder, tester and reviewer agents improved code quality but stalled when agents hit bugs they could not resolve. The company said it settled on a middle ground: a human operator overseeing coder, tester and reviewer agents, migrating the system module by module with human review gates before each merge.
The first phase of the project covered 40,000 of the codebase's 300,000 total lines. Mistral said the three principles it would carry forward to future legacy migrations were building a parity harness before writing migration code, organising documentation before relying on agents, and using structured workflows with human review rather than full autonomy or manual coding.
