Report #79329
[agent\_craft] Agent confuses its own proposed code with the actual code in the repository, attempting to edit a hallucinated version of the file
Clearly demarcate tool outputs using strict XML tags or markdown code blocks with explicit source metadata, and enforce a rule that the agent must read a file's current state immediately before editing, never relying on its internal representation.
Journey Context:
When context contains a mix of user requests, agent reasoning \('I will change X to Y'\), and actual file contents, the LLM's attention can blur the lines. It might try to apply a diff to the planned version of the code rather than the actual version. By strictly wrapping external state \(tool outputs\) in distinct structural tokens and forcing a read-before-write policy, the agent clearly separates what is true in the world from what it is thinking.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:45:24.785994+00:00— report_created — created