.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
Theagents 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.
To define entirely new agents with custom prompts, use the
customAgents array. See Custom agents below.Custom agents
You can define custom agents using thecustomAgents array. Custom agents run in parallel alongside the built-in agents and follow the same output schema.
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
Therules object controls which files are reviewed and when reviews are triggered.
UX
Theux 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
TheagentReview 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
Thepricing 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.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
.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 arisky 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
riskyarea caps the blast-radius rating and holds the whole score at or below theriskyband; acautionarea does the same atcaution. 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,cautionorrisky),sha(the full 40-character head SHA the score describes) andareas(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.
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
.mergewatch.yml
name, and its level and notes are guidance rather than a cap:
.mergewatch.yml
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,cautionorrisky(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
Withlabel: 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
enabledorlabeloff, or itssafetyScoreblock is invalid (which turns the score off).
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 most1 + 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:
model:in this file — the per-repo setting documented above. The committed.mergewatch.ymlalways wins, consistent with every other key on this page.- An installation-level override, if one has been set on the repository’s installation record.
- The deployment default, set per environment at deploy time.
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
Common patterns
Security-focused pipeline (e.g., payments service)
Security-focused pipeline (e.g., payments service)
.mergewatch.yml
Lightweight pipeline for high-volume repos
Lightweight pipeline for high-volume repos
.mergewatch.yml
Style-heavy pipeline for a frontend repo
Style-heavy pipeline for a frontend repo
.mergewatch.yml
Monorepo with service boundaries
Monorepo with service boundaries
.mergewatch.yml
Review only on mention
Review only on mention
.mergewatch.yml
@mergewatch review on the PR.Ignore generated code and vendored dependencies
Ignore generated code and vendored dependencies
.mergewatch.yml
Django/Python backend
Django/Python backend
.mergewatch.yml
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.
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.