# ondex-gregor/hear-ai architecture

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

- Interactive diagram: https://gitdiagram.com/ondex-gregor/hear-ai
- Repository: https://github.com/ondex-gregor/hear-ai

## Overview

Hear AI is a Windows voice-dictation app: the user triggers recording with a global hotkey, speaks, and receives locally transcribed text in the active application. Its documented workflow includes chunked transcription, optional vocabulary correction and prompt generation, local history, and clipboard-based delivery. The graph also shows the bubble, settings, and model management. Several links are based on README behavior because the excerpts do not show all runtime wiring; optional providers are kept distinct.

Main entry points: [`src/hear_ai/controller.py`](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/controller.py) (Dictation controller), [`src/hear_ai/ui/settings_window.py`](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/settings_window.py) (Settings window), [`src/hear_ai/ui/qt_app.py`](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/qt_app.py) (Qt app and tray), [`src/hear_ai/gerador.py`](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/gerador.py) (Prompt generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and control"]
  node_hotkey["Global hotkey<br/>[hotkey.py]"]
  node_controller["Dictation controller<br/>[controller.py]"]
  node_audio["Microphone recorder<br/>[audio.py]"]
end

subgraph group_speech["Speech and text"]
  node_streaming["Chunked transcription<br/>[streaming.py]"]
  node_transcriber["Local Whisper<br/>[transcriber.py]"]
  node_postprocess["Text postprocessing<br/>[postprocess.py]"]
  node_vocab["Vocabulary correction<br/>[vocab.py]"]
  node_modes["Operation modes<br/>[modos.py]"]
  node_generator["Prompt generator<br/>[gerador.py]"]
end

subgraph group_delivery["Delivery and history"]
  node_paster["Clipboard and paste<br/>[paster.py]"]
  node_history[("Local history<br/>[history.py]")]
end

subgraph group_experience["App experience"]
  node_recent["Recents window<br/>[recent_window.py]"]
  node_bubble["Floating bubble<br/>[bubble.py]"]
  node_bubblemodel["Bubble state and waveform<br/>[bubble_model.py]"]
  node_qt["Qt app and tray<br/>[qt_app.py]"]
  node_settings["Settings window<br/>[settings_window.py]"]
  node_settingsmodel["Settings validation<br/>[settings_model.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_models["Model downloads<br/>[model_download.py]"]
end

node_user(("User"))
node_ollama{{"Ollama"}}
node_cloud{{"Cloud endpoint"}}

node_user -->|"starts dictation"| node_hotkey
node_hotkey -->|"triggers recording"| node_controller
node_controller -->|"records speech"| node_audio
node_audio -->|"streams audio"| node_streaming
node_streaming -->|"transcribes chunks"| node_transcriber
node_controller -->|"selects mode"| node_modes
node_modes -->|"rewrites transcript"| node_generator
node_generator -.->|"requests completion"| node_ollama
node_generator -.->|"requests completion"| node_cloud
node_controller -->|"processes transcript"| node_postprocess
node_controller -->|"corrects terms"| node_vocab
node_controller -->|"saves transcript"| node_history
node_controller -->|"delivers text"| node_paster
node_user -->|"controls recording"| node_bubble
node_bubble -->|"updates display state"| node_bubblemodel
node_qt -->|"shows bubble"| node_bubble
node_qt -->|"opens recents"| node_recent
node_recent -->|"searches history"| node_history
node_qt -->|"opens settings"| node_settings
node_settings -->|"validates changes"| node_settingsmodel
node_settings -->|"saves configuration"| node_config
node_settings -->|"downloads model"| node_models
node_user -->|"reviews corrections"| node_recent

click node_hotkey "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/hotkey.py"
click node_controller "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/controller.py"
click node_audio "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/audio.py"
click node_streaming "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/streaming.py"
click node_transcriber "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/transcriber.py"
click node_postprocess "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/postprocess.py"
click node_vocab "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/vocab.py"
click node_modes "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/modos.py"
click node_generator "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/gerador.py"
click node_paster "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/paster.py"
click node_history "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/history.py"
click node_recent "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/recent_window.py"
click node_bubble "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/bubble.py"
click node_bubblemodel "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/bubble_model.py"
click node_qt "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/qt_app.py"
click node_settings "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/settings_window.py"
click node_settingsmodel "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/settings_model.py"
click node_config "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/config.py"
click node_models "https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/model_download.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_hotkey,node_controller,node_audio,node_user toneBlue
class node_streaming,node_transcriber,node_postprocess,node_vocab,node_modes,node_generator toneAmber
class node_paster,node_history toneMint
class node_recent,node_bubble,node_bubblemodel,node_qt,node_settings,node_settingsmodel,node_config,node_models toneRose
class node_ollama,node_cloud toneIndigo
```

## Components

### Capture and control

- [Global hotkey](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/hotkey.py): `src/hear_ai/hotkey.py`
- [Dictation controller](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/controller.py): `src/hear_ai/controller.py`
- [Microphone recorder](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/audio.py): `src/hear_ai/audio.py`

### Speech and text

- [Chunked transcription](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/streaming.py): `src/hear_ai/streaming.py`
- [Local Whisper](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/transcriber.py): `src/hear_ai/transcriber.py`
- [Text postprocessing](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/postprocess.py): `src/hear_ai/postprocess.py`
- [Vocabulary correction](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/vocab.py): `src/hear_ai/vocab.py`
- [Operation modes](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/modos.py): `src/hear_ai/modos.py`
- [Prompt generator](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/gerador.py): `src/hear_ai/gerador.py`

### Delivery and history

- [Clipboard and paste](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/paster.py): `src/hear_ai/paster.py`
- [Local history](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/history.py): `src/hear_ai/history.py`

### App experience

- [Recents window](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/recent_window.py): `src/hear_ai/ui/recent_window.py`
- [Floating bubble](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/bubble.py): `src/hear_ai/ui/bubble.py`
- [Bubble state and waveform](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/bubble_model.py): `src/hear_ai/ui/bubble_model.py`
- [Qt app and tray](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/qt_app.py): `src/hear_ai/ui/qt_app.py`
- [Settings window](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/ui/settings_window.py): `src/hear_ai/ui/settings_window.py`
- [Settings validation](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/settings_model.py): `src/hear_ai/settings_model.py`
- [Configuration](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/config.py): `src/hear_ai/config.py`
- [Model downloads](https://github.com/ondex-gregor/hear-ai/blob/main/src/hear_ai/model_download.py): `src/hear_ai/model_download.py`

### Other components

- **User**
- **Ollama**
- **Cloud endpoint**

## Connections

- User → Global hotkey: starts dictation (evidence: `README.md`)
- Global hotkey → Dictation controller: triggers recording (evidence: `README.md`)
- Dictation controller → Microphone recorder: records speech (evidence: `README.md`)
- Microphone recorder → Chunked transcription: streams audio (evidence: `README.md`)
- Chunked transcription → Local Whisper: transcribes chunks (evidence: `README.md`)
- Dictation controller → Operation modes: selects mode (evidence: `src/hear_ai/modos.py`)
- Operation modes → Prompt generator: rewrites transcript (evidence: `src/hear_ai/modos.py`)
- Prompt generator → Ollama: requests completion (evidence: `src/hear_ai/gerador.py`)
- Prompt generator → Cloud endpoint: requests completion (evidence: `src/hear_ai/gerador.py`)
- Dictation controller → Text postprocessing: processes transcript (evidence: `src/hear_ai/controller.py`)
- Dictation controller → Vocabulary correction: corrects terms (evidence: `src/hear_ai/controller.py`)
- Dictation controller → Local history: saves transcript (evidence: `README.md`)
- Dictation controller → Clipboard and paste: delivers text (evidence: `README.md`)
- User → Floating bubble: controls recording (evidence: `README.md`)
- Floating bubble → Bubble state and waveform: updates display state (evidence: `src/hear_ai/ui/bubble.py`)
- Qt app and tray → Floating bubble: shows bubble (evidence: `src/hear_ai/ui/qt_app.py`)
- Qt app and tray → Recents window: opens recents (evidence: `src/hear_ai/ui/qt_app.py`)
- Recents window → Local history: searches history (evidence: `README.md`)
- Qt app and tray → Settings window: opens settings (evidence: `src/hear_ai/ui/qt_app.py`)
- Settings window → Settings validation: validates changes (evidence: `src/hear_ai/ui/settings_window.py`)
- Settings window → Configuration: saves configuration (evidence: `src/hear_ai/ui/settings_window.py`)
- Settings window → Model downloads: downloads model (evidence: `src/hear_ai/ui/settings_window.py`)
- User → Recents window: reviews corrections (evidence: `README.md`)
