Hamburger Cross Icon
Code Reviewer
+
CodeRabbit Collector

Code Reviewer + CodeRabbit Collector

Guardrail Collector Experimental Devex Build And Ci

Enforce Code Reviewer using data collected by CodeRabbit Collector. Automatically check devex build and ci standards on every PR.

Guardrail: Verifies that at least one AI code reviewer is active on the component. Checks ai.code_reviewers[] for any entry with detected: true. Tool-agnostic — doesn't care which reviewer is active, just that something is reviewing code. Skips if no code reviewer data exists (no tool-specific collectors configured).
Data Source: Detects CodeRabbit AI code review activity on pull requests by querying GitHub check-runs API, and collects CodeRabbit configuration files. Writes to normalized ai.code_reviewers[] for tool-agnostic policy checks, plus tool-specific data in ai.native.coderabbit.

How CodeRabbit Collector Powers This Guardrail

The CodeRabbit Collector gathers metadata from your systems. This data flows into Lunar's Component JSON, where the Code Reviewer guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
CodeRabbit Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Code Reviewer Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the CodeRabbit Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/coderabbit@v1.0.5
    # with: ...

# Step 2: Enable the AI Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/ai@v1.0.5
    include: [code-reviewer]
    # with: ...

What CodeRabbit Collector Collects

This collector gathers the following data that the Code Reviewer guardrail evaluates.

Collector code

code-reviewer

Detects CodeRabbit check-runs on pull requests by querying the GitHub check-runs API for the coderabbitai app. Waits for scan completion and writes a normalized entry to ai.code_reviewers[].

Collector code

config

Detects CodeRabbit configuration files (.coderabbit.yaml or .coderabbit.yml) in the repository root. Records config file presence and path.

Example Data Flow

Here's an example of the data that CodeRabbit Collector writes to the Component JSON, which Code Reviewer then evaluates.

{ } component.json From CodeRabbit Collector
{
  "ai": {
    "code_reviewers": [
      {
        "tool": "coderabbit",
        "check_name": "coderabbitai",
        "detected": true,
        "last_seen": "2024-01-15T10:30:00Z"
      }
    ],
    "native": {
      "coderabbit": {
        "config_file": ".coderabbit.yaml",
        "config_exists": true
      }
    }
  }
}

Configuration Options

AI Guardrails Inputs

Input Required Default Description
canonical_filename Optional AGENTS.md The canonical (vendor-neutral) instruction filename
min_lines Optional 10 Minimum number of lines for the root instruction file (0 to disable)
max_lines Optional 300 Maximum number of lines for the root instruction file (0 to disable)
max_total_bytes Optional 32768 Maximum combined bytes across all instruction files (0 to disable)
required_sections Optional Project Overview,Build Commands Comma-separated required section heading substrings (case-insensitive)
min_annotation_percentage Optional 0 Minimum percentage of commits that should have AI annotations (0 = awareness mode)

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo