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
reviewskill. 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
- Link the repository to a factory. See Connect a repository.
- Build items with a runner. Only a runner runs a judge, so an item built in a local session shows no row for the judge. See Run work on your machines.
Add your first judge
-
Create
.outerlayer/judges/migrations.mdwith this content: - Merge the file to the base branch. OuterLayer reads judge files from there, or from the control plane when the factory has one.
- Build a work item with a runner. The runner runs the judge after the build succeeds.
- 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-reviewandacceptance-criteria. Code review and the criteria judge record their results under them.artifact,criteria,demo,finding,findingsandstep. The gateway refuses a result under them.
--- 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.
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 nofor_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:
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 answerspass 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.
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:
- Open the item’s Judges tab. The row reads Inconclusive and gives the reason.
- Choose Accept result…. You need the permission to review the item.
- Write why you accept the result, and choose Accept result.
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:- Open the item’s Judges tab. The row reads fail.
- Choose Overrule result…. You need the permission to review the item.
- Write why the result is wrong, and choose Overrule result.
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 nowhen, 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:
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’swhen 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
pathsandrepositories, 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. Soissue.typealone never stops a judge from running. The judge still shows no row when the type does not match.
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. Userepositories when a judge applies to only some of them:
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:
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 setrequired: true:
- Keep
required: falsewhile the judge runs on a few items. Include items that must pass and items that must fail. - Check each result by hand. Overrule each wrong fail, so the record counts it.
- Count the wrong passes and the wrong fails as two separate numbers.
- Change the instructions where the judge was wrong. The next build or amend of an item runs the judge again.
- Read the judge’s record in Settings, under Judges. Set
required: truewhen members overruled few of its fails.
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.