Invariants
An invariant is a team-defined rule that Verify applies to every matching change. Where user-supplied acceptance criteria describe what this change should do, invariants describe what every change should respect. They live in your Aviator account and update once for everyone.
A good invariant captures something your team learned the hard way — usually as a recurring review comment — so reviewers don't have to flag it again.
Where invariants come from
Invariants live in a per-account catalog. Each invariant has a source:
Manual
Written by hand on the Invariants page. Anyone on the account can create one.
Template
Instantiated from Aviator's starter library — common patterns you can adopt as-is or tweak.
AI-generated
AI-drafted from signals about the repo, awaiting approval.
AI from docs
Extracted from your repo's CONTRIBUTING.md, LLM.md, or similar files by the docs pipeline.
AI from PR comments
Mined from your team's recurring PR-review comments. Often the highest-yield source — it captures real-world feedback your team has already given.
Slack
Drafted on request from a @Aviator invariant command in Slack.
GitHub comment
Drafted on request from a @aviator invariant comment on a pull request.
Sources that aren't manual produce drafts. The invariant's owner team, a maintainer, or an admin promotes drafts to active in the UI; that's when they start producing verdicts.
Creating invariants from Slack
Mention the Aviator Slack app in a channel, or DM it, with @Aviator invariant [repo-name] <rule description>; when used inside a thread, the thread's messages become context for the draft, and naming a repository scopes the invariant to it (otherwise it applies account-wide). Aviator replies in the thread with the draft titles and a link to review and approve them.

Creating invariants from a GitHub comment
Include @aviator invariant in any pull request comment (a regular comment, an inline review comment, or a review body) and Aviator acknowledges with a 👍 reaction, then drafts invariants from the comment and its surrounding discussion. The commenter's GitHub account needs to be connected to Aviator, otherwise the comment is ignored; Aviator replies on the pull request with the draft titles and a link to review and approve them.

