Introducing a new way to review your PRs.

Read the announcement

altic-dev / fluidvoice

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

View on GitHub

24 documents · Updated Nov 23, 2026

docs / voice-dictation

Voice dictation pipeline

Voice dictation turns a macOS keyboard, mouse, or on-screen invocation into text in the application that had focus when recording began. The pipeline protects the start and stop boundaries, selects a ready microphone and speech engine, applies the user's text rules, and delivers the result without losing the original destination.

Pipeline scope

The dictation flow joins five product concerns. The application shell starts the flow, the audio system supplies speech, the recognition service produces a transcript, text processing prepares the output, and macOS input services return that output to the user's application.

This diagram shows how a user action becomes delivered text or a guarded no-op.

flowchart LR
    A[Invocation] --> B[Capture target context]
    X[App activation] --> Y[Accessibility preparation]
    Y --> B
    B --> C[Microphone readiness]
    C --> D[Audio recording]
    D --> E[Live and final recognition]
    E --> F[Transcript processing]
    F --> G[Target validation]
    G --> H[Text insertion]
    G --> I[No delivery]
    H --> J[Optional spoken send]

This page gives the cross-system view. The focused child pages describe the boundaries in more detail:

References: Sources/…/ASRService.swift• L57-88 Sources/…/TranscriptionProvider.swift• L105-165 Sources/…/ContentView.swift• L2087-2150

Invocation and target context

Dictation starts from a configured global shortcut or a recording control. The shortcut manager maps keyboard, mouse, and modifier-only input to a dictation start or stop action. The main application view then owns the recording mode and the rest of the output route. (Sources/…/GlobalHotkeyManager.swift• L229-257, Sources/…/GlobalHotkeyManager.swift• L998-1003, Sources/…/ContentView.swift• L3446-3474)

Before the recording UI can take focus, the flow records the focused accessibility element, its process, and the frontmost application. That snapshot gives later delivery a stable destination even when the recording overlay or a settings view becomes frontmost. The same context lets text rules adapt to the destination application and window. When screen context is enabled, the flow also starts a bounded background read for the captured target. (Sources/…/ContentView.swift• L1681-1715, Sources/…/DictationContextCapture.swift• L44-76)

Accessibility preparation

Accessibility preparation makes supported Electron applications ready to expose their focused field to dictation. It runs when an application becomes frontmost and requests the documented accessibility support without changing focus, reading text, or sending input. (Sources/…/DictationAccessibilityPreparation.swift• L1-37)

The preparation is limited to the current process identity and application bundle. Successful and unsupported results are cached with a bounded size, while missing permission and failed attempts remain retryable. A relaunch or process-ID reuse therefore receives a fresh check, and granting Accessibility permission allows a later activation to try again. (Sources/…/DictationAccessibilityPreparation.swift• L40-95, Tests/DictationAccessibilityPreparationTests.swift• L37-94)

References: Sources/…/DictationAccessibilityPreparation.swift• L1-95 Tests/DictationAccessibilityPreparationTests.swift• L37-94

The shortcut can use hold, automatic, or toggle behavior. A hold ends on release. A toggle uses a later press to stop. Automatic behavior resolves a press and release while also supporting a mode switch. These choices change how the flow is invoked, but they all converge on the same recording and stop paths. A modifier-only shortcut arms only on the first press of its configured modifier. An unrelated key or sibling modifier marks that press interrupted, and later modifier events cannot re-arm it as a clean tap. Synthesized typing events must not create a new dictation session. (Sources/…/GlobalHotkeyManager.swift• L88-230, Sources/…/GlobalHotkeyManager.swift• L1258-1321, Sources/…/GlobalHotkeyManager.swift• L1574-1709, Sources/…/GlobalHotkeyManager.swift• L1900-1961, Tests/…/HotkeyShortcutTests.swift• L607-760)

Command mode keeps ownership of its recording explicit. It stops a recording only when command mode started that recording, so opening or closing command mode cannot stop an unrelated dictation session. (Sources/…/CommandModeView.swift• L3-15, Tests/…/SettingsNavigationStateTests.swift• L84-112)

