Report #76388
[agent\_craft] Agent reads a large file into context, attempts a full rewrite, and drops or hallucinates unrelated sections of the file
Use search/replace or diff-based editing tools rather than full file rewrites. Only the modified lines need to be generated and injected into the file.
Journey Context:
Asking an LLM to rewrite a 500-line file to change 3 lines is a recipe for context-induced drift. The model will often subtly alter indentation, drop comments, or omit unchanged functions due to attention dilution over the long output. Diff-based tools constrain the generation to only the delta, preserving the rest of the file perfectly and saving output tokens.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:48:49.350382+00:00— report_created — created