Cloudflare enforces engineering standards using AI by running an AI code reviewer and a "spec reviewer" agent against one rulebook: the Cloudflare Codex. Both check every pull request and design doc against it. In four months, the reviewer flagged roughly 230,000 standards violations and blocked 16,000 merges, per Cloudflare's own August 2026 write-up.
Short answer: Cloudflare built the Cloudflare Codex, a machine-readable set of engineering standards written in RFC 2119 language (MUST/SHOULD). It then pointed an AI code reviewer and a spec reviewer agent at it. In four months the reviewer flagged 230,000 violations and blocked 16,000 merges. A separate agent reviewed 600 technical specs before code was written.

I read both of Cloudflare's engineering posts on this — the enforcement post and the internal AI stack post — line by line. I wanted the real mechanics, not just the headline numbers. In my testing of similar setups on smaller repos, the hard part was never picking a model. It was writing the standards down clearly enough for an agent to enforce them the same way twice. That's the part worth stealing from Cloudflare's approach, whether or not you run anything close to their scale.
What you'll need
You don't need Cloudflare's internal tooling to borrow the idea. You need three things. First, a written set of engineering standards your team already mostly agrees on, even if it lives in Slack threads and a stale wiki page today. Second, an AI coding tool that can run in CI or as a pre-merge check — Claude, Cursor, and GitHub Copilot all support this in different forms, and my best AI tool for code roundup compares how each handles automated review. Third, a plan for what's blocking versus advisory. Cloudflare's two-stage model — an "approved" tier that just flags, and an "enforced" tier that blocks the merge — is the single most useful idea to copy. Rolling straight to "AI blocks your PR" on day one is how teams kill the whole effort in a week.
Step-by-step: how Cloudflare's system works
1. Standards get written as machine-readable rules, not prose
Cloudflare didn't feed an LLM its wiki and hope for consistency. It rebuilt developer guidance into the Cloudflare Codex: a governed set of standards organized by domain (architecture, security, reliability, language-specific rules). Each domain has an owner. Each rule uses RFC 2119 keywords like MUST and SHOULD, and each statement gets extracted into a JSON structure with a stable slug ID, so it can be tracked and cited across tools.
2. Rules ship in two tiers: approved and enforced
New or contested standards start "approved" — the AI reviewer surfaces violations as non-blocking comments so teams get used to them. Once a rule is stable, it moves to "enforced," and a MUST violation blocks the merge outright. That staged rollout is why Cloudflare could reach 16,000 blocked merges without also blocking every team on day one.
3. An AI code reviewer runs on every pull request
The reviewer runs as part of standard CI. Fast linters (oxlint for TypeScript, a Rust linter for Rust) handle the mechanical checks. The AI layer handles the judgment calls a linter can't make. Cloudflare says a typical review takes about two minutes, and developers can also run it locally from the CLI before pushing.
4. A spec reviewer agent checks designs before code exists
Separately, a spec reviewer agent checks technical design docs against the same Codex before implementation starts. It's built as a Cloudflare Worker using D1, AI Gateway, and Cron Triggers. Since it launched in May 2026, it has reviewed close to 600 unique specs across more than 3,200 invocations. Cloudflare reports roughly 6% of findings as critical, 65% as major, and 29% as minor.
5. The same standards get applied to incident reports
A third agent checks incident postmortems for completeness: contributing factors, follow-up actions, clarity of explanation. It has assessed 200+ incident reports since May 2026, and it's now mandatory for high-severity incidents. That closes the loop — the same rulebook that governs how code gets written also governs how failures get explained.
Example prompts you can copy
If you want to build a lighter version of this for your own repo, here's what I used when testing a similar setup with an AI coding assistant wired into a pre-merge check:
- "Review this diff against
/docs/engineering-standards.md. List every MUST violation separately from every SHOULD violation, and cite the specific rule number for each." - "This design doc is in
/specs/. Check it against our architecture and security standards before I write any code, and flag anything that would fail review later." - "Summarize this incident report. Does it name a root cause, contributing factors, and a follow-up action? If any are missing, say which one."
- "Treat every 'MUST' rule in this file as blocking and every 'SHOULD' rule as advisory-only. Don't block on SHOULD violations."
The pattern that mattered most in my testing: naming the exact standards file and telling the model which violations are blocking versus advisory. Vague prompts like "check this for quality" produced inconsistent, mood-dependent reviews — specific rule citations didn't.
Common mistakes to avoid
The biggest mistake is enforcing before you've earned trust. Turn on blocking mode before engineers believe the rules are fair, and they'll route around the tool instead of fixing the code. Cloudflare's approved-then-enforced staging exists to avoid exactly that. Second, writing standards in prose only a human can parse consistently — an AI reviewer is only as consistent as the rule it checks against, so vague guidance produces vague enforcement. Third, skipping an owner per standard. Cloudflare assigns one to each domain, and a standard with no owner rots the same way undocumented code does. Fourth, checking code but ignoring design docs; catching a violation in a spec review is far cheaper than catching it after 2,000 lines are already written. Fifth, treating the AI reviewer as infallible. At Cloudflare's volume, some false-positive rate is inevitable, so a human appeal path still matters.
Cloudflare's AI enforcement layer at a glance
| Component | What it does | Reported scale (as of Aug 2026) |
|---|---|---|
| AI code reviewer | Flags/blocks MUST and SHOULD violations on every PR | 230,000 violations flagged, 16,000 merges blocked in 4 months |
| Spec reviewer agent | Checks design docs against the Codex before coding starts | ~600 unique specs, 3,200+ invocations since May 2026 |
| Incident report reviewer | Checks postmortems for completeness and root cause | 200+ incident reports reviewed since May 2026 |
| Cloudflare Codex | The governed rulebook both agents check against | RFC-2119 language, two-stage approved/enforced lifecycle |
Tools that make this easier
You don't need Cloudflare's internal Worker-based infrastructure to try a scaled-down version. If your team already lives in an AI-assisted editor, Cursor and GitHub Copilot can both be pointed at a standards file for inline review. See my Cursor vs Copilot comparison if you're picking between them. For a CLI-driven review step in CI, Claude handles long standards documents well and cites specific rules back in its output — that habit is what made Cloudflare's system trustworthy at scale. If you're setting up a coding agent for the first time, my mission for Claude Code guide covers the practical setup steps, not just the theory. None of these get you to 230,000 flagged violations on day one. Start with an "approved," non-blocking tier on a handful of MUST rules, and only flip to enforced once your team stops disputing the findings.
My take
What stands out in Cloudflare's numbers isn't the AI model. It's that they wrote standards precisely enough for a model to check them, then staged enforcement so trust came before blocking. Any team can borrow the two-stage approved/enforced pattern without building Cloudflare-scale infrastructure. The failure mode to avoid is skipping straight to "AI blocks your merge" before anyone agrees the rule is right.
Frequently Asked Questions
Is Cloudflare's AI code reviewer free or available to other companies?
No — this is an internal system Cloudflare built for its own engineering org, not a product it sells. The write-up is public, but the Codex, the reviewer, and the spec agent aren't offered externally as of this writing.
How long did it take Cloudflare to roll this out?
Cloudflare describes an eleven-month rollout to reach 93% adoption of AI coding tools across its R&D organization, with the spec reviewer and incident reviewer agents launching in May 2026, about halfway through that window.
What is the easiest way to start enforcing standards with AI on my own team?
Write down 5-10 MUST rules you already agree on, point an AI coding assistant at that file during code review in non-blocking mode, and only turn on hard blocking once engineers stop disputing what it flags — that mirrors Cloudflare's approved-to-enforced staging without needing custom infrastructure.
Does this replace human code review?
No. Cloudflare's own numbers show the AI reviewer runs alongside human review, not instead of it — it clears the mechanical, rule-based checks fast so human reviewers spend their time on design judgment calls the rules can't capture.
What models or tools power Cloudflare's system?
Cloudflare's internal stack routes the large majority of requests (over 91%) to frontier models from OpenAI, Anthropic, and Google via its own AI Gateway, with the remainder handled by Workers AI models like Kimi K2.5 for cheaper, high-volume tasks.