References: Sources/…/GlobalHotkeyManager.swift• L88-230 Sources/…/GlobalHotkeyManager.swift• L745-777 Sources/…/GlobalHotkeyManager.swift• L998-1003 Sources/…/GlobalHotkeyManager.swift• L1258-1321 Sources/…/GlobalHotkeyManager.swift• L1574-1709 Sources/…/GlobalHotkeyManager.swift• L1900-1961 Sources/…/ContentView.swift• L1681-1715 Sources/…/ContentView.swift• L3446-3474 Sources/…/CommandModeView.swift• L3-15 Tests/…/HotkeyShortcutTests.swift• L23-115 Tests/…/HotkeyShortcutTests.swift• L607-760 Tests/…/SettingsNavigationStateTests.swift• L84-112

Screen context capture

Screen context capture reads limited text from the application that received the dictation. It gives later text processing the words before the cursor and visible window text without changing the active target. (Dictation screen context)

The read starts in parallel with recording and is tied to the saved process, window, and accessibility element. It prefers accessibility text and can use OCR only when the visible window cannot provide enough text and Screen Recording access is already available. Secure fields, password-manager targets, and secure event input stop the read. (Sources/…/DictationContextCapture.swift• L30-76, Sources/…/DictationContextCapture.swift• L171-245, Sources/…/DictationContextCapture.swift• L311-329, Sources/…/DictationContextCapture.swift• L463-513)

The result is bounded and temporary. A timeout or cancellation returns no context, and a late result is dropped. The capture checks that its target still matches the recorded process and focused element before its context can affect the dictation. Edit Mode uses a separate window read that preserves text positions for its own on-device processing. (Sources/…/DictationContextCapture.swift• L44-123, Sources/…/DictationContextCapture.swift• L248-279)

References: Sources/…/DictationContextCapture.swift• L30-123 Sources/…/DictationContextCapture.swift• L171-279 Sources/…/DictationContextCapture.swift• L311-329 Sources/…/DictationContextCapture.swift• L463-513

Microphone readiness

The start path checks microphone permission and resolves a usable input from the saved microphone priority. It waits until the selected capture route produces its first PCM audio, which makes “recording” mean that audio is available rather than only that a start request was accepted. (Sources/…/ASRService.swift• L1709-1777, Sources/…/ASRService.swift• L1860-1900, Sources/…/MicrophonePreferenceCoordinator.swift• L337-419)

The current capture policy favors direct Core Audio and can keep a prepared input warm while idle to reduce start delay. Route changes, Bluetooth startup, and microphone migrations can defer or retry readiness. The attempt keeps the identity of the selected Bluetooth input while that input appears, but it does not transfer that identity to a different device. Fresh device discovery can add a newly available fallback to the retry plan. (Sources/…/AudioStartupGate.swift• L3-51, Sources/…/ASRService.swift• L1791-1978, Tests/…/HotkeyShortcutTests.swift• L431-482, Tests/…/HotkeyShortcutTests.swift• L895-1074, Tests/…/AudioHardwareRecoveryTests.swift• L857-917)

Each readiness wait belongs to the current session and capture attempt. A first-PCM event that arrived before the wait is retained for that attempt, while a stale event, cancellation, or timeout cannot make a replacement attempt appear ready. If all startup or recovery inputs fail, the service leaves the session stopped and presents a recording error. (Sources/…/AudioStartupGate.swift• L3-51, Tests/…/DirectAudioReliabilityTests.swift• L799-907, Tests/…/AudioHardwareRecoveryTests.swift• L888-917)

The saved microphone priority is stable across temporary device loss. Selection migration waits for a usable device list, keeps a disconnected user choice for later reconnect, and uses a temporary fallback without silently changing that choice. (Tests/…/HotkeyShortcutTests.swift• L1211-1531, Tests/…/HotkeyShortcutTests.swift• L1561-1660, Tests/…/AudioHardwareRecoveryTests.swift• L857-917)

The recording overlay appears as the start connects and changes to its recording state after first PCM. If the start cannot reach readiness, the service cleans up the partial session and the application removes the overlay. (Sources/…/ContentView.swift• L3202-3249, Sources/…/MenuBarManager.swift• L141-226)

References: Sources/…/MicrophonePreferenceCoordinator.swift• L337-419 Sources/…/AudioStartupGate.swift• L3-51 Sources/…/ASRService.swift• L1709-1777 Sources/…/ASRService.swift• L1791-1978 Sources/…/ContentView.swift• L3202-3249 Tests/…/HotkeyShortcutTests.swift• L431-482 Tests/…/HotkeyShortcutTests.swift• L895-1074 Tests/…/HotkeyShortcutTests.swift• L1157-1660 Tests/…/DirectAudioReliabilityTests.swift• L799-907 Tests/…/AudioHardwareRecoveryTests.swift• L857-917

