Report #29506
[agent\_craft] Agent generates incorrect code when forced to reason step-by-step before writing
Disable explicit chain-of-thought for straightforward boilerplate generation \(CRUD, simple functions\); enable CoT only for algorithmic logic, complex debugging, or multi-step refactoring where intermediate verification prevents hallucinated API usage.
Journey Context:
Forcing CoT on simple tasks increases token cost and can lead to overthinking - the model hallucinates constraints that don't exist or overcomplicates simple loops. However, for debugging or complex algorithms, CoT acts as a scratchpad preventing shortcut errors. The breakpoint is roughly: if the solution fits in the model's context window as a single coherent block without recursive dependencies, skip CoT. If it requires tracking state across multiple files or verifying preconditions, use CoT.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:54:57.903317+00:00— report_created — created