AI legacy code modernization moved from conference demos to product launches this week. On December 1, 2026, at AWS re:Invent, Pega launched Pega Surveyor, a set of AI agents built on AWS Transform that scan legacy estates and pull out the rules buried in COBOL, ABAP customizations and homegrown Java and .NET apps. Pega's head of legacy modernization put it plainly: "AI has fundamentally changed the risk calculus of legacy modernization." Earlier in the year, Thoughtworks described how a team of two, later three, used an AI coding assistant to rewrite an aging Angular dashboard and ship it to production in six weeks, against an original estimate of six months for a team of six.
If you own an old system that nobody wants to touch, that is good news with a catch. AI makes reading and rewriting code much cheaper. It does not make the rewrite correct. This guide is for CTOs and product owners who are planning to modernize with an outsourced team. It covers what AI changes, where people still have to decide, how to choose a route, the safety net to build first, and what to agree with the team before the work starts. We run this kind of work through our custom software development projects, so the advice comes from the delivery side.
Why AI changes the economics of modernization
Most legacy projects stall for the same reason. The people who wrote the system have left, the documentation is thin, and every estimate starts with weeks of reading code before anyone can say what the system does. That reading phase used to be the most expensive and least predictable part of the job.
AI coding assistants are very good at exactly that phase. They can explain an unfamiliar module, map which screens call which services, list the business rules hidden in conditionals, and draft a written specification from the code. In the Thoughtworks case, the team reports reaching a working understanding of the codebase within a couple of hours, without access to the original developers or a test environment.
What AI does not remove is the question of equivalence. A rewrite has to behave like the old system in every case your business depends on, including the odd ones nobody wrote down. AI can produce cleaner code that is wrong in exactly the places that matter, and it does so with confidence. So the effort moves from reading the old code to proving that the new code behaves the same way.
Where AI helps, and where people stay in charge
Think of a modernization in five stages. AI speeds up each one, but each one also has a decision that belongs to a person who knows the business.
- Discover: AI catalogs modules, dependencies, dead code and data flows. Your team confirms which parts still matter to users.
- Specify: AI drafts a specification of current behavior from the code. A domain expert reads it and corrects the rules it misread.
- Protect: AI drafts tests that pin down today's behavior. Engineers decide which cases are critical and add the ones only your staff remember.
- Rebuild: AI writes first drafts of the new code and the migration scripts. A named reviewer accepts or rejects every change.
- Cut over: AI summarizes logs and differences between old and new outputs. People decide when a slice goes live and when to roll back.
Across all five stages, AI produces the drafts quickly, and the people who know your users and your data decide what is true.
Choose the route before you choose the tools
AI tools make every route cheaper, so the temptation is to jump straight to a full rewrite. Pick the route on business grounds first.
Upgrade in place
Keep the language and the architecture and move to supported versions of the framework, runtime and libraries. This fits when the design still serves the business and the main problem is unsupported software. AI helps by planning the upgrade path and fixing breaking changes in bulk. In the Thoughtworks example, the assistant advised a series of small version steps instead of one large jump.
Replace in slices
Build the new system around the old one and move one capability at a time, routing traffic to the new part as each slice is ready. Martin Fowler calls this the strangler fig pattern. It fits large systems that cannot stop, because every slice can be checked and rolled back on its own. AI helps most here, since each slice is small enough to specify and test well.
Rewrite
Rebuild the application on a new stack in one project. This fits small or mid-sized applications whose framework is a dead end, where the behavior can be captured completely before the switch. It carries the most risk, because everything changes at once.
Build the safety net first
Before anyone writes new code, the team should be able to prove what the old system does. Three practices do that.
Characterization tests
A characterization test records what the current code actually does, not what the specification says it should do. You run the old system with a wide set of inputs, capture the outputs, and turn each pair into an automated test. AI is useful here because it can propose many input cases quickly, including boundary values. Engineers still have to add the cases that come from your operations: month-end runs, odd customer types, data entered by hand years ago.
Side-by-side comparison
For anything that calculates, prices, schedules or reports, run the old and new versions on the same input and compare the results automatically. Agree up front what counts as a match, for example identical values, or rounding differences within a stated tolerance. Every mismatch is either a bug in the new code or a rule nobody knew about. Both are worth finding before go-live.
Cut over by slice, with a way back
Move users or functions in small groups, watch error rates and support tickets, and keep the old path available until the new one has run through a full business cycle. DORA's four keys, especially change fail rate and time to restore service, give both sides a shared way to judge whether the cutover is going well.
Five things to agree with an outsourced modernization team
The risks are manageable when they are written down. These five points belong in the statement of work.
1. Access and data rules
Legacy systems often hold years of personal and financial data. Agree which repositories and which data the team and its AI tools may see, under which accounts, and what must stay inside your environment. Use masked or synthetic data for testing wherever possible.
2. The recovered specification is yours
The written description of what your system does is often the most useful output of the project, sometimes more useful than the new code. Make it a named deliverable, stored in your repository and kept current as rules are corrected.
3. Equivalence criteria before the rewrite
Decide how the team will prove the new system behaves like the old one: which tests, which comparisons, which tolerances, and who signs off. Without this, "done" turns into an argument at the end of the project.
4. A named reviewer on every change
When an assistant drafts most of the code, a person still has to read it and answer for it. Every merge should name the engineer who reviewed it, and reviewers should check tests as carefully as code.
5. A cutover and rollback plan
Agree the order of slices, the success measures for each, how long the old path stays available, and who can decide to roll back. Plan the decommissioning of the old system too, or you will pay to run both for longer than you meant to.
Questions to ask a modernization partner
These are the questions we expect from buyers, with the kind of answer you should hear.
- How will you learn what our system does without the original team? A plan that combines AI-assisted code analysis with interviews of the people who use the system every day.
- What will we receive besides new code? A written specification of current behavior, the test suite, and the comparison results.
- How do you prove the new system matches the old one? Characterization tests and side-by-side runs, with match rules agreed before the rewrite.
- Which AI tools touch our code, and where does our data go? A specific answer per tool, matched to the access rules you set.
- How do we go live? Slice by slice, with measures for each step and a rollback path.
How we approach modernization at MOHA
Our published case with Draco Help shows the pattern on a mobile app. Draco Help is a safety app whose panic button sends an intervention crew to the user's location. It was built on VueNative, a framework its creators no longer support, which meant no security patches and a shrinking pool of developers. We migrated it to React Native in phases: an analysis of the existing codebase to find what could be reused, replication of every core feature including the panic button and real-time intervention tracking, then testing for performance, usability and security before release.
We use AI in the same disciplined way across delivery. Our Test-case AI platform drafts test cases from feature descriptions and screen mock-ups, and engineers review every draft before it reaches the repository. On a modernization project, that habit becomes the safety net: tests that describe today's behavior, checked by people, before the new code goes in. Our guide to AI-driven software development covers the review rules we apply to AI-drafted code.
When the old system also needs a new home, our cloud and DevOps team handles the infrastructure, pipelines and monitoring for the new platform.
How to read a modernization proposal
A modernization proposal should read differently from a new-build quote. When one reaches you, check how it handles these cost drivers:
- Discovery: time and people for code analysis and for interviews with your staff, and the specification you receive at the end.
- Safety net: how much of the budget goes to characterization tests and comparison runs before construction.
- Route: whether the plan upgrades, replaces in slices or rewrites, and why.
- Parallel running: how long the old and new systems run side by side, and who pays for both.
- Data migration: volumes, cleansing, and how the team checks that nothing was lost.
- Afterlife: who maintains the new system, and how. Our comparison of software maintenance cost in-house vs offshore shows what drives that cost.
A proposal that explains these points is one you can plan around. If it only lists roles and months, ask where AI saves time and how the team will prove the result.
Talk to us about your legacy system
If you have a system that is hard to change and want a plan to modernize it safely, contact us to discuss your project.


