Insights

How to modernize a legacy system with coding agents: step by step

Published

By Ithaca

Modernizing a legacy system with coding agents means replacing the old system piece by piece, with the new one built alongside and the old one still serving. The agents read the current code, write tests that pin down what it does today and build each new part. The team decides the order, reads what goes to production and sets when each part takes over.

This guide starts from a decision already made: the system needs to change. If that calculation has not been done yet, start with what a legacy system is and when to modernize.

If it is still unclear what maturity level the company is at before the step by step, use the modernization maturity self-assessment.

Before you start: why switch piece by piece

Rewriting everything at once looks simpler. Martin Fowler, who gave the alternative path the name strangler fig, says he and his colleagues saw that plan fail most of the time. Replacing a serious system takes time, users cannot wait for new features, and it is hard to discover the details of what the old system does (Fowler, Strangler Fig, 2024). When you switch piece by piece, each new piece is small, and so is the risk of putting it live.

Coding agents do not change that logic. They make it cheaper to read and change a lot of code, which speeds up steps 1, 3 and 4. What stays hard is checking, and that is why supervision comes in from step 1. If the decision to modernize still depends on numbers, the cost data (Stripe, Protiviti, GAO) is in what a legacy system is and when to modernize.

What changes in a modernization: architecture, stack and practices

Moving the system as it is to the cloud, so-called lift-and-shift, changes where it runs but keeps the same code and the same problems. The code modernization guide published by Anthropic, The Code Modernization Playbook, organizes what needs to change, in Anthropic’s view, on three fronts, always preserving the business rule the system has accumulated:

  • Architecture: how the system is divided. Moving from a single block, where any change touches everything, to parts that deploy and scale separately (the guide advocates microservices and cloud-native architecture). That way a new screen goes live without putting core processing at risk.
  • Stack: what technology it runs on. Languages and frameworks with active support, security fixes up to date and people available on the market to maintain them.
  • Practices: how the team delivers. Continuous integration and delivery, automated tests and environments described in code, so that staging and production are the same and every change can be undone.

When a plain migration still makes sense, and how to combine it with switching piece by piece, is in lift and shift vs modernization.

The three go together. New code delivered the old way, with manual deploys and no tests, tends to become the next legacy system. The steps below deal with all three: the inventory and the choice of parts define the architecture, the new part is born on the new stack, and the characterization tests and the cutover criterion are already the new practice.

Step 1. Take the inventory

Before any new line, the agents read the existing code and documentation. That reading becomes the reference base for the following steps (at Ithaca, the Knowledge base). The inventory answers five questions:

  • Which functions the system performs for the business, and who depends on each one.
  • Where the rules are. In a legacy system, many exist only in the code; the documentation describes the system of years ago.
  • What changes most often and what consumes the most maintenance hours.
  • What the system talks to: databases, queues, other systems, scheduled jobs.
  • What nobody uses anymore. Fowler points out that much of an old system’s behavior is no longer wanted, and rebuilding it is waste. The inventory is the time to mark what will be switched off instead of migrated.

The agents do the first survey. The team checks it with the people who operate the system, because a rule found in the code may be a bug that became a feature. When the people who operate the system are one or two, and the technology is COBOL, Delphi or VB6, this inventory has a deadline; see shortage of COBOL, Delphi and VB6 developers.

Step 2. Choose the first part

Do not start with the whole system or with the most critical part. Start with a part that can be checked end to end: a request goes in, a result comes out, and the old system’s result can be compared with the new one’s. Among those, it pays to choose the one that consumes the most maintenance today, where the gain shows up first.

To separate that part, you need to find a seam: a point where calls can be diverted from the old system to the new one without touching the rest, such as an API route, a screen or a message type on a queue. If it is still unclear where the effort goes, a practical signal is the share of the team’s week that goes to maintenance. The Anthropic guide uses, as a rule of thumb, a share above 40% as a clear sign that modernizing is worth it. It is a vendor’s criterion, not a research finding.

If the burden still has to be translated into hours and budget, the map of where the cost shows up and a simple estimation method are in the cost of technical debt.

Step 3. Pin down current behavior with characterization tests

A characterization test records what the system does today, right or wrong. Michael Feathers, who described the practice, sums it up this way: the goal is to document the system’s actual behavior, not the behavior you would like it to have (Feathers, Characterization Testing, 2016).

These tests become the yardstick for the switch. The new part goes in only when it passes the same tests the old one passes, or when the team has decided, in writing, to change a behavior.

Coding agents write characterization tests quickly and in volume. What the team checks is coverage: whether the tests catch the rules the business depends on, and not just the easy paths. The detail is in AI refactoring without losing correctness.

