A text-based diagram definition lives alongside the code or docs it describes, goes through the same pull-request review as everything else, and produces a readable git diff when it changes — unlike a raster image, which produces a meaningless binary diff and requires full regeneration to fix a single error. Mermaid is the most common diagram-as-code syntax that AI coding agents generate natively, though the same text-first approach applies to tools like Graphviz and PlantUML.