Audio recording

Once the route is ready, the capture service collects mono PCM samples for the session and publishes audio levels for the recording UI. The product can use its direct Core Audio path or its AVAudioEngine path. Both paths feed the same recognition and stop logic. (Audio capture pipeline) (Sources/…/ASRService.swift• L927-1044, Sources/…/ASRService.swift• L1154-1212)

The direct capture lifecycle serializes hardware operations and checks the input format before it starts. A changed format invalidates the old input before replacement. A failed stop or failed cleanup can quarantine the input and block unsafe replacement. Native start, stop, preparation, and device queries have bounded waits, but a timeout does not release the audio buffer or start a second native operation. Late packets from retired hardware remain rejected. (Tests/…/DirectAudioReliabilityTests.swift• L909-1298, Tests/…/AudioHardwareRecoveryTests.swift• L112-165, Tests/…/AudioHardwareRecoveryTests.swift• L270-322)

Hardware topology changes are treated as evidence that may need a fresh check, not as an immediate reason to interrupt healthy capture. The recovery path coalesces change events, waits for blocked native work to finish, and clears a failed cleanup only when the device is known to be gone. A late liveness result or an old recovery failure cannot stop a newer recording. (Tests/…/AudioHardwareRecoveryTests.swift• L345-481, Tests/…/AudioHardwareRecoveryTests.swift• L483-564, Tests/…/AudioHardwareRecoveryTests.swift• L610-644, Tests/…/AudioHardwareRecoveryTests.swift• L976-1003)

Direct capture also watches for a sustained loss of signal on the internal microphone. It performs one recovery after real audio has been seen and enough silent windows follow. It does not apply this recovery to external inputs, legacy capture, or low ambient sound. (Tests/…/HotkeyShortcutTests.swift• L1157-1208)

The service treats the end of recording as an exact boundary. It stops new capture before it drains the final samples and waits for in-flight live recognition work before clearing the buffer. This ordering keeps the last spoken words and prevents work from one session from touching another session’s audio. A stalled provider wait is bounded without cancelling the provider or releasing the buffer to a replacement session. (Sources/…/ASRService.swift• L2317-2414, Tests/…/DirectAudioReliabilityTests.swift• L197-332)

The recording session can pause system media after capture is live and resumes it only when this session paused it. A pause is kept until transcription finishes. The media path confirms the player and item before it resumes playback, retries transient reads within a bound, and does not issue a blind play command when state is unknown or has changed. A cancel path stops capture and discards the session without asking a recognition engine for final text. (Sources/…/ASRService.swift• L1987-2002, Sources/…/ASRService.swift• L2702-2755, Tests/…/MediaPlaybackServiceTests.swift• L7-180, Tests/…/MediaPlaybackServiceTests.swift• L182-241, Tests/…/MediaPlaybackServiceTests.swift• L323-470)

References: Sources/…/ASRService.swift• L927-1077 Sources/…/ASRService.swift• L1154-1212 Sources/…/ASRService.swift• L2317-2414 Sources/…/ASRService.swift• L2702-2755 Tests/…/DirectAudioReliabilityTests.swift• L197-370 Tests/…/DirectAudioReliabilityTests.swift• L909-1298 Tests/…/AudioHardwareRecoveryTests.swift• L112-165 Tests/…/AudioHardwareRecoveryTests.swift• L345-644 Tests/…/MediaPlaybackServiceTests.swift• L7-241 Tests/…/MediaPlaybackServiceTests.swift• L323-470

Speech recognition

The recognition service presents one session-level view of several speech-to-text engines. It selects the engine from the current speech model, prepares it when needed, and sends the captured 16 kHz mono samples through a common provider contract. Automatic speech recognition (ASR) is the service boundary that turns those samples into a transcript. (Speech recognition engines) (Sources/…/ASRService.swift• L345-373, Sources/…/TranscriptionProvider.swift• L125-175)

Language choices are normalized into unique locale options and shown in the user's display language. This keeps engine selection stable when locale identifiers use different spellings or appear more than once. (Tests/…/AppleSpeechLocaleSelectionTests.swift• L4-31)

