Before you begin
- Storybook 8 or higher
- OpenCode installed locally
Install the addon
Configure with opencode.json
The addon runs on OpenCode. Useopencode.json to choose your AI provider and model, and to connect the addon to your published component catalog via MCP.
opencode.json
| Field | Why you’d set it |
|---|---|
provider | Choose your AI provider — anthropic, amazon-bedrock, openai, or google. |
model | Pick a specific model (e.g. claude-sonnet-4-6, us.anthropic.claude-sonnet-4-6, gpt-4o). |
mcp.loracle | Give the AI access to your published component catalog so it can look up real components, props, and usage examples when writing stories. See the MCP guide. |
Guide the AI with AGENTS.md
The addon runs on OpenCode, so it respects standard agent instruction files — AGENTS.md,CLAUDE.md, and others. Use them to set persistent rules for how the AI writes stories, so you don’t repeat yourself in every prompt.
Useful things to include:
- Import paths — where your components live, so the agent doesn’t guess
- Story structure — naming conventions, required exports, file layout
- Styling rules — design tokens over raw CSS, or a specific styling approach
- Forbidden patterns — no inline styles, no hardcoded strings, no deprecated APIs
AGENTS.md
Use the chat panel
Open any story and switch to the Loracle panel. Describe what you want — the AI edits the story file and Storybook hot-reloads with the result. Example prompts:- “Add a disabled state to this button story”
- “Create variants for small, medium, and large sizes”
- “Style this to match our brand colors”
Attach an image
Click the image button in the chat input to attach a screenshot or design mockup. The AI uses it as visual context when generating code. Supported formats: PNG, JPEG, WebP.Revert a change
Every AI response snapshots your story file. Hover over any past message to reveal the Restore button — clicking it rolls the file back to that point and reloads the page.Next steps
MCP server
Connect your coding agent to the published catalog.
Loracle CLI
Publish your design system to make it available via MCP.