# Configuration

> Where Visto AI reads its settings, how the config file and the UI's Settings work together, and the main keys with their defaults.

Web page: https://visto-ai.com/docs/configuration/

Visto AI reads its configuration from three places: one YAML file for the deployment, an environment file for its secrets, and an optional `.visto-ai.yml` in each reviewed repository. Once the service has started, most of the deployment's settings can also be changed by an admin in the UI's Settings, and the file and the database are kept in step at every start.

This page explains how those pieces fit together and lists the main keys. [config.example.yml](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/config.example.yml) documents every key, with a comment for each.

## Where configuration lives

### The deployment file

Copy [config.example.yml](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/config.example.yml) to `config.local.yml`, which git ignores, and edit it. The Compose file mounts it read only at `/config/config.yml`, and the service starts with `--config /config/config.yml`.

An unknown key anywhere in the file is an error, and the service refuses to start, printing one `config:` line for each problem.

### Secrets in the environment

A secret is never written in the file. The file names the environment variable that holds it, as `{ env: VARIABLE }`:

```yaml
model:
  apiKey: { env: OPENROUTER_API_KEY }
```

Under Compose the variables come from `.env`, which git ignores. Copy [env.example](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/env.example) to `.env` and fill it in. Every key that holds a secret takes a reference this way: the model's and the scorer's API keys, the GitHub App's private key, webhook secret and client secret, the database URL, the alert webhook, the audit key, and secrets inside extension options and MCP server headers.

### The repository's own file

