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

perf(vision): cut Obsidian CPU spikes — Chromium flag + targeted OCR skip

Louis Beaumont77b35e61a588
diff --git a/crates/screenpipe-a11y/src/tree/macos.rs b/crates/screenpipe-a11y/src/tree/macos.rs
index 5546c5b1d..3b31428be 100644
--- a/crates/screenpipe-a11y/src/tree/macos.rs
+++ b/crates/screenpipe-a11y/src/tree/macos.rs
@@ -258,6 +258,17 @@ impl MacosTreeWalker {
let eui_attr_name = cf::String::from_str("AXEnhancedUserInterface");
let eui_attr = ax::Attr::with_string(&eui_attr_name);
let _ = ax_app.set_attr(eui_attr, cf::Boolean::value_true());
+
+ // Also set AXManualAccessibility — the Chromium-specific flag.
+ // Newer Electron builds (and Chrome itself) respond to this without
+ // the "screen reader is active" side effects of EnhancedUserInterface.
+ // Some apps (Obsidian in particular — issue #3002) never materialize
+ // their tree under EnhancedUserInterface alone. Idempotent to set
+ // both: the better-supported flag wins.
+ let ama_attr_name = cf::String::from_str("AXManualAccessibility");
+ let ama_attr = ax::Attr::with_string(&ama_attr_name);
+ let _ = ax_app.set_attr(ama_attr, cf::Boolean::value_true());
+
debug!("enhanced AX mode enabled for pid={} app={}", pid, app_name);
}
diff --git a/crates/screenpipe-engine/src/paired_capture.rs b/crates/screenpipe-engine/src/paired_capture.rs
index ba10a2b62..a407310e8 100644
--- a/crates/screenpipe-engine/src/paired_capture.rs
+++ b/crates/screenpipe-engine/src/paired_capture.rs
@@ -141,8 +141,25 @@ pub async fn paired_capture(
.map(|s| a11y_content_is_thin(s, ctx.window_name, ctx.browser_url, ctx.app_name))
.unwrap_or(false);
+ // Apps where OCR fallback is known to produce low-value output at high CPU
+ // cost. See #3002: Obsidian's fullscreen editor fills OCR with gutter line
+ // numbers + tab-bar cruft, running Apple Vision at ~150% CPU per capture
+ // while the user's actual notes are already plain-text .md files on disk
+ // (the obsidian-sync pipe reads them directly). Skipping the fallback here
+ // saves the CPU and leaves the frame accessibility_text empty — search
+ // for those frames returns nothing for now, which is no worse than the
+ // garbage we'd otherwise index.
+ let app_skips_ocr_fallback = ctx.app_name.is_some_and(|name| {
+ let n = name.to_lowercase();
+ n == "obsidian"
+ });
+
// Run OCR when: no a11y text, app prefers OCR, OR a11y text is thin (hybrid)
- let (ocr_text, ocr_text_json) = if !has_accessibility_text || a11y_is_thin {
+ // Skip when the app is on the low-value-OCR list (regardless of a11y state —
+ // if a11y had text we wouldn't be here anyway).
+ let (ocr_text, ocr_text_json) = if (!has_accessibility_text || a11y_is_thin)
+ && !app_skips_ocr_fallback
+ {
// Windows native OCR is async, so call it directly (not inside spawn_blocking)
#[cfg(target_os = "windows")]
{