← Back to Blog

Anatomy of Hark

Context

I've started to design Hark as a menu bar app for the Mac first. Where you can press a key and speak. It types what you said at the cursor, opens the app you named, or, through a model server you run beside it, answers what you ask according to your context. The speech is transcribed on the Mac, by whisper.cpp, a C and C++ implementation of OpenAI's Whisper speech model so far in EU more accurate and also faster than the free DCMA dictation feature on MacOS/iOS. The audio never leaves the Mac, it's the second fundamental point that I wanted to bring here a text to speech that respect privacy. The text lands a little over a tenth of a second after key up, by a sum of parts measured separately, and the app measured about half a gigabyte of memory.

Hark works like a "power tool". The key is the trigger. Hold it and Hark listens. Let go and it does one precise job, then stops. A quick tap locks it on, until the next tap. Its icon is a cordless drill. It is a tool you pick up on purpose, to open one app or write into one text field, then put down. It is not an assistant that is always listening, waiting to be called.

Different animations depending on events

Why the voice? Voice is the most natural way of transferring information, since the beginning of human history, we started to speak, communicate between each other over the most natural way, the language over the voice. And I always wonder to build a product that brings natural human fundamentals and empowering it with technology. There is also an ambition to bring AI close to the human and their work rather than bring them close to AI and adapt their work to technology.

A good product always start by fitting to the current workflow and bring solution rather to adapt yourself to fix your problems.

Hark's app icon, a white cordless drill on a yellow rounded square
The app icon, unchanged since the first public release, 0.0.2: a white cordless drill on a yellow rounded square, with its grip, battery, chuck and bit. One tool, one job.

I always liked Cydia and the jailbreak scene on iOS back in the past. Most of you who is familiar with this culture knows that this drill logo comes from the different tweaks available in Cydia. The drill means many different things, but I always wanted to tweak my way of using my laptop. Despite my technical knowledge is limited (I do not build tweaks...), this animated with curiosity combined with a bit of old school taste, I came to this idea of choosing this logo.

This article takes Hark apart, following one sentence from the key to the cursor. For each part it shows how it is built, why, and what it costs in milliseconds and memory. Five threads run through it:

The running example here is Hark 0.0.4 on a MacBook Pro with an Apple M5 Pro and 64 GB of memory (bought it before mem crisis I feel lucky). Hark is set as a fresh install leaves it: the Small model, the Neural Engine off, the language detected, the live transcript off. The sentence is "The meeting moves to Thursday at ten, same room.", about five seconds on the key, into a Mail draft. Every measurement in this article comes from that one Mac, taken between 18 and 29 September 2026 on the builds that led to 0.0.4, under macOS 27.0 and then 27.2. Each number names its conditions.

The screenshots show a sample log, and no real dictation appears in them. Where one shows something not yet released, the caption says so.

The document is built to grow, as Hark does.

One last detail. The model that does the listening cannot spell the product's name. Whisper writes the nearest word in its vocabulary, and a French voice saying "Hark" comes back as "arc" far more often than as "Hark". So Hark answers to a short list of spellings of its own name, written out, never guessed. The list has a price, and chapter 4 names it: a sentence that really starts with "Arc" goes to the assistant.

The six parts

Hark is one process on the Mac, a menu bar app with no Dock icon, for macOS 14 or later on a Mac with Apple silicon, built in Swift. It splits into six parts. What sets them apart first is what each may touch: the speech model, your rules, another app, or something outside the process.

The six parts of Hark, and what sits beside them One Hark process holds six parts: the pipeline, capture, transcription by the whisper.cpp speech model, the decision, delivery and the Ask Hark client. Beside it sit commands.yaml, a model server for Ask in a separate process, and huggingface.co for the model downloads you start. Hark · one menu bar process on this Mac · Apple silicon · macOS 14 or later Pipeline one state machine one log line each Capture key · microphone · HUD mic open while you speak Transcription whisper.cpp · Small Metal GPU · on this Mac Decision text, command or ask reads your rules Delivery Accessibility · paste checked, else clipboard Ask Hark one streaming request only when you ask commands.yaml verbs · apps · servers reloaded when saved Model server separate process 127.0.0.1 by default huggingface.co downloads you start pinned · SHA-256 Speech model Yours to shape Boundary or check Plumbing
The six parts of Hark, and what sits beside them.

Beside them sits one file you edit, commands.yaml, covered in chapter 7.

I always liked to use very simple information to understand complex things. That's why I decided to choose the colors codes. So they keep one meaning each, here and in every diagram that follows. Amber is the speech model at work, the only neural network inside the process. Teal is what is yours to shape. Coral is a boundary or a check: delivery, which writes into another app and verifies it, and anything outside the process. Gray is plumbing. Chapter 1 shows the check that enforces what each part may touch.

Two things cross the edge of the process, and both wait for you. The first is a model download you start, from huggingface.co and its hf.co storage, at a pinned commit, checked against its SHA-256 hash: the app ships with no speech model. The second is the model server for Ask, a separate process, at 127.0.0.1 by default. A sentence you dictate never waits on either.

Seeing the "six"

Click the menu bar icon, and the panel, the window that drops from it, shows all six parts at once, here over a sample log.

Hark's menu bar panel with its status line, the last result and four recent ones
The panel, over a sample log. Status: Micro MacBook Pro, the built-in microphone's French name, then Small and ● Ask, green when the server answers. The last result, a sample 460 ms, then Ask, Text, Text, Command. Six parts, one glance.

Every part has a place on it. The status line holds three: the microphone, the model and the green dot for Ask. The last result says where delivery put it, and each row, read back from the log, what the decision made of it.

The panel is the summary. The Log tab is the record.

Settings, Log tab, listing six sample utterances with outcome, app, time and model
Settings › Log, over the same sample log. Each row: when, how it ended, the app, the transcription time, the model. At 11:20, an ask adds the model's time. At 11:05, the running example, in Mail. Sample values.

Settings has seven tabs, and they follow the parts: each chapter names the one it uses.

The row at 11:05 is the running example.

The logic behind a sentence

The six parts follow the sentence, in seven steps. Each part serves one or more of them.

The logic behind a sentence Seven steps from key down to one log line: key down, the microphone opens, key up, transcribe, resolve, deliver and check, one log line. A focus probe starts at key down beside the capture and is ready for resolve by key up. The time each step takes runs down the right. Key down ⌃⌥V · capture and probe start together Microphone opens one session · 16 kHz mono · RAM only Key up the end of speech · the HUD leaves Transcribe Whisper Small · on the GPU Resolve your rules · text, command or ask Deliver, and check Accessibility, else ⌘V, else clipboard One log line 13 keys · then back to idle Focus probe app · field · secure ready by key up t = 0 76–88 ms to start stop 17–24 ms 76 ms · 5.7 s clip in memory AX ≤ 0.25 s a call paste read ≤ 1 s one write(2) measured on this Mac, step by step · decode: Small q8_0, Metal, language fixed
The logic behind a sentence.

The sentence starts with a press of the dictation key, Control-Option-V (⌃⌥V) by default. Two things start at that instant: the capture, and a focus probe that asks macOS which app and which field are in front. Recording does not wait for the probe, so the probe costs the capture nothing. For the running example, the probe has found a Mail draft long before key up.

The microphone opens one session for this press. It delivers 16 kHz mono samples, kept in memory and never written to disk. Key up is the end of speech. No voice detector waits out 300 to 700 ms of trailing silence to guess that you stopped. The release says so, and the HUD leaves.

The amber box is Whisper, transcribing the clip. Resolve, in teal, reads your rules and picks text, a command or an ask. The running example opens with "The", not a verb or the name, so it is text. Deliver, in coral, writes into another app, then checks. For a Mail draft that means a paste, which counts only once Mail reads it. Every path ends in one log line.

Where the milliseconds go

You feel one wait: from letting go of the key to the text in Mail. The focus probe and the HUD's 120 ms fade, given in chapter 2, run while you speak and add nothing after key up. The microphone is the exception, at the start: its first sample lands 90 to 100 ms after the press, and sound before it is not recorded. Whether that clips a quick first syllable was not measured.

After key up, the wait is a short chain. The microphone stops in 17 to 24 ms. Then Whisper decodes the clip on the GPU, through Metal, Apple's GPU interface. The nearest measurement to the running example is a synthesized 5.7 s sentence on Small q8_0, its 8-bit build: 76 ms, the median of 8 runs after one discarded warm-up, with the language fixed to English. Whisper does the same amount of work for both clips, for a reason chapter 3 explains.

