Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat(retention): CLI off by default, app on by default for new installs

Louis Beaumont81e99a453ee5
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
index 626561803..4528827d3 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -1770,6 +1770,20 @@ pub fn init_store(app: &AppHandle) -> Result<SettingsStore, String> {
}
}
+ // New installs opt into local data retention (14-day media cleanup; transcripts,
+ // OCR and the searchable timeline are kept). Written as an explicit store field so
+ // the Storage settings toggle shows ON and auto_start_retention() picks it up.
+ // Existing stores are never touched here: flipping the fallback for users who
+ // installed before this default would silently delete their old recordings —
+ // auto_start_retention() in sync.rs deliberately reads `localRetentionEnabled ?? false`.
+ if is_new_store && !store.extra.contains_key("localRetentionEnabled") {
+ store.extra.insert(
+ "localRetentionEnabled".to_string(),
+ serde_json::Value::Bool(true),
+ );
+ should_save = true;
+ }
+
if should_save {
if let Err(e) = store.save(app) {
// Non-fatal — logged as warn (not error) so Sentry doesn't pick it up.
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
index 371638df4..a76100a45 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
@@ -794,7 +794,9 @@ pub async fn auto_start_retention(app: &AppHandle) {
// reads `localRetentionEnabled ?? false`, so the toggle visibly shows
// "off" for those users; defaulting to `true` here would run retention
// behind their back. Users who want auto-delete enable it via Settings →
- // Storage, which writes the field to the store.
+ // Storage, which writes the field to the store. New installs get the
+ // field written as `true` by init_store(), so retention is on by default
+ // for them without affecting anyone who installed earlier.
let enabled = settings
.extra
.get("localRetentionEnabled")
diff --git a/crates/screenpipe-engine/src/cli/mod.rs b/crates/screenpipe-engine/src/cli/mod.rs
index 04752bd74..e68720570 100644
--- a/crates/screenpipe-engine/src/cli/mod.rs
+++ b/crates/screenpipe-engine/src/cli/mod.rs
@@ -735,8 +735,10 @@ pub struct RecordArgs {
pub encrypt_secrets: bool,
/// Local data retention in days. Old screen/audio data is auto-deleted after this period.
- /// Set to 0 to disable retention (keep data forever).
- #[arg(long, default_value_t = 14)]
+ /// Disabled by default (0 = keep data forever); set a positive number of days to opt in.
+ /// CLI deployments must never silently delete data — the desktop app opts new users in
+ /// through its own onboarding default instead.
+ #[arg(long, default_value_t = 0)]
pub retention_days: u32,
/// What gets cleaned up past the retention cutoff.