# openbmb/pilotdeck architecture

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

- Interactive diagram: https://gitdiagram.com/openbmb/pilotdeck
- Repository: https://github.com/openbmb/pilotdeck

## Overview

PilotDeck is a multi-project AI agent productivity platform. Users submit work through Web, CLI, or messaging channels; the gateway routes sessions into agent execution, which uses models, tools, and workspace-scoped context to produce results. The README also identifies white-box memory, smart routing, and Always-on execution as core capabilities. Some relationships below are documented capabilities rather than verified call paths; unsampled or unclear wiring is omitted.

Main entry points: [`src/agent/loop/AgentLoop.ts`](https://github.com/OpenBMB/PilotDeck/blob/main/src/agent/loop/AgentLoop.ts) (Agent Loop), [`src/gateway/Gateway.ts`](https://github.com/OpenBMB/PilotDeck/blob/main/src/gateway/Gateway.ts) (Gateway), [`src/gateway/SessionRouter.ts`](https://github.com/OpenBMB/PilotDeck/blob/main/src/gateway/SessionRouter.ts) (Session Routing), [`src/tool/execution/ToolRuntime.ts`](https://github.com/OpenBMB/PilotDeck/blob/main/src/tool/execution/ToolRuntime.ts) (Tool Runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Entry"]
  node_web["Web UI"]
  node_cli["CLI<br/>[pilotdeck.ts]"]
  node_channels["Messaging Channels"]
  node_gateway["Gateway<br/>[Gateway.ts]"]
  node_sessions["Session Routing<br/>[SessionRouter.ts]"]
end

subgraph group_agent["Agent Runtime"]
  node_agentloop["Agent Loop<br/>[AgentLoop.ts]"]
  node_models["Model Runtime<br/>[ModelRuntime.ts]"]
  node_routing["Smart Routing<br/>[RouterRuntime.ts]"]
  node_tools["Tool Runtime<br/>[ToolRuntime.ts]"]
end

subgraph group_workspace["Workspace Context"]
  node_workspace["Workspace Isolation<br/>[paths.ts]"]
  node_memory["White-box Memory<br/>[service.ts]"]
  node_context["Context Management"]
  node_skills["Project Skills<br/>[SkillManager.ts]"]
  node_files["Local Deliverables<br/>[WorkspaceApply.ts]"]
end

subgraph group_operations["Background Operations"]
  node_alwayson["Always-on Runtime<br/>[AlwaysOnManager.ts]"]
  node_cron["Scheduled Tasks<br/>[CronManager.ts]"]
end

subgraph group_integrations["Extensions"]
  node_mcp["MCP Runtime<br/>[McpRuntime.ts]"]
  node_plugins["Plugins<br/>[PluginRuntime.ts]"]
end

node_user(("User"))

node_user -->|"submits work"| node_web
node_user -->|"submits work"| node_cli
node_user -->|"sends messages"| node_channels
node_web -.->|"sends requests"| node_gateway
node_cli -.->|"uses gateway"| node_gateway
node_channels -.->|"routes messages"| node_gateway
node_gateway -->|"routes sessions"| node_sessions
node_sessions -.->|"runs sessions"| node_agentloop
node_agentloop -->|"requests completion"| node_models
node_agentloop -->|"dispatches tools"| node_tools
node_agentloop -->|"manages context"| node_context
node_agentloop -.->|"selects models"| node_routing
node_workspace -->|"scopes memory"| node_memory
node_workspace -->|"scopes skills"| node_skills
node_memory -.->|"supplies context"| node_context
node_alwayson -->|"runs background work"| node_sessions
node_alwayson -->|"lands deliverables"| node_files
node_cron -.->|"schedules work"| node_sessions
node_plugins -.->|"contributes tools"| node_tools
node_mcp -.->|"bridges tools"| node_tools

click node_web "https://github.com/OpenBMB/PilotDeck/blob/main/ui/src/components/chat/hooks/useChatRealtimeHandlers.ts"
click node_cli "https://github.com/OpenBMB/PilotDeck/blob/main/src/cli/pilotdeck.ts"
click node_channels "https://github.com/OpenBMB/PilotDeck/blob/main/src/adapters/channel/loadEnabledChannels.ts"
click node_gateway "https://github.com/OpenBMB/PilotDeck/blob/main/src/gateway/Gateway.ts"
click node_sessions "https://github.com/OpenBMB/PilotDeck/blob/main/src/gateway/SessionRouter.ts"
click node_agentloop "https://github.com/OpenBMB/PilotDeck/blob/main/src/agent/loop/AgentLoop.ts"
click node_models "https://github.com/OpenBMB/PilotDeck/blob/main/src/model/ModelRuntime.ts"
click node_routing "https://github.com/OpenBMB/PilotDeck/blob/main/src/router/RouterRuntime.ts"
click node_tools "https://github.com/OpenBMB/PilotDeck/blob/main/src/tool/execution/ToolRuntime.ts"
click node_workspace "https://github.com/OpenBMB/PilotDeck/blob/main/src/pilot/paths.ts"
click node_memory "https://github.com/OpenBMB/PilotDeck/blob/main/src/context/memory/edgeclaw-memory-core/src/service.ts"
click node_context "https://github.com/OpenBMB/PilotDeck/blob/main/src/context/budget/TokenBudgetManager.ts"
click node_skills "https://github.com/OpenBMB/PilotDeck/blob/main/src/extension/skills/SkillManager.ts"
click node_alwayson "https://github.com/OpenBMB/PilotDeck/blob/main/src/always-on/runtime/AlwaysOnManager.ts"
click node_cron "https://github.com/OpenBMB/PilotDeck/blob/main/src/cron/runtime/CronManager.ts"
click node_mcp "https://github.com/OpenBMB/PilotDeck/blob/main/src/mcp/runtime/McpRuntime.ts"
click node_plugins "https://github.com/OpenBMB/PilotDeck/blob/main/src/extension/plugins/runtime/PluginRuntime.ts"
click node_files "https://github.com/OpenBMB/PilotDeck/blob/main/src/always-on/workspace/WorkspaceApply.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_web,node_cli,node_channels,node_gateway,node_sessions,node_user toneBlue
class node_agentloop,node_models,node_routing,node_tools toneAmber
class node_workspace,node_memory,node_context,node_skills,node_files toneMint
class node_alwayson,node_cron toneRose
class node_mcp,node_plugins toneIndigo
```

## Components

### User Entry

- [Web UI](https://github.com/OpenBMB/PilotDeck/blob/main/ui/src/components/chat/hooks/useChatRealtimeHandlers.ts): `ui/src/components/chat/hooks/useChatRealtimeHandlers.ts`
- [CLI](https://github.com/OpenBMB/PilotDeck/blob/main/src/cli/pilotdeck.ts): `src/cli/pilotdeck.ts`
- [Messaging Channels](https://github.com/OpenBMB/PilotDeck/blob/main/src/adapters/channel/loadEnabledChannels.ts): `src/adapters/channel/loadEnabledChannels.ts`
- [Gateway](https://github.com/OpenBMB/PilotDeck/blob/main/src/gateway/Gateway.ts): `src/gateway/Gateway.ts`
- [Session Routing](https://github.com/OpenBMB/PilotDeck/blob/main/src/gateway/SessionRouter.ts): `src/gateway/SessionRouter.ts`

### Agent Runtime

- [Agent Loop](https://github.com/OpenBMB/PilotDeck/blob/main/src/agent/loop/AgentLoop.ts): `src/agent/loop/AgentLoop.ts`
- [Model Runtime](https://github.com/OpenBMB/PilotDeck/blob/main/src/model/ModelRuntime.ts): `src/model/ModelRuntime.ts`
- [Smart Routing](https://github.com/OpenBMB/PilotDeck/blob/main/src/router/RouterRuntime.ts): `src/router/RouterRuntime.ts`
- [Tool Runtime](https://github.com/OpenBMB/PilotDeck/blob/main/src/tool/execution/ToolRuntime.ts): `src/tool/execution/ToolRuntime.ts`

### Workspace Context

- [Workspace Isolation](https://github.com/OpenBMB/PilotDeck/blob/main/src/pilot/paths.ts): `src/pilot/paths.ts`
- [White-box Memory](https://github.com/OpenBMB/PilotDeck/blob/main/src/context/memory/edgeclaw-memory-core/src/service.ts): `src/context/memory/edgeclaw-memory-core/src/service.ts`
- [Context Management](https://github.com/OpenBMB/PilotDeck/blob/main/src/context/budget/TokenBudgetManager.ts): `src/context/budget/TokenBudgetManager.ts`
- [Project Skills](https://github.com/OpenBMB/PilotDeck/blob/main/src/extension/skills/SkillManager.ts): `src/extension/skills/SkillManager.ts`
- [Local Deliverables](https://github.com/OpenBMB/PilotDeck/blob/main/src/always-on/workspace/WorkspaceApply.ts): `src/always-on/workspace/WorkspaceApply.ts`

### Background Operations

- [Always-on Runtime](https://github.com/OpenBMB/PilotDeck/blob/main/src/always-on/runtime/AlwaysOnManager.ts): `src/always-on/runtime/AlwaysOnManager.ts`
- [Scheduled Tasks](https://github.com/OpenBMB/PilotDeck/blob/main/src/cron/runtime/CronManager.ts): `src/cron/runtime/CronManager.ts`

### Extensions

- [MCP Runtime](https://github.com/OpenBMB/PilotDeck/blob/main/src/mcp/runtime/McpRuntime.ts): `src/mcp/runtime/McpRuntime.ts`
- [Plugins](https://github.com/OpenBMB/PilotDeck/blob/main/src/extension/plugins/runtime/PluginRuntime.ts): `src/extension/plugins/runtime/PluginRuntime.ts`

### Other components

- **User**

## Connections

- User → Web UI: submits work (evidence: `README.md`)
- User → CLI: submits work (evidence: `README.md`)
- User → Messaging Channels: sends messages (evidence: `README.md`)
- Web UI → Gateway: sends requests
- CLI → Gateway: uses gateway
- Messaging Channels → Gateway: routes messages
- Gateway → Session Routing: routes sessions (evidence: `src/gateway/index.ts`)
- Session Routing → Agent Loop: runs sessions
- Agent Loop → Model Runtime: requests completion
- Agent Loop → Tool Runtime: dispatches tools
- Agent Loop → Context Management: manages context
- Agent Loop → Smart Routing: selects models
- Workspace Isolation → White-box Memory: scopes memory (evidence: `README.md`)
- Workspace Isolation → Project Skills: scopes skills (evidence: `README.md`)
- White-box Memory → Context Management: supplies context
- Always-on Runtime → Session Routing: runs background work (evidence: `src/always-on/runtime/AlwaysOnManager.ts`)
- Always-on Runtime → Local Deliverables: lands deliverables (evidence: `README.md`)
- Scheduled Tasks → Session Routing: schedules work
- Plugins → Tool Runtime: contributes tools
- MCP Runtime → Tool Runtime: bridges tools
