Skip to main content
All posts
Software Engineering18 min read

AI Legacy Modernisation: Coding Agents and the Strangler Fig

How to use coding agents for legacy modernisation without a big-bang rewrite: strangler facade, characterisation tests and seven gates for every slice.

Published Updated: 15 November 2026

On 10 November 2026, .NET 8 and .NET 9 reached end of support, and .NET 11 shipped the same day. On 12 January 2027, .NET Framework 4.6.2 and Windows Server 2016 follow. Oracle's Premier Support for JDK 17 ended in September. Most enterprises we work with still run applications on those runtimes, and every major vendor now sells an agent that promises to "modernise" them.

Some of those agents are genuinely useful. They are also the most convincing argument for a big-bang rewrite since the last failed one: if an agent converts the codebase in a weekend, why bother with a strangler fig? This article is for the people who answer that question with a budget attached: CTOs, heads of engineering, architects and the risk owners who sign off production changes. Our answer: the agent is the labour, characterisation tests are the oracle, the strangler facade is the safety net. Below are our slice-by-slice process, our risk matrix and what the published data actually supports.

TL;DR / Key takeaways

  • Agents change the cost of conversion, not the risk of cutover. The hard part was never typing new code. It was knowing what the old code really does and switching traffic without breaking a customer.
  • Characterisation tests are the oracle. Record what the legacy system actually does, mask personal data, and make "the golden master passes" the agent's definition of done.
  • The facade is the safety net. Every slice ships dark, runs in shadow, then moves by percentage with a per-route kill switch. Cheaper slices mean you can afford smaller ones.
  • Pick slices by risk, not by size. In our risk matrix, stateless reads and CRUD on owned tables score 5–7 out of 15; stored procedures, payment workflows and COBOL batch score 12–13. Start low.
  • Treat headline productivity numbers with care. Published figures range from 19% slower (a randomised trial) to "up to 5x faster" (vendor marketing). Measure lead time and defects per slice yourself.
The AI-assisted strangler fig. Runtime (top): the facade routes each slice to legacy or new code, shadows traffic and keeps a kill switch per route. Delivery (bottom): the agent slice factory, where characterisation tests recorded from real traffic gate every agent-written change. Callouts 1–7 match the sections below.
The AI-assisted strangler fig. Runtime (top): the facade routes each slice to legacy or new code, shadows traffic and keeps a kill switch per route. Delivery (bottom): the agent slice factory, where characterisation tests recorded from real traffic gate every agent-written change. Callouts 1–7 match the sections below.

Download: Editable draw.io file · Open in diagrams.net · Chart data (CSV)

Why this matters now

Three things changed in the last eighteen months.

The deadlines got real. Most modernisation budgets hang on an end-of-support date, and several now cluster. .NET Framework 4.8 and 4.8.1 follow their Windows host, so the pressure comes from the operating system and the talent pool rather than a hard cliff. But Windows Server 2016 leaves extended support on 12 January 2027, and Java 8 teams are paying for Oracle Extended Support that ends on 31 December 2030.

Runtime support deadlines from 2022 to 2030 for .NET Framework, .NET and Oracle JDK
Runtime support deadlines from 2022 to 2030 for .NET Framework, .NET and Oracle JDK

The tooling became agentic. Microsoft's GitHub Copilot upgrade agent upgrades .NET Framework projects of any version to .NET 8 or later, including a Web Forms to Blazor scenario, and commits after each planned task. AWS Transform offers agents for .NET, mainframe and Java upgrades. Microsoft's open-source Legacy Modernization Agents sample converts COBOL to Java or C#, and says plainly that generation alone does not prove behavioural equivalence. Thoughtworks put "using GenAI to understand legacy codebases" in the Adopt ring of its November 2025 Technology Radar, calling it "a practical default rather than an experiment".

Stability is the casualty. Google's 2025 DORA report found 90% of nearly 5,000 respondents using AI at work. AI adoption now correlates positively with throughput, but still negatively with delivery stability. Veracode's 2025 tests of more than 100 models found 45% of generated code samples failed security tests, with Java worst at 72%. Point an agent at a Java 8 estate without gates and you will ship faster and break more.

The rewrite trap, now with agents

Martin Fowler's strangler fig article, updated in August 2024, lists why full replacements fail: they take too long, users can't wait, existing behaviour is hard to specify, and some of it is unwanted anyway. In his words, "we've seen this simple-sounding plan go down in flames most of the time."

