Turn an agent's work into something you can scan, understand, and share. Instead of another wall of Markdown, get a consistent visual page for a code review, architecture walkthrough, report, comparison, or dashboard.
Agents provide structured JSON; the CLI validates it, and the renderer turns it into a styled, interactive page.
promo.mp4
The agent writes a small JSON spec from a fixed set of nodes. VAR validates it, renders the page, files it in the artifact library by project, and can publish a link you can read on your phone.
Ask your agent for a visual artifact when markdown would be hard to scan:
Create a visual artifact explaining the authentication flowCompare these two solutions using a visual artifactWalk me through these code changes using a visual artifact
LLM-generated HTML is brittle. It burns tokens, drifts in style, and is hard to validate.
Visual Artifact Renderer gives agents a smaller surface: pick known UI nodes, provide data, and let a trusted renderer handle the page. The model describes what to show; the renderer decides how it looks.
flowchart TB
subgraph Agent["Agent"]
A1["Inspect source code/data"]
A2["Read node contract"]
A3["Build VisualArtifactSpec JSON"]
end
subgraph CLI["visual-artifact CLI"]
C1["Validate spec"]
C2["Write artifact bundle"]
C3["Start server if needed"]
end
subgraph Renderer["Next.js renderer"]
R1["Fetch JSON"]
R2["Render trusted adapters"]
end
subgraph Cloudflare["Optional Cloudflare publishing"]
P1["Upload bundle to R2"]
P2["Serve public URL via Worker"]
end
A1 --> A2 --> A3 --> C1 --> C2 --> C3 --> R1 --> R2
C1 -.->|invalid spec| A3
C2 -.->|--publish| P1 --> P2
The runtime path:
- The agent runs
visual-artifact contractand builds aVisualArtifactSpec. - The CLI validates the spec and writes an artifact bundle.
- The renderer fetches
artifact.jsonand renders trusted adapters.
The LLM never writes routes, imports, JSX, CSS, or full HTML for the renderer.
- Constrained JSON contract for
slug,title, optionalartifactType/topicsdiscovery metadata, optionaldata, and typednodes. - 48 node types for prose, cards, tables, charts, timelines, Mermaid, SVG diagrams, tabs, accordions, logs and diffs, plus plan and review nodes such as claim trees, decisions, call stacks, state machines, sequence and box diagrams, mockups and wireframes.
- Data-backed components that reference shared datasets by
dataKey. - Local-first storage under
~/.agents/skills/visual-artifact/artifactsunless overridden. - Pi extension asks the user to choose an artifact direction before it generates a requested artifact, then exposes
create_visual_artifactas the final writer. - Static renderer with live JSON, so new artifacts appear without rebuilding.
- Node-level annotations and in-memory AI Colab review mode.
- Optional Cloudflare publishing for durable public links.
- Safe rendering boundary: CLI validation before write, Zod parse before render, adapter-only UI.
Source-backed execution traces require ast-grep 0.43 or newer:
npm install --global @ast-grep/[email protected]Install the CLI, renderer, and agent skill:
curl -fsSL https://github.com/iurysza/visual-artifact-renderer/releases/latest/download/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
npx skills add iurysza/visual-artifact-renderer --skill visual-artifact
visual-artifact doctorRestart your agent if it was already running.
Install the CLI and renderer, then let Pi manage the skill and extension:
curl -fsSL https://github.com/iurysza/visual-artifact-renderer/releases/latest/download/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
pi install git:github.com/iurysza/visual-artifact-renderer
visual-artifact doctorRun /reload in an existing Pi session or restart Pi.
That's it. Development setup, updates, pinned versions, and uninstall commands live in the CLI guide.
From a file:
visual-artifact create my-spec.jsonFrom stdin:
visual-artifact create - < my-spec.jsonMinimal spec:
{
"slug": "demo-report",
"title": "Demo Report",
"description": "A tiny Visual Artifact Renderer artifact.",
"nodes": [
{
"type": "text",
"props": {
"text": "The agent supplied JSON. The renderer supplied the UI.",
"size": "lg"
}
}
]
}The CLI returns a local URL like:
http://127.0.0.1:9998/my-project/demo-report/
file-tree items may use src as create-time input. Relative paths must stay inside the canonical project root. Outside-project reads require a repeatable explicit --allow-read <dir> grant; the Pi tool never grants one. The CLI strips src after safely inlining content.
Artifacts support node-level comment threads. Open an artifact and use Comments to select nodes, post replies, resolve threads, and copy a page link. Local writes require an existing artifact, are serialized per bundle, and use atomic mode-0600 replacement. Writable serving is loopback-only unless --allow-remote is explicit. Mutation bodies are capped at 256 KiB. Browser writes must be JSON and satisfy same-origin checks.
Colab mode lets a formatter or agent attach suggested comments without persisting them. You can review, edit, delete, or export those comments as Markdown.
Details: ai-artifacts/docs/annotations.md.
Use --publish to create a durable public URL through your own Cloudflare account:
visual-artifact create my-spec.json --publishPublished artifacts use R2 for artifact bundles and a Worker for the static renderer, JSON endpoints, and hosted annotation writes.
First-time deployment requires a cloned repo. Setup and deployment: ai-artifacts/docs/publishing.md.
Common commands:
visual-artifact contract
visual-artifact validate my-spec.json
visual-artifact --json trace inspect --project . --anchor src/example.ts:42
visual-artifact create my-spec.json
visual-artifact serve --no-open
visual-artifact doctorFull command reference: ai-artifacts/docs/cli.md.
The docs are split like a small wiki. Start at the docs index, then follow the page that matches your task.
- Use
CLIfor install paths, command flags, server roles, and configuration. - Use
Annotationsfor comments, AI Colab, local writes, and hosted writes. - Use
Publishingfor Cloudflare setup, deploys,--publish, and GitHub Actions. - Use
Architecturewhen changing boundaries, storage, routes, or data flow. - Use
Node referencewhen composing specs or adding node types.
Run the complete pinned repository gate:
./scripts/verify.shFor renderer development:
cd app
pnpm install --frozen-lockfile
pnpm dev # http://localhost:9999/
pnpm test
pnpm lint
pnpm export:contract
pnpm verify:artifacts
pnpm buildFor focused CLI development:
cd cli
bun install --frozen-lockfile
bun test
bun run typecheck
bun run buildRun pnpm visual:qa if you touch adapters or styling. Use Reliability for the full verification map and Release before publishing a new version.
The contract is compiled into the CLI from a shared source:
shared/src/contract.tscli/assets/contract.json(generated, tracked, and checked for drift)
Inspect it with:
visual-artifact contractAfter contract changes:
cd app
pnpm export:contract
pnpm verify:artifactsapp/ # Next.js renderer source + static export
cli/ # Bun CLI source and compiled binary
shared/ # shared artifact contract + annotation schema
pi-extension/ # Pi tool wrapper for create_visual_artifact
skill/ # agent-facing skill bundle
artifacts/ # local generated bundles, gitignored
The plan nodes (claim-tree, decision, call-stack, state-machine, sequence-diagram, box-diagram, mockup and friends) port ideas and the block grammar from Thariq Shihipar's html-plan skill. The call-stack idea is credited to @dillon_mulroy. No html-plan code is copied. See NOTICE.
Key sounds in the promo video: “Single Key Press Sounds” by eklee and qubodup, CC BY 3.0, from OpenGameArt. Trimmed, filtered and mixed under the music.
