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 --agent mode gives Cursor structured findings with file locations, 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 log in to CodeRabbit if you already have one by running this command in your terminal:
coderabbit auth login
A browser window opens automatically. Sign in to CodeRabbit and the authentication completes in the browser.
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 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 commands available. In general, I want you to run coderabbit with the `--agent` flag. To review uncommitted changes (this is what we'll use most of the time) run: `coderabbit --agent -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 --agent -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 --agent for structured findings Cursor can process directly
  • Review uncommitted changes: Uses -t uncommitted so CodeRabbit reviews current changes instead of a feature branch or staging branch 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 --agent -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 --agent output (structured JSON for agent workflows) 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 --agent -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.

Optimization tips

Output modes for agent integration

When running CodeRabbit for agent use, choose the output mode that best fits your workflow:
# Structured JSON output
coderabbit --agent

# Detailed plain-text output
coderabbit --plain

# Browsable terminal UI
coderabbit --interactive
ModeBest for
--agentCursor and other agent integrations that consume structured JSON
--plainHuman-readable terminal output during manual workflows
--interactiveManual review in an interactive terminal UI
All three modes include specific file locations, problem descriptions, and suggested fix approaches.

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.