# saketh11111/intention architecture

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

- Interactive diagram: https://gitdiagram.com/saketh11111/intention
- Repository: https://github.com/saketh11111/intention

## Overview

Intention is a macOS dictation-and-writing app: a person holds the dictation key, speaks, and receives finished text at the focused cursor. The main workflow spans key/audio capture, streaming transcription, optional voice-style writing, and insertion; setup, history, caret guidance, and diagnostics are supporting capabilities. A local Node proxy connects the client to privately configured speech and writing services. Relationships are limited to the README and source-index references; unsampled implementation details are not asserted.

Main entry points: [`apps/macos/Intention/Dictation/DictationController.swift`](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Dictation/DictationController.swift) (Dictation controller), [`proxy/src/server.mjs`](https://github.com/saketh11111/intention/blob/main/proxy/src/server.mjs) (Local proxy), [`apps/macos/Intention/Onboarding/OnboardingView.swift`](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Onboarding/OnboardingView.swift) (First-run setup), [`apps/macos/Intention/Platform/Input/HoldKey.swift`](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Input/HoldKey.swift) (Dictation key)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Mac app"]
  node_onboarding["First-run setup"]
  node_setupmodel["Setup model"]
  node_home["Home window<br/>[HomeView.swift]"]
  node_settings["Preferences"]
  node_caret["Caret tracking<br/>[CaretTracker.swift]"]
  node_dot["Caret dot"]
end

subgraph group_speech["Dictation"]
  node_key["Dictation key<br/>[HoldKey.swift]"]
  node_dictation["Dictation controller"]
  node_microphone["Microphone capture<br/>[Microphone.swift]"]
  node_transcript[("Dictation history")]
end

subgraph group_writing["Writing and insertion"]
  node_composecontext["Compose context"]
  node_writer["Email writer<br/>[EmailWriter.swift]"]
  node_writinginput["Writing input<br/>[WritingInput.swift]"]
  node_inserter["Text insertion<br/>[TextInserter.swift]"]
end

subgraph group_services["Backend and records"]
  node_stream["Speech stream"]
  node_archive[("Interaction archive")]
  node_events["Client event sender"]
  node_alpha["Backend client<br/>[AlphaClient.swift]"]
  node_proxy["Local proxy<br/>[server.mjs]"]
end

node_person(("Mac user"))
node_upstreams["Speech and writing services"]

node_person -->|"holds to dictate"| node_key
node_key -.->|"starts dictation"| node_dictation
node_dictation -->|"records audio"| node_microphone
node_dictation -->|"streams audio"| node_stream
node_stream -.->|"sends speech"| node_proxy
node_proxy -.->|"forwards requests"| node_upstreams
node_dictation -->|"records history"| node_transcript
node_dictation -->|"requests email writing"| node_writer
node_writer -->|"uses writing input"| node_writinginput
node_dictation -->|"inserts finished text"| node_inserter
node_person -->|"sets up app"| node_onboarding
node_onboarding -->|"drives setup"| node_setupmodel
node_person -.->|"reviews activity"| node_home
node_person -.->|"changes preferences"| node_settings
node_caret -->|"tracks caret display"| node_dot
node_dictation -->|"archives interaction"| node_archive
node_dictation -->|"requests credentials"| node_alpha
node_events -->|"reads event journal"| node_archive
node_alpha -.->|"uses configured endpoint"| node_proxy

click node_key "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Input/HoldKey.swift"
click node_dictation "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Dictation/DictationController.swift"
click node_microphone "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Audio/Microphone.swift"
click node_stream "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/DictationStream.swift"
click node_transcript "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Dictation/DictationHistory.swift"
click node_onboarding "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Onboarding/OnboardingView.swift"
click node_setupmodel "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Onboarding/OnboardingModel.swift"
click node_home "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Home/HomeView.swift"
click node_settings "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Settings/SettingsSheet.swift"
click node_caret "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/TextAccess/CaretTracker.swift"
click node_dot "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Panels/CaretDotController.swift"
click node_composecontext "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Compose/ComposeContext.swift"
click node_writer "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Compose/EmailWriter.swift"
click node_writinginput "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Compose/WritingInput.swift"
click node_inserter "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/TextAccess/TextInserter.swift"
click node_archive "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/InteractionArchive.swift"
click node_events "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/ClientEventSender.swift"
click node_alpha "https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/AlphaClient.swift"
click node_proxy "https://github.com/saketh11111/intention/blob/main/proxy/src/server.mjs"

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_onboarding,node_setupmodel,node_home,node_settings,node_caret,node_dot,node_person toneBlue
class node_key,node_dictation,node_microphone,node_transcript toneAmber
class node_composecontext,node_writer,node_writinginput,node_inserter toneMint
class node_stream,node_archive,node_events,node_alpha,node_proxy toneRose
class node_upstreams toneIndigo
```

## Components

### Mac app

- [First-run setup](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Onboarding/OnboardingView.swift): `apps/macos/Intention/Onboarding/OnboardingView.swift`
- [Setup model](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Onboarding/OnboardingModel.swift): `apps/macos/Intention/Onboarding/OnboardingModel.swift`
- [Home window](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Home/HomeView.swift): `apps/macos/Intention/Home/HomeView.swift`
- [Preferences](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Settings/SettingsSheet.swift): `apps/macos/Intention/Settings/SettingsSheet.swift`
- [Caret tracking](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/TextAccess/CaretTracker.swift): `apps/macos/Intention/Platform/TextAccess/CaretTracker.swift`
- [Caret dot](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Panels/CaretDotController.swift): `apps/macos/Intention/Platform/Panels/CaretDotController.swift`

### Dictation

- [Dictation key](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Input/HoldKey.swift): `apps/macos/Intention/Platform/Input/HoldKey.swift`
- [Dictation controller](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Dictation/DictationController.swift): `apps/macos/Intention/Dictation/DictationController.swift`
- [Microphone capture](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Audio/Microphone.swift): `apps/macos/Intention/Platform/Audio/Microphone.swift`
- [Dictation history](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Dictation/DictationHistory.swift): `apps/macos/Intention/Dictation/DictationHistory.swift`

### Writing and insertion

- [Compose context](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Compose/ComposeContext.swift): `apps/macos/Intention/Compose/ComposeContext.swift`
- [Email writer](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Compose/EmailWriter.swift): `apps/macos/Intention/Compose/EmailWriter.swift`
- [Writing input](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Compose/WritingInput.swift): `apps/macos/Intention/Compose/WritingInput.swift`
- [Text insertion](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/TextAccess/TextInserter.swift): `apps/macos/Intention/Platform/TextAccess/TextInserter.swift`

### Backend and records

- [Speech stream](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/DictationStream.swift): `apps/macos/Intention/Platform/Backend/DictationStream.swift`
- [Interaction archive](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/InteractionArchive.swift): `apps/macos/Intention/Platform/Backend/InteractionArchive.swift`
- [Client event sender](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/ClientEventSender.swift): `apps/macos/Intention/Platform/Backend/ClientEventSender.swift`
- [Backend client](https://github.com/saketh11111/intention/blob/main/apps/macos/Intention/Platform/Backend/AlphaClient.swift): `apps/macos/Intention/Platform/Backend/AlphaClient.swift`
- [Local proxy](https://github.com/saketh11111/intention/blob/main/proxy/src/server.mjs): `proxy/src/server.mjs`

### Other components

- **Mac user**
- **Speech and writing services**

## Connections

- Mac user → Dictation key: holds to dictate (evidence: `README.md`)
- Dictation key → Dictation controller: starts dictation
- Dictation controller → Microphone capture: records audio (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Dictation controller → Speech stream: streams audio (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Speech stream → Local proxy: sends speech
- Local proxy → Speech and writing services: forwards requests (evidence: `README.md`)
- Dictation controller → Dictation history: records history (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Dictation controller → Email writer: requests email writing (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Email writer → Writing input: uses writing input (evidence: `apps/macos/Intention/Compose/EmailWriter.swift`)
- Dictation controller → Text insertion: inserts finished text (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Mac user → First-run setup: sets up app (evidence: `README.md`)
- First-run setup → Setup model: drives setup (evidence: `apps/macos/Intention/Onboarding/OnboardingView.swift`)
- Mac user → Home window: reviews activity
- Mac user → Preferences: changes preferences
- Caret tracking → Caret dot: tracks caret display (evidence: `apps/macos/Intention/Platform/Panels/CaretDotController.swift`)
- Dictation controller → Interaction archive: archives interaction (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Dictation controller → Backend client: requests credentials (evidence: `apps/macos/Intention/Dictation/DictationController.swift`)
- Client event sender → Interaction archive: reads event journal (evidence: `apps/macos/Intention/Platform/Backend/ClientEventSender.swift`)
- Backend client → Local proxy: uses configured endpoint