Agents shrink the first problem and do nothing for the other three. Worse, they make specifying behaviour look easy: a model will cheerfully summarise what a stored procedure "does". That summary is a hypothesis. Only recorded behaviour is evidence. Our legacy modernisation guide covers the classic four phases; here we cover what changes when an agent writes most of the new code.

The agent slice factory, gate by gate

Numbers match the hero diagram. Steps 1–4 run per slice in delivery; steps 5–7 happen at runtime.

① Pick the seam and size the slice

A slice is one route, transaction or batch job, ideally with data it owns. The seam is where you can intercept it. For ASP.NET Framework, Microsoft's incremental migration guide is itself a strangler fig: an ASP.NET Core app proxies to the old one with YARP, and the System.Web adapters let shared libraries keep using HttpContext. For Java 8 the facade is usually an API gateway or Spring Cloud Gateway route. For COBOL it may be a CICS transaction, an MQ queue or a batch file drop.

Score each candidate before anyone writes a prompt, on five dimensions: behaviour ambiguity, data coupling, external side effects, blast radius and the "oracle gap", how hard the behaviour is to record at all.

② Pin behaviour with characterisation tests

Michael Feathers coined "characterisation test" in Working Effectively with Legacy Code: a test that describes what the system actually does, not what it should do. In practice it is a golden master. The facade mirrors real traffic, a recorder stores request and response pairs (or batch input and output files), and a snapshot tool such as ApprovalTests or Verify turns them into assertions. Add edge cases from logs and incident tickets, because two weeks of traffic rarely includes the year-end batch.

Two rules. Mask or pseudonymise before you record, because these recordings will end up in a context window. And record the bugs too: a characterisation test pins a rounding error as faithfully as a business rule. Fixing it is a separate, explicit change.

③ Let the agent migrate the slice in a sandbox

The agent's brief is narrow: the slice's code, the golden master, the target framework (.NET 10 or 11, Java 21 or 25) and a definition of done. Build green, golden master green, no dependencies outside an allow-list. It runs in a sandbox with a scoped repository token, no production credentials and an egress allow-list; our guide to securing AI coding agents covers the hardening. Keep a plan in the repository and a commit per task, as Copilot's upgrade agent does. That is your audit trail.

④ Gate equivalence: tests, mutation, security, human

This is where AI-assisted migrations cut corners. A green golden master is necessary but not sufficient, because an agent will happily special-case the recorded inputs. Add mutation testing (Stryker.NET, PIT for Java) so tests that pass for the wrong reason get caught, the same security scanning as for human code, and a code owner's review with the agent's plan attached. When the gate fails, the failing test goes back to the agent as context. That loop is cheap, and it is where agents earn their keep.

Loading diagram...

⑤ Shadow traffic through the facade

The new slice is deployed dark. The facade sends it a copy of live requests and logs differences against the legacy response. Every diff gets a decision: defect, legacy bug you preserve, or legacy bug you fix on purpose with the business owner's sign-off. Shadow writes only against a sandbox copy of the data, or you charge customers twice.

⑥ Cut over by percentage, with a kill switch

Move traffic in steps (1%, 10%, 50%, 100%), each with a hold period and alerts on errors, latency and one business metric. The kill switch is a route-table change, not a redeployment, so rollback takes seconds. Microsoft's guidance warns that the facade must not become a single point of failure or a bottleneck, so give it its own SLOs.

Data is the part nobody demos. Microsoft's guidance describes the sequence we use: the new service first works against the shared database, with an anti-corruption layer for calls between old and new; it then gets its own domain database, loaded by ETL and kept in sync by change data capture; only after validation does that database become the system of record. Rollback stays cheap until you delete the legacy tables, so do that last.

⑦ Delete the legacy path

A strangler fig that never deletes anything is just two systems to run. Once a slice has held 100% for an agreed period, remove the legacy code, its route entry and the tables it no longer owns. Track "legacy lines deleted" next to "slices migrated". Agents help here too: finding dead references and orphaned stored procedures is tedious, checkable work.

What the numbers say

Published AI effects on task time, by evidence type
Published AI effects on task time, by evidence type

We put these figures side by side because they are not comparable. In METR's early-2025 randomised trial, 16 experienced open-source developers took 19% longer on 246 real tasks with AI allowed, while believing AI had made them 20% faster. METR's preliminary late-2025 follow-up showed an 18% speed-up for returning developers and 4% for new ones, with confidence intervals crossing zero. METR calls the data "only very weak evidence" for the size of any change: developers who no longer want to work without AI opted out, which probably understates the speed-up.

