Skip to content
Vibecoding & Dev Tooling4 min read

One Prompt, One Rust File, One WASM Tool: The New Shape of Vibecoding

Simon Willison turned a Rust renderer buried in xAI's newly open-sourced Grok CLI into a browser tool with a single Claude Code prompt — a clean case study in what agentic coding now makes trivial.

By TRAGenX Desk

Share

xAI recently open-sourced Grok CLI, its terminal-based coding agent, putting the full codebase out in the open the way Anthropic's Claude Code and other agentic coding tools have done. That kind of release usually gets skimmed for architecture ideas. Simon Willison went a level deeper: he actually read the source, and found something worth pulling out on its own.

A Rust renderer hiding in a coding agent

Buried in the repo is xai-org/grok-build's src/mermaid.rs — a self-contained Rust module that renders Mermaid diagram syntax as Unicode box-drawing art, presumably so Grok CLI can show flowcharts and sequence diagrams directly in a terminal. It's a narrow, well-scoped utility: exactly the kind of code that's easy to overlook inside a larger agent codebase, and exactly the kind an AI coding tool can read, understand, and repurpose without a human tracing every line first.

From terminal renderer to browser tool, via one prompt

Willison's move was to ask Claude Code for web, running on Fable 5, to take that Rust code and compile it to WebAssembly so it runs entirely client-side in a browser. The result, live at tools.simonwillison.net/grok-mermaid, pastes in Mermaid source — flowcharts, sequence, state, class, or entity-relationship diagrams — and renders it as Unicode box art, with adjustable output width, copy-as-text, and shareable links. Unsupported diagram types just fall back to a framed listing of the raw source rather than failing outright.

The renderer is mermaid.rs itself, unmodified and licensed Apache 2.0 from xai-org/grok-build, compiled down to a 163 KB WASM module. Nothing was reimplemented in JavaScript. The original Rust logic just runs somewhere new.

Why this is a better vibecoding example than most

Most 'I vibecoded this in an afternoon' stories are greenfield: describe an app, get an app. This one is more instructive because it's a port, not a creation. The hard part of porting code across runtimes has traditionally been the translation — rewriting Rust idioms into JS, or wiring up a build toolchain by hand. Here, an agentic coding tool did the toolchain wiring (Cargo target, wasm-bindgen glue, a minimal HTML harness) from a plain-language request, and left the actual logic untouched because there was no reason to touch it.

That's the pattern worth noticing: as coding agents get better at reading a codebase and reasoning about build systems, the cost of 'take this component and put it somewhere else' keeps dropping toward zero. It also means license and attribution discipline matters *more*, not less — the tool correctly carries forward its Apache 2.0 provenance instead of quietly laundering someone else's code into a new project.

For anyone building developer tools or exploring what's now cheap to prototype, this is a low-stakes but concrete data point: reading an unfamiliar codebase, spotting a reusable piece, and shipping it in a new form is now closer to a single well-aimed prompt than a multi-day porting project.

FAQ

Frequently asked questions

What is Grok CLI?
Grok CLI is xAI's terminal-based coding agent, recently open-sourced, giving developers access to its full implementation including internal utilities like the Mermaid diagram renderer discussed here.
Does the browser tool reimplement the Mermaid renderer in JavaScript?
No. It compiles the original Rust source from `xai-org/grok-build` (`mermaid.rs`) directly to a WebAssembly module, so the exact same rendering logic runs in the browser.
What is Fable 5?
Fable 5 is one of Anthropic's Claude 5-family models; it was used here via Claude Code for web to handle the Rust-to-WebAssembly build and packaging from a single prompt.

Sources

Share

Read next