Field Guide 001 · IH Tech

Modernizing legacy systems with AI agents

A control-loop strategy for AI-agent modernization: structure first, plans as reviewed prompts, machine-generated parity evidence, and a clear fit test.

  • Published
  • Updated
  • 14 min read
  • English

The decision

Reading route Exec

You are responsible for a system the business still depends on every day, built on a stack that is now a liability: a framework past its support window, an architecture nobody fully remembers, a codebase where every change is priced in fear. AI coding agents are on the table. The question is not whether they can write the new code. They can. The question is whether an agent-driven modernization program will actually finish, or stall at 70% the way most rewrites do.

The short answer

Reading route Exec

Run the modernization with AI agents if the legacy system can serve as the specification: the same product on a modern stack, not a new product inspired by the old one. Then invert the usual order of work.

  1. Structure first, code last

    Agents inventory, trace and score the legacy estate before anyone migrates anything.

  2. Plans are the unit of review

    Agents draft bounded migration plans; humans review plans, not piles of generated diffs. A reviewed plan is the best structured prompt your team will ever write, which is why nobody on the team needs to be a prompt engineer.

  3. Parity is machine-generated evidence

    not two developers reading two codebases side by side. Agents generate the checks; humans review the flags.

  4. Contracts replace coordination

    An agent cannot sit at the table in your standup. Every cross-team dependency you replace with a written, mocked contract is a dependency an agent can work against, and a meeting you no longer schedule.

Why modernizations stall

Reading route Tech

Every modernization starts the same way, and the start is a trap.

Phase 01 · The honeymoon

The new codebase is clean. There is no technical debt, the tooling is modern, the first features land fast. It is genuinely easier to work in the new system, so early velocity is high and everyone extrapolates from it. Steering committees see the first demo in week three and pencil in a cutover date.

Phase 02 · The middle

Now two systems exist. Every legacy change made by the team still running the old system widens the gap. Feature parity stops being a list someone wrote once and becomes a moving target nobody owns. Developers spend their days reading both codebases side by side, trying to establish whether an edge case in a twelve-year-old service was intentional, load-bearing, or dead. The work that felt like building now feels like archaeology, and velocity decays exactly when the burn-down chart says it should be accelerating.

Phase 03 · The asymptote

The business asks the only question that matters — when can we switch the old one off? — and nobody can answer it with evidence. Parity is asserted, not proven. The last 20% of behavior costs more than the first 80%, the rewrite becomes a permanent second system, and the organization now maintains both. This is how rewrites die: not with a failed deploy, but with a parity question nobody can answer.

AI agents change this, but only if you aim them at the trap rather than at the honeymoon. Pointed at “write the new code faster,” agents accelerate you into the middle and leave you there with more unreviewed code. Pointed at evidence, planning and verification, they attack the three places rewrites actually die.

The modernization control loop

Reading route Tech

We run agent-driven modernization as a control loop with four stations. Work flows forward; evidence flows back. Humans own intent and exceptions; agents own bounded execution; plans carry the context; parity evidence closes the loop.

