Measured product lead custody receipt.
Encoding The Grammar Of Diagrams
Bounded structural diagram codec · ZPE-Diagram · PyPI zpe-diagram v0.1.0 · github.com/Zer0pa/ZPE-Diagram
Most diagram exports flatten a structured drawing into a picture. Six declared synthetic SVGs round-trip through ZPE-Diagram as explicit graph state — geometry, color, stroke width, and draw order all exact.
Three out-of-scope probes — fills, dashed strokes, palette escapes — are refused at the door instead of silently approximated. This is not compression and not a general SVG renderer. It is a bounded codec that keeps the rules that make a diagram readable as a diagram.

A diagram exported as an image loses the grammar that made it a diagram.
A diagram's grammar is the draw order, not the pixels.
Standard diagram exports preserve appearance, not intent. The file shows lines in roughly the right place while losing the structural roles, the connection types, and the order in which a person actually built the drawing.
ZPE-Diagram keeps the grammar. On six declared synthetic line-based SVGs, geometry, a frozen eight-color palette, quantized stroke width, and draw order all round-trip exactly. Three out-of-scope probes — fills, dashed strokes, palette escapes — are rejected at encode time rather than silently coerced into something they are not.
Six in-scope cases verified; three out-of-scope probes refused at encode.
Committed fixtures return the same bounded metrics.
Grammar here means something precise: the rules that make a drawing readable as a diagram rather than a pile of lines. Geometry encodes where elements sit. Style encodes how connections differ. Draw order encodes the sequence in which a person placed them. ZPE-Diagram keeps all three axes on committed fixtures and replays them byte-for-byte. On the bounded surface of six declared synthetic SVGs, structural, style, and draw-order fidelity each measure 1.000 — and the three out-of-scope probes never enter the packet.
No fill encode path. No dash encode path. No arbitrary SVG coverage. No compression claim. The current evidence is six synthetic fixtures plus three out-of-scope rejects. Real-world corpus closure, the is_diagram_header() boundary profile, and stroke-width normalization beyond the synthetic packet all remain open work.
DIAGRAMS with a receipt.
The ambition is to make exported diagrams behave like the structured objects their authors meant them to be: archivable, comparable, searchable by structure rather than by pixel. A docs team, a standards committee, or an engineering archive should be able to trust that the drawing they store is the drawing they later retrieve.