AI Guardrails
Rules that keep AI-generated interfaces inside the brandOS brand system, tokens in, literals out.
Manifesto
“The AI can ship a thousand UIs an hour. The brand only survives ifevery single one of them reaches for the token before the literal.”
01 · Allowed
What AI may reach for
These are the only inputs AI-generated UI is allowed to touch.
Colors
DaisyUI semantic classes & brandOS CSS variables.
bg-base-100bg-primarytext-base-contenttext-primaryborder-base-300text-successtext-errorScales
Raw brand scales via CSS variables only.
--brandOS-primary-*--brandOS-gray-*Typography
Sizes, weights, families, and leading tokens.
--brandOS-text-*--brandOS-font-*--brandOS-leading-*Spacing
15-step rhythm scale. No ad-hoc px values.
--brandOS-space-{0…24}Radius
Seven slots from sm to full.
--brandOS-radius-smdefaultmdlgxl2xlfullShadow
Five elevation steps authored in OKLCH.
--brandOS-shadow-sm → xlMotion
Durations and easings from the token set.
--brandOS-duration-*--brandOS-ease-*Components
Reuse brandOS/ui before touching primitives.
<brand-button><brand-card>…SVG assets
Registered, optimized SVGs through exact canonical subpath imports.
<file>.svg?react<file>.svg?raw<Icon name="…" />02 · Forbidden
What AI must never emit
Every row shows the anti-pattern on the left and its token-backed fix on the right.
#2aa5eavar(--brandOS-primary-500)rgb(42, 165, 234)var(--color-primary)style="color: red"class="bos:text-error"✅ Saved<Icon name="check" />--app-text-primary: …Use semantic tokens directly.dark:bg-gray-900data-theme on <html> wins.bg-blue-500bg-primary or --brandOS-primary-*bg-[#2aa5ea]bg-primary-500<img src="cog.svg" /><Icon name="cog" /> · or a pinned brand.snyder.tech/cdn URL for fixed-color brand logossrc/vector-graphics/logo.svgimport from '@brandos/ui/assets/...svg?raw' or load from the versioned CDNimport { logo } from '@brandos/ui/assets'Import the exact '@brandos/ui/assets/<category>/<file>.svg?react' pathsrc/assets/new-logo.svgRegister ownership in brandOS/registry, then run brandos-svg-checkLight and dark variants use different viewBoxesNormalize every variant to one shared viewBox without stretching artwork<svg> without accessible semanticsAdd informative role + name, or decorative aria-hidden + focusable=false03 · Reuse ladder
Three rungs, in order
AI climbs this ladder in order. Only fall off the top rung when 01 and 02 genuinely don’t fit.
Reuse
Search brandOS/ui/src/components/ for an existing match.
Wrap
Wrap a Shoelace or DaisyUI primitive and apply brand tokens to it.
Compose
Compose a new component only if 01 & 02 fail. Open a PR to promote it.
04 · Prompts
Copy these into your AI session
Prompt fragments that pin Claude Code, Cursor, or Copilot to the rules on this page.
When generating UI in this repo:
- Reach for semantic tokens first: brandOS CSS variables (--brandOS-*, --semantic-*, --color-*). Use whichever utility layer the host app ships (DaisyUI, bos: Tailwind, MUI sx, etc.) - never the raw token name in markup.
- No hex, rgb, rgba, hsl literals. No inline style for colors, backgrounds, typography, spacing, or shadows. Dynamic, data-driven values (per-row swatch backgrounds, etc.) are the only exception.
- No emoji in UI - use Lucide, Heroicons, or inline SVG.
- Brand logos, marks, and icons use exact @brandos/ui/assets/<category>/<file>.svg?raw imports (or a pinned versioned brand.snyder.tech/cdn URL for fixed-color logos/wordmarks) - never the aggregate barrel or per-app vector-graphics folders.
- Prefer the currentColor <brand>-logo-ink.svg variant inline so it inherits the theme; use fixed-color -light/-dark only where currentColor cannot apply (e.g. an <img> tag).
- Every light, dark, and ink logo variant must share one normalized viewBox. Preserve artwork proportions; never stretch a mark to fill its frame.
- Reusable SVGs must be registry-owned, match the repository multipass SVGO output, and pass just brandos-svg-check --report.
- Informative inline SVGs require role="img" and an accessible name. Decorative inline SVGs require aria-hidden="true" and focusable="false". SVG <img> consumers require alt text, including alt="" for decorative images.
- Never load a LOCAL SVG as <img src="*.svg"> - inline it so it inherits currentColor (use <Icon name="..." /> or Fragment set:html). Fixed-color brand logos/wordmarks may load via <img> from the pinned, immutable, versioned brandOS CDN.
- Prefer an existing brandOS/ui component, then a host primitive (Shoelace / MUI / DaisyUI), before composing anything new.
- Theme switching is driven by the data-theme attribute on <html> - do not add Tailwind dark: variants or fork CSS per mode.
- If a required token does not exist, stop and ask rather than inventing one.Produce the component using only tokens listed on the AI Guardrails page. If the component already exists under brandOS/ui, import it instead of recreating it.05 · Enforcement
How we keep AI honest
Five layers, from agent instructions to source and asset verification, work together.
Every AI session auto-loads the rules on this page.
External AI clients can discover and pin the contract.
Reviewers reject any forbidden pattern. First offense coached.
Rejects forbidden literals, asset barrels, inaccessible SVG consumers, and new reusable inline SVG markup.
Rejects unsafe, unregistered, unoptimized, malformed, or geometrically inconsistent SVG assets.