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

improve obsidian sync: better prompt with all modalities, privacy, accumulation

Louis Beaumont498214a70b18
diff --git a/apps/screenpipe-app-tauri/components/settings/obsidian-sync-card.tsx b/apps/screenpipe-app-tauri/components/settings/obsidian-sync-card.tsx
index e4b8bd9cb..5c6bfd1cc 100644
--- a/apps/screenpipe-app-tauri/components/settings/obsidian-sync-card.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/obsidian-sync-card.tsx
@@ -141,12 +141,11 @@ interface SyncHistoryEntry {
const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone; // e.g. "America/New_York"
-const DEFAULT_CUSTOM_PROMPT = `use timezone: ${userTimezone}
+const DEFAULT_CUSTOM_PROMPT = `timezone: ${userTimezone}
+focus areas: work, coding, meetings
+my projects: [[Project A]], [[Project B]]
embed video clips for meetings using absolute file paths
-include timeline deep links for key moments
-use [[Name]] wiki-links for people and projects
-one file per day, daily note obsidian style
-be concise, capture reminders, todos, goals`;
+tag people I talk to frequently: [[Alice]], [[Bob]]`;
const DEFAULT_SETTINGS: ObsidianSyncSettings = {
enabled: false,
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/obsidian_sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/obsidian_sync.rs
index e4963a45b..581f088df 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/obsidian_sync.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/obsidian_sync.rs
@@ -92,17 +92,36 @@ GET /search
```
Query parameters:
-- `content_type`: "ocr" | "audio" | "all" (default: all)
+- `content_type`: "ocr" | "audio" | "input" | "accessibility" | "all" (default: all)
+ - `ocr` — screen text from screenshots
+ - `audio` — transcribed speech
+ - `input` — user actions: clicks, keystrokes, clipboard, app switches
+ - `accessibility` — accessibility tree text (richer than OCR for UI elements)
+ - `all` — combines ocr + audio + accessibility
- `start_time`: ISO 8601 timestamp (e.g., 2025-02-01T10:00:00Z)
- `end_time`: ISO 8601 timestamp
- `limit`: max results per request (default: 50, max: 1000)
- `offset`: pagination offset
+- `q`: text search query (optional, filters results by keyword)
+- `app_name`: filter by app (e.g., "Arc", "Slack", "zoom")
+- `min_length`: minimum content length in chars (use 50 to skip noise)
+- `speaker_name`: filter audio by speaker name
Example:
```bash
-curl "http://localhost:3030/search?content_type=all&start_time=2025-02-01T10:00:00Z&end_time=2025-02-01T10:30:00Z&limit=200"
+curl "http://localhost:3030/search?content_type=ocr&start_time=2025-02-01T10:00:00Z&end_time=2025-02-01T10:30:00Z&limit=200&min_length=50"
```
+### Querying Strategy
+
+For best results, query each modality separately per 30-min chunk:
+1. `content_type=ocr&min_length=50` — what was on screen (apps, documents, code)
+2. `content_type=audio` — what was said (meetings, voice notes)
+3. `content_type=input` — what the user did (typed text, clicks, app switches, clipboard)
+4. `content_type=accessibility` — UI element tree (buttons, labels, menus — richer than OCR for understanding UI interactions)
+
+This gives you richer context than a single `all` query. Use `input` data to understand workflow, `audio` for meeting summaries, and `accessibility` for precise UI context.
+
Response format:
```json
{
@@ -131,47 +150,74 @@ Response format:
## Your Task
-1. Query the screenpipe API for the specified time range
-2. Process data in 30-minute chunks to manage context size
-3. For each chunk, summarize the key activities
-4. Append summaries to the daily markdown log file
-5. Create folders/files as needed
+1. Read the existing daily note file first (if it exists) — you will merge into it
+2. Query the screenpipe API for the specified time range in 30-minute chunks
+3. Use `min_length=50` to skip noisy/short OCR fragments
+4. Synthesize activities, extract action items, and write the note
## Output Format
-Create/append to the daily log file using this markdown table format:
+Write the daily note with these sections:
```markdown
# Activity Log - YYYY-MM-DD
+## Timeline
+
| Time | Activity | Apps | Tags |
|------|----------|------|------|
| 10:00-10:30 | Reviewed PR #123 for auth module | GitHub, VSCode | #coding #review |
| 10:30-11:00 | Call with team about roadmap | Zoom, Notion | #meeting #planning |
+
+## Action Items
+
+- [ ] Follow up with [[Alice]] on API design — from 10:30 meeting
+- [ ] Review deployment checklist before Friday
+- [ ] Visit https://example.com/docs for reference
+
+## Key Moments
+
+- [10:32 AM](screenpipe://timeline?timestamp=2025-02-01T10:32:00Z) — [[Bob]] mentioned Q2 deadline is March 15
+- [11:15 AM](screenpipe://timeline?timestamp=2025-02-01T11:15:00Z) — decided to use PostgreSQL for new service
+
+## Summary
+
+Brief 2-3 sentence summary of the day's main themes and accomplishments.
```
-## Embedding Media & Deep Links
+## Accumulation Rules (critical for hourly syncs)
+
+- ALWAYS read the existing note file first before writing
+- MERGE new time ranges into the existing timeline — do not overwrite earlier entries
+- DEDUPLICATE: if a time range already exists, skip or update it, don't duplicate
+- MERGE action items: keep existing TODOs, add new ones, don't remove completed items
+- REWRITE the Summary section to cover the full day so far (not just the latest chunk)
-In the markdown output you can reference screenpipe data directly:
+## Privacy Rules
-- **Timeline links**: `[10:30 AM](screenpipe://timeline?timestamp=2025-02-01T10:30:00Z)` — opens screenpipe timeline at that moment
-- **Frame links**: `[screenshot](screenpipe://frame/12345)` — opens a specific captured frame (use frame_id from search results)
-- **Video files**: embed with `![video](/path/to/file.mp4)` using the exact file_path from search results
-- **Audio files**: embed with `![audio](/path/to/file.mp4)` using the audio_file_path from search results
+- NEVER dump raw OCR text — always synthesize into activity descriptions
+- REDACT passwords, API keys, tokens, secrets, and credentials if they appear in OCR
+- SKIP banking, financial, and medical content — just note "personal/private activity"
+- MINIMIZE personally identifiable information — use [[Name]] links, don't include full emails/phone numbers
+- DO NOT include full audio transcripts — summarize conversations instead
-These work when opening the note in Obsidian on the same machine running screenpipe.
+## Embedding Media & Deep Links
+
+- **Timeline links**: `[10:30 AM](screenpipe://timeline?timestamp=2025-02-01T10:30:00Z)` — opens screenpipe at that moment
+- **Frame links**: `[screenshot](screenpipe://frame/12345)` — links a specific captured frame
+- **Video files**: `![video](/path/to/file.mp4)` using the exact file_path from search results
+- **Audio files**: `![audio](/path/to/file.mp4)` using audio_file_path from search results
## Best Practices
- Link people names with [[Name]] (Obsidian wiki-links)
- Link projects/concepts with [[concept-name]]
+- Extract TODOs: explicit tasks, follow-ups, URLs to visit, deadlines, purchases mentioned
- Keep summaries concise but capture key activities
- Group related activities together
-- Include apps used for context
-- Add semantic tags for easy filtering
-- Include timeline deep links for key moments so user can click to review
+- Add semantic tags (#coding, #meeting, #research, etc.)
+- Include timeline deep links for key moments
- Skip idle periods or duplicates
-- If no meaningful activity in a chunk, skip it or note "idle"
## Important
@@ -179,10 +225,8 @@ These work when opening the note in Obsidian on the same machine running screenp
- Use curl to fetch data from the API
- Write files using the write tool
- Create the subfolder structure if it doesn't exist
-- ONLY create/modify the single daily log file (YYYY-MM-DD.md) - DO NOT create any other files like INDEX.md, TODO.md, QUICK_REF.txt, etc.
-- Each sync should append to or update the existing daily log file, not create new files
-- Use the user's LOCAL timezone for all times displayed in the log (convert UTC timestamps to local time)
-- Detect timezone from the system or use the timestamp offsets in the data
+- ONLY create/modify the single daily log file (YYYY-MM-DD.md) - DO NOT create any other files
+- Use the user's LOCAL timezone for all times displayed in the log (convert UTC timestamps)
"#;
/// Build the full prompt for pi
@@ -204,16 +248,8 @@ fn build_prompt(settings: &ObsidianSyncSettings, start_time: &str, end_time: &st
today
);
- let mut prompt = format!(
- r#"Sync my screenpipe activity to Obsidian.
-
-Time range: {} to {}
-Output file: {}
-User's timezone: {} (UTC{})
-
-{}"#,
- start_time, end_time, note_path, timezone, timezone_offset, SYSTEM_PROMPT
- );
+ // Static system prompt first (cacheable by LLM providers), dynamic context last
+ let mut prompt = SYSTEM_PROMPT.to_string();
// Append user's custom prompt if provided
if !settings.custom_prompt.is_empty() {
@@ -221,6 +257,19 @@ User's timezone: {} (UTC{})
prompt.push_str(&settings.custom_prompt);
}
+ prompt.push_str(&format!(
+ r#"
+
+## Current Task
+
+Sync my screenpipe activity to Obsidian.
+
+Time range: {} to {}
+Output file: {}
+User's timezone: {} (UTC{})"#,
+ start_time, end_time, note_path, timezone, timezone_offset
+ ));
+
prompt
}
diff --git a/crates/screenpipe-core/assets/pipes/obsidian-sync/pipe.md b/crates/screenpipe-core/assets/pipes/obsidian-sync/pipe.md
index 60b8651fe..ad7d20477 100644
--- a/crates/screenpipe-core/assets/pipes/obsidian-sync/pipe.md
+++ b/crates/screenpipe-core/assets/pipes/obsidian-sync/pipe.md
@@ -7,27 +7,52 @@ Sync screenpipe activity to an Obsidian vault as a daily markdown log.
## Task
-1. Query the screenpipe search API for the time range given in the context header
-2. Process data in 30-minute chunks to manage context size
-3. For each chunk, summarize the key activities
-4. Append summaries to the daily log file at `~/obsidian-vault/screenpipe/<date>.md`
-5. Create folders if they don't exist
+1. Read the existing daily note file first (if it exists) — merge into it
+2. Query the screenpipe search API for the time range in 30-minute chunks
+3. Use `min_length=50` to skip noisy/short OCR fragments
+4. Synthesize activities, extract action items, write the note
## Search API
```
-GET http://localhost:3030/search?content_type=all&start_time=<ISO8601>&end_time=<ISO8601>&limit=200
+GET http://localhost:3030/search?content_type=ocr&start_time=<ISO8601>&end_time=<ISO8601>&limit=200&min_length=50
```
+Content types: `ocr` (screen text), `audio` (speech), `input` (clicks/keystrokes/clipboard/app switches), `accessibility` (UI tree), `all`.
+
+Extra params: `q` (keyword), `app_name`, `speaker_name`, `offset` (pagination).
+
+Query each modality separately per chunk for richer results:
+1. `content_type=ocr&min_length=50` — what was on screen
+2. `content_type=audio` — what was said
+3. `content_type=input` — what was typed, clicked, copied
+4. `content_type=accessibility` — UI elements (buttons, labels, menus)
+
## Output Format
```markdown
# Activity Log - <date>
+## Timeline
+
| Time | Activity | Apps | Tags |
|------|----------|------|------|
| 10:00-10:30 | Reviewed PR #123 for auth module | GitHub, VSCode | #coding #review |
| 10:30-11:00 | Call with team about roadmap | Zoom, Notion | #meeting #planning |
+
+## Action Items
+
+- [ ] Follow up with [[Alice]] on API design — from 10:30 meeting
+- [ ] Review deployment checklist before Friday
+
+## Key Moments
+
+- [10:32 AM](screenpipe://timeline?timestamp=2025-02-01T10:32:00Z) — [[Bob]] mentioned Q2 deadline
+- [11:15 AM](screenpipe://timeline?timestamp=2025-02-01T11:15:00Z) — decided to use PostgreSQL
+
+## Summary
+
+Brief 2-3 sentence summary of the day so far.
```
## Deep Links
@@ -38,9 +63,23 @@ GET http://localhost:3030/search?content_type=all&start_time=<ISO8601>&end_time=
## Rules
- Link people with [[Name]] and concepts with [[concept]] (Obsidian wiki-links)
+- Extract TODOs: tasks, follow-ups, URLs to visit, deadlines mentioned
- Keep summaries concise, group related activities
- Add semantic tags (#coding, #meeting, etc.)
- Skip idle periods or duplicates
-- Use the user's local timezone (from context header) for all displayed times
+- Use the user's local timezone for all displayed times
- Query in chunks to avoid context overflow
-- Each sync appends to or updates the existing daily log — don't overwrite
+
+## Accumulation (for hourly syncs)
+
+- Read existing note first — merge, don't overwrite
+- Deduplicate time ranges already in the timeline
+- Keep existing TODOs, add new ones
+- Rewrite Summary to cover the full day so far
+
+## Privacy
+
+- Never dump raw OCR — synthesize into activity descriptions
+- Redact passwords, API keys, tokens, credentials
+- Skip banking/financial/medical content — note as "private activity"
+- Summarize conversations, don't paste full transcripts