The rest is small, and untimed. Resolve runs in memory, the paste is read in milliseconds by the code's own account, and the log line is one write(2).

Key up to text, added up from measured parts A timeline from key up, 0 to 160 ms. The microphone stops in 17 to 24 ms, the decode takes 76 ms, then resolve, the paste read and the log line take a few milliseconds each, about 100 to 110 ms in all as a sum of parts measured separately. The HUD's 120 ms fade-out runs beside it. Before key up, the microphone, the focus and the model are already ready. While you speak audio from 90–100 ms focus known model warm stop · 17–24 ms resolve, paste read, log not timed · widths schematic decode · 76 ms ≈ 100–110 ms · a sum of parts measured separately HUD fades out · 120 ms target: p95 under 1.5 s, off this scale a model before each sentence: +0.3–0.6 s, an estimate, refused key up 40 ms 80 ms 120 ms 160 ms measured on this Mac, M5 Pro · decode: Small q8_0, Metal, 5.7 s sentence, 512 states language fixed in the benchmark · no end-to-end measurement exists
Key up to text, added up from measured parts.

Added up, the chain comes to about 100 to 110 ms from key up to text. That is a sum of parts measured separately. No end-to-end measurement exists: the timer planned for it was never built. The log does not close the gap either. Its transcribe_ms times the whole engine call, queue waits included, not the decode alone.

By the sum of its parts, with the language fixed, the text lands at about the moment the HUD's 120 ms fade-out ends. The running example detects the language, which costs Whisper an extra pass. On short synthesized requests, detection added 24 ms to the median decode in English, which puts the running example near 125 to 135 ms. That is an estimate, and chapter 3 gives the measurements.

For scale, the project's target was under 1.5 s at the 95th percentile, for a five-second sentence. A language model routing every sentence would have added 0.3 to 0.6 s, by the project's own estimate, and needed the model server running before you could type a word. That design was refused, and chapter 7 comes back to it.

The honest summary: most of the wait is one decode, and chapter 3 is about making it small.

Chapter 1: The pipeline

The six parts need a conductor. Every utterance, whatever it becomes, runs through one state machine: one stage at a time, one way in, one way out, and one line in a log at the end.

Presses at the wrong moment

You press the dictation key again while a sentence is still being transcribed. You cancel, and the transcript lands anyway. Or Whisper finishes before Hark knows which field has focus.

Each case still ends cleanly. A press while busy is its own utterance, logged as busy at once, and the one in progress carries on. A result for an utterance that already ended is rejected.

The mechanism is a reducer, a pure function from a state and an event to the next state. reduce(state, event) reads no clock and does no I/O. It returns the new state and a list of effects: start the microphone, transcribe, insert. The controller, a Swift actor that handles one message at a time, runs each effect in its own task. The result comes back as an event, and the controller never waits, so a second press is handled at once.

So a press can arrive at the wrong moment and still end in exactly one line. That is what the state machine buys.

One state machine

The states are the seven steps, now named: idle, capturing, transcribing, resolving. Then one of three endings, acting, inserting or copying, and back to idle.

Version 0.0.3 added asking, with its stages: generating, reviewing, replacing and failed. An ask is known from the start, by the key or menu that began it, and goes to asking straight after its transcript. Only a dictation that opens with "Hark, …" turns into one later, at resolving. Chapter 6 covers it.

Some utterances never reach Whisper: too short or too quiet, they end as too_short or no_speech, at the gates of chapter 2. An insert that fails does not lose the text: the machine falls to copying, with a reason.

One state, confirming, is wired and tested and never entered: no command asks first. Every ending has a name the log can write, one of 27 failure codes or 10 discard reasons. The 62 legal and 28 illegal dictation transitions are tested from tables, and asks have tables of their own, so a change nobody planned fails a test.

One utterance, one path, one log line An utterance moves from idle to capturing at key down, to transcribing at key up, to resolving once the transcript is in, then to acting, inserting or copying; a failed insert falls back to copying. An ask branches to asking, through generating, reviewing and replacing. Every ending writes one log line and returns to idle. key down key up transcript idle mic closed capturing mic + focus probe transcribing one decode resolving your rules acting open the app · 15 s max inserting at the cursor · ch. 5 copying clipboard, with a reason a failed insert falls back to copying an ask asking Ask key · Services · "Hark, …" · ch. 6 generating the server streams reviewing yours to edit replacing selection checked Every ending writes one log line, then idle early exits: too short (< 250 ms) · no speech (RMS < 0.01) · empty · cancelled · busy
One utterance, one path, one log line.

The drill in the menu bar

The HUD leaves at key up imo. The work goes on, and the menu bar icon shows it. But like in a subtle way. I always liked design that is soft tool where you have to pay attention to the details to see them and this brings a form of expression in your software and products without disturbing the user experience. The key is to find the great balance and for an application that fits in the status bar, Its simplicity is a form of paradox of complexity.The icon is the state machine made visible, one form of the app icon's drill per state. It is a design in progress: the forms are drawn, but the animations are not yet wired into the app, and none of it is released. 0.0.4 still shows a waveform there.

Key down pulls the trigger. The drill is filled while the microphone is open, and kicks up once as the capture starts. A dot beside it means the press has latched, the tap of chapter 2.

So after key up, only the drill's battery stays filled, and the drill dims, while Whisper transcribes and the action runs. If that takes longer than 300 ms, the bit turns too: marks pass above and below it, one turn every 1.2 s. The delay keeps a short dictation from flickering. By the sum of its parts, the running example is done well within those 300 ms, so its bit never turns. An ask shows a sparkle beside the battery until the Ask panel closes, and the bit turns while the answer is written.

An utterance that fails shows a cross for a second, and the drill shakes left and right with it, the way the Mac's login window shakes at a wrong password. One that came to nothing, too short or silent, shows the cross without the shake. A cancel shows nothing, since you did it yourself.

The drill follows the pipeline The menu bar drill in four forms: an outline at rest; filled, with one kick at key down, while the microphone is open; dimmed with only the battery filled while Hark works, the bit turning once the work passes 300 ms; and, when an utterance fails, a cross that shakes left and right with the drill. At rest the drill in outline, between presses key down The trigger filled, with one kick at key down key up Working dimmed · the bit turns past 300 ms if it fails · else back to rest The shake the drill and its cross, left and right in progress, not yet released · 0.0.4 shows a waveform in the menu bar
The drill follows the pipeline.

Each animation lasts under half a second and ends on the state's own form, and only the turning repeats. With Reduce Motion on, nothing moves, and the form alone carries the state. The states differ by shape and opacity, never by color, so the icon stays a template image, a one-color image that macOS tints to match the menu bar.

The core and the shell

Hark is one Swift package, cut in three targets, the parts a package builds separately. HarkCore holds all the logic, 129 files (yeah...), and imports no UI framework, so everything that decides what happens to a sentence can be tested without a window on screen. HarkApp is the shell. Its 39 files of SwiftUI views and AppKit adapters render state and never compute it. The third, HarkObjC, is one function.

The split is enforced. scripts/check.sh runs before every commit. It fails the commit if the core imports SwiftUI or AppKit, if any folder but Transcription/ imports whisper.cpp, or if URLSession appears outside its two files. The screen and the speech model each have one door, and the network two.

Where the core touches the system, it defines a seam: a protocol, Swift's word for an interface, that the core owns and something else implements. The app plugs in AppKit adapters, and the tests plug in fakes. Most seams have a default that still ends a press in one log line.

Core, seams, adapters HarkCore holds the reducer, the transcription folder and the stages. It reaches the system only through seams, protocols it owns, which AppKit adapters implement in the app and fakes implement in tests. HarkObjC, one function that catches exceptions, is called directly by the audio stage. HarkCore all logic · no UI Reducer pure · no clock, no I/O Transcription only door to whisper.cpp Stages audio · rules · insertion Seams protocols the core owns Around it outside the core AppKit adapters pasteboard · keys · apps Test fakes no mic · no AX · no network HarkObjC one function · exceptions called directly check.sh fails a commit that imports a UI framework into the core
Core, seams, adapters.

Three dependencies, no more: whisper.cpp, pinned to its release b5130 as a prebuilt framework, KeyboardShortcuts for the keys, and Yams for the YAML file. HarkObjC exists because AVFoundation, Apple's audio and video framework, raises Objective-C exceptions, which Swift cannot catch. Its one function turns them into errors. Chapter 2 tells the crash that made it necessary.

