# fathah/hermes-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/fathah/hermes-desktop
- Repository: https://github.com/fathah/hermes-desktop

## Overview

#### Purpose and Entry Points
Hermes One is a native Electron desktop client that installs, configures, and operates the upstream Hermes Agent. It supports local Hermes (`~/.hermes`, API typically on `127.0.0.1:8642`) or a remote Hermes API, exposing chat, profiles, sessions, providers, tools, schedules, messaging gateways, memory, and a 3D Office UI.

- Electron main bootstrap: `src/main/index.ts`, `src/main/app/start.ts`
- React renderer bootstrap and root routing/UI: `src/renderer/src/main.tsx`, `src/renderer/src/App.tsx`
- Build/runtime wiring: `electron.vite.config.ts`, `electron-builder.yml`

#### Electron Process Boundary
The app is split into a privileged Node/Electron main process and an unprivileged React renderer. The preload layer defines the renderer-accessible API; IPC registration centralizes calls from UI to filesystem, process spawning, local/remote API access, and persisted Hermes state.

- Main IPC registration: `src/main/ipc/register.ts`
- Preload bridge: `src/preload/index.ts`, `src/preload/index.d.ts`
- Security and privileged operations: `src/main/security.ts`, `src/main/askpass.ts`

#### Setup, Installation, and Runtime Targeting
First-run control flow selects local versus remote operation. Local mode detects or installs Hermes through the official installer, writes Hermes configuration, and starts/manages local processes. Remote mode validates a configured URL/API key and bypasses local installation. SSH/Docker support provides another execution-location boundary.

- Installer and provisioning: `src/main/installer.ts`, `src/main/hermesone-provision.ts`
- Local/remote routing and API client: `src/main/remote-api.ts`, `src/main/api-url.ts`
- SSH/Docker transport: `src/main/ssh-remote.ts`, `src/main/ssh-docker.ts`

#### Agent Configuration, Profiles, and Secrets
Hermes configuration is managed as files and state under `~/.hermes`, with isolated named profiles. Provider/model configuration is mediated by registries and stores. Secrets resolve in priority order from process environment, `.env`, then an optional command-backed secret provider; command execution is deliberately confined to the main process.

- Config/profile lifecycle: `src/main/config.ts`, `src/main/profiles.ts`
- Provider and model management: `src/main/providers.ts`, `src/main/models.ts`, `src/main/provider-registry.ts`
- Secret-provider boundary: `src/main/secrets/index.ts`, `src/main/secrets/commandProvider.ts`

#### Chat and Streaming Data Flow
Chat UI submits messages, attachments, model choices, and slash-command effects through IPC or the dashboard transport. The main process calls the Hermes local/remote API and parses streamed SSE output. Stream events are converted into transcript updates, live tool/reasoning status, approvals, and token usage; sessions are persisted and can be resumed.

- Main stream orchestration: `src/main/run-stream.ts`, `src/main/sse-parser.ts`
- Chat screen and IPC state: `src/renderer/src/screens/Chat/Chat.tsx`, `src/renderer/src/screens/Chat/hooks/useChatIPC.ts`
- Shared stream contracts: `src/shared/chat-stream.ts`, `src/shared/chat-approval.ts`

#### Persistent Agent Workspace Features
The main process manages Hermes-backed session history, SQLite-related state access, memory, skills, tool configuration, cron jobs, and messaging platforms. Renderer screens are primarily views/controllers over those APIs rather than independent backends.

- Sessions and database access: `src/main/sessions.ts`, `src/main/db.ts`
- Agent capabilities: `src/main/memory.ts`, `src/main/skills.ts`, `src/main/tools.ts`
- Scheduled and messaging execution configuration: `src/main/cronjobs.ts`, `src/main/messaging-platforms.ts`

#### Remote Dashboard and Gateway Integration
A dashboard subsystem can launch or connect to a web/dashboard endpoint and relay WebSocket traffic, including chat transport adaptation. Messaging gateways are configured through Hermes and can require propagated environment/secrets. These are external-service boundaries alongside LLM providers and tool integrations.

