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

fix: warm up VisionKit analyzer on init, reduce incognito false positives

Louis Beaumontb0e9f8c8ceb6
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift b/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift
index c84ea124e..afdf5cd35 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift
@@ -218,7 +218,24 @@ public func ltInit(_ windowPtr: UInt64) -> Int32 {
contentView.addSubview(overlay)
mgr.overlayView = overlay
}
- let _ = mgr.ensureAnalyzer()
+ let analyzer = mgr.ensureAnalyzer()
+
+ // Warm up VisionKit by running a tiny dummy analysis in the background.
+ // The first real analyze() call triggers Apple's ML model loading which
+ // can take several seconds. By doing it here the models are ready by
+ // the time the user navigates to a frame.
+ Task.detached {
+ autoreleasepool {
+ let size = NSSize(width: 1, height: 1)
+ let img = NSImage(size: size)
+ img.lockFocus()
+ NSColor.white.setFill()
+ NSRect(origin: .zero, size: size).fill()
+ img.unlockFocus()
+ let config = ImageAnalyzer.Configuration([.text])
+ let _ = try? await analyzer.analyze(img, orientation: .up, configuration: config)
+ }
+ }
return 0
}
diff --git a/crates/screenpipe-a11y/src/incognito/titles.rs b/crates/screenpipe-a11y/src/incognito/titles.rs
index 5cfe3f92c..56d259d4b 100644
--- a/crates/screenpipe-a11y/src/incognito/titles.rs
+++ b/crates/screenpipe-a11y/src/incognito/titles.rs
@@ -55,11 +55,21 @@ pub fn is_title_private(window_title: &str) -> bool {
/// English keywords — covers Chrome, Firefox, Edge, Brave, Safari.
/// These are checked against the lowercased title.
///
-/// Order matters: more specific strings first avoids misleading matches.
-/// "private" is intentionally broad — it catches "Private Browsing",
-/// "Brave Private", and any variation. A title like "Private API docs"
-/// would be a false positive, but skipping is safer than recording.
-const ENGLISH_KEYWORDS: &[&str] = &["incognito", "inprivate", "private", "password", "secret"];
+/// We use specific phrases instead of bare words like "private" to avoid
+/// false positives on normal windows (e.g. "Private API docs", "Secret
+/// Santa Planning"). Browser incognito indicators always appear in
+/// specific patterns like "(Private Browsing)" or "- Brave Private".
+const ENGLISH_KEYWORDS: &[&str] = &[
+ "incognito",
+ "inprivate",
+ // Specific "private" phrases used by browsers
+ "private browsing",
+ "private window",
+ "private mode",
+ "- private",
+ "(private)",
+ "brave private",
+];
/// Localized incognito / private-browsing strings from Chromium and Firefox
/// translation files. All entries are lowercase.
@@ -186,13 +196,13 @@ mod tests {
}
#[test]
- fn test_password_window() {
- assert!(is_title_private("Enter Password - Chrome"));
+ fn test_brave_private() {
+ assert!(is_title_private("New Tab - Brave Private"));
}
#[test]
- fn test_secret_window() {
- assert!(is_title_private("Secret Notes - Notepad"));
+ fn test_private_window() {
+ assert!(is_title_private("Safari — Private Window"));
}
// ---- German ----