Until 23 September, every quit crashed. exit() ran the destructors of ggml, whisper.cpp's math library, while GPU memory was still held. Hark now unloads the model first, and past 3 s leaves with _exit, which skips the destructors.

Keeping the HUD and the keys live

While you speak, the HUD moves 30 times a second and the keys answer at once. Four rules keep it so:

One line per utterance

Every row in Settings › Log is one line of JSON, one file a day, thirteen keys in a fixed order. It takes one open in append mode and one write(2), in a folder and a file only your account can read. A failed write goes to the system log, never back into the pipeline.

What a line keeps is decided in code: in a password field, both texts are written as null. An ask writes the instruction you spoke, never the selection or the answer. The last two of the 13 keys, llm_model and llm_ms, came with Ask Hark.

The running example, in the log's format, broken across lines for the page:

{"ts":"2026-09-29T11:05:12.408+02:00","duration_ms":5000,"transcribe_ms":540,
"raw_text":"The meeting moves to Thursday at ten, same room.",
"normalized_text":"the meeting moves to thursday at ten same room",
"resolution":"text_inserted","target_app":"com.apple.mail","action_type":null,
"exit_code":null,"error":null,"model_tier":"small","llm_model":null,"llm_ms":null}

The time and the 540 ms are sample values. In the Log tab, a dot beside each row names its ending.

The five dots of Recent and the Log, explained in Settings › About
Settings › About, the dots in Recent and the Log. Blue, text where it should be. Orange, text only on the clipboard. Green, a command. Gray, discarded. Red, failed. Every ending, named.

No line, no utterance. Every press, kept or discarded, can be checked after the fact.

Chapter 2: Capture (key, microphone, HUD)

Chapter 1 gave every press one path. Its first state, capturing, starts with a key, not with a microphone.

Three things share the moment: the key that says what you want, the microphone that opens for it, and the HUD that shows you are heard.

Three keys, two gestures

Besides the dictation key, Hark has two: the cancel key, Control-Option-Escape (⌃⌥Esc), and the Ask key of chapter 6, Control-Option-A (⌃⌥A). All three can be rebound in Settings › General.

Settings, General tab, with recorders for the dictation, cancel and Ask Hark shortcuts
Settings › General, rebound on this Mac: dictation ⌥⌘V, cancel ⌥⌘Q, the tap-or-hold rule, then Ask Hark ⌥⌘A. Defaults: ⌃⌥V, ⌃⌥Esc, ⌃⌥A. Yours to change.

One key carries two gestures. Recording starts at key down either way. Release within 350 ms and the press latches: recording goes on with the key up, until the next tap. Hold longer and it is push-to-talk.

The keys are system-wide hot keys from Carbon, an older macOS API, through the KeyboardShortcuts package. Unlike an event tap, they need no Input Monitoring permission. The release marks the end of speech, with no voice detector. Always-on listening, which would need one, was set aside.

One key, two gestures, split at 350 ms Two timelines from key down. Hold: the key stays down past 350 ms, and recording stops at key up. Tap: the key comes up before 350 ms, the capture latches and goes on until a second tap stops it. Recording starts at key down in both. 350 ms Hold push-to-talk recording while held key down key up · stops on release Tap hands-free latched · recording goes on key down key up second tap stops 0 350 1,200 ms recording starts at key down either way · the release decides which gesture it was
One key, two gestures, split at 350 ms.

One detail from the first design. Hark was first planned around a hardware button. A two-euro Bluetooth camera shutter was for prototyping only: it sleeps and drops the first press. The pick was a three-key macro pad sending F13, F14 and F15, keys macOS binds to nothing. What shipped is a chord on the keyboard you already have. The button's only job was to emit one keystroke, so nothing after it had to change.

A window that never takes the keyboard

While you speak, the HUD at the bottom of the screen shows seven bars and a timer. The caret, the text cursor, stays where it was in Mail. By the project's own specification, this is the most important detail in the app.

Showing a window usually brings its app to the front, and early builds paid for it twice: the Settings window vanished at the first click elsewhere, and a welcome window swallowed the first dictations after each launch.

The HUD is a non-activating panel, a window that shows without bringing its app forward. It never becomes the key window, the one that takes typing, and it ignores the mouse. It is 280 by 64 points, sits 120 points above the Dock, and fades in over 120 ms, instantly under Reduce Motion. A tripwire, HUDFocusGuard, logs a fault if Hark ever becomes active while it shows.

Why the caret stays where you left it Side by side. An ordinary window activates its app, becomes key and takes the caret from Mail, so the insertion target is lost. The HUD is shown without activating, is never key or main, ignores the mouse, and Mail keeps the caret. An ordinary window what showing a window usually does App activates Hark comes to the front Window becomes key the caret leaves Mail Nowhere to type the insertion target is lost The HUD a non-activating panel Shown, not activated ordered front regardless Never key, never main ignores the mouse Mail keeps the caret your field, untouched a tripwire logs a fault if Hark ever becomes active while the HUD shows
Why the caret stays where you left it.

The seven bars are the voice's spectrum, 100 Hz to 6 kHz. They rise at once and fall back over about a third of a second, so a syllable does not blink.

HUD while listening, seven bars and 1:23 HUD latched hands-free, with a lock before the time HUD with a live transcript line under shorter bars HUD at 30:00, length limit reached, transcribing
The HUD in four states. Held: seven bars, 1:23. Tapped: a lock. Live transcript, off by default: the newest words. At 30:00, "Length limit reached. Transcribing…". The timers are preview values. None takes the keyboard.

Everything at key down

Key down waits for nothing. The reducer from chapter 1 moves to capturing and emits its effects at once: start the capture, probe the focus, lower other audio.

On this Mac, the microphone's session starts in 76 to 88 ms, and the first buffer lands about 10 ms later. The probe asks Accessibility which app and field are in front. It answers in 0 to 2 ms warm, 22 to 37 ms on a fresh process's first read. Lowering other audio took 7.9 to 16.8 ms in the installed app, the top of the range on AirPods. That is too long for the main thread, so it runs on its own actor.

Key down, everything at once Lanes on a 0 to 200 ms axis from key down. The reducer moves to capturing at once. The HUD fades in over 120 ms. The microphone session starts in 76 to 88 ms, and its first buffer arrives about 10 ms later, so the first audio lands about 90 to 100 ms after the press. The focus probe answers in 0 to 2 ms warm. Other audio is lowered in 8 to 17 ms. first audio ≈ 90–100 ms Reducer pure, no I/O capturing HUD non-activating fade in · 120 ms Microphone one session start · 76–88 ms first buffer Focus probe Accessibility 0–2 ms warm · 22–37 ms first read Other audio own actor lowered to 30% · 8–17 ms 0 50 100 150 200 ms this Mac · M5 Pro · each lane measured on its own · the fade is set, not measured
Key down, everything at once.

Why nothing is open between presses

You might expect a dictation app to keep its microphone warm. Hark opens nothing while idle.

Until 27 September, capture ran on AVAudioEngine, kept alive as long as the app. With AirPods as the input, it held them in headset mode while idle, and reconfigured itself 48 times in under a minute. Then another app changed the audio setup, and AVFoundation raised an Objective-C exception. Swift cannot catch one, so the process ended.

That crash is why HarkObjC, the one-function target from chapter 1, exists. The same exception now ends one utterance, with a log line, not the process.

The next fix created the engine at each press, and it still had one flaw: it opened the system default input even with another microphone chosen, so AirPods as the default switched to headset mode at every press. That took 2 to 5 s, and short dictations came back silent. Since 28 September, AVCaptureSession opens only the device it is given and delivers 16 kHz mono Float32. No resampler runs.

The microphone, before and after 28 September Two era rows. AVAudioEngine, until 28 September, made per press, still opened the system default input at every press and switched AirPods to headset mode in 2 to 5 s, so short clips came back silent. AVCaptureSession, since 28 September, opens one session per press on the chosen microphone only, starting in 76 to 88 ms. Between presses nothing is open. AVAudioEngine · until 28 September made per press, it still opened the system default input AirPods to headset mode · 2–5 s to switch short clips came back silent AVCaptureSession · since 28 September one session per press · only the chosen microphone start 76–88 ms · 16 kHz mono float delivered your mic and nothing else between presses, nothing is open
The microphone, before and after 28 September.

A headset now keeps its music.

Settings, Audio tab: one microphone menu set to the built-in microphone, and a note that Hark opens it only while you dictate
Settings › Audio. One choice, the microphone: Micro MacBook Pro, the built-in one under its French name. Below it, the promise that Hark opens it only while you dictate. Nothing between presses.

