# epool86/ai-office architecture

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

- Interactive diagram: https://gitdiagram.com/epool86/ai-office
- Repository: https://github.com/epool86/ai-office

## Overview

AI Office is a local Claude Code-powered virtual office: the user chats with a manager, who delegates tasks to configured staff; results, status and requests for approval appear in a browser dashboard. The map follows the documented setup, chat, staff-task, approval, project/inbox, document, usage and safety capabilities. Source excerpts establish the CLI, server, chat/task orchestration, file-backed office model and command guard; several dashboard and service internals are unsampled, so uncertain links are omitted.

Main entry points: [`lib/server.js`](https://github.com/epool86/ai-office/blob/main/lib/server.js) (Local API server), [`dashboard/app.js`](https://github.com/epool86/ai-office/blob/main/dashboard/app.js) (Office dashboard), [`lib/chat.js`](https://github.com/epool86/ai-office/blob/main/lib/chat.js) (Manager and staff chat), [`lib/office.js`](https://github.com/epool86/ai-office/blob/main/lib/office.js) (Office file model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and setup"]
  node_cli["Office CLI<br/>[ai-office.js]"]
  node_wizard["Setup wizard<br/>[wizard.js]"]
  node_generator["Office generator<br/>[generate.js]"]
  node_server["Local API server<br/>[server.js]"]
end

subgraph group_work["Work orchestration"]
  node_chat["Manager and staff chat<br/>[chat.js]"]
  node_tasks["Staff task runner<br/>[tasks.js]"]
end

subgraph group_office["Office data and safety"]
  node_officefiles["Office file model<br/>[office.js]"]
  node_templates["Office instructions<br/>[templates.js]"]
  node_defaults["Staff and model defaults<br/>[defaults.js]"]
  node_md["Markdown file helpers<br/>[md.js]"]
  node_guard["Command and action guard<br/>[guard.js]"]
  node_office_store[("Office folders and records")]
end

subgraph group_experience["Dashboard experience"]
  node_dashboard["Office dashboard<br/>[app.js]"]
  node_avatar["Staff avatars<br/>[avatar.js]"]
  node_icons["Dashboard icons<br/>[icons.js]"]
  node_markdown["Chat markdown<br/>[markdown.js]"]
  node_office3d["3D office view<br/>[office3d.js]"]
end

subgraph group_services["Runtime services"]
  node_claude["Claude Code"]
  node_status["Live status<br/>[status.js]"]
  node_usage["Usage tracking<br/>[usage.js]"]
  node_doctools["Document tools<br/>[doctools.js]"]
  node_docengine["Document generation engine<br/>[index.cjs]"]
  node_invois["Invois Online"]
end

node_user(("Office owner"))

node_user -->|"starts setup"| node_cli
node_cli -->|"runs when unconfigured"| node_wizard
node_wizard -->|"creates office"| node_generator
node_cli -->|"starts office"| node_server
node_user -->|"chats and manages"| node_dashboard
node_dashboard -->|"calls local API"| node_server
node_server -->|"routes office requests"| node_officefiles
node_server -->|"reads live status"| node_status
node_server -->|"serves chat API"| node_chat
node_server -->|"serves task API"| node_tasks
node_server -->|"serves usage API"| node_usage
node_server -->|"serves tools API"| node_doctools
node_server -.->|"serves dashboard"| node_dashboard
node_chat -->|"runs prompts"| node_claude
node_chat -.->|"reports task activity"| node_tasks
node_tasks -->|"runs staff work"| node_claude
node_chat -->|"saves conversations"| node_office_store
node_tasks -->|"writes task files"| node_office_store
node_officefiles -->|"reads and writes"| node_office_store
node_generator -->|"renders office files"| node_templates
node_generator -->|"uses defaults"| node_defaults
node_officefiles -->|"generates staff files"| node_templates
node_officefiles -->|"uses defaults"| node_defaults
node_officefiles -->|"parses office records"| node_md
node_tasks -->|"formats task records"| node_md
node_chat -->|"loads chat guidance"| node_templates
node_chat -.->|"configures command safety"| node_guard
node_guard -.->|"checks rules and approvals"| node_office_store
node_doctools -.->|"prepares document tools"| node_docengine
node_dashboard -->|"renders portraits"| node_avatar
node_dashboard -->|"renders icons"| node_icons
node_dashboard -->|"renders markdown"| node_markdown
node_dashboard -.->|"shows office view"| node_office3d
node_status -->|"reads events and approvals"| node_office_store
node_usage -.->|"reads usage records"| node_office_store
node_officefiles -.->|"supports optional add-on"| node_invois
node_user -->|"approves actions"| node_office_store

click node_cli "https://github.com/epool86/ai-office/blob/main/bin/ai-office.js"
click node_wizard "https://github.com/epool86/ai-office/blob/main/lib/wizard.js"
click node_generator "https://github.com/epool86/ai-office/blob/main/lib/generate.js"
click node_server "https://github.com/epool86/ai-office/blob/main/lib/server.js"
click node_dashboard "https://github.com/epool86/ai-office/blob/main/dashboard/app.js"
click node_avatar "https://github.com/epool86/ai-office/blob/main/dashboard/avatar.js"
click node_icons "https://github.com/epool86/ai-office/blob/main/dashboard/icons.js"
click node_markdown "https://github.com/epool86/ai-office/blob/main/dashboard/markdown.js"
click node_office3d "https://github.com/epool86/ai-office/blob/main/dashboard/office3d.js"
click node_chat "https://github.com/epool86/ai-office/blob/main/lib/chat.js"
click node_tasks "https://github.com/epool86/ai-office/blob/main/lib/tasks.js"
click node_officefiles "https://github.com/epool86/ai-office/blob/main/lib/office.js"
click node_templates "https://github.com/epool86/ai-office/blob/main/lib/templates.js"
click node_defaults "https://github.com/epool86/ai-office/blob/main/lib/defaults.js"
click node_md "https://github.com/epool86/ai-office/blob/main/lib/md.js"
click node_guard "https://github.com/epool86/ai-office/blob/main/office-files/guard.js"
click node_status "https://github.com/epool86/ai-office/blob/main/lib/status.js"
click node_usage "https://github.com/epool86/ai-office/blob/main/lib/usage.js"
click node_doctools "https://github.com/epool86/ai-office/blob/main/lib/doctools.js"
click node_docengine "https://github.com/epool86/ai-office/blob/main/office-files/doc-tools/index.cjs"

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_cli,node_wizard,node_generator,node_server toneBlue
class node_chat,node_tasks toneAmber
class node_officefiles,node_templates,node_defaults,node_md,node_guard,node_office_store toneMint
class node_dashboard,node_avatar,node_icons,node_markdown,node_office3d toneRose
class node_claude,node_status,node_usage,node_doctools,node_docengine,node_invois,node_user toneIndigo
```

## Components

### Entry and setup

- [Office CLI](https://github.com/epool86/ai-office/blob/main/bin/ai-office.js): `bin/ai-office.js`
- [Setup wizard](https://github.com/epool86/ai-office/blob/main/lib/wizard.js): `lib/wizard.js`
- [Office generator](https://github.com/epool86/ai-office/blob/main/lib/generate.js): `lib/generate.js`
- [Local API server](https://github.com/epool86/ai-office/blob/main/lib/server.js): `lib/server.js`

### Work orchestration

- [Manager and staff chat](https://github.com/epool86/ai-office/blob/main/lib/chat.js): `lib/chat.js`
- [Staff task runner](https://github.com/epool86/ai-office/blob/main/lib/tasks.js): `lib/tasks.js`

### Office data and safety

- [Office file model](https://github.com/epool86/ai-office/blob/main/lib/office.js): `lib/office.js`
- [Office instructions](https://github.com/epool86/ai-office/blob/main/lib/templates.js): `lib/templates.js`
- [Staff and model defaults](https://github.com/epool86/ai-office/blob/main/lib/defaults.js): `lib/defaults.js`
- [Markdown file helpers](https://github.com/epool86/ai-office/blob/main/lib/md.js): `lib/md.js`
- [Command and action guard](https://github.com/epool86/ai-office/blob/main/office-files/guard.js): `office-files/guard.js`
- **Office folders and records**

### Dashboard experience

- [Office dashboard](https://github.com/epool86/ai-office/blob/main/dashboard/app.js): `dashboard/app.js`
- [Staff avatars](https://github.com/epool86/ai-office/blob/main/dashboard/avatar.js): `dashboard/avatar.js`
- [Dashboard icons](https://github.com/epool86/ai-office/blob/main/dashboard/icons.js): `dashboard/icons.js`
- [Chat markdown](https://github.com/epool86/ai-office/blob/main/dashboard/markdown.js): `dashboard/markdown.js`
- [3D office view](https://github.com/epool86/ai-office/blob/main/dashboard/office3d.js): `dashboard/office3d.js`

### Runtime services

- **Claude Code**
- [Live status](https://github.com/epool86/ai-office/blob/main/lib/status.js): `lib/status.js`
- [Usage tracking](https://github.com/epool86/ai-office/blob/main/lib/usage.js): `lib/usage.js`
- [Document tools](https://github.com/epool86/ai-office/blob/main/lib/doctools.js): `lib/doctools.js`
- [Document generation engine](https://github.com/epool86/ai-office/blob/main/office-files/doc-tools/index.cjs): `office-files/doc-tools/index.cjs`
- **Invois Online**

### Other components

- **Office owner**

## Connections

- Office owner → Office CLI: starts setup (evidence: `bin/ai-office.js`)
- Office CLI → Setup wizard: runs when unconfigured (evidence: `bin/ai-office.js`)
- Setup wizard → Office generator: creates office (evidence: `lib/wizard.js`)
- Office CLI → Local API server: starts office (evidence: `bin/ai-office.js`)
- Office owner → Office dashboard: chats and manages (evidence: `README.md`)
- Office dashboard → Local API server: calls local API (evidence: `dashboard/app.js`)
- Local API server → Office file model: routes office requests (evidence: `lib/server.js`)
- Local API server → Live status: reads live status (evidence: `lib/server.js`)
- Local API server → Manager and staff chat: serves chat API (evidence: `lib/server.js`)
- Local API server → Staff task runner: serves task API (evidence: `lib/server.js`)
- Local API server → Usage tracking: serves usage API (evidence: `lib/server.js`)
- Local API server → Document tools: serves tools API (evidence: `lib/server.js`)
- Local API server → Office dashboard: serves dashboard
- Manager and staff chat → Claude Code: runs prompts (evidence: `lib/chat.js`)
- Manager and staff chat → Staff task runner: reports task activity (evidence: `lib/tasks.js`)
- Staff task runner → Claude Code: runs staff work (evidence: `lib/tasks.js`)
- Manager and staff chat → Office folders and records: saves conversations (evidence: `lib/chat.js`)
- Staff task runner → Office folders and records: writes task files (evidence: `lib/tasks.js`)
- Office file model → Office folders and records: reads and writes (evidence: `lib/office.js`)
- Office generator → Office instructions: renders office files (evidence: `lib/generate.js`)
- Office generator → Staff and model defaults: uses defaults (evidence: `lib/generate.js`)
- Office file model → Office instructions: generates staff files (evidence: `lib/office.js`)
- Office file model → Staff and model defaults: uses defaults (evidence: `lib/office.js`)
- Office file model → Markdown file helpers: parses office records (evidence: `lib/office.js`)
- Staff task runner → Markdown file helpers: formats task records (evidence: `lib/tasks.js`)
- Manager and staff chat → Office instructions: loads chat guidance (evidence: `lib/chat.js`)
- Manager and staff chat → Command and action guard: configures command safety (evidence: `lib/chat.js`)
- Command and action guard → Office folders and records: checks rules and approvals
- Document tools → Document generation engine: prepares document tools
- Office dashboard → Staff avatars: renders portraits (evidence: `dashboard/app.js`)
- Office dashboard → Dashboard icons: renders icons (evidence: `dashboard/app.js`)
- Office dashboard → Chat markdown: renders markdown (evidence: `dashboard/app.js`)
- Office dashboard → 3D office view: shows office view (evidence: `dashboard/app.js`)
- Live status → Office folders and records: reads events and approvals
- Usage tracking → Office folders and records: reads usage records
- Office file model → Invois Online: supports optional add-on (evidence: `README.md`)
- Office owner → Office folders and records: approves actions (evidence: `README.md`)
