Agent edits should sync with the open editor buffer

Feature request for product/service

Cursor IDE

Describe the request

Problem

The Agent’s edit tools write only to disk. The editor maintains a separate in-memory buffer that the agent cannot read from or write to. When both are active on the same file, you get silent data loss:

User has the file open with any unsaved edit (or files.autoSave = afterDelay is mid-flight).
Agent calls its edit tool, writes the change to disk.
User’s next save (manual or auto) overwrites the agent’s edit with the stale buffer.
The agent reports success, the user sees no change. Looks like a bug; it’s a buffer race.
Repro (10 seconds)

Open any file in the editor.
Type one character — buffer is now dirty.
Ask the Agent to make any edit to the same file.
Press Cmd+S.
Agent’s edit is gone.
Why this matters more than it looks

This is the dominant failure mode for agent-assisted document editing (Markdown PRDs, strategy docs, long-form writing) — workflows where the user keeps the file visible in the editor while iterating with the agent. It’s much less visible in pure code workflows because users rarely have a file open with unsaved changes during agent runs.

For PMs migrating from competing tools (Windsurf), this is the most painful regression — competitors edit through the open buffer, so the conflict never occurs.

Proposed solutions (in priority order)

Route agent edits through the open editor buffer, the same way Cmd+K inline edit does. Disk-write should be the fallback for closed files only. This is the structural fix.
Auto-save the buffer before agent edits land on a file with a dirty buffer in any open window. Eliminates the race without an architectural change.
Warn the user explicitly when the agent is about to edit a file that has unsaved changes in an open window.
Make files.autoSave = onFocusChange the default for new installs — substantially reduces the failure rate today.
Related (currently scattered) reports

/t/autosave-file-when-editing-agent/128066 (closed, same suggestion)
/t/the-unsaved-changes-trap/103706
/t/agent-edits-sometimes-not-saving-file-to-disk/134528
/t/agent-edits-are-not-showing-in-file-preview/152336
/t/file-changes-made-by-the-agent-are-not-reflected/81507
These are all the same root cause — would be helpful to consolidate under a single tracking issue.

Bonus

The cursor-app-control MCP advertises an open_resource tool in its INSTRUCTIONS.md, but the corresponding tools/open_resource.json descriptor is missing in shipped builds. Calls hang indefinitely with no error. Result: the agent cannot programmatically open a file in the right-hand pane — a small but visible regression vs. competitor tooling. Happy to file separately if preferred.

— Sjoerd Senior PM, Booking.com

Hi there!
This is an excellent write-up, especially the consolidation of related threads. The buffer/disk race you’ve identified is a known pain point and something our team is actively working on improving.

Your prioritized solution list maps well to how we’re thinking about it internally. No timeline to share yet, but this is getting attention. Thanks for taking the time on this.