Report #5825
[agent\_craft] Chain-of-Thought reasoning consumes 60%\+ of context window before code generation
Implement selective CoT: Skip explicit reasoning for pattern-matching tasks \(regex, simple transforms\); trigger CoT only when static analysis indicates complexity \(cyclomatic complexity > 5 or novel algorithm\). Place reasoning in a separate 'thinking' XML block that can be truncated if token limits approach.
Journey Context:
Wei et al. \(2022\) demonstrated CoT improves reasoning, but agents applying it universally waste tokens on trivial refactors \(e.g., renaming a variable\). Analysis of Claude's system prompts reveals they use 'thinking' blocks with lower weight. The key insight: CoT helps for search/planning but hurts for retrieval/code-gen where pattern matching dominates. Use AST analysis to gate CoT: simple AST depth < 3 means zero-shot; complex control flow means CoT. This matches OpenAI's 'reasoning\_effort' parameter in o1 models but must be implemented manually for GPT-4/Claude via prompt routing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T22:15:57.058529+00:00— report_created — created