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 / ai-assistance

AI assistance

Fluid uses language-model assistance to refine dictation and to turn user instructions into written text or macOS actions. The same high-level flow combines prompt settings, a selected provider and model, and a request path that can use a remote service or a private local runtime.

Assistance lifecycle

AI assistance starts after Fluid has a user input: a speech transcript, a selected text block with an instruction, or a command. Settings resolve the mode, prompt, provider, model, and app context before the request is sent. The result then returns to the mode that started the work.

The main request path is coordinated by Sources/…/LLMClient.swift. It accepts a conversation and model configuration, supports normal or streamed results, removes model reasoning markup from visible text, and exposes tool calls for agent actions. Private local work uses PrivateAIIntegrationService as the bridge to the local provider while keeping the same mode-level result flow.

This diagram shows how input becomes either refined text, transformed text, or an action result.

flowchart TD
    A[User input] --> B{Assistance mode}
    B -->|Dictation| C[Resolve prompt and route]
    B -->|Edit or write| D[Resolve instruction and context]
    B -->|Command| E[Resolve chat route and tools]
    C --> F[Language model]
    D --> F
    E --> F
    F -->|Text| G[Return text to Fluid]
    F -->|Terminal tool call| H[Run action]
    H --> I[Send result back to model]
    I --> F
    G --> J[Type, replace, or display]

Dictation enhancement

Dictation enhancement is an optional post-processing step between speech recognition and text delivery. The active speech-recognition model first produces the transcript, then Fluid checks the prompt selection, any application binding, and the resolved provider route before it sends the transcript for enhancement. The AI settings page keeps speech-recognition model setup beside language-model enhancement settings, but the two model roles remain separate.

The prompt can be the built-in dictation prompt, a saved profile, or a profile chosen for the active application. A custom prompt can include ${transcript}; if it does not, Fluid places the transcript after the prompt. Before private local generation starts, Fluid requires an installed model with matching verification and checks that the transcript leaves enough room in the model context for the enhancement request. The private integration service applies this budget check before both streamed and non-streamed generation. If it does not, Fluid keeps the complete recognized transcript instead of allowing the model path to truncate it. The model output then goes through the normal text formatting and typing path described in dictation processing and typing.

If the AI request fails, Fluid keeps the recognized transcript as the output instead of typing an error in its place. It also reports the failure so the user can correct the provider or model settings.

References: Sources/…/DictationAIPostProcessingGate.swift• L13-33 Sources/…/PrivateAIIntegrationService.swift• L244-297 Sources/…/PrivateAIProviderPromptFormat.swift• L12-36 Sources/…/ContentView.swift• L2094-2313 Sources/…/AISettingsView.swift• L101-149 Sources/…/AISettingsView+SpeechRecognition.swift• L13-135

Text transformation

Edit Mode handles two related user-directed tasks. With selected text, the model applies the spoken or typed instruction to that text. Without selected text, the same mode writes new content from the request. Fluid keeps the instruction and prior results as conversation context for follow-up requests.

The user sees the result before Fluid changes the other application. Accepting the result restores focus and replaces or inserts the text through the normal typing boundary. Prompt routing can use a global edit prompt or an application-specific profile. When the private local provider is selected, Edit Mode uses its dedicated on-device model rather than the dictation model. That model must be downloaded before RewriteModeService sends the request through the private runtime bridge. Other verified routes use the shared model request path.

The AI settings page gives the Edit Mode model its own download and removal controls. The model stays on the Mac after download, so a shortcut press does not start a model download. Screen reading is a separate opt-in context source; it uses app text first and screen capture as a fallback when the user grants access.

See command and rewrite modes for the detailed Edit Mode and Rewrite Mode behavior.

References: Sources/…/RewriteModeService.swift• L84-153 Sources/…/RewriteModeService.swift• L173-300 Sources/…/PrivateAIIntegrationService.swift• L127-138 Sources/…/PrivateAIIntegrationService.swift• L467-480 Sources/…/PrivateAIProvider.swift• L269-293 Sources/…/EditModeModelSection.swift• L4-76 Sources/…/RewriteModeView.swift• L91-145

Command execution

Command Mode turns a natural-language request into a short agent loop. The model can answer with text or request a terminal action. Fluid runs the requested action, gives the result back to the model, and repeats until the model gives a final response or the step limit is reached.