Step 4. Build the new system alongside

The old system keeps serving while the agents write the new part from the inventory and the tests. The team reviews the design and the code.

While the two coexist, some structure exists only so that the two systems can talk: a router that decides who serves each call, a data sync, an adapter. Fowler calls this transitional architecture. It is code that will be deleted at the end and, according to him, it pays off anyway, because it reduces risk and brings the return forward.

Step 5. Switch piece by piece

With the new part passing the tests, calls start going to it. Four practices reduce the damage if something goes wrong:

  • Start with a slice of traffic (a group of users, a type of request) before moving everything.
  • Compare the results of the old and the new system on the same input, when possible.
  • Have the way back ready: diverting calls back to the old system has to be simple and tested.
  • One part at a time. The next starts when the previous one is stable in production.

A failure is still possible, and some switches, especially those that touch data, may need a maintenance window. What switching piece by piece changes is the size of the damage.

Step 6. Define the cutover criterion

There are two cutovers, and both need a written criterion before they happen.

When a part takes over. For example: it passes every characterization test; it ran with a slice of traffic for an agreed period with no divergence the team has not explained; the way back was tested; someone on the team read and approved what goes to production.

When the old system is switched off. For example: no call has reached the old part for an agreed period; the data was migrated and checked; the integrations that depended on it point to the new system. Without this criterion, the old system tends to stay on "just in case", and the cost of maintaining two systems continues.

Two rules that apply at every step

People read what goes to production. The team sets the agents’ autonomy limit: what they can do without approval and what needs approval before executing. The platform operates at level 4 of the autonomy scale proposed by Dan Shapiro, with one extra rule: people on the team read what goes to production. Level 5 is the dark factory, in which code goes to production without anyone reading it.

Every session is recorded. Request, steps, model, cost, result and authorship. In a modernization that lasts months, this record shows why a rule was kept or changed and who approved the switch. What to record is in coding agent observability.

Example: Dr. Consulta’s subscription system

Dr. Consulta modernized its subscription system, eight years in production, using Ithaca’s agentic development platform. The method was to build alongside and switch piece by piece, with the current system staying in operation. Compared with the period before the modernization, infrastructure cost was 85% lower, and a representative feature that used to take two weeks started shipping the same day. It is an example, not a measurement of the whole backlog. Dr. Consulta’s team supervised the coding agents throughout. What the case shows, and what it does not prove, is in the Dr. Consulta case.

Checklist

  • Inventory done, including what will be switched off instead of migrated.
  • First part chosen: checkable end to end, with a seam to divert the calls.
  • Characterization tests covering the rules the business depends on.
  • A written criterion for each part to take over, for the way back and for switching off the old system.
  • The plan covers architecture, stack and way of delivering, and not just the server switch.

The Ithaca platform’s method for this work is in legacy system modernization without stopping the business.

Frequently asked questions

Where do you start when modernizing a legacy system?

With the inventory and a single part. Map what the system does, where the rules are and what nobody uses anymore. Then choose a part that can be checked end to end, preferably the one that consumes the most maintenance, and switch that one before the next.

Can you modernize a legacy system without stopping the operation?

That is what switching piece by piece is for. The new system is built beside the old one, which keeps serving, and functions move over piece by piece, each one checked before it goes in. A failure is still possible, and some switches may need a maintenance window. There is no promise of zero downtime, but the damage stays limited to the size of the piece.

Is migrating to the cloud (lift-and-shift) modernizing?

On its own, no. Moving the system as it is to another server changes where it runs and keeps the same code, the same coupling and the same way of delivering. Modernizing changes three things: how the system is divided, what technology it runs on and how the team delivers. The migration can be a step, but not the last one.

What are characterization tests?

Characterization tests record what the system does today, even if it looks wrong. Michael Feathers described the practice to give safety to anyone who has to change code without a specification. In a modernization, they become the yardstick: the new part goes in only when it behaves like the old one, or when the team has decided to change that behavior.

What is the role of people when coding agents do the modernization?

Deciding and checking. The team chooses the order of the parts, defines what the agents do without approval, reads what goes to production and approves each cutover. Every agent session is recorded, so it is possible to know later who approved what.

Request a free assessment

If you already have a candidate part, the first step with Ithaca is a free assessment, done with your team. Request a free assessment →

References

Read also:

What is a legacy system: risk signs and when to modernize · Legacy system modernization without stopping the business · Dr. Consulta case · Coding agent observability · AI refactoring without losing correctness

Related reading

Start with what weighs most on your backlog.

Tell us what is stuck. After the NDA and access to the code, the agents read the system with your team and show where to start.

Phone is optional. How we use your data, including to measure our ads: Privacy policy.