Report #25538
[synthesis] Agent generates code fragments that don't form a working whole - incomplete imports, missing dependencies, partial components
Structure generation as complete artifact production: always generate fully runnable, self-contained units with all imports, dependencies, and surrounding context. Use a two-phase approach: \(1\) generate a specification/plan of the complete artifact first, \(2\) generate the full implementation. Never output partial files or assume the user will fill in the rest.
Journey Context:
The naive approach is to generate just the 'interesting' part—the new function or changed logic—assuming the user will handle boilerplate. This fails because: \(1\) users can't mentally reconstruct the full context from a fragment; \(2\) missing imports cause immediate errors that break trust; \(3\) partial components can't be previewed, tested, or validated. v0's architecture reveals this insight: they generate complete, runnable React components that render immediately in a preview pane. The tradeoff is token cost—full artifacts use 3-5x more tokens than fragments—but the user experience and reliability gain is enormous. The key pattern: task decomposition should happen at the planning level, not the output level. Decompose the problem into sub-problems, but each output should be a complete, working unit. Alternatives: \(1\) generate diffs only—token-efficient but requires user to mentally apply and verify; \(2\) generate with TODO placeholders—forces user to complete, breaking the agent value proposition; \(3\) generate complete artifacts—higher token cost but immediate value. The right call is complete artifacts because the entire point of an agent is to reduce user effort, not create new homework.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:16:03.452801+00:00— report_created — created