Modernising Legacy Systems With AI Tools: Where It Speeds Up and Where It Breaks Business Logic
Short answer (December 2026). AI tools make the mechanical part of a modernisation dramatically faster: in Google's internal code migrations, 80% of the changes were written by AI and engineers estimated the total time was cut by half, and Airbnb moved about 3,500 test files to a new framework in six weeks instead of the estimated year and a half. Business logic is a different matter. In a 2026 case study, an AI coding agent migrating an ERP system from Visual Basic 6 to C# reproduced 92% of the behaviour of simple features but only 47% of complex ones, and Gartner expects more than 70% of mainframe exit projects started in 2026 to miss their goals because generative AI was overestimated. The approach that works: pin the existing behaviour with tests before anything changes, modernise in slices while the old system keeps running, let AI do the mechanical work, compare old and new on real inputs, and let people, not the model, decide every business rule. Deadlines make it urgent: mainstream maintenance for SAP ECC ends in 2027, and so do the main obligations of the Cyber Resilience Act.
This guide is for CTOs and IT leaders of companies with systems that are ten, twenty or thirty years old: what AI changes in a modernisation project, where it fails, and a method that keeps the rules the business depends on.
Why modernisation is on the agenda now
In a Lünendonk survey of German companies published in July 2025, 62% said parts of their business-critical applications were so outdated that they no longer met requirements, and 83% planned to increase their modernisation budget in 2026. McKinsey found that CIOs estimate technical debt at 20 to 40% of the value of their entire technology estate, and that 10 to 20% of the budget meant for new products is diverted to dealing with it.
Several deadlines turn the pressure into dates:
| System or rule | Date | What it means |
|---|---|---|
| Windows 10 | ended 14 October 2025 | no free security updates; paid extended updates get more expensive every year |
| PHP 8.1 / 8.2 | 31 December 2025 / 31 December 2026 | no security fixes after these dates |
| Django 4.2 LTS | April 2026 | the long-term support release is out of support; 5.2 LTS runs to April 2028 |
| Python 3.10 | October 2026 | end of life |
| .NET Framework 4.6.2 | 12 January 2027 | end of support; 4.7 to 4.8.1 follow the Windows lifecycle |
| SAP ECC (Business Suite 7) | end of 2027 | end of mainstream maintenance; optional extended maintenance to 2030 at a premium |
| Cyber Resilience Act | 11 December 2027 | main obligations for products with digital elements sold in the EU, including security updates for at least five years |
Where AI speeds things up
The strongest evidence comes from large migrations with an automatic way to check the result:
- Google used language models for internal code migrations, such as changing integer types across a huge codebase and moving tests from JUnit 3 to JUnit 4. In the integer migration, 80% of the code changes that landed were fully written by AI, and engineers estimated the total time was cut by about half. Every change was still reviewed by people.
- Airbnb migrated about 3,500 test files from Enzyme to React Testing Library in six weeks, against an estimate of a year and a half. The pipeline ran each file through the tests, the linter and the type checker and retried until they passed; 97% were done after four days, the last 3% by hand.
- Amazon says its AI assistant cut the time to upgrade an application to Java 17 from about 50 developer-days to a few hours and saved the equivalent of 4,500 developer-years. That is a vendor's own claim.
- Morgan Stanley reported that its internal tool reviewed nine million lines of legacy COBOL and PL/I in 2025 and turned them into plain-English specifications, saving an estimated 280,000 hours; engineers then wrote the new code themselves. Here AI read the old code rather than rewriting it.
The pattern is consistent: the big gains come where the work is mechanical and a machine can tell whether the result is right. Reading old code, explaining it and mapping its dependencies is the other strong area, because people verify the result before anyone acts on it. In the Lünendonk survey, only 8% of German companies used advanced AI code analysis for modernisation.
Where AI breaks business logic

