# fatihaybsn/avalon architecture

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

- Interactive diagram: https://gitdiagram.com/fatihaybsn/avalon
- Repository: https://github.com/fatihaybsn/avalon

## Overview

Avalon is a Windows personal assistant built around the OpenClaw Gateway: users chat or start work in the desktop UI; the desktop sends requests through the authenticated Gateway, where the JARVIS plugin applies task and tool policies, records work, and can dispatch explicitly selected Codex or OpenCode workers. Other documented capabilities include voice, memory and Dreaming, scheduled work, controlled Windows GUI actions, quick operations, and native document reading. Several plugin subsystems are represented by their exact directory because their implementation files were not sampled; those branches reflect README capabilities, not inspected internal call paths.

Main entry points: [`plugins/jarvis/index.ts`](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/index.ts) (JARVIS plugin), [`apps/desktop/src/main/gateway.ts`](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/gateway.ts) (Gateway client), [`apps/desktop/src/main/voice-host.ts`](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/voice-host.ts) (Voice host), [`apps/desktop/src/main/main.ts`](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/main.ts) (Desktop host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_renderer["Desktop UI<br/>[app.ts]"]
  node_desktop_main["Desktop host<br/>[main.ts]"]
  node_controller["Chat controller<br/>[controller.ts]"]
  node_contracts["UI contracts<br/>[contracts.ts]"]
end

subgraph group_gateway["Gateway and plugin"]
  node_gateway_client["Gateway client<br/>[gateway.ts]"]
  node_profile["Connection profile<br/>[profile.ts]"]
  node_vault[("Device vault<br/>[vault.ts]")]
  node_plugin["JARVIS plugin<br/>[index.ts]"]
  node_policy["Tool policy<br/>[policy.ts]"]
end

subgraph group_work["Task execution"]
  node_work_ledger[("Work ledger<br/>[work.ts]")]
  node_worker_contract["Worker contract<br/>[worker-contract.ts]"]
  node_worker_dispatch["Worker dispatch<br/>[workers.ts]"]
  node_codex["Codex worker<br/>[codex.ts]"]
  node_opencode["OpenCode worker<br/>[opencode.ts]"]
end

subgraph group_local["Local capabilities"]
  node_memory[("Memory and notes<br/>[notes.ts]")]
  node_dreaming["Dreaming<br/>[dreaming.ts]"]
  node_automation["Automation<br/>[automations.ts]"]
  node_quick["Quick Windows actions<br/>[quick.ts]"]
  node_gui["GUI policy<br/>[gui-policy.ts]"]
  node_native_windows["Windows operations<br/>[Windows.cs]"]
  node_documents["Document readers<br/>[document.py]"]
end

subgraph group_voice["Voice"]
  node_voice_host["Voice host<br/>[voice-host.ts]"]
  node_voice_policy["Voice decisions<br/>[voice-policy.ts]"]
  node_voice_media["Voice media<br/>[voice-media.ts]"]
end

node_user(("User"))
node_gemini(("Gemini Live"))
node_gateway_service{{"OpenClaw Gateway"}}
node_tavily{{"Tavily research"}}

node_user -->|"uses"| node_renderer
node_renderer -->|"submits actions"| node_desktop_main
node_desktop_main -->|"starts and routes"| node_gateway_client
node_desktop_main -->|"initializes"| node_controller
node_renderer -->|"uses types"| node_contracts
node_controller -->|"sends RPC"| node_gateway_client
node_controller -->|"projects state"| node_contracts
node_gateway_client -->|"loads settings"| node_profile
node_gateway_client -->|"loads identity"| node_vault
node_gateway_client -->|"connects"| node_gateway_service
node_gateway_service -->|"hosts plugin"| node_plugin
node_plugin -->|"applies policy"| node_policy
node_policy -->|"admits note tools"| node_memory
node_policy -->|"checks quick actions"| node_quick
node_policy -->|"checks GUI tools"| node_gui
node_plugin -->|"registers work"| node_work_ledger
node_worker_dispatch -->|"validates selection"| node_worker_contract
node_worker_dispatch -->|"dispatches Codex"| node_codex
node_worker_dispatch -->|"dispatches OpenCode"| node_opencode
node_codex -->|"uses contract"| node_worker_contract
node_opencode -->|"uses contract"| node_worker_contract
node_plugin -->|"registers workers"| node_worker_dispatch
node_plugin -->|"admits Dreaming"| node_dreaming
node_plugin -.->|"supports automation"| node_automation
node_quick -.->|"invokes operations"| node_native_windows
node_gui -.->|"guards GUI access"| node_native_windows
node_plugin -.->|"offers reading"| node_documents
node_plugin -.->|"requests research"| node_tavily
node_desktop_main -->|"initializes voice"| node_voice_host
node_voice_host -->|"checks decisions"| node_voice_policy
node_voice_host -->|"uses Gateway RPC"| node_gateway_client
node_voice_media -.->|"exchanges voice"| node_voice_host
node_voice_host -.->|"connects Live"| node_gemini
node_plugin -->|"records task state"| node_work_ledger

click node_renderer "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/renderer/app.ts"
click node_desktop_main "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/main.ts"
click node_controller "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/controller.ts"
click node_contracts "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/shared/contracts.ts"
click node_gateway_client "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/gateway.ts"
click node_profile "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/profile.ts"
click node_vault "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/vault.ts"
click node_plugin "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/index.ts"
click node_policy "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/policy.ts"
click node_work_ledger "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/work.ts"
click node_worker_contract "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/worker-contract.ts"
click node_worker_dispatch "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/workers.ts"
click node_codex "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/codex.ts"
click node_opencode "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/opencode.ts"
click node_memory "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/notes.ts"
click node_dreaming "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/dreaming.ts"
click node_automation "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/automations.ts"
click node_quick "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/quick.ts"
click node_gui "https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/gui-policy.ts"
click node_native_windows "https://github.com/fatihaybsn/avalon/blob/master/native/windows/Windows.cs"
click node_documents "https://github.com/fatihaybsn/avalon/blob/master/native/windows/document.py"
click node_voice_host "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/voice-host.ts"
click node_voice_policy "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/voice-policy.ts"
click node_voice_media "https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/renderer/voice-media.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_desktop_main,node_controller,node_contracts,node_user toneBlue
class node_gateway_client,node_profile,node_vault,node_plugin,node_policy toneAmber
class node_work_ledger,node_worker_contract,node_worker_dispatch,node_codex,node_opencode toneMint
class node_memory,node_dreaming,node_automation,node_quick,node_gui,node_native_windows,node_documents toneRose
class node_voice_host,node_voice_policy,node_voice_media,node_gemini,node_gateway_service,node_tavily toneIndigo
```

## Components

### Desktop experience

- [Desktop UI](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/renderer/app.ts): `apps/desktop/src/renderer/app.ts`
- [Desktop host](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/main.ts): `apps/desktop/src/main/main.ts`
- [Chat controller](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/controller.ts): `apps/desktop/src/main/controller.ts`
- [UI contracts](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/shared/contracts.ts): `apps/desktop/src/shared/contracts.ts`

### Gateway and plugin

- [Gateway client](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/gateway.ts): `apps/desktop/src/main/gateway.ts`
- [Connection profile](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/profile.ts): `apps/desktop/src/main/profile.ts`
- [Device vault](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/vault.ts): `apps/desktop/src/main/vault.ts`
- [JARVIS plugin](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/index.ts): `plugins/jarvis/index.ts`
- [Tool policy](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/policy.ts): `plugins/jarvis/policy.ts`

### Task execution

- [Work ledger](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/work.ts): `plugins/jarvis/work.ts`
- [Worker contract](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/worker-contract.ts): `plugins/jarvis/worker-contract.ts`
- [Worker dispatch](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/workers.ts): `plugins/jarvis/workers.ts`
- [Codex worker](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/codex.ts): `plugins/jarvis/codex.ts`
- [OpenCode worker](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/opencode.ts): `plugins/jarvis/opencode.ts`

### Local capabilities

- [Memory and notes](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/notes.ts): `plugins/jarvis/notes.ts`
- [Dreaming](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/dreaming.ts): `plugins/jarvis/dreaming.ts`
- [Automation](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/automations.ts): `plugins/jarvis/automations.ts`
- [Quick Windows actions](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/quick.ts): `plugins/jarvis/quick.ts`
- [GUI policy](https://github.com/fatihaybsn/avalon/blob/master/plugins/jarvis/gui-policy.ts): `plugins/jarvis/gui-policy.ts`
- [Windows operations](https://github.com/fatihaybsn/avalon/blob/master/native/windows/Windows.cs): `native/windows/Windows.cs`
- [Document readers](https://github.com/fatihaybsn/avalon/blob/master/native/windows/document.py): `native/windows/document.py`

### Voice

- [Voice host](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/voice-host.ts): `apps/desktop/src/main/voice-host.ts`
- [Voice decisions](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/main/voice-policy.ts): `apps/desktop/src/main/voice-policy.ts`
- [Voice media](https://github.com/fatihaybsn/avalon/blob/master/apps/desktop/src/renderer/voice-media.ts): `apps/desktop/src/renderer/voice-media.ts`

### Other components

- **User**
- **Gemini Live**
- **OpenClaw Gateway**
- **Tavily research**

## Connections

- User → Desktop UI: uses
- Desktop UI → Desktop host: submits actions
- Desktop host → Gateway client: starts and routes (evidence: `apps/desktop/src/main/main.ts`)
- Desktop host → Chat controller: initializes (evidence: `apps/desktop/src/main/main.ts`)
- Desktop UI → UI contracts: uses types (evidence: `apps/desktop/src/renderer/app.ts`)
- Chat controller → Gateway client: sends RPC (evidence: `apps/desktop/src/main/controller.ts`)
- Chat controller → UI contracts: projects state (evidence: `apps/desktop/src/main/controller.ts`)
- Gateway client → Connection profile: loads settings (evidence: `apps/desktop/src/main/gateway.ts`)
- Gateway client → Device vault: loads identity (evidence: `apps/desktop/src/main/gateway.ts`)
- Gateway client → OpenClaw Gateway: connects
- OpenClaw Gateway → JARVIS plugin: hosts plugin
- JARVIS plugin → Tool policy: applies policy (evidence: `plugins/jarvis/index.ts`)
- Tool policy → Memory and notes: admits note tools (evidence: `plugins/jarvis/policy.ts`)
- Tool policy → Quick Windows actions: checks quick actions (evidence: `plugins/jarvis/policy.ts`)
- Tool policy → GUI policy: checks GUI tools (evidence: `plugins/jarvis/policy.ts`)
- JARVIS plugin → Work ledger: registers work (evidence: `plugins/jarvis/index.ts`)
- Worker dispatch → Worker contract: validates selection (evidence: `plugins/jarvis/workers.ts`)
- Worker dispatch → Codex worker: dispatches Codex (evidence: `plugins/jarvis/workers.ts`)
- Worker dispatch → OpenCode worker: dispatches OpenCode (evidence: `plugins/jarvis/workers.ts`)
- Codex worker → Worker contract: uses contract (evidence: `plugins/jarvis/codex.ts`)
- OpenCode worker → Worker contract: uses contract (evidence: `plugins/jarvis/opencode.ts`)
- JARVIS plugin → Worker dispatch: registers workers (evidence: `plugins/jarvis/index.ts`)
- JARVIS plugin → Dreaming: admits Dreaming (evidence: `plugins/jarvis/index.ts`)
- JARVIS plugin → Automation: supports automation (evidence: `plugins/jarvis/index.ts`)
- Quick Windows actions → Windows operations: invokes operations
- GUI policy → Windows operations: guards GUI access
- JARVIS plugin → Document readers: offers reading
- JARVIS plugin → Tavily research: requests research
- Desktop host → Voice host: initializes voice (evidence: `apps/desktop/src/main/main.ts`)
- Voice host → Voice decisions: checks decisions (evidence: `apps/desktop/src/main/voice-host.ts`)
- Voice host → Gateway client: uses Gateway RPC (evidence: `apps/desktop/src/main/voice-host.ts`)
- Voice media → Voice host: exchanges voice
- Voice host → Gemini Live: connects Live
- JARVIS plugin → Work ledger: records task state (evidence: `plugins/jarvis/work.ts`)
