Skip to main content

diagonaldiagrams

PyPI License: MIT

diagonaldiagrams is a Python library and MCP server that lets an AI agent draw diagrams and charts as SVG, and check them for overlapping text, arrows through boxes and text that spills, before showing them.

Site: filmed examples, benchmarks and a gallery.

An architecture diagram drawn by diagonaldiagrams, with one chat request traced through an AI agent platform

How it works

  1. Describe. The agent writes a short description of the figure, in Mermaid, JSON or CSV.
  2. Draw. diagonaldiagrams lays it out and saves an SVG.
  3. Check. It audits the drawing and prints one line of JSON: all clear, or what is wrong and how to fix it. The agent reads that line instead of a screenshot.
$ diagonaldiagrams mermaid flow.mmd -o flow.svg
{"ok": true, "svg": "flow.svg", ..., "items": 3,
 "layout": ["row 1: Start", "row 2: Ready? (decision)", "row 3: Done"]}

When ok is false, each error comes with a fix.

Install

Needs Python 3.11 or newer.

Command line

pip install diagonaldiagrams

MCP (Cursor, Claude Desktop and other MCP apps). Add this to the app's MCP settings; it needs uv. The server is in the official MCP registry as io.github.lucas19919/diagonaldiagrams.

{
  "mcpServers": {
    "diagonaldiagrams": { "command": "uvx", "args": ["diagonaldiagrams", "mcp"] }
  }
}

Claude Desktop can also open the .mcpb file from the latest release.

Claude Code

/plugin marketplace add lucas19919/diagonaldiagrams
/plugin install diagonaldiagrams@diagonaldiagrams

Any other agent: tell it Install diagonaldiagrams from https://github.com/lucas19919/diagonaldiagrams. It follows the install skill, then draws with the drawing skill. The short version for models is llms.txt.

What it draws

Command Input Draws
mermaid flowchart, sequenceDiagram, erDiagram A flow, a sequence, or a schema
flow, arch, seq, schema JSON The same four, from a spec
iso JSON A layer stack in isometric 3D, with links between layers
bar, line, scatter CSV A comparison, a trend, a relationship
geo CSV or GeoJSON Places on a built-in coastline
chart <type> CSV or JSON About 60 more
  • describe <type> prints the spec shape for any figure type.
  • --fit column sizes a figure for a README or docs page. slide is the default, and page is for print.
  • story turns one figure into several views in one page, and --gif films it when ffmpeg is installed.
  • apply edits a spec with a JSON patch, and export writes PNG, PDF, draw.io or Excalidraw files.

How it compares

Measured on 2026-10-19 against Mermaid CLI and Pele, on version 0.8.0, with the same four flowcharts of 5 to 40 steps.

  • Speed. A 20-step flowchart takes 152 ms, about 15 times faster than Mermaid CLI (2,340 ms) and about 1.5 times slower than Pele (101 ms).
  • Tokens. An agent used 4.4k to 6.4k tokens per figure at every size. At 5 to 20 steps Pele and Mermaid CLI used fewer (1.3k to 4.0k). At 40 steps diagonaldiagrams used 6.4k, Pele 6.3k and Mermaid CLI 15.4k. This is two runs, so treat it as a small sample.
  • Quality. In blind pairs, diagonaldiagrams was judged clearer than Pele 85% of the time and than Mermaid CLI 97% of the time on slide-sized figures. It lost where an architecture translated from Mermaid was sized for a narrow column: 0 of 8 against Pele.

The full tables, the method and the scripts to rerun them are in bench/.

Develop

python -m unittest discover tests/unit   # unit tests
python tests_smoke.py                    # the command-line contract
python scripts/golden.py                 # the reference figures, byte for byte

How the engine is put together: docs/ARCHITECTURE.md. How releases are made: PUBLISHING.md.

License

MIT. See LICENSE.

Metadata

Release files for diagonaldiagrams 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diagonaldiagrams 0.9.1
File Size Uploaded Provenance Actions
diagonaldiagrams-0.9.1.tar.gz 369.2 kB With provenance Details for diagonaldiagrams-0.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for diagonaldiagrams 0.9.1
File Interpreter ABI Platform Actions
diagonaldiagrams-0.9.1-py3-none-any.whl Python 3 none any Details for diagonaldiagrams-0.9.1-py3-none-any.whl

Total release size: 737.2 kB

Release files / diagonaldiagrams-0.9.1.tar.gz

Download URL diagonaldiagrams-0.9.1.tar.gz
Size 369.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c79e8e1946f07fbb08e27b9ddf613a7e2942b526f017364c674ab90df0f1455e
BLAKE2b-256 checksum
How to use checksums
10354c297efd99f6e5e4f362af520e5189fd794028154b0f1a0719cc4e4f2128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / diagonaldiagrams-0.9.1-py3-none-any.whl

Download URL diagonaldiagrams-0.9.1-py3-none-any.whl
Size 368.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78f2cd33a439cf300d2a0f8f65385f102db678b4c6a1ec1b92c7698a8a4c15c4
BLAKE2b-256 checksum
How to use checksums
bc13c0e23cf6fe137b6bf2c3cb7ed846f1cda0b61dab92d9a0be8aa14abaebdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for diagonaldiagrams 0.9.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for diagonaldiagrams-0.9.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page