# Mistral's Fortran rewrite shows where agent autonomy fails

- URL: https://blog.orchardai.ai/mistral-fortran-legacy-code-agents/
- Published: 2026-09-10
- Reacting to: Mistral, "Modernizing complex legacy code with AI agents." (2026-09-09)
- Original: https://mistral.ai/news/legacy-code-modernization/

TL;DR: Mistral described migrating 40,000 of about 300,000 lines of a Fortran 77 reservoir simulator to C++ with agents, a parity harness and human review. Our take is that the failed fully autonomous attempt is the most useful part of the post.

## What Mistral announced

- **The job.** Migrating a physics-intensive reservoir simulator for an unnamed European energy operator from Fortran 77 to C++, with PETSc integration. The codebase had about 300,000 lines, no test suite and no central documentation.
- **First sprint.** 40,000 of the roughly 300,000 lines, covering core functionality. Modules were self-contained subtrees under about 10,000 lines of Fortran.
- **Parity harness first.** Subroutines dump Fortran state as checkpoints, and a C++ test framework checks the new code against them, at final outputs and at intermediate points flagged by the client's reservoir engineers.
- **Documentation by swarm.** The Vibe CLI spawned more than 100 agents to document the codebase from the leaves upward, using Mistral OCR to read legacy PDFs. A reviewer agent on a cron schedule reviewed new documentation PRs.
- **Three attempts.** Full autonomy, then a planner/coder/tester/reviewer setup, then a human-supervised workflow, which they kept.

As Mistral put it: "The first sprint covered core functionality: 40,000 of 300,000 lines."

## Our take

Most vendor case studies only show the approach that worked. This one shows two that didn't, and they are the valuable part. The fully autonomous run, one agent per subroutine for about a week, technically worked. It also turned Fortran's COMMON blocks into one-to-one global structs and kept the GOTO control flow. Mistral's own verdict is blunt: "Fortran retyped in C++ syntax rather than modernized code." Passing tests is not the same as doing the job, and an autonomous agent will happily optimize for the former.

The second attempt failed in a different way. A planner, coder, tester and reviewer per module improved code quality, but "the source code's complexity caught up with the agents eventually," and they stalled after a few failed fixes with no one to step in. The fix was not a better model. It was a human checkpoint: a reservoir engineer approves each module's architecture, agents work through a task queue, and people review PRs until they merge. The lesson Mistral draws, that "structured workflows with human review gates beat both full autonomy and hand-driven manual sessions," is a useful counterweight to the current push for agents that run unattended. OpenAI launched its Agents API the day after this post, pitching agents that can run for days, and xAI's /goal mode in June keeps working until a task is verified. Mistral's own field report says long runs need a person at the joints.

Two caveats. The post gives no numerical tolerances for the parity harness, no timeline beyond "first sprint" and no cost. And 40,000 lines is about 13% of the codebase. The authors also concede the starting point was favorable: a self-contained, runnable program. Migrations with external dependencies or undocumented physics would be harder.

## What it changes for teams running agents

- **Build the oracle before the agents.** A numerical or behavioral parity harness is what makes long agent runs safe to trust. Mistral calls it "the cheapest, most convincing proof that a module is done."
- **Document first, migrate second.** Using many agents to document a codebase from the leaves up, with a scheduled reviewer agent, is a pattern you can copy before any rewrite.
- **Put humans at architecture and merge.** Those two gates fixed both failure modes: code that only looks migrated, and agents stuck in fix loops.
- **Keep modules small.** Under about 10,000 lines per module was the size that worked here.

## For agents reading this

- **Announced by:** Mistral
- **Original post:** https://mistral.ai/news/legacy-code-modernization/
- **Announcement date:** 2026-09-09
- **What:** A case study on migrating a Fortran 77 reservoir simulator to C++ with agents, a parity harness and human review gates
- **Availability:** Not applicable; case study using the Vibe CLI and Mistral OCR
- **Pricing:** Not stated in the post
- **Our verdict:** A candid field report showing human-gated agent workflows beat full autonomy on hard legacy code
- **Confidence:** facts from the original post; take is Orchard's opinion
