Summary
Add Export and Import options to the Reflections (History) tab so users can back up, restore, and move their activity history between machines.
Why
Reflections stores all activity locally in events.jsonl (focus sessions, app/website block events). Giving users a way to export and re-import that data reinforces the project's local-first, you-own-your-data principle — backup before a reinstall, sync between PCs, or archive.
Proposed scope
- Export: a button (near the existing "Clear history") that writes the history to a file via a native save dialog. Format: a small JSON bundle (e.g.
{ version, exportedAt, events: [...] }) wrapping the events.jsonl records. Optionally include the daily-goal setting.
- Import: a button that reads a chosen export file and loads it. Offer Merge (default — dedupe and append) vs Replace (overwrite current history).
- Wire through IPC + preload (mirrors
history:summary / history:clear).
Considerations
- Validate/normalize imported records (reuse
readEvents-style parsing; skip malformed lines).
- Dedupe on merge (by
t + ts + target) so re-importing the same file is idempotent.
- Version the export format for forward-compat.
- Confirm before Replace (it's destructive, like Clear).
Acceptance
- Export produces a file that re-imports cleanly with identical resulting Reflections.
- Import merge is idempotent; replace fully swaps history.
- Unit tests for the export/import/merge helpers in
history.js.
Relates to Phase 5 (Reflections).
Summary
Add Export and Import options to the Reflections (History) tab so users can back up, restore, and move their activity history between machines.
Why
Reflections stores all activity locally in
events.jsonl(focus sessions, app/website block events). Giving users a way to export and re-import that data reinforces the project's local-first, you-own-your-data principle — backup before a reinstall, sync between PCs, or archive.Proposed scope
{ version, exportedAt, events: [...] }) wrapping theevents.jsonlrecords. Optionally include the daily-goal setting.history:summary/history:clear).Considerations
readEvents-style parsing; skip malformed lines).t+ts+ target) so re-importing the same file is idempotent.Acceptance
history.js.Relates to Phase 5 (Reflections).