The modernization control loop. Four stations run left to right. Station 01, Evidence, is owned by agents and produces a locally indexed surface inventory with dependency traces. Its inventory flows to Station 02, Evaluation, where agents score each unit and architects review the sequencing into waves. Scored waves flow to Station 03, Control, where agents draft a bounded migration plan in Markdown and a human signs it; the accent bar on the path out of Station 03 is that sign-off, and execution is gated on it. The approved plan flows to Station 04, Operation, where agents execute one wave and machines generate parity evidence from response and rendering diffs, generated contract tests and shadow traffic. A single accent path returns from Station 04 to Station 03, carrying the next wave's plan, and to Station 02, carrying recalibrated scores. That return path is the loop closing. Fig. 1 · Modernization control loop IH Tech · FG-001 STATION 01 Evidence ingest · discover Local index, zero egress Surface enumeration Dependency tracing Blast radius known AGENTS STATION 02 Evaluation score · sequence Framework & API risk Business criticality Traffic & test coverage Waves, sequenced AGENTS + ARCHITECTS STATION 03 Control plan · review Plan drafted in Markdown Parity checks named Out of scope named Human sign-off AGENTS + HUMAN GATE STATION 04 Operation execute · verify Bounded execution Response & render diffs Contract tests · replay Flags → human review AGENTS + HUMANS INVENTORY SCORED WAVES APPROVED PLAN HUMAN SIGN-OFF RECALIBRATED SCORES NEXT WAVE'S PLAN EVIDENCE RETURN PATH Work flows forward Evidence flows back Human control point The modernization control loop. Four stations run left to right. Station 01, Evidence, is owned by agents and produces a locally indexed surface inventory with dependency traces. Its inventory flows to Station 02, Evaluation, where agents score each unit and architects review the sequencing into waves. Scored waves flow to Station 03, Control, where agents draft a bounded migration plan in Markdown and a human signs it; the accent bar on the path out of Station 03 is that sign-off, and execution is gated on it. The approved plan flows to Station 04, Operation, where agents execute one wave and machines generate parity evidence from response and rendering diffs, generated contract tests and shadow traffic. A single accent path returns from Station 04 to Station 03, carrying the next wave's plan, and to Station 02, carrying recalibrated scores. That return path is the loop closing. Fig. 1 · Control loop STATION 01 Evidence ingest · discover AGENTS STATION 02 Evaluation score · sequence AGENTS + ARCHITECTS STATION 03 Control plan · review AGENTS + HUMAN GATE STATION 04 Operation execute · verify AGENTS + HUMANS INVENTORY SCORED WAVES HUMAN SIGN-OFF APPROVED PLAN ← recalibrated scores ← next wave's plan EVIDENCE RETURN Work flows forward Evidence flows back Human control point
Figure 1. The modernization control loop. Work flows forward through four stations; parity evidence flows back to recalibrate scores and shape the next wave's plan. The single accent path is the return of evidence; the accent bar between Control and Operation is the human sign-off that gates execution.

What each station takes and produces

Station 01 · Evidence

Owner
Agents
Takes
The legacy estate, indexed locally with zero data egress
Produces
Surface inventory (endpoints, screens, jobs, integrations, infrastructure), plus dependency traces to true blast radius
Returns to the loop
Nothing returns to Station 01; the inventory is the denominator of every parity claim
Read Station 01 in full

Station 02 · Evaluation

Owner
Agents score; architects review the sequencing
Takes
The surface inventory
Produces
A composite score per unit from framework and API risk, business criticality, production traffic and existing test coverage; work sequenced into bounded waves
Returns to the loop
Receives recalibrated scores from Station 04
Read Station 02 in full

Station 03 · Control

Owner
Agents draft; a human reviews and signs
Takes
The scored waves
Produces
A bounded migration plan in Markdown (what moves, what it depends on, the target shape, the parity checks, what is out of scope), approved only when a human signs it
Returns to the loop
Receives parity results that shape the next wave's plan
Read Station 03 in full

Station 04 · Operation

Owner
Agents execute; humans adjudicate flags
Takes
Approved plans, and only approved plans
Produces
One wave executed, plus layered parity evidence: response and rendering diffs, contract tests generated from the enumerated surface, and shadow traffic where risk justifies it
Returns to the loop
Closes the loop: parity results feed the next wave's planning and recalibrate the scores
Read Station 04 in full

Station 1: Evidence

