I asked the agent in Cursor to write a markdown file. It did. I wanted to read it in a cleaner view, so I moved my cursor to Preview and clicked.
The file was gone.
Preview had shifted at the last moment, and Undo had taken its place. One click to look at a file became one click to remove it. Then I did it again.
The only fix on offer was to ask the AI to write the file a second time. That is a strange kind of recovery. The work I lost was work I had not even read yet.
Here is the moment itself. Watch the button I am reaching for.
What actually happened
Four small things lined up.
- Layout shift under the cursor. When focus left the chat panel, the toolbar reflowed. Nothing else moved. Only the button I was reaching for.
- A destructive action in a safe spot. Undo landed exactly where Preview had been.
- No confirmation and no visible way back. The file was simply gone.
- Muscle memory became the risk. The more you use the tool, the faster your hand moves, and the more likely you are to hit it.
Three frameworks, one answer
I ran the moment through three lenses I use to review interfaces that show AI output: Bruce Tognazzini's First Principles of Interaction Design, the Laws of UX, and Jakob Nielsen's 10 usability heuristics. They come from different eras and different traditions. Here, they agree.
| Framework | Principle | What it says about this moment |
|---|---|---|
| Tognazzini | Fitts's Law | The easiest target to hit was the one that destroys work. |
| Tognazzini | Protect users' work | People should never lose work to a slip. Here, one click did it. |
| Laws of UX | Paradox of the active user | Experts do not reread the screen before they click. The design punishes its best users. |
| Laws of UX | Mental model | Undo usually means "reverse my last action." Here it meant "delete the file the AI made." |
| Nielsen | Error prevention | Nothing stood between a costly slip and its result. |
| Nielsen | User control and freedom | There was no emergency exit after the mistake. |
I scored each finding on a 0 to 4 severity scale, where 4 means likely to cause costly harm. Six of the eighteen findings landed at 4, the top of the scale.
The part that surprised me
After the second lost file, I told Cursor's agent what had happened. It said the file was gone and it would need to make a new one.
That was not quite true. Cursor's own support forum points people to Restore Checkpoint in the agent chat, or to the file Timeline in the Explorer panel (Cursor forum). A way back existed. I could not find it, and neither could the AI.
It also turns out that Undo deleting agent-created files is a known bug. Reports go back to mid-2025, and Cursor staff have confirmed it (known bug, earlier report). So my misclick landed on a control that was already unreliable.
That pairing is the real lesson. A recovery feature nobody can find protects nobody. Tognazzini makes this point directly: if people cannot find a function, for practical purposes it does not exist.
Most of the fix is plain CSS
The shift happened because the toolbar changed its layout based on focus. Controls were added to or removed from the flow, so the ones next to them moved. The fix is old and a little boring, which is exactly what you want.
/* Avoid: removing the control changes the layout */
.toolbar-action.is-idle { display: none; }
/* Prefer: the control keeps its space.
It cannot be seen, clicked, or focused. */
.toolbar-action.is-idle { visibility: hidden; }
Stable layout removes the root cause. A few product decisions cover the rest.
- Separate safe and destructive actions. Never put a destructive control in a spot a safe one can vacate. Give it its own zone.
- Ignore clicks on controls that just moved. If a control appeared or shifted in the last half second, the click was probably meant for something else.
- Make removal reversible. A soft delete with a toast that says "File removed" and offers Restore.
- Name the action honestly. "Undo" sounds safe. "Discard file" tells you what will happen.
What I would carry forward
For anyone building tools where AI produces the work and people review it:
Test every control across focus, hover, and loading states. If anything moves, someone will click the wrong thing.
Treat AI-generated work as the user's work. It took their time, their intent, and their prompt to make it.
Teach the agent about its own recovery tools. When the AI says work is gone, people believe it.
Measure layout stability. The web already has a shared name for this problem, Cumulative Layout Shift, so there is no excuse not to track it.
"AI tools make it fast to create things. They should make it just as hard to accidentally destroy them."
Closing
This was a small moment. A few pixels and a few seconds. But trust in a tool is built out of small moments like this one, and it is lost the same way.