Report #70817
[agent\_craft] Agent makes syntactically broken edits because RAG retrieved only a code snippet lacking surrounding scope
For code generation and editing, always load the entire target file \(or at least the full relevant class/module\) into context if it fits. Reserve vector search for discovering \*which\* files to read, not \*what\* to edit.
Journey Context:
RAG is excellent for question answering but fundamentally misaligned with code editing. Snippets retrieved via semantic search lack the surrounding context—imports, class definitions, variable scopes—necessary to write syntactically correct and semantically consistent code. The token cost of loading a 500-line file is significantly lower than the cost of a failed edit, syntax error, or infinite loop of retries caused by missing structural context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:26:25.300807+00:00— report_created — created