# Obsidian Sync Plan ## Goal Build a self-hosted sync system for an Obsidian vault that works across Windows, Linux, and Android. The system will use an Obsidian plugin for clients, a central sync server, and end-to-end encrypted note transfer. Conflicts should try automatic merge first, then fall back to user-visible conflict handling. ## Current Implementation Slice 1. Create a TypeScript monorepo for the plugin, server, and shared libraries. 2. Define shared sync contracts for device registration, pull, push, tombstones, and conflict responses. 3. Add a shared sync engine with AES-GCM encryption, hashing, and safe text merge helpers. 4. Build a durable server that registers devices, stores encrypted note revisions on disk, and writes structured request and client-sync logs. 5. Build an Obsidian plugin with settings, manual sync, scheduled sync, remote pull, local push, attachment sync, conflict marker handling, and sync-run diagnostics upload. 6. Validate the scaffold with a workspace build and focused tests. ## Delivery Phases ### Phase 1 - Monorepo setup - Protocol definitions - Shared crypto and merge helpers - Minimal server API - Plugin settings and sync loop ### Phase 2 - Durable storage backend for the server - Attachment sync - Better device onboarding and recovery flow - Structured logs and user-visible sync diagnostics ### Phase 3 - Hardening for large vaults and flaky networks - Packaging and deployment docs - Cross-device integration testing ## Notes - The server now persists encrypted sync state to a local data directory and keeps JSON-line diagnostics logs. - Text conflicts are handled on the client and binary conflicts produce a remote conflict copy. - Recovery bundle onboarding, device revocation, key rotation, and batched sync are implemented in the current repo. - The next highest-priority gap is broader multi-instance Obsidian integration testing and a production-grade database-backed server store.