# Configure reviews

> Control when MergeHarbor reviews, what it comments on, how strict it is, and how results gate merges, for the organization, per repository and in YAML.

## How settings combine

Settings are layered. Each layer overrides only the fields it sets, lowest precedence first:

1. **Defaults** provided by MergeHarbor.
2. **Organization settings** — console, **Settings → Review behaviour**.
3. **Repository overrides** — console, **Repositories → a repository → Settings**.
4. **Root configuration** — `.mergeharbor.yml`, then `.mergeharbor/config.yml` at the repository root.
5. **`.mergeharbor/` directories** deeper in the repository — the closest one to each changed file wins. See [Repository configuration](https://mergeharbor.com/docs/repository-config).

Configuration files are read from the pull request's **merge base**, so a pull request cannot change how it is reviewed; edits take effect after they merge. Organization admins can **lock** settings so that repositories cannot change them. **Repositories → Configuration files** in the console shows the effective value for any path and where it came from.

Problems in configuration files never block a review. The invalid key or file is skipped and listed, with file and line, in the **Configuration check** section of the review summary.

## `.mergeharbor.yml` reference

```yaml
version: 1
review:
  # When automatic reviews run: never | opened | pushes | all
  #   opened - pull request opened, reopened, or marked ready for review
  #   pushes - opened, plus every new commit
  #   all    - pushes, plus title, description, and label edits
  trigger: all
  review_drafts: false

  # Review only pull requests that match ALL conditions of ANY rule.
  # field: author | label | base_branch | head_branch | path | title | files_changed | lines_changed
  # op: include | exclude (gt | lt for files_changed and lines_changed). Branch and path values are globs.
  filters:
    - conditions:
        - { field: author, op: exclude, values: ["dependabot[bot]", "renovate[bot]"] }
        - { field: path, op: exclude, values: ["docs/**", "*.md"] }
        - { field: lines_changed, op: lt, values: ["5000"] }

  # How much review each pull request gets and its credits: standard (1) | deep (3) | max (10) | auto
  # See Review tiers and credits.
  tier: standard
  tier_rules:
    - name: Release branches
      conditions: [{ field: base_branch, op: include, values: ["release/*"] }]
      tier: max
  depth: standard # how far a Standard review looks: quick | standard | deep (no change in credits)
  reactions:
    enabled: true # eyes while reviewing, thumbs up when posted, confused on failure (GitHub and GitLab)
  strictness: medium # low | medium | high
  instructions: |
    Every database query must filter by org_id.
  categories: [correctness, security, concurrency, performance, error_handling, api_contract, data_integrity, maintainability, testing] # add style to receive style comments
  min_severity: minor # critical | major | minor | nit
  max_comments: 25 # inline comments; additional findings go to the summary
  ignore_paths: ["gen/**", "**/*.pb.go"]
  verify_findings: true # a second pass that tries to disprove each finding
  early_findings: true # post serious, high-confidence findings before the full review

  summary:
    include_summary: true
    include_confidence: true
    include_findings: true
    include_sequence_diagram: false # one diagram per review, picked from the change (see Diagrams)
    diagram_types: [entity_relation, class, sequence, flow]
    collapsible: true
    update_description: false

  comments:
    header: ""
    include_fix_prompt: true # a collapsed prompt for coding agents
  coding_agents: [claude_code, cursor] # claude_code, cursor, codex, copilot, windsurf, devin, conductor
  fix:
    links: badges # one-click "Send to <agent>" buttons: badges | text | off
    fix_all: true # a hand-off line for all open findings in the summary
    default_agent: claude_code
    auto_resolve: true # mark findings resolved when a push fixes them
    resolve_threads: true # resolve the code-host thread too (or reply "Resolved in <sha>")

  status_check:
    enabled: true
    min_confidence_to_pass: 0 # fail when the score is below this value (0 disables)
    fail_on_severity: null # critical | major
    post_error_comments: true

  auto_approve:
    enabled: false # approve pull requests that score 5 with nothing above a nit

  merge_gate: # the safe-to-merge check; see the merge gate page
    enabled: true
    mode: advisory # advisory (default) | enforce
    preset: standard # relaxed | standard | strict | regulated
    rules: # change any check of the preset
      min_confidence: 3 # lowest review confidence that passes (0 = off)
      block_severity: critical # critical | major | minor | none
      warn_severity: major
      proven_findings: block # block | warn | off
      proof_run: "off"
      requirements: warn
      min_coverage: 50 # percent of changed lines
      coverage: warn
      test_gaps: warn
      max_risk: high # low | medium | high | critical
      risk: warn
      required_approvals: 0
      policy: warn # team-rule violations and configuration errors
    branches: # first matching target branch wins
      - pattern: main
        preset: strict
    overrides:
      allowed: true
security: # root file only: which dependency files the vulnerability inventory reads
  paths:
    include: ["examples/payments/**"] # read even where the defaults skip (wins over exclude)
    exclude: ["legacy/**"] # never read
    scan_examples_and_tests: false # read test fixtures, examples and docs like your own code
```

Keys can also be written at the top level, without `review:`. `security:` is read only from the root `.mergeharbor.yml`.

## Bot pull requests

New and existing organizations skip automatic reviews of pull requests opened by Dependabot, Renovate, pre-commit.ci, GitHub Actions and All Contributors. This is the first filter rule, and it is shown as **Skip pull requests from bots** in **Settings → Review behaviour**. Turn it off there to review bot pull requests too. Mentioning `@mergeharbor` reviews a bot pull request either way.

## Diagrams

With `include_sequence_diagram: true` (the name predates the other types), each review summary can carry one Mermaid diagram. MergeHarbor picks the type from the change before calling a model, taking the first that fits from `diagram_types`:

| Type              | Drawn when                                                              |
| ----------------- | ----------------------------------------------------------------------- |
| `entity_relation` | schema or migration files change (`migrations/`, `*.sql`, `*.prisma`)   |
| `class`           | classes, structs or interfaces change, or what they extend or implement |
| `sequence`        | calls across services or API boundaries change                          |
| `flow`            | branching logic inside a function changes                               |

Small changes, and changes that fit none of these, get no diagram and cost nothing extra. Every diagram is checked before it is posted; if it would not render, the review is posted without it.

You can also draw a diagram of any pull request from its page in the console: in the **Diagram** card, keep **Best fit** or pick a type, then **Draw**. Anyone who can review the pull request can do this, up to six times an hour per pull request.

## Other files MergeHarbor reads

`CLAUDE.md`, `AGENTS.md`, `.cursorrules`, `.github/copilot-instructions.md`, and `.cursor/rules/*` are read from the merge base and treated as team guidance.

## Commands in pull requests

| Comment                        | Effect                                                                                                                 |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `@mergeharbor review`          | Review the pull request again at its current head                                                                      |
| `@mergeharbor review max`      | Review it at a higher tier this once: `standard`, `deep` or `max` (see [Review tiers and credits](https://mergeharbor.com/docs/review-tiers)) |
| `@mergeharbor remember <rule>` | Add a rule for this repository (see [Rules and learning](https://mergeharbor.com/docs/rules))                                                 |
| `@mergeharbor test`            | Start a proof run (see [Proof runs](https://mergeharbor.com/docs/proof-runs))                                                                 |
| `@mergeharbor fix`             | Reply with a link that applies the open suggestions as a fix pull request (GitHub)                                     |

Commands work in pull request comments on GitHub, GitLab, Bitbucket Cloud, Bitbucket Data Center, Azure DevOps and Gitea. On every host except GitHub you can also leave out the `@`: a comment or line that starts with `mergeharbor review`, `mergeharbor remember …`, `mergeharbor test` or `mergeharbor fix` is a command too. This helps where the editor turns `@` into a people picker, as Bitbucket's does. Questions still need the `@mergeharbor` mention.

`@mergeharbor review` and **Re-review** in the console review every file again, even files whose result MergeHarbor would otherwise reuse from an earlier review of the same change.
