# krishgokulk/context-dock architecture

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

- Interactive diagram: https://gitdiagram.com/krishgokulk/context-dock
- Repository: https://github.com/krishgokulk/context-dock

## Overview

DoraX is a macOS coordination layer that carries context and actions between apps through four launcher surfaces. Its central workflow is to capture the user’s request and app context, resolve an action or multi-step workflow, obtain route-specific approval where needed, execute through available integrations, and report results with verification limits. The graph combines explicit README capabilities with sampled-source references; unsampled subsystems are represented at their existing directory paths, and undocumented wiring is omitted.

Main entry points: [`Context-Dock/Search/LauncherView.swift`](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Search/LauncherView.swift) (Launcher shell), [`Context-Dock/AI/L2AppActionRouter.swift`](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2AppActionRouter.swift) (App action router), [`Context-Dock/AI/L2WorkflowEngine.swift`](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2WorkflowEngine.swift) (Saved workflows), [`Context-Dock/AI/GeneralChatWindowModel.swift`](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/GeneralChatWindowModel.swift) (General Chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["Launcher surfaces"]
  node_launcher["Launcher shell<br/>[LauncherView.swift]"]
  node_global["Global Context"]
  node_contextdock["Context Dock"]
  node_generalchat["General Chat"]
  node_selection["Selection Scope"]
end

subgraph group_context["Context and routing"]
  node_contextreader["App context reader"]
  node_usercontext["User context<br/>[UserContext.swift]"]
  node_menuaccess["Live menu access<br/>[AXMenuReader.swift]"]
  node_intentrouter["Intent routing"]
end

subgraph group_execution["Action execution"]
  node_workflow["Saved workflows"]
  node_taskexecutor["Task executor"]
  node_actionrouter["App action router"]
end

subgraph group_integrations["Providers and integrations"]
  node_provider["AI providers"]
  node_adapters["App adapters"]
  node_appletools["Apple app tools<br/>[AppleAppsAPI.swift]"]
  node_mcp["MCP servers<br/>[MCPRuntime.swift]"]
  node_terminal["CLI tools"]
  node_shortcuts["Shortcuts"]
end

subgraph group_trust["Privacy and verification"]
  node_approval["Route approvals"]
  node_verification["Action verification"]
  node_settings["Privacy settings<br/>[AppSettings.swift]"]
end

node_user(("User"))

node_user -->|"opens and requests"| node_launcher
node_launcher -->|"reads app context"| node_contextreader
node_contextreader -->|"detects selection"| node_usercontext
node_launcher -->|"shows global actions"| node_global
node_launcher -->|"shows app actions"| node_contextdock
node_launcher -->|"opens cross-app chat"| node_generalchat
node_launcher -->|"routes selection"| node_selection
node_global -->|"reads live menus"| node_menuaccess
node_contextdock -->|"refreshes menus"| node_menuaccess
node_generalchat -.->|"resolves requests"| node_intentrouter
node_intentrouter -.->|"selects workflow"| node_workflow
node_workflow -.->|"runs task steps"| node_taskexecutor
node_taskexecutor -.->|"dispatches actions"| node_actionrouter
node_workflow -->|"uses app data"| node_appletools
node_workflow -->|"runs commands"| node_terminal
node_actionrouter -.->|"uses app adapters"| node_adapters
node_actionrouter -.->|"uses MCP tools"| node_mcp
node_actionrouter -.->|"runs shortcuts"| node_shortcuts
node_generalchat -.->|"requests AI"| node_provider
node_settings -->|"selects provider"| node_provider
node_settings -.->|"sets privacy choices"| node_approval
node_actionrouter -->|"requests approval"| node_approval
node_actionrouter -->|"checks outcome"| node_verification

click node_launcher "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Search/LauncherView.swift"
click node_global "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/GlobalContextEngine.swift"
click node_contextdock "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/ContextDockEngine.swift"
click node_generalchat "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/GeneralChatWindowModel.swift"
click node_selection "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Search/LauncherView%2BSelectionRouter.swift"
click node_contextreader "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/ContextDetector.swift"
click node_usercontext "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/UserContext.swift"
click node_menuaccess "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Accessibility/AXMenuReader.swift"
click node_intentrouter "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2IntentSystem.swift"
click node_workflow "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2WorkflowEngine.swift"
click node_taskexecutor "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2AITaskExecutor.swift"
click node_actionrouter "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2AppActionRouter.swift"
click node_approval "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/ApprovalCenter.swift"
click node_verification "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/CommandOutcomeVerifier.swift"
click node_settings "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/App/AppSettings.swift"
click node_provider "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/AIProviderService.swift"
click node_adapters "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/AppAdapterManager.swift"
click node_appletools "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/AppleAppsAPI.swift"
click node_mcp "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/MCPRuntime.swift"
click node_terminal "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/TerminalAIBridge.swift"
click node_shortcuts "https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/ShortcutRunner.swift"

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_launcher,node_global,node_contextdock,node_generalchat,node_selection,node_user toneBlue
class node_contextreader,node_usercontext,node_menuaccess,node_intentrouter toneAmber
class node_workflow,node_taskexecutor,node_actionrouter toneMint
class node_provider,node_adapters,node_appletools,node_mcp,node_terminal,node_shortcuts toneRose
class node_approval,node_verification,node_settings toneIndigo
```

## Components

### Launcher surfaces

- [Launcher shell](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Search/LauncherView.swift): `Context-Dock/Search/LauncherView.swift`
- [Global Context](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/GlobalContextEngine.swift): `Context-Dock/Services/GlobalContextEngine.swift`
- [Context Dock](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/ContextDockEngine.swift): `Context-Dock/Services/ContextDockEngine.swift`
- [General Chat](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/GeneralChatWindowModel.swift): `Context-Dock/AI/GeneralChatWindowModel.swift`
- [Selection Scope](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Search/LauncherView%2BSelectionRouter.swift): `Context-Dock/Search/LauncherView+SelectionRouter.swift`

### Context and routing

- [App context reader](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/ContextDetector.swift): `Context-Dock/Services/ContextDetector.swift`
- [User context](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/UserContext.swift): `Context-Dock/Services/UserContext.swift`
- [Live menu access](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Accessibility/AXMenuReader.swift): `Context-Dock/Accessibility/AXMenuReader.swift`
- [Intent routing](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2IntentSystem.swift): `Context-Dock/AI/L2IntentSystem.swift`

### Action execution

- [Saved workflows](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2WorkflowEngine.swift): `Context-Dock/AI/L2WorkflowEngine.swift`
- [Task executor](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2AITaskExecutor.swift): `Context-Dock/AI/L2AITaskExecutor.swift`
- [App action router](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/L2AppActionRouter.swift): `Context-Dock/AI/L2AppActionRouter.swift`

### Providers and integrations

- [AI providers](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/AIProviderService.swift): `Context-Dock/AI/AIProviderService.swift`
- [App adapters](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/AppAdapterManager.swift): `Context-Dock/Services/AppAdapterManager.swift`
- [Apple app tools](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/AppleAppsAPI.swift): `Context-Dock/Services/AppleAppsAPI.swift`
- [MCP servers](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/MCPRuntime.swift): `Context-Dock/Services/MCPRuntime.swift`
- [CLI tools](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/TerminalAIBridge.swift): `Context-Dock/Services/TerminalAIBridge.swift`
- [Shortcuts](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/Services/ShortcutRunner.swift): `Context-Dock/Services/ShortcutRunner.swift`

### Privacy and verification

- [Route approvals](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/ApprovalCenter.swift): `Context-Dock/AI/ApprovalCenter.swift`
- [Action verification](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/AI/CommandOutcomeVerifier.swift): `Context-Dock/AI/CommandOutcomeVerifier.swift`
- [Privacy settings](https://github.com/krishgokulk/context-dock/blob/main/Context-Dock/App/AppSettings.swift): `Context-Dock/App/AppSettings.swift`

### Other components

- **User**

## Connections

- User → Launcher shell: opens and requests
- Launcher shell → App context reader: reads app context (evidence: `Context-Dock/Search/LauncherView.swift`)
- App context reader → User context: detects selection (evidence: `Context-Dock/Services/UserContext.swift`)
- Launcher shell → Global Context: shows global actions (evidence: `Context-Dock/Search/LauncherView.swift`)
- Launcher shell → Context Dock: shows app actions (evidence: `Context-Dock/Search/LauncherView.swift`)
- Launcher shell → General Chat: opens cross-app chat
- Launcher shell → Selection Scope: routes selection (evidence: `Context-Dock/Search/LauncherView+SelectionRouter.swift`)
- Global Context → Live menu access: reads live menus (evidence: `Context-Dock/Services/GlobalContextEngine.swift`)
- Context Dock → Live menu access: refreshes menus (evidence: `Context-Dock/Services/ContextDockEngine.swift`)
- General Chat → Intent routing: resolves requests
- Intent routing → Saved workflows: selects workflow
- Saved workflows → Task executor: runs task steps
- Task executor → App action router: dispatches actions
- Saved workflows → Apple app tools: uses app data (evidence: `Context-Dock/AI/L2WorkflowEngine.swift`)
- Saved workflows → CLI tools: runs commands (evidence: `Context-Dock/AI/L2WorkflowEngine.swift`)
- App action router → App adapters: uses app adapters
- App action router → MCP servers: uses MCP tools
- App action router → Shortcuts: runs shortcuts
- General Chat → AI providers: requests AI
- Privacy settings → AI providers: selects provider
- Privacy settings → Route approvals: sets privacy choices
- App action router → Route approvals: requests approval
- App action router → Action verification: checks outcome