Engines that support live work produce partial text while the user speaks. The UI uses that text as a preview and as a possible spoken-send signal. The preview loop waits for enough audio, avoids overlapping recognition work, coalesces rapid AI preview updates, and rejects results from an old provider or session. A stopped operation still drains its provider work, but it cannot publish preview or failure state and it cannot restart the preview cadence. (Sources/…/ASRService.swift• L4647-4771, Sources/…/ASRService.swift• L4784-4847, Tests/…/DirectAudioReliabilityTests.swift• L45-92, Tests/…/DirectAudioReliabilityTests.swift• L197-370, Tests/…/DirectAudioReliabilityTests.swift• L420-540)

On stop, the service waits for the live work, runs a final recognition pass, removes filler words, applies the basic user dictionary and spoken punctuation rules, and returns the cleaned transcript to the application flow. The final pass remains the source of truth for delivery because a live preview can be incomplete or can change as more speech arrives. (Sources/…/ASRService.swift• L2317-2586)

Short recordings have a conservative silence gate when the user enables silent-recording skipping and no live preview exists. Silent short audio returns an empty result before recognition. Audible audio shorter than one second receives enough trailing silence for engines that need a minimum input length. Dictionary-training recordings bypass this gate. (Sources/…/ASRService.swift• L96-178, Sources/…/ASRService.swift• L2442-2494, Tests/…/HotkeyShortcutTests.swift• L195-246)

The end-to-end integration path also checks that a prepared Whisper model can turn a 16 kHz mono fixture into non-empty text with the expected words. This verifies the provider boundary from model preparation through final transcription without depending on a live microphone. (Tests/…/DictationE2ETests.swift• L1331-1354)

References: Sources/…/ASRService.swift• L345-373 Sources/…/ASRService.swift• L96-178 Sources/…/ASRService.swift• L2317-2586 Sources/…/ASRService.swift• L2442-2494 Sources/…/ASRService.swift• L4647-4847 Sources/…/TranscriptionProvider.swift• L125-175 Tests/…/AppleSpeechLocaleSelectionTests.swift• L4-31 Tests/…/DirectAudioReliabilityTests.swift• L45-92 Tests/…/DirectAudioReliabilityTests.swift• L197-370 Tests/…/DirectAudioReliabilityTests.swift• L420-540 Tests/…/HotkeyShortcutTests.swift• L195-246 Tests/…/DictationE2ETests.swift• L1331-1354

Transcript processing

After final recognition, the application chooses whether the transcript is literal dictation, a prompt, a command, or a rewrite instruction. Normal dictation first applies spoken punctuation and spoken-send parsing. If configured, it then sends the text through an AI post-processing route. The route is resolved from the dictation slot, an app-specific binding, or the selected provider according to the active routing scope. A private-AI route is allowed only for an explicit private-AI selection or a default selection that still uses the private provider. The route must have a verified provider and model before work starts. (Dictation processing and typing) (Sources/…/ContentView.swift• L2186-2268, Sources/…/DictationAIPostProcessingGate.swift• L4-66, Sources/…/DictationPostProcessingService.swift• L16-195)

Post-processing reserves the shared model activity slot for the request. If another model activity already owns that slot, processing fails without sending the transcript to a provider. An empty transcript returns empty output without provider work. (Sources/…/DictationPostProcessingService.swift• L197-227)

Private AI refinement checks the input against the model context limit before it calls the provider. If the transcript is too large or too dense for the model, the flow keeps the complete raw transcript instead of sending a request that could truncate it. Validated output budgets are passed through to both normal and streaming enhancement, while separate requests can run independently and cancellation releases the provider call. (Tests/…/PrivateAIDictationTokenBudgetTests.swift• L97-218)

Streaming AI refinement can fall back to a non-streaming request when the provider reports a protocol problem. It does not retry transport failures, cancellation, or an invalid request. Provider request bodies state the streaming choice explicitly so compatible local services do not assume the wrong mode. (Tests/…/LLMClientRequestBodyTests.swift• L11-80)

The final text pass applies literal command and mention forms, the user's capitalization and sentence-ending preferences, and continuous-dictation context. This order lets AI cleanup happen before user formatting and lets the captured field context affect the text that follows an earlier draft. (Sources/…/ContentView.swift• L2333-2371, Sources/…/ASRService+DictationLiteralFormatting.swift• L23-67, Sources/…/ASRService+SpokenPunctuationFormatting.swift• L3-21)

The same transcript can take a different route for command mode, rewrite mode, prompt testing, or onboarding. Those routes use the recognition result for their own action or preview instead of inserting normal dictation text into the external application. Prompt test mode uses the draft prompt, provider, and model from its coordinator and reports raw transcription, processed output, or an error in the prompt editor. (Sources/…/ContentView.swift• L2436-2565, Sources/…/DictationPromptTestCoordinator.swift• L4-52, Sources/…/AISettingsView+AdvancedSettings.swift• L1810-1879)

