CodeRabbit Documentation - AI code reviews on pull requests, IDE, and CLI
Command-Line Review Tool
Get AI code reviews directly in your CLI before you commit. Catch race conditions, memory leaks, and security vulnerabilities without leaving your development environment.
Review local changes
The CodeRabbit CLI analyzes your uncommitted changes using the same pattern recognition that powers our PR reviews. Review code as you write it, apply suggested fixes instantly, and catch critical issues while you still have full context in memory.
Key features
Getting started
Organization selection
The active CodeRabbit organization is the login/default org for browser-based CLI auth. It is used when the current repository resolves to that org, but it is not a silent billing fallback for unrelated local repositories. During a review, CodeRabbit resolves the current repository first:
- If the repository matches the selected org, the review uses that org.
- If the repository matches a different org you can access, CodeRabbit switches attribution to that org.
- If the repository matches an installed public repo but you do not have access to the owning org, the review uses OSS behavior.
- If the repository cannot be matched to an installed accessible repo, the CLI falls back to limited/free review behavior until CodeRabbit is installed for that repo or org.
To change organizations later, run:
cr auth org opens sign-in automatically if your local session is missing or expired. Organization switching is not available for self-hosted mode or API key authentication.
Review modes
The CLI offers plain and agent review modes, plus an optional faster policy for active local development:
# Plain mode (default) - detailed feedback with fix suggestions
cr
# Explicit plain mode
cr --plain
# Agent mode - structured JSON output for Skills and agent integrations
cr --agent
# Faster local review policy
cr review --fast
Plain mode displays a finding count and severity summary at the end of each run. If the CLI detects a known agent environment, it suggests re-running with --agent for structured JSON output.
Diagnostics
Run cr doctor at any time to verify your local setup. The command checks:
- CLI runtime and version
- Local CodeRabbit storage directory
- Authentication state and auth environment
- Current Git repository and branch metadata
- Auto-update policy
- CodeRabbit backend reachability
- CodeRabbit WebSocket reachability
cr doctor exits with status code 1 when any check fails. Warnings appear in the report but do not cause a non-zero exit code.
Working with review results
CodeRabbit analyzes your code and surfaces specific issues with actionable suggestions. Each finding includes the problem location, explanation, and recommended fix. Example findings include:
- Race condition detected: “This goroutine accesses shared state without proper locking”
- Memory leak potential: “Stream not closed in error path - consider using defer”
- Security vulnerability: “SQL query uses string concatenation - switch to parameterized queries”
- Logic error: “Function returns nil without checking error condition first”
Browse and apply suggestions
In plain mode, read each finding in the terminal output and apply the suggested change in your editor or coding agent.
For simple issues like missing imports, syntax errors, or formatting problems, use the suggested fix directly. For larger changes, use cr review --agent so your coding agent can consume structured findings.
Use AI coding agents
For AI agent integration, see the AI agent integration section for detailed workflow guidance and integration guides.
Replay stored findings
Run cr review findings to re-read the results from the most recent local review without re-running the full analysis. This is useful in multi-step agent loops where a downstream step needs to consume results from a prior review.
Inspect AI prompts
Run cr review --show-prompts to print the AI prompts saved from the most recent local review without triggering a new review. Useful for tuning --config instructions or understanding why the model flagged a particular finding.
AI agent integration
CodeRabbit detects the problems, then your AI coding agent implements the fixes.
Integration guides
See detailed workflows for AI coding agents and workflows:
Example prompt for your AI agent
Here’s a complete prompt you can use with Cursor, Codex, or other AI coding agents:
Please implement phase 7.3 of the planning doc and then run cr --agent, let it run as long as it needs (run it in the background) and fix any issues.
Components of a good prompt
Breaking down what makes an effective CodeRabbit + AI agent workflow:
Pricing and capabilities
See the rate limits table on the Plans and pricing page for current per-plan limits. To increase the limits, consider upgrading your plan or using the Usage-based Add-on.
Contact sales@coderabbit.ai for custom rate limits or enterprise needs.
CLI with Usage-based Add-on
The usage-based add-on lets eligible CodeRabbit CLI reviews continue after the applicable review limit is reached. Authenticated CLI and agentic API-key reviews use the assigned user’s plan allowance first. Credits are charged only when a review continues over that limit. Each reviewed file in the over-limit review costs $0.25 in credits. You can purchase credits as a one-time top-up or a recurring monthly subscription from the Subscription and Billing dashboard.
Command reference
See the CLI Command Reference for a complete list of commands and options.
Uninstall
Remove CodeRabbit CLI based on how you installed it.
If installed using install script
If installed using Homebrew