Problem Framing: Three Kinds of Voice Input in a Code Editor
Separates commands, dictation and code generation, because each one has a different latency budget, accuracy target and failure cost.
Why voice coding is a different problem
A voice-driven code editor lets a developer change code by speaking. The obvious framing, speech to text and then insert the text into the buffer, fails for three reasons. Source code is not English prose, so generic recognisers mangle identifiers. A single misheard word can change program behaviour. And a developer who works with a keyboard notices any pause longer than a few hundred milliseconds, so the system has to answer faster than a person would in conversation.
Three kinds of speech
The design becomes manageable once the input is split into three classes.
- Commands. Examples: 'go to line 25', 'select next argument', 'rename this to parse input'. The vocabulary is closed and short. The response must land within about 350 ms to feel immediate. A misheard 'delete line' can destroy work, so destructive commands need a confirmation path.
- Dictation. Examples: comments, docstrings, string literals and spelled-out identifiers. The vocabulary is open and utterances are longer. A user tolerates a delay of roughly half a second for partial text, and a little more for the final text.
- Generation. Example: 'write a function that retries the request with jittered backoff'. The output is open-ended, needs the surrounding code as context, takes seconds, and must be previewed as a diff before it touches the buffer.
Each class has its own latency budget, accuracy target and failure cost. A design that sends all three through one chat box fails the command case, which is the one developers use most.
What makes it hard
- Identifiers are out of vocabulary. A project symbol such as parseHttpHeader3 is absent from any general language model. The recogniser needs contextual biasing built from the symbol table of the open workspace.
- Spoken formatting is ambiguous. 'camel case user id' must become userId in code, while 'user id' inside a comment stays two plain words. Formatting rules must depend on the cursor's syntactic position.
- Accuracy varies by speaker and by room. Average word error rate hides the failures that matter. Accuracy has to be measured per speaker group and per acoustic condition.
- Edits are stateful. 'Rename this' refers to whatever the cursor was on when the user started speaking. The system must snapshot the cursor, selection and document version at utterance start, not when recognition finishes.
Scope of this design
We design the path from microphone to a verified edit in the buffer: audio capture, recognition, interpretation, editor integration through the Language Server Protocol, accessibility controls and source-code privacy controls. We do not design a general voice assistant, a new IDE, or a model training platform. Scale numbers used in later sections are labelled as assumptions, because no public source reports the traffic of a voice coding product.
The one-line answer to the interviewer
Split the input by intent, keep the command path local and grammar-driven, send only the open-ended work to cloud models, and make every edit a versioned, previewable operation against the language server.
Key Highlights
- •Three speech classes (commands, dictation, generation) with different latency and failure budgets
- •Command responses target under 350 ms p95 because the command set is closed and runs locally
- •Identifiers need contextual biasing from the open workspace symbol table
- •Edits snapshot cursor and document version at utterance start, not at recognition end
- •Scale figures are labelled assumptions; no public source reports voice coding traffic
Section Rescue Kit
Buzzwords to use:
Safe statements:
- "Let me separate the three kinds of speech first, because each one has a different latency and accuracy target."
- "The command path is the one users feel most, so I will design it to stay local even when cloud models exist."
- "I will state my scale numbers as assumptions and then show how each one changes the design."