Migration work looks different. Google's 2025 paper covers 39 code migrations by three developers over twelve months: the LLM generated about 74% of 595 submitted changes, and developers estimated a 50% reduction in migration time. That is a self-estimate without a control group, but the task shape is the one that matters here: bounded, repetitive, machine-checkable. Andy Jassy's 2024 claim for Amazon's Java 17 upgrades, from about 50 developer-days to a few hours per application, points the same way. AWS's "up to 5x faster" is marketing and labelled as such.

Our reading: agents deliver most when the task has an oracle. A framework upgrade has one, the compiler plus the test suite. A legacy migration only has one if you build it, which is what step ② is for. Without characterisation tests you are in METR territory. With them you are closer to Google's.

Slice risk matrix, scored 1 to 3 on five dimensions (our analysis)
Slice risk matrix, scored 1 to 3 on five dimensions (our analysis)

The risk matrix is our analysis, not measured data. Two columns drive most scores. The oracle gap puts Web Forms or JSF screens (9) above CRUD, because UI behaviour is harder to record than an API. Behaviour ambiguity puts money calculations (10) higher still: their rounding rules look like bugs and are contracts.

In a recent engagement…

A European financial-services client asked us to review a modernisation programme for a .NET Framework policy administration system. A pilot with a coding agent had converted a large share of the codebase to modern .NET within weeks. It compiled. Most unit tests passed. The team wanted to know whether they could cut over at the next release window.

Neither we nor they could tell. The unit tests covered the code that had been easy to test, not the calculation paths that mattered. Nobody had recorded what production actually returned. And some of the agent's summaries of stored procedures were plausible and wrong.

We kept the work. We put a YARP facade in front of the old application, recorded masked traffic for a handful of routes, and re-ran the agent against that golden master one route at a time. A noticeable share of the converted code needed changes to pass, mostly small differences in rounding, dates and null handling that the old tests never exercised. The first route went live in shadow, then by percentage, and its legacy code was deleted. The programme is slower per line than the pilot, and far faster per slice actually in production.

Decision table: who leads each slice

The part to screenshot. "Agent leads": the agent writes, a human reviews. "Human leads": a developer writes, the agent assists.

Slice typeRisk scoreWho leadsMinimum gate before canary
Stateless read endpoint5Agent leadsGolden master + mutation score + review
CRUD on slice-owned tables7Agent leadsAs above + shadow reads
Report or export job7Agent leadsByte-level diff of output files over several runs
Web Forms / JSF screen9SharedAPI-level golden master + visual regression + UX review
Money calculation10Human leadsGolden master with boundary cases + finance sign-off
Stored-procedure logic12Human leadsCDC-validated data + golden master + DBA review
Workflow with payments or e-mail13Human leadsShadow with side effects stubbed + business owner sign-off
COBOL batch with copybooks / JCL13Human leadsFile-level golden master across full cycles

Three rules apply to every row. One slice in flight per team until the factory is proven. No canary without a kill switch. No "done" until the legacy path is deleted.

Governance for European enterprises

DORA, for financial entities. Article 17 of Commission Delegated Regulation (EU) 2024/1774 requires ICT change management with documented changes, fall-back procedures and segregation between the functions that approve changes and those that request and implement them. An agent that implements and a code owner who approves maps onto that cleanly, if you keep plan, task log, gate results and approval together as evidence. The facade's kill switch is your fall-back procedure. Your AI coding vendor is an ICT third-party service provider, too.

NIS2. Article 21(2)(e) of Directive (EU) 2022/2555 requires security in network and information systems acquisition, development and maintenance. Modernisation is all three at once, and the gates above are the proportionate measures an auditor will want to see.

GDPR. Characterisation tests built from production traffic contain personal data by default. Mask or pseudonymise at the recorder (data protection by design, Article 25), restrict access to the golden master, and keep raw recordings inside your tenant unless your processing agreements cover the model provider.

EU AI Act. An internal coding agent is not a high-risk system under Annex III. Article 4 still applies, though: since the AI Omnibus, Regulation (EU) 2026/1744, rewrote it in July 2026, providers and deployers must take measures to support their staff's AI literacy, without having to guarantee a specific level. Training reviewers on how agents fail is the obvious measure.

