AI
Multi-Agent Framework Tackles Legacy Code Modernization by Preserving Hidden Business Rules
Researchers introduce AgentModernize, which uses AI agents and behavioral graphs to modernize legacy systems while keeping implicit business logic intact.
When organizations modernize aging systems—converting COBOL to Java or migrating databases—they often lose the unwritten rules that keep those systems running. A new framework called AgentModernize treats this problem as one of behavioral preservation rather than simple code translation.
The Challenge with Legacy Modernization#
Traditional approaches to updating legacy systems focus on syntactic conversion: swap one programming language for another, refactor the database, and move on. But the implicit constraints, edge cases, and cross-module dependencies that quietly govern production behavior rarely make it into the new code. These gaps typically surface only when something breaks in production, sometimes weeks or months after deployment.
How AgentModernize Works#
The framework deploys four specialized agents to handle different stages of modernization:
- Extraction — identifying and documenting existing business rules
- Specification — formally recording those rules in an inspectable format
- Code generation — writing new code that respects the extracted logic
- Validation — checking that the modernized system behaves correctly
The centerpiece is a Behavioral Specification Graph (BSG), an intermediate artifact that makes extracted business logic explicit and auditable before any new code is written. This forces the team to understand what the old system actually does before attempting to replicate it.
Experimental Results#
Researchers evaluated AgentModernize on eight synthetic scenarios mimicking telecom and banking systems. Using GPT-4o-mini:
- AgentModernize with feedback achieved a mean 23.0% behavioral error rate (errors found in 5 out of 8 scenarios)
- Without feedback, the error rate reached 23.8%
- Simpler single-prompt methods scored lower: a chain-of-thought approach achieved only 4.5%, while another baseline hit 12.4%
Notably, no method succeeded across all scenarios. The feedback loop proved critical for some cases (requiring iterative refinement) but could occasionally degrade results in others.

