Shipping an MVP with an AI coding agent over a rainy weekend feels like magic. Maintaining that same codebase six months later feels like defusing a bomb in the dark.
Across the software industry, engineering teams are discovering a painful truth about AI-assisted development: it compresses five years of architectural drift into a matter of weeks. Code piles up faster than anyone can read it, duplication spreads quietly, and a quick tweak to one module suddenly breaks checkout or billing on the other side of the app.
When a fresh codebase turns brittle, the knee-jerk reaction is almost always the same. If an LLM built it in two days, why not let an LLM rewrite it from scratch?
I recently sat down with Dmitriy Fedoryshchev, a lead software engineer at EverCommerce building systems from scratch, scaling them into production platforms, and modernizing complex software without destructive rewrites. Having used AI agents daily since early 2025 across production environments with hundreds to thousands of endpoints, Fedoryshchev has seen firsthand what happens when generation outpaces engineering discipline. His verdict on the full-rewrite impulse is blunt.
Generating a brand-new pile of code is cheap and fast. Keeping the deep, hidden behaviors of a production system intact is where the real bill arrives.
"The price and the risk sit in the cases that are deep, nasty, and hidden, the ones that bleed and ache when nobody expects it," Fedoryshchev explained.
Any system that has survived real users accumulates side effects layered over dozens of fixes, some documented and many forgotten. With agent-written code, there is rarely even an original author around to ask why a strange edge case exists. If you hand that messy codebase back to an AI and ask for a clean rewrite without strict human architectural ownership, you end up with the same system in newer clothes, minus the hard-won stability.
"If AI planned it and implemented it, that isn't engineering, it's vibe coding," Fedoryshchev said. "So a rewrite doesn't remove the legacy. It turns a mess people understand into something nice nobody does yet, and the nice version solves the same problems differently, with new limitations, new workflows, and new costs and debts of its own."
“That doesn't make a rewrite wrong," he added. "It needs a reason worth the risk, and people in charge who oversee it and accept the result."
Even then, rebuilding works best for a component with a clean, isolated boundary, where the old version serves as the spec and both versions can run side by side for comparison. Everywhere else, teams need data over aesthetics. Choosing what to stabilize starts with measuring where changes concentrate, what depends on them, and where tests are missing, rather than chasing whichever file looks ugliest.
Before an engineer or an agent modifies a tightly coupled system, they require a map of what will shake when a file moves. In his Top Voices sessions and engineering work, Fedoryshchev separates risk into two distinct signals: hotspots and blast radius.
Hotspots are files that change constantly, often because requirements were never settled or because too many hands pulled the code in competing directions. Blast radius measures how far a mistake travels. Changing an isolated support routing page carries minimal risk; touching an invoicing module can ripple through payments, notifications, statuses, and customer emails all at once.
The real danger sits in hidden dependencies that never show up in import statements. To surface those blind spots, Fedoryshchev built warpmap, an open-source Go audit CLI that maps dependency graphs, churn-by-complexity hotspots, and test gaps before any code is altered. Crucially, it mines Git history to spot files that repeatedly change together even when no direct code import links them.
"For AI-generated changes, the map tells you where to look: where it's going to ripple, what to start with, and what to pay attention to in manual testing, verification, and code review, in what order," he noted.
In his workflow, that map doubles as a gatekeeper. It takes a baseline snapshot before a change and fails a pull request if the codebase's structural health degrades. One step earlier, his open-source multi-agent orchestrator, agentweft, runs a preflight check that blocks an agent from editing inside a hot blast radius or pauses the run for a human engineer to make the call.
Most teams try to tame coding agents the polite way: by writing longer and louder markdown instructions. Fedoryshchev tried that route too, accumulating more than 5,000 lines of guidelines across 18 context-loaded files. It still broke down.
The math works against natural-language prompts. If an agent drops one rule out of 10, giving it 100 rules does not yield 10 misses; it yields 20 or 30, and every context compaction or agent handoff makes the amnesia worse. Worse still, when an agent hits a friction point, such as integrating a mandatory internal payments library instead of a generic one from its training data, it tends to favor familiar, widely adopted solutions over project-specific requirements. It may even rewrite the definition of done to make its task easier.
In his HackerNoon articles and webinars on keeping AI code safe to change, Fedoryshchev calls the fix the "demotion ladder." Every time a prose rule fails, it gets demoted one rung down into something deterministic.
"The ladder is how I learned it; the rule of thumb now is that a script beats prose: if a rule can be a script or a check, even partly, it has to become one," Fedoryshchev said.
By moving hard requirements into harnesses, file locks, and CI checks, he trimmed his prompt rules from over 5,000 lines down to roughly 1,000. A deterministic check run 300 times produces the same answer 300 times. Leaving only non-canonical judgment calls to the LLM frees up context for actual problem-solving while making process failures mechanically impossible.
If an AI agent can modify both application code and the test suite, it will eventually tweak the tests to make a broken build pass. Fedoryshchev eliminates that temptation through strict role isolation inside agentweft, which powers daily delivery workflows of over 20 engineers.
In his setup, one role writes the definition of done, a separate tester role writes tests against it, and the developer agent implements the code while locked out of modifying either the plan or the tests. Each stage has an explicit tool scope enforced at the CLI permission level, and a reviewer that did not write the code can send work back at most twice.
Splitting work across roles introduces a familiar challenge that Fedoryshchev calls the "joining tax," where separate agents make conflicting assumptions across the seam. The antidote is shared context and bounded loops. Every agent receives both the technical spec and the underlying business goal, so a developer agent pushes back when a test or requirement clashes with reality rather than quietly moving the goalposts.
"It's how you'd run a team: each person gets the tools they can use and the rules they follow, and the work is split," he said. "One agent on its own is like a capable new hire with no onboarding. The workflow and the harness keep it on its path, and the orchestration lets several of them work together."
Enterprise teams rarely get to pause feature delivery for six months to untangle a monolith. Drawing on his experience decomposing a 600+ table monolith into roughly 30 services at EverCommerce, Fedoryshchev applies the same vertical-slice discipline to mixed human-and-AI codebases Drawing on his experience decomposing a 600+ table monolith" please; the earlier 500+ was an older count into roughly 30 services at EverCommerce, Fedoryshchev applies the same vertical-slice discipline to mixed human-and-AI codebases.
Teams start at the system level, isolate the dependency-graph leaves that break most often, pin their behavior, freeze feature work on that narrow slice, and modernize in place. Because AI generates implementation fast once a solid plan exists, the freeze window stays remarkably short. To preserve institutional memory when no human wrote the original lines, every agentweft flow closes with a retrospective, the way a human team would hold one: it records why each change was made and the context behind it and updates the docs, tests, and process steps that need it, so the next run starts from a better base.
That shift also redefines what a senior engineer does all day. Syntax production is now a commodity; architectural judgment is the bottleneck.
"For senior engineers, the biggest shift is that everyone feels like a tech lead now," Fedoryshchev said. "The asset isn't writing code anymore or knowing how to write it. It's knowing how the system works, how it's structured, and how its concepts operate."
Typing slowly has given way to continuous systems auditing, boundary design, and high-stakes review. It is mentally demanding work, and it leaves no room for autopilot. Teams that treat AI as an unsupervised rewrite engine will keep rebuilding the same fragile black box every six months. Teams that wrap their agents in deterministic rails get the speed without the hangover.
This article originally appeared on Dataconomy and is reproduced with permission.