# taiyoyamada/sundesk architecture

> Architecture diagram of the GitHub repository taiyoyamada/sundesk, 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/taiyoyamada/sundesk
- Repository: https://github.com/taiyoyamada/sundesk

## Overview

Sundesk is a macOS research workspace that combines notes, a research library, a knowledge graph, and local AI. The user works in the SwiftUI app; research content feeds graph construction and citation-backed chat, while AI requests cross a localhost HTTP boundary to a Python engine. The README documents the product capabilities and process boundary; sampled source confirms engine assembly, model management, and selected Swift gateways. Other feature-to-service links are not inferred where source was not sampled.

Main entry points: [`engine/src/sundesk_engine/app.py`](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/app.py) (Engine API), [`Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineClient.swift`](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineClient.swift) (HTTP client), [`Packages/SundeskKit/Sources/Features/WorkspaceFeature/Views/MainWindowView.swift`](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/WorkspaceFeature/Views/MainWindowView.swift) (Workspace shell), [`Packages/SundeskKit/Sources/Features/NotesFeature/Views/Document/DocumentView.swift`](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/NotesFeature/Views/Document/DocumentView.swift) (Notes and files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Workspace app"]
  node_workspace["Workspace shell"]
  node_enginecontrol["Engine lifecycle"]
  node_http["HTTP client<br/>[EngineClient.swift]"]
end

subgraph group_research["Research knowledge"]
  node_notes["Notes and files<br/>[DocumentView.swift]"]
  node_vault[("Vault storage")]
  node_library[("Research library")]
  node_graphui["Graph exploration"]
  node_knowledge["Graph and embeddings"]
  node_chatui["Source-backed chat"]
  node_chatdata["Chat routing and history"]
  node_index[("Note indexing")]
end

subgraph group_engine["Local AI engine"]
  node_api["Engine API<br/>[app.py]"]
  node_runtime["Model runtime<br/>[manager.py]"]
  node_hub["Model hub<br/>[hub.py]"]
  node_graphsvc["Graph computation<br/>[builder.py]"]
end

subgraph group_lab["Model lab"]
  node_labui["Lab and inspection<br/>[LabViewModel.swift]"]
  node_labgateway["Lab gateway"]
  node_labservice["Sampling and analysis<br/>[service.py]"]
  node_forge["Model forge<br/>[convert.py]"]
  node_images["Image generation<br/>[catalog.py]"]
  node_scratch["Python scratch<br/>[session.py]"]
  node_lora["LoRA training<br/>[train.py]"]
end

node_user(("Researcher"))
node_externalmodels(("Hugging Face"))

node_user -->|"uses"| node_workspace
node_workspace -->|"opens"| node_notes
node_workspace -->|"organizes"| node_library
node_notes -.->|"reads and writes"| node_vault
node_notes -.->|"indexes"| node_index
node_graphui -.->|"requests graph"| node_knowledge
node_knowledge -->|"posts graph and embeddings"| node_http
node_chatui -.->|"requests answers"| node_chatdata
node_chatdata -.->|"uses engine"| node_http
node_workspace -->|"starts engine"| node_enginecontrol
node_enginecontrol -->|"health checks"| node_http
node_http -->|"sends HTTP requests"| node_api
node_api -->|"serves model APIs"| node_runtime
node_api -.->|"routes graph API"| node_graphsvc
node_runtime -->|"resolves models"| node_hub
node_hub -.->|"downloads models"| node_externalmodels
node_labui -.->|"requests inspection"| node_labgateway
node_labgateway -->|"posts lab requests"| node_http
node_api -.->|"routes lab API"| node_labservice
node_api -.->|"routes forge API"| node_forge
node_api -.->|"routes image API"| node_images
node_api -.->|"routes scratch API"| node_scratch
node_api -.->|"routes LoRA API"| node_lora
node_labservice -->|"uses loaded models"| node_runtime

click node_workspace "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/WorkspaceFeature/Views/MainWindowView.swift"
click node_notes "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/NotesFeature/Views/Document/DocumentView.swift"
click node_vault "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Vault/FileSystemVaultRepository.swift"
click node_library "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Library/FileSystemLibraryRepository.swift"
click node_graphui "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/GraphFeature/ViewModels/GraphViewModel.swift"
click node_knowledge "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Knowledge/EngineKnowledgeGateway.swift"
click node_chatui "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/ChatFeature/ViewModels/ChatViewModel.swift"
click node_chatdata "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Chat/LanguageModelRouter.swift"
click node_index "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/NoteIndex/SwiftDataNoteIndex.swift"
click node_enginecontrol "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineProcess.swift"
click node_http "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineClient.swift"
click node_api "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/app.py"
click node_runtime "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/runtime/manager.py"
click node_hub "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/runtime/hub.py"
click node_graphsvc "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/graph/builder.py"
click node_labui "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/LabFeature/ViewModels/LabViewModel.swift"
click node_labgateway "https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Lab/EngineLabGateway.swift"
click node_labservice "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/lab/service.py"
click node_forge "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/forge/convert.py"
click node_images "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/images/catalog.py"
click node_scratch "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/scratch/session.py"
click node_lora "https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/lora/train.py"

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_workspace,node_enginecontrol,node_http toneBlue
class node_notes,node_vault,node_library,node_graphui,node_knowledge,node_chatui,node_chatdata,node_index toneAmber
class node_api,node_runtime,node_hub,node_graphsvc toneMint
class node_labui,node_labgateway,node_labservice,node_forge,node_images,node_scratch,node_lora toneRose
class node_user,node_externalmodels toneIndigo
```

## Components

### Workspace app

- [Workspace shell](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/WorkspaceFeature/Views/MainWindowView.swift): `Packages/SundeskKit/Sources/Features/WorkspaceFeature/Views/MainWindowView.swift`
- [Engine lifecycle](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineProcess.swift): `Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineProcess.swift`
- [HTTP client](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineClient.swift): `Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineClient.swift`

### Research knowledge

- [Notes and files](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/NotesFeature/Views/Document/DocumentView.swift): `Packages/SundeskKit/Sources/Features/NotesFeature/Views/Document/DocumentView.swift`
- [Vault storage](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Vault/FileSystemVaultRepository.swift): `Packages/SundeskKit/Sources/Core/SundeskData/Vault/FileSystemVaultRepository.swift`
- [Research library](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Library/FileSystemLibraryRepository.swift): `Packages/SundeskKit/Sources/Core/SundeskData/Library/FileSystemLibraryRepository.swift`
- [Graph exploration](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/GraphFeature/ViewModels/GraphViewModel.swift): `Packages/SundeskKit/Sources/Features/GraphFeature/ViewModels/GraphViewModel.swift`
- [Graph and embeddings](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Knowledge/EngineKnowledgeGateway.swift): `Packages/SundeskKit/Sources/Core/SundeskData/Knowledge/EngineKnowledgeGateway.swift`
- [Source-backed chat](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/ChatFeature/ViewModels/ChatViewModel.swift): `Packages/SundeskKit/Sources/Features/ChatFeature/ViewModels/ChatViewModel.swift`
- [Chat routing and history](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Chat/LanguageModelRouter.swift): `Packages/SundeskKit/Sources/Core/SundeskData/Chat/LanguageModelRouter.swift`
- [Note indexing](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/NoteIndex/SwiftDataNoteIndex.swift): `Packages/SundeskKit/Sources/Core/SundeskData/NoteIndex/SwiftDataNoteIndex.swift`

### Local AI engine

- [Engine API](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/app.py): `engine/src/sundesk_engine/app.py`
- [Model runtime](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/runtime/manager.py): `engine/src/sundesk_engine/runtime/manager.py`
- [Model hub](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/runtime/hub.py): `engine/src/sundesk_engine/runtime/hub.py`
- [Graph computation](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/graph/builder.py): `engine/src/sundesk_engine/graph/builder.py`

### Model lab

- [Lab and inspection](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Features/LabFeature/ViewModels/LabViewModel.swift): `Packages/SundeskKit/Sources/Features/LabFeature/ViewModels/LabViewModel.swift`
- [Lab gateway](https://github.com/taiyoyamada/sundesk/blob/develop/Packages/SundeskKit/Sources/Core/SundeskData/Lab/EngineLabGateway.swift): `Packages/SundeskKit/Sources/Core/SundeskData/Lab/EngineLabGateway.swift`
- [Sampling and analysis](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/lab/service.py): `engine/src/sundesk_engine/lab/service.py`
- [Model forge](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/forge/convert.py): `engine/src/sundesk_engine/forge/convert.py`
- [Image generation](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/images/catalog.py): `engine/src/sundesk_engine/images/catalog.py`
- [Python scratch](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/scratch/session.py): `engine/src/sundesk_engine/scratch/session.py`
- [LoRA training](https://github.com/taiyoyamada/sundesk/blob/develop/engine/src/sundesk_engine/lora/train.py): `engine/src/sundesk_engine/lora/train.py`

### Other components

- **Researcher**
- **Hugging Face**

## Connections

- Researcher → Workspace shell: uses (evidence: `README.md`)
- Workspace shell → Notes and files: opens (evidence: `README.md`)
- Workspace shell → Research library: organizes (evidence: `README.md`)
- Notes and files → Vault storage: reads and writes
- Notes and files → Note indexing: indexes
- Graph exploration → Graph and embeddings: requests graph
- Graph and embeddings → HTTP client: posts graph and embeddings (evidence: `Packages/SundeskKit/Sources/Core/SundeskData/Knowledge/EngineKnowledgeGateway.swift`)
- Source-backed chat → Chat routing and history: requests answers
- Chat routing and history → HTTP client: uses engine
- Workspace shell → Engine lifecycle: starts engine (evidence: `README.md`)
- Engine lifecycle → HTTP client: health checks (evidence: `Packages/SundeskKit/Sources/Infrastructure/SundeskEngineClient/EngineProcess.swift`)
- HTTP client → Engine API: sends HTTP requests (evidence: `README.md`)
- Engine API → Model runtime: serves model APIs (evidence: `engine/src/sundesk_engine/app.py`)
- Engine API → Graph computation: routes graph API
- Model runtime → Model hub: resolves models (evidence: `engine/src/sundesk_engine/runtime/manager.py`)
- Model hub → Hugging Face: downloads models
- Lab and inspection → Lab gateway: requests inspection
- Lab gateway → HTTP client: posts lab requests (evidence: `Packages/SundeskKit/Sources/Core/SundeskData/Lab/EngineLabGateway.swift`)
- Engine API → Sampling and analysis: routes lab API
- Engine API → Model forge: routes forge API
- Engine API → Image generation: routes image API
- Engine API → Python scratch: routes scratch API
- Engine API → LoRA training: routes LoRA API
- Sampling and analysis → Model runtime: uses loaded models (evidence: `engine/src/sundesk_engine/lab/service.py`)