Before anything is migrated, the legacy estate is turned into something agents can reason over.

  • Ingestion. The legacy codebase is indexed locally, with embeddings and retrieval running inside your environment and zero data egress. For most enterprises this is not a nice-to-have: it is the difference between the security review approving the program and killing it.

  • Surface enumeration. Agents extract the real inventory: every endpoint, screen, scheduled job, integration and infrastructure resource. Not the architecture diagram from 2019, but the surface that actually exists in the code. This inventory is the denominator of every parity claim you will ever make.

  • Dependency tracing. Agents trace each unit of the surface through the coupling (static helpers, service locators, inline SQL, shared state) until its true blast radius is known. This is exactly the work that exhausts senior engineers when done by reading, and it is where retrieval-equipped agents are disproportionately strong.

Station 2: Evaluation

The inventory is scored, not eyeballed. A composite score per unit weighs:

  • framework and API risk (how hostile is this code to the target stack),
  • business criticality,
  • production traffic,
  • existing test coverage (how much of a safety net already exists).

The scores sequence the work into waves: bounded batches, ordered so that early waves build the safety net and the reusable patterns that later, riskier waves depend on. Sequencing is a decision your architects review, and they review it holding a scored inventory rather than a hunch.

Station 3: Control

For each wave, agents draft a migration plan in plain Markdown: what moves, what it depends on, what the target shape is, what parity checks prove it, what is explicitly out of scope. Humans review the plan the way they review a pull request: asynchronously, in version control, with line-level comments.

This station is the answer to a question every engineering leader asks about AI adoption: does everyone now need to be a prompt engineer? No. The process develops the plans, and the plans are the prompts: structured, reviewed, versioned, reusable. The skill your developers exercise shifts from crafting clever instructions to judging whether a plan is correct, complete and safely bounded. They become process managers, leaders of an agent workforce, rather than authors of individual prompts. That is a role senior engineers already know how to do, because it is code review moved one level up.

A plan is only approved when a human signs it. This is not ceremony. It is the control in the control loop, and the moment it becomes rubber-stamping, you have automated your way back into the trap.

Station 4: Operation

Agents execute approved plans, and only approved plans. Execution is bounded: one wave, one plan, one reviewable outcome.

Verification is layered, and machines generate it.

  • Response and rendering diffs. New implementation against old, same inputs, compared automatically: response payloads for services, rendered output for interfaces.

  • Contract tests. Agents generate parity tests from the enumerated surface itself (endpoint signatures, screen states), so coverage tracks the inventory instead of somebody's memory.

  • Shadow traffic. Where the risk justifies it, real production traffic is replayed against the new system before it owns anything.

Failures do not block the pipeline silently and do not get auto-fixed silently. Each flag routes to a human with the evidence and a proposed fix attached. Humans stop reading two codebases looking for differences; they adjudicate differences that machines already found.

The loop closes here: parity results feed the next wave's planning, scores get recalibrated, and, critically, the cutover question finally has an answer that is a dashboard, not an opinion.

Four structural principles

Reading route Tech

The control loop works because of four decisions underneath it. Every gain we have seen in agent-driven modernization traces to one of these, not to a bigger model.

  1. Structure first, code last

    The instinct with agents is to start generating immediately, because generating is what they visibly do well. Resist it. Discovery, tracing and scoring before any code means every hour of agent execution lands inside a reviewed boundary. Weeks one and two of a structured program produce inventories, scores and plans rather than features. That is politically harder and structurally far cheaper than the alternative, because unreviewed early code is where rework compounds.

  2. The right context, safely

    Context is the multiplier on everything an agent does, and it cuts both ways. An agent with retrieval over your indexed legacy code, your module library and your conventions produces work that fits your system. An agent without that context does not merely produce less useful work: it actively manufactures technical debt, regenerating from scratch what already exists and amplifying every duplication it finds. We have watched teams point a coding assistant at a migration without exposing their shared module repository; the assistant rebuilt the modules, badly, in every place it needed them.

    Practically this means:

    • local indexing with zero data egress;
    • retrieval wired into the agents rather than pasted into prompts;
    • and your internal libraries exposed to agents as first-class, documented capabilities so that reuse is the default and duplication is the exception.
  3. Contract-first parallelism

    Cross-team dependencies are where both human throughput and agent throughput go to die. A frontend team blocked on a backend team loses days per handoff; an agent blocked on “ask the other team what the response looks like” is simply stuck, because an AI cannot sit at the table and talk about what's next.

    The fix is old, and agents make it newly decisive: write the contract first and mock it. An interface specification with a mock server in front of it lets both sides, and both sides' agents, ship from day one against the same verifiable target. Handoff latency drops from days to minutes, and the teams align on a single goal instead of negotiating sequence. Reducing cross-team dependencies is not a reorg nicety here; it is what converts coordination into something automatable.

  4. Verification built in

    Parity is the currency of a modernization. If you cannot prove it, you cannot cut over, and everything else was expensive motion. Build the verification harness (diffing, contract tests, shadow replay) as part of the program, not as a QA afterthought, and let agents generate the checks from the enumerated surface. The division of labor that scales is: agents generate the checks, humans review the flags.

