# Agent changes delete all text before editting

**URL:** <https://forum.cursor.com/t/agent-changes-delete-all-text-before-editting/171656>\
**Category:** Bug Reports\
**Created:** [September 14, 2026, 6:57pm UTC](https://forum.cursor.com/t/agent-changes-delete-all-text-before-editting/171656 "2026-09-14T18:57:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanawar](https://avatars.discourse-cdn.com/v4/letter/z/5f9b8f/32.png) [@zanawar](https://forum.cursor.com/u/zanawar)\
**Post date:** [September 14, 2026, 6:57pm UTC](https://forum.cursor.com/t/agent-changes-delete-all-text-before-editting/171656/1 "2026-09-14T18:57:41Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

When i am working with an agent (specifically Grok 4.5) and it makes a change to a code file I see the code file momentarily go blank, like the contents of the file has been deleted. Then a moment later it looks like it gets pasted back and the code has returned.

This alone isn’t a bug, but it causes problems with tools that I am using which look for file changes. It notices that the file is briefly empty, and then has content in it again. This tool recompiles the code once (when the file is empty) and then again after the file has been repopulated.

This causes problems because the tool tries to hot reload code changes to existing entities. But since the code is momentarily gone, it deletes those entities since it cannot find any code for them.

**This used to not happen**  
My tool used to work great with Cursor but since it started to do this “Delete everything then paste everything” thing, it has broken my tools.

### Steps to Reproduce

Just as the agent to make code changes

### Expected Behavior

How it used to work; ie, when it edits a file it doesn’t delete the files contents **(saves it)** and then writes the file contents.

The critical part here is that it saves the file when it is empty for that moment.

### Operating System

Windows 10/11

### Version Information

Version: 3.20.10 (user setup)  
VS Code Extension API: 1.128.0  
Commit: d6f462cdd0a6a6d1cff570daf980e671d0a63de0  
Date: 2026-09-10T21:04:54.045Z  
Layout: IDE  
Build Type: Stable  
Release Track: Default  
Electron: 42.10.0  
Chromium: 148.0.7778.280  
Node.js: 24.18.1  
V8: 14.8.178.38-electron.0  
xterm.js: 6.1.0-beta.291  
OS: Windows\_NT x64 10.0.22631

### Additional Information

This massively breaks up my workflow.

### Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

---

<div class="post-metadata">

**Author:** ![mohitjain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/mohitjain/32/100229_2.png) [@mohitjain](https://forum.cursor.com/u/mohitjain)\
**Post date:** [September 15, 2026, 9:14am UTC](https://forum.cursor.com/t/agent-changes-delete-all-text-before-editting/171656/6 "2026-09-15T09:14:00Z")

</div>

Hey @zanawar, thanks for the report. When the agent edits a file it writes the new contents straight to disk (not into the editor), so there’s a brief moment where the file is empty on disk before it repopulates. That’s what your hot-reload tool is catching, and it’s not something on your end.

Quick unblock: set your tool to ignore zero-length files or debounce ~300ms before recompiling. If you can, drop the exact `0 bytes` timing (a `Get-Item $f).Length` poll while the agent edits) and whether it also happens on Auto, and I’ll pass it along.

---

<div class="post-metadata">

**Author:** ![zanawar](https://avatars.discourse-cdn.com/v4/letter/z/5f9b8f/32.png) [@zanawar](https://forum.cursor.com/u/zanawar)\
**Post date:** [September 22, 2026, 12:17am UTC](https://forum.cursor.com/t/agent-changes-delete-all-text-before-editting/171656/8 "2026-09-22T00:17:35Z")

</div>

That seems like a very strange way to do edits. Is there a way to change that behavior?

I’m not able to change the tool, it’s 3rd party, so your quick unblock doesn’t help me.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [October 22, 2026, 12:18am UTC](https://forum.cursor.com/t/agent-changes-delete-all-text-before-editting/171656/9 "2026-10-22T00:18:20Z")

</div>

Closed on October 22, 2026, 12:18am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
