- Updated: August 18, 2026
- 7 min read
An Agentic Workflow for Legacy HPC Modernization: Converting the Two-Electron-Integral Core of GAMESS

Direct Answer
The paper introduces an agentic workflow that lets specialized AI agents autonomously modernize massive legacy Fortran 77 codebases, demonstrated by converting the two‑electron‑integral core of the GAMESS quantum‑chemistry package to modern free‑form Fortran 2008. This matters because it proves that production‑scale, safety‑critical code migration can be delegated to AI while preserving scientific correctness down to the last decimal place.
Background: Why This Problem Is Hard
High‑performance computing (HPC) in scientific domains still relies heavily on code written in Fortran 77, a language whose fixed‑form syntax and dated idioms hinder maintainability, compiler optimizations, and integration with modern tooling. The challenges are threefold:
- Volume and complexity: Mature packages such as GAMESS span decades of development, accumulating millions of lines across hundreds of modules.
- Risk of regression: Scientific software must reproduce reference results exactly; even a tiny numerical drift can invalidate published findings.
- Lack of automation: Traditional refactoring tools handle syntactic changes but cannot guarantee domain‑specific correctness without human‑in‑the‑loop verification.
Existing approaches—manual rewrites, semi‑automated scripts, or generic transpilers—either demand prohibitive engineering effort or sacrifice the rigorous validation required by the scientific community. Consequently, many legacy HPC codes remain untouched, limiting performance gains from new architectures and increasing technical debt.
What the Researchers Propose
The authors present a self‑governing, agentic workflow that orchestrates three Claude‑based “Code” agents, each specialized through prompt engineering, to perform end‑to‑end code modernization under a version‑controlled specification. The key components are:
- Specification repository: A Git‑style ledger that records the desired target language features, coding standards, and verification criteria. The agents themselves can propose and revise this spec, creating a living contract.
- Three specialized agents:
- Parser Agent – extracts syntactic and semantic information from the legacy Fortran 77 sources.
- Transformer Agent – generates free‑form Fortran 2008 code, applying modern constructs (modules, implicit‑none, assumed‑shape arrays, etc.).
- Validator Agent – runs an exact verification oracle (the GAMESS test suite) to confirm bit‑for‑bit numerical identity.
- Human gates: Minimal checkpoints where a human reviewer authorizes merges only when the oracle reports zero deviation.
This architecture treats the specification as the “boundary of safe delegation.” As long as the oracle can certify equivalence, the agents may proceed without further human intervention.
How It Works in Practice
The workflow unfolds in a series of isolated worktrees, each representing a snapshot of the codebase under transformation. The process can be visualized as a loop:
- Initialize: Clone the legacy GAMESS repository into a fresh worktree. Load the version‑controlled spec that declares the target Fortran 2008 style.
- Parse: The Parser Agent scans each of the twelve source files (totaling 56,448 lines) and produces an abstract syntax tree (AST) enriched with domain annotations (e.g., electron‑repulsion integral subroutines).
- Transform: The Transformer Agent consumes the AST, rewrites fixed‑form statements into free‑form syntax, replaces obsolete intrinsics with modern equivalents, and injects module boundaries. Prompt‑level constraints ensure that the generated code respects GAMESS’s naming conventions and performance‑critical loop structures.
- Validate: The Validator Agent compiles the new files, runs the full 51‑test validation battery (49 official GAMESS tests plus two custom calculations), and compares output energies to the canonical reference down to the twelfth decimal place.
- Gate & Merge: If the oracle reports perfect agreement, the changes are automatically merged into the main branch; otherwise, the human gate is triggered for manual inspection.
- Iterate: The agents repeat the cycle for the next worktree, progressively covering all 225 subroutines.
What distinguishes this approach from prior automation attempts is the tight coupling of domain‑specific verification with the agents’ autonomy. The agents are not merely generating syntactically correct code; they are continuously validated against a scientific oracle that defines the exact point where delegation must stop.
Evaluation & Results
The authors evaluated the workflow on the two‑electron‑integral core of GAMESS, a component responsible for computing electron repulsion integrals—a computational hotspot in quantum chemistry. The evaluation criteria were:
- Coverage: All twelve source files (56,448 lines, 225 subroutines) were processed.
- Correctness: The validation suite comprised 51 tests, executed across 612 individual runs (including CI builds).
- Regression tolerance: Any deviation beyond the twelfth decimal place in the printed energies was considered a failure.
Key findings:
Every transformed file passed the full test battery, and across 612 test runs the number of chemistry‑relevant differences was zero. Additionally, all files satisfied the Jenkins CI checks used by the GAMESS development team.
These results demonstrate that the agentic workflow can achieve production‑grade fidelity while eliminating the manual labor traditionally required for such a migration. The fact that the agents spanned four generations of Claude models further indicates robustness to model evolution.
Why This Matters for AI Systems and Agents
For AI practitioners and system designers, the study offers several actionable insights:
- Safety‑first delegation: By anchoring autonomy to an exact verification oracle, developers can grant agents broader authority without sacrificing correctness—a pattern applicable to any safety‑critical domain (e.g., finance, autonomous vehicles).
- Prompt‑engineered specialization: The three‑agent split shows how prompt design can create role‑specific expertise, reducing hallucination risk and improving output quality.
- Version‑controlled specifications as contracts: Treating the spec as a mutable yet auditable artifact enables continuous improvement and traceability, aligning with DevOps best practices.
- Scalable orchestration: The isolated worktree model mirrors container‑based CI pipelines, suggesting that existing Workflow automation studio tools can adopt the same pattern for other legacy migrations.
- Economic impact: Automating code modernization reduces engineering headcount, shortens time‑to‑feature, and extends the usable life of high‑value scientific software.
What Comes Next
While the results are compelling, several limitations and open challenges remain:
- Generality across domains: GAMESS provides a well‑defined test suite; many legacy codes lack such exhaustive oracles. Future work must explore surrogate verification (e.g., property‑based testing) to broaden applicability.
- Model dependency: The workflow relied on Claude’s code‑generation capabilities. As model architectures evolve, maintaining prompt stability and output consistency will require systematic benchmarking.
- Scalability to larger codebases: Extending the approach to multi‑gigabyte repositories will demand more sophisticated dependency analysis and parallel agent orchestration.
- Human‑in‑the‑loop ergonomics: Reducing the cognitive load of gate reviews—perhaps through visual diff tools or automated rationale generation—could further accelerate adoption.
Potential next steps include:
- Applying the workflow to other long‑standing HPC packages such as NWChem or CP2K.
- Integrating the agents with the Enterprise AI platform by UBOS to provide a turnkey modernization service for corporate research labs.
- Leveraging Chroma DB integration to store and query transformation histories, enabling reproducible audits.
- Exploring cross‑model ensembles (e.g., Claude + OpenAI ChatGPT) to improve robustness, as discussed in the OpenAI ChatGPT integration guide.
Addressing these challenges will move the field from isolated case studies toward a generalized, AI‑driven modernization ecosystem.
Conclusion
The agentic workflow showcased in the paper proves that AI agents, when bounded by a rigorous verification oracle and a version‑controlled specification, can safely and accurately modernize a substantial portion of a legacy HPC codebase. By converting GAMESS’s two‑electron‑integral core from Fortran 77 to Fortran 2008 without any chemistry‑relevant regression, the authors set a new benchmark for production‑scale code migration.
For computational chemists, HPC engineers, and technical managers, this work signals that the era of manual, error‑prone refactoring is ending. Leveraging similar agentic pipelines—potentially through the UBOS platform overview—can unlock performance gains, improve maintainability, and future‑proof scientific software investments.
Ready to explore AI‑driven code modernization for your organization? Contact the UBOS team today to discuss a pilot project.
References & Further Reading
- Original arXiv paper: An Agentic Workflow for Legacy HPC Modernization
- About UBOS
- UBOS templates for quick start
Andrii Bidochko
CTO UBOS
Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.