References: Sources/…/ContentView.swift• L2164-2227 Sources/…/ContentView.swift• L2229-2371 Sources/…/ContentView.swift• L2436-2565 Sources/…/DictationAIPostProcessingGate.swift• L4-116 Sources/…/DictationPostProcessingService.swift• L16-312 Sources/…/DictationPromptTestCoordinator.swift• L4-52 Sources/…/ASRService+DictationLiteralFormatting.swift• L23-67 Sources/…/ASRService+SpokenPunctuationFormatting.swift• L3-21 Tests/…/PrivateAIDictationTokenBudgetTests.swift• L97-218 Tests/…/LLMClientRequestBodyTests.swift• L11-80

Output delivery

Normal dictation delivers the final text to the application that held focus at recording start. The delivery layer checks the current target against the saved process and focus information before it inserts text. It can use direct accessibility or keyboard input and can fall back to a clipboard-based path when the target needs it. (Dictation processing and typing) (Sources/…/ContentView.swift• L2391-2473, Sources/…/TypingService.swift• L403-475, Sources/…/ASRService.swift• L4840-4917)

Clipboard delivery treats the clipboard as a temporary handoff. It serializes overlapping deliveries, posts the paste command, and restores the previous clipboard only while the pipeline still owns the temporary value. An external copy wins over restoration, while the copy-transcript setting intentionally leaves the delivered text on the clipboard. (Tests/…/PasteDeliveryCoordinatorTests.swift• L152-260, Tests/…/PasteDeliveryCoordinatorTests.swift• L262-403, Tests/…/PasteDeliveryCoordinatorTests.swift• L405-475)

The pipeline dispatches normal text before it hides the overlay. The delivery callback reports the insertion outcome before dictionary correction tracking starts. Overlay state is tied to the current lifecycle, so a late result or a rapid restart cannot hide or update a newer recording. (Tests/…/DirectAudioReliabilityTests.swift• L642-797)

Delivery failures keep the exact transcript for recovery. Accessibility, target, clipboard, and paste failures surface a recovery state, while empty text stays silent. A failed or cancelled delivery releases its slot so a later result can proceed. (Tests/…/PasteDeliveryCoordinatorTests.swift• L7-69, Tests/…/PasteDeliveryCoordinatorTests.swift• L301-367, Tests/…/PasteDeliveryCoordinatorTests.swift• L508-572)

The pipeline can also save the raw and processed forms in transcription history and copy the processed text to the clipboard. These side effects depend on the user's settings. When Fluid itself is frontmost, the flow avoids inserting the result back into Fluid's own editor. (Sources/…/ContentView.swift• L2374-2425, Tests/…/DictationE2ETests.swift• L67-148)

Spoken send is a guarded extension of delivery. The parser removes a terminal send phrase from the text and requests a follow-up key action only when the phrase is valid, the original target still matches, the text was processed successfully, and the target is safe. Immediate send can stop after the phrase and a quiet interval. If any check fails, the text may still be inserted but the send action is skipped. (Dictation processing and typing) (Sources/…/SpokenSendParser.swift• L8-131, Sources/…/ContentView.swift• L2436-2488, Sources/…/TypingService.swift• L24-74, Tests/…/SpokenSendTests.swift• L7-185, Tests/…/SpokenSendTests.swift• L278-367)

References: Sources/…/ContentView.swift• L2374-2488 Sources/…/TypingService.swift• L24-74 Sources/…/TypingService.swift• L403-475 Sources/…/SpokenSendParser.swift• L8-131 Sources/…/ASRService.swift• L4840-4917 Tests/…/DirectAudioReliabilityTests.swift• L642-797 Tests/…/PasteDeliveryCoordinatorTests.swift• L7-69 Tests/…/PasteDeliveryCoordinatorTests.swift• L152-475 Tests/…/PasteDeliveryCoordinatorTests.swift• L508-572 Tests/…/DictationE2ETests.swift• L67-148 Tests/…/SpokenSendTests.swift• L7-185 Tests/…/SpokenSendTests.swift• L278-367

User feedback

The recording overlay and menu bar show the state of the same session. They move from connecting to recording, then to transcribing or refining when the microphone stops. The overlay remains available while AI work or a spoken-send action is pending and leaves after output completes. (Sources/…/ContentView.swift• L2118-2133, Sources/…/ContentView.swift• L2266-2327, Sources/…/MenuBarManager.swift• L351-425)

