> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex integration

> AI-powered code review in Codex through the CodeRabbit plugin. Let AI code, review, and fix issues autonomously without human intervention.

export const EssentialsPlanBadge = ({tip = "This feature is available on Essentials (formerly Pro), Team (formerly Pro+), Advanced, and Enterprise. Please refer to our pricing page for more information about our plans and features.", title = "Essentials Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="shield-check" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

## Get continuous code review with Codex

The CodeRabbit plugin for Codex creates autonomous AI development workflows. Codex can trigger CodeRabbit reviews directly through natural-language prompts, enabling you to build features, run code reviews, and fix issues without manual context switching.

This integration makes AI coding more independent, with built-in quality gates that catch issues before they reach production.

<Info>
  This guide covers using the CodeRabbit plugin with Codex. For standalone CLI
  usage, see [CLI overview](/cli/index).
</Info>

CodeRabbit analyzes your code changes and surfaces specific issues, then Codex applies fixes based on that review context.

## Why integrate these tools

<CardGroup cols={2}>
  <Card title="Expert issue detection" icon="search-code">
    CodeRabbit spots race conditions, memory leaks, and logic errors that generic linters miss. Get the same pattern recognition that powers our PR reviews.
  </Card>

  <Card title="AI-powered fixes" icon="wand-sparkles">
    Codex implements fixes with full context from CodeRabbit's analysis. Complex architectural changes handled intelligently.
  </Card>

  <Card title="Context preservation" icon="brain">
    The plugin keeps review context inside Codex so findings can be turned into follow-up fixes without re-explaining the problem.
  </Card>

  <Card title="Continuous workflow" icon="refresh-cw">
    Stay in development flow - run reviews, apply fixes, and iterate without switching tools or losing mental context.
  </Card>
</CardGroup>

## Installation

<Steps>
  <Step title="Install Codex">
    Install Codex following the [platform-specific instructions](https://learn.chatgpt.com/docs/codex/cli). Ensure you can launch Codex from your terminal.
  </Step>

  <Step title="Install and authenticate CodeRabbit CLI">
    Install and authenticate the CodeRabbit CLI:

    <Tabs>
      <Tab title="Install script">
        ```bash theme={null}
        curl -fsSL https://cli.coderabbit.ai/install.sh | sh
        ```

        If `coderabbit` is not available immediately after installation, start a new shell, or run the exact shell-specific reload command printed under **Next steps**. If the install script offers browser sign-in without first asking for a region, EU users should skip it and authenticate later with an explicit `--region eu`.
      </Tab>

      <Tab title="Homebrew">
        ```bash theme={null}
        brew install coderabbit
        ```

        If `coderabbit` is not available immediately after installation, start a new shell.
      </Tab>

      <Tab title="Windows">
        ```powershell PowerShell theme={null}
        irm https://cli.coderabbit.ai/install.ps1 | iex
        ```

        See [Install CodeRabbit CLI on Windows](/cli/windows) for prerequisites, version pinning, and troubleshooting. If `coderabbit` is not available immediately after installation, open a new PowerShell window.
      </Tab>
    </Tabs>

    ```bash Authenticate theme={null}
    coderabbit auth login
    ```

    For a first login to an EU-hosted CodeRabbit account, use `coderabbit auth login --region eu`. When no region is specified or saved, the CLI uses the US region.

    A browser window opens automatically. Sign in to CodeRabbit and the authentication completes in the browser.

    If you belong to multiple CodeRabbit organizations, the sign-in choice sets your default org only. Review attribution still depends on the current repository. See [Organization selection](/cli#organization-selection).
  </Step>

  <Step title="Install CodeRabbit plugin">
    <Tabs>
      <Tab title="Codex app">
        Open the [plugin marketplace](https://learn.chatgpt.com/docs/plugins), search for `coderabbit`, and install the CodeRabbit plugin.
      </Tab>

      <Tab title="Codex CLI">
        Open the [plugin directory](https://learn.chatgpt.com/docs/plugins#plugin-browser-in-codex-cli) inside Codex using the `/plugins` command, then search for `coderabbit` and install the CodeRabbit plugin.

        ```text theme={null}
        /plugins
        ```
      </Tab>
    </Tabs>

    <Info>
      If the plugin does not appear immediately after installation, reload or restart Codex so it refreshes the local plugin catalog.
    </Info>
  </Step>

  <Step title="Verify installation">
    Ask Codex to run a CodeRabbit review:

    ```text theme={null}
    Review my current changes with CodeRabbit
    ```

    The plugin will verify your CodeRabbit CLI installation and authentication when first used.
  </Step>
</Steps>

## Usage

### Running code reviews

<Tabs>
  <Tab title="Natural language">
    Use natural language to trigger the plugin from Codex:

    ```text theme={null}
    Review my current changes with CodeRabbit
    ```
  </Tab>

  <Tab title="@ mention">
    Type `@` to invoke the plugin or one of its bundled skills explicitly. Use this when you want to be specific about which plugin or skill Codex should use.

    ```text theme={null}
    @coderabbit Review my current changes
    ```
  </Tab>
</Tabs>

The plugin will:

* verify CLI installation and authentication
* run the review
* summarize the diff first
* report how many findings CodeRabbit found
* present findings with severity, file path, impact, and recommended fix direction

Customize your review by being explicit about scope:

```text theme={null}
Review my committed changes with CodeRabbit
Review my uncommitted changes with CodeRabbit
Review this branch against main with CodeRabbit
Check my branch for security issues with CodeRabbit
What are the highest-risk issues in these changes?
```

For brand-new untracked files, ask Codex to include the `--include-untracked` flag when it runs CodeRabbit.

For longer reviews, Codex should wait quietly for completion rather than narrating intermediate polling or processing states.

## Integration workflow

### Use CodeRabbit while building new features

<Steps>
  <Step title="Request implementation + review">
    Ask Codex to implement a feature and run a CodeRabbit review:

    ```text Sample prompt wrap theme={null}
    Please implement phase 7.3 of the planning doc and then review it with CodeRabbit. Fix any issues that are found.
    ```

    Key components:

    * **Implement the feature**: Codex codes the requested functionality
    * **Run CodeRabbit review**: Uses the plugin to analyze code
    * **Fix issues**: Codex addresses the problems CodeRabbit identifies
  </Step>

  <Step title="Codex implements and triggers review">
    Codex:

    1. Implements the requested feature
    2. Runs the CodeRabbit plugin review flow
    3. Waits for the analysis to complete
  </Step>

  <Step title="CodeRabbit analysis and task creation">
    When CodeRabbit completes, Codex:

    1. Summarizes the changes in the diff
    2. Reports how many findings were found
    3. Works through each finding with severity, file path, impact, and fix direction
  </Step>

  <Step title="Automated issue resolution">
    Codex systematically works through the findings, implementing fixes and iterating until the important issues are resolved.
  </Step>
</Steps>

## Advanced usage

### CLI review commands

When running the CodeRabbit CLI directly outside the plugin, use the review command that best fits your workflow:

```bash theme={null}
# Agent mode - NDJSON output (one JSON object per line) for agent workflows
coderabbit review --agent

# Human-readable review output
coderabbit review

# Deeper review using the GitHub PR review policy
coderabbit review --deep

# Review only committed changes
coderabbit review --committed

# Review staged and tracked local edits
coderabbit review --uncommitted

# Also review files not added to Git
coderabbit review --include-untracked
```

Deep review requires CLI 0.8.0 and a compatible server. See [deep review behavior and compatibility](/cli/reference#review-modes).

| Command | Best for |
| - | - |
| `coderabbit review --agent` | Agent workflows and structured output consumers |
| `coderabbit review` | Human-readable terminal output during manual workflows |
| `coderabbit review --deep` | Deeper review using the GitHub PR review policy |

The Codex plugin chooses the appropriate review flow automatically, so direct CLI usage is mainly useful for debugging or manual review.

### Configure CodeRabbit for Codex

CodeRabbit automatically reads your `AGENTS.md` file, so you can add context there on how code reviews should run, your coding standards, and architectural preferences.

<EssentialsPlanBadge tip="Using AGENTS.md as CodeRabbit review context is available on Essentials and higher paid plans." />

## Remove or turn off a plugin

To remove the CodeRabbit plugin, reopen it from the plugin browser and select **Uninstall plugin**.

<Info>
  Uninstalling the plugin removes the plugin bundle from Codex, but the CodeRabbit CLI remains installed and continues to work independently.
</Info>

To keep the plugin installed but disable it temporarily, set its entry in `~/.codex/config.toml` to `enabled = false`, then restart Codex.

## Troubleshooting

### Plugin not found

If the plugin isn't available:

1. **Reload Codex**: Restart or reload Codex after installation so it refreshes the plugin catalog
2. **Check plugin installation**: Confirm `CodeRabbit` appears in the Codex plugin marketplace and is enabled
3. **Reinstall if needed**: Remove and reinstall the plugin from the marketplace

### CLI not authenticated

If the agent cannot find `coderabbit`, check the trusted CLI installation in your host terminal. A missing `PATH` entry does not mean it is uninstalled. Use the quoted absolute path to that installation for the commands below, not a repository-local executable or wrapper.

Codex's default sandbox blocks the CLI's saved sign-in, network access, and the local login callback. `credentials_unavailable` and `callback_listener_unavailable` indicate those local access failures, not proof that you are signed out. Older CLIs report the same failure as `authentication_failed: Failed to start server. Is port 0 in use?`; nothing is using port 0.

When Codex asks to run the `coderabbit` command outside the sandbox, approve it. To skip the prompt next time, choose the option that saves a rule for that command. A saved rule lets that CodeRabbit command run outside the sandbox with any flags, including `--use-credits`, but the plugin still asks before spending credits. You can also run the review in your own terminal.

For local sessions:

1. **Check host authentication**: Run `"/absolute/path/to/coderabbit" auth status --agent` in your host terminal. In a local agent sandbox, use approved command-scoped host execution for this status check and the review. Network permission alone does not expose host credentials. If host execution is unavailable or denied, stop and report that prerequisite; do not weaken global sandbox settings.
2. **Recover a sandbox failure**: If host status reports `authenticated: true`, you do not need to log in again. When the original review failed authentication in the sandbox before analysis began, retry it once on the host with the same working directory and arguments. Do not retry a running or completed review, a failure after analysis began, or a review that already failed on the host.
3. **Log in only when signed out**: If the host check succeeds and reports `authenticated: false`, run `"/absolute/path/to/coderabbit" auth login --agent` yourself in the host terminal, then confirm authentication before retrying. If status fails or remains unavailable, stop and report the error.

Codex Cloud and other remote sessions can't use your local sign-in; they need authentication configured in their own environment. Let the CLI access its credentials directly; never copy tokens from the host credential store or paste them into the agent.

### CodeRabbit not finding issues

If CodeRabbit isn't detecting expected issues:

1. **Check git status**: CodeRabbit analyzes tracked changes by default. Run `git status` to verify the scope; brand-new untracked files require `--include-untracked`.
2. **Specify review scope**: Ask Codex to review committed, uncommitted, or base-branch changes explicitly
3. **Run the CLI directly**: Use `coderabbit review` if you want to inspect findings outside the plugin flow

### Review taking too long

CodeRabbit reviews may take several minutes depending on the scope of changes:

1. **Review smaller changesets**: Work on focused branches and smaller diffs
2. **Limit the scope**: Ask Codex to review only committed or uncommitted changes
3. **Set the right base branch**: Be explicit when your comparison point is not `main`
4. **Let the review finish**: Long-running reviews are expected; the plugin should wait quietly rather than reporting intermediate polling states

<Info>
  The integration creates a more thorough review process than either tool alone.
</Info>

## What's next

<CardGroup cols={1}>
  <Card title="Claude Code integration" href="/cli/claude-code-integration" icon="bot" horizontal>
    Compare the Codex plugin flow with the Claude Code plugin workflow and command surface.
  </Card>

  <Card title="Command-Line Review Tool" href="/cli/index" icon="terminal" horizontal>
    Use the standalone CodeRabbit CLI directly when you want manual review workflows outside Codex.
  </Card>

  <Card title="CodeRabbit Skills" href="/cli/skills" icon="wand-sparkles" horizontal>
    Explore the skill-based integration path for other AI coding agents that support Skills.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.