# PR bot configuration

Configure the Repowise PR bot with the org policy, repository settings and .repowise/bot.yaml, set AI review depth and limits, pick checks, and use the pull request commands and labels.

This page lists every setting the [PR bot](https://docs.repowise.dev/hosted/bot) reads, where each
one can be set, and the commands and labels it answers on a pull request.

## Where settings come from

Settings come from layers, lowest first; a higher layer wins for each key it
sets:

1. the bot's defaults;
2. the **org policy** of the installation;
3. `.repowise/bot.yaml` in the repository;
4. the repository's own settings on the dashboard;
5. the keys the org policy **locks**.

Gate keys decide a merge, so a pull request cannot loosen them from its own
branch: `enabled`, `health_gate`, `check_runs`, `coverage_fail_under`,
`security_fail_on`, `not_evaluated`, `review_check`, `feedback_decisions`,
`ignore_paths` and `apply_labels` are read from `.repowise/bot.yaml` on the
base branch only. Paid keys (`review_mode`, `review_depth`, `ai_pr_cap_cents`,
`ai_monthly_cap_cents`) are set on the dashboard or through the API
(`PATCH /github-app/bot-repos/{repo_id}/config`), never from
`.repowise/bot.yaml`. `ignore_paths` is a union across layers, so a layer can
add scope but never un-ignore a path another layer skips. A malformed value is
skipped and the layer below stands.

An agent setting these through the API follows
[AI review settings](https://docs.repowise.dev/hosted/bot-setup#7-ai-review-settings-optional).

## AI review

**Depth** (`review_depth`) sets how far AI review goes:

| Depth | Runs |
|---|---|
| `light` | The quick pass and its verifier. No deep review. |
| `auto` | The quick pass, plus the deep review once per pull request when high change risk, a breaking change with outside callers, a large change or a security-sensitive path calls for it, or two of hotspot history, a health drop, a severe new finding and a missing co-change partner. |
| `deep` | The default. The deep review on every push until the pull request's budget is spent. After the first deep review, a push the remaining budget cannot pay for gets the quick pass. |

**Sensitivity** (`review_sensitivity`) sets how many points a review posts:

| Sensitivity | Posts |
|---|---|
| `quiet` | Up to 3 points, only what would hurt. |
| `balanced` | The default. Up to 5 points, leaving out minor ones. |
| `thorough` | Up to 10 points, with a longer search for narrow real defects. |

**Limits.** `ai_pr_cap_cents` bounds the spend on one pull request and
`ai_monthly_cap_cents` the spend on one repository per calendar month; `0`
turns AI review off for the repository. What the bot does when either runs
out is in [AI review budget](https://docs.repowise.dev/hosted/bot#ai-review-budget).

## Findings on lines

`on_lines` decides what lands on the changed lines themselves:

| Value | What it posts |
|---|---|
| `off` | Nothing on the lines; the findings stay in the comment. |
| `annotations` | Check run annotations in **Files changed**: high and critical health findings on added lines, and changed signatures that code outside the pull request still calls. |
| `threads` | The default. The strongest findings as review threads you can reply to: leaked keys, breaking signature changes with outside callers, and AI review points. |
| `both` | Annotations and threads. |

AI review points on code the pull request wrote are capped by the review
sensitivity.

## Checks

The comment's checks section carries what the tests, the security scan and the
docs say about the change. `checks_comment` decides when it renders:

- **`on_signal`** (the default): only when a check has something to say. Once
  shown it is always updated, to an all-clear line when the findings are gone.
- **`always`**: on every pull request.
- **`off`**: never.

### Pass/fail checks

Each check can also post its own GitHub check run, which a branch protection
rule can require. `check_runs` lists the ones that run. `review` is on by
default and the rest are off:

| `check_runs` entry | Check run | Fails when |
|---|---|---|
| `review` | `Repowise review` | Only with a blocking [merge gate](https://docs.repowise.dev/hosted/bot#the-merge-gate). Otherwise `success` when clean and `neutral` with findings. |
| `coverage` | `Repowise / coverage` | Patch coverage is below `coverage_fail_under` (a percent, 0 to 100). With no minimum it reports the figure and concludes `neutral`. |
| `security` | `Repowise / security` | The pull request adds a finding at or above `security_fail_on` (`high` by default). |
| `doc_drift` | `Repowise / doc drift` | A doc the pull request edits carries a claim the code refutes, at high confidence. |

A check that could not evaluate concludes as `not_evaluated` says.

### Checks settings

| Key | Default | Meaning |
|---|---|---|
| `checks_comment` | `on_signal` | When the checks section renders: `off`, `on_signal` or `always`. |
| `coverage` | `show` | Coverage in the comment: `off` or `show`. `check_run` shows it and also runs `Repowise / coverage`. |
| `tests_reach` | `true` | Name the changed files no test reaches when there is no coverage report. |
| `show_security_check` | `true` | Security in the comment. |
| `security_shows_at` | `med` | Lowest severity shown: `high`, `med` or `low`. |
| `doc_drift` | `off` | Doc drift in the comment: `off`, `show`, or a confidence (`high`, `medium`, `low`) at which a refuted claim alone posts the comment. |
| `check_runs` | `[review]` | Check runs: any of `review`, `coverage`, `security`, `doc_drift`. |
| `review_check` | `true` | The `Repowise review` check. `false` turns it off even when `check_runs` lists `review`. |
| `coverage_fail_under` | none | Patch coverage percent below which `Repowise / coverage` fails. Empty reports only. |
| `security_fail_on` | `high` | Lowest severity that fails `Repowise / security`: `high`, `med` or `low`. |
| `not_evaluated` | `neutral` | What a check run concludes when it could not evaluate: `neutral` or `failure`. |

## Keys

The checks keys are in [checks settings](https://docs.repowise.dev/hosted/bot-config#checks-settings) and the merge
gate's on [the merge gate](https://docs.repowise.dev/hosted/bot#the-merge-gate).

| Key | Default | Values and meaning |
|---|---|---|
| `enabled` | `true` | Turns the bot on or off for the repository. |
| `review_mode` | `signals`, or `ai` when a paid plan covers the install | `signals` or `ai`. Dashboard or API. |
| `review_depth` | `deep` | `light`, `auto` or `deep`. Dashboard or API. |
| `review_sensitivity` | `balanced` | `quiet`, `balanced` or `thorough`. |
| `ai_pr_cap_cents` | `60` | AI spend per pull request, in cents. Dashboard or API. |
| `ai_monthly_cap_cents` | `1000` | AI spend per repository per calendar month, in cents. `0` turns AI review off. Dashboard or API. |
| `comment_mode` | `on_signal` | `on_signal` posts only when something fires; `always` posts on every pull request. |
| `verbosity` | `standard` | `compact` (actions, health, gate) or `standard` (adds the evidence table and suggested reviewers). |
| `introduced` | `high` | `off`, `show`, or a severity (`critical`, `high`, `medium`, `low`) at which a new finding posts the comment on its own. |
| `recent_decline` | `show` | Same values. Damage an earlier commit did to a changed file; `show` never posts on its own. |
| `change_risk` | `signal` | `off`, `signal` (pull request page, check and labels) or `comment` (also a line in the comment). |
| `on_lines` | `threads` | See [findings on lines](https://docs.repowise.dev/hosted/bot-config#findings-on-lines). |
| `feedback_decisions` | `auto_accept` | `off`, `propose` or `auto_accept`. See [teach the review](https://docs.repowise.dev/hosted/bot#teach-the-review). |
| `apply_labels` | `false` | See [PR labels](https://docs.repowise.dev/hosted/bot-config#pr-labels). |
| `ignore_paths` | none | Globs the bot skips. |
| `show_summary`, `show_health`, `show_hotspots`, `show_ownership`, `show_coupling`, `show_dead_code`, `show_refactoring`, `show_review_priority`, `show_checklist`, `show_change_map`, `show_declining_alert` | `true` | Show or hide each part of the comment. |
| `show_evidence` | `false` | The folded evidence table. |

## Org policy and repository overrides

**Settings, PR bot, an installation** opens its org policy: the settings every
repository it covers starts from. It offers three presets:

| Preset | Sets |
|---|---|
| **Quiet** | Posts only for critical findings. No pass/fail checks, no merge gate. |
| **Standard** | The bot's defaults: posts for high-severity findings, no pass/fail checks, no merge gate. |
| **Strict gate** | Posts from medium severity, `check_runs: [coverage, security]`, a blocking merge gate, and `not_evaluated: failure`. |

No preset changes the review mode, which is a paid choice of its own. The page
shows how many repositories follow the preset, and can make selected
repositories follow it: after a confirmation naming the repositories and the
settings, it clears their overrides of the preset's keys and leaves the rest.

Each policy row has a **lock**. A locked key wins over the repository's
dashboard settings and its `.repowise/bot.yaml`; the repository's page shows
the row read only. Locking a key the policy does not set pins the value the
repositories have at that moment. The merge gate locks as one key.

A repository's page (**Customise** on the policy, or **Settings** on a
repository row) shows every setting with its value and where it comes from:
**Default**, **Org default**, **Overridden** or **Locked by org**. A change
there overrides the policy for that repository; **Reset** on a row, or
**Reset all to org default**, removes the override. The dashboard cannot see
`.repowise/bot.yaml`, so a value marked Default or Org default may still be
changed by the repository's YAML.

## `.repowise/bot.yaml`

Committed and versioned with the code:

```yaml
bot:
  enabled: true
  comment_mode: on_signal      # or "always" to post a clean bill of health
  verbosity: standard          # compact | standard
  introduced: high             # off | show | critical | high | medium | low
  recent_decline: show         # same values; "show" never posts on its own
  change_risk: signal          # off | signal (PR page) | comment
  on_lines: threads            # off | annotations | threads | both
  apply_labels: false          # opt in to repowise:* PR labels
  ignore_paths:
    - "vendor/**"
    - "**/*.generated.*"
  health_gate:
    mode: advisory             # off | advisory | blocking
    repo_drop_block: 0.3
    min_new_file_score: 7.0
    block_on_introduced: true
    block_at: high
  checks_comment: on_signal    # off | on_signal | always
  check_runs: [review, coverage]  # review | coverage | security | doc_drift
  coverage_fail_under: 80      # percent of changed lines; omit to report only
  not_evaluated: neutral       # neutral | failure
```

## Commands

Comment on a pull request:

| Command | Does |
|---|---|
| `/repowise recheck` | Runs the review again on the current commit. Also reviews a pull request the bot skipped, such as one opened by a bot account. |
| `/repowise review deep` | Runs the AI deep review on the current commit (AI review only). |
| `/repowise remember [path:<glob>] <text>` | Saves a [review preference](https://docs.repowise.dev/hosted/review-preferences) the bot reads on later reviews. Works in review threads too. |
| `/repowise confirm` | In a review thread: accepts the decision saved from it. Needs write access. |
| `/repowise forget` | In a review thread: undoes what was saved from it. Needs write access. |
| `/repowise help` | Lists the commands. |

Put `[skip repowise]`, or a do-not-merge marker such as `DNM`, in a pull
request title to skip it.

### Effort labels

A label sets the review depth for one pull request, over the repository's
`review_depth`:

| Label | That pull request gets |
|---|---|
| `repowise: deep` | Deep review |
| `repowise: light` | Light review |
| `repowise: off` | Signals only, no AI |

A label wins over `/repowise review deep`, the repo setting and the org policy.
When the org policy locks the depth, the bot ignores the labels, and a
`/repowise review deep` comment still runs one deep review. The bot never
creates the labels: type one in GitHub's label picker, which offers to create
it the first time, or run `gh label create`. Adding `repowise: deep` or
`repowise: light` runs the review again on the current commit. The `gh`
commands for an agent and how to read what ran are in
[the setup runbook](https://docs.repowise.dev/hosted/bot-setup#one-pull-request-at-a-different-depth).

## PR labels

With `apply_labels: true` the bot also applies `repowise:*` labels, created on
demand and reconciled on every run: a label is removed once its signal clears,
and labels outside the `repowise:` namespace are never touched.

| Label | Applied when |
| --- | --- |
| `repowise:gate-failed` | A blocking gate you configured tripped |
| `repowise:risk-high` | Top tercile of this repository's own commit-risk distribution |
| `repowise:missing-tests` | A file with recent fix history changed, and no test that imports it was touched |
| `repowise:size-xl` | Too large for granular analysis |

They are off by default, and the list is short on purpose. A label is public
in the pull request list and reads as a verdict on the author, so it is kept
for rare signals. Signals that fire on ordinary work (a dipped score, a
touched hotspot, a mid-sized diff) stay in the comment, with their context.

## Next
- [PR bot](https://docs.repowise.dev/hosted/bot) explains the review check, the comment and the merge gate.
- [Set up the PR bot (for agents)](https://docs.repowise.dev/hosted/bot-setup) sets AI review and limits through the API.
- [Review preferences](https://docs.repowise.dev/hosted/review-preferences) tells the review what to skip by path or rule.
