# nickvasilescu/grokbot-clone architecture

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

- Interactive diagram: https://gitdiagram.com/nickvasilescu/grokbot-clone
- Repository: https://github.com/nickvasilescu/grokbot-clone

## Overview

Grokbot Clone is a self-hosted team of configurable Bots that work through chat, connected apps, and individual desktops. A user sends a task through the web app; server routes hand it to the agent loop, which builds context, calls the model, runs tools, and persists and streams progress. The product also supports Bot configuration and memory, groups and delegation, scheduled/event-driven work, computer viewing and control, and realtime voice. Edges reflect excerpts and README statements; unsampled subsystem links are included only where the README or source index supports them.

Main entry points: [`server/src/agent/loop.ts`](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/loop.ts) (Agent loop), [`web/src/App.tsx`](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/App.tsx) (App shell), [`server/src/agent/tools.ts`](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/tools.ts) (Agent tools), [`server/src/routes.ts`](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/routes.ts) (Server routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_webapp["App shell<br/>[App.tsx]"]
  node_client["Client state<br/>[store.ts]"]
  node_chat["Chat interface<br/>[ChatView.tsx]"]
  node_viewer["Computer viewer<br/>[ComputerViewer.tsx]"]
  node_configuration["Bot configuration"]
  node_tasksview["Tasks view<br/>[TasksView.tsx]"]
  node_voiceui["Voice controls<br/>[call.ts]"]
end

subgraph group_runtime["Bot runtime"]
  node_agent["Agent loop<br/>[loop.ts]"]
  node_tooling["Agent tools<br/>[tools.ts]"]
  node_memory["Memory and context<br/>[memory.ts]"]
end

subgraph group_work["Work coordination"]
  node_rooms["Groups and subagents<br/>[rooms.ts]"]
  node_scheduling["Routines and triggers<br/>[routines.ts]"]
  node_proactive["Proactive check-ins<br/>[proactive.ts]"]
end

subgraph group_integrations["Connected services"]
  node_computer["Computer manager<br/>[computer.ts]"]
  node_orgo["Orgo computers<br/>[orgo.ts]"]
  node_composio["Connected apps<br/>[composio.ts]"]
  node_voice["Voice sessions<br/>[voice.ts]"]
end

subgraph group_platform["Server platform"]
  node_api["HTTP API<br/>[api.ts]"]
  node_routes["Server routes<br/>[routes.ts]"]
  node_auth["Session auth<br/>[auth.ts]"]
  node_store["Data and Bot store<br/>[store.ts]"]
  node_database[("SQLite database<br/>[db.ts]")]
  node_hub["Event hub<br/>[hub.ts]"]
end

node_user(("User"))
node_xai["Grok API"]
node_orgoservice["Orgo service"]
node_composioservice["Composio service"]

node_user -->|"uses"| node_webapp
node_webapp -->|"loads state"| node_client
node_webapp -->|"renders"| node_chat
node_webapp -->|"renders"| node_viewer
node_webapp -->|"opens settings"| node_configuration
node_webapp -->|"renders"| node_tasksview
node_client -->|"fetches data"| node_api
node_chat -->|"uses state"| node_client
node_configuration -->|"uses state"| node_client
node_tasksview -->|"uses state"| node_client
node_voiceui -->|"starts calls"| node_voice
node_api -->|"sends requests"| node_routes
node_routes -->|"checks sessions"| node_auth
node_routes -->|"starts task turns"| node_agent
node_routes -->|"starts connections"| node_composio
node_routes -->|"changes routines"| node_scheduling
node_agent -->|"requests responses"| node_xai
node_agent -->|"executes tools"| node_tooling
node_agent -->|"compacts context"| node_memory
node_agent -->|"loads app tools"| node_composio
node_agent -->|"reads and writes"| node_store
node_tooling -->|"dispatches actions"| node_computer
node_tooling -->|"dispatches app actions"| node_composio
node_tooling -->|"delegates work"| node_rooms
node_tooling -->|"manages routines"| node_scheduling
node_tooling -->|"requests check-ins"| node_proactive
node_rooms -.->|"starts subagent work"| node_agent
node_scheduling -->|"runs Bot tasks"| node_agent
node_proactive -->|"prompts primary Bot"| node_agent
node_computer -->|"manages VM lifecycle"| node_orgo
node_orgo -->|"provisions computers"| node_orgoservice
node_composio -->|"connects apps"| node_composioservice
node_voice -->|"hands off tasks"| node_agent
node_store -->|"persists state"| node_database
node_store -->|"emits updates"| node_hub
node_routes -->|"streams events"| node_hub

click node_webapp "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/App.tsx"
click node_client "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/store.ts"
click node_chat "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/ChatView.tsx"
click node_viewer "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/ComputerViewer.tsx"
click node_configuration "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/config/BotSettingsModal.tsx"
click node_tasksview "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/config/TasksView.tsx"
click node_voiceui "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/voice/call.ts"
click node_api "https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/lib/api.ts"
click node_routes "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/routes.ts"
click node_auth "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/lib/auth.ts"
click node_agent "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/loop.ts"
click node_tooling "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/tools.ts"
click node_memory "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/memory.ts"
click node_rooms "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/rooms.ts"
click node_scheduling "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/routines.ts"
click node_proactive "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/proactive.ts"
click node_computer "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/computer.ts"
click node_orgo "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/orgo.ts"
click node_composio "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/composio.ts"
click node_voice "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/voice.ts"
click node_store "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/store.ts"
click node_database "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/db.ts"
click node_hub "https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/lib/hub.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_webapp,node_client,node_chat,node_viewer,node_configuration,node_tasksview,node_voiceui,node_user toneBlue
class node_agent,node_tooling,node_memory toneAmber
class node_rooms,node_scheduling,node_proactive,node_xai toneMint
class node_computer,node_orgo,node_composio,node_voice toneRose
class node_api,node_routes,node_auth,node_store,node_database,node_hub,node_orgoservice,node_composioservice toneIndigo
```

## Components

### Web app

- [App shell](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Client state](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/store.ts): `web/src/store.ts`
- [Chat interface](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/ChatView.tsx): `web/src/components/ChatView.tsx`
- [Computer viewer](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/ComputerViewer.tsx): `web/src/components/ComputerViewer.tsx`
- [Bot configuration](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/config/BotSettingsModal.tsx): `web/src/components/config/BotSettingsModal.tsx`
- [Tasks view](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/components/config/TasksView.tsx): `web/src/components/config/TasksView.tsx`
- [Voice controls](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/voice/call.ts): `web/src/voice/call.ts`

### Bot runtime

- [Agent loop](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/loop.ts): `server/src/agent/loop.ts`
- [Agent tools](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/tools.ts): `server/src/agent/tools.ts`
- [Memory and context](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/memory.ts): `server/src/agent/memory.ts`

### Work coordination

- [Groups and subagents](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/agent/rooms.ts): `server/src/agent/rooms.ts`
- [Routines and triggers](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/routines.ts): `server/src/routines.ts`
- [Proactive check-ins](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/proactive.ts): `server/src/proactive.ts`

### Connected services

- [Computer manager](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/computer.ts): `server/src/computer.ts`
- [Orgo computers](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/orgo.ts): `server/src/orgo.ts`
- [Connected apps](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/composio.ts): `server/src/composio.ts`
- [Voice sessions](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/voice.ts): `server/src/voice.ts`

### Server platform

- [HTTP API](https://github.com/nickvasilescu/grokbot-clone/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`
- [Server routes](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/routes.ts): `server/src/routes.ts`
- [Session auth](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/lib/auth.ts): `server/src/lib/auth.ts`
- [Data and Bot store](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/store.ts): `server/src/store.ts`
- [SQLite database](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/db.ts): `server/src/db.ts`
- [Event hub](https://github.com/nickvasilescu/grokbot-clone/blob/main/server/src/lib/hub.ts): `server/src/lib/hub.ts`

### Other components

- **User**
- **Grok API**
- **Orgo service**
- **Composio service**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Client state: loads state (evidence: `web/src/App.tsx`)
- App shell → Chat interface: renders (evidence: `web/src/App.tsx`)
- App shell → Computer viewer: renders (evidence: `web/src/App.tsx`)
- App shell → Bot configuration: opens settings (evidence: `web/src/App.tsx`)
- App shell → Tasks view: renders (evidence: `web/src/App.tsx`)
- Client state → HTTP API: fetches data (evidence: `web/src/store.ts`)
- Chat interface → Client state: uses state (evidence: `web/src/App.tsx`)
- Bot configuration → Client state: uses state (evidence: `web/src/components/config/BotSettingsModal.tsx`)
- Tasks view → Client state: uses state (evidence: `web/src/components/config/TasksView.tsx`)
- Voice controls → Voice sessions: starts calls (evidence: `README.md`)
- HTTP API → Server routes: sends requests (evidence: `README.md`)
- Server routes → Session auth: checks sessions (evidence: `server/src/routes.ts`)
- Server routes → Agent loop: starts task turns (evidence: `server/src/routes.ts`)
- Server routes → Connected apps: starts connections (evidence: `server/src/routes.ts`)
- Server routes → Routines and triggers: changes routines (evidence: `server/src/routes.ts`)
- Agent loop → Grok API: requests responses (evidence: `README.md`)
- Agent loop → Agent tools: executes tools (evidence: `README.md`)
- Agent loop → Memory and context: compacts context (evidence: `server/src/agent/loop.ts`)
- Agent loop → Connected apps: loads app tools (evidence: `server/src/agent/loop.ts`)
- Agent loop → Data and Bot store: reads and writes (evidence: `server/src/agent/loop.ts`)
- Agent tools → Computer manager: dispatches actions (evidence: `server/src/agent/tools.ts`)
- Agent tools → Connected apps: dispatches app actions (evidence: `server/src/agent/tools.ts`)
- Agent tools → Groups and subagents: delegates work (evidence: `server/src/agent/tools.ts`)
- Agent tools → Routines and triggers: manages routines (evidence: `server/src/agent/tools.ts`)
- Agent tools → Proactive check-ins: requests check-ins (evidence: `server/src/agent/tools.ts`)
- Groups and subagents → Agent loop: starts subagent work
- Routines and triggers → Agent loop: runs Bot tasks (evidence: `README.md`)
- Proactive check-ins → Agent loop: prompts primary Bot (evidence: `README.md`)
- Computer manager → Orgo computers: manages VM lifecycle (evidence: `server/src/computer.ts`)
- Orgo computers → Orgo service: provisions computers (evidence: `README.md`)
- Connected apps → Composio service: connects apps (evidence: `README.md`)
- Voice sessions → Agent loop: hands off tasks (evidence: `README.md`)
- Data and Bot store → SQLite database: persists state (evidence: `server/src/store.ts`)
- Data and Bot store → Event hub: emits updates (evidence: `server/src/store.ts`)
- Server routes → Event hub: streams events (evidence: `server/src/routes.ts`)
