First posted on LinkedIn, October 25, 2026. Also published on Blogspot.
---
When modernizing old software, it is tempting to tell AI: "Read the old code and rewrite it." That is a trap. Before changing a single line of code, solution architects should use AI for Domain-Driven Discovery—mapping out the true business rules and boundaries inside the existing system.
We tested an open-source multi-agent AI tool (han-ddd) across five codebases spanning COBOL, Java, and C#/.NET. Total time was 13 to 46 minutes per system, and the total AI cost for all five runs was just $31.
## The 7 Takeaways
### 1. Pair AI Investigators with an "AI Critic"
A single AI is too eager to please. If it sees a folder named RouteFinder, it assumes that is a real business area, even if the code inside is fake. Instead, use a team of AI agents: have five specialized workers gather clues (words, features, data ownership, structure, and behavior) and have an Adversarial Critic agent attack the first draft.
In our test, the Critic changed 3 of the 5 models and pruned 12.5% of the proposed business areas (cutting 16 candidates down to 14).
### 2. Trust Database Writes, Not Folder Names or Comments
Documentation and folder names show what developers hoped to build, not what actually runs. Have your AI trace who owns and writes to the database.
In the FTGO food delivery app, a book describes six services, including Accounting. The AI proved that the Accounting service did not exist in the code, and the Restaurant Menu controller was completely empty.
### 3. Hunt for Hidden Bugs Before You Rewrite
If AI rewrites your old system line-by-line, it will copy every old mistake into your new code. Use behavioral AI agents to trace how data changes step-by-step.
Across all five systems, the AI uncovered severe bugs before a single line was rewritten:
- COBOL Mainframe (CardDemo): A database cleanup program forgot to save its changes, causing customer credit limits to permanently run out over time.
- Java (FTGO): A backward math check rejected valid order changes while letting under-minimum orders slip through.
- .NET (eShopOnWeb): Saved checkout data in three separate steps without a transaction.
- Java (JPetStore 6): No guard to stop inventory from dropping below zero.
### 4. Sort Business Areas into Three Readiness Buckets
Not every business area is ready to be extracted on day one. Have AI grade each area by how clean its boundaries are today:
- CURRENT (Ready): Clean data and rules today (11 of 14 final areas).
- LATENT (Tangled): A real business area currently tangled inside another area's database updates (1 of 14).
- SPECULATIVE (Thin Proof): Mostly stubs or thin wrappers that need a human decision (2 of 14).
### 5. Keep "Weak" Ideas Visible to Ask Better Questions
The AI Critic issued 4 Strong, 9 Plausible, and 3 Weak verdicts—and 0 Rejections. Instead of deleting weak boundaries in the dark, the AI downgrades them and flags them for human review. Code only tells you what it does—not why a strange rule was promised to a customer 20 years ago.
### 6. Don't Confuse a Business Area with a Microservice
Across all five systems, the AI found only 2 to 4 business areas per system—not dozens of tiny services. Finding a clear business boundary does not mean you must deploy a separate microservice. You can keep a single, well-organized program (a modular monolith) and decide how to deploy it later.
### 7. Look for Shared-Data Bottlenecks Early
Old COBOL code was no harder for the AI to map than modern Java or .NET. The AI quickly spotted when four different mainframe programs were changing the exact same account balance file—giving architects an early warning sign before they try to split the database.
---
The formal verification report with ground-truth tables and critic verdicts is available in the full PDF.