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: improve search prompts to prevent false negatives from over-filtering

louis030195d203560d40cd
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 7655ae5fe..10ef197fc 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -92,12 +92,13 @@ function buildSystemPrompt(): string {
CRITICAL SEARCH RULES (database has 600k+ entries - ALWAYS use time filters):
1. ALWAYS include start_time in EVERY search - NEVER search without a time range
2. Default time range: last 1-2 hours. Expand ONLY if no results found
-3. ALWAYS use app_name filter when user mentions ANY app
-4. Keep limit=5-10 per search. NEVER use limit > 50
-5. Maximum 10 search/API calls per user request. Stop and summarize what you have
-6. For weekly/multi-day queries: search ONE DAY AT A TIME with small limits, never the full range at once
-7. Prefer /raw_sql with COUNT(*), GROUP BY, and aggregation over fetching raw content rows
-8. All /raw_sql SELECT queries MUST include a LIMIT clause (max 10000). The server will reject queries without LIMIT
+3. First search: ONLY use time params (start_time, end_time). No q, no app_name, no content_type. This gives ground truth of what's recorded. Scan results to find correct app_name values, then narrow with filters using exact observed values. App names are case-sensitive and may differ from user input (e.g. "Discord" vs "Discord.exe" vs "discord"). The q param searches captured text (accessibility/OCR), NOT app names.
+4. NEVER report "no data found" after one filtered search. Verify with unfiltered time-only search first.
+5. Keep limit=5-10 per search. NEVER use limit > 50
+6. Maximum 10 search/API calls per user request. Stop and summarize what you have
+7. For weekly/multi-day queries: search ONE DAY AT A TIME with small limits, never the full range at once
+8. Prefer /raw_sql with COUNT(*), GROUP BY, and aggregation over fetching raw content rows
+9. All /raw_sql SELECT queries MUST include a LIMIT clause (max 10000). The server will reject queries without LIMIT
Rules for showing videos/audio:
- Show videos by putting .mp4 file paths in inline code blocks: \`/path/to/video.mp4\`
diff --git a/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md b/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md
index ad0ac6f5f..65c8fd2a7 100644
--- a/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md
+++ b/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md
@@ -51,10 +51,11 @@ curl "http://localhost:3030/search?q=QUERY&content_type=all&limit=10&start_time=
1. **ALWAYS include `start_time`** — the database has hundreds of thousands of entries. Queries without time bounds WILL timeout.
2. **Start with short time ranges** — default to last 1-2 hours. Only expand if no results found.
-3. **Use `app_name` filter** whenever the user mentions a specific app.
-4. **Keep `limit` low** (5-10) initially. Only increase if the user needs more.
-5. **"recent"** = last 30 minutes. **"today"** = since midnight. **"yesterday"** = yesterday's date range.
-6. If a search times out, retry with a narrower time range (e.g. 30 mins instead of 2 hours).
+3. **First search: ONLY use time params** (start_time, end_time). No `q`, no `app_name`, no `content_type`. This gives ground truth of what's actually recorded. Then scan results to identify correct `app_name` values and content patterns. Only THEN narrow with filters using the exact values you observed. App names are case-sensitive and may differ from what users say (e.g. "Discord" might be stored as "Discord.exe" or "discord"). The `q` param searches captured text content (accessibility/OCR), NOT app names — an app can be visible without its name appearing in the captured text.
+4. **NEVER report "no data found" after only one filtered search.** Always verify with an unfiltered time-only search first.
+5. **Keep `limit` low** (5-10) initially. Only increase if the user needs more.
+6. **"recent"** = last 30 minutes. **"today"** = since midnight. **"yesterday"** = yesterday's date range.
+7. If a search times out, retry with a narrower time range (e.g. 30 mins instead of 2 hours).
### Example Searches
@@ -242,7 +243,7 @@ You were browsing GitHub at [10:30 AM — Chrome](screenpipe://frame/12345) when
- Timestamps in results are UTC. Convert to the user's local timezone when displaying.
- If asked "what did I work on today?", search with broad terms and short time ranges, then summarize by app/activity.
- If asked about meetings, use `content_type=audio`.
-- If asked about a specific app, always use the `app_name` filter.
+- If asked about a specific app, first search with only time filters to discover the exact `app_name` value stored in the database, then filter by that value.
- Combine multiple searches to build a complete picture (e.g., screen + audio for a meeting).
- **For aggregation over large datasets**, use raw SQL instead of paginating through search results. The `/search` endpoint returns paginated results (default limit 20), so summarizing thousands of events requires raw SQL. Examples:
diff --git a/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts b/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts
index 49917e0a9..d5a0a2ed1 100644
--- a/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts
+++ b/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts
@@ -68,6 +68,10 @@ const BASE_TOOLS: Tool[] = [
"Returns timestamped results with app context. " +
"Call with no parameters to get recent activity. " +
"Use the 'screenpipe://context' resource for current time when building time-based queries.\n\n" +
+ "SEARCH STRATEGY: First search with ONLY time params (start_time/end_time) — no q, no app_name, no content_type. " +
+ "This gives ground truth of what's recorded. Scan results to find correct app_name values, then narrow with filters using exact observed values. " +
+ "App names are case-sensitive and may differ from user input (e.g. 'Discord' vs 'Discord.exe'). " +
+ "The q param searches captured text (accessibility/OCR), NOT app names. NEVER report 'no data' after one filtered search — verify with unfiltered time-only search first.\n\n" +
"DEEP LINKS: When referencing specific moments, create clickable links using IDs from search results:\n" +
"- OCR results (PREFERRED): [10:30 AM — Chrome](screenpipe://frame/12345) — use content.frame_id from the result\n" +
"- Audio results: [meeting at 3pm](screenpipe://timeline?timestamp=2024-01-15T15:00:00Z) — use exact timestamp from result\n" +
@@ -313,6 +317,13 @@ Screenpipe captures four types of data:
| app_name | Filter by app | (no filter) |
| include_frames | Include screenshots | false |
+## Search Strategy (MANDATORY)
+1. First search: ONLY use time params (start_time/end_time). No q, no app_name, no content_type. This gives ground truth of what's recorded.
+2. Scan results to find correct app_name values and content patterns.
+3. Only THEN narrow with filters using exact observed values. App names are case-sensitive and may differ from user input (e.g. "Discord" vs "Discord.exe").
+4. The q param searches captured text (accessibility/OCR), NOT app names — an app can be visible without its name in the captured text.
+5. NEVER report "no data found" after one filtered search. Verify with unfiltered time-only search first.
+
## Tips
1. Read screenpipe://context first to get current timestamps
2. Use content_type=input for "what did I type?" queries