Semantic Tokens vs Primitive Tokens in Component Libraries
Separating primitive and semantic tokens prevents cascading edits when brand values change.
Primitive and semantic tokens serve different jobs in a component library, and separating them is what makes changes propagate without component-by-component edits. Primitives hold values, while semantics assign purpose. For AI-generated UI, that foundation also needs retrievable brand guidance. Rainbrand offers structured brand guidance, while a DESIGN.md file or an MCP server can give agents the context that token names alone cannot.
Why most token systems break before they scale
A designer changes the brand primary from teal to indigo, and the team discovers there is no single place to make that change. Instead, the team has to run search-and-replace by hand across hundreds of files. Components that looked alike now need to be changed one by one because their colors were chosen separately. The library has shared values, but it does not have a shared way to change what those values mean.
A flat token system can fail in the opposite direction too. It can contain only semantic names, with no underlying raw values from which to derive variants such as opacity states. Both failures expose the same missing boundary between what a value is and what it means. More names do not repair that boundary unless the names belong to distinct layers with clear responsibilities.
What primitive tokens are and what they are not responsible for
Primitive tokens hold the raw palette of a system, including every color stop, spacing increment, and shadow definition. Their job is to store an absolute value without deciding where it belongs. For example, --color-red-500 holds #EF4444, while --space-8 holds 8px. Neither definition depends on a component, a theme, or the context in which the value appears.
The usual naming pattern shows that difference through category and scale. Names such as blue-500, space-4, and radius-md describe the value. Color scales typically span stops from 50–950, generated from a base hue, with the middle stop conventionally anchoring the base brand color. This gives the system a vocabulary for its available values without assigning interface roles to them.
Primitives are therefore the single source of truth for raw values. Every other layer derives from them rather than introducing an independent value elsewhere. That job is kept small by design because a raw color cannot decide whether it stands for an error, an action, or a surface. Making that decision inside the primitive would mix the palette with the rules for using it.
What semantic tokens do that primitives cannot
Semantic tokens name a purpose and point to the primitive that currently serves it. A token such as --color-error aliases --color-red-500, connecting the role of error to a particular color. If that role changes from red to orange, one mapping change updates every error state across the library. Primitives are still the source of truth for values, while semantic tokens are the API surface that components use. The mapping between them holds the decision.
In the light theme, --color-background and --color-text point to the primitives chosen for that theme. Switching a data-theme="dark" attribute changes those mappings to the primitives chosen for the dark theme. Components still use the same background and text tokens, so their component-level CSS does not need to be rewritten.
Semantic names also make intent available to developers and tools. Names such as surface-primary, content-primary, and action-color explain why a value is used. That distinction is the bridge from a palette to a functioning design system. Aliasing turns a purpose-based name attached to a value into a stable interface through which the system can change.
Why components must only ever reference semantic tokens
Components must reference semantic tokens rather than primitives because the rule preserves that stable interface. A component using var(--color-red-500) reaches past the mapping layer and selects its own value. If the error role later changes color, that reference still points to red until someone finds and edits it. A component using var(--color-error) instead inherits the current mapping for error. It is theme-agnostic by construction.
A linter can flag direct primitive references in components and treat them as build errors. That makes the dependency rule part of the pipeline instead of a convention that each contributor must remember. The principle also applies to AI workflows, where agents and products need structured brand context. In Rainbrand's model, structured brand guidance provides that single retrievable source of truth, so connected agents receive the canonical version.
There are two legitimate exceptions to the component rule. Data visualization may use primitives because chart series encode data identity, so red can mean the first dataset. Deliberate utility classes in utility-first frameworks also bypass semantics by design.
How a third component-token layer extends the model — and when it creates more problems than it solves
A component-token layer adds specificity above the semantic layer without replacing it. The chain runs from blue-500 to action-color to button-bg-primary, with each step representing a single alias. The component consumes its own token, which derives from the semantic role. This extends the same dependency rule through another layer. It does not give components a separate palette.
The benefit appears when one element needs an override that should not affect everything sharing its semantic role. A button background can then change through its component token while the action color used elsewhere stays the same. That precision matters in large, complex systems where individual components genuinely need to diverge. However, it also multiplies the token count and adds relationships that the system must maintain. The extra control has a real cost.
For most teams, primitives and semantic tokens are sufficient. A third layer is justified when component-specific divergence is a recurring need. Adding another alias everywhere is not automatically an architectural improvement.
How the DTCG specification turns this architecture into a portable standard
The Design Tokens Community Group published its first stable specification on October 28, 2025. The Design Tokens Format Module 2025.10 defines a cross-platform JSON schema that can drive Figma, CSS, iOS, Android, and Flutter from one source of truth. It gives the primitive/semantic model a vendor-neutral format that tools can implement. The architecture no longer has to depend on a private translation between each design tool and each code target.
The specification uses its {...} reference syntax to show how tokens relate to each other. Because those aliases are machine-parsable, tooling can inspect the relationships and enforce boundaries such as preventing direct primitive references from components. The standard also covers theming, multi-brand support, and modern color spaces such as Display P3 and Oklch. These are interoperability concerns because a portable value is not enough if its relationships or color meaning are lost during export.
Figma Variables can export to the DTCG specification, with native support for scalar token types. Composite types such as typography, gradients, and shadows still rely on third-party plugins. Style Dictionary has added first-class DTCG support for the transform step. These tools cut the need for hand-built translation layers, though the export path still has to keep the links between primitives and semantic tokens intact.
What the standard pipeline looks like end to end
A governed pipeline starts with Figma Variables and produces a DTCG-compatible export. That export carries both the values and their aliasing relationships into a build transform step. The transform produces the platform outputs, and CI/CD automation delivers them to their destinations. Once a change is merged into the token file, it can propagate across platforms without manual translation. The important unit moving through the pipeline is the token graph.
Tokens Studio offers a DTCG-compatible JSON export with aliasing relationships, but its behavior needs to be accounted for. Its default export is flat JSON, and it manages a parallel token layer independently of Figma Variables. Keeping the primitive/semantic collection structure may therefore take more setup. The pipeline must carry the architecture as well as the data.
Style Dictionary can run the build transform before the outputs are sent out automatically. However, this path is replicable with other tools that implement the DTCG specification. The spec is the constant, while the tools are instances of it. In 2026, with token adoption mainstream, the governance question is whether the graph truly serves as the single source of truth. If design and code maintain independent interpretations of that graph, they can still drift despite using tokens.
Why semantic tokens are necessary but not sufficient when AI agents write the UI
An AI tool can read a token file without knowing how to apply its contents correctly. A primary value of #1A1C1E identifies a color but does not explain why it exists or when not to use it. Semantic names reduce this ambiguity by describing intent, yet they cannot carry every rule governing a component-level decision. An agent still needs text that explains how token roles fit the surfaces and uses of a component. A sound token architecture is therefore a prerequisite for generated UI.
Rainbrand addresses this gap by ingesting brand assets and transforming them into structured, versioned brand guidance that connected agents retrieve through API or MCP. Its approach fits workflows that need a single source of truth from which palette changes and brand guideline updates can cascade into downstream systems. A DESIGN.md file is another way to give agents structured guidance, while an MCP server lets them retrieve that guidance when they need it. The choice concerns how agents receive the rules that explain the tokens.
The division of responsibility remains precise. Design tokens handle build outputs such as CSS variables and platform exports, while the context layer explains how generated code should use them. An MCP server can return guidance for a specific component without loading irrelevant tokens into the context window.
How to make brand token context retrievable for agents using MCP
The Model Context Protocol lets agents get structured brand context, including semantic token mappings, when they need it. Rather than receiving an entire token file in every prompt, an agent retrieves relevant knowledge when a component requires it. That knowledge covers token roles, rules for their use, and component patterns. Retrieval makes the context layer actionable because guidance can be requested at the point where the agent chooses a surface or state. The mapping layer then gives that choice a stable token reference.
This follows the same principle as the component architecture. A component should not skip semantic mappings to choose a raw value, and an agent should not skip structured context to make its own sense of loose brand files. Both shortcuts separate the consumer from the place where changes are governed. With token architecture and retrieval in place, consistent output depends on shared infrastructure.
The primitive/semantic split is the foundation because it separates values from decisions and lets updates propagate through the library. MCP-accessible brand context is the superstructure because it makes those decisions available to agents in a usable form. Neither layer substitutes for the other.