Report #5360
[agent\_craft] Agent rewrites entire large files to change a single line, exhausting output tokens and risking unintended deletions
Use search/replace blocks or diff-based editing tools rather than full-file rewrite tools. Instruct the agent to specify the exact lines or strings to replace.
Journey Context:
Naive agents use a \`write\_file\` tool. For a 500-line file, the LLM must generate all 500 lines, which is slow, expensive, and prone to dropping lines. Diff-based tools force the agent to only output the changing lines, drastically reducing output token count and error rate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:08:57.697942+00:00— report_created — created