Samples in memory, and two gates

The samples stay in memory. One minute, 960,000 samples or 3.84 MB, is reserved once and kept between presses. A 30-minute capture grows to 115 MB, then gives the growth back. Raw audio reaches the disk only in a debug build.

Two gates stand before the model, the early exits of chapter 1. A capture under 250 ms is too short. One whose loudest 20 ms stays under 0.01 in root mean square (RMS), a measure of loudness, holds no speech. Either way the model is never called.

Samples in memory, and two gates From the capture session to samples kept in memory, then a check that the capture lasts 250 ms or more, then a check that its peak level reaches 0.01 RMS, then the transcriber. Up to 30 minutes, 115 MB, given back after. Nothing goes to disk outside a debug build. Session one per press Samples in memory 1 min kept Long enough under 250 ms: too short Loud enough under 0.01 RMS: no speech Transcriber whisper.cpp chapter 3 in memory: up to 30 min · 115 MB, then given back Disk never, outside a debug build
Samples in memory, and two gates.

Lowering other audio, and restoring it

By default, other audio drops to 30 percent while you speak. Bluetooth headsets broke that: they keep one volume per mode. Hark lowered AirPods to 30 percent of their volume in music mode. At key up it read the headset mode's volume, unchanged, took the mismatch for your own change, and left the music low.

Now Hark lowers nothing when a Bluetooth microphone is the input or the system default, and restores only a volume that still reads what it set. The lowered state is saved first, so a crash is undone at the next launch.

The fastest microphone would be one left open. Hark opens one per press instead, and pays at the start: the first samples arrive about 90 ms after the key goes down. Between presses, nothing listens.

Chapter 3: Transcription (whisper.cpp on Apple silicon)

The key comes up. Five seconds of speech are now 80,000 numbers in memory, the samples from chapter 2. This chapter is the amber box, where the Mac does the work a server usually does.

The question is not whether a Mac can run Whisper. It is whether a menu bar app can keep it loaded all day, answer in a tenth of a second, and cost little while it waits.

Why the model loads at launch

Hark loads the model at launch, and again when you choose a size in Settings › Model, never inside a sentence. It then runs one warm-up decode: 1.25 s of silence, one token long. That step compiles the GPU code the first press would otherwise compile. A press during warm-up waits behind it, on the serial queue from chapter 1.

Ready before the first press Five steps in a row. You choose a size in Settings. Hark downloads the model pinned to one commit and checks its SHA-256, loads it onto the GPU through Metal, warms it up with one decode of 1.25 s of silence, and keeps it resident, so every press starts warm. Before the warm-up, the first press ever took 16,378 ms for 4.1 s of speech. After it, 242 ms for 15.9 s and 151 ms for 7.8 s, each the whole engine call, language auto. Each new build compiles Metal once, 12.4 to 13.0 s cold, 9 ms warm. Choose a size in Settings Download pinned commit SHA-256 check Load onto the GPU through Metal Warm up 1.25 s of silence Resident every press starts warm before: the first press ever took 16,378 ms for 4.1 s of speech after: 242 ms for 15.9 s, 151 ms for 7.8 s · Small, language auto, whole engine call each new build compiles Metal once: 12.4 to 13.0 s cold, 9 ms warm
Ready before the first press.

Before the warm-up, the first press ever took 16,378 ms, the model loading and compiling inside the sentence. On Metal, a new build's first start still costs 12.4 to 13.0 s of compilation, now paid at launch.

The price is memory held all day. Hark can unload an idle model, but the option stays off, since a reload pays the warm-up again.

The price of staying ready

On 23 September, the installed app with Small and the live transcript off measured a 489 MB footprint, the memory macOS charges to the process, and a 579 MB peak, the Neural Engine state unrecorded, most likely on. On a 16 GB Mac, that is about 3 percent. Before a launch fix it peaked at 1.0 GB: the model had loaded twice.

The weights are what keep it small. On disk, Hark's three models are quantized: their weights are stored in 8 bits (q8_0), or 5 for Large v3 (q5_0), instead of 16. They take 264.5 MB for Small, 823.4 MB for Medium and 1,081.1 MB for Large v3. The 16-bit Large v3, 3.1 GB, was left out as too big to keep loaded in a menu bar app. With the Neural Engine switch on, described below, the Core ML encoders add 163.1 to 1,175.7 MB, hence the 427.5 MB shown for Small.

The live transcript costs more. Whisper does not stream, so the HUD's line is a fresh decode of the last 6 s, on a second copy of Small. In a test process with the Core ML encoder installed, that copy added 427 MB, about its weights plus its 163 MB encoder. It delayed the final decode by 5 ms typically, 18 ms at worst over 40 runs.

Hark's memory, measured, and what is not Bars on a scale from 0 to 1 GB. The whole app with Small and the live transcript off: 489 MB footprint, 579 MB peak. Small loaded once, in a test process: 353 MB. The live transcript's second copy of Small: 427 MB more, off by default. Before a launch fix, with Small loaded twice: a 1.0 GB peak. The model server for Ask is a separate process, not counted in Hark's memory. Medium and Large v3 in memory were not measured. The test-process rows had the Core ML encoder installed, and the app row's Neural Engine state was not recorded. Hark, Small live transcript off 489 MB · peak 579 MB Small, loaded once in a test process +353 MB Live transcript Small + its encoder +427 MB · off by default Before the fix Small loaded twice peak 1.0 GB 0 500 MB 1 GB model server for Ask · a separate process · its memory is not Hark's not measured: Medium and Large v3 in memory, the app with the live transcript on test-process rows: Core ML encoder installed · app row: Neural Engine state unrecorded
Hark's memory, measured, and what is not.

Two halves, two chips

After key up, two networks run in turn. The encoder reads the whole clip once, at a cost set by the window it is given. The decoder then writes the text token by token, at a cost that grows with the words.

Two halves, two chips Audio at 16 kHz mono, at least 1.25 s long, becomes a mel spectrogram on the CPU with up to four threads. The encoder reads it once, on the GPU through Metal by default with the window scaled to the clip, or optionally on the Neural Engine through Core ML, always on the full 1,500 states. The decoder writes the text token by token, always on the GPU through Metal. The text then goes to the filter. Audio 16 kHz mono 1.25 s or more Mel on the CPU up to 4 threads Encoder once per clip cost = window Decoder token by token cost = words Text then the filter Metal · GPU the default · window scaled Core ML · Neural Engine optional · always 1,500 states Metal · GPU always the encoder's cost is set by its window, the decoder's by what you said
Two halves, two chips.

whisper.cpp runs inside Hark: 3.9 MB of a 14 MB app. Both halves run on the GPU by default, through Metal. The encoder can instead run through Core ML, Apple's framework for compiled models. whisper.cpp lets Core ML pick the chip, and the Neural Engine is the one it is meant for. Which chip ran was not checked. The CPU only builds the mel spectrogram, the clip as frequencies over time.

That second path first failed in silence. whisper.cpp derives the encoder's file name from the weights, and the project had the rule backwards. For the first morning of real use, every decode ran on Metal alone, and only whisper.cpp's log said so. Hark now logs at every load whether the encoder is there.

What a short sentence costs

A short sentence should cost less than a long one. Whisper's encoder sees a fixed 30 s window, as 1,500 states, 50 per second. Left alone, a five-second sentence pays for all thirty. audio_ctx, the number of states a decode computes, tells it how much the clip fills.

Hark scales it to the clip: seconds × 50, plus 50, rounded up to a multiple of 256, between 256 and 1,500. The running example, 5 s, needs 300 states, rounded to 512: a third of the window.

The encoder pays for the seconds you spoke A bar for Whisper's 30-second window of 1,500 encoder states, with ticks at 256, 512, 768 and 1,500. A 3 s clip computes 256, the five-second running example 512, a 10 s clip 768, and a 29 s clip all 1,500. The rule: seconds times 50, plus 50, rounded up to a multiple of 256, between 256 and 1,500. With the Core ML encoder the full 1,500 is always computed. Whisper's window · 30 s · 1,500 encoder states 3 s · 256 10 s · 768 29 s · 1,500 the running example, 5 s · 512 seconds × 50, plus 50 · rounded up to a multiple of 256 · between 256 and 1,500 with the Core ML encoder: always the full 1,500
The encoder pays for the seconds you spoke.

The floor of 256 protects quality. Cut shorter, the encoder's output drifts from what the decoder was trained on. Decoding then starts to repeat itself, which is worse than a slow decode.

