/aigui:aiguifrom aigui
Use when integrating the @ai-gui SDK to render streaming LLM output as declarative generated UI, cards, revisioned artifacts, molecules, maps, markdown, charts, citations, math, and diagrams in React/Vue/vanilla; when rendering those blocks to PNG server-side for a channel that carries only pictures, such as WeChat via OpenClaw; when a backend needs to drive cards over a WebSocket to a browser with no frontend project and no LLM in the loop; or when generating content for an @ai-gui frontend.
Ships in aigui. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
AIGUI is a framework-agnostic TypeScript SDK that renders streaming LLM output as live UI. A headless core parses the stream into an AST; adapters render it in React / Vue / vanilla; plugins add block types. Full detail: AGENTS.md and README.md.
@ai-gui to an app to render a streaming model response (markdown + cards + charts + math + diagrams).@ai-gui/core + one of @ai-gui/react / @ai-gui/vue / @ai-gui/vanilla. Add plugins as needed.CardRegistry — register({ type, description, schema?, example?, render }). The app owns the render component; the LLM only fills data.
{ data, onAction }. Vue: props data, emits action. Vanilla: (data, { onAction }) => HTMLElement.<AIRenderer ref registry plugins onCardAction /> (React/Vue) or createRenderer(el, { registry, plugins, onCardAction }) (vanilla). Imperative API: push / feed / reset (+ destroy in vanilla).onCardAction({ type, params, cardType }) to your real APIs. Buttons are declarative — the app makes the request, never the LLM.plugins={plugins} — or a stable loader, plugins={() => import("@ai-gui/plugin-mermaid").then(m => [m.mermaid()])}, to keep the heavy bundle out of the first load. The renderer reparses what it buffered when the import lands, so no replay is needed. Plugin CSS is injected automatically; plugin-map/style.css and plugin-katex/style.css must be imported by the host.buildSystemPrompt({ base, registry, plugins }); prepend it to your system prompt. Passing plugins is what tells the model it may draw a diagram or write TeX — installing a plugin only teaches the renderer to draw one. Backend just streams text.onNodeClick(node, event) maps a click to the parsed block it landed in; rawHtml={false} escapes raw HTML the model wrote instead of interpreting it.reset() then feed(response.body) — accepts a ReadableStream or AsyncIterable<string>. Renders progressively.@ai-gui/image renders the same blocks to PNG by running the real @ai-gui/vanilla renderer in a headless Chromium and screenshotting each one. Reach for it when the destination cannot display markup, not as a faster alternative to the browser path.
import { renderMarkdownToImages } from "@ai-gui/image"
const { text, images } = await renderMarkdownToImages(answer, { outDir: "/tmp/aigui" })
// text — the answer with every rendered block removed
// images — [{ kind: "chart", path: "…png", width, height }]
Requires playwright (an optional peer) plus playwright install chromium. On Linux also install fonts-noto-cjk, or Chinese labels arrive as tofu — a screenshot cannot fall back to another font the way a web page can. Maths needs nothing extra; KaTeX's stylesheet and fonts are inlined into the page.
Four things worth knowing before using it:
text as its original source. A broken diagram costs a picture, never the answer. Only blocks that actually produced a file are stripped.kinds selects the families to draw — chart, mermaid, dashboard, card, math, table. Default is all six; max caps how many (default 6) and the rest stay as text.For the OpenClaw chat gateway, @ai-gui/openclaw wires this in with no code: install it, enable it, and a reply containing a ```chart fence reaches WeChat as prose plus a picture instead of a wall of ECharts JSON. It also exposes an optional aigui_render tool for drawing on purpose, which an operator must enable with tools.allow.
@ai-gui/live lets a backend hold a WebSocket to a browser, push cards, and receive user actions back — no frontend project on the backend's side, and no LLM required: this path works with no model in the loop at all.
It carries cards, ui documents and actions — deliberately not the markdown stream. That half parses in the browser on purpose, so it can repair half-typed syntax as bytes arrive; moving it server-side would cost a round trip per token.
import { CardStore } from "@ai-gui/core"
import { createConnection, createLiveClient } from "@ai-gui/live"
const store = new CardStore({ registry })
let onFrame
const connection = createConnection({
url: "wss://example.com/live",
onFrame: (frame) => onFrame?.(frame),
onState: (state) => setIndicator(state),
})
const client = createLiveClient({ store, connection, bindFrames: (h) => (onFrame = h) })
connection.start()
const { outcome } = await client.sendAction({ type: "metric.drill", params: { id: "a" } })
Four things it guarantees:
hello → welcome → full sync), so there is no recovery-only branch to rot.createLiveClient wires this itself from the connection's state, so nothing beyond connection.start() is required.docs/live-protocol.md is normative, and fixtures/live-protocol/frames.json is the conformance suite any server implementation, in any language, tests against.
Write normal markdown. Add fenced blocks only for card/block types listed in your system prompt.
| Block | Syntax |
|---|---|
| Card | ```card:<type> + JSON data only |
| Generated UI | ```ui + one bounded declarative JSON tree |
| Chart | ```chart + ECharts option JSON (3D series if gl enabled) |
| List | ```list {"items":[...]} |
| Table | ```table {"headers":[...],"rows":[[...]]} |
| Key-value | ```key-value {"pairs":{...}} |
| Layout | ```layout {"direction":"row|column","items":[...]} |
| Math | $…$ inline, $$…$$ block |
| Diagram | ```mermaid |
| Molecule | ```molecule + strict SMILES/Molfile JSON |
| Map | ```map + strict inline GeoJSON/markers/routes JSON |
| Solid geometry | ```solid + the solid, its named points, and the conditions on them — never coordinates, never a stated result |
| Function / calculus | ```function + the expression and the interval — never sampled points, never a computed slope or area |
| Ray optics | ```optics + the element and the object — never the image position or whether it is real or virtual |
| Motion | ```motion + the initial conditions — never the range, the flight time, or the velocities after a collision |
| Force diagram | ```physics + the bodies, the forces on them and their angles |
| Price chart | ```quote + bars you actually have — never prices from memory, never indicator values, never a signal |
| Labelled figure | ```figure + the regions and what each part is called |
| Progress | ```progress + one step per thing being done; re-emit the same id to update it |
| Flashcards | ```flashcards + the questions and answers to revise from |
| Sources | ```sources {"sources":[{"id":"...","title":"...","url":"https://..."}]} |
| Artifact create | ```artifact-create + strict JSON document definition |
| Artifact update | ```artifact-update + operationId, id, exact baseRevision, and full replacement content |
Card example:
```card:weather
{ "city": "Tokyo", "tempC": 24 }
```
{"$state":"key"} bindings; never emit code, expressions, URLs, remote components, or workflows.action + params; the app performs the real request. Never claim you did it.buildSystemPrompt — don't hand-write generation rules; it assembles card specs + each plugin's prompt spec.evidence and resultset are the host's, not yours — those fences are appended by the application from what it actually executed. A model that can invent a number can invent the query said to have produced it, so emitting one is claiming provenance you do not have.See AGENTS.md for full examples.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub liliang-cn/aigui --plugin aigui2 skills in this plugin