A pragmatic adoption path

  1. Weeks 1–2: inventory and score. List applications by runtime and support date, then slice and score the first candidate. Our technical debt quantification guide helps put a euro figure on the backlog.
  2. Weeks 3–4: stand up the facade and the recorder. Facade in front of the legacy system, routing 100% to legacy and mirroring masked traffic to a recorder. Nothing migrates yet.
  3. Weeks 5–8: run the factory on two low-risk slices. Sandbox, gate, shadow, canary, delete. Measure lead time per slice, gate failure rate and production defects, not lines generated; our AI developer productivity guide explains why.
  4. Months 3–6: widen by risk class. Move up the risk matrix only when the previous class runs cleanly. Consider a modular monolith as the target rather than splitting everything into services.
  5. Ongoing: track deletion. Report slices migrated, legacy lines deleted and migration incidents monthly. When deletion stalls, you are building a second system.

The verdict

Coding agents are the most useful thing to happen to legacy modernisation in a decade, and the most dangerous. They remove what made it slow, the typing, and leave what made it fail: not knowing what the old system really does.

Our position: do not let an agent near a legacy codebase without a facade that can route and roll back per slice, characterisation tests recorded from real behaviour, and an equivalence gate a human signs. With those, agents let you run smaller slices, more often, at lower cost, which is what the strangler fig always needed. Without them, you are running a big-bang rewrite with better autocomplete.

If you want help with the facade, the recorder and the first two slices, our software engineering team runs this as a fixed-scope pilot that leaves you with a working slice factory and a scored backlog.

FAQ

Can a coding agent modernise a legacy application on its own?

Not safely, and not in one go. Agents are good at bounded, verifiable work, such as converting one route or job while a test suite checks behaviour. They are poor judges of which legacy behaviour is a bug and which is a contract. Use them inside a strangler fig process: characterisation tests, human review and a facade with a rollback switch for every slice.

What are characterisation tests and why do they matter for AI migration?

Michael Feathers coined the term in Working Effectively with Legacy Code: tests that record what the existing system actually does, not what it should do. Golden master tools such as ApprovalTests or Verify implement them. In an AI-assisted migration they are the oracle, so a green suite means equivalence, not the agent's opinion of its own work.

Which legacy slices should we give to a coding agent first?

Start with stateless read endpoints, CRUD on tables the slice owns, and report or export jobs. Their behaviour is easy to record and failures are easy to reverse. Leave money calculations, stored-procedure logic, payment or e-mail workflows and COBOL batch with shared copybooks for later, with tighter gates and a human lead.

Do AI coding tools really speed up legacy migrations?

It depends on the task and the method. METR's 2025 randomised trial found experienced developers 19% slower with early-2025 tools; its preliminary late-2025 data showed modest speed-ups that METR calls weak evidence. Google's developers estimated a 50% time saving on 39 internal code migrations. Migrations are where gains look largest, but measure lead time and defect rate per slice yourself.

Which support deadlines make this urgent in 2026 and 2027?

.NET 8 and .NET 9 reached end of support on 10 November 2026. .NET Framework 4.6.2 and Windows Server 2016 follow on 12 January 2027, and .NET Framework 3.5 SP1 on 9 January 2029. Oracle Premier Support for JDK 17 ended on 30 September 2026, and Extended Support for JDK 8 ends on 31 December 2030. .NET Framework 4.8 and 4.8.1 follow the lifecycle of their Windows host.

What do DORA and GDPR mean for AI-assisted modernisation in the EU?

Under DORA, Article 17 of Delegated Regulation (EU) 2024/1774 requires documented ICT changes, fall-back procedures and segregation between approving and implementing a change. An agent that writes and a human who approves fits, if you keep the evidence. Under GDPR, characterisation tests recorded from production traffic contain personal data, so mask before recording and keep raw recordings out of external prompts.

Sources

All sources checked on 15 November 2026. Productivity figures come from studies with different methods. We name the method each time, and the chart labels it.

Tier A: primary, vendor documentation and regulatory

Tier B: research and analysis

Tier C: vendor and directional

Topics

AI legacy modernizationstrangler fig patterncharacterisation testscoding agents legacy code.NET Framework migrationJava 8 modernisationCOBOL modernisation AIgolden master testing

Frequently Asked Questions

Not safely, and not in one go. Agents are good at bounded, verifiable work, such as converting one route or job while a test suite checks behaviour. They are poor judges of which legacy behaviour is a bug and which is a contract. Use them inside a strangler fig process: characterisation tests, human review and a facade with a rollback switch for every slice.

Expert engagement

Need expert guidance?

Our team specializes in cloud architecture, security, AI platforms, and DevSecOps. Let's discuss how we can help your organization.

Get in touchNo commitment · No sales pressure

Related articles

All posts