# Settings reference

> Abstract: Assay PR Agent takes its configuration from a saved setup or from the environment, and an explicit environment setting takes precedence over a saved value. This page lists every variable, which service reads it, and the shape of a project entry.

## Two sources

The wizard writes a saved setup under `/state/setup/`. A deployment with no wizard supplies the same facts as environment variables. Where both set something, the environment wins.

Three services read them: **setup**, which runs the manager, the wizard and sign-in; **sync**, which refreshes checkouts; and **reviewer**, which polls and runs each review.

## Provider and sign-in

| Variable | Default | Read by | Meaning |
|---|---|---|---|
| `REVIEW_PROVIDER` | `cursor` | setup, reviewer | `cursor`, `claude` or `codex` |
| `REVIEW_AUTH_MODE` | `api-key` | setup, reviewer | `api-key` or `login`. A new wizard configuration defaults to `login`. |
| `REVIEW_MODEL` | none | setup, reviewer | A model the selected provider offers |
| `CURSOR_API_KEY` | none | setup, reviewer | The Cursor key |
| `ANTHROPIC_API_KEY` | none | setup, reviewer | The Claude key |
| `CODEX_API_KEY` | none | setup, reviewer | The Codex key |
| `REVIEW_CURSOR_TEAM_ID` | none | setup, reviewer | The Cursor team to bill. Part of the cache key. |
| `REVIEW_LOGIN_DIR` | `<state>/provider-login`, or `/model-auth` with Compose | setup, reviewer | Where the provider's sign-in session lives |
| `REVIEW_STATE_DIR` | `~/.local/state/cursor-review`, or `/state` in the image | all | The root of the state volume |

Each provider key has a `_FILE` variant naming an absolute path to a mounted file. Only the selected provider's variant is read.

## Budget, polling and history