On this Mac, with Small, one 5.7 s sentence on Metal took a median 76 ms at 512 states, and 107 ms on the full window. That is 29 percent less. On a warm decode, the code calls it the single biggest latency lever.

Clips under about a second came back empty, so each is padded with silence to 1.25 s. The padding costs nothing, since the encoder is billed by audio_ctx, not by the clip.

The Neural Engine, measured

You might expect the Neural Engine to be the fast path. For dictation it is not. The published Core ML encoder is compiled for one shape, the full 1,500 states. Asked for 512, it returns an encoding the decoder cannot read, without an error. The 5.7 s sentence came back as "you", in 9 ms.

One clip, four paths, eight timed decodes each.

One sentence, four encoder paths Median decode time for one 5.7 s sentence on Small q8_0, eight decodes each on an Apple M5 Pro. Metal at 512 states, the default: 76 ms, the sentence. Core ML on the Neural Engine at the full 1,500: 83 ms, the sentence. Metal at the full 1,500: 107 ms, the sentence. Core ML at 512, a shape mismatch: 9 ms, and one word, you. Metal · 512 scaled, the default 76 ms · the sentence Core ML · 1,500 Neural Engine, full 83 ms · the sentence Metal · 1,500 GPU, full window 107 ms · the sentence Core ML · 512 shape mismatch 9 ms · one word, "you" Small q8_0 · one 5.7 s sentence, language fixed · median of 8 decodes · M5 Pro · 21 September
One sentence, four encoder paths.

Core ML must compute the whole window, and lands at 83 ms: behind Metal at 512 states, ahead of Metal on the full window. Quick, but it cannot skip the silence.

The switch is off for a fresh install, and left on for one that already holds an encoder. On, it should draw less power, which has not been measured, for an extra download per model.

Settings, Model tab: three speech models with their sizes, and the Neural Engine switch with its note
Settings › Model. Small in use at 427.5 MB, Medium at 1.39 GB, Large v3 at 2.26 GB, each with its Core ML encoder: the switch is on here, off on a fresh install. Under it, the trade.

A note on the Neural Engine. The power saving is the reason the switch exists, and it has not been measured on this Mac. The switch also has a cost the Model tab does not show. Core ML keeps its compiled encoders in the app's cache folder: 1.9 GB once all three models had been loaded. Turning the switch off, or deleting all models, clears it.

The decode settings

Every decode uses the same settings, chosen for one short sentence:

Chapter 4 shows why the product's own name is not left to the vocabulary.

Language set to detect automatically, and an empty vocabulary list with its help text
Lower in the Model tab. Language set to detect, and its cost: an extra pass over every utterance. The vocabulary's help names a word the model gets wrong: Hark, the name from the start of this document, made literal.

Silence, and thirty minutes of speech

Press the dictation key by accident, and a click or a breath is enough to carry the capture past the gates of chapter 2. Whisper then writes something. Trained on subtitled video, it hallucinates on near-silence: it writes text for audio that holds none. Fed two seconds of digital silence directly, Small writes "you". Its no_speech_prob, Whisper's own estimate that the window holds no speech, reads 0.00000032. The first filter trusted that number, and never fired on the silence it was written for.

Every decode now faces six checks.

What Whisper writes, and what Hark keeps Six checks in order. A match on any of them discards the decode as empty_transcript, and a pass moves on to the next. The checks: blank text once annotations are stripped, no_speech_prob of 0.9 or more, a subtitle credit such as Radio-Canada or Amara.org anywhere, a silence phrase such as thank you or merci as the whole utterance, a loop of one word four times, a short run three times or a clause twice, and a weak filler such as you, oui or okay, only on quiet audio. What passes all six is kept. Blank text nothing left once annotations are stripped pass Certain silence no_speech_prob 0.9 or more pass A subtitle credit anywhere · Radio-Canada, Amara.org pass A silence phrase the whole utterance · thank you, merci pass A loop one word ×4 · a short run ×3 · a clause ×2 pass A weak filler only on quiet audio · you, oui, okay pass Kept your words match discarded empty_transcript
What Whisper writes, and what Hark keeps.

A loop counts at four copies of one word, three of a two- or three-word run, and two of a whole clause. "Très très bien" stays speech, since people repeat themselves for emphasis. A weak filler is dropped only on quiet audio, a mean RMS under 0.01, or when no_speech_prob reaches 0.6. The lists are bilingual: 32 silence phrases, 12 credits, 36 fillers. A spoken "oui" survives.

Long speech failed the other way. One call over 72 s of synthesized French returned its first 30 s and two stray words. Clips over 30 s are now cut at the first pause of 2 s or more. Without one, the cut falls at the quietest 20 ms of the last 5 s.

Seventy-two seconds, cut where the speaker paused A schematic 72-second clip, positions not to scale with any real recording. The first chunk ends at a pause of 2 s or more, whose silence is skipped. The second has no pause before its 30 s limit, so it is cut at the quietest 20 ms of its last 5 s. The rest forms the third chunk. Measured: 72 s of French in 1.8 s, 62 s of English in 1.3 s, on Small q8_0 with synthesized speech. a 72 s clip, schematic ≤ 30 s ≤ 30 s rest pause ≥ 2 s · skipped quietest 20 ms no pause before 30 s: cut at the quietest 20 ms of the last 5 s measured: 72 s of French in 1.8 s · 62 s of English in 1.3 s Small q8_0 · synthesized speech · under auto, the first kept chunk sets the language
Seventy-two seconds, cut where the speaker paused.

Cut this way, the same 72 s came back whole: in 1.8 s on Small when first measured, 0.97 s in a later run. By the project's estimate, with the Neural Engine on, thirty minutes of speech waits about 35 s.

The fastest model is the one already in memory, computing only the seconds you spoke.

Chapter 4: The decision (text, command or ask)

Chapter 3 ends with a transcript, text in memory and nothing more. This chapter decides what it is for.

Say a sentence and it is typed. Say "Open Safari." and Safari opens. Say "Hark," first and you are asking. One key does all three, so every rule here must catch what you meant and leave the rest alone.

Text unless proven otherwise

In the running example, the sentence is typed into the Mail draft. Nothing opens, nothing is asked: the common case.

Two checks run, in order. First the name, "Hark": a transcript that starts with it goes to the assistant, Ask Hark with nothing selected, unless a command follows at once. Then the command: a sentence made of an opening verb and an app, with nothing after the app, opens that app. Anything else is text.

A password field changes two things. The name is never looked for there. Its text goes to the clipboard, concealed, with raw_text and normalized_text written as null. A command still runs, and its line still hides the words.

Text, unless proven otherwise A decision column. The transcript is checked for the name first, which goes to Ask unless a command follows; then for a verb and an app with nothing after, which opens the app; then for a password field, which sends the text to the clipboard concealed. Everything else is text, delivered to the cursor. The running example starts with the, so it is text. Transcript normalized · from chapter 3 Starts with the name hark · arc · ark, a greeting allowed before never in a password field yes Ask chapter 6 unless a command follows no Verb, app, nothing after your verbs, skipped words, aliases yes Open the app within 15 s no Password field secure input, or a secure field yes Clipboard concealed · text null in log no Text to the cursor · chapter 5 running example: starts with "the" so, text
Text, unless proven otherwise.

The column is the teal Resolve step, opened up.

Both checks compare a normalized form: lowercase, accents dropped, "œ" spelled "oe", Whisper's annotations removed, punctuation turned into spaces. "Ouvre le Finder." becomes ouvre le finder. The same string fills normalized_text, so a log line shows what the rules saw.

A code review found one ordering problem. A transcript that beat the focus probe from chapter 2 was resolved with no focus. A password field's text then reached the log and an unconcealed clipboard. The reducer from chapter 1 now waits in resolving until the focus is known. Each message to AX gives up after 0.25 s, so the wait is bounded.

A grammar, not a guess

"Ouvre le Finder.", open the Finder, opens Finder. "Finder is slow today." is typed. Both name the same app, and only one is a command.

Whisper misspells app names, so the match has to be approximate. On a whole sentence, approximate matching fires on ordinary speech. The rule first specified was measured before any code relied on it. Jaro-Winkler, a string similarity from 0 to 1 that rewards a common start, scored "Finder is slow today." 0.86 against the alias "finder", and "New note for the meeting." 0.867. Both cleared the 0.85 threshold and would have run. "Please open Finder." scored 0.734 and stayed text.

