Cloudflare、AI コードレビューでエンジニアリング基準を強制
本文の状態
日本語全文を表示中
詳細モードで約13分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Cloudflare AI
Cloudflare は AI コードレビューと仕様レビューエージェントを活用し、エンジニアリング標準を統一的な「Codex」で管理することで、開発効率の向上と品質の維持を実現した。
AI深層分析を開く2026年8月4日 22:47
AI深層分析
キーポイント
AI エージェントによる実効的な標準遵守
過去4ヶ月間で AI コードレビューが約25万件の違反を検出し、16,000件のマージをブロックしたほか、仕様レビューエージェントが約600件の技術設計を評価している。
分散していたナレッジの統合と Codex の構築
ドキュメントやチャットに散在していた開発ガイドラインを「Cloudflare Codex」として統一的なガバナンスモデルのもとで再構築し、エージェントが即時参照・適用可能にした。
RFC 形式に基づく標準策定プロセス
Codex の標準は RFC 2119 に準拠した SHOULD/MUST キーワードを用いた形式で策定され、ドメインオーナーの承認を経て内部サイトへ公開される。
多様なユースケースへの展開
コードレビューや技術設計レビューに加え、インシデントレポートのレビューなど、エンジニアリングライフサイクルの複数の局面で標準が適用されている。
RFC のライフサイクル管理と構造化
RFC は承認後すぐに強制されるのではなく、チームが要件を吸収できる猶予期間を持つ「enforced」状態への移行ステップを経る。LLM のコンテキスト負荷を軽減するため、SHOULD/MUST 文を抽出した JSON 構造に変換し、安定した識別子で追跡可能にする。
重要な引用
Over the past four months, our AI code reviewer has flagged nearly a quarter of a million deviations from Cloudflare engineering standards and blocked 16,000 merges.
We rebuilt this body of knowledge as the Cloudflare Codex: a governed set of engineering standards that agents can retrieve and apply at the point of work.
Approved RFCs can be consumed by Codex clients and agents, which may then start to flag Codex violations in code, configuration, or documentation.
This separate promotion step gives teams time to absorb new requirements and accommodates cases where enforcement needs additional work.
編集コメントを表示
編集コメント
大規模組織が直面するナレッジの分散と標準遵守の難しさを、AI エージェントを中核に据えたシステムで克服した事例は非常に示唆に富む。特に RFC 形式による標準策定プロセスと AI の連携は、他社でも参考にできる実用的なアプローチである。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
過去4ヶ月間、当社のAIコードレビューシステムはCloudflareのエンジニアリング基準からの約25万件の逸脱(本稿では「違反」と呼ぶ)を検出し、1万6000件のマージをブロックしました。また、仕様レビューエージェントは実装開始前に約600件の技術設計案を同基準に基づいて評価しています。
両システムは「Cloudflare Codex」に依存しており、これはエンジニアとAIエージェントの双方を対象とした、共有されたエンジニアリングガイダンスのソースです。本稿では、なぜCodexを開発したのか、それがエンジニアリングライフサイクルにおいてどのように機能しているか、そして今後の計画について解説します。
Codex(以前のAIエンジニアリングスタックに関する記事で簡単に紹介しました)が登場する以前、Cloudflareにおける開発者のガイダンスは、公式ドキュメントやリポジトリ内のファイル、チャットスレッド、個々のエンジニアが蓄積したナレッジなど、あちこちに散在していました。エンジニアたちは解決すべき問題に取り組むよりも、必要なガイダンスを探すことに多くの時間を費やすことが多々ありました。また、答えを見つけたとしても、それが最新の情報か、権威あるものか、自身の状況に適用できるものかを判断できないケースも少なくありませんでした。
Cloudflareが成長するにつれて、このモデルを維持することは次第に困難になってきました。どのエンジニアもすべての基準を読み切ることはできず、レビューアーがすべての要件を確実にチェックすることも不可能です。チーム間での人員移動に伴い、組織的なナレッジの引き継ぎが難しくなりました。さらに、ガイダンスが一貫して提示・実施されないことで、プロジェクト間で基準のズレ(ドリフト)が生じる原因ともなっていました。
このナレッジベースを再構築し、エージェントが作業現場で参照・適用できる管理されたエンジニアリング基準セット「Cloudflare Codex」として確立しました。同様のガイダンスは、コードレビューや技術設計レビュー、インシデント報告書のレビューなど多様なユースケースに活用可能となり、エンジニアは得られた知見に対して時間と判断力を集中させることができます。
Codex の組織体制とワークフロー
専用の Codex ガバナンスモデルが、Cloudflare が重視するエンジニアリング領域をカバーする複数のドメインに Codex を分割しています。対象となるのは、アーキテクチャ関連(フロントエンドやコントロールプレーンなど)、横断的な課題(セキュリティと信頼性)、特定のプログラミング言語(TypeScript や Rust)、そしてその他の分野です。各ドメインには責任者が任命され、所管文書のコンテンツ、一貫性、および全体的な品質を管理します。
Codex の基準は、RFC (Request for Comments) 形式を採用しています。要件については RFC 2119 で定義された「SHOULD」や「MUST」といったキーワードを使用します。また、ドメイン情報や RFC ステータスなどのメタデータを格納するためのフロントマターヘッダーも必須です。関心が高く、該当ドメインの専門知識を持つ Cloudflare の従業員であれば、定められた構造に従ったマージリクエストを通じて RFC を提案できます。提案は、レビュー対象者の範囲を徐々に広げながら複数のフィードバックラウンドを経るプロセスを経て承認されます。最終的にドメイン責任者から承認されれば、その RFC は Codex に組み込まれ、Astro で構築された社内サイトへ公開されます。
承認された RFC は Codex クライアントやエージェントによって利用可能となり、コード、設定、ドキュメント内の Codex 違反を即座に検出・フラグ付けできるようになります。ただし、RFC が「承認」状態から「強制適用」状態へ移行するまでは、Codex の記述に基づいたブロック処理は行われません。この段階的な昇格プロセスにより、チームには新要件の理解と吸収の時間を与えられ、強制適用に追加の手間が必要なケースにも柔軟に対応できます。
以下の図は Codex ワークフローの各ステップを示しています。
単純なアプローチとしては、Codex 全体をそのまま大規模言語モデル(LLM)に読み込ませることも考えられます。しかし、すでに 60 件以上(そして増加中)ある RFC の数を考慮すると、その語彙量はコンテキストウィンドウに過度な負荷をかけ、LLM の結果に悪影響を及ぼす可能性があります。モデルが最も関連性の高い RFC に焦点を当てられるよう支援するため、私たちは専用のエージェントを呼び出し、SHOULD および MUST 記述を自動的に抽出して専用 JSON 構造へ圧縮し、遅延発見(lazy discovery)と段階的開示(progressive disclosure)をサポートするメタデータを付加しています。以下は、制御プレーンサービスに関する RFC の結果を示す抜粋です。
各記述には、RFC が更新された場合でも抽出プロセス中に不変である安定したスラッグ識別子が付与されます。この識別子により、異なるシステム間での同一記述の追跡が可能となり、監視、分析、例外処理に不可欠な基盤となります。
当初は、規定文を JSON ではなく、より簡潔な Markdown ファイルに抽出していました。しかし時を経て、エージェントが必要な情報をより正確にフィルタリングできるよう、より構造化されたリッチな形式へと移行しました。今後はさらに絞り込みを強化するため、ソフトウェア開発ライフサイクル(SDLC)のどの段階(設計、実装、実行時など)にその規定が適用されるかを示すメタデータを追加する予定です。
Codex の利用者
現在、いくつかのシステムで Codex が日常の開発業務に活用されています。特に AI コードレビューアー、仕様書レビューアー、インシデントレポートレビューアーという 3 つのエージェントが、その実運用における役割を示しています。
AI コードレビューアー
別の記事で詳しく紹介している AI コードレビューアーエージェントは、Codex の遵守状況を含む複数の観点からマージリクエストを評価します。
各レビューにおいて、エージェントは RFC(提案文書)を取得し、Codex の規定文を解析します。モデルやコーディネーターが追加のコンテキストを必要とする場合のみ、RFC の本文全体を読み込みます。多くのケースでは、規定文自体に報告された違反事項の説明に必要な情報が含まれています。
「SHOULD」と「MUST」の区別と、RFC のステータスがレビューアーの対応方針を決定します。承認済みの RFC からの発見事項は非ブロック型の推奨事項として扱われます。一方、RFC が強制力を持つ状態になると、満たされていない「MUST」要件に対しては、その重大度に応じて承認の保留またはマージリクエストのブロックが行われます。
今年初に Codex の導入以来、AI コードレビューアーが約 23 万件の違反を検知しました。そのうち約 1 万 6,000 件は承認保留の対象となりました(これは、強制された RFC に記載された「MUST」要件への違反を指します)。
コードレビューの代替手段
コーディネーターフレームワークとサブエージェントの実行により、AI コードレビューアーの単一実行には通常数分かかります。待機時間は多くの場合、コストに見合うものですが、エンジニアからは是正処理に伴う遅延や追加ラウンドトリップへの不満の声が上がっていました。そこで私たちは体験を改善する方法を検討し、2 つの新たな選択肢を提案しました。
機械的に検証可能な言語固有の Codex 要件については、カスタムリンター構成パッケージを提供しています。これらは Codex の仕様に沿って設計されており、問題点をミリ秒単位で検出することが可能です。TypeScript は、Codex リンターサポートの対象となる最初の言語であり、同時にパフォーマンスに優れたリンター実行のために oxlint(最近 Cloudflare に加わった VoidZero チームが維持管理)を標準化しました。Rust プロジェクト向けのリンターは現在開発中で、Go についても将来的に対応し、Cloudflare で最も頻繁に使用されている主要言語の網羅的なサポートを実現する予定です。
継続的インテグレーション(CI)のレビューサイクルからの脱却を目指し、コマンドラインインターフェース(CLI)を通じてローカル環境で AI コードレビュアーを実行可能にしました。これは CI のコーディネーター機能と同等の役割を果たし、自動的に決定された差分セットに対して同じ OpenCode ベースのエージェントを実行し、その結果をターミナルに表示します。
リンターはほぼすべての開発者とコードベースにとって有用であると考えていますが、CLI はそれを好むエンジニア向けのオプションとして提供しています。
仕様レビュアー
Cloudflare のエンジニアたちは、実装前に設計ドキュメントや技術仕様(以下、仕様)を定期的に作成しています。Codex の重要なサブセットは、設計、アーキテクチャ、および技術レビューに関連する他のトピックに属しています。実装開始前のアーキテクチャ上のミスを検出するため、仕様の発見と関連する Codex 要件との評価を行うエージェントである「仕様レビュアー」を構築しました。
Spec Reviewer は Developer Platform 上で稼働しています。Cloudflare Worker として動作し、結果と状態は D1 に保存されます。モデルへのリクエストは AI Gateway を経由してルーティングされ、新しい仕様に対するスキャンは Cron Trigger で起動します。
まず、Codex から仕様に関連するドメインやセクション(言語機能や実装に焦点を当てた RFC など)をフィルタリングし、対象外となるものは除外します。その後、いくつかのガイドラインプロンプトがモデルに対して評価の実行方法と結果の枠組みを示します。
発見された課題は、SHOULD や MUST といったキーワードの影響を受ける深刻度(severity)に基づいて格付けされ、一般的な品質やアーキテクチャに関するアドバイスも含まれます。レビュー完了後、仕様ドキュメントにはレビュー詳細を確認できるカスタムダッシュボードへのリンクが記載されます。
2026 年 5 月初旬から現在までに、約 600 の一意なオープン仕様がレビューされました。オンデマンドや仕様変更によってトリガーされた再レビューを含めると、これまでに 3,200 回以上のレビュー実行が記録されています。
発見された課題の大半は「major」(65%)または「minor」(29%)であり、「critical」は少数派(6%)です。
以下の画像は、Spec Reviewer の UI がどのようなものかを示しています:
今後は、仕様ドキュメントに直接コメントを投稿したり、レビュー評価に影響を与える人間とエージェントの対話を埋め込んだり、インパクトの高い提案を人手による追加レビューとしてフラグ付けしたりすることで、Spec Reviewer とより密接に連携していく予定です。
Incident report reviewer
インシデントレポート(ポストモーテムとも呼ばれる)のレビューにも、同じアプローチが適用されます。各レポートが完全であるかを確認するだけでなく、発生した事象の明確な説明、寄与要因の特定、解決策の文書化、そして意味のあるフォローアップアクションの提案ができているかを評価します。これらの基準は、専用の Codex RFC で定義されています。
インシデントレポートレビューヤーも、仕様レビューヤーと同じく Developer Platform のビルディングブロックを利用しています。この共有アーキテクチャは、Codex エージェントにおける共通のパターンとして定着しつつあります。
2026 年 5 月以降、レビューヤーは 200 件以上のインシデントレポートを審査し、フォローアップアクション項目の欠落やタイムラインの不備、検出シグナルの省略といった課題を特定してきました。対象となったレポートのうち 93% は、影響が軽微なもの、社内限定のもの、あるいは予防的に宣言された事象に関するものでした。重大度が高いインシデントについては、包括的な中央レビュープロセスの一部としてレビューヤーの利用を義務化しており、すべての指摘事項が解消されるまでレポートは完了とみなされません。
今後の取り組み
Codex はすでにコード、技術設計、インシデントレポートのレビューを行うエージェントをサポートしています。今後はこのモデルを SDLC 全体に拡大し、設計、実装、運用の各段階で一貫して課題を浮き彫りにできるようにします。長期的な目標は、エージェントが課題の特定だけでなく、修正案の提案も自律的に行えるようになることです。ただし、変更のレビューと承認については依然としてエンジニアの責任となります。
また、Codex の活用範囲をエンジニアリング部門以外にも広げています。プロダクト、セキュリティ、コンプライアンス、そして信頼と安全性を担当するチームが独自の基準を追加し始め、エージェントが設計や実装だけでなく、より多角的な観点から作業を評価できるようになりました。
複数のエンジニアリングワークフローにおいて、Codex を活用したエージェントが問題を早期に発見し、基準の適用を一貫して行う手助けをしてきました。AI が最も効果を発揮するのは、作業現場でエンジニアに必要なガイダンスを提供する時であり、今後もこのアプローチを Cloudflare 全体に拡大していく予定です。
このようなシステム構築に興味がある方は、私たちのエンジニアリングチームで採用を行っています。
原文を表示
Over the past four months, our AI code reviewer has flagged nearly a quarter of a million deviations from Cloudflare engineering standards (what we’ll call “violations” in this post) and blocked 16,000 merges. Our spec reviewer agent has evaluated close to 600 technical designs against the same standards before implementation began. Both systems draw from the Cloudflare Codex, a shared source of engineering guidance built for people and agents. This post explains why we built the Codex, how it supports the engineering lifecycle, and what we plan to do next.
Before the Codex (which we briefly introduced in a previous post about our AI engineering stack), developer guidance at Cloudflare lived in many places: formal documentation, repository files, chat threads, and the accumulated knowledge of individual engineers. Engineers often spent too much time searching for guidance instead of working on the problem they were trying to solve. Even after finding an answer, they could not always tell whether it was current, authoritative, or applicable to their situation.
As Cloudflare grew, that model became increasingly difficult to sustain. No engineer could read every standard, and reviewers could not reliably check every requirement. Institutional knowledge became harder to recover when people moved between teams, and guidance that was not consistently surfaced or enforced led to drift between projects.
We rebuilt this body of knowledge as the Cloudflare Codex: a governed set of engineering standards that agents can retrieve and apply at the point of work. The same guidance can now inform code review, technical design review, incident report review, and many other use cases, while engineers focus their time and judgment on the resulting findings.
Codex organization and workflow
A dedicated Codex governance model divides the Codex into distinct domains covering the engineering areas we care about. These include architectural matters (for example, frontend and control plane), cross-cutting concerns (security and reliability), specific languages (TypeScript and Rust), and several other areas. Each domain is led by an owner who is responsible for the content, consistency, and overall quality of the documents they oversee.
Codex standards use a Request for Comments (RFC) format. Requirements use the SHOULD and MUST keywords defined by RFC 2119. We also expect a front matter header to hold metadata such as the domain and RFC status. Any Cloudflare employee with a key interest and domain competency can propose an RFC through a merge request that follows the prescribed structure. The proposal then passes through several rounds of feedback from an increasingly broad group of reviewers. Once the domain owner gives final approval, the RFC becomes part of the Codex and is published to an Astro-powered internal site.
Approved RFCs can be consumed by Codex clients and agents, which may then start to flag Codex violations in code, configuration, or documentation immediately. However, they block based on Codex statements only after an RFC moves from the approved to the enforced lifecycle state. This separate promotion step gives teams time to absorb new requirements and accommodates cases where enforcement needs additional work.
The following diagram illustrates the steps in the Codex workflow:
A naive process could stop here and feed the entire Codex to a large language model (LLM) as is. Given the increasing number of RFCs we have already (60+ and counting), however, the corpus volume would put a lot of stress on the context window and impact LLM results negatively. To help guide models to the most relevant RFCs, we invoke a purpose-built agent to automatically extract and compact the SHOULD and MUST statements into a dedicated JSON structure and enrich it with metadata that supports lazy discovery and progressive disclosure. The following abridged excerpt shows the result for our control plane services RFC:
Each statement receives a stable slug identifier that remains unchanged during the extraction process even when its RFC is updated. The identifier lets us track the same statement across different systems over time, which is essential for monitoring, analysis, and exception handling.
Initially, we extracted the statements into another, more concise Markdown file rather than JSON. Over time, we moved to a richer structured format so that agents could filter the content they needed more accurately. We plan to include additional metadata for even tighter scoping, such as indicators for the software development life cycle (SDLC) stage a statement applies to (e.g., design, implementation, runtime).
Codex consumers
Several systems already use the Codex in day-to-day engineering work. Three agents show how the Codex works in practice: our AI code reviewer, spec reviewer, and incident report reviewer.
AI code reviewer
Our AI code reviewer agent, covered in a separate blog post, evaluates merge requests across several dimensions, including Codex compliance.
For each review, the agent retrieves the RFCs and parses the Codex statements. It loads full RFC bodies only when the model or coordinator needs additional context. In most cases, the statements provide enough information to explain a reported violation.
The distinction between SHOULD and MUST, together with an RFC’s status, determines how the reviewer responds. Findings from approved RFCs are non-blocking recommendations. Once an RFC is enforced, an unsatisfied MUST requirement causes the reviewer to withhold approval or block a merge request, depending on the severity.
Since the Codex’s inception earlier this year, the AI code reviewer has flagged close to 230,000 violations. Among these, almost 16,000 caused approval to be withheld (i.e., they referred to MUST statements on enforced RFCs).
Code review alternatives
A single AI code reviewer run usually takes a couple of minutes to complete due to the coordinator framework and sub-agent execution. Although the wait is very often worth the money (or tokens), engineers were calling out the delay and extra round trip involved in remediating the findings. We looked into how we could improve the experience and came up with two additional options:
For language-specific Codex requirements that can be verified mechanically, we provide custom linter configuration packages. These are aligned with our Codex specification and make it possible to surface problems in milliseconds. TypeScript was the first language to receive Codex linter support while also standardizing on oxlint (maintained by the VoidZero team who joined Cloudflare recently) for performant linter execution. A linter for Rust projects is currently under development, and Go will eventually follow to complete coverage of Cloudflare’s most commonly used languages.
To cut out the continuous integration (CI) leg from the review cycle, we made it possible to run the AI code reviewer locally through a command-line interface (CLI). It matches the coordinator functionality from CI and runs the same (OpenCode-based) agents against an automatically determined diff set, with results presented in the terminal.
We believe the linters would be useful to almost every developer and codebase, while the CLI remains an optional alternative for engineers who prefer it.
Spec reviewer
Engineers at Cloudflare regularly write design documents and technical specifications (or specs in short) before implementation. A significant subset of the Codex pertains to design, architecture, and other themes relevant to technical reviews. To catch architectural mistakes before implementation begins, we built the spec reviewer, an agent that discovers specs and evaluates them against relevant Codex requirements.
The spec reviewer operates on the Developer Platform: it runs as a Cloudflare Worker, stores its results and state in D1, routes model requests through AI Gateway, and kicks off scanning for new specs via a Cron Trigger. It starts by filtering the Codex by domains and sections relevant to specs (for example, language features and implementation-focused RFCs are disregarded). Several guiding prompts instruct the model on how to run the assessment and frame the results. The findings get rated based on severity (influenced by SHOULD and MUST keywords) and include general quality and architectural advice. On completion of a review run, a note is left on the spec document linking to a custom dashboard where review details can be inspected.
Since the beginning of May 2026, almost 600 unique open specs have been reviewed. Including reruns triggered on demand or by spec changes, we tracked over 3,200 review invocations to this date. The vast majority of findings had a “major” (65%) or “minor” (29%) severity, with “critical” findings being the minority (6%).
The following image gives an impression of what the spec reviewer UI looks like:
We plan to integrate the spec reviewer more tightly by posting comments directly on the spec documents, embedding human-agent conversations that can influence the review assessment, and flagging high-impact proposals for additional human review.
Incident report reviewer
The incident report reviewer applies the same approach to incident reports (also known as postmortems). In addition to checking that each report is complete, it evaluates whether the report clearly explains what happened, identifies contributing factors, documents the resolution, and proposes meaningful follow-up actions. These expectations are defined in a dedicated Codex RFC.
The incident report reviewer uses the same Developer Platform building blocks as the spec reviewer. This shared architecture is becoming a common pattern for our Codex agents.
Since May 2026, the reviewer has assessed more than 200 incident reports and identified gaps such as missing follow-up action items, incomplete timelines, and omitted detection signals. Among those reports, 93% covered incidents that were low-impact, internal-only, or declared preemptively. For high-severity incidents, we’ve made the reviewer mandatory as part of our comprehensive central review process, and reports are not considered complete until all findings have been addressed.
Future work
The Codex already supports agents that review code, technical designs, and incident reports. We plan to extend that model throughout the SDLC, allowing agents to surface issues consistently across design, implementation, and operations. The longer-term goal is for agents to identify issues as well as propose fixes with increasing autonomy, while engineers remain responsible for reviewing and approving those changes.
We are also expanding the Codex beyond engineering. Product, security, compliance, and trust and safety teams are beginning to add their own standards, allowing agents to evaluate work against considerations that extend beyond design and implementation alone.
Across a number of engineering workflows, Codex-backed agents have helped us surface issues sooner and apply standards more consistently. We have found AI most useful when it brings the right guidance to engineers at the point of work, and plan to keep extending the approach across Cloudflare.
If you’re interested in building systems like these, our engineering teams are hiring.
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み