| Variable | Default | Read by | Meaning |
|---|---|---|---|
| `REVIEW_MAX_INPUT_TOKENS` | 6000 | setup, reviewer | The prompt budget. [Cost and coverage](cost.md#limit) gives its precedence. |
| `REVIEW_POLL_SECONDS` | 120 | reviewer | Seconds to wait after each polling cycle |
| `REVIEW_SYNC_SECONDS` | 120 | sync | Seconds between checkout syncs |
| `REVIEW_QUALGEN_INTERVAL_SECONDS` | 86400 | reviewer | Seconds between history mining runs. `0` disables mining and advisories. |
| `REVIEW_WATCH_SETUP` | off | sync, reviewer | `1` makes both wait for the first setup, and exit when it is saved so they reload. Compose sets it. |
| `XDG_CACHE_HOME` | `/tmp/.cache` in the image | reviewer | The parent of the default cache directory for a review run by hand |
| `REVIEW_OSV_DOWNLOAD_DATABASES` | `1` | reviewer | `0` forbids OSV-Scanner from downloading or refreshing advisory databases |

## Forge credentials

Supplying any of these configures the container without a wizard. Each container supports one GitHub App installation on github.com and one GitLab instance.

| Variable | What to supply |
|---|---|
| `REVIEW_OPERATOR` | The responsible human's forge `login:numeric-id`. Assay uses it for posting attribution. The project's `requester_ids` separately control who can request reviews. |
| `REVIEW_GITHUB_APP_ID`, `REVIEW_GITHUB_INSTALLATION_ID` | Numeric IDs for the GitHub App and for the installation covering your repositories. Use a reviewer installation with access to read PRs and diffs, and to write PR conversation comments. |
| `REVIEW_GITHUB_PRIVATE_KEY`, or `REVIEW_GITHUB_PRIVATE_KEY_FILE` | The App's unencrypted RSA PEM, or an absolute path to the mounted PEM. The value accepts real line breaks or a literal `\n`. |
| `REVIEW_GITLAB_TOKEN`, or `REVIEW_GITLAB_TOKEN_FILE` | A dedicated GitLab reviewer token with API permission to read merge requests and post notes, or an absolute path to the mounted token |
| `REVIEW_GITLAB_BASE_URL` | The instance's HTTPS URL, including any port and path prefix. A project entry can carry its own `gitlab_base`. |
| `REVIEW_GITLAB_CA_FILE`, `REVIEW_GITLAB_CRL_FILE` | Optional absolute paths to a PEM private CA bundle and a PEM revocation list. The variables without `_FILE` accept inline PEM. Supply the same paths to setup, sync and reviewer. |
| `REVIEW_PROJECTS` | The JSON project list. Its shape is below. |

> Choose one source for each credential: a value, or a `_FILE` path, never both. The reviewer reads its credentials when it starts, so restart it after a rotation.

## A project entry

`REVIEW_PROJECTS` is a JSON array. This example lists one GitHub project and one GitLab project:

**A project list, set out one key per line. The same list fits on one line in an environment file.**

```text
[
  {
    "provider": "github",
    "url": "https://github.com/example/api",
    "checkout": "/repos/api",
    "requester_ids": [101],
    "visibility": "public"
  },
  {
    "provider": "gitlab",
    "url": "https://gitlab.example.com/example/web",
    "checkout": "/repos/web",
    "requester_ids": [202],
    "visibility": "private"
  }
]
```

Comments:
- Comment 1 (line 3): The forge: `github` or `gitlab`.
- Comment 2 (line 6): The accounts allowed to post /review, by numeric ID.
- Comment 3 (line 7): Set the visibility the project really has. It authorizes posting on a public or internal project.


| Key | Required | Takes |
|---|---|---|
| `provider` | Yes | `github` or `gitlab`. It names the forge, not the model. |
| `url` | Yes | The project's full HTTPS URL |
| `requester_ids` | Yes | A non-empty list of numeric account IDs allowed to request reviews |
| `checkout` | Unless `managed` is set | An absolute directory that exists inside the container |
| `managed` | No | `true` for a clone the sync service manages. The checkout path is then derived from the URL. |
| `visibility` | No | `private` by default, `internal` or `public` |
| `go_analysis` | No | The trusted CI workflow or job that publishes Assay's Go analysis report |
| `scanner_ci` | No | Per-tool settings for reusing CI scanner reports. [CI reports](ci-reports.md) has them. |
| `gitlab_base` | No | The instance's HTTPS base, for a GitLab project on a custom instance |

> The `projects.json` file holds the same entries inside an object: `{"projects": [...]}`. The wizard resolves usernames to numeric IDs. A list supplied by hand must already contain the IDs.

## Setup and Compose

| Variable | Default | Meaning |
|---|---|---|
| `REVIEW_SETUP_BIND` | `127.0.0.1`, or `0.0.0.0` with Compose | The address the browser wizard listens on. The port is fixed at 8765. |
| `REVIEW_IMAGE` | `assay-pr-agent:local` | The image Compose runs. With `install.sh`, setting it pulls the image instead of building it. |
| `CONTAINER_RUNNER` | `ubuntu-latest` | A GitHub Actions repository variable naming a Docker-capable Linux x64 runner |

## A complete environment file

This `review.env` uses both forges, and reads two keys from a mounted secrets directory:

**One project per forge, with credentials read from mounted files.**

```text
REVIEW_OPERATOR=alice:101
REVIEW_GITHUB_APP_ID=123456
REVIEW_GITHUB_INSTALLATION_ID=789012
REVIEW_GITHUB_PRIVATE_KEY_FILE=/run/secrets/github-reviewer.pem
REVIEW_GITLAB_TOKEN_FILE=/run/secrets/gitlab-reviewer-token
REVIEW_PROJECTS=[{"provider":"github","url":"https://github.com/example/api","checkout":"/repos/api","requester_ids":[101],"visibility":"public"},{"provider":"gitlab","url":"https://gitlab.example.com/example/web","checkout":"/repos/web","requester_ids":[202],"visibility":"private"}]
REVIEW_POLL_SECONDS=120
REVIEW_MAX_INPUT_TOKENS=6000
```

Comments:
- Comment 1 (line 4): The App's key, read from the mounted file.
- Comment 2 (line 6): The same two projects as above, on one line.


```sh
docker run --rm --platform linux/amd64 --env-file review.env -e CURSOR_API_KEY \
  -v review-state:/state -v /path/to/checkouts:/repos:ro \
  -v /path/to/reviewer-secrets:/run/secrets:ro assay-pr-agent
```

For environment-only credentials, omit the two `_FILE` lines and the secrets volume, and pass `-e REVIEW_GITHUB_PRIVATE_KEY -e REVIEW_GITLAB_TOKEN` to forward exported values.

## The same in a Pod

Argo CD and Flux can mount a Kubernetes Secret instead. The fragment adds a mounted key and an injected token to the reviewer container. The other settings can come from a ConfigMap.

**A Pod fragment that mounts the GitHub App key and injects the GitLab token.**

```text
spec:
  containers:
    - name: reviewer
      env:
        - name: REVIEW_GITHUB_PRIVATE_KEY_FILE
          value: /run/secrets/reviewer/github.pem
        - name: REVIEW_GITLAB_TOKEN
          valueFrom:
            secretKeyRef:
              name: reviewer-credentials
              key: gitlab-token
      volumeMounts:
        - name: reviewer-key
          mountPath: /run/secrets/reviewer
          readOnly: true
  volumes:
    - name: reviewer-key
      secret:
        secretName: reviewer-credentials
        items:
          - key: github-private-key
            path: github.pem
```

Comments:
- Comment 1 (line 5): The key arrives as a file.
- Comment 2 (line 7): The token arrives as an environment variable, from the same Secret.
- Comment 3 (line 14): Mount the files so UID 10001 can read them.


## Runtime copies

Assay keeps mode-0600 runtime copies of the credentials it is given. In Docker these live in `/dev/shm`. The keys are excluded from the project settings and the review database.

The normal `/review` path uses GitLab's token without rotating it. The poller derives `GITLAB_API_BASE` from the configured GitLab projects. An explicit value must match their HTTPS instance and end in `/api/v4`.

> Keep one service instance per state volume.

---

Source of this page: https://pr-agent.assay.guide/settings
