ImplementationAdoption story

Mistral migrated 40,000 lines of Fortran 77 with agents and a human gate

Mistral says agents moved 40,000 of 300,000 lines of a reservoir simulator to C++; full autonomy gave retyped Fortran, so it settled on human-gated workflows.

Mistral's Applied AI team published a write-up on September 9, 2026 of a legacy-code migration it ran for a European energy operator, which it does not name. The target was a physics-intensive reservoir simulator written in Fortran 77, with no test suite and no central documentation. Mistral says the first sprint moved 40,000 of the codebase's 300,000 lines to C++. The post is vendor-published, and it leaves out cost, elapsed time and the number of engineer hours.

Build the proof before the migration

Mistral's first step was a parity harness. Agents added subroutines that export the Fortran program's state, and a C++ test framework loads those checkpoints to compare outputs. "Agreement" meant numerical equality of final results and of intermediate points the client's reservoir engineers flagged. Mistral calls this a net-positive investment that made long agent runs safer, and says it should be one of the first steps of any such engagement.

Documentation by agent

The documentation was scattered across old PDFs and comments in the code. Mistral parsed the program into a caller-callee tree with a custom parser, then used its Vibe CLI to run more than a hundred agents that documented it from the leaves upward. Each agent opened a pull request to the original repository, and a reviewer agent on a cron schedule reviewed new pull requests and scheduled fix tasks.

Three attempts at the migration

  • Full autonomy: one agent per subroutine, each translating independently over a week. Mistral says the result worked but was not modernization: COMMON blocks became global structs one to one and GOTO-driven control flow stayed.
  • Structure: a planner, coder, tester and code-quality reviewer per module. Quality improved substantially, but the agents hit bugs, tried a few fixes and stalled with no one to intervene.
  • Middle ground: a human operating a coder, tester and reviewer workflow, module by module. Mistral chose independent subtrees of under about 10,000 lines of Fortran, had a reservoir engineer review each target architecture, and had a human review every resulting pull request until it merged.

What the post leaves out

There is no cost, no time per module and no defect rate after merge. The 40,000 lines are 13% of the codebase, and Mistral says the project began from favorable conditions: self-contained, runnable code. It says migrations that depend on external systems, lack a runnable baseline or encode physics documented nowhere would be harder, and it does not address them.

What a team can take from it

Mistral's three lessons are to build the parity harness before migration code, to organize documentation before leaning on agents, and to prefer structured workflows with human review gates over both full autonomy and hand-driven sessions. For a budget, that means planning for a domain reviewer and test scaffolding as line items, and treating agent-only runs as a way to find where the humans are needed.

Was this useful for your work?

Questions this article answers

How did Mistral use AI agents to migrate Fortran 77 to C++?

Mistral says it first built a harness to compare numerical outputs, documented the code with more than a hundred agents, then ran a human-operated workflow of coder, tester and reviewer agents module by module.

How much code did Mistral migrate in the Fortran project?

Mistral reports migrating 40,000 of 300,000 lines in the first sprint, for a reservoir simulator belonging to a European energy operator it does not name.

Did fully autonomous AI agents work for legacy code migration?

Not well enough, according to Mistral: its one-agent-per-subroutine run worked but kept Fortran structures such as COMMON blocks and GOTO control flow, and a structured agent team stalled on hard bugs without a human.

What does the Mistral Fortran migration post not say?

It gives no cost, elapsed time or post-merge defect rate, and it says harder cases such as code with external dependencies or undocumented physics are not covered.

Send this to someone who runs a teamLinkedInXBlueskyHNEmail