VMD is an open draft for Intent-Readable Visual-Lossless Markup.
The goal is not to make Markdown prettier. The goal is to make visual documents small and safe for AI to read and edit, while still giving the browser enough information to restore the original visual output.
HTML/CSS artifact
-> visual-lossless VMD
-> AI-readable source layer
-> renderer-readable replay layer
-> restored browser output
A document may call itself visual-lossless only if the renderer can restore
the target visual output under the declared lock.
Compression is useful only after that condition is met. If a structured source layer is not enough, the VMD file must carry replay, residual, or raw fallback data until restoration passes.
The optimization target is:
the smallest complete-restoration format that an LLM can still understand and edit safely
That gives VMD three priorities:
- Complete visual restoration
- LLM-readable and LLM-editable structure
- Compression of the AI-facing source layer
VMD has two reading paths inside one .vmd file.
This is the part an AI model should read and edit:
@doc: document contract and fidelity tier::intent: audience, purpose, editable slots, non-editable constraints@tokens: design tokens that affect the document::frameand component blocks: the editable visible structure@residual_index: the replay constraints the AI must respect@edit_stateor@dirty: whether source edits have invalidated replay data
This is the part the renderer uses to restore the original browser output:
@lock: renderer, dictionary, browser, viewport, source hash, render hash@recipes: known component and layout recipes@replay: encoded DOM, CSS, layout, asset, and state replay contract@residual: lossless data not represented by source slots@raw: fallback source when replay cannot be compacted yet
AI systems should not edit @residual or @raw directly. They should edit the
source slots and respect @residual_index.
Visual-lossless restoration is guaranteed for the locked source state, not for arbitrary future edits. After an AI changes the source layer, affected replay or residual data may be stale. The document must mark the affected slots dirty and the renderer must rerender, remeasure, regenerate replay/residual data, and update hashes before the edited document can claim visual-lossless status again.
@doc "Pulse Analytics Overview" {
spec: vmd@0.1
fidelity: visual-lossless
intent: analytics-dashboard
surfaces: browser-page deck pdf
}
@lock {
renderer: vmd-web@0.3.0
renderer-hash: sha256:renderer-placeholder
dictionary: dashboard-system@1.0.0
dictionary-hash: sha256:dictionary-placeholder
browser: chromium
viewport: 1440x1200
dpr: 1
font-pack: inter@4.0.0
asset-map-hash: sha256:asset-placeholder
source-hash: sha256:source-placeholder
render-hash: sha256:render-placeholder
}
@edit_state {
source: clean
replay: current
dirty: none
on-source-edit: mark affected slots stale, rerender, remeasure, update-render-hash
}
# Pulse Analytics Overview
::intent
audience: growth team
purpose: scan revenue, accounts, and recent events quickly
editable: title, metrics, tables, events, date range
::
@tokens.editable {
accent: #c96442
surface: #ffffff
}
@tokens.locked {
border: #e6e4e0
title.line-height: 1.05
}
::frame[role="dashboard-overview" recipe="analytics.workspace"]
title: Overview - April 2026
::component.card[title="Revenue - 30 days"]
value: $842k
change: +14.6%
::
::component.card[title="New accounts"]
value: 42
change: +8
::
::
@residual_index {
affected:
- frame.dashboard-overview.title
- frame.dashboard-overview.component.metric-grid
constraints:
frame.dashboard-overview.title.max-lines: 2
frame.dashboard-overview.component.metric-grid.items: 2..4
ai-note: Edit source slots only. Do not edit replay data directly.
}
@replay {
encoding: visual-replay@0.1
contains:
- dom-delta
- css-cascade
- layout-boxes
- asset-map
- state-lock
}
@residual {
mode: visual-lossless
ai: ignore
payload: omitted in this public sample
}
HTML and CSS are excellent browser targets. They are not always good AI editing targets. A polished generated page often contains a large implementation surface: utility classes, nested wrappers, repeated styles, inline layout decisions, and component details that obscure the document's intent.
VMD keeps the browser output restorable, but moves routine AI edits to a smaller source layer. The renderer and replay layer carry the low-level details.
Markdown is compact and readable, but it does not contain enough visual contract to restore a complex browser page. VMD keeps Markdown-style readability where it helps, then adds frames, components, tokens, constraints, and replay data.
The current Open Design experiment is a prototype, not the finished codec.
- Cases: 102 AI-generated HTML artifacts
- Original HTML: 3031.8 KB
- AI source slot layer: 485.7 KB, 84.0% smaller than HTML
- Full prototype VMD with replay/residual: 1527.3 KB, 49.6% smaller than HTML
- GPT-4 token estimate: slot source reduced 83.2%; full prototype reduced 39.5%
- Current prototype round-trip pixel-equivalent cases: 46/102
The result is important but limited: the AI-facing layer is already much smaller, but the lossless replay codec is not complete. The public spec therefore treats complete restoration as a validity requirement, not as a nice-to-have.
The same benchmark also clarifies the edit rule: a file can be lossless at the current source hash and stale after an AI edit. Editability therefore requires dirty-state tracking and replay refresh, not only initial decoding.
See docs/open-design-ai-artifact-benchmark.md and
docs/visual-fidelity.md.
core/: shared parser, validator, and reference rendererextension/: Chrome reference polyfill and manual viewervscode-extension/: VS Code authoring and preview extensionsamples/visual-lossless-dashboard.vmd: visual-lossless samplesamples/source-layer-brief.vmd: compact source-layer sampledocs/spec-draft-v0.md: current draft grammar and restoration contractdocs/visual-fidelity.md: visual restoration verification modeldocs/open-design-ai-artifact-benchmark.md: AI artifact compression and fidelity benchmarkdocs/ai-authoring-guide.md: how AI systems should edit VMDdocs/browser-integration.md: Chrome rendering behaviordocs/extension-architecture.md: extension designdocs/testing.md: local verification workflowtools/verify-vmd-fidelity.mjs: Playwright visual drift checkertools/benchmark-ai-artifacts.mjs: Open Design benchmark scriptbin/vmd.mjs: CLI for validate, AST, render, and gallery builds
Requires Node.js 18 or newer.
npm install
npm run checkRun the core renderer tests:
npm run test:coreRender a sample:
npm run render:sampleValidate a VMD file:
node bin/vmd.mjs validate samples/visual-lossless-dashboard.vmd --strictThe Chrome extension is a reference polyfill for .vmd files.
It supports:
- automatic rendering for local or hosted
.vmdfiles - a manual viewer with upload and drag-and-drop
- read, deck, and map preview modes
- validator diagnostics
- packaged source-layer, layered, and visual-lossless samples
Install locally:
- Open
chrome://extensions - Enable
Developer mode - Click
Load unpacked - Select the
extension/directory - Enable
Allow access to file URLsin the extension details page - Open a
.vmdfile in Chrome
Package it:
npm run package:chromeThe VS Code extension supports:
.vmdlanguage detection- syntax highlighting and folding
- visual-lossless shell snippets
- directive snippets for
@lock,@tokens,@residual_index,@replay, and@residual - validator diagnostics
- live preview with read, deck, and map modes
Package it:
npm run package:vscodeThe public project page is:
https://philo.kim/vmd/
Build the repository gallery:
npm run build:siteVMD is an experimental public draft. The current implementation parses and renders the final visual-lossless document contract, but the replay codec is still a research target. Until the replay codec is complete, a file should only claim verified visual-lossless status when its restoration check passes under the declared renderer lock.
Useful contributions include:
- visual-lossless sample documents
- HTML-to-VMD conversion experiments
- replay/residual codec design
- renderer lock and verification improvements
- LLM editability benchmarks
- Chrome and VS Code extension improvements
- accessibility and browser portability feedback