Version History for Notes (Time Travel)
Integrate the existing TimeTravelEngine with the note storage system to provide per-note version history.
Existing Infrastructure
TimeTravelEngine in src/infra/time_travel.rs already supports:
- Snapshot capture with timestamps
- Disk persistence (JSON files)
- Query as of a specific timestamp
- Snapshot listing and removal
- Eviction policy (max snapshots)
Integration Work
-
Auto-snapshot on note write
- After every N note writes (configurable: default 10), capture a full snapshot
- Store snapshot in
{data_dir}/time_travel/
-
Per-note version tracking
- Store version metadata key:
__version:{note_path} → { current_version, history: [ts1, ts2, ...] }
- When user requests history, return timestamps + labels
-
API Endpoints
GET /notes/{path}/history — List available versions
GET /notes/{path}/history/{timestamp} — Get note content at that version
POST /notes/{path}/snapshot — Trigger manual snapshot
DELETE /notes/{path}/history/{timestamp} — Remove a specific version
-
Restore from version
POST /notes/{path}/restore?timestamp={ts} — Restore note to a previous version
- Creates a new version (not destructive)
Configuration
pub struct NoteVersionConfig {
pub auto_snapshot_interval: usize, // Auto-snapshot every N writes (default: 10)
pub max_snapshots: usize, // Max versions to keep (default: 100)
pub snapshot_dir: PathBuf, // Storage path for snapshot files
pub enable_auto_snapshot: bool, // Enable/disable auto-snapshots
}
Acceptance Criteria
Parent Epic
#275
Version History for Notes (Time Travel)
Integrate the existing
TimeTravelEnginewith the note storage system to provide per-note version history.Existing Infrastructure
TimeTravelEngineinsrc/infra/time_travel.rsalready supports:Integration Work
Auto-snapshot on note write
{data_dir}/time_travel/Per-note version tracking
__version:{note_path}→{ current_version, history: [ts1, ts2, ...] }API Endpoints
GET /notes/{path}/history— List available versionsGET /notes/{path}/history/{timestamp}— Get note content at that versionPOST /notes/{path}/snapshot— Trigger manual snapshotDELETE /notes/{path}/history/{timestamp}— Remove a specific versionRestore from version
POST /notes/{path}/restore?timestamp={ts}— Restore note to a previous versionConfiguration
Acceptance Criteria
TimeTravelEngineParent Epic
#275