# zila-kh/nd-dsh architecture

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

- Interactive diagram: https://gitdiagram.com/zila-kh/nd-dsh
- Repository: https://github.com/zila-kh/nd-dsh

## Overview

ND-DSH is a local-first AI work desktop and company operating platform. Its user workflow runs from the General or Coding workspace through ND-owned project, task, context, policy, and capability controls to a replaceable coding engine or other integration, with results surfaced in the desktop. The graph preserves major documented branches—organization orchestration, workflows and extensions, browser automation, provider routing, and coding tools—alongside sampled implementation layers. Some subsystem links reflect README-level architecture rather than inspected call sites; those are cited to the README.

Main entry points: [`src/renderer/src/App.tsx`](https://github.com/zila-kh/nd-dsh/blob/main/src/renderer/src/App.tsx) (Desktop workspace UI), [`src/main/engines/engine-session-router.ts`](https://github.com/zila-kh/nd-dsh/blob/main/src/main/engines/engine-session-router.ts) (Engine session router), [`crates/nd-agent/src/main.rs`](https://github.com/zila-kh/nd-dsh/blob/main/crates/nd-agent/src/main.rs) (ND Harness runtime), [`src/main/browser/browser-controller.ts`](https://github.com/zila-kh/nd-dsh/blob/main/src/main/browser/browser-controller.ts) (Built-in browser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app["Desktop workspace UI<br/>[App.tsx]"]
end

subgraph group_control["ND control plane"]
  node_workspace["Workspace state"]
  node_context["Context contracts<br/>[nd-context.ts]"]
  node_organization["Company orchestration<br/>[orchestrator.ts]"]
  node_tasks[("Task metrics<br/>[task-metrics.ts]")]
  node_workflows["Workflow templates"]
  node_contracts["Shared runtime contracts<br/>[contracts.ts]"]
end

subgraph group_execution["Execution adapters"]
  node_engine_router["Engine session router"]
  node_engine_catalog["Coding engine catalog<br/>[coding-engines.ts]"]
  node_harness["ND Harness runtime<br/>[main.rs]"]
  node_providers["Provider routing<br/>[providers.ts]"]
end

subgraph group_workbench["Work surfaces"]
  node_browser["Built-in browser"]
  node_browser_extensions["Browser extensions"]
  node_git["Git operations<br/>[git-service.ts]"]
  node_qa["Project checks<br/>[qa-service.ts]"]
  node_design["Design surface<br/>[design-service.ts]"]
end

subgraph group_integration["Integrations"]
  node_companion["Browser Companion<br/>[service-worker.js]"]
  node_extensions["ND extensions / skills"]
end

node_users(("Users / teams"))
node_local_files["Local files / OS"]
node_external_services["External APIs / cloud"]

node_users -->|"use"| node_app
node_app -->|"select workspace"| node_workspace
node_app -->|"manage company work"| node_organization
node_app -->|"use browser"| node_browser
node_workspace -->|"provides context"| node_context
node_organization -.->|"track tasks"| node_tasks
node_organization -->|"dispatch work"| node_engine_router
node_engine_router -->|"runs sessions"| node_harness
node_engine_router -.->|"selects engine"| node_engine_catalog
node_engine_router -->|"uses workspace"| node_workspace
node_engine_router -.->|"routes browser"| node_browser
node_engine_router -.->|"routes tools"| node_extensions
node_harness -->|"requests models"| node_providers
node_harness -->|"acts on"| node_local_files
node_harness -->|"integrates"| node_external_services
node_browser -->|"hosts"| node_browser_extensions
node_browser -.->|"optional target"| node_companion
node_app -->|"manage source"| node_git
node_app -->|"run checks"| node_qa
node_app -->|"open design"| node_design
node_app -->|"invoke capabilities"| node_extensions
node_app -->|"use workflows"| node_workflows
node_contracts -->|"defines descriptors"| node_engine_catalog

click node_app "https://github.com/zila-kh/nd-dsh/blob/main/src/renderer/src/App.tsx"
click node_workspace "https://github.com/zila-kh/nd-dsh/blob/main/src/main/workspace/workspace-service.ts"
click node_context "https://github.com/zila-kh/nd-dsh/blob/main/src/shared/nd-context.ts"
click node_organization "https://github.com/zila-kh/nd-dsh/blob/main/src/main/organization/orchestrator.ts"
click node_tasks "https://github.com/zila-kh/nd-dsh/blob/main/src/main/metrics/task-metrics.ts"
click node_engine_router "https://github.com/zila-kh/nd-dsh/blob/main/src/main/engines/engine-session-router.ts"
click node_engine_catalog "https://github.com/zila-kh/nd-dsh/blob/main/src/shared/coding-engines.ts"
click node_harness "https://github.com/zila-kh/nd-dsh/blob/main/crates/nd-agent/src/main.rs"
click node_providers "https://github.com/zila-kh/nd-dsh/blob/main/src/main/providers.ts"
click node_browser "https://github.com/zila-kh/nd-dsh/blob/main/src/main/browser/browser-controller.ts"
click node_browser_extensions "https://github.com/zila-kh/nd-dsh/blob/main/src/renderer/src/components/BrowserExtensionsManager.tsx"
click node_companion "https://github.com/zila-kh/nd-dsh/blob/main/extensions/browser-companion/service-worker.js"
click node_git "https://github.com/zila-kh/nd-dsh/blob/main/src/main/git/git-service.ts"
click node_qa "https://github.com/zila-kh/nd-dsh/blob/main/src/main/qa/qa-service.ts"
click node_design "https://github.com/zila-kh/nd-dsh/blob/main/src/main/design/design-service.ts"
click node_extensions "https://github.com/zila-kh/nd-dsh/blob/main/src/main/extensions/extension-router.ts"
click node_workflows "https://github.com/zila-kh/nd-dsh/blob/main/src/main/workflows/workflow-service.ts"
click node_contracts "https://github.com/zila-kh/nd-dsh/blob/main/src/shared/contracts.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_app,node_users toneBlue
class node_workspace,node_context,node_organization,node_tasks,node_workflows,node_contracts toneAmber
class node_engine_router,node_engine_catalog,node_harness,node_providers,node_external_services toneMint
class node_browser,node_browser_extensions,node_git,node_qa,node_design toneRose
class node_companion,node_extensions,node_local_files toneIndigo
```

## Components

### Desktop experience

- [Desktop workspace UI](https://github.com/zila-kh/nd-dsh/blob/main/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`

### ND control plane

- [Workspace state](https://github.com/zila-kh/nd-dsh/blob/main/src/main/workspace/workspace-service.ts): `src/main/workspace/workspace-service.ts`
- [Context contracts](https://github.com/zila-kh/nd-dsh/blob/main/src/shared/nd-context.ts): `src/shared/nd-context.ts`
- [Company orchestration](https://github.com/zila-kh/nd-dsh/blob/main/src/main/organization/orchestrator.ts): `src/main/organization/orchestrator.ts`
- [Task metrics](https://github.com/zila-kh/nd-dsh/blob/main/src/main/metrics/task-metrics.ts): `src/main/metrics/task-metrics.ts`
- [Workflow templates](https://github.com/zila-kh/nd-dsh/blob/main/src/main/workflows/workflow-service.ts): `src/main/workflows/workflow-service.ts`
- [Shared runtime contracts](https://github.com/zila-kh/nd-dsh/blob/main/src/shared/contracts.ts): `src/shared/contracts.ts`

### Execution adapters

- [Engine session router](https://github.com/zila-kh/nd-dsh/blob/main/src/main/engines/engine-session-router.ts): `src/main/engines/engine-session-router.ts`
- [Coding engine catalog](https://github.com/zila-kh/nd-dsh/blob/main/src/shared/coding-engines.ts): `src/shared/coding-engines.ts`
- [ND Harness runtime](https://github.com/zila-kh/nd-dsh/blob/main/crates/nd-agent/src/main.rs): `crates/nd-agent/src/main.rs`
- [Provider routing](https://github.com/zila-kh/nd-dsh/blob/main/src/main/providers.ts): `src/main/providers.ts`

### Work surfaces

- [Built-in browser](https://github.com/zila-kh/nd-dsh/blob/main/src/main/browser/browser-controller.ts): `src/main/browser/browser-controller.ts`
- [Browser extensions](https://github.com/zila-kh/nd-dsh/blob/main/src/renderer/src/components/BrowserExtensionsManager.tsx): `src/renderer/src/components/BrowserExtensionsManager.tsx`
- [Git operations](https://github.com/zila-kh/nd-dsh/blob/main/src/main/git/git-service.ts): `src/main/git/git-service.ts`
- [Project checks](https://github.com/zila-kh/nd-dsh/blob/main/src/main/qa/qa-service.ts): `src/main/qa/qa-service.ts`
- [Design surface](https://github.com/zila-kh/nd-dsh/blob/main/src/main/design/design-service.ts): `src/main/design/design-service.ts`

### Integrations

- [Browser Companion](https://github.com/zila-kh/nd-dsh/blob/main/extensions/browser-companion/service-worker.js): `extensions/browser-companion/service-worker.js`
- [ND extensions / skills](https://github.com/zila-kh/nd-dsh/blob/main/src/main/extensions/extension-router.ts): `src/main/extensions/extension-router.ts`

### Other components

- **Users / teams**
- **Local files / OS**
- **External APIs / cloud**

## Connections

- Users / teams → Desktop workspace UI: use
- Desktop workspace UI → Workspace state: select workspace
- Desktop workspace UI → Company orchestration: manage company work
- Desktop workspace UI → Built-in browser: use browser
- Workspace state → Context contracts: provides context
- Company orchestration → Task metrics: track tasks
- Company orchestration → Engine session router: dispatch work
- Engine session router → ND Harness runtime: runs sessions
- Engine session router → Coding engine catalog: selects engine (evidence: `src/main/engines/engine-session-router.ts`)
- Engine session router → Workspace state: uses workspace (evidence: `src/main/engines/engine-session-router.ts`)
- Engine session router → Built-in browser: routes browser (evidence: `src/main/engines/engine-session-router.ts`)
- Engine session router → ND extensions / skills: routes tools (evidence: `src/main/engines/engine-session-router.ts`)
- ND Harness runtime → Provider routing: requests models
- ND Harness runtime → Local files / OS: acts on
- ND Harness runtime → External APIs / cloud: integrates
- Built-in browser → Browser extensions: hosts
- Built-in browser → Browser Companion: optional target
- Desktop workspace UI → Git operations: manage source
- Desktop workspace UI → Project checks: run checks
- Desktop workspace UI → Design surface: open design
- Desktop workspace UI → ND extensions / skills: invoke capabilities
- Desktop workspace UI → Workflow templates: use workflows
- Shared runtime contracts → Coding engine catalog: defines descriptors (evidence: `src/shared/coding-engines.ts`)
