Skip to main content
This guide covers integrating CodeRabbit CLI with Cursor. For standalone CLI usage, see CLI overview.

Autonomous AI development workflows

CodeRabbit CLI + Cursor allows you to develop faster with code that gets reviewed for issues before it reaches the PR. Because Cursor executes CodeRabbit directly as part of its steps, code that gets made by Cursor can automatically be reviewed by CodeRabbit. Ask Cursor to implement a feature, run a code review, and fix any issues, as a natural part of agentic development.

Video demo

Why integrate these tools

Expert issue detection

CodeRabbit spots race conditions, memory leaks, and logic errors that generic linters miss. Same pattern recognition that powers our PR reviews.

AI-powered fixes

Cursor implements fixes with full context from CodeRabbit’s analysis. Complex architectural changes are handled intelligently.

Context preservation

CodeRabbit’s --prompt-only mode gives Cursor succinct context about issues, including location, severity, and suggested approaches.

Agentic development loop

Run a better agentic development loop - AI codes, runs reviews, applies fixes, and iterates before you even look at the code.

Prerequisites

Windows users: The CodeRabbit CLI requires WSL (Windows Subsystem for Linux) to run on Windows. See our WSL on Windows guide for setup instructions before proceeding with this integration.
1

Install Cursor

Install Cursor and setup an account if needed.
2

Install CodeRabbit CLI

Install the CodeRabbit CLI globally on your system:
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
Restart your shell:
source ~/.zshrc
3

Authenticate CodeRabbit

Create an account or login to CodeRabbit if you already have one by running this command in your terminal:
Run: coderabbit auth login
The command provides a URL, open the URL in your browser, log in to CodeRabbit via your git provider, and copy the authentication token.Paste the token back to your CLI.
Free accounts get a limited set of reviews per hour, and less comprehensive reviews. Pro accounts get higher review limits, and more robust reviews. See https://www.coderabbit.ai/pricing for more details.
4

Verify auth

Verify authentication was successful by running in your terminal:
Run: coderabbit auth status
Success shows your login status and confirms everything is set correctly.
5

Test that Cursor can run CodeRabbit

Open up the chat interface in Cursor (Command +L) and prompt it:
Let's verify you can run the CodeRabbit CLI. Run the terminal command: coderabbit auth status and tell me the output.
Because prompts and agents are non-deterministic, meaning every response will vary, and we can’t predict with certainty every outcome, sometimes Cursor (and other agents) will try to install CodeRabbit as a package, or try to run other commands to determine what CodeRabbit is. In this case, it’s recommended that you create a Cursor Rule, covered in the step below.
6

Setup a Cursor Rule for CodeRabbit

