# drajb/whisper-local architecture

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

## Overview

Whisper Local is an offline desktop dictation application for Windows and macOS. The principal workflow is: a user activates a global hotkey, audio is captured and transcribed locally, text is post-processed, then delivered to the focused application or clipboard. StateManager coordinates that workflow; main.py wires startup and components. The README also documents streaming previews, voice commands, profiles, transforms, settings, and tray controls. Unsampled subsystem links are omitted or marked unverified rather than inferred as calls.

Main entry points: [`src/whisper_key/main.py`](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/main.py) (Application startup), [`src/whisper_key/state_manager.py`](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/state_manager.py) (Dictation coordinator), [`src/whisper_key/system_tray.py`](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/system_tray.py) (System tray), [`src/whisper_key/audio_recorder.py`](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/audio_recorder.py) (Audio capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and recognition"]
  node_hotkeys["Global hotkeys<br/>[hotkey_listener.py]"]
  node_audio["Audio capture<br/>[audio_recorder.py]"]
  node_vad["Voice detection"]
  node_streaming["Streaming preview"]
  node_engine["Whisper recognition<br/>[whisper_engine.py]"]
  node_cpp["whisper.cpp backend"]
  node_models["Model registry<br/>[model_registry.py]"]
end

subgraph group_workflow["Dictation workflow"]
  node_entry["Application startup<br/>[main.py]"]
  node_state["Dictation coordinator<br/>[state_manager.py]"]
  node_postprocess["Text post-processing"]
  node_commands["Voice commands<br/>[voice_commands.py]"]
  node_delivery["Text delivery"]
  node_stats[("Usage statistics<br/>[stats.py]")]
end

subgraph group_controls["App controls"]
  node_tray["System tray<br/>[system_tray.py]"]
  node_cheatsheet["Hotkey cheat sheet<br/>[cheat_sheet.py]"]
  node_terminal["Terminal status<br/>[terminal_title.py]"]
  node_autostart["Autostart control<br/>[autostart.py]"]
  node_bundledlogs["Log bundle<br/>[bundle_logs.py]"]
end

subgraph group_settings["Settings and setup"]
  node_config["Configuration<br/>[config_manager.py]"]
  node_settingsui["Settings interface<br/>[settings_ui.py]"]
  node_profiles["Profiles<br/>[profiles.py]"]
end

subgraph group_platform["Platform services"]
  node_platform["Platform adapters<br/>[__init__.py]"]
end

node_user(("Dictation user"))

node_user -->|"presses hotkey"| node_hotkeys
node_hotkeys -.->|"dispatches events"| node_state
node_state -->|"starts or stops"| node_audio
node_audio -->|"checks speech"| node_vad
node_state -->|"requests transcription"| node_engine
node_state -->|"post-processes text"| node_postprocess
node_state -->|"delivers transcript"| node_delivery
node_entry -.->|"wires components"| node_state
node_entry -->|"constructs recorder"| node_audio
node_entry -->|"constructs backend"| node_engine
node_entry -.->|"selects backend"| node_cpp
node_entry -.->|"initializes preview"| node_streaming
node_streaming -->|"uses registry"| node_models
node_engine -.->|"uses registry"| node_models
node_state -.->|"routes commands"| node_commands
node_entry -.->|"loads settings"| node_config
node_settingsui -->|"reads and edits"| node_config
node_entry -.->|"starts tray"| node_tray
node_tray -->|"controls dictation"| node_state
node_tray -->|"opens sheet"| node_cheatsheet
node_tray -->|"controls startup"| node_autostart
node_tray -->|"opens log bundle"| node_bundledlogs
node_tray -->|"lists profiles"| node_profiles
node_entry -.->|"updates status"| node_terminal
node_entry -->|"selects adapters"| node_platform
node_state -->|"records usage"| node_stats

click node_entry "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/main.py"
click node_state "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/state_manager.py"
click node_hotkeys "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/hotkey_listener.py"
click node_audio "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/audio_recorder.py"
click node_vad "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/voice_activity_detection.py"
click node_streaming "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/streaming_manager.py"
click node_engine "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/whisper_engine.py"
click node_cpp "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/whisper_engine_cpp.py"
click node_models "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/model_registry.py"
click node_postprocess "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/text_postprocess.py"
click node_commands "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/voice_commands.py"
click node_delivery "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/clipboard_manager.py"
click node_tray "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/system_tray.py"
click node_cheatsheet "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/cheat_sheet.py"
click node_terminal "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/terminal_title.py"
click node_autostart "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/autostart.py"
click node_bundledlogs "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/bundle_logs.py"
click node_config "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/config_manager.py"
click node_settingsui "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/settings_ui.py"
click node_profiles "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/profiles.py"
click node_platform "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/platform/__init__.py"
click node_stats "https://github.com/drajb/whisper-local/blob/master/src/whisper_key/stats.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_hotkeys,node_audio,node_vad,node_streaming,node_engine,node_cpp,node_models,node_user toneBlue
class node_entry,node_state,node_postprocess,node_commands,node_delivery,node_stats toneAmber
class node_tray,node_cheatsheet,node_terminal,node_autostart,node_bundledlogs toneMint
class node_config,node_settingsui,node_profiles toneRose
class node_platform toneIndigo
```

## Components

### Capture and recognition

- [Global hotkeys](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/hotkey_listener.py): `src/whisper_key/hotkey_listener.py`
- [Audio capture](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/audio_recorder.py): `src/whisper_key/audio_recorder.py`
- [Voice detection](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/voice_activity_detection.py): `src/whisper_key/voice_activity_detection.py`
- [Streaming preview](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/streaming_manager.py): `src/whisper_key/streaming_manager.py`
- [Whisper recognition](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/whisper_engine.py): `src/whisper_key/whisper_engine.py`
- [whisper.cpp backend](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/whisper_engine_cpp.py): `src/whisper_key/whisper_engine_cpp.py`
- [Model registry](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/model_registry.py): `src/whisper_key/model_registry.py`

### Dictation workflow

- [Application startup](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/main.py): `src/whisper_key/main.py`
- [Dictation coordinator](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/state_manager.py): `src/whisper_key/state_manager.py`
- [Text post-processing](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/text_postprocess.py): `src/whisper_key/text_postprocess.py`
- [Voice commands](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/voice_commands.py): `src/whisper_key/voice_commands.py`
- [Text delivery](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/clipboard_manager.py): `src/whisper_key/clipboard_manager.py`
- [Usage statistics](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/stats.py): `src/whisper_key/stats.py`

### App controls

- [System tray](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/system_tray.py): `src/whisper_key/system_tray.py`
- [Hotkey cheat sheet](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/cheat_sheet.py): `src/whisper_key/cheat_sheet.py`
- [Terminal status](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/terminal_title.py): `src/whisper_key/terminal_title.py`
- [Autostart control](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/autostart.py): `src/whisper_key/autostart.py`
- [Log bundle](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/bundle_logs.py): `src/whisper_key/bundle_logs.py`

### Settings and setup

- [Configuration](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/config_manager.py): `src/whisper_key/config_manager.py`
- [Settings interface](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/settings_ui.py): `src/whisper_key/settings_ui.py`
- [Profiles](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/profiles.py): `src/whisper_key/profiles.py`

### Platform services

- [Platform adapters](https://github.com/drajb/whisper-local/blob/master/src/whisper_key/platform/__init__.py): `src/whisper_key/platform/__init__.py`

### Other components

- **Dictation user**

## Connections

- Dictation user → Global hotkeys: presses hotkey
- Global hotkeys → Dictation coordinator: dispatches events
- Dictation coordinator → Audio capture: starts or stops (evidence: `src/whisper_key/state_manager.py`)
- Audio capture → Voice detection: checks speech (evidence: `src/whisper_key/audio_recorder.py`)
- Dictation coordinator → Whisper recognition: requests transcription (evidence: `src/whisper_key/state_manager.py`)
- Dictation coordinator → Text post-processing: post-processes text (evidence: `src/whisper_key/state_manager.py`)
- Dictation coordinator → Text delivery: delivers transcript (evidence: `src/whisper_key/state_manager.py`)
- Application startup → Dictation coordinator: wires components (evidence: `src/whisper_key/main.py`)
- Application startup → Audio capture: constructs recorder (evidence: `src/whisper_key/main.py`)
- Application startup → Whisper recognition: constructs backend (evidence: `src/whisper_key/main.py`)
- Application startup → whisper.cpp backend: selects backend (evidence: `src/whisper_key/main.py`)
- Application startup → Streaming preview: initializes preview (evidence: `src/whisper_key/main.py`)
- Streaming preview → Model registry: uses registry (evidence: `src/whisper_key/streaming_manager.py`)
- Whisper recognition → Model registry: uses registry
- Dictation coordinator → Voice commands: routes commands (evidence: `src/whisper_key/state_manager.py`)
- Application startup → Configuration: loads settings (evidence: `src/whisper_key/main.py`)
- Settings interface → Configuration: reads and edits (evidence: `src/whisper_key/settings_ui.py`)
- Application startup → System tray: starts tray (evidence: `src/whisper_key/main.py`)
- System tray → Dictation coordinator: controls dictation (evidence: `src/whisper_key/system_tray.py`)
- System tray → Hotkey cheat sheet: opens sheet (evidence: `src/whisper_key/system_tray.py`)
- System tray → Autostart control: controls startup (evidence: `src/whisper_key/system_tray.py`)
- System tray → Log bundle: opens log bundle (evidence: `src/whisper_key/system_tray.py`)
- System tray → Profiles: lists profiles (evidence: `src/whisper_key/system_tray.py`)
- Application startup → Terminal status: updates status (evidence: `src/whisper_key/main.py`)
- Application startup → Platform adapters: selects adapters (evidence: `src/whisper_key/platform/__init__.py`)
- Dictation coordinator → Usage statistics: records usage (evidence: `src/whisper_key/state_manager.py`)
