Report #16327
[agent\_craft] Agent uses single embedding model for both code and natural language queries
Use a hybrid retrieval system: sparse retrieval \(BM25/keyword search\) for exact symbol names and error strings, and dense retrieval \(embeddings\) for conceptual queries. Route queries accordingly.
Journey Context:
A common mistake is dropping an entire codebase into a vector database \(dense retrieval\) and querying it with natural language. Dense embeddings are terrible at exact keyword matches \(like a specific variable name \`process\_user\_auth\` or an error code \`ECONNREFUSED\`\). The agent will get semantically similar but useless chunks. The solution is a hybrid search pipeline. If the user query contains CamelCase, snake\_case, or exact error strings, route heavily to BM25/sparse retrieval. For 'how do I add a new user' queries, route to dense. This dramatically reduces hallucinations caused by retrieving the wrong reference code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:23:22.475654+00:00— report_created — created