{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Email Agent — One-Page Family Inbox Triage",
    "output": "docs/email-agent-map.html",
    "quality_profile": "showcase",
    "viewBox": [1780, 1000],
    "views": [
      {
        "id": "triage-loop",
        "label": "Triage loop",
        "focus": ["sam", "caddy", "ui", "gmail", "db"],
        "note": "Sam opens one page. The app reads Gmail and stores every message."
      },
      {
        "id": "classify-reply",
        "label": "Classify and reply",
        "focus": ["ui", "jev", "omni", "gmail"],
        "note": "JEV labels each message. OmniRoute drafts the reply. SMTP sends it."
      },
      {
        "id": "hub-summary",
        "label": "Hub and summary",
        "focus": ["hub", "api", "db", "jobs", "apprise", "n8n"],
        "note": "The Hub asks read-only questions. CLI jobs send the daily summary."
      }
    ]
  },
  "components": [
    { "id": "sam", "type": "frontend", "label": "Sam", "sublabel": "phone or desktop browser", "pos": [60, 460], "size": [150, 64] },
    { "id": "caddy", "type": "security", "label": "Caddy on .35", "sublabel": "mail.lab.audasmedia.com.au", "pos": [330, 460], "size": [170, 64] },
    { "id": "ui", "type": "frontend", "label": "HTMX dashboard", "sublabel": "login, inbox, rules, reports", "pos": [640, 440], "size": [200, 80], "tag": "port 8790" },
    { "id": "db", "type": "database", "label": "SQLite", "sublabel": "email_agent_data volume", "pos": [1300, 460], "size": [180, 80] },
    { "id": "api", "type": "backend", "label": "Hub API", "sublabel": "/capabilities /ask /notify", "pos": [1300, 120], "size": [180, 64], "tag": "read-only /ask" },
    { "id": "hub", "type": "backend", "label": "Central AI Hub", "sublabel": "hear-route-answer :8788", "pos": [980, 120], "size": [180, 64] },
    { "id": "jobs", "type": "backend", "label": "CLI jobs", "sublabel": "-fetch -classify -summary-send", "pos": [1300, 800], "size": [180, 64] },
    { "id": "n8n", "type": "external", "label": "n8n schedule", "sublabel": "scan and summary runs", "pos": [1580, 800], "size": [170, 64] },
    { "id": "apprise", "type": "backend", "label": "Apprise", "sublabel": "summary email :8210", "pos": [1000, 800], "size": [170, 64] },
    { "id": "gmail", "type": "cloud", "label": "Gmail", "sublabel": "IMAP :993 / SMTP :587, IPv4", "pos": [240, 800], "size": [180, 64] },
    { "id": "jev", "type": "cloud", "label": "JEV", "sublabel": "TypeSafe System One", "pos": [500, 800], "size": [170, 64] },
    { "id": "omni", "type": "cloud", "label": "OmniRoute", "sublabel": "reply drafts :20129", "pos": [760, 800], "size": [170, 64] }
  ],
  "connections": [
    { "id": "browser", "from": "sam", "to": "caddy", "label": "HTTPS" },
    { "id": "proxy", "from": "caddy", "to": "ui", "label": "reverse proxy" },
    { "id": "store", "from": "ui", "to": "db", "label": "store mail, triage, rules" },
    { "id": "mail", "from": "ui", "to": "gmail", "label": "read + send", "fromSide": "bottom", "toSide": "top", "route": "orthogonal-v" },
    { "id": "classify", "from": "ui", "to": "jev", "label": "classify", "fromSide": "bottom", "toSide": "top", "route": "orthogonal-v" },
    { "id": "draft", "from": "ui", "to": "omni", "label": "draft reply", "fromSide": "bottom", "toSide": "top", "route": "orthogonal-v" },
    { "id": "summary", "from": "ui", "to": "apprise", "label": "send summary", "fromSide": "bottom", "toSide": "top", "route": "orthogonal-v" },
    { "id": "ask", "from": "hub", "to": "api", "label": "Bearer token" },
    { "id": "read", "from": "api", "to": "db", "label": "read only", "labelAt": [1390, 340] },
    { "id": "schedule", "from": "n8n", "to": "jobs", "label": "schedule" },
    { "id": "run", "from": "jobs", "to": "db", "label": "fetch + classify" },
    { "id": "jobs-summary", "from": "jobs", "to": "apprise", "label": "daily email", "labelAt": [1240, 878] }
  ]
}
