Sashmark / Help

Sashmark is in development. Nothing has been released yet, and there is no public build. These pages describe the development build. See the roadmap for what is still planned.

How Sashmark saves a file

What Sashmark promises when it saves: it never overwrites an agent's change you haven't seen, never leaves a half-written file, and keeps line endings.

Press Cmd/Ctrl+S to save your edits (see Editing and saving a file). This page explains what every save does.

It never overwrites a change you haven't seen

Before it writes, Sashmark checks that disk still holds the version your edits are based on. It checks again right before replacing the file. When an AI agent changes different lines, Sashmark combines both versions and saves against the newer disk version. A save that finds another change reads disk again and retries once. Changes to the same part stay unsaved until you choose Keep yours, Keep the agent's or Keep both (see When an agent changes a file you are editing). Each choice changes only that part; changes to other lines stay. The version you do not keep goes to a kept copy first.

If two saves of the same file start at once, they run one after the other. The second one checks the first one's version before writing.

If a save is still running after 20 seconds, a "Still saving…" notice offers Copy text, which copies the tab's whole text to the clipboard; your edits stay in the tab either way.

Rarely, a save lands but the page can't take the saved version in place. Sashmark then reloads the page with the saved version: from the file, or, if the file can't be read just then, from the text it just saved. Once the page shows it, the notice says "Saved. Sashmark reloaded the page to show it." The save is done; you can keep typing.

Sashmark only saves files it has open in a tab.

A file in a synced folder (iCloud Drive, OneDrive) may be only a placeholder until its full content comes from the cloud. Before a save, Sashmark reads the whole file, so it can compare it with your version; on a Mac, that read brings the full content from the cloud. If that fails, the save waits and tries again (see the table under "When a save fails").

Sashmark saves regular files only. If another program replaces an open file with a special pipe file (FIFO), the save is refused and your edits stay in the tab.

It never leaves a half-written file

Sashmark writes the new version to a hidden file in the same folder, makes sure it is fully on disk, and only then swaps it in for the old file. If the app crashes or the computer loses power during a save, the file is either the old version or the new one, never a mix.

New Document save temps start with .skm-s1- and end in .tmp. After a successful open or save, Sashmark checks this file's leftover temps in the background. A temp must be at least ten minutes old and pass the writer and file identity checks before it can be removed. This work does not hold up opening or saving. A busy or uncertain check leaves the temp for a later open or save. On a Mac or Linux, a save that fails removes its own temp right away, even if the folder was renamed or moved during the save.

The temp name carries a short machine code to help keep files from different computers apart. Copied machine setups can share this code, so the code alone never authorizes removal.

Older temps named .skm- followed by numbers are never cleaned up automatically. Changing a file's name, letter case or Unicode spelling can also leave a temp that Sashmark cannot identify. Unknown identity, links and permission problems leave files alone. Known leftover save temps can be removed by hand after the writer has stopped; never remove another app's file or a live save's temp.

The saved file keeps the old file's permissions.

What a save replaces

Because the new version replaces the old file rather than writing into it, the saved file is a new file with the same name. That means:

  • Hard links: a file that has another name (a hard link) is not saved, because the other name would keep the old text.
  • Other file details are not copied: Finder tags and other extended attributes on Mac, and Windows access lists set on the file itself, are not carried over. The new file gets the folder's defaults. The file's owner can change if someone else owned it.

It writes your text exactly

Line endings (including Windows-style CRLF), a missing newline at the end, and a byte order mark at the start are all kept as they are. Files using only CR for their line breaks also keep CR for new one-line paragraphs, list items and headings when saved. A paragraph with a line break inside asks you to save in another way.

Moving list items keeps the other lines

Moving a list item in or out with Tab or Shift+Tab (see Nesting list items) changes the shape of the list, not only one word. The save still writes only what moved: the item's own line, the lines of the items under it, and the blank line beside it when one has to go. Every other line stays byte for byte as it was, with its line ending. An item that only gets a new parent because the item above it moved out keeps its line unchanged.

Before it writes, Sashmark runs the same checks as for any edit: no line you did not touch may change, and the new file must read back as the page you see. If a check fails, nothing is written (see below).

When a save fails

Nothing is written and your edits stay in the tab. Each refused save adds one line to save-refusals.log in the Sashmark app data folder (its location is in Recent documents): the time, the reason code, the check, the check's site and the file name, never your text or the file's folder. Only recent lines are kept: when the log reaches 256 KiB it becomes save-refusals.1.log, replacing the older one, so the two files hold at most about 512 KiB. Lines have no age limit. The save-error bar offers Try again, Save a Copy and Copy as Markdown. When the edit cannot be matched to the file or the saved text would not read back as the page, Reload and keep my edits replaces Try again. It sets your whole editor text aside in a kept copy, reads disk again and rebuilds the page with your edits and the disk changes. If they cannot combine safely, the whole-file conflict asks you to choose Keep yours, Keep the agent's or Keep both, when available. The rebuilt page remains unsaved until you save or make a conflict choice.

