Report #13666
[agent\_craft] Agent ignores existing code style and import patterns when generating patches zero-shot
Prepend 2-3 exemplar edits \(few-shot\) showing the exact diff format and import style from the target repository before requesting new edits; move style guidelines from the system prompt into these concrete examples.
Journey Context:
Zero-shot instructions like 'match existing style' are too abstract for syntax-level fidelity because the model lacks grounding for specific indentation, quote style, or architectural patterns. Few-shot examples act as anchors that bind the pattern to concrete syntax trees. The tradeoff is token cost versus accuracy; studies on code models show that 2-shot examples reduce style violations by 40-60% compared to zero-shot with explicit rules. This differs from fine-tuning because the examples are retrieved dynamically from the current repository context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:19:42.112763+00:00— report_created — created