Open source · Apache 2.0 · GitHub, GitLab, Bitbucket

AI code review that works with any model.

Inline review comments, one-click suggestions, a walkthrough of every pull request and quality scores, using OpenAI, Anthropic, Gemini, AWS Bedrock, Ollama or your own gateway. Runs from the command line or in CI, with no server to host.

$go install github.com/divmora/code-review-bot/cmd/codereview@latest
store/store.go · Pull request #42
36 func (s *Store) Search(ctx, customer string) ([]Order, error) {
- rows, err := s.db.Query(ctx, q, customer)
38+ q := fmt.Sprintf("... WHERE customer = '%s'", customer)
39+ rows, err := s.db.QueryContext(ctx, q)
codereview reviewed 2 minutes ago
🛡️ Security🟠 Major

SQL injection through the customer filter

User input is formatted into the query string. Pass it as a parameter so the driver escapes it.

Suggested change Commit suggestion
- q := fmt.Sprintf("... WHERE customer = '%s'", customer)
+ q := "... WHERE customer = $1"
+ rows, err := s.db.QueryContext(ctx, q, customer)
72
Quality
40
Security
86
Maintainability
What you get

A reviewer that reads the diff the way your team does

Every comment is checked against the real diff before it's posted, so the bot never comments on code a pull request didn't touch.

Inline comments and suggestions

Findings on the exact lines, with severity and a one-click committable suggestion on GitHub and GitLab.

Walkthrough summary

A summary of what changed, file groups, review effort and a description check. It's edited in place on every run, never reposted.

Quality scores

Quality, Security and Maintainability from 1 to 100, capped by the findings, with optional PR labels and a commit status.

Verification pass

A second, skeptical model, optionally from another provider, checks every finding. Disputed major issues become questions instead of disappearing.

Incremental, never repetitive

New pushes are reviewed for what changed. Issues already on the PR aren't posted again, even when worded differently.

Secret scanner and guardrails

Leaked keys are caught without a model call. PR content is treated as untrusted, and review rules come from the target branch.

Reads your AGENTS.md

Guideline files (AGENTS.md, CLAUDE.md, Copilot instructions) are applied, including folder-level AGENTS.md, nearest first.

GitHub, GitLab, Bitbucket

GitHub and GitHub Enterprise, gitlab.com and self-managed GitLab, and Bitbucket Cloud, with each host's own Markdown and limits.

Large PRs, handled

Token-budgeted batches run in parallel. Big files get context excerpts around each change, and one failing batch doesn't sink the review.

How it works

From diff to review in eight steps

Each run reviews one pull request. The model only proposes findings: deterministic checks decide what gets posted.

  1. Read the PR

    Diff, description and the repo's .codereview.yaml, read from the target branch.

  2. Pick up where it stopped

    The last reviewed commit is read from the bot's own comment, so only new changes are sent.

  3. Filter and scan

    Lockfiles, generated, vendored and binary files are skipped. Added lines are scanned for secrets.

  4. Batch with context

    Small files go whole, large ones as excerpts around each change, in token-budgeted batches.

  5. Review in parallel

    Batches go to your model with structured output, retries and fallback models.

  6. Check against the diff

    Comments on lines the PR didn't change, or on unknown files, are dropped.

  7. Verify

    A skeptical second pass removes false positives and turns uncertain findings into questions.

  8. Post

    Inline comments, the walkthrough summary, scores, labels and a commit status. Only with --post.

Bring your own model

Switch providers with one line

Pick a model with --model, CODEREVIEW_MODEL or model: in the config: a provider:model spec or a named profile. Add fallbacks, and use a different model for verification.

OpenAIAnthropicGoogle GeminiAWS Bedrock any model familyAzure OpenAIOllamaOpenRouterGroqDeepSeekMistralxAITogetherLiteLLMAny OpenAI-compatible server
codereview.yaml
model: claude            # change this line to switch provider
fallback: [backup]
models:
  claude:  { provider: bedrock, model: <model-or-inference-profile-id>, region: us-east-1 }
  backup:  { provider: openai,  model: <model>, api_key_env: OPENAI_API_KEY }
  local:   { provider: ollama,  model: "qwen2.5-coder:14b" }
review:
  verify_model: "bedrock:moonshotai.kimi-k2.5"   # a second opinion from another family
Or straight from the environment
# the provider's usual key variable is read automatically
export CODEREVIEW_MODEL=anthropic:claude-sonnet-5-5   ANTHROPIC_API_KEY=...
export CODEREVIEW_MODEL=openai:<model>               OPENAI_API_KEY=...
export CODEREVIEW_MODEL=gemini:<model>               GEMINI_API_KEY=...
export CODEREVIEW_MODEL=bedrock:<model-id>           AWS_REGION=us-east-1
export CODEREVIEW_MODEL=ollama:qwen2.5-coder:14b     # local, no key

codereview ping     # check every model in the chain
Quick start

Review a pull request in a minute

Nothing is written to a pull request unless you pass --post. Try it as a dry run first.

Terminal
# install (or download a binary from Releases, or use the Docker image)
go install github.com/divmora/code-review-bot/cmd/codereview@latest

codereview review --local                         # your uncommitted changes
codereview review --local --base origin/main      # your branch vs main
codereview review https://github.com/org/repo/pull/123                # dry run
codereview review https://gitlab.com/group/proj/-/merge_requests/9 --post
codereview review https://bitbucket.org/team/repo/pull-requests/7 --post --commit-status
codereview ask https://github.com/org/repo/pull/123 "Is the retry loop safe?"
Docker
# the image's entrypoint is the codereview binary
docker run --rm -e CODEREVIEW_MODEL -e ANTHROPIC_API_KEY -e GITHUB_TOKEN \
  ghcr.io/divmora/code-review-bot:0.4.0 review https://github.com/org/repo/pull/123

# review local changes: mount the repository at /workspace
docker run --rm -v "$PWD:/workspace" -e CODEREVIEW_MODEL -e ANTHROPIC_API_KEY \
  ghcr.io/divmora/code-review-bot:0.4.0 review --local
CI/CD

Review every push, with no server

The PR is detected from the CI environment. State lives on the PR itself, so each run picks up where the last one stopped.

.github/workflows/code-review.yml
name: AI code review
on:
  pull_request:
    types: [opened, reopened, synchronize, ready_for_review]
permissions:
  contents: read
  pull-requests: write
jobs:
  review:
    if: ${{ !github.event.pull_request.head.repo.fork }}
    runs-on: ubuntu-latest
    steps:
      - uses: divmora/code-review-bot@v0.4.0
        with:
          model: anthropic:claude-sonnet-5-5
          # fail-on: critical
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  • Drafts and repeats skipped: with --auto, draft PRs, closed PRs and commits already reviewed are skipped. Set auto_review.drafts: true to review drafts.
  • Self-managed GitLab: the instance comes from CI_SERVER_URL. If it uses a private CA, add the CA to the image or point SSL_CERT_FILE at it. skip_tls_verify: true under gitlab: in codereview.yaml is a last resort.
  • Gate merges if you want: --fail-on critical exits with code 3. Leave it off for advisory reviews.
Per-repository config

Your rules, from your target branch

Commit .codereview.yaml to the default branch. It's read from the target branch, like CODEOWNERS, so a pull request can't loosen the rules it's reviewed against. The keys for the PR description and title match CodeRabbit's.

.codereview.yaml
profile: balanced          # chill | balanced | assertive
instructions: |
  Flag fmt.Println outside tests; we use log/slog.
path_instructions:
  - path: "migrations/**"
    instructions: Migrations must be reversible.
path_filters: ["!docs/**"]
max_comments: 20
high_level_summary: true   # "Summary by codereview" in the description
auto_title_placeholder: "@codereview"
auto_review:
  drafts: false
  base_branches: [main, "release/*"]
  • AGENTS.md and friends: project guidelines, plus folder-level AGENTS.md, are checked against every change.
  • Description check: the bot says when the description misses or misstates what the code does, and suggests a title.
  • Never rewrites authors: its summary goes in its own block; titles change only when you add the placeholder.
  • Noise control: profiles, severity thresholds, a comment budget, and lockfiles, generated and vendored files skipped.
  • Scores and status: --score-labels sets Quality Score::85-style labels, and --commit-status marks each reviewed commit.

Review profiles

chillfewest comments

Likely bugs, security problems, data loss and serious performance issues only. No style or naming points.

balanceddefault

Bugs, security and performance, plus maintainability problems that will clearly cause trouble. Skips pure style preferences.

assertivemost thorough

Adds readability, naming, missing tests and documentation gaps. Small polish items are marked as nitpicks.

Reference

CLI

CommandWhat it does
review [URL]Review one PR/MR: --local, --base, --post, --full, --auto, --format text|markdown|json|sarif, --fail-on, --profile, --max-comments, --min-severity, --score-labels, --commit-status, --verify-model
ask URL "question"Answer a question about a PR using its diff (--post to reply on it)
modelsList providers, profiles and the active model chain
pingTest each model in the chain with a tiny structured request
versionPrint the version

Exit codes: 0 success, 1 error, 3 a finding met --fail-on. The JSON output is a stable contract for other tools.

Need it as a service?

Divmora Code Review Console adds webhooks, a review queue, chat commands (@codereview), SSO, a repository allowlist, history and dashboards. It runs this CLI through local, Docker or Kubernetes executors.

See the console