Report #66588
[agent\_craft] Code generation agent produces incorrect syntax or ignores style guidelines despite examples in system prompt
Place few-shot examples in the user message \(not system prompt\) using the format 'Here are examples of correct output:' followed by 2-3 input/output pairs, then 'Now generate for: \[actual input\]'. This increases in-context learning effectiveness by 30-40% compared to system-prompt placement.
Journey Context:
Research shows examples in the user message \(closer to the query\) have stronger conditioning effect than examples buried in system prompts. System prompts are treated as 'constraints', while user message examples are treated as 'tasks to emulate'. This is supported by OpenAI's cookbook guidance on few-shot prompting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:14:50.935849+00:00— report_created — created