An Agentic Workflow for Legacy HPC Modernization: Converting the Two-Electron-Integral Core of GAMESS
A research paper proposes an agentic workflow for modernizing legacy Fortran code at production scale. The workflow uses three prompt-specialized agent roles operating under a version-controlled specification authored and revised by the agents themselves, with humans holding a small number of gates. An exact verification oracle inherited from the domain ensures safety. The workflow was applied to convert the two-electron-integral routines of GAMESS, a quantum-chemistry package with a 48-year development history, from fixed-form Fortran 77 to free-form Fortran 2008. The scope included twelve source files, 56,448 lines, and 225 subroutines for computing electron repulsion integrals. The agents ran as three Claude Code roles in isolated worktrees.
The paper describes an agentic workflow designed to modernize legacy Fortran codebases, which are often too large for manual transformation. Three specialized agent roles collaborate under a specification they authored and revised, with human oversight at key gates. Safety is maintained by an exact verification oracle from the domain, and the boundary of safe delegation is where the oracle stops seeing. The case study converted GAMESS's two-electron-integral core from Fortran 77 to Fortran 2008, covering 12 files, 56,448 lines, and 225 subroutines. The agents were implemented as three Claude Code roles in isolated worktrees.
The workflow leverages prompt-specialized agent roles and a version-controlled specification to handle routine code transformations at scale. The use of an exact verification oracle from the domain (likely comparing numerical outputs) ensures correctness, and the boundary of safe delegation is defined by the oracle's visibility. The case study demonstrates application to a large, mature codebase (GAMESS) with 56,448 lines and 225 subroutines, indicating the approach can handle substantial legacy code. The agents operate in isolated worktrees, suggesting parallel or isolated execution to manage complexity.
Legacy code modernization is a significant challenge in computational science, where codebases are large and transformations are routine but time-consuming. This agentic workflow could reduce the manual effort required for such modernization, potentially accelerating updates to scientific software. The use of Claude Code roles indicates a practical implementation using existing AI coding tools. The approach may be applicable to other legacy Fortran codebases in HPC and scientific computing.
The workflow could reduce the cost and time required to modernize legacy scientific software, which is often critical for maintaining and extending research capabilities. Organizations with large Fortran codebases (e.g., national labs, universities, HPC centers) could benefit from automated modernization. The approach may also be applicable to other legacy languages and domains, expanding its market potential.
Next signals to observe include whether the workflow is adopted by other legacy codebases, whether the verification oracle approach generalizes to other domains, and whether the agents can handle more complex transformations beyond syntax conversion. The paper may lead to further research on agentic code modernization and the limits of safe delegation. Potential commercialization could involve tools or services for legacy code modernization in scientific computing.