Report #96444
[agent\_craft] Agent uses RAG for files it needs to modify, leading to fragmented edits and missing dependencies
Use RAG for discovery \(finding the right file\), but load the \*entire\* target file \(or relevant module\) into the context before editing. Reserve RAG for knowledge lookup, not code modification.
Journey Context:
RAG chunks files, which destroys the structural integrity of code. An agent trying to edit a function based on a chunk might miss class-level variables, imports, or other functions it needs to update in tandem. The journey usually goes: Agent searches -> finds chunk -> edits -> breaks code because it didn't see the whole file. The correct pattern is a two-step retrieval: 1. Semantic search to identify the target files \(discovery\). 2. Full file read of the identified files into the context window \(editing\). This trades context space for edit accuracy, which is the right tradeoff for code generation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:27:51.254675+00:00— report_created — created