--- name: obsidian-sync-reliability description: "Use when syncing, repairing or pushing the Obsidian vault." version: 1.0.0 author: HamaratLabs license: MIT --- # Obsidian Sync Reliability Use this skill when a note exists in Google Drive but is missing, blank, duplicated, or opens as a newly created note on another Obsidian device. ## Always-on rules - Treat sync as a data-integrity task: inspect both the local vault and remote objects before changing either side. - Keep one sync owner per device. Never run rclone and an Obsidian Drive plugin against the same vault concurrently; race conditions can create duplicate paths and overwrite newer content. - Exclude `.obsidian/**`, secrets, tokens, and credentials from file sync. Install/configure plugins separately on each device. - Preserve a local backup before deleting or rebuilding remote objects, and prove the archive is readable (`gzip -t`, expected file count) BEFORE the deletion rather than after. - Before collapsing a redundant vault copy into the canonical one, prove no unique content dies: hash every file on both sides, then for each differing file check whether every non-empty line of the stale copy still appears somewhere in the canonical file. Report the count of lines that exist ONLY in the copy — zero means the copy is purely stale, and that number is what earns approval to delete it. A raw "26 files differ" figure looks like data loss and stalls the decision. - Never run a full resync until the canonical side and the delete scope are explicit; a resync can remove remote-only notes. - Prefer concise Turkish status reports with exact counts, paths, hashes, and the next device action. - For a free Windows + macOS + Android setup, prefer one Syncthing owner over Git, Google Drive plugins, and rclone; pair the devices and verify the first transfer before disabling the old owner. - When the user wants version history over their notes rather than device-to-device sync, Git/GitHub is the right owner. Choose the mobile client using measured size, device resources and the user's workflow. A small markdown vault can use Obsidian Git on Android, but size alone neither removes experimental-support warnings nor rules out network, permission, or merge failures. See `references/git-vault-sync.md` for the role split, `.gitignore` gate, and both mobile patterns. - Exclude `.obsidian/` from the repo ENTIRELY, not selectively. Committing `manifest.json` while ignoring `main.js` ships a plugin folder with no code, which the second device loads as a broken plugin; per-device settings also collide on clone. - Do not retire a working sync owner at the moment a new one is configured; keep both until the new path is verified on every device, then remove the old one. This is the default for an undecided case, not a veto: once the user has explicitly decided to drop the old transport, execute the removal and verify it instead of re-proposing the safer hybrid. Repeating a settled decision back to them reads as stalling. - On desktop, offer the Obsidian Git plugin proactively rather than treating terminal-only as the safe default — there it drives the real `git` binary. Someone who writes notes in Obsidian wants to send them from Obsidian; automation intervals can be set to 0 for manual control. See `references/git-vault-sync.md` for the install and settings recipe. - State reliability caveats once with their documented scope and available measurements, then let the user decide. Do not invent a size threshold or narrow a general mobile warning to large vaults only. Re-proposing the cautious alternative after they have pushed back reads as evasion, and steering someone to a terminal workflow to avoid a documented-but-inapplicable risk costs more than the risk. When a published warning exists, name the condition it applies under and measure whether this vault meets it. - Keep Syncthing paused until the canonical copy and the receiving device are prepared; this prevents an unverified first sync from propagating deletions. - Do not treat an Obsidian status message such as “up to date” as proof that the currently open editor buffer contains the file on disk; verify the file and reload the app when needed. - When the user asks to commit/push the vault (e.g. to read a note on the phone), never let private folders' names or contents into the output or the commit: exclude non-ignored private folders by pathspec, scan staged files for secrets, push, and verify the file on `origin/main`. Recipe: `references/git-vault-sync.md` → "Routine commit + push". ## External asset disk and selective cloud backup - Keep the user's planned shared Mac/Windows asset disk separate from Obsidian transport: Git owns notes; selected media folders may have a one-way, version-preserving Drive backup. A Drive asset backup is not permission to restore Drive vault sync. - Treat personal phone/computer backup folders as strictly forbidden to every agent: no listing, indexing, scanning, hashing, reading, or cloud upload. Use explicit asset-root allowlists; do not recursively inventory the disk root or follow symlinks outside allowed roots. Folder names and exFAT permissions are not a security boundary; consider a user-unlocked encrypted personal container without giving agents its credentials. - Treat advance planning as no authorization to erase: first require the user's independent backup confirmation, identify the physical device from metadata only, and obtain fresh scope confirmation. Honor vault prohibitions on agent disk-erasure commands; leave formatting to the user when those apply. - Validate disk identity and mount presence before each backup, fail closed when absent, and never create a replacement directory under an absent mount path. Verify restore using only approved test/asset files. Confirm cloud quota, retention, selected folders and scheduling before automation. ## Procedure 1. **Reproduce and identify the target** - Capture the exact vault-relative path, not only the display title or wikilink label. - Check whether the local file exists and has nonzero content. - Inspect the source note's wikilink: a link to a missing local path can legitimately create a new note when clicked; do not change the shortcut before proving the target file is present. 2. **Inspect the remote without mutating it** - List remote objects with size, modification time, and ID. - Group by exact path and flag any path with more than one remote ID. - Download the target to a temporary file and compare its SHA-256 and byte count with the local canonical copy. - Run a dry-run only; do not infer safety from a successful dry-run if it reports duplicate objects or broad deletes. 3. **Repair a duplicate safely** - Stop automatic push on all other devices before repair. - Back up the known-good local file outside the vault. - If one remote duplicate is empty and another contains the known-good content, delete the duplicate path objects only after confirming the dry-run lists exactly those objects. - Upload one canonical copy, update its remote modification time if the client relies on modified-time polling, then re-list and re-hash it. - Verify that the exact target path has one remote object and that its hash matches the canonical copy. 4. **Pull on other devices** - Keep auto-push disabled. - Run Pull, wait for completion, close and reopen Obsidian, and open the exact target path. - If the file is still absent locally while it exists remotely, do not click the wikilink repeatedly and do not push; use a controlled reset or manually place a verified copy into the target vault path. - Only push after the pulled file is visibly present and nonempty. - Verify the remote again after each device push. 5. **Set up a free cross-platform vault with Syncthing** - Keep the original vault as the backup and create a separate sync vault from it; do not overwrite the original during migration. - Exclude `.obsidian/`, `/`, ``, tokens, credentials, temporary files, and Syncthing version folders from the sync copy. - Install Syncthing on macOS/Windows and the maintained Syncthing-Fork on Android; use device storage on Android so Syncthing can access the vault. - Add the sync folder as `Send & Receive`, but leave it paused until Android is paired and the destination path is confirmed. - Disable Android battery optimization for Syncthing-Fork; otherwise background sync can appear broken. - After the first transfer, compare file counts and representative hashes, open the copied vault in Obsidian, and only then retire the old sync owner. - Never run Google Drive Sync, rclone, Git sync, or another folder synchronizer against the same Syncthing vault. 6. **Interpret the result** - A blank editor with a populated remote file usually indicates an absent/stale local file or an in-memory editor buffer, not a bad remote file. - A correct remote file plus a missing local file means the pull path, change cursor, or plugin mapping is stale; app reload alone may not repair it. - A display label can differ from the file path. Inspect the full wikilink target before blaming Obsidian's new-note behavior. ## Durable verification checklist Report these values after repair: - exact target path - remote object count for that path - remote byte count - local byte count - local/remote SHA-256 equality - remote-only and local-only file counts - whether a full resync was intentionally skipped See `references/google-drive-plugin.md` for the plugin-specific failure modes and command recipes, and `references/git-vault-sync.md` when moving the vault onto Git/GitHub or doing a routine desktop commit+push (private-folder pathspec exclusion, staged secret scan, remote verification of Turkish filenames).