# haz-ux/cardinal-frame architecture

> Architecture diagram of the GitHub repository haz-ux/cardinal-frame, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haz-ux/cardinal-frame
- Repository: https://github.com/haz-ux/cardinal-frame

## Overview

Cardinal Frame is a personal-scale AI agent orchestration platform with a React SPA and an Express/SQLite backend. Users authenticate, then operate agents, chat, DAG workflows, and other capabilities through the UI; requests reach backend routes and, where applicable, orchestration engines that enforce governance before execution. Major branches include multi-node delegation, skills and plugins, LLM providers, observability, and the live neural map. The README documents the broad architecture; unsampled route and engine internals are represented only at the documented subsystem level.

Main entry points: [`client/src/App.jsx`](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/App.jsx) (React application), [`src/server/server.mjs`](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/server.mjs) (HTTP server), [`client/src/AuthContext.jsx`](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/AuthContext.jsx) (Session and API client), [`src/server/routes/skills.mjs`](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/skills.mjs) (Skills sandbox)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["React application<br/>[App.jsx]"]
  node_authui["Session and API client<br/>[AuthContext.jsx]"]
  node_chatui["Chat interface<br/>[Chat.jsx]"]
  node_dagui["DAG editor<br/>[DAGEditor.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_neuralmap["Neural map<br/>[NeuralMap.jsx]"]
  node_layout["Graph layout engine<br/>[LayoutEngine.js]"]
  node_metrics["Graph metrics<br/>[GraphMetrics.js]"]
  node_sector["Sector layout<br/>[SectorLayout.js]"]
  node_cache["Client data cache<br/>[dataCache.js]"]
  node_polling["Live resource updates<br/>[useWsResource.js]"]
end

subgraph group_orchestration["Execution and governance"]
  node_dagengine["DAG executor and queue<br/>[job-queue.mjs]"]
  node_chains["Chain executor<br/>[chains.mjs]"]
  node_skills["Skills sandbox<br/>[skills.mjs]"]
  node_governance["Governance controls<br/>[governance.mjs]"]
  node_agents["Agent workflows<br/>[agent.mjs]"]
end

subgraph group_integrations["Providers and nodes"]
  node_delegation["Node delegation<br/>[delegation.mjs]"]
  node_llmroutes["LLM routes<br/>[llm.mjs]"]
  node_provider["Provider runtime"]
  node_mcp["MCP client<br/>[mcp-client.mjs]"]
  node_plugins["Plugin system<br/>[plugins.mjs]"]
end

subgraph group_platform["Platform services"]
  node_server["HTTP server<br/>[server.mjs]"]
  node_authroutes["Authentication routes<br/>[auth.mjs]"]
  node_validation["Request validation<br/>[validate.mjs]"]
  node_database[("SQLite state<br/>[server.mjs]")]
end

node_user(("Operator"))
node_llmservice{{"LLM providers"}}
node_mcpservice{{"MCP servers"}}

node_user -->|"uses"| node_app
node_app -->|"checks session"| node_authui
node_app -->|"routes to"| node_chatui
node_app -->|"routes to"| node_dagui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_neuralmap
node_chatui -->|"sends requests"| node_authui
node_dagui -->|"sends requests"| node_authui
node_dashboard -->|"sends requests"| node_authui
node_neuralmap -->|"requests layout"| node_layout
node_layout -->|"uses"| node_metrics
node_layout -->|"uses"| node_sector
node_user -->|"HTTP requests"| node_server
node_authui -->|"calls API"| node_server
node_server -->|"registers routes"| node_authroutes
node_server -->|"validates requests"| node_validation
node_authroutes -->|"reads and writes"| node_database
node_dagui -->|"submits workflows"| node_dagengine
node_dagengine -->|"executes steps"| node_skills
node_chains -->|"executes steps"| node_skills
node_chains -->|"checks permission"| node_governance
node_agents -->|"runs skills"| node_skills
node_delegation -->|"checks permissions"| node_governance
node_llmroutes -->|"uses runtime"| node_provider
node_provider -->|"sends requests"| node_llmservice
node_mcp -->|"connects by stdio"| node_mcpservice
node_skills -->|"fires hooks"| node_plugins
node_dagengine -->|"persists jobs"| node_database
node_governance -->|"records audit"| node_database
node_polling -.->|"refreshes resources"| node_server
node_server -->|"shares state"| node_database

click node_app "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/App.jsx"
click node_authui "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/AuthContext.jsx"
click node_chatui "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/Chat.jsx"
click node_dagui "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/DAGEditor.jsx"
click node_dashboard "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/Dashboard.jsx"
click node_neuralmap "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/NeuralMap.jsx"
click node_layout "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/graph/LayoutEngine.js"
click node_metrics "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/graph/GraphMetrics.js"
click node_sector "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/graph/SectorLayout.js"
click node_cache "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/dataCache.js"
click node_polling "https://github.com/haz-ux/cardinal-frame/blob/master/client/src/useWsResource.js"
click node_server "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/server.mjs"
click node_authroutes "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/auth.mjs"
click node_validation "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/validate.mjs"
click node_dagengine "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/job-queue.mjs"
click node_chains "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/chains.mjs"
click node_skills "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/skills.mjs"
click node_governance "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/governance.mjs"
click node_agents "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/agent.mjs"
click node_delegation "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/delegation.mjs"
click node_llmroutes "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/llm.mjs"
click node_provider "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/llm/provider-runtime.mjs"
click node_mcp "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/mcp-client.mjs"
click node_plugins "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/plugins.mjs"
click node_database "https://github.com/haz-ux/cardinal-frame/blob/master/src/server/server.mjs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_authui,node_chatui,node_dagui,node_dashboard,node_neuralmap,node_layout,node_metrics,node_sector,node_cache,node_polling toneBlue
class node_dagengine,node_chains,node_skills,node_governance,node_agents toneAmber
class node_delegation,node_llmroutes,node_provider,node_mcp,node_plugins,node_mcpservice toneMint
class node_server,node_authroutes,node_validation,node_database toneRose
class node_user,node_llmservice toneIndigo
```

## Components

### User interface

- [React application](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/App.jsx): `client/src/App.jsx`
- [Session and API client](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/AuthContext.jsx): `client/src/AuthContext.jsx`
- [Chat interface](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/Chat.jsx): `client/src/Chat.jsx`
- [DAG editor](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/DAGEditor.jsx): `client/src/DAGEditor.jsx`
- [Dashboard](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/Dashboard.jsx): `client/src/Dashboard.jsx`
- [Neural map](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/NeuralMap.jsx): `client/src/NeuralMap.jsx`
- [Graph layout engine](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/graph/LayoutEngine.js): `client/src/graph/LayoutEngine.js`
- [Graph metrics](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/graph/GraphMetrics.js): `client/src/graph/GraphMetrics.js`
- [Sector layout](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/graph/SectorLayout.js): `client/src/graph/SectorLayout.js`
- [Client data cache](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/dataCache.js): `client/src/dataCache.js`
- [Live resource updates](https://github.com/haz-ux/cardinal-frame/blob/master/client/src/useWsResource.js): `client/src/useWsResource.js`

### Execution and governance

- [DAG executor and queue](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/job-queue.mjs): `src/server/job-queue.mjs`
- [Chain executor](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/chains.mjs): `src/server/chains.mjs`
- [Skills sandbox](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/skills.mjs): `src/server/routes/skills.mjs`
- [Governance controls](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/governance.mjs): `src/server/routes/governance.mjs`
- [Agent workflows](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/agent.mjs): `src/server/routes/agent.mjs`

### Providers and nodes

- [Node delegation](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/delegation.mjs): `src/server/routes/delegation.mjs`
- [LLM routes](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/llm.mjs): `src/server/routes/llm.mjs`
- [Provider runtime](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/llm/provider-runtime.mjs): `src/server/llm/provider-runtime.mjs`
- [MCP client](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/mcp-client.mjs): `src/server/mcp-client.mjs`
- [Plugin system](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/plugins.mjs): `src/server/plugins.mjs`

### Platform services

- [HTTP server](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/server.mjs): `src/server/server.mjs`
- [Authentication routes](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/routes/auth.mjs): `src/server/routes/auth.mjs`
- [Request validation](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/validate.mjs): `src/server/validate.mjs`
- [SQLite state](https://github.com/haz-ux/cardinal-frame/blob/master/src/server/server.mjs): `src/server/server.mjs`

### Other components

- **Operator**
- **LLM providers**
- **MCP servers**

## Connections

- Operator → React application: uses (evidence: `README.md`)
- React application → Session and API client: checks session (evidence: `client/src/App.jsx`)
- React application → Chat interface: routes to (evidence: `client/src/App.jsx`)
- React application → DAG editor: routes to (evidence: `client/src/App.jsx`)
- React application → Dashboard: routes to (evidence: `client/src/App.jsx`)
- React application → Neural map: routes to (evidence: `client/src/App.jsx`)
- Chat interface → Session and API client: sends requests
- DAG editor → Session and API client: sends requests (evidence: `README.md`)
- Dashboard → Session and API client: sends requests (evidence: `README.md`)
- Neural map → Graph layout engine: requests layout (evidence: `client/src/graph/LayoutEngine.js`)
- Graph layout engine → Graph metrics: uses (evidence: `client/src/graph/LayoutEngine.js`)
- Graph layout engine → Sector layout: uses (evidence: `client/src/graph/LayoutEngine.js`)
- Operator → HTTP server: HTTP requests (evidence: `README.md`)
- Session and API client → HTTP server: calls API (evidence: `client/src/AuthContext.jsx`)
- HTTP server → Authentication routes: registers routes (evidence: `src/server/server.mjs`)
- HTTP server → Request validation: validates requests (evidence: `README.md`)
- Authentication routes → SQLite state: reads and writes (evidence: `README.md`)
- DAG editor → DAG executor and queue: submits workflows (evidence: `README.md`)
- DAG executor and queue → Skills sandbox: executes steps (evidence: `README.md`)
- Chain executor → Skills sandbox: executes steps (evidence: `README.md`)
- Chain executor → Governance controls: checks permission (evidence: `README.md`)
- Agent workflows → Skills sandbox: runs skills (evidence: `README.md`)
- Node delegation → Governance controls: checks permissions (evidence: `README.md`)
- LLM routes → Provider runtime: uses runtime
- Provider runtime → LLM providers: sends requests (evidence: `README.md`)
- MCP client → MCP servers: connects by stdio (evidence: `src/server/mcp-client.mjs`)
- Skills sandbox → Plugin system: fires hooks (evidence: `README.md`)
- DAG executor and queue → SQLite state: persists jobs (evidence: `README.md`)
- Governance controls → SQLite state: records audit (evidence: `README.md`)
- Live resource updates → HTTP server: refreshes resources
- HTTP server → SQLite state: shares state (evidence: `README.md`)
