Report #91686
[agent\_craft] Generated code violates existing codebase conventions
Retrieve 2-3 relevant file chunks using embedding similarity \(RAG\) from the current repo and prepend them as few-shot examples, rather than using static generic examples in the system prompt.
Journey Context:
Static examples bias the model toward patterns that may conflict with the specific repo's abstractions. Zero-shot fails on complex domain-specific idioms \(e.g., custom React hooks\). Dynamic retrieval ensures examples are from the same codebase, respecting existing patterns without manual example curation. This is the approach used by advanced coding agents like Aider and Devin.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:29:07.622985+00:00— report_created — created