refract v0.1 · beta
Agent-native / Overview

Agent-native

refract is built to be the design system an AI agent can't drift from. An agent doesn't guess your tokens or invent class names — it binds to a fixed, named vocabulary and a machine-readable contract it can read, query, and validate against. The headline is consistency: the same theme, named the same way, every time. (Fewer tokens is a real but secondary bonus — an agent emits a short path like colors.brand.dark, not a hex pasted everywhere.)

A fixed vocabulary

Every value has one stable token path (colors.brand.dark) — a public identifier that won't change within a release. An agent references names, not values, so its output stays consistent across turns and files. Token paths ▸

A machine-readable contract

Opt into the self-documenting guide and refract emits llms.txt + a versioned manifest.json — the recipe index plus the full token set, in one file the agent binds to. Self-documenting output ▸

Installable skills

Fourteen procedural skills, version-locked to your refract, teach an agent the authoring workflow — one command installs them into Claude, Copilot, Cursor, Codex and more. AI skills ▸

Self-correction

An invalid theme fails loud with a stable RefractError code, and validation collects every problem at once — so an agent fixes them all in one pass, not one build at a time. Errors ▸

A live query surface

Beyond the static contract, a Model Context Protocol server turns the theme into live tools an agent calls directly — resolveToken, getClass, listRecipes, validateTheme — so it queries and validates against the real compiled theme instead of guessing. It's the one capability a plain token file can't offer. The MCP server, with examples ▸

Lead with consistency. An agent bound to a named vocabulary and a contract it validates against produces the same, correct theme every time — the token-efficiency win rides along, it isn't the pitch. The skills below are how you hand an agent that contract.
Technical documentation for @theme-registry/refract · all output is compiled client-side by the real library (CSS adapter). The chrome is theme-aware; the render panes carry each preset's own world. · MIT licensed.