Report #74932
[agent\_craft] Code agent generating verbose reasoning before simple edits, wasting tokens and occasionally hallucinating non-existent execution paths
Disable chain-of-thought \(CoT\) for deterministic refactoring tasks \(renames, moves, type annotations\); use CoT only for algorithmic generation or complex debugging. Prefix the user prompt with 'Generate code only:' to suppress reasoning.
Journey Context:
Chain-of-thought prompting \(e.g., 'Let's think step by step'\) increases accuracy on mathematical reasoning but often degrades code generation for well-specified tasks by introducing 'imagined' runtime states or intermediate variables that don't exist. Studies show CoT can increase hallucination rates in code completion by 15-20% when the underlying model already knows the syntax pattern. The trade-off: CoT helps when the agent must invent logic \(e.g., 'write a regex'\), but hurts when the pattern is memorized \(e.g., 'add a null check'\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:22:12.503799+00:00— report_created — created