<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="drawio" version="26.0.0">
  <diagram name="SymForge Architecture">
    <mxGraphModel dx="1422" dy="794" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1400" pageHeight="1100" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />

        <!-- Title -->
        <mxCell id="2" value="SymForge v8 — Local-First Code Intelligence MCP" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontStyle=1;fontSize=18;" vertex="1" parent="1">
          <mxGeometry x="300" y="10" width="800" height="40" as="geometry" />
        </mxCell>

        <!-- CLIENT LAYER -->
        <mxCell id="10" value="MCP Clients" style="swimlane;startSize=30;fillColor=#f5f5f5;strokeColor=#666666;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="60" width="1320" height="110" as="geometry" />
        </mxCell>
        <mxCell id="11" value="Cursor / Claude Code" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;dashed=1;" vertex="1" parent="10">
          <mxGeometry x="120" y="45" width="200" height="50" as="geometry" />
        </mxCell>
        <mxCell id="12" value="Codex CLI" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;dashed=1;" vertex="1" parent="10">
          <mxGeometry x="400" y="45" width="160" height="50" as="geometry" />
        </mxCell>
        <mxCell id="13" value="Gemini CLI" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;dashed=1;" vertex="1" parent="10">
          <mxGeometry x="620" y="45" width="160" height="50" as="geometry" />
        </mxCell>
        <mxCell id="14" value="Other MCP hosts" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;dashed=1;" vertex="1" parent="10">
          <mxGeometry x="840" y="45" width="180" height="50" as="geometry" />
        </mxCell>

        <!-- TRANSPORT LAYER -->
        <mxCell id="20" value="Transport &amp; Entry Points" style="swimlane;startSize=30;fillColor=#ffe6cc;strokeColor=#d79b00;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="200" width="1320" height="130" as="geometry" />
        </mxCell>
        <mxCell id="21" value="stdio MCP&#xa;(rmcp transport-io)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="20">
          <mxGeometry x="80" y="45" width="220" height="60" as="geometry" />
        </mxCell>
        <mxCell id="22" value="HTTP /mcp&#xa;(symforge serve)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="20">
          <mxGeometry x="380" y="45" width="220" height="60" as="geometry" />
        </mxCell>
        <mxCell id="23" value="Sidecar HTTP&#xa;(pre-read / post-edit hooks)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="20">
          <mxGeometry x="680" y="45" width="240" height="60" as="geometry" />
        </mxCell>
        <mxCell id="24" value="CLI&#xa;(init, setup, harness)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="20">
          <mxGeometry x="1000" y="45" width="200" height="60" as="geometry" />
        </mxCell>

        <!-- PROTOCOL LAYER -->
        <mxCell id="30" value="MCP Protocol Surface (src/protocol + src/stel)" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="360" width="1320" height="200" as="geometry" />
        </mxCell>
        <mxCell id="31" value="SymForgeServer&#xa;ToolRouter + PromptRouter&#xa;SessionContext + CCR" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;" vertex="1" parent="30">
          <mxGeometry x="480" y="50" width="280" height="80" as="geometry" />
        </mxCell>
        <mxCell id="32" value="STEL compact-3&#xa;symforge | symforge_edit | status&#xa;L1 plan → L2 economics → L3 serve → L4 ledger" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="30">
          <mxGeometry x="80" y="50" width="320" height="80" as="geometry" />
        </mxCell>
        <mxCell id="33" value="Tools (default compact-3)&#xa;35 tools via SYMFORGE_SURFACE=full&#xa;read · search · edit · index · health" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="30">
          <mxGeometry x="840" y="50" width="280" height="80" as="geometry" />
        </mxCell>
        <mxCell id="34" value="Resources&#xa;symforge://repo/* · file/* · symbol/*" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="30">
          <mxGeometry x="200" y="145" width="280" height="45" as="geometry" />
        </mxCell>
        <mxCell id="35" value="Prompts&#xa;review · architecture · triage · onboard · refactor · debug" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="30">
          <mxGeometry x="560" y="145" width="280" height="45" as="geometry" />
        </mxCell>
        <mxCell id="36" value="ServerRuntime&#xa;Auth + Governor + dispatch" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="30">
          <mxGeometry x="920" y="145" width="240" height="45" as="geometry" />
        </mxCell>

        <!-- RUNTIME LAYER -->
        <mxCell id="40" value="Runtime Modes" style="swimlane;startSize=30;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="590" width="1320" height="130" as="geometry" />
        </mxCell>
        <mxCell id="41" value="Local in-process&#xa;LiveIndex + Watcher in MCP process&#xa;Fallback when daemon unreachable" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="40">
          <mxGeometry x="120" y="45" width="340" height="70" as="geometry" />
        </mxCell>
        <mxCell id="42" value="Shared Daemon (src/daemon)&#xa;Project-aware axum HTTP backend&#xa;Per-session tool proxy + auth token" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;" vertex="1" parent="40">
          <mxGeometry x="530" y="45" width="340" height="70" as="geometry" />
        </mxCell>
        <mxCell id="43" value="Embed facade (src/embed)&#xa;Engine-only build for library embedders&#xa;No daemon / sidecar / MCP server" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;dashed=1;" vertex="1" parent="40">
          <mxGeometry x="940" y="45" width="320" height="70" as="geometry" />
        </mxCell>

        <!-- ENGINE LAYER -->
        <mxCell id="50" value="Core Engine (always compiled)" style="swimlane;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="750" width="1320" height="160" as="geometry" />
        </mxCell>
        <mxCell id="51" value="LiveIndex&#xa;In-memory symbols + refs&#xa;query · search · rank" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;" vertex="1" parent="50">
          <mxGeometry x="60" y="45" width="200" height="90" as="geometry" />
        </mxCell>
        <mxCell id="52" value="Parsing&#xa;tree-sitter + ast-grep&#xa;20+ languages" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="50">
          <mxGeometry x="300" y="45" width="180" height="90" as="geometry" />
        </mxCell>
        <mxCell id="53" value="Watcher&#xa;notify debouncer&#xa;incremental re-index" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="50">
          <mxGeometry x="520" y="45" width="180" height="90" as="geometry" />
        </mxCell>
        <mxCell id="54" value="Git&#xa;what_changed · diff_symbols&#xa;co-change coupling" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="50">
          <mxGeometry x="740" y="45" width="180" height="90" as="geometry" />
        </mxCell>
        <mxCell id="55" value="Edit Safety&#xa;structural edits&#xa;idempotency · tee" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="50">
          <mxGeometry x="960" y="45" width="180" height="90" as="geometry" />
        </mxCell>
        <mxCell id="56" value="Discovery + Capability&#xa;workspace root · worktree routing" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="50">
          <mxGeometry x="1180" y="45" width="120" height="90" as="geometry" />
        </mxCell>

        <!-- PERSISTENCE LAYER -->
        <mxCell id="60" value="Local Persistence (.symforge/)" style="swimlane;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="940" width="1320" height="120" as="geometry" />
        </mxCell>
        <mxCell id="61" value="index.bin&#xa;snapshot + checkpoint_now" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="60">
          <mxGeometry x="120" y="40" width="180" height="70" as="geometry" />
        </mxCell>
        <mxCell id="62" value="stel_ledger.db&#xa;economics (serve)" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="60">
          <mxGeometry x="400" y="40" width="180" height="70" as="geometry" />
        </mxCell>
        <mxCell id="63" value="analytics.db&#xa;tool telemetry" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="60">
          <mxGeometry x="680" y="40" width="180" height="70" as="geometry" />
        </mxCell>
        <mxCell id="64" value="quarantine/&#xa;bad snapshots isolated" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="60">
          <mxGeometry x="960" y="40" width="180" height="70" as="geometry" />
        </mxCell>

        <!-- EDGES: Client to Transport -->
        <mxCell id="100" value="MCP JSON-RPC" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.25;entryY=0;" edge="1" parent="1" source="11" target="21">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="101" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="12" target="21">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="102" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.75;entryY=0;" edge="1" parent="1" source="13" target="22">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="103" value="hooks" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;entryX=0.5;entryY=0;dashed=1;" edge="1" parent="1" source="11" target="23">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Transport to Protocol -->
        <mxCell id="110" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="21" target="31">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="111" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="22" target="36">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="112" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.25;entryY=0;" edge="1" parent="1" source="23" target="51">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="800" y="720" />
              <mxPoint x="160" y="720" />
            </Array>
          </mxGeometry>
        </mxCell>

        <!-- Protocol internal -->
        <mxCell id="120" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;entryX=0;entryY=0.5;" edge="1" parent="1" source="32" target="31">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="121" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;entryX=1;entryY=0.5;" edge="1" parent="1" source="33" target="31">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="122" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="36" target="31">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Protocol to Runtime -->
        <mxCell id="130" value="local mode" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="31" target="41">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="131" value="daemon proxy" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="31" target="42">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Runtime to Engine -->
        <mxCell id="140" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.15;entryY=0;" edge="1" parent="1" source="41" target="51">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="141" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="42" target="51">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Engine internal flow -->
        <mxCell id="150" value="parse" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;entryX=0;entryY=0.5;" edge="1" parent="1" source="52" target="51">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="151" value="watch" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;entryX=1;entryY=0.5;" edge="1" parent="1" source="53" target="51">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="152" value="rank" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;entryX=1;entryY=0.5;" edge="1" parent="1" source="54" target="51">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="153" value="mutate" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;entryX=1;entryY=0.75;" edge="1" parent="1" source="55" target="51">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Engine to Persistence -->
        <mxCell id="160" value="checkpoint" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="51" target="61">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>
        <mxCell id="161" value="L4 events" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;dashed=1;" edge="1" parent="1" source="32" target="62">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="220" y="900" />
              <mxPoint x="490" y="900" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="162" value="observe" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;entryX=0.5;entryY=0;dashed=1;" edge="1" parent="1" source="31" target="63">
          <mxGeometry relative="1" as="geometry">
            <Array as="points">
              <mxPoint x="620" y="900" />
              <mxPoint x="770" y="900" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="163" value="quarantine" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;entryX=0;entryY=0.5;dashed=1;strokeColor=#b85450;" edge="1" parent="1" source="61" target="64">
          <mxGeometry relative="1" as="geometry" />
        </mxCell>

        <!-- Legend -->
        <mxCell id="70" value="Legend" style="swimlane;startSize=24;fillColor=#ffffff;strokeColor=#999999;" vertex="1" parent="1">
          <mxGeometry x="1080" y="60" width="280" height="110" as="geometry" />
        </mxCell>
        <mxCell id="71" value="" style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;html=1;strokeWidth=2;" edge="1" parent="70">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="20" y="40" as="sourcePoint" />
            <mxPoint x="80" y="40" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="72" value="Primary data / request flow" style="text;html=1;strokeColor=none;fillColor=none;align=left;" vertex="1" parent="70">
          <mxGeometry x="90" y="28" width="180" height="24" as="geometry" />
        </mxCell>
        <mxCell id="73" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;dashed=1;" edge="1" parent="70">
          <mxGeometry relative="1" as="geometry">
            <mxPoint x="20" y="70" as="sourcePoint" />
            <mxPoint x="80" y="70" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="74" value="Secondary / optional path" style="text;html=1;strokeColor=none;fillColor=none;align=left;" vertex="1" parent="70">
          <mxGeometry x="90" y="58" width="180" height="24" as="geometry" />
        </mxCell>
        <mxCell id="75" value="Dashed box = external / opt-out" style="text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=11;" vertex="1" parent="70">
          <mxGeometry x="20" y="82" width="240" height="20" as="geometry" />
        </mxCell>

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