Documentation menu

Apps

How sync works

The apps keep a full copy of each brain you can see as a folder on your device and bring it in step with the server in both directions. The rules are simple and conservative: nothing is silently overwritten, and a deletion never wins over an edit.

When a sync pass runs

  • when the app starts;
  • when the server announces a change;
  • about one second after a file changes on disk;
  • every 60 seconds in any case;
  • on request, with Sync now in the tray menu.

Each brain has a numbered change log on the server; the app asks for what happened since the last number it saw, and sends its own changes with the version each one was based on. Content is identified by a hash, so unchanged files are not transferred again.

Sync between two devices goes through the server and its numbered change log.A sequence between device A, the Memex server and device B. 1: device A pushes a change with the hash of the version it was based on. 2: the server adds it to the change log of the brain. 3: the server tells device B that something changed. 4: device B pulls the changes since the last number it saw. 5: the server sends only the files whose content changed. 6: device B merges, or keeps a conflict copy when the same lines were edited on both sides.1. push: change + base version hash3. event: something changed4. pull: changes since my last number5. changed files only (by hash)Device AMemex serverDevice B2. added to the brain’s change log6. merged, or conflict copy kept
Sync between two devices goes through the server and its numbered change log.

Offline

The app runs a local Memex instance over your folder, so the tree, notes, search, graph, backlinks and history work without a connection. Edits are kept locally and sent at the next successful pass; while the server cannot be reached, the app retries with increasing delays.

Concurrent edits

SituationResult
Two people edit different parts of the same Markdown noteA three-way merge keeps both edits.
Two people edit the same lines, or the file is not textBoth versions are kept: one stays in place, the other is saved beside it as name (conflict <user> <date>).ext.
One deletes a note while another edits itThe edit wins: the note is kept.
A note or folder is renamedIt is synced as a move, not as a deletion and a creation.

Read-only folders

Your rights on the device are the server’s, folder by folder. If you change a file in a folder you may only read, the server refuses the change: the app restores the server’s version and moves your version to the quarantine folder .memex-orphaned/ instead of discarding it.

What is not synced

  • .git, .memex and .trash folders;
  • system and temporary files: .DS_Store, Thumbs.db, *.swp, ~$*, .~lock.*, *.tmp;
  • the per-device layout of Obsidian, .obsidian/workspace*.json (the rest of .obsidian is synced);
  • symbolic links;
  • empty folders;
  • files larger than 50 MB.

Security of sync

Sync goes over the same HTTPS connection as the web app, with the app token of your account. Notes are not end-to-end encrypted: the server stores them as readable files, which is what lets it search them and serve them to the AI assistants you authorise. See Security.

Reference: desktop.md and sync-protocol.md.