Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

Flora: A Diagram Library Built with (and for) AI

Flora is an open-source diagram library optimized for AI-generated diagrams, using deterministic SVG output and layout algorithms that large language models can reliably produce. It compresses to under 600 prompt tokens, enabling reasoning models to memorise it for single-shot diagram generation.

Background

- **Flora** is a new open-source diagramming library designed specifically for use by AI coding agents (like Cursor, Copilot, or custom LLM-based tools), not just for human developers. - The library is built with **Mermaid.js**, a popular text-to-diagram tool that lets you write diagram definitions as plain text (e.g., `graph TD; A-->B`). Mermaid is widely used in documentation and AI outputs because its text-based format is easy for both humans and LLMs to generate. - The key insight: most existing diagram tools are optimized for visual manipulation by humans (drag-and-drop, clicking, etc.), which LLMs cannot do. Flora aims to solve this by providing a declarative, text-based API that AI agents can reliably produce and manipulate, and by integrating with LLMs through structured outputs (e.g., JSON schemas or function-calling). - This matters because AI-assisted coding is booming, but generating accurate, editable diagrams programmatically remains a weak point — human developers still have to manually fix or recreate AI-generated diagrams. Flora represents an attempt to close that gap by making diagrams a first-class output for AI agents.

Related stories