Why only the app name is approximate Jaro-Winkler scores on a scale from 0.70 to 1.00 with the 0.85 threshold marked. Under the first rule, whole sentences such as Finder is slow today pass the threshold while Please open Finder does not. Under the shipped rule only the app name is compared: Fynder passes, fichier does not, and notre scored 0.953 against note until determiners became skipped words. 0.85 First rule: the whole sentence against an alias Finder is slow today. 0.86 · would open Finder New note for the meeting. 0.867 · would run "new note" Please open Finder. 0.734 · text Shipped rule: the app name, after a verb Ouvre le Fynder. 0.900 · opens Finder Ouvre le fichier. 0.797 · text notre against note: now skipped 0.953 0.70 1.00 Jaro-Winkler scores, from 0 to 1 · threshold 0.85
Why only the app name is approximate.

The rule that shipped is a small grammar: an opening verb, skipped words, then an app, then nothing. Verbs and skipped words must be said as written. Only the app name is approximate, compared word by word at 0.85. "Ouvre le Fynder." opens Finder at 0.900. "Ouvre le fichier.", open the file, scores 0.797 and stays text.

The last clause came from a live check on 24 September. "Ouvre le Finder pour demain.", open the Finder for tomorrow, opened Finder. The app must now end the sentence. A polite ending such as "please" may follow it, on main, not yet released.

Each trap found since became a fix. "Notre" scores 0.953 against "note", so determiners became skipped words. Chatty verbs such as "montre", show, left the verb list after "Montre-moi tes notes", show me your notes, opened Notes. The verbs gained their familiar and formal forms, because Whisper hears "affiches-moi" and "ouvrez", then their plural ones, after it heard "Affiche-moi" as "Affichons à".

The specification accepts one cost: a dictation that starts with "ouvre" and an app is a command. That keeps everything else text.

A command does one thing today, open an app. Hark looks for it in six folders and gives it 15 s to come to the front. A miss is named in the log, as app_not_found, app_not_activated, action_timeout and others. Chapter 7 makes every list here yours, and tells why a model does not make this call.

The name the model cannot spell

The detail from the start of this document is a design problem. "Hark, …" has to reach the assistant, and the word is not in Whisper's vocabulary.

A bench measured it before any rule: 300 synthesized requests, 1,216 decodes on the Small model. English voices saying "Hark, …" came back as "Hark" 45 times in 100. French voices, once in 100, and as "arc" 27 times. "Hey Hark" in French: 0 of 50. In a live check, a French accent turned "Hark" into "Arc" even in an English sentence.

The name, as Whisper writes it Left: how often Whisper wrote Hark exactly, 45 of 100 English clips, 1 of 100 French clips, 0 of 50 French clips with Hey Hark. Right: Jaro-Winkler against hark with a 0.85 threshold misses arc at 0.72 and catches hard at 0.88 and ark at 0.92. Below: the decision, an exact list of spellings. Hark written exactly synthesized voices · Small English, 100 clips 45 French, 100 clips 1 Hey Hark, French, 50 0 Jaro-Winkler, against hark threshold 0.85 arc 0.72 missed hard 0.88 caught, wrongly ark 0.92 caught An exact list: hark · arc · ark arke on main, not yet released
The name, as Whisper writes it.

A fuzzy rule fails both ways. Against "hark", "arc" scores 0.72 and is missed, while "hard" (0.88) and "ark" (0.92) pass. Against "arc", "marc" and "parc" score 0.92. The vocabulary prompt from chapter 3 did not rescue it. When the prompt failed, Whisper mostly left the word out, and a missing prefix cannot be matched at all.

So the name is a list, matched exactly after normalization. A greeting may come before the name, but a greeting alone does nothing. The name must end where a word ends, so "Arc-en-ciel", rainbow, and "Hark's" stay dictation. No comma is required: of the 28 French requests where Whisper wrote the name at all, 18 had no comma after it. This is the block 0.0.4 ships:

assistant:
  prefix: [hark, arc, ark]
  greetings: [hey, hello, salut]

"arke" joins the list on main, not yet released, after a live check. A sentence that really starts with "Arc" goes to the assistant, and that cost is accepted.

Text is the default. A command has to prove itself.

Chapter 5: Delivery

The running example is text now. It has to land at the caret, in an app Hark does not control.

macOS offers no general way to type into another app's field and know it worked. This chapter is the coral step, the one that delivers and checks.

Three ways in, tried in order

The sentence appears at the caret in the Mail draft. Half a second later, your clipboard is as you left it. Three routes stand behind that, and the focus read at key down picks the first:

A set that timed out is the opposite risk, since the app may still apply it. That text goes to the clipboard as insertion_timeout, never typed twice.

Field, paste, or clipboard with a reason The focus is known at key down. Hark tries an Accessibility insert and reads it back; if nothing moved, it pastes; if no app reads the paste within 1 s, the text goes to the clipboard with a reason. The running example, a Mail draft, goes straight from the focus to the paste. The log line ends as text_inserted or text_clipboard. Focus at key down Mail · draft body · value settable Accessibility insert set the selection · read it back native text fields nothing moved Paste a pasteboard promise · ⌘V Mail drafts, terminals, Chromium, Electron, Firefox, JetBrains not read in 1 s Clipboard with a reason · a notification no field · password field a set that timed out running example the log line text_inserted text_clipboard
Field, paste, or clipboard with a reason.

Some apps always get a paste: terminals, Chromium browsers, Firefox, JetBrains IDEs, Electron apps such as Slack and VS Code, and any app that embeds Chromium.

In Chromium and Electron apps, an unknown focus most likely means a web field, because their Accessibility tree is off. In a native app it means nothing has focus, and a paste would land nowhere, so the text goes to the clipboard. Chapter 7 shows how to override the choice for any app.

The running example carries a late discovery. Mail's draft body is a web area that answers no selected text. Until 0.0.4, Hark counted it as no field, and every dictation into a Mail draft went to the clipboard as no_text_field. Now a web area whose value can be set counts as a field, and gets a paste.

One guard runs last, right before the text is sent. If the app in front changed since key down, the text goes to the clipboard as focus_changed. The route itself is a menu in Settings:

Settings, General tab, Dictation section: insertion method, clipboard fallback, live transcript and lower other audio
Settings › General, Dictation. Automatic insertion, Accessibility then a paste, with the clipboard fallback on. Other audio lowered, and a notification with sound. The live transcript is on here, off by default. The three ways in, one menu.

The paste that counts only when it is read

You copied a link before you spoke. After the sentence lands in Mail, the link is back on the clipboard. Keeping that promise took a second design.

No API tells an app when another app has consumed a paste. The first version restored the clipboard on a timer. A code review found the flaw: a slow app could paste your old contents, the text was lost, and the log still said text_inserted.

Hark now keeps a copy of your clipboard. It writes the text as a pasteboard promise, clipboard data supplied only when an app reads it. A transient marker makes clipboard managers skip it. Then Hark posts Command-V. The paste counts only when an app reads the promise, which it does as it handles Command-V, in milliseconds. Your contents come back 500 ms after that read, and only if the clipboard still holds Hark's write. Anything newer is yours to keep.

A paste that counts only when it is read Three lifelines: Hark, the pasteboard and Mail. Hark keeps a copy of the clipboard, writes the text as a transient promise, and posts Command-V for the current keyboard layout. Mail reads the promise in milliseconds, which tells Hark the text is inserted. 500 ms later Hark puts the old contents back. With no read within 1 s the line says paste_not_consumed and the text stays on the clipboard. Hark delivery Pasteboard your clipboard Mail your draft keep a copy of yours write a promise · transient ⌘V · this keyboard layout reads it · in milliseconds read: text_inserted 500 ms later: yours back no read within 1 s: paste_not_consumed · the text stays on the clipboard
A paste that counts only when it is read.

Hark treats no read within 1 s as no read at all. The line says paste_not_consumed, and the text stays on the clipboard instead of your old contents. The restore waits while the pipeline is already idle, so it costs the next sentence nothing.

Command-V depends on the keyboard. Hark posts it with the key code that the current layout gives V. The risk is real: during testing, a test script's Command-A, built from the US key code for A, pressed Command-Q under AZERTY and quit TextEdit. Local keyboard events are held back while the keys are posted, so a key you still hold does not mix in.

Small courtesies

The rest is detail, and each detail came from a failure:

Two exits, never ambiguous: the field, or the clipboard with a reason. Unless you turn the fallback off, nothing you said is lost.

Chapter 6: Ask Hark

Chapters 2 to 5 never wait on a language model. That rule came before Ask Hark existed, and Ask Hark keeps it: the model runs outside the process.

