When an agent changes a file you are editing
How your edits and an agent's edits fit together, the one choice you make when you both changed the same part, and where the version you did not keep goes.
You have unsaved edits in a tab, and an AI agent (or another app) writes the same file. Sashmark compares both versions with the version you started from, line by line.
- You changed different parts: both sets of edits go in, with no question. Your edits stay unsaved until you save (or until auto-save saves them).
- You both changed the same part: you get one plain choice for that part: Keep yours, Keep the agent's or Keep both. Sashmark never puts both versions in the file unless you click Keep both, and it never writes markers or extra words into the file.
- Nothing is lost: before the version you did not keep is replaced, Sashmark puts a copy of it in its kept-aside folder (see Kept copies).
The edits go in place: the tab is not reloaded, your caret and scroll stay, and undo history is kept. Cmd+Z (Ctrl+Z on Windows and Linux) undoes them like any other change.
When you changed different parts
- The agent's changes appear alongside your edits, keeping your reading position and caret.
- Blank lines count by where they sit, so removing or adding a blank line in one place and the agent's edit in another still fit together.
- If you both add lines at the very end of the file, both go in: the agent's lines first, then yours.
- When the save that holds the agent's changes lands, the notice bar says The agent's changes were added to this page. with Undo and See changes.
- See changes opens the Changes view for the tab.
- Undo gives back your page exactly as it was before the agent's changes went in, as unsaved edits. The version on disk (with the agent's changes) goes to the kept-aside folder first. As soon as you type after the merge, Undo goes away, so it never undoes your own typing.
- With auto-save on, auto-save keeps going after the agent's changes go in: it saves the page once after the usual pause. Before that save, the agent's version as it was on disk goes to the kept-aside folder.
When you both changed the same part
When an agent's change reaches Sashmark while you have unsaved edits in the same part, or a save finds that change, Sashmark puts the agent's other changes on the page and shows a choice on that part. The choice shows on any kind of block: a paragraph, heading, list item, quote, code block or link. On a list item, Keep both puts the two items one after the other in the same list. If the page can't take a choice in a block, the notice bar says Couldn't apply that choice. The page is as it was. and the choice stays open. Above the part, a box labelled The agent's version shows the agent's text. Under it, Your version (below) points to your text, which is the block right under the box and stays as you left it. Then come three buttons:
- Keep yours keeps your version. The agent's whole file goes to the kept-aside folder first.
- Keep the agent's puts the agent's version in place of yours, in that part only; your other edits stay. Your whole page goes to the kept-aside folder first.
- Keep both puts the agent's version first, then yours, as separate blocks. Nothing goes to the kept-aside folder, because both versions are in the file. After the click, the page labels the two parts The agent's version and Your version for as long as the tab is open. The labels are on screen only: they are never saved, and Save a Copy and Copy as Markdown leave them out.
Each choice changes only its own part; edits elsewhere, yours and the agent's, stay. The box is announced once by screen readers, and Tab moves through its three buttons in order.
Choose once for each part. Every other block stays editable meanwhile. A save waits while a choice is open, and the notice says why. After your last choice, Sashmark saves at once with no other click.
After Keep yours or Keep the agent's, the notice bar says Kept a copy of the other version. with Show, which opens the kept-aside folder. When Keep yours can't fit your edits and the agent's together, your page is saved as it is and the notice bar says Saved your version. The agent's edits are not in the file; a copy of the agent's version is in the kept-aside folder. with Show. If the copy can't be written, nothing changes: both versions stay, the choice stays open, and the notice bar says Couldn't keep a copy of the other version, so nothing changed. While a copy is being written, the buttons do nothing.
If Sashmark can't make an exact copy of your page, for example because the agent's version isn't readable text, Keep the agent's shows that same notice and your page stays as it is.
If you and the agent both add the same new line, even in different places, that is a choice too, so the line never ends up in the file twice without your Keep both. If the agent rewrote the whole file (none of the old lines are left), the choice covers the whole page at once.
Cmd+Z (Ctrl+Z on Windows and Linux) undoes Keep the agent's or Keep both like any other change. The block then holds your version again and is not offered again. A choice counts only while the block still holds exactly the text it put there: if you undo it, or edit that block afterwards, before the save, the save that follows shows the bar described below instead of writing, so the agent's text is never replaced without your choice there.
If the agent writes the file again while a choice is open, the choices go and the bar shows.
The bar under the tabs
Some changes can't be shown as a choice on the page: a choice was undone, the agent wrote again while a choice was open, or the versions can't be lined up safely (for example, lines that repeat, or changes too large to align). Then the page keeps your edits and a bar under the tabs says You and an agent changed the same part of this file. with Keep yours, Keep the agent's, Keep both (when offered), Save a Copy and Copy as Markdown. Screen readers announce it right away.
Until you choose, a save is refused: nothing is written, the agent's version stays on disk, and the notice bar says Couldn't save: the file changed on disk since you opened it. Your edits are still here.
- Keep yours first puts the agent's version on disk in the kept-aside folder; then the bar goes away and nothing is written yet; press Cmd+S (Ctrl+S on Windows and Linux) to save. The agent's changes to other lines are kept. If the copy can't be written, the bar stays. If Sashmark cannot line up the versions safely, your save writes your whole version.
- Keep the agent's shows the agent's version in place of your page. Sashmark asks first, in a box headed with the file's name: Keep the agent's version? Your edits go to a kept copy. with Cancel and Keep the agent's. Your whole page goes to the kept-aside folder before it is replaced.
- Keep both, when offered, saves at once: the agent's whole text, then yours. Nothing goes to the kept-aside folder.
Before Keep yours or Keep both writes, Sashmark checks that every line keeps the bytes your version or the agent's version has there, line endings and the last line's ending included. If one would change, nothing is saved, your edits stay, and the notice bar says the app can't match the edit to the file.
If the agent's version is not valid UTF-8 text, the bar offers only Keep the agent's, Save a Copy and Copy as Markdown: Sashmark can't make an exact copy of the agent's bytes, so there is no Keep yours or Keep both. Keep the agent's puts your page in the kept-aside folder and shows the agent's file, read-only, as it shows any file that is not valid UTF-8.
After Keep yours, later changes to other lines go in by themselves. A new change to the same part brings the bar back so you can choose again.
The Keep the agent's box
- Cancel has the focus when the box opens, so Return picks Cancel.
- Escape and Cancel keep your edits and the bar.
- Only Keep the agent's (click it, or Tab to it and press Return or Space) replaces your edits. Sashmark reads the file again first, and replaces your edits only once the agent's version is on the page, with no unsaved dot. Typing and saving pause meanwhile.
- If you click Keep yours while the agent's version is still loading, Keep yours wins: your edits stay.
- If the file can't be read, is gone, or changes again while it is being read, your edits stay, still unsaved, and the notice bar says Couldn't keep the agent's version: with the reason, then Your edits are still here.
- While the box is open, Tab and Shift+Tab move only between its two buttons, and the app's shortcuts (save, close tab, switch tab and the like) wait for your answer. A file you open meanwhile opens after you answer. If you quit while it is open, it closes as if you chose Cancel (your edits stay) and the quit box opens (see Editing and saving a file).
If a file is already opening when you click Keep the agent's, it appears after you answer this box, whether you choose Cancel, press Escape or keep the agent's version.
If the file goes back to the version you started editing from, the bar goes away by itself. If the file is moved or deleted, the bar goes away and the notice bar says File moved or deleted. Showing the last version.; your edits stay. The bar shows only for the tab you are looking at.
Kept copies
The version you did not keep goes to a folder named kept-aside inside the Sashmark app data folder, never next to your document (an agent reading your folder never sees it):
| System | Kept-aside folder |
|---|---|
| Mac | ~/Library/Application Support/com.sashmark.app/kept-aside |
| Windows | %APPDATA%\com.skimmark.app\kept-aside (the current folder stays in use) |
| Linux | $XDG_DATA_HOME/com.sashmark.app/kept-aside, or ~/.local/share/com.sashmark.app/kept-aside |
- A Discard before you choose (on the bar or in the page), or on a tab whose file is gone, also puts your page here first (see Closing a tab with a choice to make).
- Each document has its own subfolder there, so two files with the same name in different folders never mix.
- Each copy is a new file named after the document, the time (in UTC, so copies sort in the order they were made), and whose version it is, for example
jane-doe-notes 2026-10-19 141205 agent.mdor... yours.md. A copy never replaces another one. - Show on the notice opens the kept-aside folder. If it can't be opened, the notice bar says Couldn't open the folder of kept copies.
- Sashmark never deletes a kept copy. Once a document has more than 100 copies, Sashmark moves the oldest ones to the Trash (the Recycle Bin on Windows), where you can still get them back. If the Trash can't take them, they stay in the folder.
Save a Copy and Copy as Markdown
Neither one changes your tab or the file, and neither closes anything.
- Save a Copy writes the whole page, as Save would write it, to a new file beside the original: name (copy).md, then name (copy 2).md and so on. It never writes over an existing file. After 20 copies beside one file it stops and asks you to move or rename some. It also refuses a folder or a copy name that is a link. On Mac and Linux the copy is never open to more people than the original: a private file's copy stays private. The notice bar says Saved a copy: with the new file's name, or Couldn't save a copy: with the reason.
- Copy as Markdown puts the whole page on the clipboard.
- Both prefer the text that passes Save's checks. When a check refuses, they can still rescue the whole in-memory editor text. The confirmation warns: "This copy uses the editor text and may differ from what Save would write." The original file and the tab stay unchanged.
- Right after a save lands, while Sashmark checks the saved page, both prefer the text that save wrote. If the page no longer matches, they rescue the current editor text with the same warning.
Large files
A file over 100,000 characters is read-only in Sashmark (see The document lock), so there are no edits of yours to combine: an agent's change simply shows, and nothing is written.
Closing a tab with a choice to make
- Before you choose on the bar, the edits can't be saved, so the close box shows Save dimmed with "Can't save: the file changed on disk since you opened it." Discard and Cancel still work. See Editing and saving a file.
- Discard there first puts a copy of your page in the kept-aside folder (see Kept copies), then closes the tab. The file on disk keeps the agent's version. If the copy can't be written, Discard does nothing: the tab stays open with your edits, and the notice bar says Couldn't keep a copy of your edits, so Discard did nothing. Your edits are still here. Use Save a Copy, then Discard. Once Save a Copy of the page has worked, Discard uses that copy and writes no kept-aside copy, so it closes the tab even when the kept-aside folder can't be written; if you type after the Save a Copy, it needs a new one. If the copy takes more than 10 seconds, Discard does nothing and says the same; the copy still finishes on its own. While the copy is written, the page takes no typing; if the page changes anyway, Discard does nothing and the notice bar says Your page changed while its copy was kept, so Discard did nothing. Your edits are still here. Discard all when you quit or close a window does the same for each such tab.
- The same goes for a tab with a choice still open in the page itself, and for a tab whose file is gone from disk while it has edits.
- After Keep yours, the edits can be saved again, so the close box offers Save, like any tab with unsaved edits.