Report #21486
[agent\_craft] RAG pipeline injects too much raw code into the context, overwhelming the agent's instruction following
Implement a two-stage retrieval: first retrieve candidate files or chunks, then use a lightweight classifier or the LLM itself to extract only the specific functions or lines relevant to the task before injecting into the main agent context.
Journey Context:
Naive RAG pastes entire files or large chunks into the prompt. This wastes context window and introduces distractor tokens, degrading reasoning. A retrieve-then-extract pipeline minimizes token count and maximizes signal density, keeping the agent focused on the exact code it needs to modify rather than surrounding noise.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:28:42.867628+00:00— report_created — created