Modernizing complex legacy code with AI agents.
mistral ·
Mistral's Applied AI team helped a European energy operator modernize a legacy reservoir simulator by migrating 40,000 lines of Fortran 77 to C++. Before the migration, they built a parity harness to verify numerical equality of outputs between the old and new codebases. They also generated a caller-callee tree and used over a hundred AI agents, supported by Mistral OCR, to document the scattered legacy knowledge and move it next to the code. The team found that fully autonomous agent translation produced only superficial modernization—essentially Fortran rewritten in C++ syntax—while structured workflows with planner, coder, tester, and reviewer agents, plus human checkpoints, worked best. The first sprint covered core functionality, migrating 40,000 of the total 300,000 lines. Three key lessons were emphasized: build the parity harness first, organize documentation before relying on agents, and use structured workflows with human review gates rather than full autonomy or manual sessions. The authors noted that the codebase's self-contained and runnable nature made the migration favorable, while external dependencies or undocumented physics would introduce additional challenges.
mistral