<mxfile host="app.diagrams.net" modified="2026-02-15T00:00:00.000Z" agent="Claude Code" version="24.0.0" type="device">
  <!-- ================================================================ -->
  <!-- TAB 1: HIGH-LEVEL ARCHITECTURE                                   -->
  <!-- ================================================================ -->
  <diagram id="arch" name="High-Level Architecture">
    <mxGraphModel dx="1422" dy="894" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1000" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <!-- TITLE -->
        <mxCell id="title" value="Gremlin — High-Level Architecture" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=22;fontStyle=1;fontColor=#1a1a2e;" vertex="1" parent="1">
          <mxGeometry x="500" y="20" width="400" height="40" as="geometry" />
        </mxCell>
        <mxCell id="subtitle" value="v0.2.0 — CLI + Python API + Claude Code Agent" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=12;fontColor=#666666;" vertex="1" parent="1">
          <mxGeometry x="530" y="55" width="340" height="20" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- ENTRY POINTS                    -->
        <!-- =============================== -->
        <mxCell id="entry-group" value="Entry Points" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#6c5ce7;strokeWidth=2;dashed=1;fontSize=11;fontStyle=1;fontColor=#6c5ce7;verticalAlign=top;spacingTop=2;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="130" y="90" width="1140" height="130" as="geometry" />
        </mxCell>

        <mxCell id="cli" value="&lt;b&gt;CLI&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;gremlin/cli.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Typer + Rich&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="170" y="125" width="180" height="70" as="geometry" />
        </mxCell>

        <mxCell id="api" value="&lt;b&gt;Python API&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;gremlin/api.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Gremlin class&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="410" y="125" width="180" height="70" as="geometry" />
        </mxCell>

        <mxCell id="agent" value="&lt;b&gt;Claude Code Agent&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;plugins/gremlin/agents/&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Code-review patterns&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="650" y="125" width="180" height="70" as="geometry" />
        </mxCell>

        <mxCell id="cicd" value="&lt;b&gt;CI/CD Integration&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;JUnit XML / JSON&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Exit codes&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="890" y="125" width="180" height="70" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- CORE ENGINE                     -->
        <!-- =============================== -->
        <mxCell id="core-group" value="Core Engine  (gremlin/core/)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#00b894;strokeWidth=2;dashed=1;fontSize=11;fontStyle=1;fontColor=#00b894;verticalAlign=top;spacingTop=2;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="130" y="270" width="860" height="150" as="geometry" />
        </mxCell>

        <mxCell id="inference" value="&lt;b&gt;Domain Inference&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;inference.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Keyword → Domain&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#00b894;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="155" y="310" width="180" height="70" as="geometry" />
        </mxCell>

        <mxCell id="patterns-node" value="&lt;b&gt;Pattern Selection&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;patterns.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Universal + Domain&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#00b894;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="375" y="310" width="180" height="70" as="geometry" />
        </mxCell>

        <mxCell id="prompts" value="&lt;b&gt;Prompt Builder&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;prompts.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;System + User msg&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#00b894;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="595" y="310" width="180" height="70" as="geometry" />
        </mxCell>

        <mxCell id="validator" value="&lt;b&gt;Validator&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;validator.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;2nd-pass filter&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#55efc4;fontColor=#2d3436;strokeColor=#00b894;strokeWidth=1;arcSize=20;shadow=1;dashed=1;dashPattern=8 8;" vertex="1" parent="1">
          <mxGeometry x="800" y="315" width="160" height="60" as="geometry" />
        </mxCell>

        <!-- Core arrows -->
        <mxCell id="e1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#00b894;strokeWidth=2;" edge="1" source="inference" target="patterns-node" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#00b894;strokeWidth=2;" edge="1" source="patterns-node" target="prompts" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="e3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#00b894;strokeWidth=2;dashed=1;" edge="1" source="prompts" target="validator" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- PATTERN STORE                   -->
        <!-- =============================== -->
        <mxCell id="store-group" value="Pattern Store  (107 patterns, 14 domains)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#fdcb6e;strokeWidth=2;dashed=1;fontSize=11;fontStyle=1;fontColor=#d4a017;verticalAlign=top;spacingTop=2;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="130" y="470" width="400" height="190" as="geometry" />
        </mxCell>

        <mxCell id="breaking" value="&lt;b&gt;breaking.yaml&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;14 domains + universal&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot; color=&quot;#999&quot;&gt;payments, auth, files,&lt;br&gt;database, api, search,&lt;br&gt;security, serialization,&lt;br&gt;distributed ...&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="150" y="510" width="160" height="130" as="geometry" />
        </mxCell>

        <mxCell id="incidents" value="&lt;b&gt;incidents/*.yaml&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Learned from&lt;br&gt;real incidents&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#999&quot;&gt;via gremlin learn&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="340" y="510" width="160" height="130" as="geometry" />
        </mxCell>

        <mxCell id="e-store" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#d4a017;strokeWidth=2;" edge="1" source="breaking" target="patterns-node" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="230" y="490" />
              <mxPoint x="465" y="490" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- =============================== -->
        <!-- LLM LAYER                       -->
        <!-- =============================== -->
        <mxCell id="llm-group" value="LLM Layer  (gremlin/llm/)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#e17055;strokeWidth=2;dashed=1;fontSize=11;fontStyle=1;fontColor=#e17055;verticalAlign=top;spacingTop=2;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="590" y="470" width="400" height="190" as="geometry" />
        </mxCell>

        <mxCell id="factory" value="&lt;b&gt;Provider Factory&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;factory.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Registry pattern&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e17055;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="620" y="510" width="160" height="60" as="geometry" />
        </mxCell>

        <mxCell id="anthropic" value="&lt;b&gt;Anthropic&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot;&gt;Claude Sonnet 4&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fab1a0;fontColor=#2d3436;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="620" y="590" width="100" height="50" as="geometry" />
        </mxCell>
        <mxCell id="openai-p" value="&lt;b&gt;OpenAI&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot;&gt;GPT-4&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffeaa7;fontColor=#2d3436;strokeColor=#e17055;strokeWidth=1;arcSize=20;shadow=1;dashed=1;dashPattern=5 5;" vertex="1" parent="1">
          <mxGeometry x="740" y="590" width="100" height="50" as="geometry" />
        </mxCell>
        <mxCell id="ollama-p" value="&lt;b&gt;Ollama&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot;&gt;Local LLMs&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffeaa7;fontColor=#2d3436;strokeColor=#e17055;strokeWidth=1;arcSize=20;shadow=1;dashed=1;dashPattern=5 5;" vertex="1" parent="1">
          <mxGeometry x="860" y="590" width="100" height="50" as="geometry" />
        </mxCell>

        <mxCell id="ef1" style="rounded=1;strokeColor=#e17055;strokeWidth=1.5;" edge="1" source="factory" target="anthropic" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="ef2" style="rounded=1;strokeColor=#e17055;strokeWidth=1.5;dashed=1;" edge="1" source="factory" target="openai-p" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="ef3" style="rounded=1;strokeColor=#e17055;strokeWidth=1.5;dashed=1;" edge="1" source="factory" target="ollama-p" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="e-prm-fac" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="prompts" target="factory" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="685" y="440" />
              <mxPoint x="700" y="440" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- =============================== -->
        <!-- OUTPUT LAYER                    -->
        <!-- =============================== -->
        <mxCell id="output-group" value="Output Layer" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#0984e3;strokeWidth=2;dashed=1;fontSize=11;fontStyle=1;fontColor=#0984e3;verticalAlign=top;spacingTop=2;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="130" y="710" width="860" height="130" as="geometry" />
        </mxCell>

        <mxCell id="parser" value="&lt;b&gt;Risk Parser&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;api.py:_parse_risks&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;MD → Risk objects&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="155" y="745" width="170" height="70" as="geometry" />
        </mxCell>

        <mxCell id="renderer" value="&lt;b&gt;Renderer&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;output/renderer.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Rich / Markdown / JSON&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="375" y="745" width="170" height="70" as="geometry" />
        </mxCell>

        <mxCell id="structured" value="&lt;b&gt;Structured Output&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;AnalysisResult&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;JSON / JUnit / LLM fmt&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="595" y="745" width="170" height="70" as="geometry" />
        </mxCell>

        <mxCell id="bridge" value="&lt;b&gt;Agent Bridge&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#ccc&quot;&gt;integrations/&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;CLI ↔ Agent&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="800" y="745" width="160" height="70" as="geometry" />
        </mxCell>

        <mxCell id="eo1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#0984e3;strokeWidth=2;" edge="1" source="parser" target="renderer" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="eo2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#0984e3;strokeWidth=2;" edge="1" source="parser" target="structured" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- LLM → Parser -->
        <mxCell id="e-llm-par" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="factory" target="parser" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="700" y="690" />
              <mxPoint x="240" y="690" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="lbl-resp" value="LLM Response (Markdown)" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#636e72;" vertex="1" parent="1">
          <mxGeometry x="380" y="672" width="150" height="20" as="geometry" />
        </mxCell>

        <!-- Entry → Core -->
        <mxCell id="ec1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="cli" target="inference" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="260" y="240" />
              <mxPoint x="245" y="240" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="ec2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="api" target="inference" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="500" y="240" />
              <mxPoint x="245" y="240" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- =============================== -->
        <!-- EVAL & TESTING                  -->
        <!-- =============================== -->
        <mxCell id="eval-group" value="Eval &amp; Testing" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#a29bfe;strokeWidth=2;dashed=1;fontSize=11;fontStyle=1;fontColor=#a29bfe;verticalAlign=top;spacingTop=2;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="1060" y="270" width="200" height="390" as="geometry" />
        </mxCell>

        <mxCell id="eval-runner" value="&lt;b&gt;Eval Runner&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;evals/run_eval.py&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot; color=&quot;#999&quot;&gt;A/B Gremlin vs Claude&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a29bfe;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="1080" y="310" width="160" height="60" as="geometry" />
        </mxCell>

        <mxCell id="eval-cases" value="&lt;b&gt;Test Cases&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;54 real-world YAML&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot; color=&quot;#999&quot;&gt;evals/cases/&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#dfe6e9;strokeColor=#a29bfe;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="1080" y="395" width="160" height="70" as="geometry" />
        </mxCell>

        <mxCell id="critiques" value="&lt;b&gt;Critiques&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;httpx, pydantic,&lt;br&gt;celery validation&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot; color=&quot;#999&quot;&gt;evals/critiques/&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#dfe6e9;strokeColor=#a29bfe;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="1080" y="490" width="160" height="80" as="geometry" />
        </mxCell>

        <mxCell id="ci" value="&lt;b&gt;CI Pipeline&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;GitHub Actions&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:9px&quot; color=&quot;#999&quot;&gt;pytest + ruff + coverage&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a29bfe;fontColor=#ffffff;strokeColor=none;arcSize=20;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="1080" y="590" width="160" height="60" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- EXTERNAL: Anthropic API cloud   -->
        <!-- =============================== -->
        <mxCell id="anthropic-api" value="&lt;b&gt;Anthropic API&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;claude-sonnet-4&lt;/font&gt;" style="shape=cloud;whiteSpace=wrap;html=1;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=1;fontSize=11;align=center;" vertex="1" parent="1">
          <mxGeometry x="1060" y="110" width="200" height="90" as="geometry" />
        </mxCell>

        <mxCell id="e-ext" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#d4a017;strokeWidth=2;dashed=1;" edge="1" source="anthropic" target="anthropic-api" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="670" y="670" />
              <mxPoint x="1040" y="670" />
              <mxPoint x="1040" y="155" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- =============================== -->
        <!-- LEGEND                          -->
        <!-- =============================== -->
        <mxCell id="legend-bg" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8f9fa;strokeColor=#dfe6e9;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="1060" y="710" width="210" height="130" as="geometry" />
        </mxCell>
        <mxCell id="legend-title" value="Legend" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=11;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="1070" y="715" width="50" height="20" as="geometry" />
        </mxCell>
        <mxCell id="ls1" value="" style="endArrow=classic;html=1;strokeColor=#636e72;strokeWidth=2;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="1075" y="748" as="sourcePoint" />
            <mxPoint x="1120" y="748" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ls1l" value="Data flow" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="1125" y="738" width="65" height="20" as="geometry" />
        </mxCell>
        <mxCell id="ls2" value="" style="endArrow=classic;html=1;strokeColor=#636e72;strokeWidth=2;dashed=1;" edge="1" parent="1">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="1075" y="770" as="sourcePoint" />
            <mxPoint x="1120" y="770" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="ls2l" value="Optional / Planned" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="1125" y="760" width="120" height="20" as="geometry" />
        </mxCell>
        <mxCell id="ls3" value="" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=10;fillColor=#ffeaa7;strokeColor=#d4a017;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="1075" y="790" width="35" height="20" as="geometry" />
        </mxCell>
        <mxCell id="ls3l" value="Static data file" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="1125" y="785" width="90" height="20" as="geometry" />
        </mxCell>
        <mxCell id="ls4" value="" style="shape=cloud;whiteSpace=wrap;html=1;fillColor=#ffeaa7;strokeColor=#d4a017;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="1072" y="813" width="40" height="22" as="geometry" />
        </mxCell>
        <mxCell id="ls4l" value="External API" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="1125" y="810" width="80" height="20" as="geometry" />
        </mxCell>

      </root>
    </mxGraphModel>
  </diagram>

  <!-- ================================================================ -->
  <!-- TAB 2: DATA FLOW                                                 -->
  <!-- ================================================================ -->
  <diagram id="dataflow" name="Data Flow">
    <mxGraphModel dx="1422" dy="894" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1100" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <!-- TITLE -->
        <mxCell id="df-title" value="Gremlin — Data Flow" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=22;fontStyle=1;fontColor=#1a1a2e;" vertex="1" parent="1">
          <mxGeometry x="560" y="20" width="280" height="40" as="geometry" />
        </mxCell>
        <mxCell id="df-subtitle" value="Request lifecycle from user input to structured risk output" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=12;fontColor=#666666;" vertex="1" parent="1">
          <mxGeometry x="470" y="55" width="370" height="20" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 1: USER INPUT              -->
        <!-- =============================== -->
        <mxCell id="step1-label" value="① User Input" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#6c5ce7;" vertex="1" parent="1">
          <mxGeometry x="100" y="90" width="110" height="25" as="geometry" />
        </mxCell>

        <mxCell id="user-input" value="&lt;b&gt;User Input&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;scope: &quot;checkout flow&quot;&lt;br&gt;context: @src/checkout.py&lt;br&gt;depth: quick | deep&lt;br&gt;threshold: 80&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;fontColor=#ffffff;strokeColor=none;arcSize=15;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="100" y="120" width="200" height="90" as="geometry" />
        </mxCell>

        <mxCell id="ctx-resolve" value="&lt;b&gt;Context Resolution&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;String → direct&lt;br&gt;@file → read file&lt;br&gt;- → read stdin&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a29bfe;fontColor=#ffffff;strokeColor=none;arcSize=15;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="370" y="120" width="170" height="90" as="geometry" />
        </mxCell>

        <mxCell id="ea1" value="scope + context" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;fontSize=10;fontColor=#636e72;" edge="1" source="user-input" target="ctx-resolve" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 2: DOMAIN INFERENCE        -->
        <!-- =============================== -->
        <mxCell id="step2-label" value="② Domain Inference" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#00b894;" vertex="1" parent="1">
          <mxGeometry x="100" y="250" width="160" height="25" as="geometry" />
        </mxCell>

        <mxCell id="scope-str" value="&lt;font style=&quot;font-size:11px&quot;&gt;&lt;b&gt;&quot;checkout flow&quot;&lt;/b&gt;&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dfe6e9;strokeColor=#b2bec3;shadow=0;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="100" y="285" width="170" height="35" as="geometry" />
        </mxCell>

        <mxCell id="kw-match" value="&lt;b&gt;Keyword Matching&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;scope_lower → domain_keywords&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#999&quot;&gt;&quot;checkout&quot; → &lt;/font&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#00b894&quot;&gt;[payments]&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#999&quot;&gt;&quot;auth login&quot; → &lt;/font&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#00b894&quot;&gt;[auth]&lt;/font&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#999&quot;&gt;&quot;upload s3&quot; → &lt;/font&gt;&lt;font style=&quot;font-size:10px&quot; color=&quot;#00b894&quot;&gt;[files, infrastructure]&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#00b894;fontColor=#ffffff;strokeColor=none;arcSize=15;shadow=1;" vertex="1" parent="1">
          <mxGeometry x="350" y="270" width="250" height="110" as="geometry" />
        </mxCell>

        <mxCell id="domains-out" value="&lt;font style=&quot;font-size:11px&quot;&gt;&lt;b&gt;matched_domains&lt;/b&gt;&lt;br&gt;[&quot;payments&quot;]&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#55efc4;strokeColor=#00b894;shadow=0;fontSize=11;fontColor=#2d3436;" vertex="1" parent="1">
          <mxGeometry x="680" y="290" width="160" height="45" as="geometry" />
        </mxCell>

        <mxCell id="ea2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="scope-str" target="kw-match" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="ea3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="kw-match" target="domains-out" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 3: PATTERN SELECTION       -->
        <!-- =============================== -->
        <mxCell id="step3-label" value="③ Pattern Selection" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#d4a017;" vertex="1" parent="1">
          <mxGeometry x="100" y="420" width="160" height="25" as="geometry" />
        </mxCell>

        <mxCell id="yaml-store" value="&lt;b&gt;breaking.yaml&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;107 patterns&lt;br&gt;14 domains&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="100" y="455" width="130" height="80" as="geometry" />
        </mxCell>

        <mxCell id="incidents-store" value="&lt;b&gt;incidents/&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;*.yaml&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="100" y="555" width="130" height="55" as="geometry" />
        </mxCell>

        <mxCell id="selector" value="&lt;b&gt;select_patterns()&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;1. Always include &lt;b&gt;universal&lt;/b&gt; patterns&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(Boundary, State, Timing ...)&lt;br&gt;&lt;br&gt;2. Add &lt;b&gt;domain-specific&lt;/b&gt; for&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;each matched domain&lt;br&gt;&lt;br&gt;3. Merge &lt;b&gt;incident&lt;/b&gt; patterns&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(deduplicated)&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fdcb6e;fontColor=#2d3436;strokeColor=#d4a017;arcSize=12;shadow=1;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="310" y="440" width="250" height="180" as="geometry" />
        </mxCell>

        <mxCell id="selected-out" value="&lt;b&gt;selected_patterns&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;universal: [...],&lt;br&gt;&amp;nbsp;&amp;nbsp;domain: {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;payments: [...]&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=0;fontSize=11;fontColor=#2d3436;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="640" y="460" width="190" height="120" as="geometry" />
        </mxCell>

        <mxCell id="ea4" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#d4a017;strokeWidth=2;" edge="1" source="yaml-store" target="selector" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="ea5" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#d4a017;strokeWidth=2;" edge="1" source="incidents-store" target="selector" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="ea6" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="domains-out" target="selector" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="760" y="410" />
              <mxPoint x="435" y="410" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="ea7" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="selector" target="selected-out" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 4: PROMPT BUILDING         -->
        <!-- =============================== -->
        <mxCell id="step4-label" value="④ Prompt Construction" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#e17055;" vertex="1" parent="1">
          <mxGeometry x="100" y="660" width="180" height="25" as="geometry" />
        </mxCell>

        <mxCell id="sys-prompt" value="&lt;b&gt;system.md&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;Gremlin persona&lt;br&gt;+ output format&lt;/font&gt;" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=15;fillColor=#fab1a0;strokeColor=#e17055;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="100" y="695" width="130" height="70" as="geometry" />
        </mxCell>

        <mxCell id="builder" value="&lt;b&gt;build_prompt()&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;&lt;b&gt;system_prompt =&lt;/b&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;persona + patterns YAML&lt;br&gt;&lt;br&gt;&lt;b&gt;user_message =&lt;/b&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;scope + depth + threshold&lt;br&gt;&amp;nbsp;&amp;nbsp;+ optional context&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e17055;fontColor=#ffffff;strokeColor=none;arcSize=12;shadow=1;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="310" y="680" width="250" height="140" as="geometry" />
        </mxCell>

        <mxCell id="prompt-out" value="&lt;b&gt;Constructed Prompt&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;(system_prompt, user_message)&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#fab1a0;strokeColor=#e17055;shadow=0;fontSize=11;fontColor=#2d3436;" vertex="1" parent="1">
          <mxGeometry x="640" y="720" width="210" height="45" as="geometry" />
        </mxCell>

        <mxCell id="ea8" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#e17055;strokeWidth=2;" edge="1" source="sys-prompt" target="builder" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="ea9" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="selected-out" target="builder" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="735" y="640" />
              <mxPoint x="435" y="640" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="ea9b" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="ctx-resolve" target="builder" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="560" y="165" />
              <mxPoint x="600" y="165" />
              <mxPoint x="600" y="750" />
              <mxPoint x="560" y="750" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="ea10" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="builder" target="prompt-out" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 5: LLM CALL               -->
        <!-- =============================== -->
        <mxCell id="step5-label" value="⑤ LLM Call" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#e17055;" vertex="1" parent="1">
          <mxGeometry x="920" y="660" width="90" height="25" as="geometry" />
        </mxCell>

        <mxCell id="llm-call" value="&lt;b&gt;Anthropic API&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;messages.create()&lt;br&gt;model: claude-sonnet-4&lt;br&gt;max_tokens: 4096&lt;/font&gt;" style="shape=cloud;whiteSpace=wrap;html=1;fillColor=#ffeaa7;strokeColor=#d4a017;shadow=1;fontSize=11;align=center;" vertex="1" parent="1">
          <mxGeometry x="910" y="695" width="220" height="110" as="geometry" />
        </mxCell>

        <mxCell id="ea11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="prompt-out" target="llm-call" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 6: RESPONSE PARSING        -->
        <!-- =============================== -->
        <mxCell id="step6-label" value="⑥ Response Parsing" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#0984e3;" vertex="1" parent="1">
          <mxGeometry x="920" y="430" width="160" height="25" as="geometry" />
        </mxCell>

        <mxCell id="raw-md" value="&lt;b&gt;Raw Markdown&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;## 🔴 CRITICAL (95%)&lt;br&gt;**Title**&lt;br&gt;&amp;gt; What if ...?&lt;br&gt;- **Impact:** ...&lt;br&gt;- **Domain:** ...&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dfe6e9;strokeColor=#b2bec3;shadow=0;fontSize=11;fontColor=#2d3436;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="930" y="460" width="190" height="110" as="geometry" />
        </mxCell>

        <mxCell id="ea12" value="LLMResponse.text" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;fontSize=10;fontColor=#636e72;" edge="1" source="llm-call" target="raw-md" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <mxCell id="risk-parser" value="&lt;b&gt;_parse_risks()&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;1. Split by ## / ### headers&lt;br&gt;2. Regex: severity + confidence&lt;br&gt;3. Extract **Title**&lt;br&gt;4. Extract &amp;gt; scenario&lt;br&gt;5. Extract **Impact**&lt;br&gt;6. Extract **Domain**&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=12;shadow=1;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="1200" y="455" width="220" height="130" as="geometry" />
        </mxCell>

        <mxCell id="ea13" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#636e72;strokeWidth=2;" edge="1" source="raw-md" target="risk-parser" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- STEP 7: STRUCTURED OUTPUT       -->
        <!-- =============================== -->
        <mxCell id="step7-label" value="⑦ Structured Output" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=13;fontStyle=1;fontColor=#0984e3;" vertex="1" parent="1">
          <mxGeometry x="920" y="90" width="160" height="25" as="geometry" />
        </mxCell>

        <mxCell id="risk-obj" value="&lt;b&gt;Risk&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;severity: &quot;CRITICAL&quot;&lt;br&gt;confidence: 95&lt;br&gt;scenario: &quot;What if...&quot;&lt;br&gt;impact: &quot;...&quot;&lt;br&gt;title: &quot;...&quot;&lt;br&gt;domains: [...]&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#74b9ff;fontColor=#2d3436;strokeColor=#0984e3;arcSize=12;shadow=1;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="920" y="120" width="175" height="120" as="geometry" />
        </mxCell>

        <mxCell id="result-obj" value="&lt;b&gt;AnalysisResult&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;scope, risks[], domains&lt;br&gt;pattern_count, depth&lt;br&gt;&lt;br&gt;.to_json()&lt;br&gt;.to_junit()&lt;br&gt;.format_for_llm()&lt;br&gt;.has_critical_risks()&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#74b9ff;fontColor=#2d3436;strokeColor=#0984e3;arcSize=12;shadow=1;align=left;spacingLeft=10;" vertex="1" parent="1">
          <mxGeometry x="1150" y="115" width="190" height="130" as="geometry" />
        </mxCell>

        <mxCell id="ea14" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#0984e3;strokeWidth=2;" edge="1" source="risk-parser" target="risk-obj" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="1310" y="380" />
              <mxPoint x="1008" y="380" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="lbl-list" value="List[Risk]" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#0984e3;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="1100" y="360" width="70" height="20" as="geometry" />
        </mxCell>

        <mxCell id="ea15" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#0984e3;strokeWidth=2;" edge="1" source="risk-obj" target="result-obj" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Output formats -->
        <mxCell id="out-json" value="&lt;b&gt;JSON&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=30;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="1400" y="120" width="80" height="30" as="geometry" />
        </mxCell>
        <mxCell id="out-junit" value="&lt;b&gt;JUnit XML&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=30;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="1400" y="160" width="80" height="30" as="geometry" />
        </mxCell>
        <mxCell id="out-llm" value="&lt;b&gt;LLM fmt&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;fontColor=#ffffff;strokeColor=none;arcSize=30;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="1400" y="200" width="80" height="30" as="geometry" />
        </mxCell>
        <mxCell id="out-rich" value="&lt;b&gt;Rich TUI&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;fontColor=#ffffff;strokeColor=none;arcSize=30;shadow=1;fontSize=11;" vertex="1" parent="1">
          <mxGeometry x="1400" y="240" width="80" height="30" as="geometry" />
        </mxCell>

        <mxCell id="eo1" style="rounded=1;strokeColor=#0984e3;strokeWidth=1.5;" edge="1" source="result-obj" target="out-json" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="eo2" style="rounded=1;strokeColor=#0984e3;strokeWidth=1.5;" edge="1" source="result-obj" target="out-junit" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="eo3" style="rounded=1;strokeColor=#0984e3;strokeWidth=1.5;" edge="1" source="result-obj" target="out-llm" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="eo4" style="rounded=1;strokeColor=#6c5ce7;strokeWidth=1.5;" edge="1" source="result-obj" target="out-rich" parent="1">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- =============================== -->
        <!-- OPTIONAL VALIDATION PATH        -->
        <!-- =============================== -->
        <mxCell id="val-label" value="Optional: --validate" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#636e72;fontStyle=2;" vertex="1" parent="1">
          <mxGeometry x="1190" y="660" width="130" height="20" as="geometry" />
        </mxCell>

        <mxCell id="val-pass" value="&lt;b&gt;Validation Pass&lt;/b&gt;&lt;br&gt;&lt;font style=&quot;font-size:10px&quot;&gt;2nd LLM call filters&lt;br&gt;hallucinated risks&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#55efc4;fontColor=#2d3436;strokeColor=#00b894;strokeWidth=1;arcSize=15;shadow=1;dashed=1;dashPattern=8 8;" vertex="1" parent="1">
          <mxGeometry x="1190" y="685" width="180" height="65" as="geometry" />
        </mxCell>

        <mxCell id="ea-val1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#00b894;strokeWidth=2;dashed=1;" edge="1" source="raw-md" target="val-pass" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="1025" y="600" />
              <mxPoint x="1170" y="600" />
              <mxPoint x="1170" y="718" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="ea-val2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#00b894;strokeWidth=2;dashed=1;" edge="1" source="val-pass" target="risk-parser" parent="1">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="1420" y="718" />
              <mxPoint x="1420" y="520" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- =============================== -->
        <!-- LEGEND                          -->
        <!-- =============================== -->
        <mxCell id="df-legend-bg" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8f9fa;strokeColor=#dfe6e9;arcSize=12;" vertex="1" parent="1">
          <mxGeometry x="100" y="830" width="500" height="85" as="geometry" />
        </mxCell>
        <mxCell id="df-legend-title" value="Legend" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=11;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="110" y="835" width="50" height="20" as="geometry" />
        </mxCell>

        <mxCell id="lg1" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#6c5ce7;strokeColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="115" y="862" width="30" height="15" as="geometry" />
        </mxCell>
        <mxCell id="lg1l" value="User / CLI" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="150" y="857" width="70" height="20" as="geometry" />
        </mxCell>

        <mxCell id="lg2" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#00b894;strokeColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="225" y="862" width="30" height="15" as="geometry" />
        </mxCell>
        <mxCell id="lg2l" value="Core Engine" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="260" y="857" width="80" height="20" as="geometry" />
        </mxCell>

        <mxCell id="lg3" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fdcb6e;strokeColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="340" y="862" width="30" height="15" as="geometry" />
        </mxCell>
        <mxCell id="lg3l" value="Patterns" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="375" y="857" width="55" height="20" as="geometry" />
        </mxCell>

        <mxCell id="lg4" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e17055;strokeColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="115" y="888" width="30" height="15" as="geometry" />
        </mxCell>
        <mxCell id="lg4l" value="LLM / Prompt" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="150" y="883" width="85" height="20" as="geometry" />
        </mxCell>

        <mxCell id="lg5" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#0984e3;strokeColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="240" y="888" width="30" height="15" as="geometry" />
        </mxCell>
        <mxCell id="lg5l" value="Output / Parsing" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="275" y="883" width="100" height="20" as="geometry" />
        </mxCell>

        <mxCell id="lg6" value="" style="shape=cloud;whiteSpace=wrap;html=1;fillColor=#ffeaa7;strokeColor=#d4a017;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="380" y="885" width="40" height="22" as="geometry" />
        </mxCell>
        <mxCell id="lg6l" value="External API" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" vertex="1" parent="1">
          <mxGeometry x="425" y="883" width="80" height="20" as="geometry" />
        </mxCell>

      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
