# .visto-ai.yml

> The per-repository file that lists paths whose changes always need a human reviewer, and how its patterns match.

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

A team can commit `.visto-ai.yml` at the root of its repository to list paths that always need a human reviewer. A changed file that matches one of the patterns scores 100% and is listed for a person, whatever the model thinks of it, so it also stops [automatic approval](https://visto-ai.com/docs/automatic-approval/). The file can only add protection: nothing in it lowers a score or changes the deployment's settings.

## Write the file

```yaml
# .visto-ai.yml
human_review:
  - db/migrate/
  - "app/**/policy.rb"
```

`human_review` is the only key. It holds a list of path patterns.

The service reads the file from the repository's **default branch**, not from the pull request. A pull request that edits `.visto-ai.yml` cannot weaken its own review, and the change takes effect once it is merged into the default branch. A missing or empty file means no extra paths.

The review explains each such file with the reason "a path the team marked as always needing a person".

## How patterns match

| Pattern | Matches | Does not match |
|---|---|---|
| `migrations` or `migrations/` | `migrations/x.sql`, `services/api/migrations/x.sql` | |
| `db/migrate/` | `db/migrate/001.rb` | `services/db/migrate/001.rb` |
| `/docs` | the top-level `docs` | `site/docs` |
| `app/**/policy.rb` | `app/policy.rb`, `app/models/user/policy.rb` | `lib/policy.rb` |
| `app/[id]/page.tsx` | only `app/[id]/page.tsx` | `app/1/page.tsx` |

The rules:

- **Where a pattern starts.** A trailing slash is ignored. A pattern with no slash left matches at any depth. A pattern with a slash anywhere but at its end is matched from the repository root, and so is one with a leading slash.
- **Directories.** A pattern that names a directory covers everything under it, dot-files included.
- **Wildcards.** `*` is any run of characters within one name, `?` is one character, and `**` is any number of directories. `**` is special only as a whole path segment: inside a name, such as `a**b`, it is two `*`.
- **Literal characters.** Brackets are ordinary characters. Matching is case-sensitive. Spaces around a pattern are trimmed.
- **Renamed files.** A renamed file is checked by its old path as well as its new one, so moving a file out of a protected path does not unprotect it.

## Paths that are always protected

Some files need a person whether or not the file lists them: `.visto-ai.yml` itself, `CODEOWNERS` (at the root, in `.github/`, `docs/` or `.gitlab/`), and CI definitions (`.github/workflows/`, `.circleci/`, `.buildkite/`, `.gitlab-ci.yml`, `Jenkinsfile`, `azure-pipelines.yml`, `bitbucket-pipelines.yml`, `.travis.yml`). They score 100% with the reason "it changes the reviewer's own file, code owners or CI".

## When the file cannot be used

The service never ignores a broken file silently. If it cannot use the file, **every file of every pull request goes to a person**, and each review says why with one of these codes:

| Code | Cause |
|---|---|
| `not_yaml` | The file is not valid YAML. |
| `not_a_mapping` | The top level is not a mapping of keys. |
| `unknown_key` | A key other than `human_review` is present. |
| `bad_patterns` | `human_review` is not a list, holds more than 200 patterns, or holds a pattern that is refused (below). |
| `not_text` | The content is not text, such as a file saved as UTF-16. |
| `too_large` | The file is over 20,000 characters. |

A pattern is refused when it is not a string, is empty, is longer than 200 characters, starts with `!`, contains a backslash or a brace, contains an empty, `.` or `..` segment, or is only slashes. These would match nothing, so the service refuses the file rather than leave the paths unprotected without a word.

Only a "not found" from GitHub means there is no file. Any other failure to read it fails the review, like any other read of the pull request, rather than review without the protection.

## Related

- [The score](https://visto-ai.com/docs/the-score/)
- [Automatic approval](https://visto-ai.com/docs/automatic-approval/)
- [Configuration](https://visto-ai.com/docs/configuration/)
