9 Sep 2026
Mistral: AI agents migrate 40,000 lines of Fortran to C++
Mistral published a case study on helping an unnamed European energy operator migrate 40,000 lines of Fortran 77 to C++ in a physics-intensive reservoir simulator that had no test suite and no centralized documentation.
Mistral is unusually blunt that fully autonomous agents failed at real Fortran modernization. Useful for anyone selling “agents rewrite legacy code” without number-matching tests and human architecture gates.
Mistral published “Modernizing complex legacy code with AI agents,” by Carlo Antonio Patti and Rasul Alakbarli. The company describes helping a European energy operator migrate 40,000 lines of Fortran 77 to C++ in a physics-intensive reservoir simulator — software that models an underground reservoir — part of a roughly 300,000-line Fortran codebase. Fortran 77 is an old programming language still used in scientific code. The customer is unnamed. That news post is the primary.
The starting conditions on the post were no test suite and no centralized documentation. Mistral says knowledge was scattered in old PDFs and comments buried in the Fortran.
Before migration, Mistral says it built a numerical parity harness — a test that checks the new code’s numbers against the old — using Fortran state-export subroutines plus a C++ test framework that loads those checkpoints. Final outputs and critical intermediate points flagged by the client’s reservoir engineers could then be compared. Treat that as Mistral’s method claim.
On the documentation pass, Mistral describes a caller-callee tree from a custom parser and “over a hundred agents” via Vibe CLI documenting nodes and opening PRs (pull requests), pulling PDFs through document libraries and Mistral OCR (optical character recognition). Those are company figures and process.
The first attempt was full autonomy: one agent per Fortran subroutine for about a week. Mistral says the result was functional C++, but COMMON blocks became global structs one-to-one and GOTO-driven control flow stayed intact. COMMON and GOTO are old Fortran habits for sharing data and jumping around the program. The company calls it Fortran retyped in C++ syntax — not modernization.
The second attempt used a structured multi-agent setup: a planner, coder, tester, and code-quality reviewer per module improved quality, but Mistral says agents stalled on hard bugs with no human available to intervene.
The settled workflow on the page is a human operating coder, tester, and reviewer agents module by module. Reservoir engineers approve the target C++ architecture. Modules were kept under about 10,000 Fortran lines. Each task ran plan → implement → test loops; a human reviewed PRs and requested changes until merge.
The first sprint covered 40,000 of about 300,000 lines — core functionality. The post does not give a duration, production-cutover status, deal size, or customer name.
Three lessons Mistral lists: build the parity harness before writing migration code; get documentation in order before leaning on the agents; at this scale, structured workflows with human review gates beat both full autonomy and hand-driven manual sessions.