What changes for your team

Reading route Act

Developers become leaders of agents

The day-to-day shifts from writing migration code to reviewing plans, adjudicating parity flags and steering the next wave. Seniority expresses itself as judgment, which is exactly the scarce resource you were trying to scale.

Prompting is a process property, not a personal skill

The pipeline produces the plans; the plans are the structured prompts. One person who is brilliant at prompting is a bus factor, not a strategy.

Review moves up a level

From “read this 400-line diff” to “is this wave's plan bounded, complete and safe”, and separately “is this parity flag a bug or an intentional behavior we must preserve”.

Coordination flattens

Fewer synchronization meetings, more contracts, queues and dashboards. The organization aligns on one goal, provable parity on the new stack, instead of aligning on each other's calendars.

Trade-offs you are accepting

Reading route Tech

Upfront structure versus early applause

The structured program's first demo is an inventory and a scored plan, not a feature. You will defend that in a steering committee. The unstructured program demos a feature in week three and cannot answer the cutover question in month nine. Decide which conversation you would rather have.

Bounded waves versus opportunistic improvement

Engineers in a legacy codebase see things they itch to redesign. Inside a wave, the answer is no: parity first, improvement after evidence. The discipline feels conservative; it is what keeps the parity claim provable. Park the redesigns in a backlog that activates after cutover.

Local context infrastructure versus convenience

Indexing the estate inside your boundary costs setup time that a cloud-hosted shortcut would not. In any regulated or confidentiality-sensitive environment, the shortcut is not actually available, and the local pipeline is what makes the program approvable at all.

A verification harness versus shipping faster this quarter

Diffing, contract generation and shadow replay are real engineering investments that produce no user-visible features. They are also the only thing that ever lets you switch the legacy system off. Fund them as the product of the program, because they are.

Failure modes: signals the approach is breaking down

Reading route Act

Watch for these; each one is observable and each one has a specific repair.

  1. The parity dashboard goes quiet

    Parity tracking drifts back into spreadsheets and memory.

    Repair

    No wave closes without machine-generated parity results attached; the dashboard is the definition of done.

  2. Agents duplicate what already exists

    Generated code rebuilds shared modules instead of importing them. This is a context gap, not an agent quality problem.

    Repair

    Re-index, re-expose the library, and regenerate.

  3. Plan review becomes rubber-stamping

    Approval latency drops to minutes and comments disappear. The control is now theater; the loop is open.

    Repair

    Sample-audit approved plans, rotate reviewers, make plan quality a named responsibility.

  4. Waves swell

    Each wave carries a little more scope than the last until “bounded execution” is a memory.

    Repair

    Hard wave-size limits enforced at planning, not at retrospective.

  5. A prompt hero emerges

    One person hand-crafts increasingly elaborate prompts outside the pipeline, and results depend on their availability.

    Repair

    Fold whatever they learned into the plan templates; the process, not the person, is the asset.

  6. New requirements leak in

    “While we're in there” grows past roughly a fifth of the work, parity stops being the goal, and you are now building a new product with a legacy anchor tied to it.

    Repair

    Route new asks to the post-cutover backlog, or consciously re-scope the program as product development, with different economics and different promises.