An ask is one gesture: select text, say what you want done with it, then choose what to keep. A companion example runs through this chapter, in Notes. Select a short paragraph about a meeting, press the Ask key, say "Turn it into a bulleted list.", and press Return.

Three ways to ask

An ask starts in one of three places:

Services came first. Offered by macOS on selected text in every app, it is the only public route into another app's text menu, and AppKit draws the item itself.

The Ask key reads the selection before the microphone opens. Accessibility answers first, in 0 to 2 ms on this Mac. Where it returns nothing, in web page text, Mail, Chromium and Electron apps, Hark sends Command-C, waits up to 250 ms, then puts your clipboard back. That copy has a cost: in a Chromium-based app with nothing selected, the microphone opened 278 ms after the press, not yet fixed. Never in a password field. Never in editors whose Command-C copies the whole line, such as VS Code, where a question would become an ask about a line of code.

With the Ask key or Services, the words are an instruction from the press, never matched as a command or typed at the caret. The HUD stays hidden, and the Ask panel shows the listening state instead.

Ask Hark panel listening for a spoken instruction about the selected text
Ask Hark on a selection. A red microphone, the sample paragraph in two lines, Listening… and the hint to say what to do, then press Return. Cancel, or Done. The selection has not left Hark yet.

A model next door

Whisper lives inside Hark. The language model does not. It runs in a separate server that speaks the OpenAI-compatible chat API, on this Mac by default, at 127.0.0.1:8000/v1. Hark never starts or stops it, and its memory is not Hark's. That boundary is the memory decision behind Ask: the largest thing an ask needs lives in a process you start, size and stop. On this Mac, the server runs a 27-billion-parameter model on port 8002.

While you speak, GET /models checks the server, in about 5 ms on this Mac. A closed port refuses in 0.1 ms, so a stopped server says so before your instruction is spent. Then one streaming request goes out. A hand-written parser reads the reply as server-sent events (SSE), text lines over one HTTP response. Each update carries the whole text so far. Only the newest is kept, so a slow screen drops frames instead of queueing them.

Cancel closes the connection, which makes the server stop writing. After a cancel, the next ask's first word came in 799 to 832 ms, against 806 ms on an idle server, so nothing kept running.

One request out, one stream back Hark, one process, holds the Ask panel, a language client with a hand-written SSE parser, and a key read from the Keychain per request. A separate model server on this Mac exposes an OpenAI-compatible API, serves a 27B model and keeps its own log. Between them, a model check while you speak, answered in about 5 ms, one streamed chat request, the first word in 0.7 to 1.0 s, then 25 to 36 tokens a second, and a cancel that closes the stream. Hark one process Ask panel listen · wait · review Language client URLSession, one stream hand-written SSE parser keeps the newest text Keychain the key, per request Model server separate process not Hark's memory OpenAI-compatible /v1/models /v1/chat/completions streamed A 27B model on this Mac, port 8002 Its own log not Hark's file GET /models, while you speak about 5 ms POST chat, one stream first word in 0.7 to 1.0 s then 25 to 36 tokens a second cancel: close the stream 127.0.0.1 by default · https for any other host · no redirect
One request out, one stream back.

The rules are flat. Plain http goes only to this Mac, https anywhere else, and no redirect is followed. The key comes from the login Keychain on each request. It is never in commands.yaml or the log. Timeouts: 2 s to connect, 15 s of silence before the first word, 60 s in all. A server off this Mac is possible, and the Ask panel then names its host.

Settings, Ask tab: a server address on this Mac and a key saved in the Keychain
Settings › Ask, its Server card. The address, http://127.0.0.1:8002/v1, on this Mac, not the default port 8000. The API key, Saved, in the login Keychain and never shown again. The server next door.

Waiting, then writing

After Return, the Ask panel says Thinking…, then the answer arrives line by line. The first word, the time to first token (TTFT), waits on the server reading the prompt. The rest arrives at the rate the model writes.

Ask Hark waiting for the model server at 127.0.0.1:8002 Ask Hark with a bulleted answer arriving line by line
Waiting, then writing, under the sample instruction as the title. Above, after 3 s of Thinking…, the Ask panel names the server, 127.0.0.1:8002. Below, the answer arrives, its last line cut short. Two latencies, two states.

The numbers come from this Mac and its 27-billion-parameter model, 10 asks run 3 times each, with thinking, the model's reasoning pass, off. The server's first chunk came back in a median 1.8 ms. The first word took 0.7 to 1.0 s for a typical ask, 837 ms as the median of all 30 runs.

The model then wrote 25 to 36 tokens a second, and the median ask took 3.59 s in all. The prompt is read at 263 to 355 tokens a second, so a 3,000-token selection waits about 8 to 11 s before its first word.

The first word, then the rest A timeline of an ask with thinking off, medians of 30 runs: the server's first chunk at 1.8 ms, the prompt read until the first word at 837 ms, then writing at 25 to 36 tokens a second until the last word at 3.59 s. With thinking left on, no word came until 7.4 s, off this scale. An ask thinking off, medians first chunk · 1.8 ms reading the prompt writing · 25 to 36 tokens a second first word · 837 ms last word · 3.59 s Thinking on one case, 3 runs no word until 7.4 s 0 s 1 s 2 s 3 s 4 s 10 asks, 3 runs each · at most 1,024 tokens · a 27B model on this Mac
The first word, then the rest.

The gap between the first chunk and the first word is why Thinking… is a state of its own. For scale, a 5.7 s sentence needs about 100 to 110 ms after key up, a sum of parts never measured end to end.

Two defaults come from the same measurements. Thinking stays off: left on, the first word came at 7.4 s instead of 0.9 s. The temperature is 0.3. At the server's default of 1.0, one politer rewrite invented a request the text never made.

Nothing changes until you choose

The answer ends complete and editable. Cancel, Copy, or Replace with Command-Return. Until then, nothing in Notes has changed.

Ask Hark panel with a finished bulleted list and Cancel, Copy and Replace buttons
The answer, complete and editable: three bullets, the last one now whole. Then Cancel, Copy, or Replace, ⌘↩, the only button that touches Notes. Nothing changes until you choose.

Replace is guarded. Hark brings the caller back and waits up to 600 ms for its focus to settle, since Safari briefly reports none. It reads the selection again and compares words, not white space, which each route reports differently. If the app or the selection changed, the answer goes to the clipboard as selection_changed. Otherwise it goes in as a dictation would, through the same inserter and fallbacks as chapter 5.

The prompts are rules, fixed in code, and the selection is data, never instructions. The answer keeps its language, its tone, and its tu or vous, and adds or removes nothing unless asked. The assistant says in one sentence when a request needs mail, a calendar, files or the web.

In the Mail draft from the start of this document, with nothing selected, press the Ask key and say "Write an email to decline Thursday's meeting." A text field had focus, so Insert is offered. Without one, only Copy.

Assistant draft declining Thursday's meeting, with Cancel, Copy and Insert The same draft with only Cancel and Copy
The Ask key with nothing selected, the sample request as the title. Above, with a text field in focus: Cancel, Copy, Insert. Below, with none: Cancel and Copy. One answer, two contexts.

A stopped server is one sentence in the Ask panel, with Retry, and Copy Instruction keeps the spoken words.

Ask Hark panel saying the model server is not running at 127.0.0.1:8002, with Cancel, Copy Instruction and Retry
A stopped server, under the sample instruction. One sentence names the address, 127.0.0.1:8002, and what to do. Then Cancel, Copy Instruction, or Retry. Dictation never waits on this panel.

The model can be slow, wrong or stopped. None of that reaches dictation.

One more detail. The model server on this Mac keeps its own log, and its preview of each request holds the first 23 characters of the message. Hark opens every request with a fixed line longer than that, so the preview never holds a word you said. Hark's own log keeps the spoken instruction, the model's name and its time. It never keeps the selection or the answer.

Chapter 7: commands.yaml

Every chapter so far named a default: a key, a model, a verb list, a server. Here each becomes yours.

Each change has a cost. The same key types your words, runs your commands and reaches Ask Hark, so every new option is also a new way to misfire. Three habits keep that in check: a strict grammar where fuzzy matching would catch ordinary speech, a measurement before each rule, and a gesture wherever a guess would be wrong often enough to hurt.

Where your changes live

You shape Hark in three places. Gestures say what you want before you speak: three keys, each rebindable, and a tap or a hold. One readable file, commands.yaml, holds your rules: verbs, apps and their nicknames, per-app typing rules, the assistant's name, model servers. A few switches in Settings cover the rest.

