Trade-offs & Decisions
Key trade-offs across streaming speech recognition, incremental AST mutation, and Figma plugin IPC.
Latency & Debounce
Streaming Intent Parsing vs. Batch Processing
Waiting for someone to stop speaking before transcribing adds 1.2 to 2 seconds of latency before any canvas feedback appears. For interactive layout editing, this delay interrupts creative work.
We feed 250ms partial audio chunks directly to the parser. When parsing confidence exceeds 0.85, the mutation executes immediately. If confidence falls below that threshold, the system buffers the intent until the next chunk clarifies it.
Speakers often correct themselves mid-sentence ("Make the card blue, no, dark slate"). Because mutations pass through the in-memory buffer before dispatch, the engine overwrites pending properties before sending the final WebSocket packet to Figma.
Data Model
AST Buffering vs. Full-Screen Regeneration
Full-Screen Regeneration
Generating entire mockups from scratch works well for initial brainstorming, but fails during iterative design. A request to adjust button padding will frequently re-render the whole screen, changing unrelated typography and rearranging neighboring blocks.
Semantic AST Buffering
Dizzy keeps an in-memory JSON tree of the document. Spoken commands mutate only the targeted node's attributes (such as padding, layoutMode, or fill color). Neighboring layers, component instances, and manual tweaks stay preserved.
// 1. Initial Document State
{ id: "frame_hero", type: "FRAME", padding: 16, layout: "VERTICAL" }
// 2. Spoken instruction: "Increase padding to 32px"
// 3. Parser identifies target property delta:
{
"op": "REPLACE",
"target": "frame_hero",
"path": "padding",
"value": 32,
"previous": 16
}
// 4. Figma Plugin updates the live node:
const node = await figma.getNodeByIdAsync("frame_hero");
node.paddingLeft = 32;
node.paddingRight = 32;
node.paddingTop = 32;
node.paddingBottom = 32;Figma Plugin Bridge
Batching Updates to Avoid UI Jitter
Figma's plugin sandbox runs on the main application thread. Executing fifty individual property assignments across multiple frames causes visible frame drops and canvas stuttering.
Dizzy's diff engine coalesces multiple property updates into a single transaction per animation frame. The local WebSocket bridge sends one structured payload, and the plugin applies all mutations within a single synchronous pass before relinquishing thread control back to Figma.