Mistral AI Modernizes Fortran Code with AI Agents

At a Glance
| Item | Value |
|---|---|
| Publisher | Mistral AI |
| Source type | Primary source (the publisher itself) |
Values determined by this site’s code at collection time. Dates are JST.
Overview
On September 9, 2026, Mistral AI announced a case study detailing the migration of legacy Fortran 77 code to modern C++ using AI agents. The project successfully migrated approximately 40,000 lines of code for a large-scale reservoir simulator involving physical calculations held by a European energy company.
Announcement Details
Rather than performing a mere syntactic translation, the project aimed to refactor the architecture from a procedural language to an object-oriented language. Mistral AI carried out the migration through the following processes:
First, to prove the correctness of the migration, a “parity harness" was built. This consists of a test framework designed to export the state from the Fortran side and read and verify those checkpoints on the C++ side. This ensured that the migrated code numerically matched the legacy code.
Next, the code was documented using AI agents. Based on call trees generated by a custom parser, over 100 agents were deployed. Using Mistral OCR and document libraries, information scattered across old PDFs and code comments was organized and placed alongside the code.
The actual migration workflow was optimized through the following three stages:
- Fully Autonomous: An attempt to translate each subroutine individually. While functional, the results remained merely a syntactic translation of Fortran into C++, such as COMMON blocks turning into global structs.
- Role-Divided: An attempt to assign agent roles including planner, coder, tester, and code quality reviewer. Quality improved significantly, but agents faced stagnation issues when encountering complex bugs.
- Human-in-the-Loop (Adopted Approach): A workflow where humans managed the execution of coder, tester, and reviewer agents. Human intervention at checkpoints prevented agent stagnation while maintaining high code quality.
Background
Legacy scientific codebase repositories often accumulate over decades, and when original developers leave, it becomes difficult to recover the knowledge embedded in the code. Furthermore, continuing to use languages without an active developer ecosystem means missing opportunities to leverage the work of others for new development. This case study targeted a physics-centric Fortran 77 system lacking both a test suite and centralized documentation.
Impact on Local LLM Users
This announcement demonstrates the importance of operating AI agents not merely as “translators," but as part of a “structured workflow" that includes documentation and verification processes when migrating large codebases. The implications for engineers are as follows:
- Importance of Verification: Building a verification environment (parity harness) to confirm numerical consistency prior to code migration is key to safely advancing agent-based automation.
- Prioritizing Documentation: Organizing documentation before having agents understand the code directly correlates with migration success.
- Balance Between Autonomy and Control: Full autonomy risks resulting in “rewrites" with insufficient architectural overhaul. For complex tasks, a structure where humans intervene as workflow gatekeepers is reported to be effective in balancing quality and efficiency.
Note that this case study targeted a self-contained codebase with a runnable baseline, and did not discuss application to cases dependent on external systems or where physical laws are nowhere documented.
Related Articles
Sources
Update History
- 2026-09-19: Rewrote the article from re-collected sources and restored it from draft to published.