When this strategy does not apply

Reading route Exec

Use this as a gate, honestly, before you commit:

Fit criteria for the parity-pipeline strategy.
Fit criterion Fits this strategy Does not fit
New business requirements ≤ ~20% of target scope Substantially new product
Feature structure Screens, workflows, endpoints map roughly 1:1 Consolidation or re-imagination
Legacy as specification Business rules readable; ~80%+ of target derivable from legacy Behavior undocumented and unreadable
System count One system in, one system out Several systems merging into one

The second is a legitimate program; it is just a design program, and it needs discovery, product decisions and different verification, not a parity pipeline.

Put it to work

Reading route Act

In your next planning session, answer five questions:

  1. What percentage of the target is genuinely new requirements? (Above ~20%, stop here and re-frame the program.)
  2. Can the legacy surface be enumerated mechanically (endpoints, screens, jobs, resources)? Who can confirm the inventory is complete?
  3. What would parity evidence look like for your riskiest workflow: a diff, a contract test, shadow traffic, or all three?
  4. Which cross-team dependency would a written, mocked contract remove first?
  5. Who reviews plans, and do they have the standing to reject one?

Then run a two-track proof, about six weeks:

≈6 weeks

Both tracks run at the same time.

Track 1

One vertical slice

Pick a single feature domain and run it through the whole loop on real code: ingest, enumerate, trace, score, plan, human review, bounded execution, machine-verified parity. The output is go/no-go evidence, not a slideware pilot.

Track 2

The estate strategy, in parallel

While the slice runs, tune the agents and retrieval to your codebase, design the wave plan, the review gates, the verification harness and the team process.

By the end of the proof you hold verified parity on real code plus the complete toolkit to scale across the estate. That turns “should we modernize with agents” from a debate into a decision you have already piloted.

What we have seen

Reading route Exec

Practitioner observation · Not an audited benchmark

Ranges from modernization programs run this way, offered as practitioner observation rather than audited benchmark: endpoint migration throughput improving by roughly an order of magnitude once the pipeline is running; architecture-compliance audits that took weeks of manual review completing in hours when agents execute the checks in parallel across the estate; and frontend/backend handoff latency collapsing from days to minutes once a mocked contract replaces coordination.

weekshours

Architecture-compliance audits, once agents run the checks in parallel

daysminutes

Frontend and backend handoff latency, once a mocked contract replaces coordination

≈10×an order of magnitude

Endpoint migration throughput, once the pipeline is running

Your numbers will depend on how conventional the legacy codebase is, how much of its surface is mechanically discoverable, and how disciplined wave scoping stays.

Method, assumptions and limitations

Reading route Tech

Method

This guide generalizes IH Tech's operating model for AI-agent-driven modernization: local retrieval over an indexed legacy estate, agentic discovery and dependency tracing, scored wave planning, human plan review, bounded execution, and machine-generated parity verification.

Assumptions

The legacy surface is mechanically discoverable (conventional routing, enumerable screens and resources); the organization can staff plan review with people empowered to reject; production traffic or business criticality data exists to feed scoring where test coverage is weak; the environment permits local indexing infrastructure.

Limitations

The throughput observations above are not controlled studies; they come from programs where the fit criteria held. This strategy is explicitly not designed for product re-imagination, multi-system consolidation, or estates where the legacy code cannot serve as a behavioral specification. Model and tooling capabilities continue to shift; the structural principles are the durable part of this guide, and specific tool choices are not.

Corrections

If you believe something here is wrong, tell us. Corrections reach us through the contact route on ihtech.ba, and this guide's modified date changes when its content does.

This guide last changed on