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: serialize macOS accessibility queries to prevent crash + pipe store cache fixes

Louis Beaumont064553cb156d
diff --git a/Cargo.lock b/Cargo.lock
index f62df3723..32518eecc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6755,7 +6755,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"anyhow",
"audiopipe",
@@ -6815,7 +6815,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -6828,7 +6828,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"anyhow",
"async-trait",
@@ -6856,7 +6856,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6902,7 +6902,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"anyhow",
"chrono",
@@ -6928,7 +6928,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"anyhow",
"async-trait",
@@ -6998,7 +6998,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"anyhow",
"chrono",
@@ -7016,7 +7016,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -7056,7 +7056,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.269"
+version = "0.3.271"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/apps/screenpipe-app-tauri/components/pipe-store.tsx b/apps/screenpipe-app-tauri/components/pipe-store.tsx
index 2ac4c7a69..4d964e8f3 100644
--- a/apps/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/apps/screenpipe-app-tauri/components/pipe-store.tsx
@@ -478,7 +478,10 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {
if (cached) {
setPipes(cached);
// If cache is still fresh, skip network request
- if (apiCache.isFresh(cacheKey)) return;
+ if (apiCache.isFresh(cacheKey)) {
+ setLoading(false);
+ return;
+ }
} else {
setLoading(true);
}
@@ -641,6 +644,7 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {
toast({ title: `"${slug}" unpublished from store` });
setShowDetail(false);
setSelectedPipe(null);
+ apiCache.invalidatePrefix("pipes/store");
fetchPipes();
} catch (err: any) {
toast({
@@ -812,6 +816,7 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {
onOpenChange={setPublishOpen}
token={token}
onPublished={() => {
+ apiCache.invalidatePrefix("pipes/store");
fetchPipes();
toast({ title: "pipe published to store" });
}}
diff --git a/crates/screenpipe-a11y/src/platform/macos.rs b/crates/screenpipe-a11y/src/platform/macos.rs
index 88dee3fe4..86a064f30 100644
--- a/crates/screenpipe-a11y/src/platform/macos.rs
+++ b/crates/screenpipe-a11y/src/platform/macos.rs
@@ -19,6 +19,12 @@ use tracing::{debug, error};
use cidre::cg::event::access as cg_access;
use cidre::{ax, cf, cg, ns};
+/// Guard to serialize accessibility queries – concurrent calls to
+/// AXUIElementCopyElementAtPosition can corrupt AppKit's internal
+/// accessibility caches (NSAccessibilityIsSelectorUsingBaseImplementation)
+/// and cause a SIGABRT in CFDictionarySetValue / __CFBasicHashRehash.
+static AX_QUERY_LOCK: parking_lot::Mutex<()> = parking_lot::Mutex::new(());
+
// Keycodes for clipboard operations (macOS)
const KEY_C: u16 = 8;
const KEY_X: u16 = 7;
@@ -965,6 +971,11 @@ fn get_element_at_position(x: f64, y: f64, config: &UiCaptureConfig) -> Option<E
return None;
}
+ // Serialize accessibility queries to prevent concurrent calls that corrupt
+ // AppKit's internal accessibility caches. Use try_lock to avoid blocking
+ // the event tap callback path – if another query is in-flight, skip this one.
+ let _guard = AX_QUERY_LOCK.try_lock()?;
+
let sys = ax::UiElement::sys_wide();
let elem = sys.element_at_pos(x as f32, y as f32).ok()?;
@@ -1066,6 +1077,9 @@ fn get_focused_window_title(pid: i32) -> Option<String> {
/// Get the currently focused UI element's context (for capturing text field values)
fn get_focused_element_context(config: &UiCaptureConfig) -> Option<ElementContext> {
+ // Serialize accessibility queries (same guard as get_element_at_position)
+ let _guard = AX_QUERY_LOCK.try_lock()?;
+
let sys = ax::UiElement::sys_wide();
let focused = sys.attr_value(ax::attr::focused_ui_element()).ok()?;
diff --git a/crates/screenpipe-core/assets/pipes/ai-prompt-journal/README.md b/crates/screenpipe-core/assets/pipes/ai-prompt-journal/README.md
new file mode 100644
index 000000000..fae6aee21
--- /dev/null
+++ b/crates/screenpipe-core/assets/pipes/ai-prompt-journal/README.md
@@ -0,0 +1,99 @@
+# AI Prompt Journal
+
+**Every prompt you send to AI — automatically captured and organized in your vault.**
+
+You use ChatGPT, Claude, Gemini, Perplexity, and a dozen other AI tools every day. But what did you actually *ask* them? What problems were you solving? What ideas were you exploring?
+
+AI Prompt Journal watches your screen and captures every prompt you type into AI tools — then saves them as a clean, searchable daily journal in your Obsidian vault (or local markdown).
+
+## What it does
+
+- **Monitors 15+ AI tools** — ChatGPT, Claude, Gemini, Perplexity, Grok, DeepSeek, Copilot, Mistral, Poe, HuggingChat, OpenRouter, LM Studio, Ollama, Jan, GPT4All, and more
+- **Extracts only YOUR prompts** — smart heuristics separate what you typed from AI responses
+- **Auto-classifies** each prompt by tool, category (coding, writing, research, brainstorming...), topic, and length
+- **Saves to Obsidian** — daily notes with YAML frontmatter and tags, ready for search and backlinks
+- **Falls back gracefully** — no Obsidian? Saves to `~/.screenpipe/ai-prompts/` as plain markdown
+- **Deduplicates** — won't log the same prompt twice even if the page is captured multiple times
+- **Cross-platform** — works on macOS, Windows, and Linux
+
+## Example output
+
+```markdown
+## 09:15 — ChatGPT — React auth flow
+**Category**: coding | **Length**: long
+
+> How do I implement OAuth 2.0 with PKCE in a React SPA? I need to support
+> Google and GitHub providers. Show me the full flow including token refresh.
+
+---
+
+## 10:42 — Claude — Quarterly planning
+**Category**: writing | **Length**: medium
+
+> Help me draft the Q3 roadmap for our team. We need to prioritize
+> infrastructure work vs new features. Budget is flat.
+
+---
+
+## 11:30 — Perplexity — Market research
+**Category**: research | **Length**: short
+
+> What's the current market size for AI-powered CRM tools in 2026?
+
+---
+```
+
+## Why this matters
+
+- **Remember your best prompts** — that perfect prompt you crafted 3 weeks ago? Now you can find it
+- **Track AI usage patterns** — see which tools you use for what, and how your usage evolves
+- **Team visibility** — share the journal with your team to see what problems everyone is solving with AI
+- **Prompt library** — over time, build a personal library of effective prompts organized by topic
+- **Audit trail** — know exactly what data you fed into which AI tool, when
+
+## Setup
+
+1. Install this pipe from the screenpipe store
+2. (Optional) Connect Obsidian in Settings > Connections — set your vault path
+3. The pipe runs every hour automatically and captures any AI prompts from the last hour
+4. Check your journal at `{vault}/screenpipe/ai-prompts/YYYY-MM-DD.md`
+
+## How it works
+
+The pipe uses screenpipe's accessibility tree and OCR data to read what's on your screen. It:
+
+1. **Finds AI tool frames** — SQL query matches window titles and app names against known AI tools
+2. **Extracts text** — pulls structured elements, full-page text, and input field contents
+3. **Separates prompts from responses** — uses conversation structure, element roles, and text heuristics
+4. **Deduplicates** — groups identical text across frames, keeps the most complete version
+5. **Classifies and saves** — categorizes each prompt and appends to the daily journal
+
+Everything runs locally. Your prompts never leave your machine.
+
+## Supported AI tools
+
+| Tool | Detection method |
+|------|-----------------|
+| ChatGPT | App name or window title |
+| Claude | Browser window title pattern |
+| Gemini | URL pattern |
+| Perplexity | App name or URL |
+| Grok | URL pattern |
+| DeepSeek | URL pattern |
+| Copilot | URL pattern |
+| Mistral | URL pattern |
+| Poe | URL pattern |
+| HuggingChat | URL pattern |
+| OpenRouter | URL pattern |
+| Google AI Studio | URL pattern |
+| LM Studio | Native app name |
+| Ollama | Native app name |
+| Jan | Native app name |
+| GPT4All | Native app name |
+
+## Privacy
+
+- Runs 100% locally — no data sent anywhere
+- Only reads screen data already captured by screenpipe
+- Prompts are saved to your local filesystem only
+- You control the output location (Obsidian vault or ~/.screenpipe/)