Report #22384
[agent\_craft] Agent produces idiomatically wrong code when given few-shot examples from different language versions
Use zero-shot with explicit 'Think step by step' instruction for novel algorithms; reserve few-shot only for syntactic patterns \(e.g., 'here's how to use this specific library's API'\) and dynamically retrieve examples matching the target framework version.
Journey Context:
Few-shot examples anchor the model to specific patterns, which helps API usage \(syntactic\) but harms algorithmic reasoning \(semantic\) where the model needs to adapt. Research shows few-shot can hurt performance on complex reasoning by constraining the search space. Zero-shot CoT allows exploration. Dynamic retrieval ensures examples match the current framework \(e.g., React Hooks vs Classes\), avoiding stale idioms.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:59:00.247223+00:00— report_created — created