Three surfaces you shape, three stores behind them Three teal surfaces: gestures (three keys, tap or hold), a few switches (Settings, seven tabs) and one file (commands.yaml). The keys and the switches are kept in the app's defaults, one key each. The switches also write API keys to the Keychain, a guarded store. The file lives in Application Support and is reloaded when saved, and the Commands and Ask tabs write it too. Yours to shape three surfaces, each with its store Gestures three keys tap or hold A few switches Settings, 7 tabs mic · model · language One file commands.yaml verbs · apps · servers The app's defaults one key each Keychain API keys, nothing else Application Support reloaded when saved Settings writes it too
Three surfaces you shape, three stores behind them.

Behind them sit three stores: the file for rules, the app's defaults for the switches and key chords, one entry each, and the Keychain for API keys alone. For commands and the Ask server, Settings edits the file and does not own the state.

One file, the source of truth

Open commands.yaml in any editor, change a line, save. The next sentence uses it. Hark watches the file and its folder, so an editor that saves by renaming a new file into place is still seen. Changes settle for 100 ms, and a save that changes nothing is ignored.

A file edited by hand will hold a typo one day. It never breaks Hark. The parser is strict: no YAML anchors, which let a small file expand without bound, yes read as text rather than as true, no unknown keys, 256 KiB at most. An error names the line and the column, and for a misspelled key, the one you probably meant. The last good version stays in force, and the menu bar icon shows the error.

A broken edit never breaks Hark You save the file from any editor or from Settings. Hark watches the file and its folder, lets changes settle for 100 ms, then parses strictly. A valid file goes into force and is copied as the last good version. An invalid one leaves the last good version in force, and the icon shows the line, the column and a hint. A write from Settings is refused if the file moved meanwhile. You save any editor, or Settings Settings writes refused if the file moved Watched the file and its folder Settled 100 ms · same bytes: nothing Parsed strict · no anchors · no unknown keys valid invalid In force copied as the last good version Last good stays in force icon warns · line, column, a hint cold start with a broken file: the last good copy, else no commands
A broken edit never breaks Hark.

A cold start with a broken file uses the last good copy. With none, Hark runs with no commands, never the bundled defaults, which could bring back a command you deleted. Settings cannot overwrite a hand edit either. Each write names the version it was based on, and is refused if the file moved meanwhile.

The Commands tab is the same file, shown as a table.

Settings, Commands tab: apps with their aliases, and the lists of opening verbs, skipped words and polite endings
Settings › Commands, scrolled past its intro: each app and its other names (note, calendrier, musique), then opening verbs, skipped words, polite endings. The endings and app, appli, application are on main, not yet released. Chapter 4's grammar, as a table.

The tab shows the verb and word lists but does not edit them. They, and the rest, are edited in the file, as in this excerpt:

version: 3
defaults:
  threshold: 0.85
apps:
  com.sublimetext.4: { insert: paste }
# on main, not yet released
endings:
  en: [please]
  fr: ["s'il te plaît", "s'il vous plaît"]

The apps: line sends one editor to paste. Upgrades respect your edits too: only a default file nobody touched, recognized by its hash, is replaced at launch, and a fix on main extends this to the files of 0.0.3 and 0.0.4.

What each option costs

Earlier chapters measured these costs. Vocabulary helps a word the model has not learned and hurts one it already writes, as chapter 3 showed. Each spelling added to the assistant's name is a word that can no longer start a dictation, as chapter 4 showed. The apps: list overrides chapter 5's built-in routes both ways: to a paste, to Accessibility, or to the clipboard. Someone who will not grant Accessibility can choose Clipboard only, and the missing grant becomes a warning, not an error.

What stays fixed, on purpose

Some freedoms were weighed and turned down:

Why a model does not decide

The idea was one key for everything, with a model on the Mac deciding whether a sentence is text, a command or a request. It was probed on 29 September 2026 on this Mac: a small on-device classifier, through Core ML.

Speed was never the problem. It answered in milliseconds, and it was right on most of a set of test sentences, half English and half French.

The replay changed the plan. Over 128 logged dictations into text fields, from two days on this Mac, it would have sent 28 away from typing with a confidence of 0.7 or more, 22 percent. The labels came from what happened, so they are approximate. From the words alone, the same sentence is dictation in one app and a task in another.

A guess from the words, or a gesture Left, a classifier probed on this Mac: milliseconds per answer and right on most test sentences, yet 22 percent of 128 logged dictations into text fields sent away from typing. Right, what ships: the dictation key, the Ask key and the spoken name, each saying what you want. A model guesses from the words probed, then set aside Milliseconds per answer on this Mac, through Core ML Right on most test sentences English and French 22 percent sent away 28 of 128 logged dictations The gesture says it what ships Dictation key text, or a verb and an app Ask key a selection, or nothing "Hark, …" an exact list of spellings a small classifier · Core ML · this Mac, M5 Pro, 64 GB · confidence 0.7 or more
A guess from the words, or a gesture.

The design was set aside the same day. Routing stays an open question, to be rethought from a signal other than the words. A language model in front of every sentence had already been refused, for the 0.3 to 0.6 s it would add to each. Today the gestures route.

Fast is not the same as right. Like the drill from the start of this document, Hark does the job you picked it up for, never one it guessed.


Appendix A: Methodology and measurements

Main tool: one Swift package, in Swift 6 language mode, with strict concurrency and warnings as errors. scripts/bundle.sh builds and signs the app, runs its self-test, and with --install installs it.

Appendix B: The problems, by date

Between 21 and 29 September, fifteen problems shaped Hark. Here they are in the order they were met:

Appendix C: The project's diagrams

These diagrams come from the project's documentation and open full size from their link. The first two and the last are older than the figures above; their captions give their date and what has changed since. The five in between are redrawn from the code of Hark 0.0.4.

Data-flow diagram: Hark as one process inside the Mac, with the microphone, the user, the app in front and notifications, and huggingface.co outside
The data-flow diagram, level 0, drawn on 28 September 2026, before Ask Hark. The dashed line is the Mac, and only the model download crosses. The model server of chapter 6 adds a second flow, on this Mac by default.
Layered architecture of Hark, from the SwiftUI app down to Metal, Core ML and the Neural Engine
Hark layer by layer, drawn on 28 September 2026, before Ask Hark: SwiftUI on top, chapter 1's seams, Metal below. Its Neural Engine encoder is off by default. Since then: an asking state, a seventh tab, a second network peer.
Diagram: the talk and Ask keys reach PipelineController, which probes focus, starts AudioCapture and drops captures too short or too quiet.
From the key to the samples, redrawn from the code of Hark 0.0.4. Both keys reach one controller, the Ask key after reading the selection. Dictation probes the focus at key down, and the microphone is open only from start to stop. Raw audio reaches disk only in debug builds.
Diagram: the samples pass through SwappableTranscriptionEngine into the Transcriber's four steps; PipelineReducer then picks idle, asking or the resolver.
From the samples to the transcript, redrawn from the code of Hark 0.0.4. The samples reach the engine without entering the reducer's state. whisper.cpp runs on Metal by default: a 5.7 s clip on Small, 76 ms, against 83 ms with the Core ML switch on.
Diagram: commands.yaml is watched by DispatchFileWatcher and parsed by ConfigStore, which feeds ResolutionSettings, AskSettings and HealthStatus.
commands.yaml, the file you write, redrawn from the code of Hark 0.0.4. One actor re-reads it after each save, and the app hands each part to the code that uses it. A broken file never replaces the last good one, and Settings never writes over a newer edit.
Diagram: Settings › Model drives DownloadCoordinator and ModelStore; URLSessionDownloader fetches pinned files from huggingface.co for the Transcriber.
The models you choose, redrawn from the code of Hark 0.0.4. Nothing downloads until you click, every file is checked against a pinned SHA-256, and the Core ML encoder comes only with its switch on. This downloader is one of two network clients; Ask's is the other.
Diagram: PipelineController appends one line per utterance through UtteranceLog; LogReader feeds the panel and Settings › Log; LogHistory deletes them.
The log Hark keeps, redrawn from the code of Hark 0.0.4: one line per utterance, 13 keys, a folder at 0700 and files at 0600. The panel and Settings › Log read it back, and Clear History, offered in both, deletes it.
Deployment view of the Mac: SSD files, macOS services, the Hark process and the CPU, GPU and Neural Engine
One process on one Mac, drawn on 28 September 2026: files on the SSD, daemons in macOS, work split across CPU, GPU and Neural Engine. Drawn before Ask Hark, so the model server and its Keychain item are missing.

Glossary

References