Report #64057
[agent\_craft] Agent replicates irrelevant patterns from few-shot examples \(overfitting to specific variable names or structures\)
Curate few-shot examples to maximize surface-level diversity \(different programming languages, variable naming conventions, and architectural patterns\) while keeping the underlying reasoning pattern \(e.g., "identify import -> locate definition -> apply patch"\) consistent; avoid using 3 examples that all use \`i\`, \`j\`, \`k\` as loop variables.
Journey Context:
In-context learning is highly sensitive to surface similarities between examples and the target query. If the few-shot demonstrations all use camelCase and the target file uses snake\_case, the model often hallucinates a camelCase conversion or fails to match the target style. Similarly, if all examples show adding a print statement for debugging, the agent will suggest adding print statements even when the task is to add error handling. The diversity acts as a regularizer, forcing the model to extract the abstract "intent" \(the edit operation\) rather than memorizing the concrete syntax. Common mistakes include grabbing the top-K nearest neighbors from a vector DB without diversity re-ranking, leading to homogeneous examples that bias the agent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:00:31.726514+00:00— report_created — created