How I built a narrator for my desktop AI companion: 1 sentence, 180 characters, and a 3-second budget
Ankita AI is the desktop AI assistant I'm building — a little companion that lives on your desktop and gets things done while you're away. I built it because a voice assistant that goes quiet for a minute while it works is indistinguishable from one that died. The fix sounds simple: narrate what it's doing. The hard part is that every obvious way to do it lies.
A canned line — "Working on it…" — lies by omission: it says the same thing whether the job is running, stuck, or waiting on a permission. A model-written update lies by commission: give a model a tool transcript and it will cheerfully tell you the file is saved before the write has even started. So the narrator in Ankita is a separate, deliberately small model call with a prompt that is mostly rules about what it must not claim. The project site is at ankita-sable.vercel.app.
One sentence, and the budget that enforces it
The narrator lives in src/core/voice-narrator.mjs, behind createVoiceNarrator(). The constants are the whole design:
-
VOICE_NARRATION_TIMEOUT_MS— 3,000 ms. A progress update that arrives after the work is done is worse than silence, so the call is aborted at 3 seconds. -
NARRATION_MAX_CHARS— 180. One short, complete spoken sentence, not a tool transcript. -
NARRATION_MAX_TOKENS— 1,024 output tokens, including the model's mandatory reasoning. The test pins this explicitly: optional narration must not inherit the full file-generation budget. -
NARRATION_MAX_STEPS— 3. Only the three most recent observed steps go in. -
REQUEST_MAX_CHARS— 300. Enough of the task intent, without sending the conversation or memory again.
The prompt demands one complete sentence, preferably under sixteen words, at most twenty — and then spends most of its length on honesty rules. "Requested means preparation, not execution: permission or a shared resource may still be pending. Never say an action is underway until its started observation." A write_file saves directly to disk; it is not typing inside an app. A background run_command receipt only acknowledges submission: it does not prove an app is open or a process finished. Never invent a time estimate. And if there is no useful supported change, output an empty response.
What the model is allowed to see
The narrator never sees tool arguments. voiceActionContext() in src/automation/voice-progress.mjs builds the facts the model gets: the tool name, the basename of a target path, the program basename from a shell command — capped at 80 characters, shell expressions rejected by a SAFE_PROGRAM check. No file bodies, no full paths, no command arguments. Everything is passed through redactText() with the configured secrets first, and the previous update is sent along so the model can be told not to repeat it.
The test suite checks the boundary rather than trusting it. One test sends a write_file call whose arguments contain a private file body and a fixture API key, then asserts neither string appears anywhere in the request payload. Another test checks that a save followed by a launch is narrated as two distinct states — "Your poem is saved; I am launching Notepad." — with the run_command marked background: true and the secret argument stripped out. A third test covers the waiting case: a long task gets a generated waiting update, and a 503 from the provider returns an empty string. Failed narration stays silent.
Silence is the failure mode
That last point is the design decision I keep coming back to. Every failure path in the narrator returns '': HTTP error, empty content, an overlong sentence, a repeat of the previous update, a timeout, a request error. The wiring in desktop/electron/voice.mjs makes silence the default — progress() offers the narrated line into the speech queue, and if the line is empty no audio is prepared at all. The narrator runs alongside the tools, never in their critical path; the file's own comment says so.
I chose that because a spoken progress update is a claim about the world, and a wrong claim spoken aloud is harder to take back than a wrong line of text. A canned "Working on it…" can never be wrong, but it can never be useful either. The narrator bets the other way: say something specific, or say nothing.
The honest limits
The bet has holes, and they're worth naming. The honesty rules are prompt instructions, not verification — the model can still misstate state, just with a shorter leash. It sees only the last three steps and a 300-character slice of the request, so it can misattribute which step produced which result. Every update is a separate model call, which costs tokens and a round trip that the 3-second timeout can cut off — a slow provider means a quiet assistant. And the verification so far is three focused tests against a mocked fetch, not a live-provider run; the numbers above are the design's claims, not a benchmark.
Tell me I'm wrong: is a model writing its own progress updates a feature, or a lie generator with a 3-second budget? Would you trust a template that can never lie, even if it can never say anything useful either — or is one honest sentence, or silence, the right line?
— Krish Verma, creator of Ankita AI
Top comments (2)
The distinction that made this click for me is canned lines lying by omission versus model-written updates lying by commission — and your answer, a separate small model call whose prompt is mostly rules about what it must not claim, is the honest middle. The 3,000 ms timeout enforcing it is elegant: a progress update that arrives after the work is done is worse than silence, and you made silence the default instead of the failure.
The part I would steal for my own work is the receipts idea: write_file saving to disk is not the same as typing inside an app, and a background run_command receipt only proves submission, never completion. Naming that gap explicitly is what keeps the narrator honest, and your tests prove the boundary instead of trusting it — the private file body and fixture API key never appearing in the output is a test I wish more AI features had.
On your closing question, I would call it a feature with a lie-generator failure mode, which is exactly why the budget matters. One thing I am curious about: you send the previous update along so the model can be told not to repeat it — have you found the 16-word limit or the 3-second timeout harder to hold in practice when a task runs long and the narrator has to say something new every few seconds?
Good question — and honestly, the 3-second timeout is the harder one to hold. It's a hard abort: AbortSignal.timeout(3000) in createVoiceNarrator (src/core/voice-narrator.mjs), so any slow model response just becomes silence. The 16-word limit is softer than it looks — the prompt asks for "preferably under sixteen words, at most twenty", but the code only enforces the 180-character cap and the one-sentence cut; there's no word-count check. The model usually lands inside it because the prompt is mostly rules about what it must not claim.
The thing that surprised me on long tasks is that the pressure isn't really either limit — it's the novelty rule. Every call sends the previous update along and the prompt says "do not repeat the previous update", and the code rejects an exact repeat outright. The payload also stays bounded no matter how long the task runs (request capped at 300 chars, last 3 steps only), so the timeout doesn't get worse with task length — but on a long task with no real state change, the honest answer is usually silence, and the narrator takes it. The waiting update ("still working, I'll tell you when it's ready") is the escape hatch for exactly that case.
Caveat: I haven't instrumented which failure fires most often in real use — the diagnostics exist (onDiagnostic with request-error / invalid-length-or-repeat) but nothing counts them yet, so "timeout bites more" is my reading of the code, not a measured rate. And thanks for the "feature with a lie-generator failure mode" framing — that's the most accurate one-line version of it I've heard.