{
  "nodes": [
    {
      "id": "title",
      "type": "text",
      "x": -860,
      "y": -520,
      "width": 1080,
      "height": 150,
      "color": "#2563eb",
      "text": "# God Node Map\nResolutionFlow architecture hotspots, 2026-05-06\n\nRead left to right: behavioral risk -> expected infrastructure -> self-serve boundaries."
    },
    {
      "id": "frontend_group",
      "type": "group",
      "x": -900,
      "y": -300,
      "width": 720,
      "height": 760,
      "color": "#fee2e2",
      "label": "Frontend Behavioral Hubs"
    },
    {
      "id": "assistant_page",
      "type": "text",
      "x": -860,
      "y": -240,
      "width": 300,
      "height": 190,
      "color": "#ef4444",
      "text": "## AssistantChatPage.tsx\n\nHighest-risk frontend node.\n\n- 2,493 LOC\n- 39 outbound imports\n- 77 changes in 90 days\n- Owns many unrelated workflows"
    },
    {
      "id": "tree_navigation_page",
      "type": "text",
      "x": -520,
      "y": -240,
      "width": 300,
      "height": 160,
      "color": "#f97316",
      "text": "## TreeNavigationPage.tsx\n\nLarge page orchestrator.\n\n- 1,385 LOC\n- 31 outbound imports\n- 33 changes in 90 days"
    },
    {
      "id": "procedural_navigation_page",
      "type": "text",
      "x": -860,
      "y": 0,
      "width": 300,
      "height": 160,
      "color": "#f97316",
      "text": "## ProceduralNavigationPage.tsx\n\nLarge page orchestrator.\n\n- 1,021 LOC\n- 33 outbound imports\n- 22 changes in 90 days"
    },
    {
      "id": "frontend_pages",
      "type": "text",
      "x": -520,
      "y": 0,
      "width": 300,
      "height": 190,
      "color": "#f59e0b",
      "text": "## Other Page Hubs\n\n- TreeLibraryPage.tsx\n- TreeEditorPage.tsx\n- SessionDetailPage.tsx\n\nTreat as page shells. Extract workflow hooks when touched."
    },
    {
      "id": "frontend_action",
      "type": "text",
      "x": -860,
      "y": 250,
      "width": 640,
      "height": 150,
      "color": "#16a34a",
      "text": "## Frontend Rule\n\nDo not start a broad cleanup. For new self-serve work, keep billing in `useBillingStore`, keep onboarding state narrow, and prefer direct API module imports over the `@/api` barrel."
    },
    {
      "id": "backend_group",
      "type": "group",
      "x": -80,
      "y": -300,
      "width": 740,
      "height": 760,
      "color": "#ffedd5",
      "label": "Backend Behavioral Hubs"
    },
    {
      "id": "flowpilot_engine",
      "type": "text",
      "x": -40,
      "y": -240,
      "width": 310,
      "height": 190,
      "color": "#ef4444",
      "text": "## flowpilot_engine.py\n\nReal backend behavioral hub.\n\n- 1,793 LOC\n- prompts\n- structured parsing\n- session state transitions\n- model orchestration"
    },
    {
      "id": "ai_sessions_endpoint",
      "type": "text",
      "x": 310,
      "y": -240,
      "width": 310,
      "height": 180,
      "color": "#f97316",
      "text": "## ai_sessions.py\n\nController plus mapper.\n\n- 1,173 LOC\n- 15 outbound imports\n- 32 changes in 90 days\n\nKeep subscription/onboarding logic out."
    },
    {
      "id": "sessions_trees_endpoints",
      "type": "text",
      "x": -40,
      "y": 0,
      "width": 310,
      "height": 190,
      "color": "#f59e0b",
      "text": "## sessions.py / trees.py\n\nLarge endpoint hubs.\n\n- ownership\n- exports\n- sharing\n- limits\n- tree/session behavior\n\nUse guards and services instead of handler sprawl."
    },
    {
      "id": "admin_endpoint",
      "type": "text",
      "x": 310,
      "y": 0,
      "width": 310,
      "height": 150,
      "color": "#f59e0b",
      "text": "## admin.py\n\nLarge admin surface.\n\nHigh LOC, lower churn. Extend carefully, but not a self-serve blocker."
    },
    {
      "id": "backend_action",
      "type": "text",
      "x": -40,
      "y": 250,
      "width": 660,
      "height": 150,
      "color": "#16a34a",
      "text": "## Backend Rule\n\nMount subscription and email-verification checks at dependency/router boundaries. Keep billing behavior in BillingService and subscription models, not in AI/session/tree endpoints."
    },
    {
      "id": "infra_group",
      "type": "group",
      "x": 820,
      "y": -300,
      "width": 640,
      "height": 760,
      "color": "#dbeafe",
      "label": "Expected Infrastructure Hubs"
    },
    {
      "id": "frontend_infra",
      "type": "text",
      "x": 860,
      "y": -240,
      "width": 260,
      "height": 200,
      "color": "#3b82f6",
      "text": "## Frontend Infra\n\nExpected central nodes:\n\n- lib/utils.ts\n- lib/toast.ts\n- api/client.ts\n- types/index.ts\n- ui/Button.tsx"
    },
    {
      "id": "backend_infra",
      "type": "text",
      "x": 1160,
      "y": -240,
      "width": 260,
      "height": 200,
      "color": "#3b82f6",
      "text": "## Backend Infra\n\nExpected central nodes:\n\n- core/database.py\n- api/deps.py\n- core/config.py\n- ORM models"
    },
    {
      "id": "barrel_cycles",
      "type": "text",
      "x": 860,
      "y": 10,
      "width": 260,
      "height": 170,
      "color": "#60a5fa",
      "text": "## Barrel Cycles\n\n`frontend/src/api/*` has a large barrel/export cycle.\n\nLow urgency. Prefer direct imports in new code."
    },
    {
      "id": "orm_cycles",
      "type": "text",
      "x": 1160,
      "y": 10,
      "width": 260,
      "height": 170,
      "color": "#60a5fa",
      "text": "## ORM Cycles\n\nSQLAlchemy model cycles are expected.\n\nKeep behavior in services, not model methods."
    },
    {
      "id": "infra_action",
      "type": "text",
      "x": 860,
      "y": 250,
      "width": 560,
      "height": 150,
      "color": "#16a34a",
      "text": "## Infrastructure Rule\n\nDo not refactor a file just because it has high inbound count. Central utilities, clients, config, database, and model definitions are allowed to be central."
    },
    {
      "id": "self_serve_group",
      "type": "group",
      "x": -900,
      "y": 560,
      "width": 2360,
      "height": 300,
      "color": "#dcfce7",
      "label": "Self-Serve Signup Guidance"
    },
    {
      "id": "no_blocker",
      "type": "text",
      "x": -860,
      "y": 620,
      "width": 360,
      "height": 160,
      "color": "#22c55e",
      "text": "## Do Now\n\nNo large refactor is required before self-serve signup.\n\nUse this map to avoid accidental coupling while implementing the plans."
    },
    {
      "id": "self_serve_boundaries",
      "type": "text",
      "x": -440,
      "y": 620,
      "width": 440,
      "height": 170,
      "color": "#22c55e",
      "text": "## During Self-Serve\n\n- `useBillingStore`, not `authStore`\n- `BillingService`, not AI/session/tree endpoints\n- dependency guards, not repeated handler checks\n- direct API imports in new frontend code"
    },
    {
      "id": "opportunistic_refactors",
      "type": "text",
      "x": 60,
      "y": 620,
      "width": 440,
      "height": 170,
      "color": "#84cc16",
      "text": "## Opportunistic Refactors\n\n- Extract one Assistant workflow at a time\n- Extract FlowPilot prompt/validation pieces when touched\n- Move ai_sessions mapping helpers if touched again"
    },
    {
      "id": "avoid_refactors",
      "type": "text",
      "x": 560,
      "y": 620,
      "width": 820,
      "height": 170,
      "color": "#a3e635",
      "text": "## Avoid\n\n- Broad `AssistantChatPage` cleanup before product work\n- ORM cycle cleanup unless there is a runtime issue\n- Splitting utilities, toast, API client, or database just because they are central\n- Running self-serve behavior through AI/product endpoints"
    }
  ],
  "edges": [
    {
      "id": "edge_assistant_frontend_action",
      "fromNode": "assistant_page",
      "fromSide": "bottom",
      "toNode": "frontend_action",
      "toSide": "top",
      "label": "extract one workflow at a time"
    },
    {
      "id": "edge_tree_frontend_action",
      "fromNode": "tree_navigation_page",
      "fromSide": "bottom",
      "toNode": "frontend_action",
      "toSide": "top",
      "label": "extract hooks when touched"
    },
    {
      "id": "edge_proc_frontend_action",
      "fromNode": "procedural_navigation_page",
      "fromSide": "bottom",
      "toNode": "frontend_action",
      "toSide": "top"
    },
    {
      "id": "edge_flowpilot_backend_action",
      "fromNode": "flowpilot_engine",
      "fromSide": "bottom",
      "toNode": "backend_action",
      "toSide": "top",
      "label": "keep self-serve out"
    },
    {
      "id": "edge_ai_backend_action",
      "fromNode": "ai_sessions_endpoint",
      "fromSide": "bottom",
      "toNode": "backend_action",
      "toSide": "top",
      "label": "avoid billing logic here"
    },
    {
      "id": "edge_sessions_backend_action",
      "fromNode": "sessions_trees_endpoints",
      "fromSide": "bottom",
      "toNode": "backend_action",
      "toSide": "top",
      "label": "mount guards"
    },
    {
      "id": "edge_frontend_selfserve",
      "fromNode": "frontend_action",
      "fromSide": "bottom",
      "toNode": "self_serve_boundaries",
      "toSide": "top"
    },
    {
      "id": "edge_backend_selfserve",
      "fromNode": "backend_action",
      "fromSide": "bottom",
      "toNode": "self_serve_boundaries",
      "toSide": "top"
    },
    {
      "id": "edge_infra_selfserve",
      "fromNode": "infra_action",
      "fromSide": "bottom",
      "toNode": "avoid_refactors",
      "toSide": "top",
      "label": "do not refactor just because central"
    },
    {
      "id": "edge_no_blocker_boundaries",
      "fromNode": "no_blocker",
      "fromSide": "right",
      "toNode": "self_serve_boundaries",
      "toSide": "left"
    },
    {
      "id": "edge_boundaries_opportunistic",
      "fromNode": "self_serve_boundaries",
      "fromSide": "right",
      "toNode": "opportunistic_refactors",
      "toSide": "left"
    },
    {
      "id": "edge_opportunistic_avoid",
      "fromNode": "opportunistic_refactors",
      "fromSide": "right",
      "toNode": "avoid_refactors",
      "toSide": "left"
    }
  ]
}
