Cloudflare uses AI to police code

Cloudflare deploys AI to enforce engineering standards, flagging 250K code deviations and blocking 16K merges via its Codex knowledge base.

Diagram showing the Cloudflare Codex workflow from RFC proposal to approved and enforced states.
Cloudflare
Visual TL;DR
Scattered Engineering GuidanceDriver
From the article 2 mentionsPreviously, engineering guidance was scattered across documentation, code repositories, chat logs, and individual engineers' knowledge.
Cloudflare CodexContext
From the article 9+ mentionsThis initiative draws from the Cloudflare Codex, a unified repository of engineering guidance designed for both human and automated consumption.
AI Code ReviewerCore
From the article 7 mentionsOver the past four months, the company's AI code reviewer identified nearly 250,000 violations of its engineering best practices.
AI Spec ReviewerCore
From the article 3 mentionsIts companion, a spec reviewer agent, has evaluated about 600 technical designs prior to implementation.
Flagged 250K DeviationsOutcome
nearly 250,000 violations of engineering best practices identified in 4 months
From the articleCloudflare is deploying artificial intelligence to enforce its engineering standards, a move that has already flagged hundreds of thousands of code deviations and blocked thousands of merges.
Evaluated 600 DesignsOutcome
From the articleIts companion, a spec reviewer agent, has evaluated about 600 technical designs prior to implementation.
Enforce Engineering StandardsEffect
Cloudflare uses AI to enforce consistent engineering standards
From the article 2 mentionsCloudflare is deploying artificial intelligence to enforce its engineering standards, a move that has already flagged hundreds of thousands of code deviations and blocked thousands of merges.
Blocked 16K MergesOutcome
From the articleCloudflare is deploying artificial intelligence to enforce its engineering standards, a move that has already flagged hundreds of thousands of code deviations and blocked thousands of merges.
Contents(3)

Cloudflare is deploying artificial intelligence to enforce its engineering standards, a move that has already flagged hundreds of thousands of code deviations and blocked thousands of merges. Over the past four months, the company's AI code reviewer identified nearly 250,000 violations of its engineering best practices. Its companion, a spec reviewer agent, has evaluated about 600 technical designs prior to implementation. This initiative draws from the Cloudflare Codex, a unified repository of engineering guidance designed for both human and automated consumption.

The need for such a system became apparent as Cloudflare grew. Previously, engineering guidance was scattered across documentation, code repositories, chat logs, and individual engineers' knowledge. This fragmentation made it difficult for developers to find current and authoritative information, leading to wasted time and inconsistent application of standards. Relying solely on human reviewers also became unsustainable; no single engineer could possibly read and verify every standard across all projects.

Building the Codex

To address this, Cloudflare constructed the Codex, a structured collection of engineering standards. This centralized knowledge base allows AI agents to access and apply guidance directly at the point of work, whether it's code review, technical design evaluation, or incident report analysis. The Codex is organized into distinct domains, such as architectural patterns, security, reliability, and specific programming languages. Each domain is managed by an owner responsible for its content quality and consistency.

Standards within the Codex follow an RFC (Request for Comments) format, using keywords like MUST and SHOULD as defined by RFC 2119. Any employee can propose a new standard via a merge request. These proposals undergo multiple rounds of feedback before an owner grants final approval, at which point the RFC becomes part of the Codex and is published internally. Initially, approved RFCs generate non-blocking findings. However, after an explicit promotion step, enforced RFCs can block merges that violate MUST requirements, providing a crucial buffer for teams to adapt to new standards.

AI's Role in Enforcement

Feeding the entire Codex corpus directly to a large language model would strain context windows and degrade performance, especially as the number of RFCs grows. Cloudflare employs a purpose-built agent to extract and condense MUST and SHOULD statements into a structured JSON format. This process enriches the data with metadata, enabling efficient retrieval and progressive disclosure of relevant standards. Each extracted statement receives a stable slug identifier, crucial for tracking across different systems over time for monitoring and exception handling.

The JSON output, an example of which details control plane service requirements, includes fields like `rfc`, `title`, `status`, `domain`, and `statements`. Each statement contains its own `slug`, `section`, `level` (MUST or SHOULD), `text`, and `href` for easy reference. This structured approach allows AI agents to precisely identify and flag deviations, freeing up engineers to focus on higher-level problem-solving and strategic development rather than manual compliance checks.

Why This Matters

Cloudflare's approach highlights a significant trend: the increasing reliance on AI not just for creating software, but for ensuring its quality and adherence to organizational policies. As software complexity and development velocity accelerate, traditional methods of code review and standard enforcement struggle to keep pace. By automating much of this process, Cloudflare aims to maintain engineering rigor at scale, prevent knowledge silos, and reduce the costly errors that can arise from inconsistent practices. This could set a precedent for other large tech organizations grappling with similar scaling challenges. For startups, the underlying principle of codifying and automating best practices, even without massive AI teams, offers a valuable lesson in building scalable, high-quality products from the ground up.

© 2026 StartupHub.ai. All rights reserved. You may not republish this article in full without a license. Search engines and AI research tools may crawl and summarize for reference. Bulk reproduction or model training requires a license. See our terms.
Daniel Singer

Written by

Daniel Singer

Editor, StartupHub.ai

Daniel Singer is the editor of StartupHub.ai, a technology expert and thought leader on AI and its applications across sectors, from fintech and healthcare to developer tooling and consumer software. He writes and tests the tools covered here thoroughly and regularly, and built StartupHub.ai to give founders, operators and buyers a clearer read on what they are actually being sold.