Save a Copy writes a new file beside the original; Copy as Markdown copies the whole page. When Save's check refuses, they can rescue the in-memory editor text independently. The confirmation warns: "This copy uses the editor text and may differ from what Save would write." Neither changes the original or closes the tab. See Save a Copy and Copy as Markdown.

The bar says What happened Try again
you don't have permission to change this file The file is read-only, or you aren't allowed to write it or its folder. Works once you fix the permission.
another app is using the file Another program held the file open the whole time Sashmark tried. Works once the other program lets go.
the file or its folder is gone The file or its folder was deleted, moved or renamed, even if only the letter case of its name changed. Sashmark doesn't recreate it; open the file from its new name. Dimmed, with "the file was moved or deleted", until the file is back.
the disk is full There is no room left on the disk (or your quota is used up). Works once there is room.
the file couldn't be written Something else went wrong while writing. Works if the cause has passed.
the file is still in the cloud and didn't download The file is in a synced folder (iCloud Drive, OneDrive) and Sashmark could not read all of it before writing. When you saved it yourself, Sashmark tried 4 times in all before this bar showed, waiting 2, 4 and 8 seconds, with "Waiting for <name> to download from the cloud…" in the notice. An automatic save doesn't wait: it shows this bar at once and auto-save pauses for that tab. Works once the file's full content is on this computer. Your edits stay; Save a Copy saves them beside it.
the file has more than one name (hard link) The file has another name (a hard link). Off: these edits can't be saved to this file.
the file isn't open in Sashmark any more, or it now leads to another file The file's tab was closed. Nothing was saved. Off.
the file isn't open in Sashmark any more, or it now leads to another file Leads to another file: since you opened it, the file (or a folder above it) was replaced by a link to a different file, maybe one open in another tab. Nothing was saved, and the other file keeps its text. Off: to keep your edits, use Copy as Markdown, then open the file you want from where it is now.
Closing this window. Use Save in the close dialog You saved while the window was closing or Sashmark was quitting, before it asked about unsaved tabs. Not needed: the close dialog that follows offers Save.

When Sashmark's own check refuses a save

Sashmark also refuses a save that would not be safe. The bar then names the check that refused:

The bar says The check
it would change line 2, which you didn't edit The line check. The number is the first line the save would have changed, counted from 1.
the saved file would not read back as the page The read-back check. No line is named.
the app can't match this edit to the file Sashmark could not match the edit to a part of the file. No line is named.
the app found no change to write Sashmark found nothing to write. No line is named.
you edited a part that is locked until the file changes Your edit is in a part an earlier refusal already locked. No line is named, and nothing more is added.

After every reason but the last one in the table, the bar says whether that part is now locked: that part is locked until the file changes, or nothing was locked. A locked part is read-only for this version of the file (see When editing is off).

When the line check refuses, the parts the save would change are marked in the page, in the same style as the Changes view: inside a paragraph, only the lines that would change; other blocks are marked whole. The bar also offers Save with these changes. One click writes exactly that version, with the line check skipped for that one save only; nothing is written before you click. The refusal log records that you chose it. The next save is checked as usual. The button goes away once you edit again, because the marked version is no longer what would be saved.

For a line-check refusal, Try again is off until your next edit. For an edit-match or read-back refusal, use Reload and keep my edits instead. Reload does not depend on the check that refused. If the kept copy or disk read fails, your page stays and the notice says why. A later Save still runs the normal checks.

When outside changes cannot merge safely, the bar under the tabs appears instead (see When an agent changes a file you are editing). After Keep yours, later changes to different lines can still merge; a new overlap asks again.

On Windows, another program (often antivirus or the search indexer) can hold a file open for a moment. Sashmark tries again a few times over a quarter of a second, then says "another app is using the file". The file keeps its old version.

When the save isn't fully confirmed

Rarely, the new version is in place but the computer can't confirm that the swap itself is safely stored on disk (the folder sync failed). The save still counts: the file is the complete new version. If the computer then lost power before the disk caught up, the old version could come back. Sashmark does not tell you when this happens: the save looks like any other, and no notice or log file records it.

Auto-save

