Code Generation
~7 min readUpdated: December 2026

Code-Driven AI Illustrations: Editable SVG, Canvas & WebGPU Agent Pipelines

Code-Driven AI Illustrations Pipeline Generating Editable SVG and WebGPU Graphics via Smoke Monkey Harness

Simon Willison’s November 28, 2026 analysis demonstrates why frontier coding LLMs (Claude Opus 5.5, GPT-6 Astra, Gemini 4 Neon) generating SVG, HTML/CSS, 2D Canvas, Blender scripts, and WebGPU shaders outperform bitmap image models for technical diagrams, posters, UI components, and game assets. Code-driven outputs guarantee crisp font typography, editable DOM/vector layers, and surgical iterative fixes.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Code-Driven AI Illustrations: Editable SVG, Canvas & WebGPU Agent Pipelines: Simon Willison’s November 28, 2026 analysis demonstrates why frontier coding LLMs (Claude Opus 5.5, GPT-6 Astra, Gemini 4 Neon) generating SVG, HTML/CSS, 2D Canvas, Blender scripts, and WebGPU shaders outperform bitmap image models for technical diagrams, posters, UI components, and game assets. Code-driven outputs guarantee crisp font typography, editable DOM/vector layers, and surgical iterative fixes. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Examplesvg-illustration-verify-agent.ts
svg-illustration-verify-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
// Coding agent that authors SVG diagrams and verifies layout via headless rasterization
const agent = createAgent({
agentId: 'code-driven-svg-illustrator',
provider: 'anthropic',
model: 'claude-opus-5-5',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
});
async function main() {
const result = await agent.run(
[
'Create docs/architecture-diagram.svg (1200x675 viewBox, crisp system fonts, <g> labeled layers).',
'Render it to /tmp/preview.png using resvg or rsvg-convert so zero text labels overflow pill containers.',
].join(' ')
);
console.log('Generated and verified SVG illustration:', result.summary);
}
main().catch(console.error);
Video Guides

Watch: Related Video Guides

Top 6 Tools to Turn Code into Beautiful Diagrams

AI Diagrams Are Ugly. This Free Skill Fixes Them

Why Code-Driven Illustrations Outperform Bitmap Models for Engineering Assets

Dedicated image models—ranging from diffusion pipelines to LLM-driven bitmap editors like Nano Banana, ChatGPT Images, and Ideogram 4.0—bake pixels into a flat raster array. Even when multimodal editors preserve details across turns, zooming in exposes micro-glitches, distorted glyphs, and locked layers that cannot be edited independently.

When a frontier coding model (Claude Opus 5.5, GPT-6 Astra, or Gemini 4 Neon) writes SVG, HTML/CSS, 2D Canvas, Blender Python, or WebGPU shaders directly inside an agent harness, every visual primitive remains inspectable source code. Fixing a clipped pill badge takes a two-character width attribute edit rather than re-rolling an entire diffusion seed.

CriterionCode-Driven Agent (SVG / Canvas / Blender)Dedicated Bitmap Image Model
Output RepresentationInspectable XML / DOM / Python / WGSL sourceFlat raster pixel grid (PNG / WebP)
Typography FidelityNative font rendering, crisp at any zoomApproximated pixel glyphs; occasional artifacts
Element-Level EditingDirect edit in code, Inkscape, Illustrator, Boxy SVGRequires inpainting or full re-generation
Best Fit Use CasesArchitecture diagrams, posters, UI, charts, game spritesPhotorealistic scenes and organic photography

Fixing Blind Spots: Pairing SVG Codegen with Local Raster Inspection

As Simon Willison documented when iterating on a 1970s-styled Kakapo conservation poster with Gemini 4 Neon, chat interfaces that do not render SVGs force the user to screenshot clipping bugs (such as text overflowing a pill box) manually.

In a local agent harness, you eliminate that manual copy-paste loop:

  1. Structured Layer Groups: Prompt the agent to wrap semantic components in named <g id="..."> groups with explicit viewBox coordinates and web-safe or embedded font stacks.
  2. Automated Raster Check: Run resvg or Playwright in a verify step to produce a PNG preview, then let the multimodal model inspect its own render for bounding-box collisions before marking the task complete.
  3. Domain Fact Grounding: Have the agent fetch or search verified statistics first so embedded numbers, labels, and captions are factually accurate.

Beyond SVG: Vibe Game Assets & Presentations

The same code-driven loop applies to slide decks (HTML/CSS + PDF export), 3D props (Blender Python), and procedural WebGPU textures—all version-controlled in Git alongside application code.

Reproducible SVG Validation & Raster Verification Pipeline

Add a deterministic CLI check to validate XML well-formedness and render a verification PNG on every SVG generated by your agents:

bash
# 1. Validate XML syntax of generated SVG files
python3 -c "import xml.etree.ElementTree as ET; ET.parse('docs/architecture-diagram.svg'); print('Valid SVG XML')"

# 2. Rasterize SVG at 2x scale using resvg (or rsvg-convert) for visual inspection
resvg docs/architecture-diagram.svg /tmp/architecture-diagram.png --width 2400

# 3. Inspect dimensions and file size
file /tmp/architecture-diagram.png

Run this workflow inside Smoke Monkey Harness to turn text-only coding agents into deterministic visual asset generators without external bitmap APIs.

Google Search Questions & Answers

Frequently Asked Questions

Q:When should I use code-driven AI illustrations instead of a bitmap image model?

Use code-driven generation (SVG, HTML/CSS, Canvas, Blender, WebGPU) for technical diagrams, UI mockups, posters with exact typography, data visualizations, presentations, and modular game assets. Use dedicated image models for photorealism.

Q:Why did Claude and other text LLMs close the gap without native bitmap generators?

Frontier text LLMs became skilled enough at spatial layout, CSS, and SVG geometry that they can build complete presentations, websites, and vector posters purely through code—another manifestation of the bitter lesson.

Q:How do I stop LLMs from overflowing text boxes in generated SVGs?

Give the agent a shell tool that rasterizes the SVG via resvg or headless Chromium so it can visually inspect bounding boxes and adjust rect widths or font sizes automatically.

Q:Which tools can edit AI-generated SVG files afterward?

Any vector editor—including Inkscape, Adobe Illustrator, Figma, and Boxy SVG—or a plain text editor can modify individual shapes, colors, and text nodes cleanly.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness