# gilbertoffice007-lab/my-openclaw architecture

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

- Interactive diagram: https://gitdiagram.com/gilbertoffice007-lab/my-openclaw
- Repository: https://github.com/gilbertoffice007-lab/my-openclaw

## Overview

OpenClaw is a self-hosted personal AI assistant: a user sends a request through a supported messaging channel or companion app, the Gateway coordinates assistant work, and the response is returned through an available surface. The repository also supports agent context and memory, browser automation, live Canvas, voice, and native device capabilities. The README establishes the product workflow and capabilities; source excerpts and the index show selected internal links, so unverified runtime connections are dashed or omitted.

Main entry points: [`src/agents/embedded-agent-runner`](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/src/agents/embedded-agent-runner) (Agent runtime), [`src/gateway`](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/src/gateway) (Gateway), [`src/agents/harness/context-engine-lifecycle.ts`](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/harness/context-engine-lifecycle.ts) (Context lifecycle), [`extensions`](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions) (Messaging channels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User surfaces"]
  node_channels["Messaging channels"]
  node_control_ui["Control UI<br/>[storage.ts]"]
  node_theme_storage[("Theme preferences<br/>[storage.ts]")]
  node_custom_theme["Custom themes<br/>[custom-theme.ts]"]
end

subgraph group_control["Gateway and channels"]
  node_gateway["Gateway"]
  node_reply["Reply pipeline<br/>[reply-pipeline.ts]"]
  node_device_pairing["Device pairing<br/>[device-pairing.ts]"]
end

subgraph group_assistant["Agent runtime"]
  node_agent["Agent runtime"]
  node_context_lifecycle["Context lifecycle"]
  node_context_engine["Context engine<br/>[registry.ts]"]
  node_context_maintenance["Context maintenance"]
  node_auth[("Credential storage<br/>[auth-storage.ts]")]
  node_agent_prompts["Prompt helpers"]
  node_session_lock["Session write lock"]
end

subgraph group_capabilities["Assistant capabilities"]
  node_memory["Memory search"]
  node_browser["Browser automation"]
  node_canvas["Live Canvas<br/>[server.ts]"]
  node_voice["Voice interaction"]
  node_browser_context["Browser runtime context<br/>[server-context.ts]"]
  node_chrome["Chrome control<br/>[chrome.ts]"]
  node_chrome_mcp["Chrome MCP tabs<br/>[chrome-mcp.ts]"]
end

subgraph group_clients["Companion apps"]
  node_android["Android companion"]
  node_ios["iOS companion"]
  node_macos["macOS companion"]
  node_watch["Watch companion"]
end

node_user(("User"))

node_user -->|"sends request"| node_channels
node_channels -.->|"delivers message"| node_gateway
node_user -.->|"uses"| node_control_ui
node_control_ui -.->|"controls"| node_gateway
node_gateway -.->|"dispatches work"| node_agent
node_agent -.->|"prepares response"| node_reply
node_reply -.->|"delivers reply"| node_channels
node_agent -.->|"uses lifecycle"| node_context_lifecycle
node_context_lifecycle -.->|"assembles context"| node_context_engine
node_context_lifecycle -->|"runs maintenance"| node_context_maintenance
node_context_maintenance -->|"resolves owner"| node_context_engine
node_agent -.->|"uses memory"| node_memory
node_agent -.->|"uses automation"| node_browser
node_browser_context -->|"checks reachability"| node_chrome
node_browser_context -->|"lists tabs"| node_chrome_mcp
node_agent -.->|"controls Canvas"| node_canvas
node_user -.->|"speaks and listens"| node_voice
node_agent -.->|"uses credentials"| node_auth
node_user -.->|"uses companion"| node_android
node_user -.->|"uses companion"| node_ios
node_user -.->|"uses companion"| node_macos
node_ios -.->|"pairs with"| node_watch
node_theme_storage -->|"parses theme"| node_custom_theme
node_agent -.->|"uses prompts"| node_agent_prompts
node_agent -.->|"serializes writes"| node_session_lock
node_gateway -.->|"authorizes devices"| node_device_pairing

click node_channels "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions"
click node_control_ui "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/ui/src/ui/storage.ts"
click node_gateway "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/src/gateway"
click node_reply "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/channels/message/reply-pipeline.ts"
click node_agent "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/src/agents/embedded-agent-runner"
click node_context_lifecycle "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/harness/context-engine-lifecycle.ts"
click node_context_engine "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/context-engine/registry.ts"
click node_context_maintenance "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/embedded-agent-runner/context-engine-maintenance.ts"
click node_memory "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions/memory-core/src/memory"
click node_browser "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions/browser/src/browser"
click node_canvas "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/canvas/src/host/server.ts"
click node_voice "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/talk/talk-session-controller.ts"
click node_auth "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/sessions/auth-storage.ts"
click node_android "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/android/app/src/main/java/ai/openclaw/app"
click node_ios "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/ios/Sources"
click node_macos "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/macos/Sources/OpenClaw"
click node_watch "https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/ios/WatchExtension/Sources"
click node_browser_context "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/browser/src/browser/server-context.ts"
click node_chrome "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/browser/src/browser/chrome.ts"
click node_chrome_mcp "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/browser/src/browser/chrome-mcp.ts"
click node_theme_storage "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/ui/src/ui/storage.ts"
click node_custom_theme "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/ui/src/ui/custom-theme.ts"
click node_agent_prompts "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/embedded-agent-runner/run/attempt.prompt-helpers.ts"
click node_session_lock "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/session-write-lock.ts"
click node_device_pairing "https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/infra/device-pairing.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_channels,node_control_ui,node_theme_storage,node_custom_theme,node_user toneBlue
class node_gateway,node_reply,node_device_pairing toneAmber
class node_agent,node_context_lifecycle,node_context_engine,node_context_maintenance,node_auth,node_agent_prompts,node_session_lock toneMint
class node_memory,node_browser,node_canvas,node_voice,node_browser_context,node_chrome,node_chrome_mcp toneRose
class node_android,node_ios,node_macos,node_watch toneIndigo
```

## Components

### User surfaces

- [Messaging channels](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions): `extensions`
- [Control UI](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/ui/src/ui/storage.ts): `ui/src/ui/storage.ts`
- [Theme preferences](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/ui/src/ui/storage.ts): `ui/src/ui/storage.ts`
- [Custom themes](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/ui/src/ui/custom-theme.ts): `ui/src/ui/custom-theme.ts`

### Gateway and channels

- [Gateway](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/src/gateway): `src/gateway`
- [Reply pipeline](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/channels/message/reply-pipeline.ts): `src/channels/message/reply-pipeline.ts`
- [Device pairing](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/infra/device-pairing.ts): `src/infra/device-pairing.ts`

### Agent runtime

- [Agent runtime](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/src/agents/embedded-agent-runner): `src/agents/embedded-agent-runner`
- [Context lifecycle](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/harness/context-engine-lifecycle.ts): `src/agents/harness/context-engine-lifecycle.ts`
- [Context engine](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/context-engine/registry.ts): `src/context-engine/registry.ts`
- [Context maintenance](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/embedded-agent-runner/context-engine-maintenance.ts): `src/agents/embedded-agent-runner/context-engine-maintenance.ts`
- [Credential storage](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/sessions/auth-storage.ts): `src/agents/sessions/auth-storage.ts`
- [Prompt helpers](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/embedded-agent-runner/run/attempt.prompt-helpers.ts): `src/agents/embedded-agent-runner/run/attempt.prompt-helpers.ts`
- [Session write lock](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/agents/session-write-lock.ts): `src/agents/session-write-lock.ts`

### Assistant capabilities

- [Memory search](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions/memory-core/src/memory): `extensions/memory-core/src/memory`
- [Browser automation](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/extensions/browser/src/browser): `extensions/browser/src/browser`
- [Live Canvas](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/canvas/src/host/server.ts): `extensions/canvas/src/host/server.ts`
- [Voice interaction](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/src/talk/talk-session-controller.ts): `src/talk/talk-session-controller.ts`
- [Browser runtime context](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/browser/src/browser/server-context.ts): `extensions/browser/src/browser/server-context.ts`
- [Chrome control](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/browser/src/browser/chrome.ts): `extensions/browser/src/browser/chrome.ts`
- [Chrome MCP tabs](https://github.com/gilbertoffice007-lab/my-openclaw/blob/main/extensions/browser/src/browser/chrome-mcp.ts): `extensions/browser/src/browser/chrome-mcp.ts`

### Companion apps

- [Android companion](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/android/app/src/main/java/ai/openclaw/app): `apps/android/app/src/main/java/ai/openclaw/app`
- [iOS companion](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/ios/Sources): `apps/ios/Sources`
- [macOS companion](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/macos/Sources/OpenClaw): `apps/macos/Sources/OpenClaw`
- [Watch companion](https://github.com/gilbertoffice007-lab/my-openclaw/tree/main/apps/ios/WatchExtension/Sources): `apps/ios/WatchExtension/Sources`

### Other components

- **User**

## Connections

- User → Messaging channels: sends request (evidence: `README.md`)
- Messaging channels → Gateway: delivers message
- User → Control UI: uses
- Control UI → Gateway: controls
- Gateway → Agent runtime: dispatches work
- Agent runtime → Reply pipeline: prepares response
- Reply pipeline → Messaging channels: delivers reply
- Agent runtime → Context lifecycle: uses lifecycle (evidence: `src/agents/harness/context-engine-lifecycle.ts`)
- Context lifecycle → Context engine: assembles context (evidence: `src/agents/harness/context-engine-lifecycle.ts`)
- Context lifecycle → Context maintenance: runs maintenance (evidence: `src/agents/harness/context-engine-lifecycle.ts`)
- Context maintenance → Context engine: resolves owner (evidence: `src/agents/embedded-agent-runner/context-engine-maintenance.ts`)
- Agent runtime → Memory search: uses memory
- Agent runtime → Browser automation: uses automation
- Browser runtime context → Chrome control: checks reachability (evidence: `extensions/browser/src/browser/server-context.ts`)
- Browser runtime context → Chrome MCP tabs: lists tabs (evidence: `extensions/browser/src/browser/server-context.ts`)
- Agent runtime → Live Canvas: controls Canvas (evidence: `README.md`)
- User → Voice interaction: speaks and listens (evidence: `README.md`)
- Agent runtime → Credential storage: uses credentials
- User → Android companion: uses companion (evidence: `README.md`)
- User → iOS companion: uses companion (evidence: `README.md`)
- User → macOS companion: uses companion (evidence: `README.md`)
- iOS companion → Watch companion: pairs with
- Theme preferences → Custom themes: parses theme (evidence: `ui/src/ui/storage.ts`)
- Agent runtime → Prompt helpers: uses prompts
- Agent runtime → Session write lock: serializes writes
- Gateway → Device pairing: authorizes devices (evidence: `src/gateway/server.auth.control-ui.suite.ts`)