An empty or silent session produces no external text. A failed start or final recognition pass also leaves the destination unchanged. These outcomes keep a short accidental press or a lost audio route from inserting misleading content. (Sources/…/ASRService.swift• L2416-2475, Sources/…/ASRService.swift• L2587-2617)

References: Sources/…/ContentView.swift• L2118-2133 Sources/…/ContentView.swift• L2266-2327 Sources/…/MenuBarManager.swift• L351-425 Sources/…/ASRService.swift• L2416-2475 Sources/…/ASRService.swift• L2587-2617 Tests/…/HotkeyShortcutTests.swift• L124-180

Pipeline observability

The pipeline records aggregate usage and timing data so beta releases can show where dictation time is spent. Daily summaries keep counts and timing buckets instead of raw transcript or window content, while detailed analytics can be purged without removing the daily activity record. (Tests/…/AnalyticsDatabaseTests.swift• L18-104, Tests/…/AnalyticsDatabaseTests.swift• L145-174, Tests/…/AnalyticsDatabaseTests.swift• L443-472)

Performance records preserve the application and operating-system versions measured at dictation time. This keeps later summaries tied to the release and system that produced the latency. (Tests/…/AnalyticsDatabaseTests.swift• L106-143)

References: Tests/…/AnalyticsDatabaseTests.swift• L18-104 Tests/…/AnalyticsDatabaseTests.swift• L106-174 Tests/…/AnalyticsDatabaseTests.swift• L443-472

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep frontmost-application observation, Electron accessibility preparation, and focus capture ordered so a target is ready before the dictation snapshot is taken.
  • Keep accessibility preparation keyed by process identity and bundle. Permission denial and failed writes must remain retryable, while successful results must stay bounded and coalesced.
  • Keep the global shortcut callbacks and the recording-mode state in agreement. A new invocation route must still select the correct stop route and must not re-arm an interrupted modifier-only press.
  • Keep modifier-only shortcut state armed only by the first configured modifier press. Sibling modifiers and unrelated input must preserve interruption state until the press finishes.
  • Keep command-mode recording ownership separate from the shared ASR session. Deactivation must not stop a recording that command mode did not start.
  • Keep focus and application context capture before any overlay or settings action that can change macOS focus.
  • Keep screen context reads tied to the captured process, window, and element. A late or mismatched result must not influence a new target.
  • Keep secure-field and password-manager checks ahead of accessibility and OCR reads. Screen Recording fallback must never request permission as part of dictation context capture.
  • Keep context timeouts and cancellation one-shot. A late read must not revive a finished dictation or retain window text.
  • Keep first-PCM readiness tied to the active audio backend and the current capture attempt. A start must not report recording before the selected route supplies usable samples.
  • Keep direct-capture format checks, serialized hardware ownership, bounded native work, and failed-stop quarantine aligned. A replacement input must not start while an old input still owns the device.
  • Keep topology recovery conservative. A healthy capture must not be stopped by an unrelated device change, and failed cleanup must remain blocked until removal is known.
  • Keep fallback microphone discovery and Bluetooth attempt identity aligned with the saved priority. A new device may be tried without silently changing the user's intended route.
  • Keep silent-PCM recovery limited to the internal direct-capture case after a real signal. Do not turn external inputs, legacy capture, or low ambient sound into recovery events.
  • Keep the provider's live and final sample contracts aligned. A change to model selection or sample format can affect both preview and final output.
  • Keep session, operation, and provider generations aligned. Late streaming results may drain and clean up, but must not change a newer session.
  • Keep short-audio silence checks aligned with preview and dictionary-training paths. A new stop route must not suppress valid speech or send silent audio to recognition by accident.
  • Keep media pause ownership tied to confirmed player state and to the session that caused the pause. Resume only after verification and never issue a blind play after unknown or changed media state.
  • Keep prompt selection, app binding, routing scope, private-AI allowance, provider verification, AI cleanup, literal formatting, user formatting, and continuous-dictation context aligned unless the output contract also changes.
  • Keep shared model activity ownership around post-processing. A competing model task must not receive dictation work or leave the activity marked busy.
  • Keep AI context validation and output budgets shared by streaming and non-streaming private processing. Oversized input must fall back before provider generation.
  • Keep provider request bodies explicit about streaming and limit fallback to protocol incompatibility. Do not turn cancellation or transport errors into duplicate requests.
  • Keep prompt test mode tied to its draft provider and model. It must not silently use the global provider or deliver test output to the active external application.
  • Keep temporary clipboard ownership, paste settlement, restoration, and external-copy detection aligned. A delivery must not overwrite a user's newer clipboard value.
  • Keep recovery failures tied to the exact failed transcript and presentation identity. An older dismissal must not clear a newer delivery error.
  • Keep history, clipboard, external typing, and onboarding side effects separate when adding a new output route.
  • Keep normal insertion before overlay dismissal and start dictionary tracking only after the delivery callback reports its outcome.
  • Keep spoken-send parsing and post-insertion safety checks coupled. A phrase must not trigger an action for a different process or an unsafe field.
  • Keep aggregate analytics free of detailed transcript and window content when changing performance or usage events.