A team can commit `.visto-ai.yml` at the root of its repository to list paths that always need a human reviewer. It can only add protection: it never weakens a setting of the deployment. See [.visto-ai.yml](https://visto-ai.com/docs/visto-ai-yml/).

## The file and the UI's Settings

Once the service has started, the editable part of the configuration lives in its database too, and an admin changes it in the UI's Settings (see [The UI](https://visto-ai.com/docs/the-ui/)). The rest stays in the file and is shown read only on the screen.

### What the UI edits

| Editable in Settings | Only in the file |
|---|---|
| `dryRun`, `learning` | `app`, `database`, `server`, `alerts` |
| `limits`: all four keys | `ui`, `auditKey` |
| `model.model`, `model.fallbacks`, `model.effort`, `model.toolChoice`, `model.timeoutSeconds`, `model.prices`, `model.extraBody`, `model.extraHeaders` | `extensions`, `mcpServers` |
| `scorer.model`, `scorer.timeoutSeconds` | `model.apiKey`, `scorer.apiKey` |
| Under `repositories.defaults` and each override: `primaryBranches`, `ignoredAuthors`, `baseBranches`, `newHead`, the `score` keys and the `gate` keys | `model.baseUrl`, `scorer.baseUrl` |

A list or a map is one setting. The file-only keys are the ones the service needs before it reaches the database, or ones that hold a secret by reference.

The two endpoints, `model.baseUrl` and `scorer.baseUrl`, are file-only on purpose. The API keys are sent to them, so an admin who could change an endpoint could send the deployment's keys to an address of their choosing. Settings shows them read only with "Set in config.yml". Changing one takes an edit of the file and a restart.

The second scorer is on while `scorer.model` or `scorer.timeoutSeconds` is in the database. Its API key stays in the file, so switching the scorer on in the UI needs the file to write `scorer.apiKey`.

These settings belong to the deployment. A repository's `.visto-ai.yml` still only adds protection on top of them.

### How the file and the database stay in step

At each start, after the migrations and before anything reads a setting, the service compares each editable setting in the file with what the file said at the previous start. It does this in one transaction and logs one `settings` line with `from_file` and `from_ui` counts.

- **A setting you changed in the file** (written, edited or removed) goes into the database and replaces what the UI saved. The change is recorded as made by `config.yml`. A setting removed from the file goes back to its default.
- **A setting you did not change in the file** keeps the database's value, so a change made in the UI survives a restart.
- **The first start** copies every setting the file writes.

So the rule is simple: **a setting changed in the file wins at the next start; otherwise the UI's value stands.**

While the UI is off (the file writes no `ui.publicUrl`), each start instead copies the file's editable part whole, recording every difference as made by `config.yml`. The service then runs on the file's settings, and what the UI saved before is replaced. The change record keeps the old values, and an export taken before has their text.

#### When the file and the saved settings clash

A file that fails on its own stops the start as usual, with its `config:` lines and exit code 2, and nothing is copied.

A file that passes on its own but fails once the settings saved in the UI are put back also stops the start, and nothing is copied. The service prints:

1. one `config:` line for each issue;
2. when some setting came from the UI, the sentence `Saved in the UI: <up to 10 setting paths, then "and <n> more">; with them config.yml does not pass.`, followed by how to settle it;
3. a plain `start_failed` line, then one JSON line `{ "event": "start_failed", ... }`.

The process exits with 1, and the service and its UI stay down until the file is fixed. The sentence names every setting saved in the UI, not only the ones that clash; the `config:` lines say which ones do. To settle it, write those settings in the file with another value, or remove them where the file writes them: a setting changed in the file wins at the next start. A setting the file does not write is settled only by writing it.

#### Repository override keys

A key under `repositories.overrides` is lower-cased when it is stored (`Acme/Web` is read as `acme/web`). Two keys that differ only by case become one repository; for a setting both write, the key that sorts last, as written, wins. An override key that is not `<owner>/<name>` once lower-cased names no repository and is not copied into the database.

### When a saved setting applies

Most settings apply at the next review or event, with no restart. A review already running keeps the settings it started with.

| Applies at once | Waits for the next start |
|---|---|
| Every repository setting (each event, gate job, withdrawal job and review job reads the settings in force) | `dryRun` |
| `limits.inputTokensPerCall`, `limits.batchesPerReview` | `learning` |
| `limits.spendPerDay`, read at each look | `limits.queueConcurrency` |
| `model.model`, `fallbacks`, `effort`, `extraBody`, `extraHeaders`, `prices` | `model.timeoutSeconds`, `model.toolChoice` |
| `scorer.model`, `scorer.timeoutSeconds` | Whether the second scorer is on |

Saving a setting from the right-hand column restarts the service on its own (see [Running the service](https://visto-ai.com/docs/running-the-service/#restarts-and-upgrades)). Raising `limits.spendPerDay` above what is already spent lets the alerts at 80% and at the limit fire again when the spend reaches them.

A few things are decided at start, so a change saved in the UI takes full effect only at the next start:

- **Merge gate.** A gate switched on in the UI holds each pull request from its next event. The start's sweep of checks, the `gate_bypass` alert, the app's permission check for the gate, and the asking for checks of waiting reviews when a pause begins, ends or changes reason all wait for the next start.
- **Automatic approval.** Switched on in the UI, it is checked for the app's Administration read permission at the next start.
- **The model's key check.** The check at start, and at each upkeep after it, sends the headers and endpoint the service started with, and judges a key with no limit left by the models it started with, while reviews send the saved headers. A wrong header saved in the UI does not show in the check, and a saved header that fixes a wrong one does not lift a `model_error` pause the check raised, so reviews can stay paused until the next start.

### Exporting the settings

The UI never writes `config.yml`. Instead, Settings gives the saved settings as YAML to copy back into the file: the `dryRun`, `learning`, `limits`, `model`, `scorer` and `repositories` keys, including what only the file holds inside `model` and `scorer` (the key references and the endpoints). It starts with two comment lines. A third, `# scorer: not in the saved settings ...`, appears when the second scorer is off in the saved settings while the file still writes a `scorer` block: remove that block from the file, or the evals keep scoring with it.

The export reads back as the same settings, so replacing those keys of the file with it keeps the file in step. The file's comments in those blocks are lost when you replace them.

The eval commands (`npm run eval:replay`, `eval:backtest`, `eval:judge` and the other `eval:*` scripts) read `config.yml` only. An eval run after a change in the UI uses the file's settings until you copy the export in.

### What the screen, the record and the export show

No secret's value is stored in the database's settings, shown on the screen, recorded or exported. Two exceptions follow from what takes no reference:

- `model.extraBody` and `model.extraHeaders` hold their values as written. Whatever the file writes there, a header's value included, is shown to admins in Settings, stored in the `settings`, `settings_file` and `setting_changes` tables, recorded and exported. Nothing is refused.
- `model.baseUrl` and `scorer.baseUrl` take any `http` or `https` address. A user, password or token written in an address is shown to admins, read only, and appears in the export. It is not stored in those tables or recorded.

Keep keys in `model.apiKey` or `scorer.apiKey`, by reference. To read the settings and their history by hand, see "The settings, and who changed them" in [The UI](https://visto-ai.com/docs/the-ui/).

## The main blocks

The tables below give each key's default and what it does. The comments in [config.example.yml](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/config.example.yml) give the full detail.

### `model`

The model that writes the review, through a chat-completions endpoint.

| Key | Default | What it does |
|---|---|---|
| `baseUrl` | `https://openrouter.ai/api/v1` | The endpoint. Only the file sets it, because the key is sent there. |
| `apiKey` | required | The environment variable holding the API key, sent as a bearer token. |
| `model` | required | The model to ask first. |
| `fallbacks` | `[]` | Models to try, in order, when the first one fails. |
| `effort.default` | `{}` | Fragment merged into the request body for ordinary pull requests. |
| `effort.elevated` | `{}` | Fragment for large pull requests and those that target a primary branch. The example sets `{ reasoning: { effort: high } }`. |
| `extraBody` | `{}` | Fields merged into every request body. |
| `extraHeaders` | `{}` | Headers sent with every request. |
| `prices` | `null` | `inputPerMillion`, `cachedInputPerMillion`, `outputPerMillion`, for an endpoint that reports no cost. OpenRouter reports it. |
| `timeoutSeconds` | `240` | How long one model call may take, at most 300. |
| `toolChoice` | `forced` | How the model is made to answer through `submit_review`. |

With neither a reported cost nor `prices`, a review's cost is recorded as 0 and the daily spend limit cannot see it.

#### `model.toolChoice`

With `forced`, every request names the `submit_review` tool. Use it unless your endpoint refuses a request that names a tool for your model; some endpoints do this for some newer models, and every review then fails at the model stage with a provider error.

With `auto`, each request leaves the choice to the model. The tools offered stay the same, and a turn that must end the call says so in a line. An answer there that does not call `submit_review` is invalid output and takes the one retry. The cost: the model may answer in prose, which costs one more request, and two such answers in one model call fail that part of the review. With MCP servers named, a model that calls one of their tools on the closing turn and again on its retry fails that batch the same way (see [MCP tools](https://visto-ai.com/docs/mcp-tools/)). The key applies to requests with no MCP server too, and the eval commands honour it.

### `limits`

| Key | Default | What it does |
|---|---|---|
| `inputTokensPerCall` | `200000` | Input tokens allowed in one model call, at least 10,000. With MCP servers named, under about 34,000 the tools never fit, and every review records each server as skipped with `no_room`. |
| `batchesPerReview` | `6` | Batches of files allowed in one review. |
| `spendPerDay` | `50` | The most the service may spend on model calls in one UTC day, in the unit of the recorded costs (US dollars with OpenRouter). |
| `queueConcurrency` | `2` | How many review jobs may run at once, 1 to 20. |

See [Running the service](https://visto-ai.com/docs/running-the-service/#spending-and-limits) for what happens at the limit.

### `dryRun` and `learning`

| Key | Default | What it does |
|---|---|---|
| `dryRun` | `true` | `true`: reviews are run and recorded, and nothing is posted to GitHub. `false`: reviews are posted and `/review` comments are answered. See [Leaving dry run](https://visto-ai.com/docs/leave-dry-run/). |
| `learning` | `false` | Switches memory on or off for every repository of the deployment: memory for the score, lessons and reverts. It is not a repository key. See [Memory](https://visto-ai.com/docs/memory/). |

The number a pull request's description says it reverts is stored whether or not learning is on.

### `scorer`

An optional second scorer: a decision model that scores the changed blocks in place of the review model. Naming one sends the reviewed code to that provider too, and `repositories.defaults.score.threshold` must then be written. See [Second scorer](https://visto-ai.com/docs/second-scorer/).

| Key | Default | What it does |
|---|---|---|
| `baseUrl` | `https://openrouter.ai/api/alpha` | The scorer's API. Only the file sets it. |
| `apiKey` | required | The environment variable holding the scorer's key. |
| `model` | required | The decision model to call. |
| `timeoutSeconds` | `60` | How long to wait for one scorer call, at most 300. |

### `app`, `database`, `server`, `alerts`

Needed to run the service, not for the eval commands.

| Key | Default | What it does |
|---|---|---|
| `app.id` | required | The GitHub App's id. |
| `app.privateKey` | required | The variable holding the app's RSA private key in PEM form. A key on one line, with `\n` for each line break, is accepted. |
| `app.webhookSecret` | required | The variable holding the secret set on the app's webhook. |
| `app.clientId`, `app.clientSecret` | none | Needed only when `ui` lets people sign in through GitHub. |
| `database.url` | required | The variable holding the Postgres URL (`postgres://` or `postgresql://`). |
| `server.port` | `8080` | The port the service listens on, 1 to 65535. |
| `alerts.webhook` | none | The variable holding a URL (http or https) that receives every alert. See [Alerts](https://visto-ai.com/docs/running-the-service/#alerts). |

See [Create the GitHub App](https://visto-ai.com/docs/create-the-github-app/) for the app's values.

### `ui`

The web UI at `<publicUrl>/ui/`. It is on when `publicUrl` is written. Without `ui`, `/ui/` and `/api/` answer 404. See [The UI](https://visto-ai.com/docs/the-ui/).

| Key | Default | What it does |
|---|---|---|
| `publicUrl` | none | Where people open the service: an `https` URL with no path, or `http://localhost` or `http://127.0.0.1`. |
| `accounts` | `[]` | GitHub logins (up to 100) who may also sign in through the GitHub App, as viewers until an admin says otherwise. |
| `team` | none | One `<org>/<team-slug>`, or a list of up to 10. A member of any of them may sign in through GitHub. Install the app on each organisation named, with Members read. |
| `openSignIn` | `false` | Anyone with a GitHub account may sign in, always as a viewer, for a public demo; events of a repository that is not public are then ignored. Needs a second, public app for sign-in: see [Open sign-in to anyone](https://visto-ai.com/docs/the-ui/#open-sign-in-to-anyone-for-a-public-demo). |

With `accounts`, `team` or `openSignIn`, `app.clientId` and `app.clientSecret` must be written too, and the app's callback URL is `<publicUrl>/api/auth/callback`. Password accounts are made by an admin in Settings, and the first admin by `npm run accounts`.

### `auditKey`

The secret the audit sample of automatic approval is drawn with, named by reference: at least 32 characters, for example the output of `openssl rand -hex 32`. It is optional. With none written, the service generates a key at its first start and keeps it in its database, never shown, logged or exported. A key you write must be set in the environment, and wins. Writing a key later, or removing it, draws every pull request again. See "The audit key" under [Automatic approval](https://visto-ai.com/docs/automatic-approval/).

### `extensions` and `mcpServers`

- `extensions` lists extension modules, at most 20, each with a `name`, a `module` (a path or a package) and its `options`, where a secret is named as `{ env: VARIABLE }`. See [Extension modules](https://visto-ai.com/docs/extension-modules/).
- `mcpServers` lists MCP servers, at most 5, each with a `name`, a `url`, `headers` (a secret by reference) and the `tools` the model may be offered (1 to 20). See [MCP tools](https://visto-ai.com/docs/mcp-tools/).

### `repositories`

`repositories.defaults` applies to every repository. `repositories.overrides`, keyed by `owner/name`, changes only the keys it sets for one repository:

```yaml
repositories:
  defaults:
    primaryBranches: [main, master]
    score: { threshold: 70 }
  overrides:
    acme/shop: { primaryBranches: [trunk], baseBranches: [trunk], score: { threshold: 60 } }
```

| Key | Default | What it does |
|---|---|---|
| `primaryBranches` | `[main, master]` | A pull request that targets one of these gets elevated effort. |
| `ignoredAuthors` | `['dependabot[bot]']` | Pull requests by these logins are not reviewed. |
| `baseBranches` | `[]` | Only pull requests that target one of these are reviewed. Empty, or a list holding `*`, means every branch. |
| `newHead` | `incremental` (see below) | How a new head of an already reviewed pull request is reviewed. |
| `score.threshold` | `70` | A changed block scored at or above this (1 to 100) is listed for a human reviewer. Required when a scorer is named. See [The score](https://visto-ai.com/docs/the-score/). |
| `score.inlineNotes` | `false` | A short comment in the diff for each block listed for a human reviewer. See [Inline notes](https://visto-ai.com/docs/inline-notes/). |
| `score.autoApprove` | `false` | Posts the review as an approval when nothing needs a person. See [Automatic approval](https://visto-ai.com/docs/automatic-approval/). |
| `score.approvalThreads` | `strict` | When a thread counts as closed for approval: `strict` or `gate`. |
| `score.auditShare` | `5` | The percentage (0 to 100) of would-be approvals sent to a person anyway. `0` switches the sample off. |
| `gate` | off | The merge gate. See [The merge gate](https://visto-ai.com/docs/merge-gate/). |

#### `newHead`

- `incremental` reads only what changed since the last review, plus files no review has read and files with a thread due a verdict. A defect left in unchanged code is then not found.
- `full` reads the whole pull request at every head, and costs about what a first review costs.

Not written means `incremental`, except on a gated pull request in `enforce` or `bypass` mode, where it means `full`. It changes nothing for a first review, for a head on a different base branch (always full), or for a `/review` on the head and base of the last review (always a re-check). See [Reviews after the first](https://visto-ai.com/docs/leave-dry-run/).

#### `*` in branch lists

In `baseBranches`, `*` means every branch, also beside other names; git refuses `*` in a branch name, so no real branch is shadowed. The gate's `branches` work differently: a `*` there is read as a branch of that name and gates nothing. The Settings screen says so beside them.

#### `gate`

| Key | Default | What it does |
|---|---|---|
| `enabled` | `false` | With the gate off, nothing else in the block has any effect. |
| `branches` | none | The gated base branches, compared exactly. Required when the gate is enabled. |
| `checkName` | `AI Review` | The check's name, 1 to 100 printable ASCII characters. |
| `mode` | `enforce` | `enforce`, `shadow` (writes the check, but pushes are reviewed as without a gate) or `bypass` (writes a passing check). |
| `clearByReply` | `true` | Whether a person's reply and a resolved thread clear a blocking finding. |
| `skipTeam` | none | `<org>/<team-slug>` whose members may comment `/ai-review-skip <reason>`. |
| `requiredChecks` | `[]` | Other checks or statuses that `/done` reads before it says a head is already green. |

Only the deployment's configuration sets the gate; a reviewed repository cannot. The check must also be made required in GitHub. See [The merge gate](https://visto-ai.com/docs/merge-gate/) for the permissions it needs and how to switch it on in shadow mode first.
