Review local changes
The CodeRabbit CLI analyzes local Git changes using the same pattern recognition that powers our PR reviews. By default, it reviews tracked changes: committed changes, staged changes (including new files added withgit add), and unstaged edits to tracked files. Use --uncommitted to review only staged and tracked local edits. Files not added to Git are skipped unless you pass --include-untracked.
Key features
Review local changes
Apply fixes in one step
Context-aware reviews
Install agent skills
coderabbit skills to preview and install or update verified CodeRabbit skills for supported coding agents.Getting started
Install CLI
Authenticate
cr auth org.If browser sign-in is blocked or unavailable, authenticate with an Agentic API key instead:Review your code
--dir flag changes the review directory, but that directory must also contain a Git repository.main, specify your base branch:Verify local setup
Apply suggestions
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.
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 uses plain-text, human-readable output by default, with agent output and an optional lighter policy also available:--agent for structured JSON output.
Diagnostics
Runcr 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.
Review statistics
Usecr stats to inspect your review statistics from local review history:
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, usecr 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
Runcr review findings to read results from the most recent local review that produced findings, 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
Runcr 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./coderabbit:review instead of
the CLI commands shown below.Integration guides
See detailed workflows for AI coding agents and workflows:CodeRabbit Skills
coderabbit skills to install agent-native Skills and trigger reviews with an explicit request such as “Run a CodeRabbit review.”Claude Code integration
Codex integration
Headless CLI integration
Example prompt for your AI agent
Here’s a complete prompt you can use with Cursor, Codex, or other AI coding agents:Components of a good prompt
Breaking down what makes an effective CodeRabbit + AI agent workflow:1. Run CodeRabbit CLI
1. Run CodeRabbit CLI
--agent flag:2. Run in the background
2. Run in the background
3. Evaluate and implement fixes
3. Evaluate and implement fixes
complete event has status: "review_skipped", there were no file changes in scope.4. Verify with a second pass
4. Verify with a second pass
5. Set loop limits
5. Set loop limits
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.Free tier
Paid plans
- Learnings-powered reviews: Remembers your team’s preferred patterns for error handling, state management, and architecture
- Full contextual analysis: Understands your imports, dependencies, and project structure
- Team standards enforcement: Applies your documented coding guidelines automatically
- Advanced issue detection: Spots subtle race conditions, performance bottlenecks, and security vulnerabilities
Usage-based Add-On (Pay-as-you-Go)
- Assigned-seat users use their plan allowance first
- Credits are charged only for eligible over-limit reviews
- Full control over usage and scaling through the dashboard
- Flexible purchase options (one-time & monthly subscription)
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.Enable the add-on and buy credits
Create an Agentic API key
Authenticate with your API key
--api-key KEY to any command directly, but if you plan to make multiple calls, it is more convenient to authenticate once with your CodeRabbit API key:Run a CodeRabbit review