Sync / foldkit-durable
Retention
Three tables grow monotonically over the lifetime of a database: one identity row per distinct opId (retained across compaction to recognize old retries), one row per effect key, and parked runs until unparked.
Compaction clears payload columns while leaving SQLite free pages in the file; schedule vacuum() during maintenance to rebuild the file and checkpoint the WAL (an active reader on another connection can cause vacuum to fail with JournalError, which succeeds on a later run).
When rotating or recreating a database file, reject stale operations older than your retained window (using a per-document watermark or comparing base cursors against the floor) so lost identity rows cannot be re-applied as new edits.