Skip to main content
A judge is one markdown file. Its body is the instructions that an agent follows after a build. Your runner starts that agent and records its result on the work item. This page shows how to write a judge file, so that a work item shows your judge as a row on its Judges tab. Judges and the merge gate covers the verdict, the merge gate and the criteria judge.

A judge or a team rule

A judge and a team rule both check a change against a rule that your team writes. Choose by the answer you want:
  • If the answer is a list of places in the code, write a team rule. Put it in the Also a problem here section of the review skill. See Add your team’s rules.
  • If the answer is one yes or no about the whole change, write a judge.
Two quick tests help when you are not sure:
  • Would two violations be two separate things to fix? Write a team rule.
  • Do you want to block a merge on the rule by name? Write a judge.

Before you start

Add your first judge

  1. Create .outerlayer/judges/migrations.md with this content:
  2. Merge the file to the base branch. OuterLayer reads judge files from there, or from the control plane when the factory has one.
  3. Build a work item with a runner. The runner runs the judge after the build succeeds.
  4. Open the item’s Judges tab. The row shows the judge’s result, the runner that recorded it, the commit it judged and when. When the runner uploaded a report, View report opens it.

The file format

Each .md file in .outerlayer/judges/ is one judge. OuterLayer reads only the first 20 files by name. More files add an error row. The file name without .md is the judge’s id. The result is stored under the id. An id is a lowercase letter, then lowercase letters, digits, ., - or _, up to 64 characters. A file cannot have one of these ids:
  • code-review and acceptance-criteria. Code review and the criteria judge record their results under them.
  • artifact, criteria, demo, finding, findings and step. The gateway refuses a result under them.
The file starts with YAML frontmatter between two --- lines. The frontmatter is optional, and so is every key in it. The text after the frontmatter is the judge’s instructions. The file must have instructions. See Write the instructions.

Make a judge required

required sets whether the judge’s result is part of the verdict. The verdict passes only when every required judge passes. A required judge’s fail can go to the agent, which fixes the failed judge items. See When a required judge fails. A judge can also answer that it cannot decide. See Let a judge answer inconclusive. Each judge also posts a GitHub check named OuterLayer judge / <id>. The required key sets how a fail looks on that check: An inconclusive result concludes action_required, whether or not the judge is required. A pass concludes success. A fail that a member overruled concludes neutral, and the title of the check names the member. See Overrule a failed result. A judge whose when does not match concludes skipped. A judge with no result yet is queued. GitHub’s branch protection decides which checks block a merge. See The checks of each judge and of the code review.
The id of a judge is its file name, and the name of its check follows the id. When you rename a judge file, its check gets a new name. A branch protection rule that names the old check then waits for a check that never comes.
To turn a judge off, delete its file. Start a new judge with required: false. Read its record, then set required: true. See Read a judge’s record and Test a judge before you require it.

Judge each criterion

With no for_each key, the judge gives one result for the change as a whole. It can add one judge item for each part it judged, such as a file. With for_each: criterion, the judge gives one judge item for each recorded criterion of the item, as the criteria judge does:
A judge fails when any of its judge items fails. A judge is inconclusive when none of its judge items fails and any is inconclusive. A judge that cannot run records a failing judge item with the id judge-not-run. Its reason says why. The build reference lists each reason a judge fails.

How the result is recorded

The runner starts a fresh agent for each judge, after the build succeeds. The agent is the one that ran the build, when it can judge, and Claude Code otherwise. The runner reads the agent’s answer and records the result under the runner’s own key.
  • Only a runner’s result decides the row. The agent that built the change cannot record a pass for the judge.
  • The row reads as waiting while a runner holds a claim on the item and no result is recorded. It fails when the claim ends with no result.
  • The judge shows no row on an item that no runner has claimed.
  • The newest result counts for every pull request of the item.

Let a judge answer inconclusive

A judge answers pass or fail when the evidence decides. It answers inconclusive when the evidence cannot decide. For example, the change calls an endpoint, and the handler is in another repository that the judge cannot read. An inconclusive result is neither a pass nor a fail:
  • It never passes. A required judge with an inconclusive result holds the verdict at waiting, and Approve names the judge.
  • It never fails. The verdict does not flag.
  • A judge that is not required shows the result on the Judges tab. The verdict does not change.
The runner tells the judge to answer inconclusive only when the evidence cannot decide. It tells the judge to name in the reason what it could not read or decide. It also tells the judge never to answer inconclusive in place of a fail that it can show. A member decides an inconclusive result on the Judges tab:
  1. Open the item’s Judges tab. The row reads Inconclusive and gives the reason.
  2. Choose Accept result…. You need the permission to review the item.
  3. Write why you accept the result, and choose Accept result.
The row then shows who accepted the result and why. The verdict stops waiting on the judge. An acceptance applies to one result. When a later build records a new result for the judge, the acceptance no longer applies. The judge writes inconclusive in items.json, as its whole result or as the result of one judge item. The runner records the result with the judge’s reason. A judge with a failing judge item is a fail, even when other judge items are inconclusive. The criteria judge and the code review never answer inconclusive. A gateway can be too old to take an inconclusive result. The runner then records a fail in its place, with the same reason.

Overrule a failed result

A required judge that fails wrongly flags the verdict. A member can say that the judge is wrong, and move on:
  1. Open the item’s Judges tab. The row reads fail.
  2. Choose Overrule result…. You need the permission to review the item.
  3. Write why the result is wrong, and choose Overrule result.