Owner teams
Every invariant has an owner team, the GitHub team responsible for it. Aviator picks it when the invariant is created, and you can change it later. An invariant without a team of its own is owned by the account's default owner team, and with neither it's unowned. Open an invariant to see who owns it. You can filter both invariant pages by Owner team, including My teams for the teams you're directly on.
Create an invariant
Anyone on the account
Approve, reject, edit, enable or disable, delete, change the owner
Direct members of the owner team, and Aviator maintainers and admins
Set the default owner team
Admins
Team membership only counts once your GitHub account is connected to Aviator.
How the owner is picked
Aviator looks at the people behind the invariant and picks the team most of them are directly on. Which people count depends on where the invariant came from:
Manual
The person who created it.
AI from docs
The admin who started the docs extraction.
Slack
The person who ran @Aviator invariant.
GitHub comment
The person who wrote the @aviator invariant comment.
AI from PR comments
The pull request authors, and anyone who commented or left a written review.
If nobody behind the invariant is on a team, it gets no team of its own, so you may not be able to edit an invariant you created.
Changing the owner
The Owner field on the invariant's edit page is a team picker. Anyone who can edit the invariant can hand it to another team, or pick Use the default owner team to drop its own team and fall back to the default. If no default owner team is set, that option reads Remove owner team and leaves the invariant unowned. Once you pick a team, only its members, maintainers, and admins can edit the invariant.
Default owner team
Admins can set a Default invariant owner team in Verify → Settings → Verify. It owns every invariant that didn't get a team of its own, across all repositories. Changing the default immediately re-owns every invariant without a team, including ones created before you set it. Invariants with a team of their own keep it.
Conditions
Each invariant has zero or more conditions that gate when it's eligible to apply:
file_path_glob
Files changed in the review match a glob like src/**/*.py.
language
The detected language of changed files matches.
An invariant with no conditions is eligible for every review. With conditions, it's eligible when at least one changed file satisfies them. See Invariant conditions for the exact matching rules and examples.
Eligibility doesn't mean the invariant applies — it just means the next step (selection) will consider it.
Categories
Every invariant belongs to a category. Default categories:
functional_correctness
The change behaves correctly for expected and edge-case inputs.
test_coverage
New and changed code is covered by meaningful tests.
security
The change avoids common vulnerabilities and enforces required controls.
performance
The change doesn't introduce avoidable latency, memory, or query regressions.
accessibility
UI changes meet accessibility standards.
observability
Errors emit metrics; logging uses structured fields.
backwards_compatibility
Public surfaces don't break existing consumers.
documentation
Public APIs and behavior changes are documented.
code_style
Code follows team conventions (type usage, naming, layering).
Categories drive grouping in the UI and reporting in the audit trail.
How invariants apply to a review
When a review is created, a selector picks which eligible invariants actually apply. The selector reads the review's intent, the user-supplied acceptance criteria, and the change set, and uses an LLM to pick the catalog entries that defensibly fit the change.
Selected invariants are materialized as acceptance criteria on the review, tagged with source: baseline_invariant. From that point on, they flow through the verification pipeline like any other criterion — same verdict shape, same evidence, same review-document treatment.
Two consequences:
You don't need to think about invariants when writing the intent. The selector handles eligibility. Your acceptance criteria stay focused on what's specific to this change.
Invariant verdicts and user-criterion verdicts look identical in the review document. The only visible difference is the source tag, and the fact that invariant criteria can't be edited per review (they can be waived).
Writing a good invariant
Three rules of thumb:
Be specific about the assertion, vague about the implementation.
✓ "All HTTP handlers must call an authentication middleware before any business logic."
✗ "Use
AuthMiddlewarefromsrc/auth/middleware.go." (Brittle — the check should survive renames and module moves.)
Make the rule verifiable in isolation.
A rule that requires running the whole system is hard to verify. Prefer rules that can be checked from the diff or from a single runtime probe.
✓ "All migrations must declare a
downblock."✗ "All migrations must be reversible." (Can't be checked without running them backwards.)
Scope it to where it can be broken.
Use conditions to limit a rule to the files where it can be violated, for example a frontend rule to web/**. Verify skips an invariant when none of the changed files match its conditions.
Turning a review comment into an invariant
Most invariants worth writing start as a review comment that's been left more than twice. The mining pipeline — ai_generated_pr_comments — does this automatically by reading your PR history, but you can also do it by hand:
Find the recurring comment. Scan PRs over the last quarter.
Write the assertion. State the rule in one sentence. Don't write the fix — the verifier will explain what's wrong.
Pick a category. Helps with grouping and reporting.
Add conditions if needed. Most invariants don't need them.
Save it, then watch a week of verifications. Manual invariants are active as soon as you save. Use the first verdicts to confirm the rule reads cleanly, and turn off the Enabled switch on its edit page if you need to rework it.
Example, turning a real review comment into an invariant:
Comment on PR #4173: "Please don't write to
usersdirectly — go throughUserRepository.UpdateProfile. We had a partial-write bug last quarter from a similar pattern."
Invariant body:
Conditions: file_path_glob: src/**/*.go (skip non-Go files).
Category: functional_correctness.
Waivers
Invariant verdicts can be waived with a categorized reason, from the review document, from the Verify tab on the pull request, or with aviator dismiss:
false_positive
The invariant fired but the rule misjudged this case.
doesnt_apply
The rule is valid in general but isn't relevant to this PR.
accepted_risk
The failure is real but the PR author accepts the trade-off.
fix_in_followup
The failure is real and will be addressed in a separate follow-up PR.
Every waiver is recorded in the audit trail with the reviewer, the category, and the free-text reason. If you find yourself waiving the same invariant repeatedly, the rule is wrong — tighten its conditions, rephrase the body, or rebuild the rule from real review comments.
See also
Setting up org invariants — step-by-step setup
Verification layers — how invariants compose with criteria in a run
How verification works — the verifier pipeline
How to: Writing a SKILL.md — for runtime context, not for rules
Last updated
Was this helpful?
