# agent: Improve UX when agent tries to edit unsaved buffer \(\#55655\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e78ddcac8d7bb36c3f68835c506f38f4850adb7d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e78ddcac8d7bb36c3f68835c506f38f4850adb7d

Requested commit: e78ddcac8d7bb36c3f68835c506f38f4850adb7d

Commit: e78ddcac8d7bb36c3f68835c506f38f4850adb7d

Tree: 9ae695648075b696612364da38969d4ff5e4fba6

Author: Bennet Bo Fenner

Committer: GitHub

## Message

```
agent: Improve UX when agent tries to edit unsaved buffer (#55655)

Before:

1. Agent tries to edit unsaved file
2. Tool call fails with error telling the agent to ask the user to save
or discard edits
3. User types save/restore
4. Agent uses save/restore tool


https://github.com/user-attachments/assets/c94dd361-e8e0-48ee-be31-da8afe594419

After:

1. Agent tries to edit unsaved file
2. User is prompted to save/restore file
3. User accepts/rejects or saves/discards file manually


https://github.com/user-attachments/assets/1d98a0c4-4420-4426-94f2-42355de230be

Release Notes:

- agent: Improved UX when agent tries to edit unsaved buffer

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
```

## Parents

- [c049193fd93b2c27d3e4a8a40f5e1739db4640b1](https://git.cafe/gitcafe/zed/commit/c049193fd93b2c27d3e4a8a40f5e1739db4640b1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e78ddcac8d7bb36c3f68835c506f38f4850adb7d?format=markdown)
