Council Post: Now That AI Writes The Code, Who’s Guarding The Architecture?
Evan J. Schwartz is the Chief Innovation Officer at AMCS Group.gettyThe best AI-led development pipelines today are “spec-first,” and they are genuinely impressive. A human writes a specification, an AI agent ...
Evan J. Schwartz is the Chief Innovation Officer at AMCS Group.

getty
The best AI-led development pipelines today are “spec-first,” and they are genuinely impressive. A human writes a specification, an AI agent builds to it and an independent verifier agent reruns every acceptance criterion (“run X, observe Y”) against a live deployment before the work counts as done. Real discipline, real results.
But software has two values, not one. Behavior is what the system does today; it's urgent, visible and what every process you own verifies. Structure is whether the next change is cheap; it's important, invisible and measured by nothing in your pipeline. You’ve lived the consequence: the codebase where a two-day feature takes three weeks, where estimates inflate release after release while the team works harder than ever. That curve, cost per feature rising as coupling accumulates, used to be drawn by human hands over years.
Here’s what’s new: An AI agent multiplies whatever discipline you already have. It does not supply discipline you don’t.
Velocity is speed times direction. Agents deliver the speed. If your architecture’s arrows point the wrong way (any module can call any module, everything is public, boundaries exist only on a slide from 2019), the agent gets you to the wall faster. Three mechanisms make this concrete.
First, the agent’s defaults are the tutorial’s defaults. Left unconstrained, coding agents produce the shape of every getting-started guide they trained on, with everything public and organized by technical layer. Every unnecessary public type is an invitation to a shortcut, and on a deadline, some future change (whether it be human or AI) will be accepted.
Second, verification is behavior-blind. An agent can pass every acceptance criterion and still leave behind new dependencies from your business core straight into a vendor’s SDK. Every dashboard stays green. Verified is not the same as healthy, and a process that can only see behavior will optimize away the thing it cannot see.
Third, erosion now compounds at machine speed. The old constraint on architectural decay was human typing speed. Teams adopting AI delivery over weak structure are going to discover “legacy code” that is 11 months old. You cannot out-type entropy anymore, and you cannot out-review it either, because erosion lives in the dependency arrows, and arrows don’t show up in a line-by-line diff.
The industry has known the answer since before AI. Dependencies should point inward, toward business policy, away from frameworks and vendors and, as the saying goes, "The best design ignored is no design." That lesson was written for teams of polite humans. Agents are neither polite nor impolite; they are unconstrained until constrained. That’s actually the good news. An agent respects an enforced constraint with a fidelity no human team ever matched. The problem is that nothing in the spec-first loop asks for structure.
So, ask in the loop’s own grammar:
Write a structure contract. Not an architecture diagram, a one-page contract that details which components exist, which dependencies are allowed and which few types are public on purpose.
Make the compiler your co-steward. Feed that contract into a dependency checker (e.g. ArchUnit, NetArchTest, dependency-cruiser, import-linter) running in the same automated gates as your tests. Structure becomes a build fact instead of a review opinion, and agents respect build facts absolutely.
Give the verifier one structural criterion. “Run the dependency check; observe zero new violations.” It takes seconds to run. Now "verified" means it behaved correctly and left the structure no worse.
On a greenfield project, the ordering rule is simple: The Structure Contract precedes the first spec. Name the actors, draw the ten-box component map, write down the arrows and turn on enforcement the same day—the cheapest moment there will ever be. A repo with dependency enforcement from commit one cannot develop this disease; erosion fails the build while it’s still one line big.
But almost nobody gets greenfield. Most companies are laying these AI pipelines over legacy code, and there, the danger inverts. AI agents work by absorbing your repository as context. An agent reading a tangled codebase doesn’t see tangle; it sees house style. Your god-classes and workarounds become its conventions, reproduced fluently in every new file. Context-driven agents don’t inherit your architecture problem—they scale it.
So, the legacy playbook starts differently. Stop the bleeding before healing anything, and never attempt the healing as a standalone project. No business funds a “refactoring quarter,” and none should. Every step below runs inside normal feature delivery.
Assess honestly, and let the audit say “not ready” if that’s the truth. Map reality by generating documentation verified against the code because legacy documentation lies. Set a ratchet by grandfathering today’s violations in the dependency checker, then enforce one rule: "Zero new violations and the count only goes down." You can’t fix 20 years of arrows this sprint, but you can make new wrong arrows fail the build today. Pin behavior before agents touch the tangle, with characterization tests that record what the code actually does—ideal AI grunt work, incidentally. Attack from the edges in. Every feature that touches a messy area pays a small “structure tax.” Introduce the interface the feature needed anyway, retire a few grandfathered violations. Time-box your bridges: Temporary adapters between new and legacy code are legitimate scaffolding, but each needs a written retirement trigger, or it’s permanent debt in costume. And curate the context. Mark legacy patterns “do not replicate” in the agent’s instructions, and make the Structure Contract its required reading. The same agent that would have scaled your worst patterns will follow the contract perfectly—the moment it’s the loudest thing in its context.
AI will write more and more of the code. The judgment, where the boundaries go, which way the arrows point, what must stay changeable and what gets enforced rather than hoped, stays human. Stays yours.
The best design ignored is no design. The best design enforced is the only one an agent can’t ignore.
Forbes Technology Council is an invitation-only community for world-class CIOs, CTOs and technology executives. Do I qualify?