Skip to main content
The .mergewatch.yml file controls how MergeWatch reviews pull requests in a repository. Place it at the root of your repository’s default branch (usually main).

Configuration priority

MergeWatch resolves configuration in the following order. Each layer overrides the one before it:
1

Built-in defaults

Hardcoded in the MergeWatch Lambda. These apply when no other configuration is present.
2

Installation-level settings (DynamoDB)

Set via the dashboard. Apply to all repositories in the installation.
3

Per-repo .mergewatch.yml

Checked into the repository. Overrides both built-in defaults and installation-level settings.
A .mergewatch.yml in the repository always wins. If you set maxFiles: 100 in the dashboard but maxFiles: 20 in the YAML file, the repo uses 20.

Validation

MergeWatch validates the .mergewatch.yml file on the first webhook it receives for the repository. If the file contains errors — invalid YAML, unknown properties, or type mismatches — MergeWatch posts the validation errors as a comment on the pull request so they are immediately visible to the author.

Full annotated example

.mergewatch.yml

Property reference

Top-level properties

Agents

The agents object is a boolean map that toggles each of the eight built-in review agents on or off. Set an agent to false to disable it entirely.
You do not need to list all agents. Omitted agents default to true (enabled). To disable a single agent, include only that agent with false.
To define entirely new agents with custom prompts, use the customAgents array. See Custom agents below.
Built-in agents:

Custom agents

You can define custom agents using the customAgents array. Custom agents run in parallel alongside the built-in agents and follow the same output schema.
A critical finding from a repo custom agent fails the MergeWatch check run, like a critical from a built-in agent. Repo agents have no advisory mode; to report without gating, set severityDefault below critical. Findings from repo agents are not sent to the verifier. A repo agent that fails to answer (the model call errors, or the reply is not usable) also fails the check, titled Custom agent failed: <name>, because its rule was not evaluated. See When an agent fails.

Rules

The rules object controls which files are reviewed and when reviews are triggered.
rules.ignorePatterns is deprecated. Use top-level excludePatterns instead — it is the canonical field for filtering files out of the diff. Existing .mergewatch.yml files keep working: any entries under rules.ignorePatterns are folded into excludePatterns at parse time and a one-time deprecation warning is emitted.

UX

The ux object controls how the review comment is formatted and what sections are shown. Tone directives:

Path filters

MergeWatch has two top-level path-filter fields. They operate at different layers — see Skip Rules for the full picture.
.mergewatch.yml

Agent-authored PRs

The agentReview object controls how MergeWatch handles pull requests authored by coding agents (Claude Code, Cursor, Codex, etc.). When detection matches, the review pipeline applies stricter prompts and tracks how many iterations the agent took to reach a passing state.
.mergewatch.yml

Pricing overrides

The pricing field maps a model ID to its per-token price (USD per 1M tokens) and is used by the cost-estimation pipeline. Set it when you run a model that is not in MergeWatch’s built-in price table — for example, a self-hosted Llama on Ollama or a custom Bedrock provisioned-throughput endpoint.
.mergewatch.yml

Safety score

An optional, advisory rating of how risky a pull request is to deploy: not whether its code is correct (that is the merge score), but how much it would hurt if something in it is wrong. Off by default.
safetyScore is read only from the .mergewatch.yml on your default branch, unlike every other key on this page. A pull request that edits safetyScore in its own branch cannot change its own score, remove its own risky areas, or turn the score off. Change it by merging to the default branch.

What it is

When enabled, each review makes one extra safety-agent call. It rates five factors from 1 to 5: blast radius, change size, testing, error monitoring and rollback. MergeWatch combines them into a score from 1 to 100 and a band: safe, caution or risky. The score appears in the review comment, under the merge score. It never changes the review event, the check run or the merge gate. The two scores answer different questions: Turning it on. Set enabled: true on the default branch, or use the Safety score toggle in the dashboard settings. Where the default-branch .mergewatch.yml sets safetyScore.enabled, it wins over the toggle; where it does not, the toggle applies.