Auto-save is on unless you turn it off. To turn it off, open Profile (the person icon at the right end of the top bar) and uncheck Auto-save under Saving; check it to turn it on again. The choice is kept for every window and after you quit, and turning it off stops auto-save in every open window at once. If you turned it off before, it stays off. If Sashmark can't store the choice, the notice bar says "Auto-save setting not saved" and the switch goes back. If Sashmark can't read its settings file, auto-save stays off and the switch shows it off.

With auto-save off, you can save with Cmd/Ctrl+S or Save in a dialog. Sashmark also saves after the last on-page conflict choice or when you choose Keep both on the conflict bar.

With auto-save on, a tab with unsaved edits is saved:

  • after a pause: 2 seconds after your last keystroke in that tab. Every change you type starts the 2 seconds again; moving the caret does not.
  • when you leave the tab: switching to another tab saves the one you left at once.
  • when the window loses focus: switching to another app, or a file picker opening, saves every tab with edits in that window.

An auto-save is a normal save. It runs the same checks as Cmd/Ctrl+S and clears the unsaved dot the same way. A successful auto-save shows nothing.

A pause in typing can come in the middle of a sentence. An AI agent that reads the file right then sees your edit as it is, unfinished.

While a save runs, the page does not take keys, exactly as during Cmd/Ctrl+S. A key typed in that moment does not enter the page; the first one shows "Saving. Keys typed now do not enter the page." A save usually takes a few milliseconds.

When auto-save pauses a tab

Auto-save never retries on its own. It pauses a tab, and writes nothing more to it, when:

  • a save of that tab is refused or fails, for any reason in When a save fails, unless the agent's changes then go into your page (see below);
  • an agent changes the file while you have unsaved edits and you both changed the same part, so the page shows a choice or the conflict bar;
  • the agent's changes go into your page but the copy of the agent's version can't be written to the kept-aside folder;
  • you choose Keep yours on the bar, or the page shows marked lines or a choice to make;
  • the tab's file is missing, too large, or locked for editing.

The notice bar then says once: "Auto-save is paused for <file name>. Press Cmd+S to save it." (Ctrl+S on Windows and Linux). If the tab already shows a warning, such as a missing file, the sentence follows the warning. Your text stays in the tab. Save that tab yourself and auto-save starts again for it. Choosing Keep the agent's on the bar or undoing back to the text on disk also ends the pause.

Auto-save also waits, without pausing, while a file loads, while you are typing an accented or other composed character, while the Changes view is on, and while a close, quit, Review or discard dialog is open. The next pause in typing saves.

Quitting and closing

Auto-save never writes because you quit or close. If every tab is saved, Quit, Close Tab and Close Window close without asking. If a tab still has edits, or its auto-save is still running, the usual dialog asks first. Close Window, while another Sashmark window stays open, waits for a running auto-save to finish: if it saved, the window closes without asking; if it was refused, the window stays open with that tab paused. Cancelling that dialog does not save at once; the next pause does.

When an agent writes the file you have open

  • Your tab has no unsaved edits: the page reloads with the agent's version, without asking. Nothing is written.
  • You are typing, with auto-save on: Sashmark never writes over the agent's version without keeping a copy. If you changed different parts, the agent's changes go into your page and auto-save keeps going: the agent's version as it was on disk goes to the kept-aside folder, then the page is saved once after the usual pause, and the notice bar says The agent's changes were added to this page. with Undo and See changes. This is the same whether the agent's change reaches Sashmark first or your auto-save does (the last check before the save sees the newer file, refuses that save, and the page takes the agent's changes). If you both changed the same part, the page shows Keep yours, Keep the agent's and Keep both there, and auto-save pauses for that tab: nothing more is written until you choose. See When an agent changes a file you are editing.

A change in the instant before a save

Before every save replaces the file, Sashmark checks one last time that disk still holds the version your edits are based on. If another app writes the file in the instant between that last check and the replacement, that app's change is lost. This is true on every operating system. Auto-save saves more often than you would by hand, so this can happen more often with it on.

On a test Mac, with a small file (4 KB), the gap was about 0.3 ms for a typical save and 2.4 ms for the slowest 1 in 100; with a 200 KB file, about 0.6 ms and 6.5 ms. With auto-save saving about 300 times an hour while you type, an agent write at a random moment lands in that gap about 1 in 36,000 times for the small file, and about 1 in 1,800 in the slowest case. In a stress test on the same Mac, an agent wrote the file at 1,000 moments packed around a save: 948 saves were refused and kept the agent's version, and 1 agent write was lost, one that was still being written when the save replaced the file. These are measurements from one machine, not a promise: a slow or synced disk widens the gap.

View as Markdown