Guard
Every pull request checked against your tokens. Agents included.
The Guard scans your code in CI and fails the check when a rule breaks. Then it writes the fix, and applies it once a person approves.
What it catches
It checks what drifts, before a person reviews the change.
When a team moves fast, the same things slip:
- Colours typed straight into code instead of coming from a token.
- Layouts pinned to left and right, which break in languages read right to left.
- Components that have grown past their size limit.
- Text that misses the contrast floor in one brand's theme.
It also reads page markup and flags six common accessibility problems, as warnings. The full list, the flags and the settings are in the Guard docs.
Typed into the code
src/DriftToken.tsx, line 13
backgroundColor: '#424CB3',
A colour typed straight into code.
Guardscan --check
What the Guard does
Reported
Still reads: backgroundColor: '#424CB3',
Nothing is written. The check fails, exit code 1.
Who it checks
Person or agent, the same rules.
Think of the Guard as the smoke alarm and GitHub as the fire door. The Guard fails its check and puts the fix in a comment on the pull request. Nothing is applied until a person approves it. GitHub does the blocking, once the repository owner makes the check required. The CI guide shows how.
A real pull request, step by step
Step 1
A change arrives.
A pull request adds a colour typed straight into code.
src/DriftToken.tsx, line 13
Added: backgroundColor: '#424CB3',
Step 2
The Guard comments, and the check fails.
It reports what the change adds, and asks for changes.
Sovereign Guard Zero-Trust Enforcement
Design-token drifts detected. Please review and commit the recommended W3C token mappings below:
src/DriftToken.tsx, line 13
Sovereign Guard — Impact Radius Metric Count Files scanned 322 New violations 1 Waived by baseline 198 Baseline entries that can shrink 8 New violations
src/DriftToken.tsx — NEW raw-colour findings: 1 found, baseline 0
Sovereign Guard Zero-Trust PR / Blast radius and inline suggestions: failing
Step 3
It proposes the fix, on the line.
The suggestion swaps the typed colour for a token. The code is not changed yet.
Suggested change
src/DriftToken.tsx, line 13
Removed: backgroundColor: '#424CB3',
Added: backgroundColor: 'var(--semantic-color-ramp-600)',
Step 4
A person approves it. The Guard checks again.
The change goes in only when someone applies the suggestion.
Sovereign Guard — Impact Radius
Sovereign Guard — Impact Radius Metric Count Files scanned 322 New violations 0 Waived by baseline 198 Baseline entries that can shrink 8 Review dismissed. Superseded by the Sovereign Guard run on 12fd4e0.
Sovereign Guard Zero-Trust PR / Blast radius and inline suggestions: passing
A real Guard run that fails
- sovereign-guard suite — 18 checks
- a11y — pass
- contrast — pass
- perf — fail (known — governance/guard-verify-baseline.json)
- zero-overrides — fail (NEW)
- zero-overrides fails and is not in the baseline — fix it (or, with a reason, record it in governance/guard-verify-baseline.json)
- Error: Process completed with exit code 1.
It fixes, too
It doesn't stop at the warning. It writes the fix.
Most checks tell you something is wrong and leave the rest to you. The Guard does the work. For a colour typed straight into the code, it finds the matching token and writes the swap. A person approves it, and the Guard applies it to the code. It never commits on its own: the change lands in your working copy, for you to review and commit.
For text that misses the contrast floor, it works out the nearest colour that passes and writes it down as a suggestion, without touching your code.
Where it stands today
It applies token swaps in .ts and .tsx files when exactly one token matches. Fixing is phase 2 of 4.
A one-click approve button on the pull request, and a check that the page looks the same afterwards, aren't built yet. The commands are in the Guard docs.
Starting with the code you have
Where your code stands today is accepted. A new problem fails the build.
The Guard records today's state in a baseline file. What's already there is accepted. Budgets live in the repo as well, and raising one shows in the diff.
A real Guard run
- sovereign-guard scan — 322 files scanned, 190 ignored by sovereign.config.json
- 198 finding(s) waived by governance/guard-scan-baseline.json
- src/audio.ts: lines ceiling 925, now 741 — lower it: npm run guard:tighten
- src/lab.ts: lines ceiling 1950, now 1755 — lower it: npm run guard:tighten
- src/main.ts: complexity ceiling 29, now 28 — lower it: npm run guard:tighten
- vite.config.ts: complexity ceiling 19, now 15 — lower it: npm run guard:tighten
- sovereign-guard: 322 files, no new violations (198 waived).
Several brands
Components name a token, never a brand.
Each brand only changes what the tokens point to. Switch brand and the component's code stays put, while the Guard checks the contrast floor on every pair.
The component, as written
.button {
color: var(--semantic-action-primary-text);
background: var(--semantic-action-primary);
border-radius: var(--alias-radius-cta);
clip-path: var(--alias-corner-cta);
}Lines changed between brands: 0
The brand only changes what the tokens point to, set once at the root. Colour, corners, spacing and type all move together.
The same component, Aurora
Open the case.
One desk. Three authorities.
- Corners: Rounded. Card radius 16px.
- Text on a card: 14.7:1. Passes the 4.5:1 floor.
- Accent on a card: 8.2:1. Passes the 4.5:1 floor.
- Button text on the accent: 8.2:1. Passes the 4.5:1 floor.
Your code stays put
In our tests, no network connection.
In our tests, on an earlier build, scan and verify made no network connection. We cut the network off entirely and the results came out identical. Linux only, so far. We'll re-test on the current build, and the date and build are on the Tested page.
What it isn't
Not an accessibility certificate.
The Guard makes no claim of legal compliance, the European Accessibility Act included. It reads source, not the rendered page, so it can't see content built by components, added by scripts or hidden by CSS. Treat findings as leads to check, not a full audit. Our accuracy figures are on the Tested page.