The mode separates checking, execution, and result verification so the user can see progress. Destructive commands can stop for confirmation before they run. Command Mode requires a verified chat provider and a chat-capable model; the built-in private dictation provider is not a command provider.

See command and rewrite modes for command prompts, terminal boundaries, and user-facing mode behavior.

References: Sources/…/CommandModeService.swift• L305-375 Sources/…/CommandModeService.swift• L377-517 Sources/…/CommandModeService.swift• L604-632 Sources/…/SettingsStore+CommandMode.swift• L21-79

Provider and model routing

Provider routing connects each assistance mode to a model endpoint. Fluid supplies built-in providers for common remote services and local servers, and it also supports saved custom providers. Each route carries the provider identity, endpoint, model, and any needed API key.

Provider selection

The AI settings page brings together speech-recognition model setup and language-model enhancement settings. For enhancement, the user selects a provider, chooses or adds a model, and verifies the connection. Dictation profiles can carry their own provider and model, while Edit Mode and Command Mode can either follow the global provider or use their own route.

Provider selection is sticky. Fluid does not replace the user's selected provider just because another provider becomes verified; new prompt setup can use the selected provider when it is verified, or another verified provider when no such selection is available. Verification identifies the provider, endpoint, API key state, and model, so a changed route or model must be verified again before it is treated as ready. Private AI uses the same gate idea for the selected model: the model must be installed and its current provider and backend choice must still match stored verification.

The provider and model rules are described in AI provider and model management.

References: Sources/…/AIEnhancementSettingsViewModel.swift• L156-241 Sources/…/AIEnhancementSettingsViewModel.swift• L371-453 Sources/…/AIEnhancementSettingsViewModel.swift• L805-1081 Sources/…/AIEnhancementSettingsViewModel.swift• L1505-1541 Sources/…/AISettingsView.swift• L101-149 Sources/…/AISettingsView+SpeechRecognition.swift• L13-135 Sources/…/DictationAIPostProcessingGate.swift• L35-65 Sources/…/PrivateAIProviderPromptFormat.swift• L19-47

Local and remote execution

Remote providers send requests to a provider API and need an API key. Local endpoints such as Ollama, LM Studio, or another private-network service can run without a key when the route is recognized as local.

Fluid also has an optional private local provider. Its task model roles separate dictation from Edit Mode, and the edit model choice does not change when the dictation model changes. A private model must be available, installed, and verified on the Mac before its task can use the local runtime. The private route manages model preparation, update, loading, and unloading so the active runtime follows the task model. When a model becomes ready, inactive installed model files can be removed.

The private provider can recommend a model from a hardware snapshot. The recommendation uses memory and known chip performance as a heuristic; it does not change settings or load a model. It favors the smaller model when memory or hardware data is limited and favors the larger model on supported performance chips. Before dictation enhancement reaches the runtime, it checks the input against the model context limit. This route is separate from the chat-provider path used by Command Mode, so a local dictation model is not automatically suitable for command or tool flows.

Speech recognition has its own model selection and preparation path. The settings page lets the user preview the catalog, compare model traits, download or update a model, activate one model, and remove an installed model. It also exposes language or locale choices for models that support them. Fluid blocks conflicting model actions while recognition or model preparation is active, and it refreshes the available model state when the catalog changes. This setup produces the transcript that later enters the language-model assistance flow.

References: Sources/…/PrivateAIHardwareRecommendation.swift• L5-65 Sources/…/PrivateAIIntegrationService.swift• L123-199 Sources/…/PrivateAIIntegrationService.swift• L233-289 Sources/…/PrivateAIIntegrationService.swift• L357-411 Sources/…/PrivateAIProvider.swift• L144-183 Sources/…/PrivateAIProvider.swift• L233-293 Sources/…/PrivateAIProviderPromptFormat.swift• L19-36 Sources/…/EditModeModelSection.swift• L4-76 Sources/…/VoiceEngineSettingsView.swift• L27-32 Sources/…/VoiceEngineSettingsViewModel.swift• L14-24 Sources/…/VoiceEngineSettingsViewModel.swift• L68-148 Sources/…/VoiceEngineSettingsViewModel.swift• L172-224 Sources/…/VoiceEngineSettingsViewModel.swift• L256-285 Sources/…/AISettingsView+SpeechRecognition.swift• L13-135 Sources/…/AISettingsView+SpeechRecognition.swift• L260-532 Sources/…/AISettingsView+SpeechRecognition.swift• L534-797

