# AI code reviews in AI coding agents

[**AI Code Reviews in CLI**](https://docs.bito.ai/ai-code-reviews-in-cli/overview) integrates seamlessly with AI coding agents like Cursor, Claude Code, Windsurf, and others, enabling natural language code reviews and automated fixes.

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

Before you begin, make sure you have:

* ✅ Installed the CLI ([Installation guide](https://docs.bito.ai/ai-code-reviews-in-cli/installation-guide))
* ✅ Configured your [Bito API key (aka Bito Access Key)](https://docs.bito.ai/help/account-and-settings/access-key)
* ✅ A Git repository with code changes (committed or uncommitted)

## Why use code review CLI with AI agents?

AI coding agents are great at writing code, but they need expert guidance to catch security vulnerabilities, performance issues, and best practices violations. The **AI Code Reviews in CLI** provides that expertise.

**The power combination:**

* **AI Code Reviews in CLI** provides specialized code analysis
* **Your AI agent (Cursor, Claude Code, Windsurf, etc.)** implements the fixes and iterates based on feedback
* **You** stay in natural conversation, never leaving your workflow

## How it works

{% stepper %}
{% step %}

### Configure your agent

Add `bitoreview` command to your agent's rules file so it knows when and how to run code reviews. See the [**Setup guide**](#setup-guide) section below for commands to set this up for your specific coding agent.
{% endstep %}

{% step %}

### Ask for code reviews in natural language

Simply tell your agent "review my changes" or "check for security issues"
{% endstep %}

{% step %}

### Agent runs code review CLI Automatically

Your agent executes the `bitoreview` command and reads the results
{% endstep %}

{% step %}

### Get fixes implemented instantly

Tell your agent which issues to fix, and it implements the changes automatically
{% endstep %}
{% endstepper %}

## Setup guide

The [guidelines file](https://bitoreview.bito.ai/bito_cli_review_guidelines.md) is a set of instructions that tells your AI coding agent (Claude Code, Cursor, etc.) how to correctly run `bitoreview` command when you ask it to do a code review. It defines the expected workflow, such as always using `--prompt-only` for structured JSON output, waiting for the review to complete before responding, grouping issues by severity, and validating problems in the actual code before suggesting fixes. Without these guidelines, the AI coding agent may not know how to use Bito's AI Code Reviews in CLI.

To get started, you need to add the guidelines to your agent's rules file. Depending on your AI coding agent, this is either done automatically during installation, or manually per project using a simple command:

#### Global configuration (auto-applied during install)

During setup, the installer **automatically adds the usage guidelines globally** for the following AI coding agents if they are detected on your system:

<table><thead><tr><th width="179" align="center">AI Coding Agent</th><th>Guidelines file location</th></tr></thead><tbody><tr><td align="center"><strong>Claude Code</strong></td><td><code>~/.claude/CLAUDE.md</code></td></tr><tr><td align="center"><strong>Windsurf</strong></td><td><code>~/.codeium/windsurf/memories/global_rules.md</code></td></tr></tbody></table>

#### Project-level configuration (manual, per-project)

For all other supported IDEs such as **Cursor, VS Code (GitHub Copilot), Junie, and JetBrains AI Assistant**, you need to add the guidelines manually inside each project directory where you want them to apply.

Navigate to your project root, then run the relevant command:

**Cursor:**

* **macOS / Linux:**

  ```shellscript
  cd /path/to/your/project
  curl -fsSL https://bitoreview.bito.ai/bito_cli_review_guidelines.md -o .cursorrules
  ```
* **Windows:**

  ```shellscript
  cd C:\path\to\your\project
  irm 'https://bitoreview.bito.ai/bito_cli_review_guidelines.md' | Out-File -FilePath .cursorrules
  ```

**Windsurf:**

* **macOS / Linux:**

  ```shellscript
  cd /path/to/your/project
  mkdir -p .windsurf/rules
  curl -fsSL https://bitoreview.bito.ai/bito_cli_review_guidelines.md -o .windsurf/rules/bitoai-review.md
  ```
* **Windows:**

  ```shellscript
  cd C:\path\to\your\project
  New-Item -ItemType Directory -Path .windsurf\rules -Force
  irm 'https://bitoreview.bito.ai/bito_cli_review_guidelines.md' | Out-File -FilePath .windsurf\rules\bitoai-review.md
  ```

**VS Code (GitHub Copilot):**

* **macOS / Linux:**

  ```shellscript
  cd /path/to/your/project
  mkdir -p .github
  curl -fsSL https://bitoreview.bito.ai/bito_cli_review_guidelines.md -o .github/copilot-instructions.md
  ```
* **Windows:**

  ```shellscript
  cd C:\path\to\your\project
  New-Item -ItemType Directory -Path .github -Force
  irm 'https://bitoreview.bito.ai/bito_cli_review_guidelines.md' | Out-File -FilePath .github\copilot-instructions.md
  ```

**Junie:**

* **macOS / Linux:**

  ```shellscript
  cd /path/to/your/project
  mkdir -p .junie
  curl -fsSL https://bitoreview.bito.ai/bito_cli_review_guidelines.md -o .junie/guidelines.md
  ```
* **Windows:**

  ```shellscript
  cd C:\path\to\your\project
  New-Item -ItemType Directory -Path .junie -Force
  irm 'https://bitoreview.bito.ai/bito_cli_review_guidelines.md' | Out-File -FilePath .junie\guidelines.md
  ```

**JetBrains AI Assistant:**

* **macOS / Linux:**

  ```shellscript
  cd /path/to/your/project
  mkdir -p .aiassistant/rules
  curl -fsSL https://bitoreview.bito.ai/bito_cli_review_guidelines.md -o .aiassistant/rules/bitoai-review.md
  ```
* **Windows:**

  ```shellscript
  cd C:\path\to\your\project
  New-Item -ItemType Directory -Path .aiassistant\rules -Force
  irm 'https://bitoreview.bito.ai/bito_cli_review_guidelines.md' | Out-File -FilePath .aiassistant\rules\bitoai-review.md
  ```

**Other agents**: Check your agent's documentation for the custom rules/instructions file location, then copy and paste the sample guidelines content provided below directly into that file.

```markdown
# Code Review

When user asks for code review, run `bitoreview` immediately with all required permissions needed to allow it to write files to its config.

## Do
- Always use `--prompt-only` flag (JSON output for AI)
- Generate a unique temp filename (e.g., using timestamp)
- Use `tee` to save output to the temp file while running
- Wait for command to complete before responding
- Present clear summary grouped by severity
- Validate issue against actual code before fixing

## Don't
- Don't use hardcoded filenames (conflicts with parallel runs)
- Don't respond before command completes
- Don't run the review command twice
- Don't show raw JSON output to user
- Don't fix issues without validating first

## Two-Step Pattern
1. Run `bitoreview review --prompt-only 2>&1 | tee <unique_temp_file>`
2. Parse the JSON output and present summary to user

Generate unique filename using timestamp or random value in the platform's temp directory.

## After Reading Output
1. Quick sanity check (file exists, line numbers valid)
2. Group issues by severity (high â†’ medium â†’ low)
3. Present summary: file:line, issue title, suggested fix
4. Show metrics (total issues, by severity)
5. Offer to help fix issues

## Before Fixing Any Issue
1. Read the actual code at the reported file:line
2. Validate the issue exists in current code
3. Verify suggested fix is appropriate
4. Apply fix only if validated
5. If invalid, explain why to user

## Modify Command By Intent
- "quick" / "critical" â†’ add `--mode essential`
- "security" â†’ add `--focus security`
- "performance" â†’ add `--focus performance`
- "before PR" â†’ add `--base main`
- "specific file" â†’ add file path
- "uncommitted" â†’ add `--type working`

## Flags Reference
- `--prompt-only` â€” always use (JSON output for AI)
- `--mode essential` â€” ~20% faster, critical issues only
- `--focus` â€” security | performance | bugs | best-practices

## Timing
~2-10 min depending on changeset size. `--mode essential` is ~20% faster.

## Platform Note
`tee` works on Linux, macOS, PowerShell, and Git Bash/WSL. Use platform-appropriate syntax if needed.
```
