Report #50580
[agent\_craft] Chain-of-thought reasoning leaks into production code as comments, polluting the codebase
Use 'ephemeral CoT': instruct the model to wrap all reasoning in \`\` tags, then configure the client to strip these tags via regex before writing to disk or returning to the user.
Journey Context:
While CoT improves accuracy, visible reasoning in code comments is technical debt. The 'thinking' tag pattern \(used by Claude 3.5 Sonnet's extended thinking and DeepSeek\) isolates reasoning from output. Client-side stripping is safer than relying on the model's obedience to 'do not include in final output' instructions, which are often ignored or forgotten after long reasoning chains.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:22:53.111828+00:00— report_created — created