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
Catch bugs before they reach your repository. CodeRabbit scans committed and uncommitted Git changes for race conditions, null pointer exceptions, and logic errors.
Turn findings into fixes
CodeRabbit reports each issue with fix guidance. Apply the change in your editor, or pass structured findings to your AI coding agent to implement it.
Context-aware reviews
Paid plans unlock reviews powered by your team’s codebase history: error handling conventions, architectural patterns, and coding preferences applied automatically to every review.
Install agent skills
Run
coderabbit skills to preview and install or update verified CodeRabbit skills for supported coding agents.Getting started
1
Install CLI
Install the CLI using your preferred method:If
- Install script
- Homebrew
- Windows
coderabbit is not available immediately after installation, start a new shell, or run the exact shell-specific reload command printed under Next steps. If the install script offers browser sign-in without first asking for a region, EU users should skip it and authenticate later with an explicit --region eu.2
Authenticate
Link your CodeRabbit account to enable personalized reviews based on your team’s patterns.A browser window opens automatically. Sign in to CodeRabbit and the authentication completes in the browser.When no region is specified or saved, login uses the US region. The CLI saves the selected region for future commands, and API-key authentication uses the key’s organization and is also the recommended flow for headless or bot-driven environments. Reviews use the assigned user’s plan allowance first, then usage credits only for eligible over-limit reviews when usage-based reviews are enabled.
cr auth status displays it.If your account has access to multiple CodeRabbit organizations, choose your default organization during sign-in. That choice sets the login/default org for browser-based auth, but CLI reviews still resolve the current repository first. You can change the default later with cr auth org.If browser sign-in is blocked or unavailable, authenticate with an Agentic API key instead:3
Review your code
Analyze your Git repository for issues using the CodeRabbit CLI.If your main branch is not CodeRabbit scans the selected Git changes and provides specific feedback with suggested fixes.
Local reviews require a Git repository: Run the CLI from anywhere inside an initialized Git worktree. The
--dir flag can target a Git worktree or a subdirectory within one. To review without a checkout, use a remote review.main, specify your base branch:4
Verify local setup
If setup, authentication, or review startup fails, run the local diagnostics command:The command checks installation, local storage, authentication, Git repository state, and CodeRabbit service connectivity.
5
Apply suggestions
Review findings in your terminal and either apply quick fixes or send complex issues to your AI coding agent.
Review without a local checkout
With CLI 0.7.7 or later, review an installed GitHub repository from any directory:--agent for structured output.
See remote review requirements and limits, including supported refs, the changed-file limit, and local history behavior.
Configure your repository
With CLI 0.7.7 or later, run guided setup inside your Git repository:cr config --detailed to configure review style and path-specific instructions. Existing settings are preserved unless you choose to change them.
See configuration setup for agent workflows, configuration discovery, and validation.
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 local 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 requires an active browser-based login. If your local session is missing or expired, run cr auth login first, then run cr auth org again. 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.
Usage-based reviews and consent
When an organization sets usage-based reviews to the On demand continuation mode and the included review limit is reached, CodeRabbit shows the number of billable files and the maximum review price before starting paid work. See usage-based review pricing for rates. Only developers with an assigned seat can authorize them. This self-serve launch excludes Enterprise organizations. In an interactive terminal, confirm the price prompt to run that one review with usage credits. You can also give explicit consent when starting the review:coderabbit review command never creates a charge in on_demand mode without this confirmation.
In headless or agent mode, CodeRabbit never waits for or assumes confirmation. Instead, it returns a structured action_required result with status: "awaiting_confirmation", the billable file count, maximum price, confirmationHeadCommitId content identity, and the explicit coderabbit review --use-credits command. Automation can inspect that result and decide whether to start a new authorized review.
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 analysis. An empty review can still remind you about findings retained from an earlier session.
With CLI 0.7.7 or later, run cr review findings --clear to dismiss those findings after fixing or rejecting them. Clearing runs without a prompt and affects only the current review directory, branch, and base branch. Use --dir <path> for a scoped review directory. Incremental review state is preserved, and future reviews can report new findings normally.
See stored review findings for scope, retention, and error behavior. Remote reviews do not store findings locally.
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.Claude Code users: Claude Code now supports CodeRabbit through a native
plugin. See the Claude Code integration guide
for the recommended plugin-based setup using
/coderabbit:review instead of
the CLI commands shown below.Integration guides
See detailed workflows for AI coding agents and workflows:CodeRabbit Skills
Run
coderabbit skills to install agent-native Skills and trigger reviews with an explicit request such as “Run a CodeRabbit review.”Claude Code integration
Automated workflow with background execution and task-based fixes
Codex integration
Integrated code review and fix implementation with Codex CLI
Headless CLI integration
Authenticate CodeRabbit non-interactively in GitHub Actions and other bot-driven automation
Example prompt for your AI agent
Here’s a complete prompt you can use with Cursor, Codex, or other AI coding agents:Sample prompt
Components of a good prompt
Breaking down what makes an effective CodeRabbit + AI agent workflow:1. Run CodeRabbit CLI
1. Run CodeRabbit CLI
Tell your AI agent to run CodeRabbit with the You can also specify a review scope or base branch:
--agent flag:2. Run in the background
2. Run in the background
CodeRabbit reviews can take 7-30+ minutes depending on the scope of changes. Instruct your AI agent to run CodeRabbit in the background and set up a timer to check periodically:
Prompt
3. Evaluate and implement fixes
3. Evaluate and implement fixes
Once CodeRabbit completes, have your AI agent evaluate the findings and prioritize:This keeps your agent focused on meaningful improvements rather than minor style issues. If the
Prompt
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
Run CodeRabbit one more time to ensure fixes didn’t introduce new issues:
Prompt
5. Set loop limits
5. Set loop limits
Prevent infinite iteration by setting clear completion criteria:This ensures your AI agent completes the task efficiently and provides a clear report.
Prompt
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 usage-based reviews.Free tier
Basic static analysis with limited daily usage. Catches syntax errors, logic issues, and security vulnerabilities. Eligible Free users may see an Advanced trial prompt after sign-in or when a CLI review reaches the rate limit.
Paid plans
Enhanced reviews powered by learnings from your CodeRabbit organization plus higher rate limits and more files per review. Paid users reviewing repositories connected to that organization get:
- 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 reviews (pay-as-you-go)
Continues eligible CodeRabbit CLI reviews after rate limits
- Assigned-seat users use their plan allowance first
- Usage is billed only for eligible over-limit reviews
- Full control over usage and spending caps through the dashboard
- Usage-based billing — each over-limit file is added to your monthly invoice
CLI with usage-based reviews
Usage-based reviews let 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. Usage is billed only when a review continues over that limit. See usage-based review pricing for per-file rates. Usage is added to your monthly invoice. Enable pay-as-you-go and set a spending cap from the Subscription and Billing dashboard for US or EU. This self-serve launch excludes Enterprise organizations.1
Enable the add-on
Go to Subscription and Billing for US or EU, then open the Usage-based add-on tab to turn on pay-as-you-go and set a spending cap.For full setup details, see Manage your subscription.
2
3
Authenticate with your API key
You can pass For GitHub Actions and other non-interactive environments, see Headless CLI integration.
--api-key KEY to a review directly, but if you plan to make multiple calls, it is more convenient to authenticate once with your CodeRabbit API key:4
Run a CodeRabbit review
After logging in, prompt your agent to run a CodeRabbit CLI review without passing the API key again:If plan allowance is available, no usage is billed. If the review is rate-limited, usage-based reviews can continue the review only when pay-as-you-go is enabled, remaining spending capacity is available, and the review is attributed to an assigned-seat user.
Command reference
See the CLI Command Reference for command and option details.Uninstall
Remove CodeRabbit CLI based on how you installed it.If installed using install script
If installed using Homebrew