CodeRabbit が Claude を活用してエージェントオーケストレーションシステムを構築した方法
本文の状態
日本語全文を表示中
詳細モードで約9分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Claude Blog
開発支援ツール「CodeRabbit」が、AI モデル「Claude」を活用し、複数のエージェントを制御・連携させるオーケストレーションシステムの構築に成功しました。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
*当シリーズ「Claude を活用したスタートアップの取り組み」では、AI によって業界を変革するスタートアップ事例を紹介しています。本記事では、CodeRabbit がコード生成前に計画を行うエージェントオーケストレーション層をどのように構築したかを共有します。
クイック概要
社名
CodeRabbit
設立年
2023 年
創業者
Harjot Gill(CEO)
技術スタック
Claude Platform, Claude Code
スケール
15,000 社以上の顧客に対し、週あたり 200 万件の PR(プルリクエスト)レビューを実施
AI コーディングツールは、アイデアから動作するプロトタイプまでの時間を劇的に短縮しました。しかし、CodeRabbit という AI コードレビュープラットフォームでは、その処理能力の高まりに伴い別の傾向が浮き彫りになっています。それは、「コンパイルもテストも通過するが、チームが実際に意図した機能を実装していないコード」です。
CodeRabbit の AI 担当バイスプレジデントである David Loker は、この原因をモデルの上位段階に位置づけています。経験豊富な開発者は、コーディングエージェントが自分たちと同じ文脈を理解していると思い込み、自分たちにとって自明な要件を書き残すことを怠りがちです。その結果、コーディングエージェントは自分が妥当とみなしたもので隙間を埋めてしまいます。
そのギャップを埋めるために、CodeRabbit は Claude を活用して、コード生成の前に構造化された計画フェーズを実行するエージェントオーケストレーションシステム(agent orchestration system)の設計と構築を行いました。チームの仮説は、計画の質が出力の質を決定し、コード生成のコストが下がるほど、間違った方向へ進むコストが高くなるというものです。
AI コーディングにおける内部知識ギャップへの対応
CodeRabbit チームが顧客ベース全体で AI によって生成されたプルリクエスト(pull request)を調査した際、最も頻繁に発生する失敗モードは、コンパイルが成功しテストも通過するものの、本来解決すべき問題を解決できていないコードでした。
「開発者として経験を積むにつれ、私たちは知識を内面化します」と Loker は述べています。「それらのすべては私たちの頭の中にあり、他の開発者もそれを理解していると思い込んでしまいます。しかし、その前提を AI システムにも適用してしまい、それが暗黙的に理解していると仮定してしまうのです。私たちは、そのような仮定をしていることさえ気づいていません。
曖昧なプロンプト(prompt)は、基盤となるシステムに、それが妥当とみなすものでギャップを埋めさせることになります。その推測は、開発者が意図していたものとしばしば乖離します。
Loker は個人的な例を挙げています。サイドプロジェクトでメモリシステムを構築する際、すべてが動作するまでコーディングエージェントと何時間も反復作業を行いました。彼がその使い方をエージェントに尋ねたところ、指示にはユーザートークンを渡すように書かれていました。ログインページはありませんでした。彼はシステムにユーザーが必要だと指定していましたが、ユーザーがサインインする方法が必要だとは一言も述べていませんでした。エージェントはその隙間を埋め、何時間もかけた作業の成果物が玄関口のない製品となってしまいました。
「結局のところ、その上に多くのものを構築することになり、ずっと後になって問題があることに気づくことになります」と Loker は言います。「AI ワークフローでは、遅れた検証は非常に高価になる可能性があります。」
AI コーディングソリューションの前に動作するオーケストレーション層
CodeRabbit の対応策は、コード生成の前に計画システムを挿入することでした。これは複数の Claude モデルを調整して要件を分析し、構造化された実行プラン(何を構築すべきか、どのような制約を満たす必要があるかを定義する)を生成する前に前提条件を浮き彫りにします。
「この計画システムは、Claude Code の Plan Mode を置き換えるものではありません」と Loker は言います。「これは Claude Code 以前に起こるより高レベルなオーケストレーションであり、明確にする必要があるすべての事項を明確にし、行われているすべての前提条件を認識できるように、非常に狭く正しい方向へと導くものです。」
出力結果は、共同で作成された製品要件定義書(PRD)です。これは、チーム全体のステークホルダーによって文脈を完全に踏まえて作成され、検証され、実装開始前にレビューされた計画です。Claude Code はこの計画を引き継ぎ、それを基に詳細な実装計画を生成します。この計画は、何が決定され、なぜそう決まったのかを捉えた共有アーティファクトとなり、チームが手戻りを避けたり、後から出力が元の意図と一致していることを検証したり、新しいエンジニアのオンボーディングを支援したりする役割を果たします。
Claude モデルファミリー全体にわたるルーティング
CodeRabbit は、コストとレイテンシを最適化するために、各モデルティアをタスクの複雑さに合わせてマッチングさせています。Opus がオーケストレーションループを駆動し、問題理解や全体的な方向性の設定といった高レベルの戦略的作業を担当します。Sonnet はその出力を受け取り、構造化された計画ステップへと順序立てて展開します。Haiku は、文脈の集約や特定のツール使用など、狭い範囲に限定された操作を処理します。これは、質問が具体的すぎて小さなモデルでも十分に回答できる場合に該当します。
「あるタスクにおいて Haiku が Sonnet と同等以上の成果を出す場合、私たちは Haiku を使用します」と Loker 氏は述べています。「評価ハッチ(harness)が、Opus により多くの余地を与えることで計画の品質が向上することを示す場合は、その余地を与えます。私たちは推測はしません。」
計画品質のための評価ハッチの構築
CodeRabbit にはコードレビュー用の成熟した評価システムが存在しましたが、計画出力の評価を行うものは何もありませんでした。このインフラストラクチャを構築することは、それ自体が一つのプロジェクトとなりました。
システムは手動調整された例と手動検査から始まりました。チームは、計画の質の特定の次元を評価する LLM 判事(LLM judges)のライブラリを開発しました。最終的に計画がコードを生み出すため、生成されたコードが機能しているか、余分なスコープが含まれていないか、そしてそこに至るまでにどれほどのトークンが必要だったかを測定することもできました。計画ステップの有無で同じタスクを実行することで、計画自体の価値を切り離して評価する方法を得ました。
「その計画に適切な詳細レベルが何であるかは、私たちは気づいていませんでした」とローカー氏は述べています。細かすぎる計画は、コードベースが変化した瞬間に陳腐化しました。一方、高すぎた計画では、エージェントが仮定を埋める余地が残ってしまい、これはまさに計画層が解決しようとしていた元の問題そのものです。機能する抽象度のレベルを見つけるには反復が必要でしたが、それが評価ハーン(eval harness)によって可能になりました。
記述される前にエラーを検出する
AI ネイティブなコーディングワークフローでは、これまでコードレビューの段階で表面化していた多くの決定が、より早期の計画層で行われるようになりました。コード生成が始まる前にチームがレビューし合意できる計画を構築することで、ミスを早期に発見できます。
「私たちが Claude エコシステムを用いて構築したのは、組織全体の計画システムです」とローカー氏は言います。「計画自体が品質ゲートとなります。もしその計画の質を事前に本当に高く保つことができれば、下流への影響は非常に顕著になります。最終的には、はるかに優れたコードが得られるのです。」
CodeRabbit チームからのベストプラクティス
あなたは実際にどのような成果を創出しようとしており、それをどのように測定しますか?
AI に対する仕様に明示性を持つだけでなく、MPP(最大可能製品)において何を望むかも定義してください。
まだ暗黙のうちに残っている仮定は何ですか?
Claude に問いかけてください:何が不足しているのか?計画の一部が明示的な仕様ではなく、暗黙の仮定として現れていないか確認してください。
忘れられやすいワークフローやエッジケースはどのようなものですか?
あなたが考慮していない場所やケースを特定するよう、Claude に支援を求めてください。
ロールアウト前に出力が意図に合致していることをどうやって確認しますか?
作業の記録を作成してください:保存され再利用される計画アーティファクトの年表です。
Claude Platform を活用してスタートアップを構築しましょう。
原文を表示
*In our series,* *How startups build with Claude*, we highlight how startups are transforming their industries with AI. In this article, we share how CodeRabbit built an agent orchestration layer that plans before AI generates code.
| The quick pitch | |
|---|---|
| Name | CodeRabbit |
| Founded | 2023 |
| Founders | Harjot Gill, CEO |
| Stack | Claude Platform, Claude Code |
| Scale | Reviews 2 million PRs per week across 15,000+ customers |
AI coding tools have collapsed the time between idea and working prototype. CodeRabbit, an AI code review platform, has noticed a different trend climbing alongside that throughput: code that compiles and passes tests but doesn't do what the team actually meant to build.
David Loker, VP of AI at CodeRabbit, locates the cause upstream of the model. Experienced developers often assume coding agents understand the same context they do, so they don’t write down requirements that feel obvious to them. The coding agent then fills the gaps with whatever it considers plausible.
To close that gap, CodeRabbit used Claude to design and build an agent orchestration system that runs a structured planning phase before any code is generated. The team's working thesis is that planning quality determines output quality, and the cheaper code generation gets, the more expensive it becomes to move in the wrong direction.
Addressing the internal knowledge gap in AI coding
When the CodeRabbit team studied AI-generated pull requests across their customer base, the most frequent failure mode was code that compiled and passed tests, yet still didn't solve the problem it was built to solve.
"As we gain experience as developers, we internalize knowledge," Loker says. "All those things are in our head, and we assume other developers know them too. But then we make that assumption of the AI system as well, that it also implicitly understands. We're not even aware that we're assuming those things."
Vague prompts force the underlying system to fill gaps with whatever it considers plausible. That guess often diverges from what the developer had in mind.
Loker offers a personal example. While building a memory system on a side project, he spent hours iterating with a coding agent until everything ran. When he asked the agent how to use it, the instructions told him to pass in a user token. There was no login page. He had specified that the system required users but never said users needed a way to sign in. The agent filled the gap, and hours of work landed in a product missing a front door.
"What ends up happening is you build a lot more stuff on top of it, then much later you find there's a problem," Loker says. "In AI workflows, late validation can be very expensive."
An orchestration layer that runs before AI coding solutions
CodeRabbit's response was to insert a planning system in front of code generation. It coordinates multiple Claude models to analyze requirements and surface assumptions before producing a structured execution plan that defines what should be built and what constraints it needs to satisfy.
"This planning system is not meant to replace Claude Code's Plan Mode," Loker says. "It's a higher level orchestration that happens before Claude Code, to point it in a really narrow and right direction where everything that needs to be explicit is made explicit, and we are aware of all assumptions that are being made."
The output is a collaborative product requirements document (PRD): a plan created with full context, validated by stakeholders across the team, and reviewed before implementation starts. Claude Code picks up that plan and uses it to generate a fine-grained implementation plan. The plan becomes a shared artifact that captures what was decided and why, which not only helps teams avoid rework and validate later that the output matched the original intent, but also onboard new engineers.
Routing across the Claude model family
CodeRabbit matches each model tier to task complexity to optimize for cost and latency. Opus drives the orchestration loop and the higher-level strategic work of understanding the problem and setting overall direction. Sonnet takes that output and sequences it into structured planning steps. Haiku handles narrowly scoped operations like context distillation and targeted tool use, where the question is specific enough that a smaller model can answer it well.
"If Haiku does as well as Sonnet on a given task, we use Haiku," Loker says. "If the evaluation harness tells us the plan quality improves when we give Opus more room, we give it more room. We don't guess."
Building an eval harness for plan quality
CodeRabbit had a mature evaluation system for code review, but nothing for evaluating planning output. Building that infrastructure became its own project.
The system started with hand-tuned examples and manual inspection. The team developed a library of LLM judges that scored specific dimensions of plan quality. Because plans eventually produce code, the team could also measure whether the generated code worked, whether it contained extra scope, and how many tokens it took to get there. Running the same task with and without the planning step gave them a way to isolate the value of planning itself.
"We didn't realize what the right level of detail was going to be for that plan," Loker says. Plans that were too granular went stale the moment the codebase shifted. Plans that were too high-level left room for the agent to fill in assumptions, which was the original problem the planning layer was meant to solve. Finding the working level of abstraction took iteration, which is what the eval harness made possible.
Catching errors before any code gets written
In an AI-native coding workflow, many of the decisions that used to surface during code review are now made earlier, in the planning layer. Building a plan that the team can review and align on before code generation starts catches mistakes early.
"What we've built, using the Claude ecosystem, is a team-wide planning system," Loker says. "The plan itself becomes a quality gate. If we can make sure the quality of that plan is really good upfront, the downstream effect is very pronounced. You end up with a lot better code at the end of it."
| Best practices from the CodeRabbit team | |
|---|---|
| What outcome are you actually trying to create, and how do you measure? | Be explicit not just in specifications to the AI but also define what you want in the MPP (maximum possible product). |
| What assumptions are still implicit? | Ask Claude: what is missing? Are there any parts of the plan that are coming out as implicit assumptions instead of explicit specifications? |
| What workflows or edge cases are easy to forget? | Ask Claude to help identify places or cases that you may not have taken into account. |
| How will you know the output matches intent before rollout? | Create a record of work: a chronicle of planning artifacts that is saved and reused. |
Build your startup on the Claude Platform.
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み