Report #29705
[synthesis] Free-form code generation produces inconsistent unrunnable output
Constrain the output space by anchoring generation to a known component library, framework API, or design system. Index available primitives first, then generate compositions of known building blocks—not free-form code from scratch.
Journey Context:
v0's breakthrough in UI code generation came not from a better base model, but from constraining output to shadcn/ui components plus Tailwind utility classes. This collapsed the search space from 'all valid React code' to 'valid compositions of ~50 known components with known props.' The same principle applies broadly: Perplexity constrains synthesis to retrieved source chunks; Cursor indexes the user's codebase to ground edits in existing patterns. Unconstrained generation forces the model to simultaneously invent architecture, naming, and logic—overloading its capacity. Tradeoff: constraining output limits novelty and may miss solutions outside the known set. But reliability gain is massive: generated code that composes known, tested primitives is far more likely to run. When no component library exists, extract one from the existing codebase first.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:14:59.218451+00:00— report_created — created