# augustdev/enchanted architecture

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

- Interactive diagram: https://gitdiagram.com/augustdev/enchanted
- Repository: https://github.com/augustdev/enchanted

## Overview

Enchanted is a SwiftUI chat app for using privately hosted Ollama models across Apple platforms. The main workflow is composing a prompt, optionally with an image or voice input, sending conversation context to Ollama, then displaying and saving the response. It also supports model selection, conversation history, read-aloud, settings, and a macOS Spotlight-style prompt/completion panel. The tree and README establish these capabilities; sampled source confirms chat generation and SwiftData persistence, while some UI and store wiring is unsampled.

Main entry points: [`Enchanted/UI/macOS/PromptPanel/PanelManager.swift`](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/macOS/PromptPanel/PanelManager.swift) (Panel controller), [`Enchanted/Stores/ConversationStore.swift`](https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/ConversationStore.swift) (Conversation workflow), [`Enchanted/UI/iOS/ChatView_iOS.swift`](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/iOS/ChatView_iOS.swift) (Chat interface), [`Enchanted/Services/OllamaService.swift`](https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/OllamaService.swift) (Ollama client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat experience"]
  node_app["Application entry"]
  node_chatui["Chat interface<br/>[ChatView_iOS.swift]"]
  node_chatdisplay["Message display"]
  node_voiceinput["Voice prompts"]
  node_speechui["Read aloud"]
end

subgraph group_models["Models and settings"]
  node_ollama["Ollama client"]
  node_modelstore["Model catalog"]
  node_settings["App settings<br/>[SettingsView.swift]"]
end

subgraph group_state["Conversation state"]
  node_conversationstore["Conversation workflow"]
  node_conversationdata["Conversation data"]
  node_messagedata["Message data<br/>[MessageSD.swift]"]
  node_swiftdata[("Local persistence")]
end

subgraph group_macpanel["macOS prompt panel"]
  node_panelmanager["Panel controller<br/>[PanelManager.swift]"]
  node_promptpanel["Prompt panel<br/>[PromptPanel.swift]"]
  node_completionstore["Completions"]
end

subgraph group_platform["Platform services"]
  node_speechservice["Speech synthesis"]
  node_hotkeys["Hotkey service"]
  node_clipboard["Clipboard<br/>[Clipboard.swift]"]
end

node_user(("User"))
node_ollamaserver["Ollama server"]

node_user -->|"composes"| node_chatui
node_app -->|"presents"| node_chatui
node_chatui -->|"submits prompt"| node_conversationstore
node_chatui -.->|"records prompt"| node_voiceinput
node_conversationstore -->|"requests completion"| node_ollama
node_ollama -->|"sends request"| node_ollamaserver
node_ollamaserver -->|"returns response"| node_ollama
node_conversationstore -->|"loads and saves"| node_swiftdata
node_swiftdata -->|"persists"| node_conversationdata
node_swiftdata -->|"persists"| node_messagedata
node_conversationstore -->|"publishes messages"| node_chatdisplay
node_chatdisplay -->|"shows response"| node_user
node_modelstore -->|"fetches models"| node_ollama
node_settings -->|"configures"| node_user
node_speechui -->|"speaks response"| node_speechservice
node_speechservice -->|"plays audio"| node_user
node_user -->|"opens panel"| node_panelmanager
node_panelmanager -->|"presents"| node_promptpanel
node_panelmanager -->|"uses completions"| node_completionstore
node_panelmanager -->|"registers shortcut"| node_hotkeys
node_panelmanager -->|"copies text"| node_clipboard

click node_app "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/ApplicationEntry.swift"
click node_chatui "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/iOS/ChatView_iOS.swift"
click node_chatdisplay "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Chat/Components/MessageListVIew.swift"
click node_voiceinput "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Chat/Components/Recorder/SpeechRecogniser.swift"
click node_speechui "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Chat/Components/ReadingAloudView.swift"
click node_conversationstore "https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/ConversationStore.swift"
click node_conversationdata "https://github.com/augustdev/enchanted/blob/main/Enchanted/SwiftData/Models/ConversationSD.swift"
click node_messagedata "https://github.com/augustdev/enchanted/blob/main/Enchanted/SwiftData/Models/MessageSD.swift"
click node_swiftdata "https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/SwiftDataService.swift"
click node_ollama "https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/OllamaService.swift"
click node_modelstore "https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/LanguageModelStore.swift"
click node_settings "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Settings/SettingsView.swift"
click node_speechservice "https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/SpeechService.swift"
click node_panelmanager "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/macOS/PromptPanel/PanelManager.swift"
click node_promptpanel "https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/macOS/PromptPanel/PromptPanel.swift"
click node_completionstore "https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/CompletionsStore.swift"
click node_hotkeys "https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/HotkeyService.swift"
click node_clipboard "https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/Clipboard.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_app,node_chatui,node_chatdisplay,node_voiceinput,node_speechui,node_user toneBlue
class node_ollama,node_modelstore,node_settings toneAmber
class node_conversationstore,node_conversationdata,node_messagedata,node_swiftdata,node_ollamaserver toneMint
class node_panelmanager,node_promptpanel,node_completionstore toneRose
class node_speechservice,node_hotkeys,node_clipboard toneIndigo
```

## Components

### Chat experience

- [Application entry](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/ApplicationEntry.swift): `Enchanted/UI/Shared/ApplicationEntry.swift`
- [Chat interface](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/iOS/ChatView_iOS.swift): `Enchanted/UI/iOS/ChatView_iOS.swift`
- [Message display](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Chat/Components/MessageListVIew.swift): `Enchanted/UI/Shared/Chat/Components/MessageListVIew.swift`
- [Voice prompts](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Chat/Components/Recorder/SpeechRecogniser.swift): `Enchanted/UI/Shared/Chat/Components/Recorder/SpeechRecogniser.swift`
- [Read aloud](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Chat/Components/ReadingAloudView.swift): `Enchanted/UI/Shared/Chat/Components/ReadingAloudView.swift`

### Models and settings

- [Ollama client](https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/OllamaService.swift): `Enchanted/Services/OllamaService.swift`
- [Model catalog](https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/LanguageModelStore.swift): `Enchanted/Stores/LanguageModelStore.swift`
- [App settings](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/Shared/Settings/SettingsView.swift): `Enchanted/UI/Shared/Settings/SettingsView.swift`

### Conversation state

- [Conversation workflow](https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/ConversationStore.swift): `Enchanted/Stores/ConversationStore.swift`
- [Conversation data](https://github.com/augustdev/enchanted/blob/main/Enchanted/SwiftData/Models/ConversationSD.swift): `Enchanted/SwiftData/Models/ConversationSD.swift`
- [Message data](https://github.com/augustdev/enchanted/blob/main/Enchanted/SwiftData/Models/MessageSD.swift): `Enchanted/SwiftData/Models/MessageSD.swift`
- [Local persistence](https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/SwiftDataService.swift): `Enchanted/Services/SwiftDataService.swift`

### macOS prompt panel

- [Panel controller](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/macOS/PromptPanel/PanelManager.swift): `Enchanted/UI/macOS/PromptPanel/PanelManager.swift`
- [Prompt panel](https://github.com/augustdev/enchanted/blob/main/Enchanted/UI/macOS/PromptPanel/PromptPanel.swift): `Enchanted/UI/macOS/PromptPanel/PromptPanel.swift`
- [Completions](https://github.com/augustdev/enchanted/blob/main/Enchanted/Stores/CompletionsStore.swift): `Enchanted/Stores/CompletionsStore.swift`

### Platform services

- [Speech synthesis](https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/SpeechService.swift): `Enchanted/Services/SpeechService.swift`
- [Hotkey service](https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/HotkeyService.swift): `Enchanted/Services/HotkeyService.swift`
- [Clipboard](https://github.com/augustdev/enchanted/blob/main/Enchanted/Services/Clipboard.swift): `Enchanted/Services/Clipboard.swift`

### Other components

- **User**
- **Ollama server**

## Connections

- User → Chat interface: composes
- Application entry → Chat interface: presents
- Chat interface → Conversation workflow: submits prompt
- Chat interface → Voice prompts: records prompt
- Conversation workflow → Ollama client: requests completion
- Ollama client → Ollama server: sends request
- Ollama server → Ollama client: returns response
- Conversation workflow → Local persistence: loads and saves
- Local persistence → Conversation data: persists
- Local persistence → Message data: persists
- Conversation workflow → Message display: publishes messages
- Message display → User: shows response
- Model catalog → Ollama client: fetches models
- App settings → User: configures
- Read aloud → Speech synthesis: speaks response
- Speech synthesis → User: plays audio
- User → Panel controller: opens panel
- Panel controller → Prompt panel: presents
- Panel controller → Completions: uses completions
- Panel controller → Hotkey service: registers shortcut
- Panel controller → Clipboard: copies text
