Report #48749
[agent\_craft] Injecting retrieved code snippets as plain text without structural context causes the agent to mix up which snippet belongs to which file
Always wrap retrieved context in structured metadata tags \(e.g., ...\). The agent needs the spatial and hierarchical relationships to correctly apply edits.
Journey Context:
RAG pipelines often return chunks of text stripped of their metadata to save tokens. For a coding agent, this is disastrous. A function handle\_request means nothing if the agent doesn't know if it's in the API router or the test file. Applying an edit to the wrong file is a critical failure. The tradeoff is a slight increase in token usage vs. a massive increase in edit accuracy. Structured context \(using XML or JSON\) allows the agent to map the code back to the filesystem correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:18:16.232101+00:00— report_created — created