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:Restart your shell:
3
Authenticate CodeRabbit
Create an account or login to CodeRabbit if you already have one by running this command in your terminal: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: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: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: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:Key components:
- Implement the feature: Cursor codes the requested functionality
- Run CodeRabbit: Uses
--prompt-onlyflag for AI-optimized output - Review uncommitted changes: uses the flag
-t ucommittedso CodeRabbit only reviews current changes as opposed to a feature branch or staging againstmain. - 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
them4
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
2
Run integrated workflow
Tell Cursor to implement and review:
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:
- 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 yourcursor.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:- Check authentication status: Run
coderabbit auth status(authentication improves review quality but isn’t required) - Verify git status: CodeRabbit analyzes tracked changes - check
git status - Consider review type: Use the
--typeflag to specify what to review:coderabbit --type uncommitted- only uncommitted changescoderabbit --type committed- only committed changescoderabbit --type all- both committed and uncommitted (default)
- Specify base branch: If your main branch isn’t
main, use--base:coderabbit --base developcoderabbit --base master
- 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:- Ensure background execution: Configure Cursor to run CodeRabbit in the background so you can continue working
- Review smaller changesets: Adjust what you’re reviewing to reduce analysis time:
- Use
--type uncommittedto review only uncommitted changes - Work on smaller feature branches compared to main
- Break large features into smaller, reviewable chunks
- Use
- Configure the diff scope: Control what changes are analyzed:
- Review uncommitted changes only: Use
--type uncommittedto analyze just working directory changes - Configure base branch: Use
--base developor--base mainto set the comparison point - Use feature branches: Work on focused feature branches instead of large staging branches
- Review uncommitted changes only: Use
The integration creates a more thorough review process than either tool alone.
Expect comprehensive analysis that catches issues that would otherwise reach
production.