Ask AI — generate tokens
Route: Library → Properties → Tokens → Primitives → Ask AI
The Ask-AI modal turns a prose description of a brand into a structured token patch — adds, updates, and removes you can review and apply.
Opening the modal
On the Primitives page, click Ask AI in the page header. The modal opens with a single textarea for your prompt.
When no API key is set, the modal says so and Generate is disabled. There is no mock mode: a canned response that looks like a real one makes a broken feature indistinguishable from a working one. Everything the modal does, the Primitives page does by hand.
Writing a useful prompt
Two patterns that work well:
Pattern A — brand brief
"Calm, professional palette for a fintech onboarding flow. Trust signals: navy primary, off-white surfaces, warm gold accent for the CTA. Avoid neon."
Pattern B — example anchor
"Match the feel of Linear's marketing site — muted neutrals, restrained accent, slightly warm grays in dark mode."
Both work because they give the model role (what the palette is for), mood (formal / playful / restrained), and at least one constraint (no neon, or 'restrained accent').
Reading the diff
The response is a TokenPatch:
- Add — new primitives the model proposed (e.g.
color-navy-500,color-gold-400) - Update — existing tokens whose value changed (shows old → new with swatches)
- Remove — tokens the model proposed deleting (rare; usually empty)
- Rationale — one paragraph explaining the choices
Each row has the proposed value with a swatch so you can scan the diff visually before applying.
Applying
Click Apply. The patch commits as one step, which means:
Ctrl/Cmd + Zreverts the whole patch, not just its last line.- The Primitives page updates immediately.
- Every semantic and component binding downstream re-resolves.
- The Documentation tab regenerates fresh
tokens.css,design-system.md, anddesign-system.json.
To dismiss without applying, click Cancel or hit Escape.
Tokens it can't apply
The model is given the ids of every token you actually have. If it still proposes a change to one that doesn't exist, that entry is dropped before the diff is drawn, and the rationale names what went. The alternative — showing it, letting you approve it, and having it quietly do nothing — is the one outcome worse than an error.
When the call fails
Nothing is applied, and your prompt stays in the box. See the failure table for what each message means. Two behaviours worth knowing:
- Tostada never retries by itself. On a rate limit you get the countdown Anthropic asked for and a Retry button. Spending your quota on your behalf isn't ours to do.
- A refusal is not a bug. "Claude declined this request" means the call worked and Claude chose not to answer. Rewording usually fixes it.
Tips
- Don't ask for a full system — ask for primitives. Tostada's semantic and component layers stay yours to author.
- Iterate. Re-open the modal, refine the prompt, apply a new patch. Undo if you don't like it.
- Name your primitives. A patch arrives with names like
color-navy-500. Rename them to your team's convention before binding semantics.