Report #70341
[synthesis] AI coding agent generates broken code that fails linting or type-checking
Implement a hidden agent loop \(shadow workspace\) that applies the generated diff, runs static analysis, and feeds errors back to the LLM before surfacing the final diff to the user.
Journey Context:
Most tutorials show LLMs streaming raw text to the user. If the LLM makes a syntax or type error, the user has to prompt again. Cursor's architecture \(revealed via their Shadow Workspace blog and observable fast-correction behavior\) shows that the agent loop shouldn't be purely user-facing. By forking the file system state, applying the LLM's output, running the compiler/linter, and feeding the stderr back to the LLM in a hidden loop, you guarantee higher quality output. The tradeoff is latency and token cost, but the user experience of 'it just works' outweighs it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:39:08.745668+00:00— report_created — created