# zachlatta/freeflow architecture

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

- Interactive diagram: https://gitdiagram.com/zachlatta/freeflow
- Repository: https://github.com/zachlatta/freeflow

## Overview

FreeFlow is a macOS menu-bar dictation and voice-editing app. The main workflow is shortcut activation, audio capture, optional app-context collection, provider transcription, context- and vocabulary-aware cleanup or selected-text editing, then insertion into the active app and history. The README also documents configurable shortcuts/providers, custom vocabulary, Edit Mode, and update support. Edges are limited to relationships visible in excerpts, the source index, or README; unsampled implementation details are not inferred.

Main entry points: [`Sources/AppState.swift`](https://github.com/zachlatta/freeflow/blob/main/Sources/AppState.swift) (Dictation coordinator), [`Sources/PostProcessingService.swift`](https://github.com/zachlatta/freeflow/blob/main/Sources/PostProcessingService.swift) (Cleanup and edit), [`Sources/SettingsView.swift`](https://github.com/zachlatta/freeflow/blob/main/Sources/SettingsView.swift) (App settings), [`Sources/HotkeyManager.swift`](https://github.com/zachlatta/freeflow/blob/main/Sources/HotkeyManager.swift) (Hotkey manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["App interaction"]
  node_menu["Menu bar UI<br/>[MenuBarView.swift]"]
  node_appstate["Dictation coordinator<br/>[AppState.swift]"]
end

subgraph group_capture["Shortcut and capture"]
  node_shortcutui["Shortcut settings"]
  node_binding["Shortcut bindings"]
  node_matcher["Shortcut matcher"]
  node_session["Dictation session"]
  node_hotkeys["Hotkey manager"]
  node_globalkeys["Global shortcut backend"]
  node_audio["Audio recorder"]
end

subgraph group_language["Transcription and editing"]
  node_realtime["Realtime transcription"]
  node_transcribe["Provider transcription"]
  node_postprocess["Cleanup and edit"]
  node_transport["LLM request transport"]
  node_models["Model configuration"]
  node_cooldown["Model cooldowns"]
end

subgraph group_context["Context and vocabulary"]
  node_contextservice["App context capture"]
  node_vocabulary["Custom vocabulary"]
end

subgraph group_state["Settings and history"]
  node_historyitem["Pipeline history record"]
  node_historystore[("Pipeline history store")]
  node_settings["App settings<br/>[SettingsView.swift]"]
  node_keychain[("API key storage")]
  node_updates["Update manager"]
end

node_user(("Dictation user"))
node_target["Active text field"]
node_provider{{"Configured AI provider"}}
node_github{{"GitHub releases"}}

node_user -->|"opens"| node_menu
node_menu -->|"uses state"| node_appstate
node_user -.->|"configures"| node_shortcutui
node_shortcutui -->|"edits"| node_binding
node_hotkeys -->|"starts backend"| node_globalkeys
node_hotkeys -->|"matches events"| node_matcher
node_matcher -->|"evaluates"| node_binding
node_appstate -->|"starts monitoring"| node_hotkeys
node_appstate -->|"handles shortcut"| node_session
node_appstate -->|"starts recording"| node_audio
node_appstate -->|"captures context"| node_contextservice
node_appstate -->|"starts realtime"| node_realtime
node_appstate -->|"requests fallback"| node_transcribe
node_transcribe -.->|"sends audio"| node_provider
node_appstate -->|"cleans transcript"| node_postprocess
node_contextservice -->|"requests inference"| node_provider
node_postprocess -->|"sends requests"| node_transport
node_postprocess -->|"uses configuration"| node_models
node_postprocess -->|"checks limits"| node_cooldown
node_postprocess -.->|"requests cleanup"| node_provider
node_appstate -->|"manages vocabulary"| node_vocabulary
node_user -->|"speaks into"| node_target
node_appstate -->|"pastes result"| node_target
node_appstate -->|"records pipeline"| node_historyitem
node_appstate -->|"persists history"| node_historystore
node_historystore -->|"stores records"| node_historyitem
node_settings -->|"configures"| node_appstate
node_settings -->|"selects models"| node_models
node_appstate -->|"stores API key"| node_keychain
node_settings -->|"manages updates"| node_updates
node_updates -.->|"checks releases"| node_github

click node_menu "https://github.com/zachlatta/freeflow/blob/main/Sources/MenuBarView.swift"
click node_appstate "https://github.com/zachlatta/freeflow/blob/main/Sources/AppState.swift"
click node_shortcutui "https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutComponents.swift"
click node_binding "https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutBinding.swift"
click node_matcher "https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutCore/ShortcutMatcher.swift"
click node_session "https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutCore/DictationShortcutSessionController.swift"
click node_hotkeys "https://github.com/zachlatta/freeflow/blob/main/Sources/HotkeyManager.swift"
click node_globalkeys "https://github.com/zachlatta/freeflow/blob/main/Sources/GlobalShortcutBackend.swift"
click node_audio "https://github.com/zachlatta/freeflow/blob/main/Sources/AudioRecorder.swift"
click node_realtime "https://github.com/zachlatta/freeflow/blob/main/Sources/RealtimeTranscriptionService.swift"
click node_transcribe "https://github.com/zachlatta/freeflow/blob/main/Sources/TranscriptionService.swift"
click node_contextservice "https://github.com/zachlatta/freeflow/blob/main/Sources/AppContextService.swift"
click node_postprocess "https://github.com/zachlatta/freeflow/blob/main/Sources/PostProcessingService.swift"
click node_transport "https://github.com/zachlatta/freeflow/blob/main/Sources/LLMAPITransport.swift"
click node_models "https://github.com/zachlatta/freeflow/blob/main/Sources/ModelConfiguration.swift"
click node_cooldown "https://github.com/zachlatta/freeflow/blob/main/Sources/LLMCooldownManager.swift"
click node_vocabulary "https://github.com/zachlatta/freeflow/blob/main/Sources/AppState%2BAddVocabularyButton.swift"
click node_historyitem "https://github.com/zachlatta/freeflow/blob/main/Sources/PipelineHistoryItem.swift"
click node_historystore "https://github.com/zachlatta/freeflow/blob/main/Sources/PipelineHistoryStore.swift"
click node_settings "https://github.com/zachlatta/freeflow/blob/main/Sources/SettingsView.swift"
click node_keychain "https://github.com/zachlatta/freeflow/blob/main/Sources/KeychainStorage.swift"
click node_updates "https://github.com/zachlatta/freeflow/blob/main/Sources/UpdateManager.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_menu,node_appstate,node_user toneBlue
class node_shortcutui,node_binding,node_matcher,node_session,node_hotkeys,node_globalkeys,node_audio toneAmber
class node_realtime,node_transcribe,node_postprocess,node_transport,node_models,node_cooldown toneMint
class node_contextservice,node_vocabulary toneRose
class node_historyitem,node_historystore,node_settings,node_keychain,node_updates,node_target,node_provider,node_github toneIndigo
```

## Components

### App interaction

- [Menu bar UI](https://github.com/zachlatta/freeflow/blob/main/Sources/MenuBarView.swift): `Sources/MenuBarView.swift`
- [Dictation coordinator](https://github.com/zachlatta/freeflow/blob/main/Sources/AppState.swift): `Sources/AppState.swift`

### Shortcut and capture

- [Shortcut settings](https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutComponents.swift): `Sources/ShortcutComponents.swift`
- [Shortcut bindings](https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutBinding.swift): `Sources/ShortcutBinding.swift`
- [Shortcut matcher](https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutCore/ShortcutMatcher.swift): `Sources/ShortcutCore/ShortcutMatcher.swift`
- [Dictation session](https://github.com/zachlatta/freeflow/blob/main/Sources/ShortcutCore/DictationShortcutSessionController.swift): `Sources/ShortcutCore/DictationShortcutSessionController.swift`
- [Hotkey manager](https://github.com/zachlatta/freeflow/blob/main/Sources/HotkeyManager.swift): `Sources/HotkeyManager.swift`
- [Global shortcut backend](https://github.com/zachlatta/freeflow/blob/main/Sources/GlobalShortcutBackend.swift): `Sources/GlobalShortcutBackend.swift`
- [Audio recorder](https://github.com/zachlatta/freeflow/blob/main/Sources/AudioRecorder.swift): `Sources/AudioRecorder.swift`

### Transcription and editing

- [Realtime transcription](https://github.com/zachlatta/freeflow/blob/main/Sources/RealtimeTranscriptionService.swift): `Sources/RealtimeTranscriptionService.swift`
- [Provider transcription](https://github.com/zachlatta/freeflow/blob/main/Sources/TranscriptionService.swift): `Sources/TranscriptionService.swift`
- [Cleanup and edit](https://github.com/zachlatta/freeflow/blob/main/Sources/PostProcessingService.swift): `Sources/PostProcessingService.swift`
- [LLM request transport](https://github.com/zachlatta/freeflow/blob/main/Sources/LLMAPITransport.swift): `Sources/LLMAPITransport.swift`
- [Model configuration](https://github.com/zachlatta/freeflow/blob/main/Sources/ModelConfiguration.swift): `Sources/ModelConfiguration.swift`
- [Model cooldowns](https://github.com/zachlatta/freeflow/blob/main/Sources/LLMCooldownManager.swift): `Sources/LLMCooldownManager.swift`

### Context and vocabulary

- [App context capture](https://github.com/zachlatta/freeflow/blob/main/Sources/AppContextService.swift): `Sources/AppContextService.swift`
- [Custom vocabulary](https://github.com/zachlatta/freeflow/blob/main/Sources/AppState%2BAddVocabularyButton.swift): `Sources/AppState+AddVocabularyButton.swift`

### Settings and history

- [Pipeline history record](https://github.com/zachlatta/freeflow/blob/main/Sources/PipelineHistoryItem.swift): `Sources/PipelineHistoryItem.swift`
- [Pipeline history store](https://github.com/zachlatta/freeflow/blob/main/Sources/PipelineHistoryStore.swift): `Sources/PipelineHistoryStore.swift`
- [App settings](https://github.com/zachlatta/freeflow/blob/main/Sources/SettingsView.swift): `Sources/SettingsView.swift`
- [API key storage](https://github.com/zachlatta/freeflow/blob/main/Sources/KeychainStorage.swift): `Sources/KeychainStorage.swift`
- [Update manager](https://github.com/zachlatta/freeflow/blob/main/Sources/UpdateManager.swift): `Sources/UpdateManager.swift`

### Other components

- **Dictation user**
- **Active text field**
- **Configured AI provider**
- **GitHub releases**

## Connections

- Dictation user → Menu bar UI: opens
- Menu bar UI → Dictation coordinator: uses state (evidence: `Sources/App.swift`)
- Dictation user → Shortcut settings: configures (evidence: `README.md`)
- Shortcut settings → Shortcut bindings: edits (evidence: `Sources/ShortcutComponents.swift`)
- Hotkey manager → Global shortcut backend: starts backend (evidence: `Sources/HotkeyManager.swift`)
- Hotkey manager → Shortcut matcher: matches events (evidence: `Sources/HotkeyManager.swift`)
- Shortcut matcher → Shortcut bindings: evaluates (evidence: `Sources/ShortcutCore/ShortcutMatcher.swift`)
- Dictation coordinator → Hotkey manager: starts monitoring (evidence: `Sources/AppState.swift`)
- Dictation coordinator → Dictation session: handles shortcut (evidence: `Sources/AppState.swift`)
- Dictation coordinator → Audio recorder: starts recording (evidence: `Sources/AppState.swift`)
- Dictation coordinator → App context capture: captures context (evidence: `Sources/AppState.swift`)
- Dictation coordinator → Realtime transcription: starts realtime (evidence: `Sources/AppState.swift`)
- Dictation coordinator → Provider transcription: requests fallback (evidence: `Sources/AppState.swift`)
- Provider transcription → Configured AI provider: sends audio (evidence: `README.md`)
- Dictation coordinator → Cleanup and edit: cleans transcript (evidence: `Sources/AppState.swift`)
- App context capture → Configured AI provider: requests inference (evidence: `Sources/AppContextService.swift`)
- Cleanup and edit → LLM request transport: sends requests (evidence: `Sources/PostProcessingService.swift`)
- Cleanup and edit → Model configuration: uses configuration (evidence: `Sources/PostProcessingService.swift`)
- Cleanup and edit → Model cooldowns: checks limits (evidence: `Sources/PostProcessingService.swift`)
- Cleanup and edit → Configured AI provider: requests cleanup (evidence: `README.md`)
- Dictation coordinator → Custom vocabulary: manages vocabulary (evidence: `Sources/AppState+AddVocabularyButton.swift`)
- Dictation user → Active text field: speaks into (evidence: `README.md`)
- Dictation coordinator → Active text field: pastes result (evidence: `README.md`)
- Dictation coordinator → Pipeline history record: records pipeline (evidence: `Sources/AppState.swift`)
- Dictation coordinator → Pipeline history store: persists history (evidence: `Sources/AppState.swift`)
- Pipeline history store → Pipeline history record: stores records (evidence: `Sources/PipelineHistoryStore.swift`)
- App settings → Dictation coordinator: configures (evidence: `Sources/SettingsView.swift`)
- App settings → Model configuration: selects models (evidence: `Sources/SettingsView.swift`)
- Dictation coordinator → API key storage: stores API key (evidence: `Sources/AppState.swift`)
- App settings → Update manager: manages updates (evidence: `Sources/SettingsView.swift`)
- Update manager → GitHub releases: checks releases (evidence: `README.md`)