Request and response contract

The shared request layer turns the resolved route into a model request. It supports provider endpoints that use chat messages and the OpenAI Responses form, and it can stream visible content when a mode needs live feedback. It also normalizes model reasoning fields so internal thinking does not become user text.

Normal text assistance returns model content. Command assistance can return a function call, which Fluid treats as a request to use an allowed tool. The mode service then supplies the tool result in the next model turn.

References: Sources/…/LLMClient.swift• L118-226 Sources/…/LLMClient.swift• L228-425 Sources/…/LLMClient.swift• L468-496 Sources/…/LLMClient.swift• L797-884

Prompt and context routing

Prompt routing controls what the model is asked to do and which context it can use. Fluid keeps a built-in baseline for dictation and edit work, then resolves a custom profile or app binding when the selected scope allows it.

Prompt profiles

A prompt profile is a named instruction set for one assistance mode. Dictation supports Off, Default, a custom profile, and the optional private local provider selection. Edit, write, and rewrite use the shared edit prompt family.

When routing is limited to selected applications, an app binding chooses the profile for the active bundle. An invalid or missing binding falls back to the built-in behavior rather than sending an empty route.

References: Sources/…/SettingsStore.swift• L453-537 Sources/…/SettingsStore.swift• L681-755 Sources/…/SettingsStore+PromptRouting.swift• L4-57

Application context

Dictation requests can use the active application as routing context. Edit requests can also include the selected text and, when enabled, the active app's text or screen context. This lets the model apply an instruction without confusing the instruction with the text to change.

Fluid keeps this context separate from the final text boundary. The model produces text for Fluid to format, show, type, or replace; it does not directly write into the other application.

References: Sources/…/ContentView.swift• L1915-1983 Sources/…/PrivateAIIntegrationService.swift• L27-44 Sources/…/RewriteModeService.swift• L205-215 Sources/…/SettingsStore.swift• L1098-1112 Sources/…/EditModeModelSection.swift• L79-138

Change checklist

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

  • Keep provider identity and storage-key rules aligned between route resolution, verification fingerprints, and per-provider model selection.
  • Keep the sticky provider-selection rule aligned with new-prompt defaults so setup does not silently change the user's active route.
  • Keep the prompt selection values aligned with prompt profile modes, app bindings, and the dictation shortcut routing logic.
  • Keep local-provider detection consistent with the API-key gate and with request authorization behavior.
  • Keep model capability checks aligned with mode requirements so dictation-only models cannot enter chat or tool flows.
  • Keep tool-call message shapes aligned between LLMClient, Command Mode history, and the terminal result returned to the model.
  • Keep the AI fallback path separate from final text formatting so a failed enhancement never becomes typed error text.
  • Keep private dictation context-budget checks ahead of provider generation so long or token-dense transcripts fall back without truncation.
  • Keep private model readiness, installed files, and verification fingerprints tied to the selected task model and backend choice.
  • Keep dictation and Edit Mode model roles separate when changing model catalogs, download state, or runtime selection.
  • Keep private model update and removal paths tied to runtime unload and the managed model directory so an active model is not removed or an unrelated file is touched.
  • Keep hardware recommendations as display guidance only; they must not silently change the selected model or load a runtime.
  • Keep customer-facing model preview IDs separate from registered model IDs, download artifacts, and runtime settings.
  • Keep local rewrite routing aligned with private model verification and runtime configuration so text transformation does not fall through to an invalid remote route.
  • Keep Edit Mode screen access separate from dictation context settings and keep its permission state aligned with the app-text and screen-capture fallback.
  • Keep speech-recognition model catalog refresh, filtering, activation, and preparation state aligned with the transcript source used by dictation enhancement.

Important failure modes

