<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="eli.ai" agent="eli.ai diagram exporter" version="1">
  <diagram id="ai-template-generation-d3f7aea7" name="AI template generation">
    <mxGraphModel dx="1600" dy="1200" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1200" math="0" shadow="0">
      <root>
        <mxCell id="0"/>
        <object id="1" label="AI template generation" schemaVersion="1" diagramId="ai-template-generation-d3f7aea7" canonicalAppearanceKey="md:docs/architecture/workspace/08-capture-templates.md#5" sourceSha256="d3f7aea7e2717cc3c0f15b6af7ca4308569933a8921ced6698accd7b144b59d2" metadataPayloadSha256="e4edd68bf2ace0a10d51a3ecd0cbdbfff7f2ebf40e78356d07167260b3eedb1f" generationKey="801eabadab5d41bda487c653a202e3452c098fcd61d7797b126ca67067558524" concepts="[&quot;Capture templates&quot;]" keywords="[&quot;MCP agent&quot;,&quot;generateTemplateAction (templates-ai.ts)&quot;,&quot;apply_template tool (template.ts)&quot;,&quot;storage.applyTemplate (adapter)&quot;,&quot;Template engine (parser.ts + apply.ts)&quot;,&quot;write (templates-ai.ts:130)&quot;,&quot;apply_template with template, path, vars&quot;,&quot;parse into tokens (parser.ts:53)&quot;,&quot;createNote at destination path (writes.ts:475)&quot;,&quot;Template editor UI&quot;,&quot;AI gateway (smart tier)&quot;,&quot;template body, token usage recorded (templates-ai.ts:106)&quot;,&quot;upsert note at with _template true (templates-ai.ts:145)&quot;,&quot;storage.applyTemplate(templateId, path + vars) (template.ts:53)&quot;,&quot;applyTemplate(source, vars, now)&quot;,&quot;.eli/templates&quot;,&quot;.eli/templates/id.md&quot;,&quot;vault/.eli/templates/typeName.md&quot;,&quot;.eli/templates/typeName.md&quot;,&quot;date/var/prompt&quot;,&quot;literal/date/var/prompt&quot;,&quot;storage&quot;,&quot;resolveAiKey - fail fast with no AI key configured (templates-ai.ts:85)&quot;,&quot;ok, path, body, modelId - row inserted optimistically (editor.tsx:115)&quot;,&quot;read - missing gives Template not found isError (writes.ts:456)&quot;,&quot;Note&quot;]" application="{&quot;name&quot;:&quot;eli-ai&quot;,&quot;version&quot;:&quot;0.1.0&quot;}" packages="{&quot;mermaid&quot;:&quot;11.16.0&quot;,&quot;mermaidCli&quot;:&quot;11.16.0&quot;,&quot;playwright&quot;:&quot;1.62.1&quot;,&quot;playwrightCore&quot;:&quot;1.62.1&quot;,&quot;puppeteer&quot;:&quot;25.6.0&quot;,&quot;puppeteerCore&quot;:&quot;25.6.0&quot;}" environment="{&quot;architecture&quot;:&quot;x64&quot;,&quot;containerImage&quot;:&quot;playwright:v1.62.1-noble@sha256:c091b21d9fae78c76e85cd4356431e9b018402f172a214fc7d7a5e9a7e29d8ac+node:26.3.1-bookworm-slim@sha256:209558c3e5e40e8adff68959d3c2ba7cd73723e716d89196878a0c362fa1e109&quot;,&quot;node&quot;:&quot;v26.3.1&quot;,&quot;platform&quot;:&quot;linux&quot;,&quot;yarn&quot;:&quot;4.17.1&quot;}" renderer="{&quot;browser&quot;:{&quot;executableSha256&quot;:&quot;0b20b130e7edd9dd51873be867761295fe0cfad490c2b9a64f95bd3cfc08fa71&quot;,&quot;name&quot;:&quot;chromium&quot;,&quot;revision&quot;:&quot;1234&quot;,&quot;version&quot;:&quot;151.0.7922.34&quot;},&quot;font&quot;:{&quot;family&quot;:&quot;Eli Diagram Inter Variable&quot;,&quot;fileSha256&quot;:&quot;3100e775e8616cd2611beecfa23a4263d7037586789b43f035236a2e6fbd4c62&quot;,&quot;licenseSha256&quot;:&quot;3b0a5fca3d17942cde889069889dedbbbd075e9b599968c82a95f4d944e9b345&quot;},&quot;mermaidConfigSha256&quot;:&quot;68c10966fe84406ee626034d58bfabd555df9f65f691204b7c46db24038da101&quot;,&quot;themeCssSha256&quot;:&quot;c80287a78d80ad63d27bd5ca348b2ef9a7e2f44da289e436be6484ea28a1b033&quot;}" adapterVersions="{&quot;diagramGenerator&quot;:&quot;2&quot;,&quot;drawioFlowchart&quot;:&quot;1&quot;,&quot;drawioGantt&quot;:&quot;1&quot;,&quot;drawioSequence&quot;:&quot;1&quot;,&quot;drawioState&quot;:&quot;1&quot;}" mermaidType="sequence" generatedAt="2026-08-12T23:36:38.933Z" mermaidSource="sequenceDiagram&#10;    participant E as Template editor UI&#10;    participant GA as generateTemplateAction (templates-ai.ts)&#10;    participant AIG as AI gateway (smart tier)&#10;    participant TF as .eli/templates storage&#10;    participant A as MCP agent&#10;    participant T as apply_template tool (template.ts)&#10;    participant SAD as storage.applyTemplate (adapter)&#10;    participant ENG as Template engine (parser.ts + apply.ts)&#10;&#10;    E-&gt;&gt;GA: Generate with AI, typeName + optional hint (id regex checked, editor.tsx:101)&#10;    GA-&gt;&gt;GA: resolveAiKey - fail fast with no AI key configured (templates-ai.ts:85)&#10;    GA-&gt;&gt;AIG: generateText, system prompt teaches date/var/prompt placeholder syntax (templates-ai.ts:93)&#10;    AIG--&gt;&gt;GA: template body, token usage recorded (templates-ai.ts:106)&#10;    GA-&gt;&gt;GA: strip code fences, force-prepend frontmatter block if absent (templates-ai.ts:121)&#10;    alt local mode&#10;        GA-&gt;&gt;TF: write vault/.eli/templates/typeName.md (templates-ai.ts:130)&#10;    else saas mode&#10;        GA-&gt;&gt;TF: upsert note at .eli/templates/typeName.md with _template true (templates-ai.ts:145)&#10;    end&#10;    GA--&gt;&gt;E: ok, path, body, modelId - row inserted optimistically (editor.tsx:115)&#10;&#10;    A-&gt;&gt;T: apply_template with template, path, vars&#10;    T-&gt;&gt;SAD: storage.applyTemplate(templateId, path + vars) (template.ts:53)&#10;    alt local mode (LocalAdapter)&#10;        SAD-&gt;&gt;TF: read .eli/templates/id.md - missing gives Template not found isError (writes.ts:456)&#10;        SAD-&gt;&gt;ENG: applyTemplate(source, vars, now)&#10;        ENG-&gt;&gt;ENG: parse into literal/date/var/prompt tokens (parser.ts:53)&#10;        ENG-&gt;&gt;ENG: date tokens - Day.js format translated to date-fns then rendered (apply.ts:66)&#10;        ENG-&gt;&gt;ENG: var tokens substituted, missing ones left in place + missingVars list (apply.ts:149)&#10;        ENG-&gt;&gt;ENG: prompt tokens resolve verbatim to (TODO question) - aiPromptRuntime still throws (prompt-runtime.ts:59)&#10;        ENG--&gt;&gt;SAD: rendered source, frontmatter re-parsed, underscore keys stripped (apply.ts:115)&#10;        SAD-&gt;&gt;SAD: createNote at destination path (writes.ts:475)&#10;        SAD--&gt;&gt;T: Note&#10;        T--&gt;&gt;A: serialized note + structuredContent id, path, template, version_id (template.ts:57)&#10;    else saas mode (SupabaseAdapter)&#10;        SAD--&gt;&gt;T: NotImplementedError Phase 6 templates, surfaced as isError (supabase.ts:195)&#10;    end">
          <mxCell parent="0"/>
        </object>
        <object id="c:i9" label="alt [local mode] / [saas mode]" mermaidId="i9" mermaidShape="frame">
          <mxCell parent="1" vertex="1" style="collapsible=0;container=1;dashed=1;fillColor=none;fontColor=#333333;html=1;recursiveResize=0;rounded=0;strokeColor=#9370DB;whiteSpace=wrap;">
            <mxGeometry x="767" y="385" width="1042.5" height="190" as="geometry"/>
          </mxCell>
        </object>
        <object id="c:i26" label="alt [local mode (LocalAdapter)] / [saas mode (SupabaseAdapter)]" mermaidId="i26" mermaidShape="frame">
          <mxCell parent="1" vertex="1" style="collapsible=0;container=1;dashed=1;fillColor=none;fontColor=#333333;html=1;recursiveResize=0;rounded=0;strokeColor=#9370DB;whiteSpace=wrap;">
            <mxGeometry x="1787.5" y="735" width="2710.5" height="790" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:ENG" label="Template engine (parser.ts + apply.ts)" mermaidId="ENG" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="3935" y="0" width="306" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:SAD" label="storage.applyTemplate (adapter)" mermaidId="SAD" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="3282.5" y="0" width="267" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:T" label="apply_template tool (template.ts)" mermaidId="T" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="2616.5" y="0" width="265" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:A" label="MCP agent" mermaidId="A" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="1940" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:TF" label=".eli/templates storage" mermaidId="TF" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="1707" y="0" width="183" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:AIG" label="AI gateway (smart tier)" mermaidId="AIG" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="1465" y="0" width="192" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:GA" label="generateTemplateAction (templates-ai.ts)" mermaidId="GA" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="612" y="0" width="332" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:E" label="Template editor UI" mermaidId="E" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="0" y="0" width="158" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="e:lifeline:ENG" label="" mermaidId="lifeline:ENG" mermaidKind="lifeline">
          <mxCell parent="1" source="n:ENG" target="n:ENG" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="4088" y="65" as="sourcePoint"/>
              <mxPoint x="4088" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:SAD" label="" mermaidId="lifeline:SAD" mermaidKind="lifeline">
          <mxCell parent="1" source="n:SAD" target="n:SAD" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="3416" y="65" as="sourcePoint"/>
              <mxPoint x="3416" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:T" label="" mermaidId="lifeline:T" mermaidKind="lifeline">
          <mxCell parent="1" source="n:T" target="n:T" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="2749" y="65" as="sourcePoint"/>
              <mxPoint x="2749" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:A" label="" mermaidId="lifeline:A" mermaidKind="lifeline">
          <mxCell parent="1" source="n:A" target="n:A" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="2015" y="65" as="sourcePoint"/>
              <mxPoint x="2015" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:TF" label="" mermaidId="lifeline:TF" mermaidKind="lifeline">
          <mxCell parent="1" source="n:TF" target="n:TF" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1798.5" y="65" as="sourcePoint"/>
              <mxPoint x="1798.5" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:AIG" label="" mermaidId="lifeline:AIG" mermaidKind="lifeline">
          <mxCell parent="1" source="n:AIG" target="n:AIG" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1561" y="65" as="sourcePoint"/>
              <mxPoint x="1561" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:GA" label="" mermaidId="lifeline:GA" mermaidKind="lifeline">
          <mxCell parent="1" source="n:GA" target="n:GA" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="778" y="65" as="sourcePoint"/>
              <mxPoint x="778" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:E" label="" mermaidId="lifeline:E" mermaidKind="lifeline">
          <mxCell parent="1" source="n:E" target="n:E" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="79" y="65" as="sourcePoint"/>
              <mxPoint x="79" y="1545" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i0" label="Generate with AI, typeName + optional hint (id regex checked, editor.tsx:101)" mermaidId="i0" mermaidKind="message">
          <mxCell parent="1" source="n:E" target="n:GA" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="80" y="115" as="sourcePoint"/>
              <mxPoint x="774" y="115" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i1" label="resolveAiKey - fail fast with no AI key configured (templates-ai.ts:85)" mermaidId="i1" mermaidKind="message">
          <mxCell parent="1" source="n:GA" target="n:GA" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="779" y="165" as="sourcePoint"/>
              <mxPoint x="779" y="185" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="839" y="155"/>
                <mxPoint x="839" y="195"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i2" label="generateText, system prompt teaches date/var/prompt placeholder syntax (templates-ai.ts:93)" mermaidId="i2" mermaidKind="message">
          <mxCell parent="1" source="n:GA" target="n:AIG" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="779" y="245" as="sourcePoint"/>
              <mxPoint x="1557" y="245" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i3" label="template body, token usage recorded (templates-ai.ts:106)" mermaidId="i3" mermaidKind="message">
          <mxCell parent="1" source="n:AIG" target="n:GA" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1560" y="295" as="sourcePoint"/>
              <mxPoint x="782" y="295" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i4" label="strip code fences, force-prepend frontmatter block if absent (templates-ai.ts:121)" mermaidId="i4" mermaidKind="message">
          <mxCell parent="1" source="n:GA" target="n:GA" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="779" y="345" as="sourcePoint"/>
              <mxPoint x="779" y="365" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="839" y="335"/>
                <mxPoint x="839" y="375"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i6" label="write vault/.eli/templates/typeName.md (templates-ai.ts:130)" mermaidId="i6" mermaidKind="message">
          <mxCell parent="1" source="n:GA" target="n:TF" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="779" y="470" as="sourcePoint"/>
              <mxPoint x="1794.5" y="470" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i8" label="upsert note at .eli/templates/typeName.md with _template true (templates-ai.ts:145)" mermaidId="i8" mermaidKind="message">
          <mxCell parent="1" source="n:GA" target="n:TF" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="779" y="565" as="sourcePoint"/>
              <mxPoint x="1794.5" y="565" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i10" label="ok, path, body, modelId - row inserted optimistically (editor.tsx:115)" mermaidId="i10" mermaidKind="message">
          <mxCell parent="1" source="n:GA" target="n:E" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="777" y="625" as="sourcePoint"/>
              <mxPoint x="83" y="625" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i11" label="apply_template with template, path, vars" mermaidId="i11" mermaidKind="message">
          <mxCell parent="1" source="n:A" target="n:T" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="2016" y="675" as="sourcePoint"/>
              <mxPoint x="2745" y="675" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i12" label="storage.applyTemplate(templateId, path + vars) (template.ts:53)" mermaidId="i12" mermaidKind="message">
          <mxCell parent="1" source="n:T" target="n:SAD" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="2750" y="725" as="sourcePoint"/>
              <mxPoint x="3412" y="725" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i14" label="read .eli/templates/id.md - missing gives Template not found isError (writes.ts:456)" mermaidId="i14" mermaidKind="message">
          <mxCell parent="1" source="n:SAD" target="n:TF" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="3415" y="820" as="sourcePoint"/>
              <mxPoint x="1802.5" y="820" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i15" label="applyTemplate(source, vars, now)" mermaidId="i15" mermaidKind="message">
          <mxCell parent="1" source="n:SAD" target="n:ENG" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="3417" y="870" as="sourcePoint"/>
              <mxPoint x="4084" y="870" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i16" label="parse into literal/date/var/prompt tokens (parser.ts:53)" mermaidId="i16" mermaidKind="message">
          <mxCell parent="1" source="n:ENG" target="n:ENG" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="4089" y="920" as="sourcePoint"/>
              <mxPoint x="4089" y="940" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="4149" y="910"/>
                <mxPoint x="4149" y="950"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i17" label="date tokens - Day.js format translated to date-fns then rendered (apply.ts:66)" mermaidId="i17" mermaidKind="message">
          <mxCell parent="1" source="n:ENG" target="n:ENG" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="4089" y="1000" as="sourcePoint"/>
              <mxPoint x="4089" y="1020" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="4149" y="990"/>
                <mxPoint x="4149" y="1030"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i18" label="var tokens substituted, missing ones left in place + missingVars list (apply.ts:149)" mermaidId="i18" mermaidKind="message">
          <mxCell parent="1" source="n:ENG" target="n:ENG" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="4089" y="1080" as="sourcePoint"/>
              <mxPoint x="4089" y="1100" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="4149" y="1070"/>
                <mxPoint x="4149" y="1110"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i19" label="prompt tokens resolve verbatim to (TODO question) - aiPromptRuntime still throws (prompt-runtime.ts:59)" mermaidId="i19" mermaidKind="message">
          <mxCell parent="1" source="n:ENG" target="n:ENG" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="4089" y="1160" as="sourcePoint"/>
              <mxPoint x="4089" y="1180" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="4149" y="1150"/>
                <mxPoint x="4149" y="1190"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i20" label="rendered source, frontmatter re-parsed, underscore keys stripped (apply.ts:115)" mermaidId="i20" mermaidKind="message">
          <mxCell parent="1" source="n:ENG" target="n:SAD" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="4087" y="1240" as="sourcePoint"/>
              <mxPoint x="3420" y="1240" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i21" label="createNote at destination path (writes.ts:475)" mermaidId="i21" mermaidKind="message">
          <mxCell parent="1" source="n:SAD" target="n:SAD" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="3417" y="1290" as="sourcePoint"/>
              <mxPoint x="3417" y="1310" as="targetPoint"/>
              <Array as="points">
                <mxPoint x="3477" y="1280"/>
                <mxPoint x="3477" y="1320"/>
              </Array>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i22" label="Note" mermaidId="i22" mermaidKind="message">
          <mxCell parent="1" source="n:SAD" target="n:T" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="3415" y="1370" as="sourcePoint"/>
              <mxPoint x="2753" y="1370" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i23" label="serialized note + structuredContent id, path, template, version_id (template.ts:57)" mermaidId="i23" mermaidKind="message">
          <mxCell parent="1" source="n:T" target="n:A" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="2748" y="1420" as="sourcePoint"/>
              <mxPoint x="2019" y="1420" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i25" label="NotImplementedError Phase 6 templates, surfaced as isError (supabase.ts:195)" mermaidId="i25" mermaidKind="message">
          <mxCell parent="1" source="n:SAD" target="n:T" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="3415" y="1515" as="sourcePoint"/>
              <mxPoint x="2753" y="1515" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
