# sarveshwaran20/pulse_pilot architecture

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

- Interactive diagram: https://gitdiagram.com/sarveshwaran20/pulse_pilot
- Repository: https://github.com/sarveshwaran20/pulse_pilot

## Overview

PulsePilot combines a localhost biometric-state service, a cockpit dashboard, an approval-gated MCP action bridge, and a Chrome browser agent. The principal workflow is local state calculation → cockpit presentation and protection recommendations → user-approved actions with receipts. The README also describes a separate web experience and its AI and hardware/interaction features; its internal wiring is not established by the sampled sources, so those branches are represented without inferred call relationships.

Main entry points: [`dashboard/src/App.tsx`](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/App.tsx) (Cockpit App), [`vault/app/router.py`](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/router.py) (Vault API), [`mcp-server/server.py`](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/server.py) (MCP Bridge), [`web/src/app/cockpit/page.tsx`](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/cockpit/page.tsx) (Web Cockpit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vault["Local Vault"]
  node_vault_api["Vault API<br/>[router.py]"]
  node_state_scoring["State Scoring<br/>[calculator.py]"]
  node_vault_db[("SQLite Vault<br/>[database.py]")]
  node_vault_models["Vault Models<br/>[models.py]"]
  node_vault_config["Vault Config<br/>[config.py]"]
  node_vault_seed["Sample Ingest<br/>[seed.py]"]
  node_vault_entry["Vault Service<br/>[main.py]"]
end

subgraph group_cockpit["Cockpit Dashboard"]
  node_dashboard_app["Cockpit App<br/>[App.tsx]"]
  node_state_gauges["State Gauges<br/>[ArcGauge.tsx]"]
  node_ecg["ECG Timeline<br/>[ECGTimeline.tsx]"]
  node_orb["Pulse Orb<br/>[PulseOrb.tsx]"]
  node_sleep["Sleep Reserve<br/>[SleepDebtBar.tsx]"]
  node_bento["Bento Layout<br/>[BentoGrid.tsx]"]
  node_boot["Boot Sequence<br/>[BootSequence.tsx]"]
  node_approval_card["Approval Cards<br/>[ApprovalCard.tsx]"]
  node_history["Action History<br/>[HistoryRail.tsx]"]
  node_themes["State Themes<br/>[themes.ts]"]
end

subgraph group_actions["MCP Actions"]
  node_mcp_server["MCP Bridge<br/>[server.py]"]
  node_approval_gate["Approval Gate<br/>[gating.py]"]
  node_state_tool["State Tool<br/>[state_tools.py]"]
  node_calendar_tool["Calendar Actions<br/>[calendar_tools.py]"]
  node_email_tool["Email Actions<br/>[email_tools.py]"]
  node_habit_tool["Habit Actions<br/>[habit_tools.py]"]
end

subgraph group_browser["Browser Agent"]
  node_extension_content["Page Adaptation<br/>[content.ts]"]
  node_extension_background["Extension Background<br/>[background.ts]"]
  node_extension_panel["Extension Panel<br/>[sidepanel.ts]"]
end

subgraph group_web["Web Experience"]
  node_web_cockpit["Web Cockpit<br/>[page.tsx]"]
  node_web_landing["Landing Experience<br/>[page.tsx]"]
  node_web_auth["Local Authentication<br/>[page.tsx]"]
  node_web_copilot["AI Copilot"]
  node_web_hardware["Hardware Lab<br/>[HardwarePPGLab.tsx]"]
  node_web_interlock["Synaptic Interlock"]
  node_web_tokens["Design Tokens<br/>[tokens.ts]"]
end

node_pilot(("Pilot"))

node_pilot -->|"opens cockpit"| node_dashboard_app
node_dashboard_app -->|"fetches state"| node_vault_api
node_dashboard_app -->|"renders"| node_state_gauges
node_dashboard_app -->|"renders"| node_ecg
node_dashboard_app -->|"renders"| node_orb
node_dashboard_app -->|"renders"| node_sleep
node_dashboard_app -->|"renders"| node_bento
node_dashboard_app -->|"renders"| node_boot
node_dashboard_app -->|"stages actions"| node_approval_card
node_dashboard_app -->|"shows receipts"| node_history
node_dashboard_app -->|"applies state themes"| node_themes
node_vault_entry -->|"registers routes"| node_vault_api
node_vault_entry -->|"initializes"| node_vault_db
node_vault_entry -->|"seeds data"| node_vault_seed
node_vault_api -->|"computes state"| node_state_scoring
node_vault_api -->|"reads and writes"| node_vault_db
node_vault_api -->|"uses schemas"| node_vault_models
node_vault_db -->|"loads settings"| node_vault_config
node_vault_db -->|"maps records"| node_vault_models
node_vault_seed -->|"stores samples"| node_vault_db
node_vault_seed -->|"builds snapshots"| node_vault_models
node_mcp_server -->|"registers tool"| node_state_tool
node_mcp_server -->|"registers tool"| node_calendar_tool
node_mcp_server -->|"registers tool"| node_email_tool
node_mcp_server -->|"registers tool"| node_habit_tool
node_mcp_server -->|"manages approvals"| node_approval_gate
node_state_tool -->|"fetches state"| node_vault_api
node_calendar_tool -->|"requests approval"| node_approval_gate
node_email_tool -->|"requests approval"| node_approval_gate
node_habit_tool -->|"requests approval"| node_approval_gate
node_pilot -->|"browses pages"| node_extension_content
node_pilot -->|"opens web cockpit"| node_web_cockpit
node_web_cockpit -.->|"reads local state"| node_vault_api
node_web_cockpit -.->|"offers copilot"| node_web_copilot
node_web_cockpit -.->|"uses tokens"| node_web_tokens
node_web_landing -.->|"presents lab"| node_web_hardware
node_web_cockpit -.->|"offers safeguard"| node_web_interlock
node_web_auth -.->|"authenticates locally"| node_vault_api

click node_dashboard_app "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/App.tsx"
click node_state_gauges "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/ArcGauge.tsx"
click node_ecg "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/ECGTimeline.tsx"
click node_orb "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/PulseOrb.tsx"
click node_sleep "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/SleepDebtBar.tsx"
click node_bento "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/BentoGrid.tsx"
click node_boot "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/BootSequence.tsx"
click node_approval_card "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/mcp/ApprovalCard.tsx"
click node_history "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/mcp/HistoryRail.tsx"
click node_themes "https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/styles/themes.ts"
click node_vault_api "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/router.py"
click node_state_scoring "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/calculator.py"
click node_vault_db "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/database.py"
click node_vault_models "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/models.py"
click node_vault_config "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/config.py"
click node_vault_seed "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/seed.py"
click node_vault_entry "https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/main.py"
click node_mcp_server "https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/server.py"
click node_approval_gate "https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/gating.py"
click node_state_tool "https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/state_tools.py"
click node_calendar_tool "https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/calendar_tools.py"
click node_email_tool "https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/email_tools.py"
click node_habit_tool "https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/habit_tools.py"
click node_extension_content "https://github.com/sarveshwaran20/pulse_pilot/blob/main/extension/src/content.ts"
click node_extension_background "https://github.com/sarveshwaran20/pulse_pilot/blob/main/extension/src/background.ts"
click node_extension_panel "https://github.com/sarveshwaran20/pulse_pilot/blob/main/extension/src/sidepanel.ts"
click node_web_cockpit "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/cockpit/page.tsx"
click node_web_landing "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/page.tsx"
click node_web_auth "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/auth/page.tsx"
click node_web_copilot "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/components/ai/CircadianAICopilot.tsx"
click node_web_hardware "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/components/innovations/HardwarePPGLab.tsx"
click node_web_interlock "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/components/innovations/SynapticInterlock.tsx"
click node_web_tokens "https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/lib/tokens.ts"

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_vault_api,node_state_scoring,node_vault_db,node_vault_models,node_vault_config,node_vault_seed,node_vault_entry toneBlue
class node_dashboard_app,node_state_gauges,node_ecg,node_orb,node_sleep,node_bento,node_boot,node_approval_card,node_history,node_themes toneAmber
class node_mcp_server,node_approval_gate,node_state_tool,node_calendar_tool,node_email_tool,node_habit_tool toneMint
class node_extension_content,node_extension_background,node_extension_panel toneRose
class node_web_cockpit,node_web_landing,node_web_auth,node_web_copilot,node_web_hardware,node_web_interlock,node_web_tokens,node_pilot toneIndigo
```

## Components

### Local Vault

- [Vault API](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/router.py): `vault/app/router.py`
- [State Scoring](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/calculator.py): `vault/app/calculator.py`
- [SQLite Vault](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/database.py): `vault/app/database.py`
- [Vault Models](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/models.py): `vault/app/models.py`
- [Vault Config](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/config.py): `vault/app/config.py`
- [Sample Ingest](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/seed.py): `vault/app/seed.py`
- [Vault Service](https://github.com/sarveshwaran20/pulse_pilot/blob/main/vault/app/main.py): `vault/app/main.py`

### Cockpit Dashboard

- [Cockpit App](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [State Gauges](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/ArcGauge.tsx): `dashboard/src/components/cockpit/ArcGauge.tsx`
- [ECG Timeline](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/ECGTimeline.tsx): `dashboard/src/components/cockpit/ECGTimeline.tsx`
- [Pulse Orb](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/PulseOrb.tsx): `dashboard/src/components/cockpit/PulseOrb.tsx`
- [Sleep Reserve](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/SleepDebtBar.tsx): `dashboard/src/components/cockpit/SleepDebtBar.tsx`
- [Bento Layout](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/BentoGrid.tsx): `dashboard/src/components/cockpit/BentoGrid.tsx`
- [Boot Sequence](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/cockpit/BootSequence.tsx): `dashboard/src/components/cockpit/BootSequence.tsx`
- [Approval Cards](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/mcp/ApprovalCard.tsx): `dashboard/src/components/mcp/ApprovalCard.tsx`
- [Action History](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/components/mcp/HistoryRail.tsx): `dashboard/src/components/mcp/HistoryRail.tsx`
- [State Themes](https://github.com/sarveshwaran20/pulse_pilot/blob/main/dashboard/src/styles/themes.ts): `dashboard/src/styles/themes.ts`

### MCP Actions

- [MCP Bridge](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/server.py): `mcp-server/server.py`
- [Approval Gate](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/gating.py): `mcp-server/gating.py`
- [State Tool](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/state_tools.py): `mcp-server/tools/state_tools.py`
- [Calendar Actions](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/calendar_tools.py): `mcp-server/tools/calendar_tools.py`
- [Email Actions](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/email_tools.py): `mcp-server/tools/email_tools.py`
- [Habit Actions](https://github.com/sarveshwaran20/pulse_pilot/blob/main/mcp-server/tools/habit_tools.py): `mcp-server/tools/habit_tools.py`

### Browser Agent

- [Page Adaptation](https://github.com/sarveshwaran20/pulse_pilot/blob/main/extension/src/content.ts): `extension/src/content.ts`
- [Extension Background](https://github.com/sarveshwaran20/pulse_pilot/blob/main/extension/src/background.ts): `extension/src/background.ts`
- [Extension Panel](https://github.com/sarveshwaran20/pulse_pilot/blob/main/extension/src/sidepanel.ts): `extension/src/sidepanel.ts`

### Web Experience

- [Web Cockpit](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/cockpit/page.tsx): `web/src/app/cockpit/page.tsx`
- [Landing Experience](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/page.tsx): `web/src/app/page.tsx`
- [Local Authentication](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/app/auth/page.tsx): `web/src/app/auth/page.tsx`
- [AI Copilot](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/components/ai/CircadianAICopilot.tsx): `web/src/components/ai/CircadianAICopilot.tsx`
- [Hardware Lab](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/components/innovations/HardwarePPGLab.tsx): `web/src/components/innovations/HardwarePPGLab.tsx`
- [Synaptic Interlock](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/components/innovations/SynapticInterlock.tsx): `web/src/components/innovations/SynapticInterlock.tsx`
- [Design Tokens](https://github.com/sarveshwaran20/pulse_pilot/blob/main/web/src/lib/tokens.ts): `web/src/lib/tokens.ts`

### Other components

- **Pilot**

## Connections

- Pilot → Cockpit App: opens cockpit (evidence: `README.md`)
- Cockpit App → Vault API: fetches state (evidence: `dashboard/src/App.tsx`)
- Cockpit App → State Gauges: renders (evidence: `dashboard/src/App.tsx`)
- Cockpit App → ECG Timeline: renders (evidence: `dashboard/src/App.tsx`)
- Cockpit App → Pulse Orb: renders (evidence: `dashboard/src/App.tsx`)
- Cockpit App → Sleep Reserve: renders (evidence: `dashboard/src/App.tsx`)
- Cockpit App → Bento Layout: renders (evidence: `dashboard/src/App.tsx`)
- Cockpit App → Boot Sequence: renders (evidence: `dashboard/src/App.tsx`)
- Cockpit App → Approval Cards: stages actions (evidence: `README.md`)
- Cockpit App → Action History: shows receipts (evidence: `README.md`)
- Cockpit App → State Themes: applies state themes (evidence: `README.md`)
- Vault Service → Vault API: registers routes (evidence: `vault/app/main.py`)
- Vault Service → SQLite Vault: initializes (evidence: `vault/app/main.py`)
- Vault Service → Sample Ingest: seeds data (evidence: `vault/app/main.py`)
- Vault API → State Scoring: computes state (evidence: `vault/app/router.py`)
- Vault API → SQLite Vault: reads and writes (evidence: `vault/app/router.py`)
- Vault API → Vault Models: uses schemas (evidence: `vault/app/router.py`)
- SQLite Vault → Vault Config: loads settings (evidence: `vault/app/database.py`)
- SQLite Vault → Vault Models: maps records (evidence: `vault/app/database.py`)
- Sample Ingest → SQLite Vault: stores samples (evidence: `vault/app/seed.py`)
- Sample Ingest → Vault Models: builds snapshots (evidence: `vault/app/seed.py`)
- MCP Bridge → State Tool: registers tool (evidence: `mcp-server/server.py`)
- MCP Bridge → Calendar Actions: registers tool (evidence: `mcp-server/server.py`)
- MCP Bridge → Email Actions: registers tool (evidence: `mcp-server/server.py`)
- MCP Bridge → Habit Actions: registers tool (evidence: `mcp-server/server.py`)
- MCP Bridge → Approval Gate: manages approvals (evidence: `mcp-server/server.py`)
- State Tool → Vault API: fetches state (evidence: `mcp-server/tools/state_tools.py`)
- Calendar Actions → Approval Gate: requests approval (evidence: `mcp-server/tools/calendar_tools.py`)
- Email Actions → Approval Gate: requests approval (evidence: `mcp-server/tools/email_tools.py`)
- Habit Actions → Approval Gate: requests approval (evidence: `mcp-server/tools/habit_tools.py`)
- Pilot → Page Adaptation: browses pages (evidence: `README.md`)
- Pilot → Web Cockpit: opens web cockpit (evidence: `README.md`)
- Web Cockpit → Vault API: reads local state
- Web Cockpit → AI Copilot: offers copilot
- Web Cockpit → Design Tokens: uses tokens
- Landing Experience → Hardware Lab: presents lab
- Web Cockpit → Synaptic Interlock: offers safeguard
- Local Authentication → Vault API: authenticates locally