TriggerConsequenceGuard
Dictation prompt is Off or its app-only binding is missingThe transcript bypasses AI post-processingDictationAIPostProcessingGate checks the active slot and application before the request
Remote provider has no API key or its verified route changedThe AI request is blocked before or during processingProvider verification and route fingerprint checks require the current endpoint and key state
Private AI is unavailable in the current buildPrivate model actions report unavailable and local assistance cannot runThe provider feature registry selects an unavailable integration shim
Private model for the requested task is missing, not installed, or its model or backend verification is stalePrivate dictation or local text transformation cannot runPrivateAIProviderPromptFormat and the task model registry check availability, installation, and matching verification
Edit Mode model is not downloaded before useA local Edit Mode request cannot start; the shortcut does not download itEditModeModelSection exposes a one-time download and reports the installed state
Private dictation input leaves too little context for the enhancement requestFluid skips private generation and types the complete raw transcriptPrivateAIIntegrationService rejects insufficient headroom before calling the provider
Provider returns a network error, invalid response, or empty contentFluid reports the issue and dictation uses the recognized textLLMClient reports request errors and ContentView falls back to the transcript
Command model returns an unsupported model type or an unverified chat routeCommand Mode does not start the agent loopCommand readiness checks require a verified chat provider and a supported chat model
Model requests a destructive terminal command while confirmation is enabledExecution pauses until the user confirms or cancelsCommand Mode creates a pending command instead of running it immediately
A model update or removal targets a path outside the managed model folderThe file operation is refusedPrivateAIIntegrationService validates model paths before removal
Provider or model changes after verificationA late check cannot mark the new route as readyVerification results carry the current provider, endpoint, key, and model identity
Hardware identity or memory data is unknownThe recommendation uses the smaller private model even when a faster choice might be possiblePrivateAIHardwareRecommendation treats unknown hardware as a conservative recommendation
Speech recognition is running or a model action is already in progressModel activation, download, update, or removal is blockedVoiceEngineSettingsViewModel.areSpeechModelActionsBlocked prevents conflicting actions
Installed-model state cannot be checkedThe active model state is unavailable until the check succeedsThe speech model settings show a retry path and keep model actions unavailable

Key files

FileWhy to read it
Sources/…/LLMClient.swiftShared request, streaming, response, reasoning, and tool-call boundary
Sources/…/ContentView.swiftDictation routing, AI gating, fallback behavior, and return to text delivery
Sources/…/DictationPostProcessingService.swiftDictation provider route resolution and post-processing entry point
Sources/…/DictationAIPostProcessingGate.swiftReadiness rules for prompt-based and private dictation assistance
Sources/…/RewriteModeService.swiftUser-directed writing and rewriting flow, including private-provider routing
Sources/…/CommandModeService.swiftModel-driven terminal action loop and confirmation boundary
Sources/…/SettingsStore.swiftPrompt selection, profile resolution, transcript composition, and mode defaults
Sources/…/SettingsStore+CommandMode.swiftCommand provider linking, model suitability, and readiness rules
Sources/…/ModelRepository.swiftBuilt-in provider identities, endpoints, model defaults, and local endpoint rules
Sources/…/PrivateAIIntegrationService.swiftPrivate model lifecycle, safe model-file management, local dictation checks, context limits, and local text transformation entry points
Sources/…/PrivateAIProvider.swiftPrivate provider contract, model states, and task support boundary
Sources/…/PrivateAIHardwareRecommendation.swiftHardware-based guidance for the private model choice
Sources/…/PrivateAIProviderPromptFormat.swiftPrivate model selection and verification rules used by assistance modes
Sources/…/AISettingsView.swiftSettings page boundary that joins speech-recognition and language-model assistance configuration
Sources/…/EditModeModelSection.swiftEdit Mode model download, removal, and optional screen-context controls
Sources/…/PrivateAIModelPresentation.swiftCustomer-facing model descriptions and preview labels separate from runtime model identity
Sources/…/VoiceEngineSettingsView.swiftSpeech settings boundary that observes the selected model and updates its view state
Sources/…/VoiceEngineSettingsViewModel.swiftSpeech model catalog, filtering, activation, download, update, removal, language selection, and action guards
Sources/…/AISettingsView+SpeechRecognition.swiftSpeech model preview, active-state display, preparation controls, and language selection
Sources/…/AIEnhancementSettingsViewModel.swiftUser-facing provider selection, model configuration, prompt routing, verification, and keychain-backed credentials
Tests/…/PrivateAIDictationTokenBudgetTests.swiftGuarantee that oversized or token-dense private dictation falls back before provider generation