Preheader: Your AI agent needs an architecture gate.

AI did not make code cheap.

It made bad architecture faster.

That is the part the LinkedIn victory laps keep skipping. A coding agent can patch a bug, add a route, rename a component, and make the tests pass. Great. Then two weeks later the same rule exists in three places, the frontend and backend disagree, nobody knows where the seam is, and every new change needs another little exception.

That is not speed.

That is entropy with a nicer autocomplete box.

Matt Pocock has a useful frame for this: shallow modules versus deep modules. A deep module hides real behavior behind a small interface. A shallow module gives you a tiny bit of behavior and makes every caller learn too much.

Agents make shallow code worse because shallow code gives them too many places to type.

Another helper. Another wrapper. Another conditional. Another duplicated rule that looks reasonable inside the file the agent happened to open.

The damage shows up later, when the codebase becomes harder to change even though each individual change looked fine.

Use a gate before you let an agent work in messy code.

Before implementation, make it answer this:

  • What module owns this behavior?

  • What interface should callers use?

  • Where is the seam?

  • What adapter satisfies the seam in production?

  • What adapter satisfies it in tests?

  • Which duplicated rule disappears if we do this properly?

  • What test proves the behavior stayed put?

If the agent cannot answer those, it is not ready to implement. It is ready to scout.

Ask for one to three architecture-deepening candidates instead:

  • file paths involved

  • shallow module or missing seam

  • proposed module boundary

  • behavior that moves behind the interface

  • test surface

  • risk if you leave it alone

Then pick one candidate yourself.

That last part matters. Agents are good tactical programmers. They can search, compare, sketch, and patch quickly. They are bad owners of long-term codebase health unless you force the architecture conversation before the typing starts.

The mistake is treating AI coding like a cheaper keyboard.

Treat it like a junior developer who can type very fast and has no taste unless you give it constraints.

If the codebase is already muddy, do not start with "fix this ticket."

Start with "show me the seam."