GUIDE

Design tokens for AI agents

An agent will use your design system if it has to. Here is what to define as tokens, how to make them required instead of suggested, and how that works in Wonderblok.

Why agents drift off your system

Ask an agent for a settings screen and it picks a blue, a spacing and a font size that look reasonable. None of them are yours. A style guide in a prompt is advice, and advice is easy to skip. What works is giving the agent real values to reference and rejecting anything else.

What to define

  • Color: at least four, with the roles named (ink, surface, primary, danger) rather than the shades.
  • Font: one family to start.
  • Text styles: weight, size and line height in one value, at least three (heading, body, caption).
  • Spacing: a scale on a 4px grid, such as 4, 8, 12, 16, 24, 32, 48, 64.
  • Radius: at least two.

Name tokens by role. A value like primary survives a rebrand; blue-500 does not.

Make tokens required, not suggested

  • Expose the tokens to the agent as data it can list, not as a PDF it may or may not read.
  • Reject values that are not tokens, instead of warning about them.
  • Make the agent read your rules before it edits, so a change to the rules reaches the next edit.
  • Check the result after each edit: text sizes, contrast and missing empty or error states are all visible to a machine.

How Wonderblok does it

In Wonderblok a value that starts with $ is a token. The agent lists them over MCP:

{
  "ink": { "type": "color", "value": "#1A1A1A" },
  "space-4": { "type": "number", "value": "16" },
  "text-body": { "type": "text", "value": "normal 16/1.5 $font" }
}

Paint and fonts must use tokens: a hex that equals a token is snapped to it, and any other hex is rejected. Every edit must carry the hash of your current rules, and Wonderblok checks the screens an agent touched and sends the findings back for it to fix. The full behavior is in Tokens and guidelines. Rules are checked when the agent edits, not when you do, so you can still draw outside the system by hand.

To start from a flow that is already structured, begin in Universe. The pattern supplies the screens and states and your tokens supply the look.

Questions

What are design tokens?
Named values for the decisions of a design system: colors, fonts, spacing, radius and text styles. A layer that uses the token changes when the token changes.
Why do AI agents ignore my design system?
Because nothing makes them read it. If tokens are optional, the agent writes the hex value or pixel length that looks right to it, and the result drifts from your brand.
How does Wonderblok keep an agent on tokens?
Paint and fonts must use tokens. A hex value equal to a token is snapped to it, and any other hex is rejected. Every edit also has to carry the hash of your current rules, so the agent must read them first.
Do tokens support dark mode?
Yes. A token can have a value per mode, such as dark.
What if my file has no tokens yet?
Wonderblok reports how complete the design system is. When it is not ready, the agent adds a 4px spacing scale, radius tokens and a type scale, and proposes your colors and fonts or asks you.