{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    { "type": "text", "id": "title", "x": 320, "y": 15, "text": "AI Agent Flow Map", "fontSize": 28 },
    { "type": "text", "id": "subtitle", "x": 180, "y": 53, "text": "15 agent automation workflows. Agents need structured JSON (-J), exit codes, and field selection.", "fontSize": 14, "strokeColor": "#868e96" },

    { "type": "text", "id": "col-trigger", "x": 60, "y": 80, "text": "TRIGGER (Agent Goal)", "fontSize": 16, "strokeColor": "#495057" },
    { "type": "text", "id": "col-flow", "x": 400, "y": 80, "text": "COMMAND PIPELINE", "fontSize": 16, "strokeColor": "#495057" },
    { "type": "text", "id": "col-gap", "x": 880, "y": 80, "text": "BLOCKED BY", "fontSize": 16, "strokeColor": "#ef4444" },

    { "type": "rectangle", "id": "zone-context", "x": 20, "y": 110, "width": 960, "height": 200,
      "backgroundColor": "#e5dbff", "fillStyle": "solid", "roundness": { "type": 3 },
      "strokeColor": "#8b5cf6", "strokeWidth": 1, "opacity": 20 },
    { "type": "text", "id": "zone-context-label", "x": 30, "y": 115, "text": "Context Gathering (pre-action)", "fontSize": 14, "strokeColor": "#7048e8" },

    { "type": "rectangle", "id": "a1-trigger", "x": 30, "y": 140, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A1: Pre-edit context\nAbout to modify files", "fontSize": 14 } },
    { "type": "arrow", "id": "a1-a1", "x": 230, "y": 165, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a1-cmd1", "x": 280, "y": 145, "width": 80, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J health", "fontSize": 14 } },
    { "type": "arrow", "id": "a1-a2", "x": 360, "y": 165, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a1-cmd2", "x": 380, "y": 145, "width": 140, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J who src/auth/", "fontSize": 14 } },
    { "type": "arrow", "id": "a1-a3", "x": 520, "y": 165, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a1-cmd3", "x": 540, "y": 145, "width": 170, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J search \"auth\" -n 10", "fontSize": 14 } },
    { "type": "arrow", "id": "a1-a4", "x": 710, "y": 165, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a1-cmd4", "x": 730, "y": 145, "width": 130, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J who --overlap", "fontSize": 14 } },

    { "type": "rectangle", "id": "a6-trigger", "x": 30, "y": 210, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A6: Auto-assign reviewers\nBased on file expertise", "fontSize": 14 } },
    { "type": "arrow", "id": "a6-a1", "x": 230, "y": 235, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a6-cmd1", "x": 280, "y": 215, "width": 100, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#ffd8a8", "fillStyle": "solid",
      "label": { "text": "-J mrs 456", "fontSize": 14 } },
    { "type": "text", "id": "a6-block", "x": 390, "y": 218, "text": "file list not\nin response!", "fontSize": 12, "strokeColor": "#ef4444" },
    { "type": "arrow", "id": "a6-a2", "x": 380, "y": 245, "width": 480, "height": -10,
      "points": [[0,0],[480,-10]], "endArrowhead": "arrow", "strokeColor": "#ef4444", "strokeStyle": "dashed" },
    { "type": "rectangle", "id": "a6-gap", "x": 860, "y": 210, "width": 110, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "strokeColor": "#ef4444",
      "label": { "text": "MR files\nnot exposed", "fontSize": 14 } },

    { "type": "rectangle", "id": "zone-report", "x": 20, "y": 320, "width": 960, "height": 200,
      "backgroundColor": "#d3f9d8", "fillStyle": "solid", "roundness": { "type": 3 },
      "strokeColor": "#22c55e", "strokeWidth": 1, "opacity": 20 },
    { "type": "text", "id": "zone-report-label", "x": 30, "y": 325, "text": "Reporting & Synthesis", "fontSize": 14, "strokeColor": "#15803d" },

    { "type": "rectangle", "id": "a3-trigger", "x": 30, "y": 350, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A3: Sprint status report\n7 queries for 1 report", "fontSize": 14 } },
    { "type": "arrow", "id": "a3-a1", "x": 230, "y": 375, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a3-cmd1", "x": 280, "y": 352, "width": 100, "height": 36,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "issues -s closed", "fontSize": 12 } },
    { "type": "rectangle", "id": "a3-cmd2", "x": 390, "y": 352, "width": 100, "height": 36,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "issues --status", "fontSize": 12 } },
    { "type": "rectangle", "id": "a3-cmd3", "x": 500, "y": 352, "width": 100, "height": 36,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "mrs -s merged", "fontSize": 12 } },
    { "type": "rectangle", "id": "a3-cmd4", "x": 610, "y": 352, "width": 80, "height": 36,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "mrs -s open", "fontSize": 12 } },
    { "type": "rectangle", "id": "a3-cmd5", "x": 700, "y": 352, "width": 80, "height": 36,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "count x2", "fontSize": 12 } },
    { "type": "rectangle", "id": "a3-cmd6", "x": 790, "y": 352, "width": 60, "height": 36,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "who", "fontSize": 12 } },
    { "type": "arrow", "id": "a3-agap", "x": 850, "y": 370, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a3-gap", "x": 860, "y": 350, "width": 110, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "strokeColor": "#ef4444",
      "label": { "text": "No summary\ncommand", "fontSize": 14 } },
    { "type": "text", "id": "a3-note", "x": 280, "y": 395, "text": "7 sequential API calls for one report. A `lore summary` could reduce to 1.", "fontSize": 12, "strokeColor": "#868e96" },

    { "type": "rectangle", "id": "a7-trigger", "x": 30, "y": 430, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A7: Incident timeline\nPostmortem reconstruction", "fontSize": 14 } },
    { "type": "arrow", "id": "a7-a1", "x": 230, "y": 455, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a7-cmd1", "x": 280, "y": 435, "width": 190, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J timeline --depth 2", "fontSize": 14 } },
    { "type": "arrow", "id": "a7-a2", "x": 470, "y": 455, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a7-cmd2", "x": 490, "y": 435, "width": 170, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J search --since 3d", "fontSize": 14 } },
    { "type": "arrow", "id": "a7-a3", "x": 660, "y": 455, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a7-cmd3", "x": 680, "y": 435, "width": 170, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J mrs -s merged", "fontSize": 14 } },

    { "type": "rectangle", "id": "zone-discover", "x": 20, "y": 530, "width": 960, "height": 200,
      "backgroundColor": "#fff3bf", "fillStyle": "solid", "roundness": { "type": 3 },
      "strokeColor": "#f59e0b", "strokeWidth": 1, "opacity": 20 },
    { "type": "text", "id": "zone-discover-label", "x": 30, "y": 535, "text": "Discovery & Correlation", "fontSize": 14, "strokeColor": "#b45309" },

    { "type": "rectangle", "id": "a5-trigger", "x": 30, "y": 560, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A5: PR description\nFind related issues to link", "fontSize": 14 } },
    { "type": "arrow", "id": "a5-a1", "x": 230, "y": 585, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a5-cmd1", "x": 280, "y": 565, "width": 170, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J search keywords", "fontSize": 14 } },
    { "type": "arrow", "id": "a5-a2", "x": 450, "y": 585, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a5-cmd2", "x": 470, "y": 565, "width": 180, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J issues --fields iid,url", "fontSize": 14 } },
    { "type": "arrow", "id": "a5-a3", "x": 650, "y": 585, "width": 210, "height": 0,
      "points": [[0,0],[210,0]], "endArrowhead": "arrow", "strokeColor": "#ef4444", "strokeStyle": "dashed" },
    { "type": "rectangle", "id": "a5-gap", "x": 860, "y": 560, "width": 110, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "strokeColor": "#ef4444",
      "label": { "text": "No refs\nquery", "fontSize": 14 } },
    { "type": "text", "id": "a5-note", "x": 280, "y": 612, "text": "Agent can't ask \"which issues does MR !456 close?\" -- entity_references data exists but isn't queryable.", "fontSize": 12, "strokeColor": "#868e96" },

    { "type": "rectangle", "id": "a11-trigger", "x": 30, "y": 640, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A11: Knowledge graph\nMap entity relationships", "fontSize": 14 } },
    { "type": "arrow", "id": "a11-a1", "x": 230, "y": 665, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a11-cmd1", "x": 280, "y": 645, "width": 140, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J search -n 30", "fontSize": 14 } },
    { "type": "arrow", "id": "a11-a2", "x": 420, "y": 665, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a11-cmd2", "x": 440, "y": 645, "width": 190, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J timeline --depth 2", "fontSize": 14 } },
    { "type": "arrow", "id": "a11-a3", "x": 630, "y": 665, "width": 230, "height": 0,
      "points": [[0,0],[230,0]], "endArrowhead": "arrow", "strokeColor": "#ef4444", "strokeStyle": "dashed" },
    { "type": "rectangle", "id": "a11-gap", "x": 860, "y": 640, "width": 110, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "strokeColor": "#ef4444",
      "label": { "text": "No refs\nquery", "fontSize": 14 } },

    { "type": "rectangle", "id": "zone-maint", "x": 20, "y": 740, "width": 960, "height": 140,
      "backgroundColor": "#dbe4ff", "fillStyle": "solid", "roundness": { "type": 3 },
      "strokeColor": "#4a9eed", "strokeWidth": 1, "opacity": 20 },
    { "type": "text", "id": "zone-maint-label", "x": 30, "y": 745, "text": "Maintenance & Cleanup", "fontSize": 14, "strokeColor": "#1971c2" },

    { "type": "rectangle", "id": "a9-trigger", "x": 30, "y": 770, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A9: Stale issue cleanup\nWeekly backlog hygiene", "fontSize": 14 } },
    { "type": "arrow", "id": "a9-a1", "x": 230, "y": 795, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a9-cmd1", "x": 280, "y": 775, "width": 200, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J issues --sort updated --asc", "fontSize": 12 } },
    { "type": "arrow", "id": "a9-a2", "x": 480, "y": 795, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a9-cmd2", "x": 500, "y": 775, "width": 120, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#ffd8a8", "fillStyle": "solid",
      "label": { "text": "filter client-side", "fontSize": 14 } },
    { "type": "arrow", "id": "a9-a3", "x": 620, "y": 795, "width": 240, "height": 0,
      "points": [[0,0],[240,0]], "endArrowhead": "arrow", "strokeColor": "#ef4444", "strokeStyle": "dashed" },
    { "type": "rectangle", "id": "a9-gap", "x": 860, "y": 770, "width": 110, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "strokeColor": "#ef4444",
      "label": { "text": "No --before\nNo offset", "fontSize": 14 } },

    { "type": "rectangle", "id": "a15-trigger", "x": 30, "y": 840, "width": 200, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid",
      "label": { "text": "A15: Conflict detect\n\"Safe to start work?\"", "fontSize": 14 } },
    { "type": "arrow", "id": "a15-a1", "x": 230, "y": 865, "width": 50, "height": 0,
      "points": [[0,0],[50,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a15-cmd1", "x": 280, "y": 845, "width": 110, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J issues 123", "fontSize": 14 } },
    { "type": "arrow", "id": "a15-a2", "x": 390, "y": 865, "width": 20, "height": 0,
      "points": [[0,0],[20,0]], "endArrowhead": "arrow" },
    { "type": "rectangle", "id": "a15-cmd2", "x": 410, "y": 845, "width": 130, "height": 40,
      "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid",
      "label": { "text": "-J who --overlap", "fontSize": 14 } },
    { "type": "arrow", "id": "a15-a3", "x": 540, "y": 865, "width": 320, "height": 0,
      "points": [[0,0],[320,0]], "endArrowhead": "arrow", "strokeColor": "#ef4444", "strokeStyle": "dashed" },
    { "type": "rectangle", "id": "a15-gap", "x": 860, "y": 840, "width": 110, "height": 50,
      "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "strokeColor": "#ef4444",
      "label": { "text": "No refs +\n--state", "fontSize": 14 } },

    { "type": "text", "id": "callout-1", "x": 30, "y": 910, "text": "Agent-specific pain: Agents always use -J and --fields minimal for token efficiency. Every extra query burns tokens.", "fontSize": 14, "strokeColor": "#495057" },
    { "type": "text", "id": "callout-2", "x": 30, "y": 935, "text": "Biggest ROI: `lore refs` command would unblock A5, A11, A12, A15 instantly. Data already exists in entity_references table.", "fontSize": 14, "strokeColor": "#15803d" },
    { "type": "text", "id": "callout-3", "x": 30, "y": 960, "text": "Token waste: Sprint report (A3) requires 7 calls. A composite `lore summary` could save ~85% of tokens.", "fontSize": 14, "strokeColor": "#ef4444" }
  ],
  "appState": { "viewBackgroundColor": "#ffffff", "gridSize": null },
  "files": {}
}