# Saving, conflicts and recovery

Canonical: https://heedit.ai/docs/reference/saving/
Language: en

The Markdown file on disk is the source of truth. Saving must never turn that principle into silent data loss.

## Save the original, not a copy

Heedit saves committed Markdown revisions back to the original path with a verified atomic write. Unchanged documents are not rewritten merely because they were opened or previewed. Encoding markers and line-ending styles are preserved when they can be represented safely.

## When another tool changes the file

Read-only views refresh to the newest file while preserving the visible place where possible. An editor session never lets an old save overwrite a newer external version. Heedit reports the conflict and keeps the unsaved text available for recovery. Late background results are discarded when their document revision is no longer current.