Important failure modes

TriggerConsequenceGuard
Microphone permission is missing or no usable input matches the saved priorityRecording does not start and no text is deliveredCheck authorization and resolve a live input before capture
Bluetooth or another selected route is still settlingThe start waits, retries within its policy, or fails without using an unrelated deviceKeep the capture-attempt identity and apply route-specific retry rules
Accessibility permission is missing or an Electron target is not readyFocus capture or later text insertion can fail without changing the target appPrepare only supported frontmost processes, do not cache denial, and retry on a later activation
A target process is relaunched or its process ID is reusedA stale accessibility write could affect the wrong applicationMatch process ID, launch date, and bundle before enabling support
Screen context points to a secure field, password manager, or secure event inputContext capture returns no text and processing continues without window contextStop before reading Accessibility data or taking an OCR image
Accessibility cannot read enough of the captured window and Screen Recording access is unavailableNo OCR context is addedUse OCR only when access is already granted and keep context optional
Context capture times out, is cancelled, or completes after the session changesThe result is ignored and the active target remains unchangedTie the read to the captured target and drop late results
The selected route does not produce first PCM or changes during startupThe start is retried or fails without a recording sessionTie readiness to the current attempt and verify route stability before marking the session live
A native hardware operation times out or task cancellation arrives while it is blockedThe caller wakes, but the old native work remains owned and replacement is delayedBound the wait without touching the blocked call, then retire and invalidate hardware in order
Failed cleanup is followed by an unknown or unrelated topology eventThe input remains unavailable rather than risking two capture ownersClear recovery only after a known device removal and coalesce topology checks
A direct input format changes or its stop failsThe old input is invalidated or quarantined and replacement is blockedSerialize hardware operations and require a valid lifecycle before replacement
Sustained silent PCM is seen on an internal direct-capture inputThe input is recovered once after a real signal, while external or low-level ambient input is left aloneRequire the internal and direct-capture conditions plus the full silent-window threshold
A modifier-only press is interrupted by another key or sibling modifierThe release is ignored as a clean tap, and the shortcut does not start or toggle dictation by accidentArm only on the first configured modifier press and retain interruption state until release
A short recording is silent and silent-recording skipping is enabledRecognition is skipped and no external text is deliveredRequire no live preview and pass the conservative silence assessment before skipping
A session ends while media state is unknown, the player changes, or the pause command is not confirmedPlayback is not resumed automaticallyResume only for the confirmed player and item, with bounded verification and retries
The speech model is unavailable or final recognition failsThe stop path returns no transcriptPrepare the selected provider and keep empty or error results out of delivery
A late streaming result belongs to a stopped sessionPreview or failure state is not changed, but active provider work still drainsCheck the current session, operation, and provider generation before publishing
The AI post-processing provider failsRaw recognized text is delivered and the user can retry refinementFall back to the normalized transcript and expose an actionable AI failure state
Another model activity owns the shared processing slotAI refinement is rejected and no provider request is sentReserve the activity before processing and release it on every exit
Private AI input exceeds its context budgetThe provider is not called and the complete raw transcript is deliveredValidate input headroom before generation
A streaming provider rejects the protocolThe request can retry without streamingRetry only protocol failures and send an explicit streaming flag
A dictation prompt points to an unverified provider, model, or API routeAI refinement is blocked before a request is sentResolve the effective slot or app route and require its current verification state
Prompt test mode has an invalid draft provider or modelThe editor shows the raw transcript and an error instead of processed outputValidate the draft route separately from global provider settings
The focused application or accessibility element changes before deliveryText insertion is rejected or cannot reach the intended fieldCompare the delivery target with the captured focus and require Accessibility permission
Clipboard snapshot or temporary write failsText is not pasted and the original clipboard is preserved when possibleSnapshot before the handoff, stop before posting paste, and release the delivery slot
The user changes the clipboard during or after pasteThe user's newer clipboard value must not be overwrittenRestore only when the temporary value still belongs to the delivery session
Spoken send is detected but target or processing checks failText can be inserted without sendingRequire the original process, safe field, released modifiers, and successful processing
Command mode deactivates while another feature owns recordingThe other dictation session is stopped unexpectedlyTrack whether command mode started the recording before stopping it