- Dashboard launch/relay: `src/main/dashboard-launch.ts`, `src/main/dashboard-websocket-relay.ts`
- Renderer dashboard transport: `src/renderer/src/screens/Chat/hooks/useDashboardChatTransport.ts`
- Gateway UI: `src/renderer/src/screens/Gateway/Gateway.tsx`

#### Specialized Visual and Distribution Systems
The Office feature is a separate React/3D subsystem with scene, routing, presence, and interaction models, fed by Hermes/Office status rather than replacing core chat. Releases package Electron for desktop platforms, with auto-update support where packaging permits.

- Office startup/backend coordination: `src/main/office-start.ts`, `src/main/claw3d.ts`
- 3D scene and interaction domain: `src/renderer/src/screens/Office/office3d/Office3D.tsx`, `src/renderer/src/screens/Office/office3d/interactions/registry.ts`
- Packaging/updating: `src/main/app/updater.ts`, `build/afterPack.js`

Main entry points: [`src/main/ipc/register.ts`](https://github.com/fathah/hermes-desktop/blob/main/src/main/ipc/register.ts) (IPC registry), [`src/main/remote-api.ts`](https://github.com/fathah/hermes-desktop/blob/main/src/main/remote-api.ts) (Runtime API router), [`src/renderer/src/App.tsx`](https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/App.tsx) (App routing), [`src/main/installer.ts`](https://github.com/fathah/hermes-desktop/blob/main/src/main/installer.ts) (Provisioning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_renderer["Renderer UI"]
  node_renderer_root["App routing<br/>React root<br/>[App.tsx]"]
  node_chat_ui["Chat UI<br/>chat controller<br/>[Chat.tsx]"]
  node_dashboard_transport["Dashboard transport<br/>WebSocket chat transport"]
  node_gateway_ui["Gateway UI<br/>gateway controller<br/>[Gateway.tsx]"]
  node_office_3d["Office 3D<br/>3D scene UI<br/>[Office3D.tsx]"]
end

subgraph group_electron["Electron Main"]
  node_preload{{"Preload bridge<br/>IPC API boundary<br/>[index.ts]"}}
  node_main_bootstrap["Main bootstrap<br/>Electron lifecycle<br/>[index.ts]"]
  node_ipc{{"IPC registry<br/>privileged API handlers<br/>[register.ts]"}}
  node_provisioning["Provisioning<br/>installer and setup<br/>[installer.ts]"]
  node_api_router["Runtime API router<br/>local/remote client<br/>[remote-api.ts]"]
  node_stream_orchestrator["Chat stream orchestrator<br/>SSE orchestration<br/>[run-stream.ts]"]
  node_dashboard_relay["Dashboard relay<br/>WebSocket relay"]
  node_office_backend["Office backend<br/>Office coordination<br/>[office-start.ts]"]
end

subgraph group_runtime["Hermes Runtime"]
  node_hermes_target{{"Hermes Agent API<br/>agent runtime"}}
  node_ssh_docker["SSH/Docker transport<br/>execution transport<br/>[ssh-remote.ts]"]
end

subgraph group_workspace["Agent Workspace"]
  node_hermes_home[("~/.hermes state<br/>config and session store<br/>[config.ts]")]
  node_providers_secrets["Providers and secrets<br/>credential management<br/>[providers.ts]"]
  node_agent_features["Agent feature config<br/>capability state<br/>[tools.ts]"]
end

subgraph group_distribution["Distribution"]
  node_packaging["Desktop packaging<br/>release pipeline"]
  node_updater["Auto updater<br/>release client<br/>[updater.ts]"]
end

node_renderer_root -->|"renders"| node_chat_ui
node_renderer_root -->|"renders"| node_gateway_ui
node_renderer_root -->|"renders"| node_office_3d
node_chat_ui -->|"IPC requests/events"| node_preload
node_preload -->|"approved API"| node_ipc
node_main_bootstrap -->|"registers"| node_ipc
node_main_bootstrap -->|"starts setup"| node_provisioning
node_provisioning -->|"sets runtime mode"| node_api_router
node_provisioning -->|"writes local config"| node_hermes_home
node_ipc -->|"chat operations"| node_stream_orchestrator
node_stream_orchestrator -->|"stream API calls"| node_api_router
node_api_router -->|"HTTP API"| node_hermes_target
node_api_router -.->|"remote execution"| node_ssh_docker
node_ipc -->|"profiles, sessions, state"| node_hermes_home
node_ipc -->|"provider configuration"| node_providers_secrets
node_providers_secrets -.->|"credentials and models"| node_hermes_target
node_ipc -->|"configure capabilities"| node_agent_features
node_agent_features -->|"agent configuration"| node_hermes_target
node_dashboard_transport -->|"WebSocket traffic"| node_dashboard_relay
node_dashboard_relay -->|"dashboard relay"| node_hermes_target
node_office_3d -->|"Office status"| node_office_backend
node_office_backend -->|"coordinates status"| node_hermes_target
node_packaging -->|"ships updater"| node_updater

click node_renderer_root "https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/App.tsx"
click node_chat_ui "https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Chat/Chat.tsx"
click node_dashboard_transport "https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Chat/hooks/useDashboardChatTransport.ts"
click node_gateway_ui "https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Gateway/Gateway.tsx"
click node_office_3d "https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Office/office3d/Office3D.tsx"
click node_preload "https://github.com/fathah/hermes-desktop/blob/main/src/preload/index.ts"
click node_main_bootstrap "https://github.com/fathah/hermes-desktop/blob/main/src/main/index.ts"
click node_ipc "https://github.com/fathah/hermes-desktop/blob/main/src/main/ipc/register.ts"
click node_provisioning "https://github.com/fathah/hermes-desktop/blob/main/src/main/installer.ts"
click node_api_router "https://github.com/fathah/hermes-desktop/blob/main/src/main/remote-api.ts"
click node_stream_orchestrator "https://github.com/fathah/hermes-desktop/blob/main/src/main/run-stream.ts"
click node_dashboard_relay "https://github.com/fathah/hermes-desktop/blob/main/src/main/dashboard-websocket-relay.ts"
click node_office_backend "https://github.com/fathah/hermes-desktop/blob/main/src/main/office-start.ts"
click node_ssh_docker "https://github.com/fathah/hermes-desktop/blob/main/src/main/ssh-remote.ts"
click node_hermes_home "https://github.com/fathah/hermes-desktop/blob/main/src/main/config.ts"
click node_providers_secrets "https://github.com/fathah/hermes-desktop/blob/main/src/main/providers.ts"
click node_agent_features "https://github.com/fathah/hermes-desktop/blob/main/src/main/tools.ts"
click node_packaging "https://github.com/fathah/hermes-desktop/blob/main/electron-builder.yml"
click node_updater "https://github.com/fathah/hermes-desktop/blob/main/src/main/app/updater.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_root,node_chat_ui,node_dashboard_transport,node_gateway_ui,node_office_3d toneBlue
class node_preload,node_main_bootstrap,node_ipc,node_provisioning,node_api_router,node_stream_orchestrator,node_dashboard_relay,node_office_backend toneAmber
class node_hermes_target,node_ssh_docker toneMint
class node_hermes_home,node_providers_secrets,node_agent_features toneRose
class node_packaging,node_updater toneIndigo
```

## Components

### Renderer UI

Unprivileged React application.

- [App routing](https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/App.tsx): React root · `src/renderer/src/App.tsx`
- [Chat UI](https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Chat/Chat.tsx): chat controller · Submits chat state and renders streamed transcript updates. · `src/renderer/src/screens/Chat/Chat.tsx`
- [Dashboard transport](https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Chat/hooks/useDashboardChatTransport.ts): WebSocket chat transport · `src/renderer/src/screens/Chat/hooks/useDashboardChatTransport.ts`
- [Gateway UI](https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Gateway/Gateway.tsx): gateway controller · `src/renderer/src/screens/Gateway/Gateway.tsx`
- [Office 3D](https://github.com/fathah/hermes-desktop/blob/main/src/renderer/src/screens/Office/office3d/Office3D.tsx): 3D scene UI · Separate visual presence and interaction subsystem. · `src/renderer/src/screens/Office/office3d/Office3D.tsx`

### Electron Main

Privileged desktop orchestration.

- [Preload bridge](https://github.com/fathah/hermes-desktop/blob/main/src/preload/index.ts): IPC API boundary · Exposes the approved main-process API to the renderer. · `src/preload/index.ts`
- [Main bootstrap](https://github.com/fathah/hermes-desktop/blob/main/src/main/index.ts): Electron lifecycle · `src/main/index.ts`
- [IPC registry](https://github.com/fathah/hermes-desktop/blob/main/src/main/ipc/register.ts): privileged API handlers · Centralizes UI access to files, processes, state, and Hermes APIs. · `src/main/ipc/register.ts`
- [Provisioning](https://github.com/fathah/hermes-desktop/blob/main/src/main/installer.ts): installer and setup · Selects local or remote mode and installs/configures local Hermes. · `src/main/installer.ts`
- [Runtime API router](https://github.com/fathah/hermes-desktop/blob/main/src/main/remote-api.ts): local/remote client · Routes Hermes API calls to the configured target. · `src/main/remote-api.ts`
- [Chat stream orchestrator](https://github.com/fathah/hermes-desktop/blob/main/src/main/run-stream.ts): SSE orchestration · Converts Hermes stream events into transcript, tool, approval, and usage updates. · `src/main/run-stream.ts`
- [Dashboard relay](https://github.com/fathah/hermes-desktop/blob/main/src/main/dashboard-websocket-relay.ts): WebSocket relay · `src/main/dashboard-websocket-relay.ts`
- [Office backend](https://github.com/fathah/hermes-desktop/blob/main/src/main/office-start.ts): Office coordination · `src/main/office-start.ts`

### Hermes Runtime

Local, remote, and hosted agent targets.

- **Hermes Agent API**: agent runtime · Local API, configured remote API, or dashboard-connected Hermes endpoint.
- [SSH/Docker transport](https://github.com/fathah/hermes-desktop/blob/main/src/main/ssh-remote.ts): execution transport · Alternative boundary for running against Hermes elsewhere. · `src/main/ssh-remote.ts`

### Agent Workspace

Persistent Hermes configuration and state.

- [~/.hermes state](https://github.com/fathah/hermes-desktop/blob/main/src/main/config.ts): config and session store · Profiles, configuration, sessions, and agent-managed state. · `src/main/config.ts`
- [Providers and secrets](https://github.com/fathah/hermes-desktop/blob/main/src/main/providers.ts): credential management · Resolves provider/model settings and main-process secret sources. · `src/main/providers.ts`
- [Agent feature config](https://github.com/fathah/hermes-desktop/blob/main/src/main/tools.ts): capability state · Memory, skills, tools, schedules, and messaging gateway configuration. · `src/main/tools.ts`

### Distribution

Desktop packaging and updates.

- [Desktop packaging](https://github.com/fathah/hermes-desktop/blob/main/electron-builder.yml): release pipeline · `electron-builder.yml`
- [Auto updater](https://github.com/fathah/hermes-desktop/blob/main/src/main/app/updater.ts): release client · `src/main/app/updater.ts`

## Connections

- App routing → Chat UI: renders
- App routing → Gateway UI: renders
- App routing → Office 3D: renders
- Chat UI → Preload bridge: IPC requests/events
- Preload bridge → IPC registry: approved API
- Main bootstrap → IPC registry: registers
- Main bootstrap → Provisioning: starts setup
- Provisioning → Runtime API router: sets runtime mode
- Provisioning → ~/.hermes state: writes local config
- IPC registry → Chat stream orchestrator: chat operations
- Chat stream orchestrator → Runtime API router: stream API calls
- Runtime API router → Hermes Agent API: HTTP API
- Runtime API router → SSH/Docker transport: remote execution
- IPC registry → ~/.hermes state: profiles, sessions, state
- IPC registry → Providers and secrets: provider configuration
- Providers and secrets → Hermes Agent API: credentials and models
- IPC registry → Agent feature config: configure capabilities
- Agent feature config → Hermes Agent API: agent configuration
- Dashboard transport → Dashboard relay: WebSocket traffic
- Dashboard relay → Hermes Agent API: dashboard relay
- Office 3D → Office backend: Office status
- Office backend → Hermes Agent API: coordinates status
- Desktop packaging → Auto updater: ships updater
