AI writes fast. Production breaks when review is optional.

Enterprise teams adopt Cursor and Claude in weeks. Incidents from unreviewed merges follow in days. The model did not fail. The gate did.

The Agent Is a Junior Engineer

Fast output. No judgment. No memory of last week’s outage.

Treat it like a junior who ships plausible code on the first try. You would not let that merge without review. The same rule applies when the junior is an API.

Speed is not the product. Correctness under load is.

Three Gates Before Merge

No code reaches main without passing all three.

Gate 1 — Spec exists

What must this change do? What must it not do? What tests prove it?

If there is no spec, the agent is guessing. Guessing at enterprise scale is expensive.

Gate 2 — Tests pass

CI green is not negotiable. Agents generate tests that assert the happy path. You add the failure paths.

A merge with failing tests is not a merge. It is debt with a green avatar.

Gate 3 — Human read the diff

Someone who owns the system read every changed line.

Not skimmed. Read.

Auth, payments, data retention, and external integrations require a named owner on the PR.

What the Gate Blocks

No spec          → do not generate code
Tests failing    → do not merge
Diff unread      → do not merge
Sensitive paths  → named owner approval required

Sensitive paths are a short list. Keep it short:

app/Payments/
app/Auth/
app/Webhooks/
config/production/
migrations/

Agents can draft. Humans own these directories.

Metrics That Matter

Lines generated is vanity. Two numbers tell the truth:

Hotfix rate — releases that fix releases. If AI velocity doubles but hotfixes climb 30%, you are not faster. You are noisier.

Review discipline — PRs merged without spec link or without owner on sensitive paths. Track it. One skip becomes culture in a quarter.

At Patchstack scale, tightening review gates and CI cut hotfix releases roughly 30%. Velocity went up anyway — because less time went to firefighting.

Enterprise Reality

Regulated environments add one rule: every AI-assisted change must be explainable.

Explainable means:

  • Spec links to ticket or requirement
  • Test names describe behavior
  • Commit message states what changed and why
  • Audit can trace decision without opening chat logs

Chat logs are not documentation. Merged code is.

Rolling It Out

Do not mandate AI tools and skip the gate. Mandate the gate and let tools compete inside it.

Week 1: define sensitive paths and spec template. Week 2: block merge on failing tests — already should exist. Week 3: require spec link on every agent-assisted PR. Week 4: measure hotfix rate. Adjust.

Leads who skip grief and skip gates get adoption and lose standards. Both show up in the same dashboard eventually.

Key Takeaways

AI-assisted code needs the same merge discipline as human code. More, not less.

Three gates: spec exists, tests pass, human read the diff.

Sensitive paths need named owners. Agents draft; humans own.

Track hotfix rate and review skips — not lines generated.

Enterprise AI is explainable merges, not faster chaos.

The merge gate is not anti-AI. It is how AI ships in production.