# wickedapp/openclaw-office architecture

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

- Interactive diagram: https://gitdiagram.com/wickedapp/openclaw-office
- Repository: https://github.com/wickedapp/openclaw-office

## Overview

OpenClaw Office is a companion dashboard for observing OpenClaw agents. The main user workflow is gateway activity entering the workflow API, being recorded and streamed to the dashboard, then rendered as office animations, activity, and statistics. Separate branches cover gateway/agent setup and optional AI scene generation. The README documents capabilities whose implementation is not fully sampled; relationships below are limited to cited source references or README statements.

Main entry points: [`app/page.js`](https://github.com/wickedapp/openclaw-office/blob/master/app/page.js) (Dashboard page), [`lib/openclaw-ws.js`](https://github.com/wickedapp/openclaw-office/blob/master/lib/openclaw-ws.js) (Gateway connection), [`app/api/openclaw/route.js`](https://github.com/wickedapp/openclaw-office/blob/master/app/api/openclaw/route.js) (OpenClaw API), [`app/api/workflow/route.js`](https://github.com/wickedapp/openclaw-office/blob/master/app/api/workflow/route.js) (Workflow API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard &amp; Views"]
  node_dashboard["Dashboard page<br/>[page.js]"]
  node_office["Office visualization<br/>[IsometricOffice.js]"]
  node_pipeline["Request pipeline<br/>[RequestPipeline.js]"]
  node_activity["Activity log<br/>[ActivityLog.js]"]
  node_team["Team dashboard<br/>[TeamDashboard.js]"]
  node_stats["Stats cards<br/>[StatsCards.js]"]
  node_cost["Cost dashboard<br/>[CostDashboard.js]"]
  node_security["Security dashboard"]
  node_dbview["Database dashboard"]
end

subgraph group_workflow["Workflow Runtime"]
  node_workflowapi["Workflow API<br/>[route.js]"]
  node_streamapi["Workflow stream API<br/>[route.js]"]
  node_streamhook["Workflow stream hook"]
  node_workflowlogic["Task routing<br/>[workflow.js]"]
  node_eventbus["Event bus<br/>[event-bus.js]"]
  node_database[("SQLite store<br/>[db.js]")]
end

subgraph group_integration["Gateway &amp; Integrations"]
  node_openclawapi["OpenClaw API<br/>[route.js]"]
  node_gatewayws["Gateway connection<br/>[openclaw-ws.js]"]
  node_agentapi["Agent sync API<br/>[route.js]"]
  node_agentsync["Agent discovery<br/>[agent-sync.js]"]
  node_telegram["Telegram notifications<br/>[telegram.js]"]
  node_config["Runtime configuration<br/>[config.js]"]
end

subgraph group_setup["Setup &amp; Scene Generation"]
  node_cliinit["Setup wizard<br/>[init.js]"]
  node_cligateway["CLI gateway client<br/>[gateway.js]"]
  node_imagegen["Office image generation<br/>[image-gen.js]"]
  node_positiondetect["Desk position detection<br/>[position-detect.js]"]
  node_prompts["Scene prompts<br/>[prompts.js]"]
end

node_user(("Office user"))
node_gateway{{"OpenClaw gateway"}}
node_gemini{{"Gemini image service"}}
node_claude{{"Claude Vision"}}

node_user -->|"views"| node_dashboard
node_dashboard -->|"renders"| node_office
node_dashboard -->|"renders"| node_pipeline
node_dashboard -->|"renders"| node_activity
node_dashboard -->|"renders"| node_team
node_dashboard -->|"renders"| node_stats
node_dashboard -->|"renders"| node_cost
node_dashboard -->|"renders"| node_security
node_dashboard -->|"renders"| node_dbview
node_dashboard -->|"posts stages"| node_workflowapi
node_pipeline -->|"reads stream"| node_streamhook
node_streamhook -->|"opens SSE"| node_streamapi
node_workflowapi -->|"routes tasks"| node_workflowlogic
node_workflowapi -->|"reads and writes"| node_database
node_workflowapi -->|"notifies"| node_telegram
node_streamapi -->|"streams events"| node_eventbus
node_streamapi -->|"loads snapshots"| node_database
node_openclawapi -->|"records requests"| node_database
node_openclawapi -->|"reads status"| node_gatewayws
node_openclawapi -->|"notifies"| node_telegram
node_openclawapi -->|"emits updates"| node_eventbus
node_gatewayws -->|"publishes events"| node_eventbus
node_gatewayws -->|"records activity"| node_database
node_gatewayws -->|"uses routing"| node_workflowlogic
node_gatewayws -->|"loads settings"| node_config
node_gateway -->|"connects"| node_gatewayws
node_agentapi -->|"delegates sync"| node_agentsync
node_cliinit -->|"discovers agents"| node_cligateway
node_cliinit -->|"generates scene"| node_imagegen
node_cliinit -->|"detects desks"| node_positiondetect
node_imagegen -->|"builds prompts"| node_prompts
node_positiondetect -->|"uses templates"| node_prompts
node_imagegen -.->|"generates image"| node_gemini
node_positiondetect -.->|"detects positions"| node_claude

click node_dashboard "https://github.com/wickedapp/openclaw-office/blob/master/app/page.js"
click node_office "https://github.com/wickedapp/openclaw-office/blob/master/components/IsometricOffice.js"
click node_pipeline "https://github.com/wickedapp/openclaw-office/blob/master/components/RequestPipeline.js"
click node_activity "https://github.com/wickedapp/openclaw-office/blob/master/components/ActivityLog.js"
click node_team "https://github.com/wickedapp/openclaw-office/blob/master/components/TeamDashboard.js"
click node_stats "https://github.com/wickedapp/openclaw-office/blob/master/components/StatsCards.js"
click node_cost "https://github.com/wickedapp/openclaw-office/blob/master/components/CostDashboard.js"
click node_security "https://github.com/wickedapp/openclaw-office/blob/master/components/SecurityDashboard.js"
click node_dbview "https://github.com/wickedapp/openclaw-office/blob/master/components/DatabaseDashboard.js"
click node_workflowapi "https://github.com/wickedapp/openclaw-office/blob/master/app/api/workflow/route.js"
click node_streamapi "https://github.com/wickedapp/openclaw-office/blob/master/app/api/workflow/stream/route.js"
click node_streamhook "https://github.com/wickedapp/openclaw-office/blob/master/lib/useWorkflowStream.js"
click node_workflowlogic "https://github.com/wickedapp/openclaw-office/blob/master/lib/workflow.js"
click node_eventbus "https://github.com/wickedapp/openclaw-office/blob/master/lib/event-bus.js"
click node_database "https://github.com/wickedapp/openclaw-office/blob/master/lib/db.js"
click node_openclawapi "https://github.com/wickedapp/openclaw-office/blob/master/app/api/openclaw/route.js"
click node_gatewayws "https://github.com/wickedapp/openclaw-office/blob/master/lib/openclaw-ws.js"
click node_agentapi "https://github.com/wickedapp/openclaw-office/blob/master/app/api/agents/sync/route.js"
click node_agentsync "https://github.com/wickedapp/openclaw-office/blob/master/lib/agent-sync.js"
click node_telegram "https://github.com/wickedapp/openclaw-office/blob/master/lib/telegram.js"
click node_config "https://github.com/wickedapp/openclaw-office/blob/master/lib/config.js"
click node_cliinit "https://github.com/wickedapp/openclaw-office/blob/master/cli/commands/init.js"
click node_cligateway "https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/gateway.js"
click node_imagegen "https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/image-gen.js"
click node_positiondetect "https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/position-detect.js"
click node_prompts "https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/prompts.js"

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_dashboard,node_office,node_pipeline,node_activity,node_team,node_stats,node_cost,node_security,node_dbview,node_user toneBlue
class node_workflowapi,node_streamapi,node_streamhook,node_workflowlogic,node_eventbus,node_database toneAmber
class node_openclawapi,node_gatewayws,node_agentapi,node_agentsync,node_telegram,node_config toneMint
class node_cliinit,node_cligateway,node_imagegen,node_positiondetect,node_prompts toneRose
class node_gateway,node_gemini,node_claude toneIndigo
```

## Components

### Dashboard & Views

- [Dashboard page](https://github.com/wickedapp/openclaw-office/blob/master/app/page.js): `app/page.js`
- [Office visualization](https://github.com/wickedapp/openclaw-office/blob/master/components/IsometricOffice.js): `components/IsometricOffice.js`
- [Request pipeline](https://github.com/wickedapp/openclaw-office/blob/master/components/RequestPipeline.js): `components/RequestPipeline.js`
- [Activity log](https://github.com/wickedapp/openclaw-office/blob/master/components/ActivityLog.js): `components/ActivityLog.js`
- [Team dashboard](https://github.com/wickedapp/openclaw-office/blob/master/components/TeamDashboard.js): `components/TeamDashboard.js`
- [Stats cards](https://github.com/wickedapp/openclaw-office/blob/master/components/StatsCards.js): `components/StatsCards.js`
- [Cost dashboard](https://github.com/wickedapp/openclaw-office/blob/master/components/CostDashboard.js): `components/CostDashboard.js`
- [Security dashboard](https://github.com/wickedapp/openclaw-office/blob/master/components/SecurityDashboard.js): `components/SecurityDashboard.js`
- [Database dashboard](https://github.com/wickedapp/openclaw-office/blob/master/components/DatabaseDashboard.js): `components/DatabaseDashboard.js`

### Workflow Runtime

- [Workflow API](https://github.com/wickedapp/openclaw-office/blob/master/app/api/workflow/route.js): `app/api/workflow/route.js`
- [Workflow stream API](https://github.com/wickedapp/openclaw-office/blob/master/app/api/workflow/stream/route.js): `app/api/workflow/stream/route.js`
- [Workflow stream hook](https://github.com/wickedapp/openclaw-office/blob/master/lib/useWorkflowStream.js): `lib/useWorkflowStream.js`
- [Task routing](https://github.com/wickedapp/openclaw-office/blob/master/lib/workflow.js): `lib/workflow.js`
- [Event bus](https://github.com/wickedapp/openclaw-office/blob/master/lib/event-bus.js): `lib/event-bus.js`
- [SQLite store](https://github.com/wickedapp/openclaw-office/blob/master/lib/db.js): `lib/db.js`

### Gateway & Integrations

- [OpenClaw API](https://github.com/wickedapp/openclaw-office/blob/master/app/api/openclaw/route.js): `app/api/openclaw/route.js`
- [Gateway connection](https://github.com/wickedapp/openclaw-office/blob/master/lib/openclaw-ws.js): `lib/openclaw-ws.js`
- [Agent sync API](https://github.com/wickedapp/openclaw-office/blob/master/app/api/agents/sync/route.js): `app/api/agents/sync/route.js`
- [Agent discovery](https://github.com/wickedapp/openclaw-office/blob/master/lib/agent-sync.js): `lib/agent-sync.js`
- [Telegram notifications](https://github.com/wickedapp/openclaw-office/blob/master/lib/telegram.js): `lib/telegram.js`
- [Runtime configuration](https://github.com/wickedapp/openclaw-office/blob/master/lib/config.js): `lib/config.js`

### Setup & Scene Generation

- [Setup wizard](https://github.com/wickedapp/openclaw-office/blob/master/cli/commands/init.js): `cli/commands/init.js`
- [CLI gateway client](https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/gateway.js): `cli/lib/gateway.js`
- [Office image generation](https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/image-gen.js): `cli/lib/image-gen.js`
- [Desk position detection](https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/position-detect.js): `cli/lib/position-detect.js`
- [Scene prompts](https://github.com/wickedapp/openclaw-office/blob/master/cli/lib/prompts.js): `cli/lib/prompts.js`

### Other components

- **Office user**
- **OpenClaw gateway**
- **Gemini image service**
- **Claude Vision**

## Connections

- Office user → Dashboard page: views (evidence: `README.md`)
- Dashboard page → Office visualization: renders (evidence: `app/page.js`)
- Dashboard page → Request pipeline: renders (evidence: `app/page.js`)
- Dashboard page → Activity log: renders (evidence: `app/page.js`)
- Dashboard page → Team dashboard: renders (evidence: `app/page.js`)
- Dashboard page → Stats cards: renders (evidence: `app/page.js`)
- Dashboard page → Cost dashboard: renders (evidence: `app/page.js`)
- Dashboard page → Security dashboard: renders (evidence: `app/page.js`)
- Dashboard page → Database dashboard: renders (evidence: `app/page.js`)
- Dashboard page → Workflow API: posts stages
- Request pipeline → Workflow stream hook: reads stream (evidence: `components/RequestPipeline.js`)
- Workflow stream hook → Workflow stream API: opens SSE (evidence: `README.md`)
- Workflow API → Task routing: routes tasks (evidence: `app/api/workflow/route.js`)
- Workflow API → SQLite store: reads and writes (evidence: `app/api/workflow/route.js`)
- Workflow API → Telegram notifications: notifies (evidence: `app/api/workflow/route.js`)
- Workflow stream API → Event bus: streams events (evidence: `app/api/workflow/stream/route.js`)
- Workflow stream API → SQLite store: loads snapshots (evidence: `app/api/workflow/stream/route.js`)
- OpenClaw API → SQLite store: records requests (evidence: `app/api/openclaw/route.js`)
- OpenClaw API → Gateway connection: reads status (evidence: `app/api/openclaw/route.js`)
- OpenClaw API → Telegram notifications: notifies (evidence: `app/api/openclaw/route.js`)
- OpenClaw API → Event bus: emits updates (evidence: `app/api/openclaw/route.js`)
- Gateway connection → Event bus: publishes events (evidence: `lib/openclaw-ws.js`)
- Gateway connection → SQLite store: records activity (evidence: `lib/openclaw-ws.js`)
- Gateway connection → Task routing: uses routing (evidence: `lib/openclaw-ws.js`)
- Gateway connection → Runtime configuration: loads settings (evidence: `lib/openclaw-ws.js`)
- OpenClaw gateway → Gateway connection: connects (evidence: `README.md`)
- Agent sync API → Agent discovery: delegates sync (evidence: `app/api/agents/sync/route.js`)
- Setup wizard → CLI gateway client: discovers agents (evidence: `cli/commands/init.js`)
- Setup wizard → Office image generation: generates scene (evidence: `cli/commands/init.js`)
- Setup wizard → Desk position detection: detects desks (evidence: `cli/commands/init.js`)
- Office image generation → Scene prompts: builds prompts (evidence: `cli/lib/image-gen.js`)
- Desk position detection → Scene prompts: uses templates (evidence: `cli/lib/position-detect.js`)
- Office image generation → Gemini image service: generates image (evidence: `README.md`)
- Desk position detection → Claude Vision: detects positions (evidence: `README.md`)