Key files

FileWhy to read it
Sources/…/ContentView.swiftFollow the product-level route from invocation through stop, processing, side effects, and delivery.
Sources/…/GlobalHotkeyManager.swiftUnderstand how macOS shortcut presses become dictation start and stop events, including interrupted modifier-only presses.
Sources/…/CommandModeView.swiftUnderstand how command mode keeps ownership of a recording it started.
Sources/…/DictationAccessibilityPreparation.swiftUnderstand how supported Electron targets are prepared without changing focus or sending input.
Sources/…/DictationContextCapture.swiftUnderstand how optional target context is captured, bounded, privacy-checked, and kept separate from delivery.
Sources/…/ASRService.swiftSee the shared session boundary between capture, live preview, final recognition, silence handling, and cancellation.
Sources/…/TranscriptionProvider.swiftSee the common contract that lets the product choose different speech engines without changing the dictation flow.
Sources/…/MicrophonePreferenceCoordinator.swiftUnderstand how the selected microphone is resolved and confirmed before recording.
Sources/…/AudioStartupGate.swiftUnderstand why audio setup waits for the initial macOS UI state to settle.
Sources/…/DictationPostProcessingService.swiftSee how dictation routing selects a prompt or private-AI path, reserves processing activity, validates the route, and returns refined text.
Sources/…/DictationAIPostProcessingGate.swiftSee how prompt selection and verified provider state allow or block AI refinement.
Sources/…/DictationPromptTestCoordinator.swiftSee how prompt test mode keeps draft prompt and provider state separate from normal delivery.
Sources/…/SpokenSendParser.swiftSee how a spoken send phrase becomes text plus a guarded action request.
Sources/…/TypingService.swiftSee the safety boundary between final text and the active macOS application.
Sources/…/PasteDeliveryCoordinator.swiftSee how clipboard-based delivery serializes paste, preserves external copies, and reports recovery outcomes.
Tests/DictationAccessibilityPreparationTests.swiftSee the retry, process-identity, permission, cache, cancellation, and coalescing guarantees for accessibility preparation.
Tests/…/AudioHardwareRecoveryTests.swiftSee how blocked, failed, or changing Core Audio hardware is retired before recovery and how stale recovery events are isolated from new recordings.
Tests/…/DirectAudioReliabilityTests.swiftSee the lifecycle guarantees for readiness, streaming work, direct capture ownership, and output ordering.
Tests/…/HotkeyShortcutTests.swiftSee shortcut, microphone policy, Bluetooth startup, silence handling, and capture-mode compatibility checks.
Tests/…/MediaPlaybackServiceTests.swiftSee how dictation owns a confirmed media pause and restores it without affecting a different player or session.
Tests/…/PasteDeliveryCoordinatorTests.swiftSee clipboard handoff, queueing, restoration, external-copy protection, and user-facing failure guarantees.
Tests/…/DictationE2ETests.swiftSee provider-level end-to-end and text-rule checks for model preparation, fixture transcription, and output normalization.
Tests/…/LLMClientRequestBodyTests.swiftSee the provider request and streaming fallback contracts used by AI refinement.
Tests/…/PrivateAIDictationTokenBudgetTests.swiftSee the private refinement budget and raw-text fallback contract.
Tests/…/SpokenSendTests.swiftSee the terminal phrase, immediate-stop, and safe post-insertion action rules.
Tests/…/SettingsNavigationStateTests.swiftSee the command-mode ownership and navigation state guarantees that protect active recording.
docs/audio-capture-pipeline.mdRead the audio child page for microphone and capture behavior.
docs/speech-recognition-engines.mdRead the speech-engine child page for provider and model behavior.
docs/dictation-processing-and-typing.mdRead the text-processing child page for formatting and delivery behavior.
docs/dictation-screen-context.mdRead the child page for screen context capture and its role in dictation processing.