Agent changes delete all text before editting

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

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.

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.