Repository navigation
Description
Problem Statement
A user dictates into very different places in one day: a WhatsApp chat with a friend, a Slack thread at work, a Gmail reply, a Linear ticket. Voice applies one global cleanup style to all of them. A message to a friend comes out with the same capitalization and final period as an email to a client, so the user either picks a compromise style or fixes the text by hand after every insertion.
Wispr Flow solves this with a Style page that has four categories (Personal messages, Work messages, Email, Other), a style per category, and automatic detection of the app or website the user is dictating into. Voice has no notion of which target receives the text beyond what insertion needs to validate focus.
Solution
Voice detects the target app (and, in a browser, the website's host) at the start of each session, classifies it into one of four categories, and cleans the final transcript with the style the user chose for that category.
- The Style page gets four tabs: Personal messages, Work messages, Email, Other.
- Each tab offers three styles: Formal (caps and full punctuation), Casual (caps, no period at the end), Very casual (no caps, no period at the end).
- Each tab shows which apps it applies to, with the real icons of installed apps, and a working "+" that assigns any installed app or any website to that category.
- In the Email category, cleanup also lays the text out as an email (greeting line, body, sign-off) when the model handles it well.
- Detection, classification and styling all run on the Mac. The detected app and host are used once to pick the style and are never saved, logged or sent anywhere.
- When cleanup is off, the language is not English, or cleanup fails, Voice behaves exactly as today: the raw transcript plus dictionary and snippet rewrites is inserted, with no style.
Defaults for new installs: Personal messages is Casual, Work messages, Email and Other are Formal. Existing users keep their current output on upgrade, because their saved global style is copied into all four categories.
User Stories
- As a user, I want Voice to recognize that I'm dictating into Messages or WhatsApp, so that my text is styled like a chat message without me switching settings.
- As a user, I want Voice to recognize that I'm dictating into Slack or Teams, so that work messages get my work style.
- As a user, I want Voice to recognize Mail, Outlook, Superhuman and other email apps, so that emails get my email style.
- As a user, I want Voice to recognize Gmail, Outlook web and other webmail in my browser, so that email in a browser tab is treated as email.
- As a user, I want Voice to recognize web versions of messengers (web.whatsapp.com, web.telegram.org, discord.com, messenger.com, app.slack.com), so that the browser is not a blind spot.
- As a user, I want any app or site Voice does not recognize to use my Other style, so that behavior is predictable everywhere.
- As a user, I want to choose Formal, Casual or Very casual separately for each of the four categories, so that each kind of writing reads the way I write it.
- As a user, I want each style card to show a short rule ("Caps + punctuation", "Caps, no period at the end", "No caps, no period at the end"), so that I know what the style does before I choose it.
- As a user, I want each style card to show an example in the context of the category (a chat line, a work message, an email), so that I can picture the output.
- As a user, I want the examples to reflect what the model really produces, so that the page does not promise output I will not get.
- As a user, I want each tab to show a banner like "This style applies in personal messengers" with the icons of the matching apps I have installed, so that I can see where the style applies.
- As a user, I want the banner icons to be my installed apps' real icons, so that they match what I see in my Dock.
- As a user, I want a "+" on each tab that lets me assign an installed app to that category, so that an app Voice does not know is styled correctly.
- As a user, I want to add a website to a category by typing a host or pasting a URL, so that a web app I use is styled correctly.
- As a user, I want a pasted URL to be reduced to its host, so that I don't have to clean it up myself.
- As a user, I want invalid website input to disable the Add button with a reason, so that I don't save something that will never match.
- As a user, I want a site assignment to cover its subdomains, so that assigning
slack.comalso coversapp.slack.com. - As a user, I want a lookalike domain not to match, so that assigning
x.comdoes not capturebox.com. - As a user, I want my own assignments to always win over Voice's built-in list, so that I can correct any classification.
- As a user, I want an app already assigned to another category to show where it is now and move when I pick it, so that one app never belongs to two categories.
- As a user, I want to remove an assignment I made, so that the app goes back to its built-in category or to Other.
- As a user, I want browsers to be absent from the app picker, so that I can't accidentally make every website in Chrome "Work" and lose Gmail's email style.
- As a user, I want my assignments and per-category styles to persist across restarts, so that I set them once.
- As a user, I want a save that fails to leave my previous choice intact, so that I never lose what I picked.
- As an existing user, I want my current style to carry over to all four categories on upgrade, so that nothing changes until I decide to change it.
- As an existing user on the Casual style, I want to land on Very casual, so that my lowercase chat output stays the same.
- As an existing user on Semi-casual or Semi-formal, I want to land on the closest new style, so that my output barely changes.
- As a user, I want the style to follow the app I was in when I pressed the shortcut, so that switching apps mid-session does not restyle text for an app that will not receive it.
- As a user, I want detection to add no delay between pressing the shortcut and recording, so that dictation still feels instant.
- As a user, I want a failed or slow detection to fall back to Other rather than block or delay the session, so that dictation never breaks because of styling.
- As a user, I want Voice to read only the website's host, never the full URL or page content, so that my browsing stays private.
- As a user, I want the detected app and host to stay out of History, Insights, logs and diagnostics, so that Voice keeps no record of where I dictate.
- As a user, I want the Style page to tell me plainly that Voice checks the app and website locally and saves nothing, so that I understand what is happening.
- As a user, I want a note that styles apply to English dictation, so that I'm not surprised when another language is inserted as recognized.
- As a user, I want the style cards on every tab to be disabled when cleanup is off or the language is unsupported, so that the page reflects what will actually happen.
- As a user, I want my transcript inserted even if cleanup or styling fails, so that I never lose what I said.
- As a user, I want my dictionary spellings (names, acronyms like "GitHub") to keep their casing under Very casual, so that lowercase styling does not break proper nouns I taught Voice.
- As a user, I want snippet expansions inserted exactly as I saved them under any style, so that styling never alters my saved text.
- As a user, I want Casual and Very casual to drop only a single final period and leave "p.m.", "U.S.", an ellipsis, a question mark or a URL ending alone, so that the text still reads correctly.
- As a user writing an email, I want the Email category to lay out a dictated greeting, body and sign-off as an email, so that I don't fix line breaks by hand.
- As a user writing a one-line email reply, I want it to stay one line, so that email layout does not invent structure.
- As a user writing a long email, I want consistent output, so that layout is not attempted separately on each part.
- As a user without Accessibility permission, I want app-level styling to keep working, so that only website detection degrades.
- As a user of a browser whose page address Voice cannot read, I want the session to fall back to the browser's app category or Other, so that nothing breaks.
- As a maintainer, I want the app and website catalog in one table with unique keys, so that classification is easy to review and extend.
- As a maintainer, I want style mapping to live inside the cleanup adapter, so that a future cleanup provider declares which styles it supports or falls back to raw.
- As a maintainer, I want to verify per-app styling end to end without manually switching apps, so that the real flow (shortcut, speak, transcript, insert) is provable in test mode.
- As a maintainer, I want a measured record of the model's output for each style and layout before card copy is written, so that the product copy is grounded.
Implementation Decisions
Product scope.
- Four categories: Personal messages, Work messages, Email, Other. Other is the fallback.
- Three styles on every tab: Formal, Casual, Very casual. Unlike Flow, Very casual is not limited to Personal, because once Excited is gone a per-tab option table buys nothing.
- Declined: Excited (no trained register; turning "." into "!" invents tone), LLM style detection from the user's own messages, stacked messages, server sync, cleanup strength levels, onboarding wizard, email signatures.
- The existing "Clean up text" switch stays global.
Style mapping, owned by the S1-mini cleanup adapter. S1-mini is trained on four Styling tags and a Context tag with general and email values. The adapter receives a provider-neutral request and maps it.
| Product style | S1 Styling | Layout (Email category only) | Deterministic finish |
|---|---|---|---|
| Formal | semi-formal | none | |
| Casual | semi-formal or semi-casual, decided by calibration | drop the final period | |
| Very casual | casual | general | none; the model already drops caps and the final period |
- Email layout is used only when the transcript fits in one cleanup chunk, and ships only if calibration shows it leaves one-line replies alone.
- The deterministic finish is a pure function that removes one trailing period, except after an internal-period word ("p.m.", "U.S.") or an ellipsis. It runs only when the final chunk was accepted by the model, so raw text is never restyled.
- The S1
formaltag (contraction expansion) is no longer offered. Users on it migrate to Formal and get contractions back.
Types. These encode the decisions more precisely than prose.
// Cleanup package: what any cleanup adapter is asked for.
type WritingStyle = "formal" | "casual" | "veryCasual";
type CleanupStyle = { style: WritingStyle; layout: "general" | "email" };
// Shared by main and renderer.
type Category = "personal" | "work" | "email" | "other";
type BundleId = string & { readonly __brand: "BundleId" }; // lowercased
type Host = string & { readonly __brand: "Host" }; // lowercased ASCII, no port, no trailing dot
type Assignment =
| { kind: "app"; bundleId: BundleId; name: string; category: Category }
| { kind: "site"; host: Host; category: Category };
type CategoryStyles = Readonly<Record<Category, WritingStyle>>;
type Target = { bundleId: BundleId | null; host: Host | null }; // one session onlySettings.
- The cleanup settings become
{ enabled, styles: CategoryStyles, assignments: Assignment[] }. - Patches merge
stylesper key and replaceassignmentswhole, like snippets. - A malformed assignment in a patch is refused, as snippets are. On load, invalid entries are dropped and invalid per-key styles fall back to that key's default.
- Migration happens in the existing field-by-field settings parser. If
stylesis absent and the legacy global styling is present, it seeds all four categories: casual to Very casual, semi-casual to Casual, semi-formal to Formal, formal to Formal. The legacy field disappears on the next save. - New-install defaults: Personal is Casual; Work, Email and Other are Formal.
Session orchestration.
- Main resolves the style once, where it already builds the transcript event for the session reducer.
- The reducer's transcript event replaces its
cleanup: booleanwithcleanup: CleanupStyle | null. The cleaning phase and the cleanup effect carry that value, and the cleanup effect passes it to the cleanup adapter instead of reading the global setting. nullmeans no cleanup, which keeps today's eligibility rules (cleanup enabled, supported language).- Style follows the target captured at session start. Insertion already refuses a changed target, so there is no re-resolve on focus change.
Target detection, in the macOS helper.
- At capture start, the helper reads the frontmost app's bundle identifier from the same running-application object it already reads for the insertion target. This is an in-memory property read and adds no Accessibility call before audio starts.
- Only when the bundle id is a known browser (Safari, Chrome, Arc, Brave, Edge, Firefox, Opera, Vivaldi), a separate low-priority task walks up from the focused element (bounded depth) to the web area, reads its URL with the existing Accessibility timeout, accepts http/https only, and reduces it to a host in the helper. Full URLs never cross the process boundary.
- The target rides on the existing transcript event as an optional
{ bundleId, host }. If the host read has not finished by then, the host is null. A malformed target decodes to null and never drops the transcript. - The helper protocol version bumps from 10 to 11.
- A new test-mode-only helper command sets the target the next capture reports, guarded like the existing test audio hook. The verify tooling's dictate command gains an app/host option that uses it.
Classification.
- A pure function
classify(target, assignments) -> Categoryuses a built-in catalog of two maps (bundle id to category, host to category) plus display names for banners. - Bundle ids match exactly and case-insensitively. A host matches an entry when it equals it or ends with "." + entry. There is no substring matching.
- Precedence: user site, user app, built-in site, built-in app, Other.
- The initial catalog is Flow's macOS and website lists reduced to one category per key, plus a few additions to verify before merge: new Teams (
com.microsoft.teams2), Zoom (us.zoom.xos),teams.cloud.microsoftandoutlook.office365.com.
Installed apps and icons.
- A new helper command lists installed apps (bundle id, name, path) from the standard application folders, off the main thread. This bumps the protocol to 12.
- Main renders icons from the app path through Electron's file-icon API and caches them in memory. If that API does not return real app icons, the helper returns rendered PNGs instead.
- No bundled brand logos and no favicon fetching. Missing apps and sites show a monogram.
UI.
- The Style page keeps its header and the cleanup switch, then adds four tabs. Each tab has a banner (installed built-in icons up to four then "+N", removable chips for user assignments, and a "+"), three style cards with rule lines and category-specific examples, and an English and privacy footer.
- The "+" opens a popover with an installed-app search (browsers excluded) and an "Add website" field.
- No changes to the tray, Settings, Home, the onboarding checklist or the Flow Bar pill. History and Insights get no app column.
Platforms. macOS only. No Windows helper exists. Bundle-id keys leave room for Windows process-name keys later.
Testing Decisions
A good test drives a public seam with synthetic input and asserts what the user would observe: the style the cleanup adapter receives, the text inserted, or the settings saved. It does not assert internal call order or private state. Fixtures are synthetic, per the repository's test-data rules.
Seams, highest first:
-
Dictation orchestration with the fake helper. This is the main seam. Emit a transcript carrying a target and assert the cleanup adapter receives the resolved style:
- Mail gives Formal with email layout.
- Messages gives Personal's style.
- A null or malformed target gives Other's style.
- A user assignment overrides the built-in list.
- Cleanup failure or timeout still inserts the rewritten raw transcript.
- The English gate means no cleanup call.
- A snippet-only dictation bypasses cleanup.
- No bundle id or host appears in the session report or log output.
Prior art: the existing dictation tests using the fake helper.
-
Session reducer. Event sequences show the
CleanupStyle | nullvalue travels from the transcript event to the cleanup effect, and raw fallback is unchanged. Prior art: existing session reducer sequence tests. -
Settings parse and patch. Cover the legacy-value migration table, invalid per-key styles, invalid assignments dropped on load, a malformed assignment refused on patch, per-key style merge, disk round trip, and the legacy field gone after save. Prior art: the existing settings tests (invalid-value tables, old-file defaults, retired fields).
-
Classification and host parsing, as pure table tests. Cover precedence, dot-boundary suffix, case, lookalikes (
box.comvsx.com), null target, catalog keys unique and hosts valid, and URL-to-host normalization. -
Cleanup adapter. Assert the exact control line per
CleanupStyle. Table-test the final-period finish:p.m., a URL, an ellipsis and?all unchanged. Assert no finish when the last chunk was rejected, and that a multi-chunk email uses general layout. Prior art: the existing prompt tests and S1-mini lifecycle tests. -
Helper protocol and native pure functions. On the TypeScript side, a target decodes to null when malformed and the transcript still parses. On the Swift side,
https://Mail.Google.com:443/u/0becomesmail.google.com,about:andfile:become nil, and the bounded parent walk stops. Prior art: the existing protocol tests and helper core tests. -
Calibration, as an opt-in real-model sweep of four Styling tags times two layouts over the fixtures, recorded in the PR and not committed. Prior art: the existing calibration script and real-model integration tests.
Real-app verification uses the project verify skill in test mode with the new target option, plus a manual pass. Dictate the same synthetic clip into an unsent Messages field, a Mail compose body, and Safari and Chrome tabs on gmail.com and duckduckgo.com, and compare the inserted text. Shortcut-to-capture-start latency (p50 over 20 sessions) must not move beyond noise.
Suggested delivery order, one concern per PR:
- Calibration.
- Three product styles in the cleanup adapter, still global.
- The helper reports the target (protocol 11), with the test hook and smoke script.
- Classification and per-category styles with tabs.
- Banners with installed-app icons (protocol 12).
- The working "+" picker.
Out of Scope
- Excited style.
- Detecting style from the user's previous messages.
- Splitting one dictation into several messages.
- Syncing style settings across devices.
- Cleanup strength levels (None/Light/Medium).
- An onboarding wizard for styles.
- Named custom voices beyond the four categories (Flow's "My Voice"). The assignment shape grows into this without migration.
- Email signatures and Slack mention tagging.
- Re-resolving the style when focus changes during a session.
- Windows target detection.
- A toggle for website detection. It is host-only, local and in memory.
- Showing the detected category in the Flow Bar pill, History or Insights.
Further Notes
-
Reference. Static inspection of Wispr Flow 1.6.1167 showed:
- A native helper reads the frontmost app and, for browsers, the web area URL through Accessibility.
- Classification uses hard-coded client lists (Email, then Work, then Personal, then Other).
- The style and app context are sent to Flow's server, which formats the text.
- The "+" on Flow's Style tab is decorative.
Voice does all of this locally instead.
-
Chromium. Chromium may not expose the web area URL until an assistive client has touched its tree. The PR that adds detection includes a smoke script that measures this per browser. If it fails often, set
AXManualAccessibilityonce per helper run, as screen readers do. Firefox URL exposure is unverified; the fallback is app-level classification. -
Calibration may adjust copy. Very casual under S1
casualmay strip apostrophes ("im", "cant"), which Flow does not. Calibration shows the real output and the card copy follows it. -
Bundle ids. Unverified ids silently fall to Other if wrong. Check them against real installs before merge.
-
Mail checks. Real-app checks in Mail need a configured account. Without one, verify email styling through a site assignment.
Activity
fix(cleanup): keep URLs and identifiers in Very casual, drop the peri…
feat(desktop): decode the helper's target on transcripts (protocol 11)
feat(verify): fake the target app with dictate --app
docs(verify): document dictate --app and the target app recipe
feat(desktop): decode the helper's target on transcripts (protocol 11)
feat(verify): fake the target app with dictate --app
docs(verify): document dictate --app and the target app recipe
test(cleanup): calibrate S1-mini stylings across general and email la…
feat(cleanup): offer Formal, Casual and Very casual styles (#284)
feat(helper): report the target app and website host with each transc…