Configuration
Every setting, its default, the file it belongs in, and which one wins. All files are optional: with none, the bot runs on environment variables and the defaults below.
Two config files
Operator config: codereview.yaml | Repository config: .codereview.yaml | |
|---|---|---|
| Where | Wherever the bot runs (see lookup order) | Committed to the repository, read from the PR's base commit, so a PR can't change its own rules |
| Holds | Models and keys, code hosts, engine settings, approvals, the command footer, and review.defaults: the review settings every repository starts from | Review settings only |
| Set by | Whoever runs the bot: you, a CI job, or Divmora Code Review Console | The repository's maintainers |
${VAR} in either file is replaced with the environment variable VAR. Keep keys and tokens in the environment, never in a file.
Where the operator config comes from
The first one found is used; the others are ignored:
--config <path>$CODEREVIEW_CONFIG: a path$CODEREVIEW_CONFIG_YAML: the YAML itself. The console passes each job's config this way; in CI it can live in one protected variable../codereview.yamlor./codereview.ymlin the working directory, for local use
The environment variable comes before the file in the working directory: in GitLab CI and Bitbucket Pipelines that directory is the PR's checkout, and a codereview.yaml added by a PR must not replace the operator's config. Run codereview config validate to see which source was used and whether it is valid.
Which setting wins
A review setting is resolved from lowest to highest:
- built-in defaults
review.defaultsin the operator config- the repository's
.codereview.yaml CODEREVIEW_OVERRIDES(per-repository settings from the console)- CLI flags, including turning things off:
--approve=false,--score-labels=false,--fail-on none
The operator keeps control of a few things:
review.approveandreview.commandsare operator-only. In.codereview.yamlthey are ignored, with a warning in the log.- A repository's
fail_oncan set one where the operator has none, and otherwise only make it stricter. - A repository's
modelis used only withallow_repo_model: true, and only names one of the operator's profiles. instructions,path_instructions,path_filtersandlearningsadd up across levels instead of replacing each other.
Operator config
| Key | Default | Meaning |
|---|---|---|
model | the only profile, if there is one | Active model: a profile name from models or a provider:model spec. --model and CODEREVIEW_MODEL win over it. |
fallback | [] | Models tried in order when the active one fails after its retries. CODEREVIEW_FALLBACK (comma-separated) wins. |
models.<name> | Named model profiles, with the keys below. | |
allow_repo_model | false | Let .codereview.yaml pick one of the profiles with model:. Specs from a repository are never used. |
bot_name | the token's user, else codereview | Handle in placeholders and the command footer (@<bot_name> review). Set it for a GitHub App (its slug) or tokens with no user. |
review | Engine settings, approvals and review.defaults. | |
github.api_url | $GITHUB_API_URL, else https://api.github.com | GitHub Enterprise Server: https://<host>/api/v3. GITHUB_TOKEN is sent only here. |
github.token | $GITHUB_TOKEN | A token that can read the PR and post comments. |
github.app_id, private_key_file, private_key | Use a GitHub App instead of a token. | |
github.host | from api_url | PR URL host when it differs from the API host. |
gitlab[] | one instance from GITLAB_URL / CI_SERVER_URL | One entry per GitLab instance: base_url, token, host, skip_tls_verify (last resort for private CAs). |
bitbucket | https://api.bitbucket.org/2.0 | Bitbucket Cloud: token (access token), or email + api_token; api_url. |
Model profile keys
| Key | Default | Meaning |
|---|---|---|
provider | required | openai, anthropic, gemini, bedrock, azure, ollama, openrouter, groq, deepseek, mistral, xai, together, litellm, openai-compatible |
model | required | The provider's model or deployment ID. |
api_key / api_key_env | the provider's usual variable | A key as ${VAR}, or the name of the variable holding it. |
base_url | the provider's | For Azure, gateways and OpenAI-compatible servers. |
headers | Extra HTTP headers, e.g. for a gateway. | |
region, aws_profile | AWS default chain | Bedrock only. |
max_tokens | 8192 | Output token limit per call. |
temperature | the provider's | Sampling temperature. |
timeout | 5m | Per call. |
max_retries | 3 | Retries with backoff; -1 for none. |
structured_output | by provider | json_schema, json_object or prompt. |
Engine settings (review:)
Operator config only.
| Key | Default | Meaning |
|---|---|---|
concurrency | 4 | Parallel model calls per review. |
batch_tokens | 40000 | Estimated prompt tokens per call. |
max_files | 150 | PRs with more reviewable files are skipped. |
full_file_max_lines | 800 | Files up to this size are sent whole for context. |
context_lines | 60 | Larger files: lines sent around each change. |
verify | true | Second, skeptical pass over the findings (one extra call). |
verify_model | the review model | Model for that pass; --verify-model wins. |
verify_can_drop | confident | confident, minor or all: what the verifier may remove. |
verify_can_add | false | Let the verifier add findings it thinks were missed (unverified). |
passes | 1 | Review each batch 1–3 times and merge the findings. |
anchor_scores | true | Start scores from the previous review's; --full rescores. |
repo_config_file | .codereview.yaml | Path of the repository config, read from the base commit. |
approve.enabled | false | Approve PRs that pass, with --post. --approve turns it on, --approve=false off, for one run. |
approve.block | major | Lowest severity that blocks approval: critical, major, minor, nitpick or none. |
approve.min_score | 0 | Also need every score at least this high (1–100); 0 ignores scores. |
approve.withdraw | true | Withdraw the bot's earlier approval when a later review doesn't pass. |
commands | false | List the @bot chat commands in the summary footer. Only when a webhook service (the console) answers them. |
defaults | Any review setting: the starting point for every repository. |
Review settings (.codereview.yaml)
These go in a repository's .codereview.yaml or under review.defaults in the operator config.
| Key | Default | Flag | Meaning |
|---|---|---|---|
profile | balanced | --profile | chill, balanced or assertive. |
max_comments | 25 | --max-comments | Inline comment limit; the rest go in the summary. |
min_severity | by profile | --min-severity | Drop findings below critical, major, minor or nitpick. |
language | English | Language of the review text. | |
poem | false | A short poem in the summary. | |
instructions | Guidance for the whole review. Adds to the operator's. | ||
path_instructions | List of {path, instructions} for matching files. | ||
path_filters | Globs to include; !glob excludes. Lockfiles, generated, vendored and binary files are always skipped. | ||
learnings | List of {text, path}: team decisions the reviewer follows (at most 100). | ||
guidelines.enabled | true | Read guideline files from the target branch. | |
guidelines.files | AGENTS.md, CLAUDE.md, .github/copilot-instructions.md, .cursorrules | Files at the repository root; nested AGENTS.md files are always included. | |
diagram | off | --diagram | Flow diagram in the walkthrough: off, auto (when a change spans layers) or always. |
labels.mode | off | --labels | off, suggest (a line in the walkthrough) or apply (also set them). |
labels.allow | Patterns of the project's labels that may be used, e.g. type::*. | ||
labels.suggest_only | Shown, never set, even in apply mode. | ||
labels.max | 4 | Labels per PR, at most 10. | |
labels.instructions | How to choose labels. | ||
auto_review.enabled | true | --auto applies these | Review on pushes. |
auto_review.drafts | false | Review draft PRs. | |
auto_review.incremental | true | On new pushes, review only what changed. | |
auto_review.base_branches | any | Only PRs into matching branches. | |
auto_review.ignore_title_keywords | [skip review], [no review], WIP | Skip PRs whose title contains one. | |
high_level_summary | true | Append a "Summary by codereview" block to the description. | |
high_level_summary_placeholder | @codereview summary | Where the block goes; works even when the summary is off. | |
high_level_summary_instructions | How to write the summary. | ||
auto_title_placeholder | @codereview | Put it in the title to get a generated one. | |
auto_title_instructions | How to write the title. | ||
score_labels | false | --score-labels | Set Quality, Security and Maintainability score labels (with --post). |
commit_status | false | --commit-status | Set a codereview status on the commit (with --post). |
fail_on | none | --fail-on | Exit 3 at this severity or above. A repository can only make the operator's stricter. |
model | One of the operator's profiles; used only with allow_repo_model. |
CODEREVIEW_OVERRIDES
Per-repository settings as JSON, set by Divmora Code Review Console. They win over the repository's file; CLI flags win over them. Unknown keys are rejected.
{"profile": "assertive", "max_comments": 30, "min_severity": "minor",
"model": "claude", "auto_review": true, "drafts": false,
"instructions": "added to the repository's",
"diagram": "auto",
"labels": {"mode": "suggest", "allow": ["type::*"]},
"learnings": [{"text": "...", "path": "api/**"}]}Environment variables
| Variable | Meaning |
|---|---|
CODEREVIEW_MODEL, CODEREVIEW_FALLBACK | Active model and fallbacks; win over the config. |
CODEREVIEW_CONFIG, CODEREVIEW_CONFIG_YAML | Operator config as a path, or the YAML itself (lookup order). |
CODEREVIEW_OVERRIDES | Per-repository settings as JSON. |
CODEREVIEW_STATE_KEY | A long random secret, the same on every run: the bot signs what it posts and still recognises its own comments after the token changes user. |
GITHUB_TOKEN, GITHUB_API_URL | GitHub token and API base; the token is sent only to that host. |
GITLAB_TOKEN, GITLAB_URL / CI_SERVER_URL | GitLab token (api scope) and instance; the token is sent only to that host. |
BITBUCKET_TOKEN, or BITBUCKET_EMAIL + BITBUCKET_API_TOKEN | Bitbucket Cloud credentials. |
OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, … | Provider keys, read automatically for their provider. Bedrock uses the AWS credential chain. |
Full examples: examples/codereview.yaml (operator) and examples/.codereview.yaml (repository).