# knitfury/g-bot-astra architecture

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

- Interactive diagram: https://gitdiagram.com/knitfury/g-bot-astra
- Repository: https://github.com/knitfury/g-bot-astra

## Overview

G-Bot Astra is a local-first Electron business workspace with a simulated browser demo and optional production account services. The primary workflow is to configure a BYOK model provider and remote MCP tools, ask G-Bot to work across connected business apps, review required approvals, and inspect activity or snapshots. The graph separates the user interface, desktop bridge, runtime execution, and persisted state. Some capabilities are documented but their source was not sampled; those links use README evidence, and unsampled implementation details are not inferred.

Main entry points: [`desktop/runtime/service.ts`](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/service.ts) (Workspace service), [`src/services/index.ts`](https://github.com/knitfury/g-bot-astra/blob/main/src/services/index.ts) (Service selection), [`desktop/main.ts`](https://github.com/knitfury/g-bot-astra/blob/main/desktop/main.ts) (Electron main process), [`desktop/runtime/orchestrator.ts`](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/orchestrator.ts) (Task orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace UI"]
  node_chat["Chat &amp; approvals<br/>[gbot-chat.tsx]"]
  node_connect["MCP connections"]
  node_providers_ui["Provider setup"]
  node_account_ui["Onboarding &amp; account<br/>[auth-screen.tsx]"]
  node_activity_ui["Activity &amp; settings"]
  node_workspace_state["Workspace state<br/>[workspace.ts]"]
end

subgraph group_bridge["Desktop Bridge"]
  node_services["Service selection<br/>[index.ts]"]
  node_desktop_client["Desktop service client<br/>[client.ts]"]
  node_main["Electron main process<br/>[main.ts]"]
end

subgraph group_runtime["Execution Runtime"]
  node_service["Workspace service<br/>[service.ts]"]
  node_orchestrator["Task orchestration<br/>[orchestrator.ts]"]
  node_provider_adapter["Model providers<br/>[providers.ts]"]
  node_mcp_adapter["MCP tools<br/>[mcp.ts]"]
  node_snapshots["Business snapshots<br/>[snapshots.ts]"]
  node_attachments["Attachments<br/>[attachments.ts]"]
end

subgraph group_state["Identity &amp; State"]
  node_identity["Production identity<br/>[identity.ts]"]
  node_secret_store[("Encrypted credentials<br/>[storage.ts]")]
  node_local_store[("Workspace persistence<br/>[storage.ts]")]
end

subgraph group_production["Production Services"]
  node_production_api["Account control API<br/>[control.ts]"]
  node_account_routes["Production API routes<br/>[route.ts]"]
end

node_user(("Workspace user"))
node_external_services{{"AI &amp; MCP services"}}

node_user -->|"asks"| node_chat
node_user -->|"configures"| node_connect
node_user -->|"configures"| node_providers_ui
node_user -->|"signs in"| node_account_ui
node_chat -->|"requests actions"| node_services
node_connect -->|"manages connections"| node_services
node_providers_ui -->|"manages providers"| node_services
node_account_ui -->|"authenticates"| node_services
node_activity_ui -.->|"reads activity"| node_services
node_workspace_state -->|"persists workspace"| node_desktop_client
node_services -->|"selects desktop"| node_desktop_client
node_desktop_client -.->|"sends IPC"| node_main
node_main -.->|"dispatches requests"| node_service
node_service -->|"delegates execution"| node_orchestrator
node_orchestrator -->|"requests inference"| node_provider_adapter
node_orchestrator -->|"invokes tools"| node_mcp_adapter
node_service -->|"builds snapshots"| node_snapshots
node_service -.->|"processes files"| node_attachments
node_service -->|"delegates identity"| node_identity
node_main -->|"initializes vault"| node_secret_store
node_service -.->|"stores credentials"| node_secret_store
node_main -.->|"persists state"| node_local_store
node_provider_adapter -.->|"calls providers"| node_external_services
node_mcp_adapter -.->|"connects remotely"| node_external_services
node_account_routes -->|"routes requests"| node_production_api
node_production_api -.->|"verifies accounts"| node_identity

click node_chat "https://github.com/knitfury/g-bot-astra/blob/main/src/components/chat/gbot-chat.tsx"
click node_connect "https://github.com/knitfury/g-bot-astra/blob/main/src/features/connections/connection-manager.tsx"
click node_providers_ui "https://github.com/knitfury/g-bot-astra/blob/main/src/features/providers/provider-manager.tsx"
click node_account_ui "https://github.com/knitfury/g-bot-astra/blob/main/src/features/auth/auth-screen.tsx"
click node_activity_ui "https://github.com/knitfury/g-bot-astra/blob/main/src/features/activity/activity-screen.tsx"
click node_workspace_state "https://github.com/knitfury/g-bot-astra/blob/main/src/stores/workspace.ts"
click node_services "https://github.com/knitfury/g-bot-astra/blob/main/src/services/index.ts"
click node_desktop_client "https://github.com/knitfury/g-bot-astra/blob/main/src/services/desktop/client.ts"
click node_main "https://github.com/knitfury/g-bot-astra/blob/main/desktop/main.ts"
click node_service "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/service.ts"
click node_orchestrator "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/orchestrator.ts"
click node_provider_adapter "https://github.com/knitfury/g-bot-astra/blob/main/desktop/adapters/providers.ts"
click node_mcp_adapter "https://github.com/knitfury/g-bot-astra/blob/main/desktop/adapters/mcp.ts"
click node_snapshots "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/snapshots.ts"
click node_attachments "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/attachments.ts"
click node_identity "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/identity.ts"
click node_secret_store "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/storage.ts"
click node_local_store "https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/storage.ts"
click node_production_api "https://github.com/knitfury/g-bot-astra/blob/main/src/production/server/control.ts"
click node_account_routes "https://github.com/knitfury/g-bot-astra/blob/main/src/app/api/control/%5Baction%5D/route.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_chat,node_connect,node_providers_ui,node_account_ui,node_activity_ui,node_workspace_state,node_user toneBlue
class node_services,node_desktop_client,node_main toneAmber
class node_service,node_orchestrator,node_provider_adapter,node_mcp_adapter,node_snapshots,node_attachments toneMint
class node_identity,node_secret_store,node_local_store toneRose
class node_production_api,node_account_routes,node_external_services toneIndigo
```

## Components

### Workspace UI

- [Chat & approvals](https://github.com/knitfury/g-bot-astra/blob/main/src/components/chat/gbot-chat.tsx): `src/components/chat/gbot-chat.tsx`
- [MCP connections](https://github.com/knitfury/g-bot-astra/blob/main/src/features/connections/connection-manager.tsx): `src/features/connections/connection-manager.tsx`
- [Provider setup](https://github.com/knitfury/g-bot-astra/blob/main/src/features/providers/provider-manager.tsx): `src/features/providers/provider-manager.tsx`
- [Onboarding & account](https://github.com/knitfury/g-bot-astra/blob/main/src/features/auth/auth-screen.tsx): `src/features/auth/auth-screen.tsx`
- [Activity & settings](https://github.com/knitfury/g-bot-astra/blob/main/src/features/activity/activity-screen.tsx): `src/features/activity/activity-screen.tsx`
- [Workspace state](https://github.com/knitfury/g-bot-astra/blob/main/src/stores/workspace.ts): `src/stores/workspace.ts`

### Desktop Bridge

- [Service selection](https://github.com/knitfury/g-bot-astra/blob/main/src/services/index.ts): `src/services/index.ts`
- [Desktop service client](https://github.com/knitfury/g-bot-astra/blob/main/src/services/desktop/client.ts): `src/services/desktop/client.ts`
- [Electron main process](https://github.com/knitfury/g-bot-astra/blob/main/desktop/main.ts): `desktop/main.ts`

### Execution Runtime

- [Workspace service](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/service.ts): `desktop/runtime/service.ts`
- [Task orchestration](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/orchestrator.ts): `desktop/runtime/orchestrator.ts`
- [Model providers](https://github.com/knitfury/g-bot-astra/blob/main/desktop/adapters/providers.ts): `desktop/adapters/providers.ts`
- [MCP tools](https://github.com/knitfury/g-bot-astra/blob/main/desktop/adapters/mcp.ts): `desktop/adapters/mcp.ts`
- [Business snapshots](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/snapshots.ts): `desktop/runtime/snapshots.ts`
- [Attachments](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/attachments.ts): `desktop/runtime/attachments.ts`

### Identity & State

- [Production identity](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/identity.ts): `desktop/runtime/identity.ts`
- [Encrypted credentials](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/storage.ts): `desktop/runtime/storage.ts`
- [Workspace persistence](https://github.com/knitfury/g-bot-astra/blob/main/desktop/runtime/storage.ts): `desktop/runtime/storage.ts`

### Production Services

- [Account control API](https://github.com/knitfury/g-bot-astra/blob/main/src/production/server/control.ts): `src/production/server/control.ts`
- [Production API routes](https://github.com/knitfury/g-bot-astra/blob/main/src/app/api/control/%5Baction%5D/route.ts): `src/app/api/control/[action]/route.ts`

### Other components

- **Workspace user**
- **AI & MCP services**

## Connections

- Workspace user → Chat & approvals: asks (evidence: `README.md`)
- Workspace user → MCP connections: configures (evidence: `README.md`)
- Workspace user → Provider setup: configures (evidence: `README.md`)
- Workspace user → Onboarding & account: signs in (evidence: `README.md`)
- Chat & approvals → Service selection: requests actions (evidence: `src/components/chat/gbot-chat.tsx`)
- MCP connections → Service selection: manages connections (evidence: `src/features/connections/connection-manager.tsx`)
- Provider setup → Service selection: manages providers (evidence: `src/features/providers/provider-manager.tsx`)
- Onboarding & account → Service selection: authenticates (evidence: `src/features/auth/auth-screen.tsx`)
- Activity & settings → Service selection: reads activity (evidence: `README.md`)
- Workspace state → Desktop service client: persists workspace (evidence: `src/stores/workspace.ts`)
- Service selection → Desktop service client: selects desktop (evidence: `src/services/index.ts`)
- Desktop service client → Electron main process: sends IPC (evidence: `README.md`)
- Electron main process → Workspace service: dispatches requests (evidence: `desktop/main.ts`)
- Workspace service → Task orchestration: delegates execution (evidence: `desktop/runtime/service.ts`)
- Task orchestration → Model providers: requests inference (evidence: `desktop/runtime/orchestrator.ts`)
- Task orchestration → MCP tools: invokes tools (evidence: `desktop/runtime/orchestrator.ts`)
- Workspace service → Business snapshots: builds snapshots (evidence: `desktop/runtime/service.ts`)
- Workspace service → Attachments: processes files (evidence: `README.md`)
- Workspace service → Production identity: delegates identity (evidence: `desktop/runtime/service.ts`)
- Electron main process → Encrypted credentials: initializes vault (evidence: `desktop/main.ts`)
- Workspace service → Encrypted credentials: stores credentials (evidence: `README.md`)
- Electron main process → Workspace persistence: persists state (evidence: `README.md`)
- Model providers → AI & MCP services: calls providers (evidence: `README.md`)
- MCP tools → AI & MCP services: connects remotely (evidence: `README.md`)
- Production API routes → Account control API: routes requests (evidence: `src/app/api/control/[action]/route.ts`)
- Account control API → Production identity: verifies accounts (evidence: `README.md`)