Learn more about Cursor rules in their documentation. Create a Cursor rule by running the Cursor rule command from the chat @rule. Enter this prompt or modify it to fit your development preferences:
  # Running the CodeRabbit CLI

  CodeRabbit is already installed in the terminal. Run it as a way to review your code. Run the command: cr -h for details on comands available. In general, I want you to run coderabbit with the `--prompt-only` flag. To review uncommitted changes (this is what we'll use most of the time) run: `coderrabit --prompt-only -t uncommitted`.

  IMPORTANT: When running CodeRabbit to review code changes, don't run it more than 3 times in a given set of changes.

Integration workflow

Use CodeRabbit as part of building new features

1

Request implementation + review

Ask Cursor to implement a feature and run CodeRabbit, analyze the suggestions and apply fixes:
Please implement phase 7.3 of the planning doc and then run coderabbit --prompt-only -t uncommitted,
let it run as long as it needs and fix any issues.
Key components:
  • Implement the feature: Cursor codes the requested functionality
  • Run CodeRabbit: Uses --prompt-only flag for AI-optimized output
  • Review uncommitted changes: uses the flag -t ucommitted so CodeRabbit only reviews current changes as opposed to a feature branch or staging against main.
  • Fix issues: Cursor addresses all problems CodeRabbit identifies. You can also tell it to fix critical issues and ignore nits.
2

Cursor implements and runs CodeRabbit

Cursor: 1. Implements the requested feature 2. Runs coderabbit --prompt-only -t uncommitted 3. Waits, reviews may take anywhere from 7-30 minutes depending on the amount of changes.
3

CodeRabbit analysis and task creation

When CodeRabbit completes, Cursor: 1. Reads the --prompt-only output (plain text optimized for AI agents) 2. Creates a task list addressing each issue CodeRabbit surfaced 3. Shows you the planned fixes before implementing them
4

Automated issue resolution

Cursor systematically works through the task list, implementing fixes for each CodeRabbit finding. The cycle continues until all issues are resolved or the limit of 3 times is reached which we set on a rule earlier.

Example: API integration implementation

This example shows the workflow implementing a webhook handler for payment processing:
1

Start implementation

# Working on payment webhook feature
git checkout -b feature/payment-webhooks
2

Run integrated workflow

Tell Cursor to implement and review:
Implement the payment webhook handler from the spec document.
Then run coderabbit --prompt-only -t uncommitted, review the suggestions then fix any critical issues. Ignore nits.
3

CodeRabbit analysis

CodeRabbit analyzes the webhook code and identifies issues: - Missing signature verification - Race conditions in payment state updates - Insufficient error handling for network failures - Webhook replay attack vulnerabilities
4

Cursor fixes

Cursor automatically applies fixes: - Adds HMAC signature verification - Implements database transactions for state consistency - Adds retry logic with exponential backoff - Includes idempotency key handling
5

Verification

The workflow continues until all critical issues are resolved or a set number of loops is reached. Cursor reports completion.
The --prompt-only mode provides Cursor with token-efficient but succinct context about each issue, including file locations, problem descriptions, and suggested fixes.

Optimization tips

Use prompt-only mode for efficiency

When running CodeRabbit manually before Cursor, use --prompt-only for optimal AI agent integration:
coderabbit --prompt-only
This mode:
  • Provides succinct issue context
  • Uses token-efficient formatting
  • Includes specific file locations and line numbers
  • Suggests fix approaches without overwhelming detail

Configure CodeRabbit for Cursor

CodeRabbit automatically reads your cursor.md file, so you can add context there on how code reviews should run, your coding standards, and architectural preferences.
This is a Pro paid plan feature.

Troubleshooting

CodeRabbit not finding issues

If CodeRabbit isn’t detecting expected issues:
  1. Check authentication status: Run coderabbit auth status (authentication improves review quality but isn’t required)
  2. Verify git status: CodeRabbit analyzes tracked changes - check git status
  3. Consider review type: Use the --type flag to specify what to review:
    • coderabbit --type uncommitted - only uncommitted changes
    • coderabbit --type committed - only committed changes
    • coderabbit --type all - both committed and uncommitted (default)
  4. Specify base branch: If your main branch isn’t main, use --base:
    • coderabbit --base develop
    • coderabbit --base master
  5. Review file types: CodeRabbit focuses on code files, not docs or configuration

Managing review duration

CodeRabbit reviews may take 7 to 30+ minutes depending on the scope of changes:
  1. Ensure background execution: Configure Cursor to run CodeRabbit in the background so you can continue working
  2. Review smaller changesets: Adjust what you’re reviewing to reduce analysis time:
    • Use --type uncommitted to review only uncommitted changes
    • Work on smaller feature branches compared to main
    • Break large features into smaller, reviewable chunks
  3. Configure the diff scope: Control what changes are analyzed:
    • Review uncommitted changes only: Use --type uncommitted to analyze just working directory changes
    • Configure base branch: Use --base develop or --base main to set the comparison point
    • Use feature branches: Work on focused feature branches instead of large staging branches
The integration creates a more thorough review process than either tool alone. Expect comprehensive analysis that catches issues that would otherwise reach production.