Report #43971
[agent\_craft] Agent performs destructive full-file rewrites instead of surgical edits, losing comments and formatting
Mandate 'Search/Replace' block format for edits: require the agent to output exact original lines in \`<<<<<<< SEARCH\` block and new lines in \`=======\` block, similar to git conflict markers; reject outputs that do not match existing file content exactly
Journey Context:
Full-file rewrites are token-expensive and destructive—they strip existing comments, docstrings, or non-standard formatting that the model deems 'irrelevant'. Line numbers drift as the file changes. Search/replace blocks \(similar to git conflict markers or unified diffs\) force the model to explicitly match existing context, preventing accidental overwrites of adjacent code and making the edit idempotent and reviewable. This format is also standard in developer tools \(aider, cursor\), making it interpretable by existing infrastructure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:16:40.646092+00:00— report_created — created