Legacy systems are full of rules that exist only in the code: a rounding step in a price calculation, a fiscal year that starts in April, a save that also locks a record for the warehouse, an exception that a nightly job catches and turns into an e-mail. A model that rewrites the code produces something that compiles and looks cleaner, and quietly changes one of these rules.
The evidence for this is now specific:
- The VB6 case study. Researchers used an AI coding agent to migrate twelve features of a corporate ERP system from Visual Basic 6 to C# .NET 10. On average the new code was 70% functionally equivalent: 92% for low-complexity features, 47% for high-complexity ones. The complex features are where the business logic lives.
- Gartner's warning. In June 2026 Gartner predicted that more than 70% of mainframe exit projects started that year will fail to deliver the intended benefits because of an overestimation of generative AI tooling, and that 75% of vendors selling mainframe exits will change or end their business model by 2030.
- Code quality trends. GitClear's 2026 analysis of 623 million code changes found that changes to code last touched more than a year ago fell by 74% since 2023, while duplicated blocks rose by 81% and constructs that mask errors by 47%. Teams add new code instead of improving old code, which is the opposite of what a modernisation needs.
- Security. In Veracode's 2026 report, AI-generated code passed security checks in 56% of cases, essentially unchanged from a year earlier, although it was syntactically correct almost every time. Java, the language of many enterprise legacy systems, had the lowest pass rate: 30%.
- Stability. Google's DORA research found in 2024 that a 25% increase in AI adoption was associated with a 7.2% decrease in delivery stability; the 2025 report still sees a negative link to stability and describes AI as an amplifier of what a team already does.
- Speed is not guaranteed either. In METR's 2025 randomised trial, experienced developers took 19% longer with AI tools on their own mature codebases, while believing they had been faster. A February 2026 update with newer tools points to a speed-up, but METR itself calls those figures unreliable because many developers refused to work without AI.
A method that keeps the business rules

