# debugdwrld/grok-bot-0.18-reconstructed architecture

> Architecture diagram of the GitHub repository debugdwrld/grok-bot-0.18-reconstructed, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/debugdwrld/grok-bot-0.18-reconstructed
- Repository: https://github.com/debugdwrld/grok-bot-0.18-reconstructed

## Overview

Grok Bot 0.18 Reconstructed is a source-oriented reconstruction of a macOS desktop agent app. A user configures a provider in the renderer, sends a conversation turn, and the desktop runtime routes it through the coordinator and host for inference and tool execution; results return as conversation activity. Other product branches include account/session handling, MCP/plugins, computer sandbox control, local-tool approvals, automations, and review. README documents the runtime boundaries and provider/local-Docker options; sampled excerpts show selected routing, sending, and MCP behavior, not every subsystem’s wiring.

Main entry points: [`source/host`](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/host) (Host runtime), [`source/node-agent-coordinator/inference-router.ts`](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/node-agent-coordinator/inference-router.ts) (Routed turns), [`source/electron-main/main-edge.ts`](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/main-edge.ts) (Electron main), [`source/host/extensions/inference/inference-service.ts`](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/inference/inference-service.ts) (Inference service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_renderer["Renderer UI<br/>[main.tsx]"]
  node_contracts["Desktop RPC<br/>[main-rpc.ts]"]
  node_main["Electron main<br/>[main-edge.ts]"]
  node_accounts["Account and auth"]
  node_coordinator["Coordinator"]
end

subgraph group_conversation["Conversation runtime"]
  node_host["Host runtime"]
  node_send["Turn submission<br/>[send-pipeline.ts]"]
  node_summarization["Conversation summaries<br/>[pipeline.ts]"]
end

subgraph group_providers["Inference routing"]
  node_router["Routed turns"]
  node_inference["Inference service"]
  node_provider_contract["Provider choices"]
  node_local_auth["Local CLI auth"]
  node_usage["Router usage model"]
end

subgraph group_tools["Tools and plugins"]
  node_mcp_desktop["Desktop MCP manager"]
  node_mcp_host["Host MCP manager<br/>[mcp-manager.ts]"]
  node_tool_permission["Tool approvals"]
end

subgraph group_capabilities["Agent capabilities"]
  node_computer["Computer sandbox"]
  node_box_sync[("Box store sync")]
  node_auto_review["Auto review"]
  node_automation["Automations"]
end

node_user(("User"))
node_provider_services["Inference providers"]

node_user -->|"uses"| node_renderer
node_renderer -->|"invokes RPC"| node_contracts
node_contracts -->|"dispatches"| node_main
node_main -->|"owns runtime"| node_coordinator
node_main -->|"manages auth"| node_accounts
node_coordinator -->|"connects"| node_host
node_host -->|"accepts turns"| node_send
node_router -->|"runs provider"| node_inference
node_inference -->|"reads choices"| node_provider_contract
node_inference -->|"calls"| node_provider_services
node_router -->|"runs routed requests"| node_provider_services
node_router -->|"dispatches MCP"| node_mcp_host
node_mcp_desktop -->|"manages MCP"| node_mcp_host
node_host -->|"requests approval"| node_tool_permission
node_main -->|"manages box"| node_computer
node_computer -->|"syncs store"| node_box_sync
node_host -->|"handles review"| node_auto_review
node_host -->|"summarizes turns"| node_summarization
node_renderer -->|"presents routines"| node_automation
node_router -->|"tracks usage"| node_usage
node_local_auth -.->|"checks local auth"| node_inference

click node_renderer "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/frontend/src/main.tsx"
click node_contracts "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/frontend/src/recovered/contracts/main-rpc.ts"
click node_main "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/main-edge.ts"
click node_accounts "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/electron-main/account"
click node_coordinator "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/coordinator/production-root-provider.ts"
click node_host "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/host"
click node_send "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/transcript/send-pipeline.ts"
click node_router "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/node-agent-coordinator/inference-router.ts"
click node_inference "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/inference/inference-service.ts"
click node_provider_contract "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/inference-router.ts"
click node_local_auth "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/node/inference-router-local.ts"
click node_mcp_desktop "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/mcp/desktop-mcp-manager.ts"
click node_mcp_host "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/node/mcp/mcp-manager.ts"
click node_tool_permission "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/local-tool-permission/local-tool-permission-controller.ts"
click node_computer "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/electron-main/box"
click node_box_sync "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/box-store-sync/box-store-pack-pipeline.ts"
click node_auto_review "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/auto-review/auto-review-service.ts"
click node_automation "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/frontend/src/recovered/features/automations/routines"
click node_summarization "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/packages/agent-summarization/pipeline.ts"
click node_usage "https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/inference-router.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_renderer,node_contracts,node_main,node_accounts,node_coordinator,node_user toneBlue
class node_host,node_send,node_summarization toneAmber
class node_router,node_inference,node_provider_contract,node_local_auth,node_usage toneMint
class node_mcp_desktop,node_mcp_host,node_tool_permission toneRose
class node_computer,node_box_sync,node_auto_review,node_automation,node_provider_services toneIndigo
```

## Components

### Desktop runtime

- [Renderer UI](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Desktop RPC](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/frontend/src/recovered/contracts/main-rpc.ts): `frontend/src/recovered/contracts/main-rpc.ts`
- [Electron main](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/main-edge.ts): `source/electron-main/main-edge.ts`
- [Account and auth](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/electron-main/account): `source/electron-main/account`
- [Coordinator](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/coordinator/production-root-provider.ts): `source/electron-main/coordinator/production-root-provider.ts`

### Conversation runtime

- [Host runtime](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/host): `source/host`
- [Turn submission](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/transcript/send-pipeline.ts): `source/host/extensions/transcript/send-pipeline.ts`
- [Conversation summaries](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/packages/agent-summarization/pipeline.ts): `source/packages/agent-summarization/pipeline.ts`

### Inference routing

- [Routed turns](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/node-agent-coordinator/inference-router.ts): `source/node-agent-coordinator/inference-router.ts`
- [Inference service](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/inference/inference-service.ts): `source/host/extensions/inference/inference-service.ts`
- [Provider choices](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/inference-router.ts): `source/shared/inference-router.ts`
- [Local CLI auth](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/node/inference-router-local.ts): `source/shared/node/inference-router-local.ts`
- [Router usage model](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/inference-router.ts): `source/shared/inference-router.ts`

### Tools and plugins

- [Desktop MCP manager](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/electron-main/mcp/desktop-mcp-manager.ts): `source/electron-main/mcp/desktop-mcp-manager.ts`
- [Host MCP manager](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/shared/node/mcp/mcp-manager.ts): `source/shared/node/mcp/mcp-manager.ts`
- [Tool approvals](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/local-tool-permission/local-tool-permission-controller.ts): `source/host/extensions/local-tool-permission/local-tool-permission-controller.ts`

### Agent capabilities

- [Computer sandbox](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/source/electron-main/box): `source/electron-main/box`
- [Box store sync](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/box-store-sync/box-store-pack-pipeline.ts): `source/host/extensions/box-store-sync/box-store-pack-pipeline.ts`
- [Auto review](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/blob/main/source/host/extensions/auto-review/auto-review-service.ts): `source/host/extensions/auto-review/auto-review-service.ts`
- [Automations](https://github.com/debugdwrld/grok-bot-0.18-reconstructed/tree/main/frontend/src/recovered/features/automations/routines): `frontend/src/recovered/features/automations/routines`

### Other components

- **User**
- **Inference providers**

## Connections

- User → Renderer UI: uses
- Renderer UI → Desktop RPC: invokes RPC
- Desktop RPC → Electron main: dispatches
- Electron main → Coordinator: owns runtime
- Electron main → Account and auth: manages auth
- Coordinator → Host runtime: connects
- Host runtime → Turn submission: accepts turns
- Routed turns → Inference service: runs provider
- Inference service → Provider choices: reads choices
- Inference service → Inference providers: calls
- Routed turns → Inference providers: runs routed requests
- Routed turns → Host MCP manager: dispatches MCP
- Desktop MCP manager → Host MCP manager: manages MCP
- Host runtime → Tool approvals: requests approval
- Electron main → Computer sandbox: manages box
- Computer sandbox → Box store sync: syncs store
- Host runtime → Auto review: handles review
- Host runtime → Conversation summaries: summarizes turns
- Renderer UI → Automations: presents routines
- Routed turns → Router usage model: tracks usage
- Local CLI auth → Inference service: checks local auth