Reference

Every key is optional. This block is the full reference, with every key set:
.mergewatch.yml
The defaults, written out in full. These are what apply when a key is omitted:
.mergewatch.yml
Factor names are blastRadius, changeSize, testing, errorMonitoring and rollback. Bands, emoji and each factor merge key by key with the defaults; areas and notes replace them. Invalid config turns the score off. An unknown key, an out-of-range value or a broken rule disables the safety score for every review until it is fixed. The review comment then shows one line naming each problem by its path, for example safetyScore.bands: risky (80) must be below caution (67). The rest of the review is unaffected.

Reading the comment

For a migration in a risky area, the safety section reads:
  • The band line shows the score and band. When a matched area’s level lowered it, it says so: — capped at {score} by {area} (was {score before}).
  • A matched area’s level caps and clamps. A risky area caps the blast-radius rating and holds the whole score at or below the risky band; a caution area does the same at caution. A level never raises a score.
  • Factors are always listed in the same order, each with its band and one sentence from the agent.
  • Applied lists every area whose patterns matched a changed file (with its level and patterns), every pattern-less area the agent judged relevant, and every global note it applied.
  • Concerns lists at most two specific ways the change could go wrong in production.
  • When the comment is too long for GitHub, the factor detail can be dropped (after the diagram and the work-done stats); the band line and the data line always stay.

mw-safety data line

The hidden line under the band line is for other tools (labels, dashboards, bots):
  • Keys appear in that order: score (1–100), band (safe, caution or risky), sha (the full 40-character head SHA the score describes) and areas (the display names of every area that applied, unescaped; [] when none).
  • < and > are written as < and >, which is still valid JSON, so an area name cannot close the comment.
  • Each review comment carries exactly one line, and it moves to the new head SHA on every push.
From TypeScript, parseSafetyPayload(commentBody) in @mergewatch/core does the same and returns null for a missing or malformed line.

Writing areas

An area tells the agent what matters in your repository. There are three shapes. A named business flow, matched by file pattern:
.mergewatch.yml
A file type, where the pattern is the name:
.mergewatch.yml
A pattern-less area, which the agent judges from the diff. It needs a name, and its level and notes are guidance rather than a cap:
.mergewatch.yml
Org-wide areas. Organization admins can also define areas on the dashboard’s Safety Areas tab. They apply to every in-scope repository in addition to its own areas, and the riskiest matching level wins, so a repository can add areas but never weaken an org one. A matched org area is marked (org) in the comment. Uncovered folders. When at least one area has patterns, the safety section also lists every new top-level folder the pull request adds that no area pattern covers, for example - Uncovered: `edge/`, `payments/` are new top-level folders no area covers. (sorted, at most five, then (+N more)) A folder is new when it is not a directory at the base branch’s root. Dot-folders and files excluded by excludePatterns are ignored. The line is a prompt to add an area; it never changes the score. It costs one extra GitHub API call per review and no model call. Patterns are globs matched against every changed file’s path, including dot-files and dot-directories. A file excluded by excludePatterns or maxFileDiffKB is not matched, and neither is a pure rename out of an area (the diff names only the new path).

Telling MergeWatch it got the band wrong

Reply on the pull request with a line of its own:
  • The band is safe, caution or risky (any case), optionally followed by a reason (at most 500 characters kept).
  • The vote is recorded on the pull request’s latest safety-scored review, with your GitHub login and the time. A later vote from the same person supersedes their earlier one; nothing is overwritten in storage.
  • MergeWatch reacts 👍 to your comment when the vote is recorded, and 😕 when there is no safety-scored review to record it on (the score is off, or the pull request was never scored).
  • It never triggers a review or a model call, and it never changes the score, the comment or the check. A comment with this line is handled only as feedback, even if it also says @mergewatch review.
  • Anything else after @mergewatch safety (for example @mergewatch safety why so risky?) is an ordinary question to MergeWatch.
  • Only the pull request’s 50 most recently reviewed commits are searched for the latest scored review.

