Engram::Sync
Reconciles the memory migration files on disk (.agents/memories/*.md)
with the per-clone SQLite cache: new files get applied, files that were
deleted get rolled back, files whose content changed get re-applied, and
supersedes demotion links get recomputed from scratch every pass.
Sync only ever looks at the working tree and the store — never git history or branch names — so it is git-agnostic (correct mid-rebase, in detached HEAD, after a stash) and idempotent (rerunning it with nothing changed is a no-op). A deleted or corrupted store is fully rebuilt by the next sync, since every file with no matching row is simply applied.
Class methods
Scans memories_dir and reconciles it against store; embedder, if given, computes embeddings for newly-applied or content-changed memories. Raises Engram::DuplicateIdError if two files in the tree declare the same id (before touching the store at all).