- Inventory. What runs, who and what calls it, which data and interfaces it touches, which batch jobs depend on it. AI is good at the first draft: reading the code, listing entry points and dependencies, explaining what a module seems to do. People confirm it, especially the parts nobody remembers.
- Pin the behaviour. Before any change, write characterisation tests, a term from Michael Feathers: tests that record what the code actually does today, not what anyone thinks it should do. Add recorded real inputs and outputs from production, with personal data removed. AI writes these tests quickly; the important part is that they pass against the old code.
- Cut a slice. Replace the system piece by piece behind a facade, so the old system keeps running and serving everything not yet moved. Martin Fowler calls this the strangler fig pattern. A big-bang rewrite gives AI the most room to break things unnoticed.
- Rebuild with AI. For each slice, the model writes the new code, and the pinned tests decide whether it is done. A test that fails is information, not an obstacle: either the new code is wrong or the old behaviour was a bug, and a person decides which.
- Compare. Run old and new on the same production inputs and compare the outputs, for days or weeks depending on how often the rare cases occur. Every difference gets an explanation before the switch.
- Switch and remove. Move traffic to the new slice and delete the old code. A modernisation that never deletes anything ends up running two systems.
The rules we work by
- No behaviour change without a failing test first. If a rule is to change, the test changes first and someone signs off why.
- The model never decides a business rule. When the code and the documentation disagree, or the code does something that looks wrong, a person who owns the process decides. The model may point it out; it may not "fix" it.
- Every rule found goes into a test and a document. Modernisation is the one chance to recover the knowledge that left with the people who wrote the system.
- Small changes, human review. AI produces large diffs easily; reviewers can only judge small ones.
- Security checks on AI-written code, with the same tools and gates as for human code, and stricter for languages with known weak spots.
- The old system stays runnable until the comparison is clean, so going back is a configuration change, not a project.
The Cyber Resilience Act and legacy products
For companies that sell software or devices with software, modernisation now has a regulatory side. The CRA's reporting duty for actively exploited vulnerabilities applies since 11 September 2026 to all products on the EU market, old ones included. The full requirements apply from 11 December 2027 to products placed on the market from then on, and to older products only after a substantial modification. A large rewrite of a product you sell may count as one, so plan the modernisation together with the CRA requirements, including at least five years of security updates. Our guide to the CRA reporting duty and the compliance calendar 2026–2028 cover the details.
Where to start
- List systems by business risk and deadline: which ones run out of support first, which carry money, safety or compliance.
- Pick one well-bounded slice with clear inputs and outputs for the first round.
- Record real inputs and outputs for that slice before touching the code.
- Let AI draft the inventory and the characterisation tests; have the process owners confirm them.
- Rebuild the slice with AI under those tests, compare in parallel, switch, delete.
- Measure what matters: behaviour differences found and explained, time per slice, defects after the switch.
How we can help
We take on modernisation projects as a team or as CTO as a service, starting with an architecture review of the existing system: what runs, what depends on it, where the business rules hide and which slice to move first. If the system in question was itself built quickly with AI tools, our article on auditing, refactoring or rewriting an AI-built MVP covers that case.
FAQ
Can AI migrate a legacy system automatically?
Not end to end. AI handles mechanical, testable work very well, such as version upgrades, repetitive refactoring and test migrations. Business logic is where it fails: in a 2026 study, an AI agent reproduced 92% of the behaviour of simple ERP features but only 47% of complex ones.
How much faster is a modernisation with AI?
For mechanical migrations with automatic checks, much faster: Google estimated half the time for one migration, Airbnb needed six weeks instead of a year and a half for a test migration. For the whole project, the gain depends on how much of the work is mechanical and how well the existing behaviour is pinned by tests.
What is a characterisation test?
A test that records what the existing code actually does, including its odd behaviour, rather than what a specification says. It protects the business rules hidden in the code while the code is replaced.
What is the strangler fig pattern?
Replacing a legacy system gradually: new code takes over one slice at a time behind a facade, while the old system keeps serving everything else, until nothing is left of it.
Should we rewrite our legacy system from scratch with AI?
Rarely. A full rewrite gives AI the most room to change business rules unnoticed and delivers value only at the end. A slice-by-slice replacement with pinned tests and parallel comparison is slower to start and much safer.
Does the Cyber Resilience Act apply to legacy software?
Its reporting duty for actively exploited vulnerabilities applies since 11 September 2026 to all products on the EU market. The full requirements apply to older products only after a substantial modification, which a large rewrite may be.
Sources
- Lünendonk, IT-Modernisierung zwischen Legacy, Cloud und KI: press release, July 2025
- McKinsey, Tech debt: Reclaiming tech equity
- Google, How is Google using AI for internal code migrations?, January 2025
- Airbnb Engineering, Accelerating large-scale test migration with LLMs, 2025
- Simon Willison, Andy Jassy on Amazon Q Java upgrades, August 2024
- Slashdot, Morgan Stanley's AI tool reviewed nine million lines of legacy code, June 2025
- Alves, Politowski, Montandon, Legacy System Modernization with Coding Agents: A Case Study, August 2026
- CIO Dive, Gartner: mainframe exit plans at risk as leaders overestimate AI, June 2026
- GitClear, The AI code quality maintainability gap, 2026
- Veracode, 2026 GenAI Code Security Report, July 2026
- Google Cloud, 2024 DORA report and 2025 DORA report
- METR, Early-2025 AI and experienced open-source developer productivity, July 2025, and Uplift update, February 2026
- Martin Fowler, Strangler Fig Application and Patterns of Legacy Displacement
- InfoQ, Characterization testing, on Michael Feathers' method
- SAP News, SAP S/4HANA maintenance until 2040, clarity for SAP Business Suite 7, February 2020
- Microsoft, Windows 10 lifecycle and .NET Framework lifecycle; PHP, supported versions; Python, version status; Django, supported versions
- European Commission, Cyber Resilience Act
Categories
About the author
Share
Need a project estimate?
Drop us a line, and we provide you with a qualified consultation.