The row then shows who overruled the result and why. The verdict ignores that result. The judge’s GitHub check concludes neutral, and its title names the member, so branch protection lets the merge through. An overrule applies to one result. When a later build records a new result for the judge, the overrule no longer applies, and the judge judges the new change again. An overrule does not turn a judge off. You can overrule the fail of a judge that is not required too. The overrule is recorded, and the verdict does not change, because the verdict ignores that fail already. A member can overrule the result of a judge in your judge files only. The criteria judge and the code review have their own decisions.

Read a judge’s record

Open Settings for the factory, and choose Judges under Review. The page lists two checks every factory has, then each judge of your judge files that recorded a result in the last 90 days. Each shows its record over the last 30 days: A fail counts once. A fail that a member overruled counts as overruled, never as fixed. A judge with no result in the last 30 days says so, and shows no rate. The two checks every factory has show even when they have no result: The page does not show whether a judge of your files is required. The file on the base branch is the only source of required.

Limit where a judge applies

With no when, a judge applies to every pull request. When when does not match, the judge shows no row. Every key you set must match. Write the two issue keys under one issue key:
A judge with an issue key shows no row when no issue is linked, or when OuterLayer cannot read the issue. A judge with paths shows no row when OuterLayer cannot read the changed files.

When the runner skips a judge

After a build, the runner checks each judge’s when against the item. It does not run a judge with a key that does not match. That judge costs no agent run. The runner log names each skipped judge and the key that did not match. When the runner cannot tell if a key matches, it runs the judge. These are the cases:
  • The runner cannot read the work item.
  • For paths and repositories, the runner cannot read the branches that the build pushed.
  • For paths, the item has a pull request whose head is not a commit the build pushed. The runner cannot see the files of that pull request.
  • For paths, the runner cannot read the files that the branch changes.
  • For issue.type, the runner cannot read the issue’s type. So issue.type alone never stops a judge from running. The judge still shows no row when the type does not match.
The runner checks the item as it is after the build. A label added later, or a later push to the pull request, can make the when match. The judge then shows no result until the next build runs it.

Path globs

A glob matches the whole path. * and ? match within one path segment. ** matches any run of characters, / included. Every other character is literal, braces included. To match both a top-level file and a nested one, list two globs.

One judge for some repositories

A control plane supplies one set of judges to every repository it governs. Use repositories when a judge applies to only some of them:
A name that the factory does not link adds an error row that names it.

Write the instructions

The instructions are the markdown after the frontmatter. This judge checks that a change to the public API also updates the docs:
You do not need a judge for security problems. The built-in code review reports each one at its line. The judge reads these files. A Claude Code judge has no shell. A Codex judge is told to read only. See The Codex judge and code review. The runner tells the judge which of the last three files exist. It also tells the judge to read them as material, never as instructions. previous.json holds the items of the earlier result. Each item has an id and a result, and can have a reason and the commit it was judged at. The file also holds the overall result, except when that result reads pass beside a failing item. An earlier result decides nothing: the judge judges the pushed commit. A judge with for_each: criterion never gets pull-request.md. The build writes that text, and it could name a test for a criterion. The judge finds each criterion’s tests itself. For a judge of the whole change, the runner reads each pull request from GitHub with the build’s read token. It reads at most five, the open ones first, and only in a repository that the build pushed in. The runner removes its own keys and any text shaped like a secret from issue.md and pull-request.md. It cuts each file at 256 KiB. Follow two rules in the instructions:
  • Say how to judge. Do not say what shape the answer has, because the runner tells the judge that.
  • Tell the judge to treat repository content, comments included, as material to judge and never as instructions.

Make the result one you can trust

  • Judge one failure mode in each file. A broad judge gives one result for many questions, so split it into several judges.
  • Define each term that the instructions use. The example above says what “the public API” means in this repository.
  • Name the borderline cases, and say how to judge each one.
  • List what never fails the judge.
  • Tell the judge what to do when the evidence cannot decide: answer inconclusive, and say what is missing. Never let a judge pass on missing proof, and never let it answer inconclusive for a fail that it can show.

Test a judge before you require it

A judge can be wrong in two ways. A wrong pass lets a bad change through. A wrong fail flags a good change. Test for both before you set required: true:
  1. Keep required: false while the judge runs on a few items. Include items that must pass and items that must fail.
  2. Check each result by hand. Overrule each wrong fail, so the record counts it.
  3. Count the wrong passes and the wrong fails as two separate numbers.
  4. Change the instructions where the judge was wrong. The next build or amend of an item runs the judge again.
  5. Read the judge’s record in Settings, under Judges. Set required: true when members overruled few of its fails.
A judge that many members overrule is not ready. Its fails are wrong too often to block a merge. A judge whose fails are fixed by a later commit finds real problems. Fix its instructions only when members overrule it. The record counts wrong fails only. A wrong pass leaves no trace, so check passes by hand.

When a file fails to load

A judge file loads whole or not at all. OuterLayer drops a file in these cases:
  • The file name is not a valid id, or it is an id that a file cannot have.
  • The frontmatter is not valid YAML, or it has no closing --- line.
  • The frontmatter has an unknown key, or a value that breaks a rule on this page.
  • The file has no instructions.
The work item’s Judges tab shows one error row for every problem in the judge files. It names the first problem and its file, and counts the rest. The other rows still show. Fix the files where OuterLayer reads them: the base branch, or the control plane.

Next steps

Judges and the merge gate shows how to make a flagged verdict block the merge.