Safety labels

With label: true, MergeWatch keeps exactly one safety:<band> label on the pull request, matching the latest reviewed commit. It creates the three labels in the repository on first use (safety:safe green, safety:caution amber, safety:risky red), swaps them as the band changes, and never touches any other label. When the safety agent could not score a commit, the safety:* label is removed rather than left showing an older commit’s band. The label is left as it was when:
  • the review was skipped (for example a docs-only change), so no score was computed;
  • the default branch has since turned enabled or label off, or its safetyScore block is invalid (which turns the score off).
Adding a label never starts a review. Do not list safety:* labels in rules.ignoreLabels: the label MergeWatch adds would then skip every later review of that pull request. If two MergeWatch Apps are installed on the same repository, each keeps its own band and the label can flip between them. The label needs the App’s Pull requests: write permission, which it already has.

Cost

One safety-agent call per review on the primary model, plus one more for each round in which the agent asks to open files (for example, tests), when codebase awareness is on. That is at most 1 + maxFileRequestRounds calls. The calls are included in the review’s reported cost. When the safety score is disabled, it costs nothing.

Which model actually runs

model: is resolved against two other sources. Highest precedence first:
  1. model: in this file — the per-repo setting documented above. The committed .mergewatch.yml always wins, consistent with every other key on this page.
  2. An installation-level override, if one has been set on the repository’s installation record.
  3. The deployment default, set per environment at deploy time.
Self-hosted differs in one respect: the LLM_MODEL environment variable is an operator pin rather than a default, so it overrides everything above — including this file. Omitting model: therefore means “use whatever this deployment is configured with”, not “use the value shown in the table above” — which is why the Default column reads (deployment default) rather than naming a model. The review log line records which source won:
Before MergeWatch v0.1.x, model: was silently ignored on the hosted service — the deployment default was used regardless of what this file said. Self-hosted always honored it. If you set model: and saw no change, that was why; it now works on both.

Minimal configuration

If the defaults work for you, the smallest valid configuration is:
.mergewatch.yml
This enables all eight built-in agents with their default prompts, uses Claude Sonnet via Bedrock, and reviews PRs automatically.

Common patterns

.mergewatch.yml
Disables style and diagram agents. A custom agent adds domain-specific security checks for payments services.
.mergewatch.yml
Uses the cheaper Haiku model, disables low-priority agents, and suppresses info-level findings. Good for repos with frequent small PRs where speed and cost matter more than comprehensive review.
.mergewatch.yml
Custom agents add React/TypeScript conventions and frontend-specific security checks alongside the built-in agents.
.mergewatch.yml
Custom agents enforce architectural boundaries. All built-in agents remain enabled.
.mergewatch.yml
MergeWatch stays silent until someone comments @mergewatch review on the PR.
.mergewatch.yml
.mergewatch.yml
Three custom agents with Django-specific prompts alongside the built-in agents.

Where the file lives

The .mergewatch.yml file must be placed at the root of the repository’s default branch (the branch GitHub shows when you visit the repo — usually main or master). MergeWatch reads the file at the PR’s head commit, so a configuration change made in a PR applies to that PR’s own review. The exception is approve, which is read only from the default branch, so a PR cannot approve itself.
If you rename your default branch, MergeWatch automatically detects the new default on the next webhook. No action is required.

maxFileDiffKB

Maximum size, in KB, of a single file’s diff section. Default 128. A file whose diff exceeds this is dropped from review even if no excludePatterns entry matches it. excludePatterns only catches artifacts you have already met. This catches the next one: a hand-written source file with a 128KB+ diff essentially does not exist, so a section that large is generated, vendored, or minified. Dropped files are always reported in the logs, distinctly from pattern exclusions — a pattern match is your intent, a size drop is MergeWatch’s.
Related: MergeWatch also refuses to review a diff that would exceed the configured model’s context window, posting a neutral “Review skipped — diff too large” check that names the estimated size, the budget, and the model. Previously such a PR failed with a raw provider error.