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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
docs(skills): fix SQLite timestamp comparison in screenpipe-api skill (#4655)
Ezra Ellettef264cad4be33
diff --git a/.claude/skills/screenpipe-api/SKILL.md b/.claude/skills/screenpipe-api/SKILL.mdindex aa2c3b099..7d29c4fc2 100644--- a/.claude/skills/screenpipe-api/SKILL.md+++ b/.claude/skills/screenpipe-api/SKILL.md@@ -252,7 +252,9 @@ curl -X POST http://localhost:3030/raw_sql \-d '{"query": "SELECT ... LIMIT 100"}'```-**Rules**: Every SELECT needs LIMIT. Always filter by time. Read-only. Use `datetime('now', '-24 hours')` for time math.+**Rules**: Every SELECT needs LIMIT. Always filter by time. Read-only. For time math, see the timestamp caveat below.++**Timestamp caveat**: DB timestamps are stored as RFC3339 strings — usually `2026-06-26T18:01:14.214586+00:00` (frames / audio_transcriptions / ui_events), though some tables (e.g. `meetings.meeting_start`, memories) use a `Z` suffix with milliseconds: `2026-06-26T18:01:14.214Z`. Do not compare either form directly to SQLite `datetime()` strings like `timestamp > datetime('now', '-10 seconds')`: the `T` vs space makes it a lexical string comparison and can include stale same-day rows. Use `datetime(timestamp) > datetime('now', '-10 seconds')` (works for both forms), or for indexed string comparisons use an RFC3339-shaped cutoff: `timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-10 seconds')`.**WARNING**: Do NOT use frame counts for time estimates — frames are event-driven, not fixed-interval. Use `/activity-summary` for screen time.@@ -276,7 +278,7 @@ curl -X POST http://localhost:3030/raw_sql \```sql-- Most used apps (last 24h)SELECT app_name, COUNT(*) as frames FROM frames-WHERE timestamp > datetime('now', '-24 hours') AND app_name IS NOT NULL+WHERE timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours') AND app_name IS NOT NULLGROUP BY app_name ORDER BY frames DESC LIMIT 20-- Most visited domains@@ -284,18 +286,18 @@ SELECT CASE WHEN INSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), '/')THEN SUBSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), 1, INSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), '/') - 1)ELSE SUBSTR(browser_url, INSTR(browser_url, '://') + 3) END as domain,COUNT(*) as visits FROM frames-WHERE timestamp > datetime('now', '-24 hours') AND browser_url IS NOT NULL+WHERE timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours') AND browser_url IS NOT NULLGROUP BY domain ORDER BY visits DESC LIMIT 20-- Speaker statsSELECT COALESCE(NULLIF(s.name, ''), 'Unknown') as speaker, COUNT(*) as segmentsFROM audio_transcriptions at LEFT JOIN speakers s ON at.speaker_id = s.id-WHERE at.timestamp > datetime('now', '-24 hours')+WHERE at.timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours')GROUP BY at.speaker_id ORDER BY segments DESC LIMIT 20-- Context switches per hourSELECT strftime('%H:00', timestamp) as hour, COUNT(*) as switches-FROM ui_events WHERE event_type = 'app_switch' AND timestamp > datetime('now', '-24 hours')+FROM ui_events WHERE event_type = 'app_switch' AND timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours')GROUP BY hour ORDER BY hour LIMIT 24```@@ -375,7 +377,7 @@ Meeting updates use `PUT /meetings/:id`, not PATCH. Before appending an AI-gener| `note` | string? | User notes / appended AI summaries || `detection_source` | string | How detected (`app`, `calendar`, `ui`, etc.) |-Also available via raw SQL: `SELECT * FROM meetings WHERE meeting_start > datetime('now', '-24 hours') LIMIT 20`+Also available via raw SQL: `SELECT * FROM meetings WHERE meeting_start > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours') LIMIT 20`---diff --git a/apps/screenpipe-app-tauri/lib/generated/screenpipe-skills.ts b/apps/screenpipe-app-tauri/lib/generated/screenpipe-skills.tsindex c8fb4b83e..ef82b75c8 100644--- a/apps/screenpipe-app-tauri/lib/generated/screenpipe-skills.ts+++ b/apps/screenpipe-app-tauri/lib/generated/screenpipe-skills.ts@@ -6,7 +6,7 @@// Source of truth: .claude/skills/{screenpipe-api,screenpipe-cli}/SKILL.md// Regenerate: bun scripts/gen-skill-content.js (runs automatically on prebuild)-export const SCREENPIPE_API_SKILL_MD = "---\nname: screenpipe-api\ndescription: Query the user's screen recordings, audio, UI elements, and usage analytics via the local Screenpipe REST API at localhost:3030. Use when the user asks about their screen activity, meetings, apps, productivity, media export, retranscription, or connected services.\n---\n\n# Screenpipe API\n\nLocal REST API at `http://localhost:3030`. Full reference (60+ endpoints): https://docs.screenpi.pe/llms-full.txt\n\n## Authentication\n\n**ALL requests require authentication.** Add the auth header to every curl call:\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/...\"\n```\n\nThe `$SCREENPIPE_LOCAL_API_KEY` env var is already set in your environment. Without it you get 403. The only exception is `/health` (no auth needed).\n\n## Context Window Protection\n\nAPI responses can be large. Always write curl output to a file first (`curl ... -o /tmp/sp_result.json`), check size (`wc -c /tmp/sp_result.json`), and if over 5KB read only the first 50-100 lines. Extract what you need with `jq`. NEVER dump full large responses into context.\n\nFor the list endpoints (`/search`, `/elements`, `/frames/{id}/elements`) you can also cut tokens at the source: add `&format=csv` (or `tsv`) to get a columnar table that writes each column name once instead of repeating keys per row, and `&fields=a,b,c` to return only the columns you need (dotted paths like `content.text`). On a list of UI elements that is roughly a 70% token cut versus JSON. Text-heavy `ocr`/`audio` barely benefit (the text blob dominates), so reach for `fields` + `max_content_length` there. With no `format`/`fields` the response is unchanged JSON.\n\n---\n\n## 1. Search — `GET /search`\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/search?q=QUERY&content_type=all&limit=10&start_time=1h%20ago\"\n```\n\n### Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `q` | string | No | Keywords. Do NOT use for audio searches — transcriptions are noisy, q filters too aggressively. |\n| `content_type` | string | No | `all` (default), `accessibility`, `audio`, `input`, `ocr`, `memory`. Screen text is primarily captured via the OS accessibility tree (`accessibility`); OCR is a fallback for apps without accessibility support (games, remote desktops). Use `all` unless you need a specific modality. |\n| `limit` | integer | No | Max 1-20. Default: 10 |\n| `offset` | integer | No | Pagination. Default: 0 |\n| `start_time` | ISO 8601 or relative | **Yes** | Accepts `2024-01-15T10:00:00Z` or `16h ago`, `2d ago`, `30m ago` |\n| `end_time` | ISO 8601 or relative | No | Defaults to now. Accepts `now`, `1h ago` |\n| `app_name` | string | No | e.g. \"Google Chrome\", \"Slack\", \"zoom.us\" |\n| `window_name` | string | No | Window title substring |\n| `speaker_name` | string | No | Filter audio by speaker (case-insensitive partial) |\n| `focused` | boolean | No | Only focused windows |\n| `tags` | string | No | Comma-separated; return only items carrying ALL of them (e.g. `person:ada,project:atlas`). Works for screen/audio and, with `content_type=memory`, memories. See Tags below. |\n| `max_content_length` | integer | No | Truncate each result's text (middle-truncation) |\n| `format` | string | No | `json` (default), `csv`, or `tsv`/`table`. CSV/TSV return a columnar table (column names written once) instead of one JSON object per row, much cheaper to read on list-shaped results. CSV is lossless; TSV collapses newlines (worse for long `ocr` text). |\n| `fields` | string | No | Comma-separated column allowlist of dotted paths, e.g. `type,content.app_name,content.text`. Returns only those columns (handy for dropping the repeated absolute `content.file_path`). Works for `json` too (sparse objects). |\n\n### Progressive Disclosure\n\nDon't jump to heavy `/search` calls. Escalate:\n\n| Step | Endpoint | When |\n|------|----------|------|\n| 0 | `GET /memories?q=...` | **Always query first/in parallel** — highest signal, lowest cost |\n| 1 | `GET /activity-summary?start_time=...&end_time=...` | Broad questions (\"what was I doing?\", \"which apps?\") |\n| 2 | `GET /search?...` | Need specific content |\n| 3 | `GET /elements?...` or `GET /frames/{id}/context` | UI structure, buttons, links |\n| 4 | `GET /frames/{frame_id}` (PNG) | Visual context needed |\n\nDecision tree:\n- \"What was I doing?\" → Step 1 only\n- \"Summarize my meeting\" → Step 2 with `content_type=audio`, NO q param. Add `content_type=all` for screen context.\n- \"How long on X?\" → Step 1 (`/activity-summary` → `total_active_minutes` for the whole range, plus per-app/window `minutes`)\n- \"Which apps today?\" → Step 1 (do NOT use frame counts or raw SQLite)\n- \"What button did I click?\" → Step 3 (`/elements` with role=AXButton)\n- \"Show me what I saw\" → Step 2 (find frame_id) → Step 4\n\n### Tags — linking people, projects, topics\n\nTags are a shared label layer across screen, audio, and memories under one string namespace. Use namespaced tags: `person:ada`, `project:atlas`, `topic:pricing`. Two items sharing a tag are connected.\n\n- Add to a frame/audio: `POST /tags/vision/{frame_id}` or `POST /tags/audio/{chunk_id}` body `{\"tags\":[\"person:ada\"]}`.\n- Add to a memory: include `tags` in `POST /memories` (or `PUT /memories/{id}`).\n- Retrieve by tag: `GET /search?tags=person:ada&start_time=30d%20ago` (screen+audio), or add `content_type=memory` for memories. Multiple tags AND together; matching is exact, not substring.\n\nFrames are pruned by retention, so for a durable link tag a memory (memories also carry `created_at` and a `frame_id` back to the moment). To pull everything about a person across time: one call for captures (`content_type=all&tags=person:ada`) plus one for facts (`content_type=memory&tags=person:ada`).\n\n### Critical Rules\n\n1. **ALWAYS include `start_time`** — queries without time bounds WILL timeout\n2. **Start with 1-2 hour ranges** — expand only if no results\n3. **Use `app_name`** when user mentions a specific app\n4. **Keep `limit` low** (5-10) initially\n5. **\"recent\"** = 30 min. **\"today\"** = since midnight. **\"yesterday\"** = yesterday's range\n6. If timeout, narrow the time range\n\n### Response Format\n\n```json\n{\n \"data\": [\n {\"type\": \"OCR\", \"content\": {\"frame_id\": 12345, \"text\": \"...\", \"timestamp\": \"...\", \"app_name\": \"Chrome\", \"window_name\": \"...\"}},\n {\"type\": \"Audio\", \"content\": {\"chunk_id\": 678, \"transcription\": \"...\", \"timestamp\": \"...\", \"speaker\": {\"name\": \"John\"}}},\n {\"type\": \"UI\", \"content\": {\"id\": 999, \"text\": \"Clicked 'Submit'\", \"timestamp\": \"...\", \"app_name\": \"Safari\"}}\n ],\n \"pagination\": {\"limit\": 10, \"offset\": 0, \"total\": 42}\n}\n```\n\n> **Note**: The `\"OCR\"` type label is used for all screen text results, including text captured via the accessibility tree. Most screen text comes from accessibility, not OCR.\n\n---\n\n## 2. Activity Summary — `GET /activity-summary`\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/activity-summary?start_time=1h%20ago&end_time=now\"\n```\n\nReturns a rich overview with:\n- **total_active_minutes**: authoritative total active screen time for the whole range (every app, idle gaps excluded). Use this as the grand total / denominator. Do NOT sum `windows[].minutes` (capped at 30) and do NOT open `db.sqlite` to recompute durations — this field already is the answer.\n- **apps**: per-app `minutes` (active time), first/last seen\n- **windows**: every distinct window/tab with title, `browser_url`, and `minutes` spent — the most valuable field for *what* the user worked on (top 30 by time)\n- **key_texts**: one representative text snippet per window context (user input fields prioritized over static page text)\n- **audio_summary.top_transcriptions**: actual transcription text with speaker and timestamp (not just counts)\n\nThis is usually enough to answer \"what was I doing?\" without further searches. Only drill into `/search` if you need verbatim quotes or specific content.\n\n> **Building a pipe/automation?** Same rule: call this endpoint for time math. The numbers are computed server-side from frame timestamps — never recompute durations from raw frames, and never ask an LLM to sum minutes (it will drift). Let the model label activities; let this endpoint own the durations.\n\n---\n\n## 3. Elements — `GET /elements`\n\nLightweight FTS search across UI elements (~100-500 bytes each vs 5-20KB from `/search`).\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/elements?q=Submit&start_time=1h%20ago&limit=10\"\n```\n\nParameters: `q`, `frame_id`, `source` (`accessibility`|`ocr`), `role`, `start_time`, `end_time`, `app_name`, `limit`, `offset`, plus `format` (`json`/`csv`/`tsv`) and `fields` (dotted paths). Elements are uniform rows, so this is where the columnar format pays off most:\n\n```bash\n# compact table, only the columns you need (~70% fewer tokens than JSON)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/elements?frame_id=12345&format=csv&fields=role,text,bounds.left,bounds.top\"\n```\n\n### Frame Context — `GET /frames/{id}/context`\n\nReturns accessibility text, parsed nodes, and extracted URLs for a frame.\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/frames/6789/context\"\n```\n\n### Common Roles (platform-specific)\n\nRoles are **not normalized** across platforms. Use the correct format for the user's OS:\n\n| Concept | macOS | Windows | Linux |\n|---------|-------|---------|-------|\n| Button | `AXButton` | `Button` | `Button` |\n| Static text | `AXStaticText` | `Text` | `Label` |\n| Link | `AXLink` | `Hyperlink` | `Link` |\n| Text field | `AXTextField` | `Edit` | `Entry` |\n| Text area | `AXTextArea` | `Document` | `Text` |\n| Menu item | `AXMenuItem` | `MenuItem` | `MenuItem` |\n| Checkbox | `AXCheckBox` | `CheckBox` | `CheckBox` |\n| Group | `AXGroup` | `Group` | `Group` |\n| Web area | `AXWebArea` | `Pane` | `DocumentWeb` |\n| Heading | `AXHeading` | `Header` | `Heading` |\n| Tab | `AXTab` | `TabItem` | `Tab` |\n| List item | `AXRow` | `ListItem` | `ListItem` |\n\nOCR-only roles (fallback when accessibility unavailable): `line`, `word`, `block`, `paragraph`, `page`\n\n---\n\n## 4. Frames (Screenshots) — `GET /frames/{frame_id}`\n\n```bash\ncurl -o /tmp/frame.png \"http://localhost:3030/frames/12345\"\n```\n\nReturns raw PNG. **Never fetch more than 2-3 frames per query** (~1000-2000 tokens each).\n\n---\n\n## 5. Media Export — `POST /export`\n\nRenders a real-time MP4 (screen frames at their true timestamps + synced microphone audio). The clip's duration matches the wall-clock span you ask for — it is NOT a sped-up timelapse.\n\n```bash\ncurl -X POST http://localhost:3030/export \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \\\n -d '{\"start\": \"5m ago\", \"end\": \"now\"}'\n```\n\nFields: `start` + `end` (ISO 8601 or relative like `\"2h ago\"`, `\"now\"`; `end` defaults to now), OR `meeting_id` to export a whole meeting. Optional `output_path` writes the MP4 to a specific absolute path (e.g. `~/Downloads/clip.mp4`); otherwise it lands in the data dir's `exports/` folder.\n\nReturns `{\"output_path\": \"...\", \"frame_count\": N, \"audio_chunk_count\": N, \"duration_secs\": N, \"file_size_bytes\": N}`. Show `output_path` as an inline code block for playback. Long ranges can take a few minutes.\n\n### Audio & ffmpeg\n\nAudio files from search results (`file_path`). Common operations:\n```bash\nffmpeg -y -i /path/to/audio.mp4 -q:a 2 ~/.screenpipe/exports/output.mp3 # convert\nffmpeg -y -i input.mp4 -ss 00:01:00 -to 00:05:00 -q:a 2 clip.mp3 # trim\nffmpeg -y -i input.mp4 -filter:v \"setpts=0.5*PTS\" -an fast.mp4 # speed 2x\nffmpeg -y -i input.mp4 -t 10 -vf \"fps=10,scale=640:-1\" output.gif # GIF\n```\n\nAlways use `-y`, save to `~/.screenpipe/exports/`.\n\n---\n\n## 6. Retranscribe — `POST /audio/retranscribe`\n\n```bash\ncurl -X POST http://localhost:3030/audio/retranscribe \\\n -H \"Content-Type: application/json\" \\\n -d '{\"start\": \"1h ago\", \"end\": \"now\"}'\n```\n\nOptional: `engine` (`whisper-large-v3-turbo`|`whisper-large-v3`|`deepgram`|`qwen3-asr`), `vocabulary` (array of `{\"word\": \"...\", \"replacement\": \"...\"}` for bias/replacement), `prompt` (topic context for Whisper).\n\nKeep ranges short (1h max). Show old vs new transcription.\n\n---\n\n## 7. Raw SQL — `POST /raw_sql`\n\n```bash\ncurl -X POST http://localhost:3030/raw_sql \\\n -H \"Content-Type: application/json\" \\\n -d '{\"query\": \"SELECT ... LIMIT 100\"}'\n```\n\n**Rules**: Every SELECT needs LIMIT. Always filter by time. Read-only. Use `datetime('now', '-24 hours')` for time math.\n\n**WARNING**: Do NOT use frame counts for time estimates — frames are event-driven, not fixed-interval. Use `/activity-summary` for screen time.\n\n### Schema\n\n| Table | Key Columns | Time Column |\n|-------|-------------|-------------|\n| `frames` | `app_name`, `window_name`, `browser_url`, `focused` | `timestamp` |\n| `ocr_text` | `text`, `app_name`, `window_name` | join via `frame_id` |\n| `elements` | `source`, `role`, `text`, `bounds_*` | join via `frame_id` |\n| `audio_transcriptions` | `transcription`, `device`, `speaker_id`, `is_input_device` | `timestamp` |\n| `audio_chunks` | `file_path` | `timestamp` |\n| `speakers` | `name`, `metadata` | — |\n| `ui_events` | `event_type`, `app_name`, `window_title`, `browser_url` | `timestamp` |\n| `accessibility` | `app_name`, `window_name`, `text_content`, `browser_url` | `timestamp` |\n| `meetings` | `meeting_app`, `title`, `attendees`, `detection_source` | `meeting_start` |\n| `memories` | `content`, `source`, `tags`, `importance` | `created_at` |\n\n### Example Queries\n\n```sql\n-- Most used apps (last 24h)\nSELECT app_name, COUNT(*) as frames FROM frames\nWHERE timestamp > datetime('now', '-24 hours') AND app_name IS NOT NULL\nGROUP BY app_name ORDER BY frames DESC LIMIT 20\n\n-- Most visited domains\nSELECT CASE WHEN INSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), '/') > 0\n THEN SUBSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), 1, INSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), '/') - 1)\n ELSE SUBSTR(browser_url, INSTR(browser_url, '://') + 3) END as domain,\nCOUNT(*) as visits FROM frames\nWHERE timestamp > datetime('now', '-24 hours') AND browser_url IS NOT NULL\nGROUP BY domain ORDER BY visits DESC LIMIT 20\n\n-- Speaker stats\nSELECT COALESCE(NULLIF(s.name, ''), 'Unknown') as speaker, COUNT(*) as segments\nFROM audio_transcriptions at LEFT JOIN speakers s ON at.speaker_id = s.id\nWHERE at.timestamp > datetime('now', '-24 hours')\nGROUP BY at.speaker_id ORDER BY segments DESC LIMIT 20\n\n-- Context switches per hour\nSELECT strftime('%H:00', timestamp) as hour, COUNT(*) as switches\nFROM ui_events WHERE event_type = 'app_switch' AND timestamp > datetime('now', '-24 hours')\nGROUP BY hour ORDER BY hour LIMIT 24\n```\n\nCommon patterns: `GROUP BY date(timestamp)` (daily), `GROUP BY strftime('%H:00', timestamp)` (hourly), `HAVING frames > 5` (filter noise).\n\n---\n\n## 8. Connections — `GET /connections`\n\n```bash\n# List all integrations (Telegram, Slack, Discord, Email, Todoist, Teams, 40+)\ncurl http://localhost:3030/connections\n\n# Get saved credentials for a webhook/token integration\ncurl http://localhost:3030/connections/telegram\n```\n\n**Credential integrations** — `GET /connections/<id>` returns saved fields to use with the service API directly:\n- **Telegram**: `bot_token` + `chat_id` → `POST https://api.telegram.org/bot{token}/sendMessage`\n- **Slack**: `webhook_url` → `POST {webhook_url}` with `{\"text\": \"...\"}`\n- **Discord**: `webhook_url` → `POST {webhook_url}` with `{\"content\": \"...\"}`\n- **Todoist**: `api_token` → `POST https://api.todoist.com/api/v1/tasks` with Bearer auth\n- **Teams**: `webhook_url` → `POST {webhook_url}` with `{\"text\": \"...\"}`\n- **Email**: `smtp_host`, `smtp_port`, `smtp_user`, `smtp_pass`, `from_address`\n\n**OAuth/proxy integrations** — tokens are stored in SecretStore and are never exposed via `GET /connections/<id>`. Call the local proxy instead; it injects auth and forwards to the upstream API:\n\n```bash\n# GitHub — create an issue (repo owner/name from pipe settings)\ncurl -X POST http://localhost:3030/connections/github/proxy/repos/OWNER/REPO/issues \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\":\"Found a bug\",\"body\":\"Steps to reproduce...\"}'\n\n# GitHub — comment on an issue\ncurl -X POST http://localhost:3030/connections/github/proxy/repos/OWNER/REPO/issues/42/comments \\\n -H \"Content-Type: application/json\" \\\n -d '{\"body\":\"Thanks for the report!\"}'\n\n# Generic OAuth proxy pattern (Zoom, Vercel, Google Docs, Microsoft 365, etc.)\ncurl -X POST http://localhost:3030/connections/<id>/proxy/<upstream-api-path> \\\n -H \"Content-Type: application/json\" \\\n -d '{...}'\n```\n\nDo **not** call `https://api.github.com/...` directly from a pipe — use `/connections/github/proxy/...` instead. There is no `/connections/<id>/token` endpoint.\n\nIf not connected, tell user to set up in Settings > Connections.\n\n---\n\n## 9. Meetings — `GET /meetings`, `PUT /meetings/:id`\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/meetings?start_time=1d%20ago&end_time=now&limit=10&offset=0\"\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/meetings?q=alice%40acme.com\"\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/meetings/42\"\n\n# Update mutable fields. This is a partial update body: omitted fields stay as-is.\ncurl -X PUT http://localhost:3030/meetings/42 \\\n -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\":\"Q3 planning\", \"note\":\"<existing note>\\n\\n## Summary\\n<summary>\"}'\n```\n\nReturns detected meetings (from calendar, app detection, window titles, UI elements, multi-speaker audio). `q` is a case-insensitive substring filter against title, attendees, and notes.\n\nMeeting updates use `PUT /meetings/:id`, not PATCH. Before appending an AI-generated summary, read the current meeting first and include the existing `note` text in the new note body so user-written notes are preserved.\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `id` | integer | Meeting ID |\n| `meeting_start` | ISO 8601 | Start time |\n| `meeting_end` | ISO 8601? | End time (null if ongoing) |\n| `meeting_app` | string | App (zoom, teams, meet, etc.) |\n| `title` | string? | Meeting title |\n| `attendees` | string? | Attendees |\n| `note` | string? | User notes / appended AI summaries |\n| `detection_source` | string | How detected (`app`, `calendar`, `ui`, etc.) |\n\nAlso available via raw SQL: `SELECT * FROM meetings WHERE meeting_start > datetime('now', '-24 hours') LIMIT 20`\n\n---\n\n## 10. Speakers — Management & Reassignment\n\n```bash\n# Search speakers by name\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/speakers/search?name=John\"\n\n# Get unnamed speakers (for labeling)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/speakers/unnamed?limit=20&offset=0\"\n\n# Get speakers similar to a given speaker (by voice embedding)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/speakers/similar?speaker_id=29&limit=5\"\n\n# Update speaker name/metadata\ncurl -X POST http://localhost:3030/speakers/update \\\n -H \"Content-Type: application/json\" \\\n -d '{\"id\": 29, \"name\": \"Jordan\"}'\n\n# Reassign speaker for an audio chunk (propagates to similar chunks by default)\ncurl -X POST http://localhost:3030/speakers/reassign \\\n -H \"Content-Type: application/json\" \\\n -d '{\"audio_chunk_id\": 456, \"new_speaker_name\": \"Jordan\", \"propagate_similar\": true}'\n# Returns: new_speaker_id, transcriptions_updated, old_assignments (for undo)\n\n# Undo a speaker reassignment\ncurl -X POST http://localhost:3030/speakers/undo-reassign \\\n -H \"Content-Type: application/json\" \\\n -d '{\"old_assignments\": [{\"transcription_id\": 1, \"old_speaker_id\": 29}]}'\n\n# Merge two speakers (keeps one, merges the other into it)\ncurl -X POST http://localhost:3030/speakers/merge \\\n -H \"Content-Type: application/json\" \\\n -d '{\"speaker_to_keep_id\": 5, \"speaker_to_merge_id\": 29}'\n\n# Mark speaker as hallucination (false detection)\ncurl -X POST http://localhost:3030/speakers/hallucination \\\n -H \"Content-Type: application/json\" \\\n -d '{\"speaker_id\": 29}'\n\n# Delete a speaker (also removes associated audio chunk files)\ncurl -X POST http://localhost:3030/speakers/delete \\\n -H \"Content-Type: application/json\" \\\n -d '{\"id\": 29}'\n```\n\n### Speaker Reassignment Workflow\n\nWhen the user says \"that was actually Jordan, not Karishma\":\n1. Search audio results to find the `chunk_id` for the misidentified audio\n2. Call `POST /speakers/reassign` with `audio_chunk_id` and `new_speaker_name`\n3. With `propagate_similar: true` (default), it also fixes similar-sounding chunks\n\n---\n\n## 11. Memories — High-Signal Persistent Knowledge\n\n**Memories are the highest-signal data source in screenpipe.** They contain curated facts, user preferences, decisions, and project context — distilled from hours of screen/audio data. Always check memories when answering questions or building context.\n\n### When to Query Memories\n\n**Query memories FIRST (before or alongside `/search`)** when:\n- The user asks about preferences, decisions, or past context\n- You need background on a project, person, or workflow\n- You're generating a summary, recommendation, or action plan\n- You're unsure about user preferences or past decisions\n- Any task where historical context would improve the output\n\n**Rule: If you're calling `/search`, also call `/memories` in parallel.** Memories provide the \"why\" behind the raw screen data. Search gives you what happened; memories tell you what matters.\n\n### API\n\n```bash\n# Search memories (FTS) — do this often!\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/memories?q=preference&limit=20\"\n\n# List recent memories (high importance first)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/memories?min_importance=0.5&limit=20\"\n\n# Filter by source or tags\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/memories?source=user&tags=project&limit=20\"\n\n# Create a memory\ncurl -X POST http://localhost:3030/memories \\\n -H \"Content-Type: application/json\" \\\n -d '{\"content\": \"User prefers dark mode\", \"source\": \"user\", \"tags\": [\"preference\", \"ui\"], \"importance\": 0.7}'\n\n# Update a memory\ncurl -X PUT http://localhost:3030/memories/1 \\\n -H \"Content-Type: application/json\" \\\n -d '{\"content\": \"User prefers dark mode in all apps\", \"importance\": 0.8}'\n\n# Delete a memory\ncurl -X DELETE http://localhost:3030/memories/1\n```\n\nParameters for `GET /memories`: `q` (FTS search), `source`, `tags`, `min_importance`, `start_time`, `end_time`, `limit`, `offset`.\n\nMemories also appear in `/search?content_type=memory`.\n\n### Creating Memories\n\nWhen you learn something important about the user (preferences, decisions, project context), store it as a memory. Use `importance` 0.0-1.0 to rank signal. Only store genuinely useful long-lived facts, not transient observations.\n\n---\n\n## 12. Notifications — `POST http://localhost:11435/notify`\n\nSend a notification to the screenpipe desktop UI. This uses the Tauri sidecar server (port 11435), **not** the main API (port 3030).\n\nThe notification body supports **markdown**: `**bold**`, `` `inline code` ``, and `[link text](url)`. Links can be web URLs, file paths, or screenpipe deeplinks.\n\n```bash\n# Simple notification\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"3 new voice memos\", \"body\": \"found recordings from today\"}'\n\n# Markdown body with links\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Meeting summary\", \"body\": \"**Q3 Planning** notes saved\\n\\nopen [meeting notes](~/Documents/notes/q3.md) or view [recording](screenpipe://timeline)\"}'\n\n# Link to a local file (absolute path or ~ path)\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Export complete\", \"body\": \"saved to [report.csv](~/Downloads/report.csv)\"}'\n\n# With action buttons\n# Use `type: \"link\"` for external URLs and `type: \"deeplink\"` for\n# screenpipe:// in-app routes. `type: \"dismiss\"` closes the notification.\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Meeting summary\", \"body\": \"**Q3 Planning**\\n- Budget approved\", \"actions\": [{\"id\": \"view\", \"label\": \"view\", \"type\": \"deeplink\", \"url\": \"screenpipe://timeline\"}, {\"id\": \"skip\", \"label\": \"skip\", \"type\": \"dismiss\"}]}'\n\n# External URL action (opens in browser)\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"PR ready for review\", \"body\": \"nice work\", \"actions\": [{\"id\": \"open\", \"label\": \"open pr\", \"type\": \"link\", \"url\": \"https://github.com/screenpipe/screenpipe/pull/1234\"}]}'\n\n# Custom auto-dismiss (5 seconds)\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Saved\", \"body\": \"Note saved\", \"timeout\": 5000}'\n```\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `title` | string | **Yes** | Notification title |\n| `body` | string | **Yes** | Markdown body (`**bold**`, `` `code` ``, `[text](url)`) |\n| `type` | string | No | Category (default \"pipe\") |\n| `timeout` | integer | No | Auto-dismiss in ms (default 20000) |\n| `autoDismissMs` | integer | No | Alias for timeout |\n| `actions` | array | No | Action buttons |\n\n**Supported link types in body markdown:**\n- Web URLs: `[docs](https://docs.screenpi.pe)` — opens in browser\n- File paths: `[notes](~/notes/file.md)` or `[log](/var/log/app.log)` — opens in default app\n- Deeplinks: `[timeline](screenpipe://timeline)` — navigates within screenpipe\n\nReturns `{\"success\": true, \"message\": \"Notification sent successfully\"}`.\n\n---\n\n## 13. Other Endpoints\n\n```bash\ncurl http://localhost:3030/health # Health check\ncurl http://localhost:3030/audio/list # Audio devices\ncurl http://localhost:3030/vision/list # Monitors\n```\n\n---\n\n## Deep Links\n\nReference specific moments with clickable links:\n\n```markdown\n[10:30 AM — Chrome](screenpipe://frame/12345) # screen text results (use frame_id)\n[meeting at 3pm](screenpipe://timeline?timestamp=ISO8601) # Audio results (use timestamp)\n```\n\nOnly use IDs/timestamps from actual search results. Never fabricate.\n\n## Showing Videos\n\nShow `file_path` from search results as inline code for playable video:\n```\n`/Users/name/.screenpipe/data/monitor_1_2024-01-15_10-30-00.mp4`\n```\n";+export const SCREENPIPE_API_SKILL_MD = "---\nname: screenpipe-api\ndescription: Query the user's screen recordings, audio, UI elements, and usage analytics via the local Screenpipe REST API at localhost:3030. Use when the user asks about their screen activity, meetings, apps, productivity, media export, retranscription, or connected services.\n---\n\n# Screenpipe API\n\nLocal REST API at `http://localhost:3030`. Full reference (60+ endpoints): https://docs.screenpi.pe/llms-full.txt\n\n## Authentication\n\n**ALL requests require authentication.** Add the auth header to every curl call:\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/...\"\n```\n\nThe `$SCREENPIPE_LOCAL_API_KEY` env var is already set in your environment. Without it you get 403. The only exception is `/health` (no auth needed).\n\n## Context Window Protection\n\nAPI responses can be large. Always write curl output to a file first (`curl ... -o /tmp/sp_result.json`), check size (`wc -c /tmp/sp_result.json`), and if over 5KB read only the first 50-100 lines. Extract what you need with `jq`. NEVER dump full large responses into context.\n\nFor the list endpoints (`/search`, `/elements`, `/frames/{id}/elements`) you can also cut tokens at the source: add `&format=csv` (or `tsv`) to get a columnar table that writes each column name once instead of repeating keys per row, and `&fields=a,b,c` to return only the columns you need (dotted paths like `content.text`). On a list of UI elements that is roughly a 70% token cut versus JSON. For the element endpoints specifically, `&format=outline` (alias `tree`) goes further still — a deduped, indented tree of just the text-bearing nodes (~91% fewer tokens, measured) — and is the best default for reading UI structure. Text-heavy `ocr`/`audio` barely benefit from any reshaping (the text blob dominates), so reach for `fields` + `max_content_length` there. With no `format`/`fields` the response is unchanged JSON.\n\n---\n\n## 1. Search — `GET /search`\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/search?q=QUERY&content_type=all&limit=10&start_time=1h%20ago\"\n```\n\n### Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `q` | string | No | Keywords. Do NOT use for audio searches — transcriptions are noisy, q filters too aggressively. |\n| `content_type` | string | No | `all` (default), `accessibility`, `audio`, `input`, `ocr`, `memory`. Screen text is primarily captured via the OS accessibility tree (`accessibility`); OCR is a fallback for apps without accessibility support (games, remote desktops). Use `all` unless you need a specific modality. |\n| `limit` | integer | No | Max 1-20. Default: 10 |\n| `offset` | integer | No | Pagination. Default: 0 |\n| `start_time` | ISO 8601 or relative | **Yes** | Accepts `2024-01-15T10:00:00Z` or `16h ago`, `2d ago`, `30m ago` |\n| `end_time` | ISO 8601 or relative | No | Defaults to now. Accepts `now`, `1h ago` |\n| `app_name` | string | No | e.g. \"Google Chrome\", \"Slack\", \"zoom.us\" |\n| `window_name` | string | No | Window title substring |\n| `speaker_name` | string | No | Filter audio by speaker (case-insensitive partial) |\n| `focused` | boolean | No | Only focused windows |\n| `tags` | string | No | Comma-separated; return only items carrying ALL of them (e.g. `person:ada,project:atlas`). Works for screen/audio and, with `content_type=memory`, memories. See Tags below. |\n| `include_related` | boolean | No | With `tags`, also return a `related` map of co-occurring tags (people/projects/workflows seen alongside yours), most-frequent first. One call for the surrounding context instead of several. See Tags below. |\n| `max_content_length` | integer | No | Truncate each result's text (middle-truncation) |\n| `format` | string | No | `json` (default), `csv`, `tsv`/`table`, or `outline`/`tree` (element endpoints only). CSV/TSV return a columnar table (column names written once) instead of one JSON object per row. `outline` returns a deduped indented text tree of the text-bearing UI nodes — the cheapest read for \"what's on screen?\" (~91% fewer tokens). CSV is lossless; TSV collapses newlines (worse for long `ocr` text). |\n| `fields` | string | No | Comma-separated column allowlist of dotted paths, e.g. `type,content.app_name,content.text`. Returns only those columns (handy for dropping the repeated absolute `content.file_path`). Works for `json` too (sparse objects). |\n\n### Progressive Disclosure\n\nDon't jump to heavy `/search` calls. Escalate:\n\n| Step | Endpoint | When |\n|------|----------|------|\n| 0 | `GET /memories?q=...` | **Always query first/in parallel** — highest signal, lowest cost |\n| 1 | `GET /activity-summary?start_time=...&end_time=...` | Broad questions (\"what was I doing?\", \"which apps?\") |\n| 2 | `GET /search?...` | Need specific content |\n| 3 | `GET /elements?...` or `GET /frames/{id}/context` | UI structure, buttons, links |\n| 4 | `GET /frames/{frame_id}` (PNG) | Visual context needed |\n\nDecision tree:\n- \"What was I doing?\" → Step 1 only\n- \"Summarize my meeting\" → Step 2 with `content_type=audio`, NO q param. Add `content_type=all` for screen context.\n- \"How long on X?\" → Step 1 (`/activity-summary` → `total_active_minutes` for the whole range, plus per-app/window `minutes`)\n- \"Which apps today?\" → Step 1 (do NOT use frame counts or raw SQLite)\n- \"What button did I click?\" → Step 3 (`/elements` with role=AXButton)\n- \"Show me what I saw\" → Step 2 (find frame_id) → Step 4\n\n### Tags — linking people, projects, topics\n\nTags are a shared label layer across screen, audio, and memories under one string namespace. Use namespaced tags: `person:ada`, `project:atlas`, `topic:pricing`. Two items sharing a tag are connected.\n\n- Add to a frame/audio: `POST /tags/vision/{frame_id}` or `POST /tags/audio/{chunk_id}` body `{\"tags\":[\"person:ada\"]}`.\n- Add to a memory: include `tags` in `POST /memories` (or `PUT /memories/{id}`).\n- Retrieve by tag: `GET /search?tags=person:ada&start_time=30d%20ago` (screen+audio), or add `content_type=memory` for memories. Multiple tags AND together; matching is exact, not substring.\n\nFrames are pruned by retention, so for a durable link tag a memory (memories also carry `created_at` and a `frame_id` back to the moment — jump there with `GET /frames/{frame_id}`). To pull everything about a person across time: one call for captures (`content_type=all&tags=person:ada`) plus one for facts (`content_type=memory&tags=person:ada`).\n\nAdd `include_related=true` to a tag query to get the surrounding context in the same response — the tags that co-occur with yours, grouped by namespace (prefix pluralized: `person:`→`people`, `project:`→`projects`) and ranked by frequency. Replaces the 2-3 follow-up \"who/what else\" calls with one:\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \\\n \"http://localhost:3030/search?tags=person:ada&include_related=true&limit=5\"\n# data: [...], related: { \"people\": [\"connor\",\"drew\"], \"projects\": [\"atlas\"], \"workflows\": [\"planning\"] }\n```\n\n### Critical Rules\n\n1. **ALWAYS include `start_time`** — queries without time bounds WILL timeout\n2. **Start with 1-2 hour ranges** — expand only if no results\n3. **Use `app_name`** when user mentions a specific app\n4. **Keep `limit` low** (5-10) initially\n5. **\"recent\"** = 30 min. **\"today\"** = since midnight. **\"yesterday\"** = yesterday's range\n6. If timeout, narrow the time range\n\n### Response Format\n\n```json\n{\n \"data\": [\n {\"type\": \"OCR\", \"content\": {\"frame_id\": 12345, \"text\": \"...\", \"timestamp\": \"...\", \"app_name\": \"Chrome\", \"window_name\": \"...\"}},\n {\"type\": \"Audio\", \"content\": {\"chunk_id\": 678, \"transcription\": \"...\", \"timestamp\": \"...\", \"speaker\": {\"name\": \"John\"}}},\n {\"type\": \"UI\", \"content\": {\"id\": 999, \"text\": \"Clicked 'Submit'\", \"timestamp\": \"...\", \"app_name\": \"Safari\"}}\n ],\n \"pagination\": {\"limit\": 10, \"offset\": 0, \"total\": 42}\n}\n```\n\n> **Note**: The `\"OCR\"` type label is used for all screen text results, including text captured via the accessibility tree. Most screen text comes from accessibility, not OCR.\n\n---\n\n## 2. Activity Summary — `GET /activity-summary`\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/activity-summary?start_time=1h%20ago&end_time=now\"\n```\n\nReturns a rich overview with:\n- **total_active_minutes**: authoritative total active screen time for the whole range (every app, idle gaps excluded). Use this as the grand total / denominator. Do NOT sum `windows[].minutes` (capped at 30) and do NOT open `db.sqlite` to recompute durations — this field already is the answer.\n- **apps**: per-app `minutes` (active time), first/last seen\n- **windows**: every distinct window/tab with title, `browser_url`, and `minutes` spent — the most valuable field for *what* the user worked on (top 30 by time)\n- **key_texts**: one representative text snippet per window context (user input fields prioritized over static page text)\n- **audio_summary.top_transcriptions**: actual transcription text with speaker and timestamp (not just counts)\n\nThis is usually enough to answer \"what was I doing?\" without further searches. Only drill into `/search` if you need verbatim quotes or specific content.\n\n> **Building a pipe/automation?** Same rule: call this endpoint for time math. The numbers are computed server-side from frame timestamps — never recompute durations from raw frames, and never ask an LLM to sum minutes (it will drift). Let the model label activities; let this endpoint own the durations.\n\n---\n\n## 3. Elements — `GET /elements`\n\nLightweight FTS search across UI elements (~100-500 bytes each vs 5-20KB from `/search`).\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/elements?q=Submit&start_time=1h%20ago&limit=10\"\n```\n\nParameters: `q`, `frame_id`, `source` (`accessibility`|`ocr`), `role`, `start_time`, `end_time`, `app_name`, `limit`, `offset`, plus `format` (`json`/`csv`/`tsv`/`outline`) and `fields` (dotted paths). Elements are uniform rows, so this is where compact formats pay off most.\n\n**`format=outline` (alias `tree`) is the cheapest read for \"what's on screen?\"** — a deduped, indented text tree of just the text-bearing nodes (drops empty structural nodes + bounds, collapses repeats into `×N`, `#id` is the ref, inlines `(disabled)`/`(selected)`/`(focused)`/`(expanded)`/`(off-screen)` state, body capped). Best on `source=accessibility` (the common UI case — structural noise, repeated rows, hierarchy, state): 85–99% fewer tokens than JSON (o200k_base). Flat OCR text blocks are the floor (~67%, nothing to dedup) — for pure OCR `format=csv&fields=text` is about as good.\n\n```bash\n# compact outline — best default for an LLM reading the UI\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/elements?q=Submit&format=outline&limit=30\"\n# frame 12345 · accessibility · 8 text elements\n# AXButton \"Submit Order\" #4012\n# AXButton \"Cancel\" #4013 (disabled)\n# AXCell \"Shipped\" #4020 ×6\n\n# columnar table when you need specific columns (e.g. bounds) instead\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/elements?frame_id=12345&format=csv&fields=role,text,bounds.left,bounds.top\"\n```\n\n`GET /frames/{id}/elements?format=outline` gives the whole frame's tree the same way (and is capped, unlike the raw JSON dump).\n\n### Frame Context — `GET /frames/{id}/context`\n\nReturns accessibility text, parsed nodes, and extracted URLs for a frame.\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/frames/6789/context\"\n```\n\n### Common Roles (platform-specific)\n\nRoles are **not normalized** across platforms. Use the correct format for the user's OS:\n\n| Concept | macOS | Windows | Linux |\n|---------|-------|---------|-------|\n| Button | `AXButton` | `Button` | `Button` |\n| Static text | `AXStaticText` | `Text` | `Label` |\n| Link | `AXLink` | `Hyperlink` | `Link` |\n| Text field | `AXTextField` | `Edit` | `Entry` |\n| Text area | `AXTextArea` | `Document` | `Text` |\n| Menu item | `AXMenuItem` | `MenuItem` | `MenuItem` |\n| Checkbox | `AXCheckBox` | `CheckBox` | `CheckBox` |\n| Group | `AXGroup` | `Group` | `Group` |\n| Web area | `AXWebArea` | `Pane` | `DocumentWeb` |\n| Heading | `AXHeading` | `Header` | `Heading` |\n| Tab | `AXTab` | `TabItem` | `Tab` |\n| List item | `AXRow` | `ListItem` | `ListItem` |\n\nOCR-only roles (fallback when accessibility unavailable): `line`, `word`, `block`, `paragraph`, `page`\n\n---\n\n## 4. Frames (Screenshots) — `GET /frames/{frame_id}`\n\n```bash\ncurl -o /tmp/frame.png \"http://localhost:3030/frames/12345\"\n```\n\nReturns raw PNG. **Never fetch more than 2-3 frames per query** (~1000-2000 tokens each).\n\n---\n\n## 5. Media Export — `POST /export`\n\nRenders a real-time MP4 (screen frames at their true timestamps + synced microphone audio). The clip's duration matches the wall-clock span you ask for — it is NOT a sped-up timelapse.\n\n```bash\ncurl -X POST http://localhost:3030/export \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \\\n -d '{\"start\": \"5m ago\", \"end\": \"now\"}'\n```\n\nFields: `start` + `end` (ISO 8601 or relative like `\"2h ago\"`, `\"now\"`; `end` defaults to now), OR `meeting_id` to export a whole meeting. Optional `output_path` writes the MP4 to a specific absolute path (e.g. `~/Downloads/clip.mp4`); otherwise it lands in the data dir's `exports/` folder.\n\nReturns `{\"output_path\": \"...\", \"frame_count\": N, \"audio_chunk_count\": N, \"duration_secs\": N, \"file_size_bytes\": N}`. Show `output_path` as an inline code block for playback. Long ranges can take a few minutes.\n\n### Audio & ffmpeg\n\nAudio files from search results (`file_path`). Common operations:\n```bash\nffmpeg -y -i /path/to/audio.mp4 -q:a 2 ~/.screenpipe/exports/output.mp3 # convert\nffmpeg -y -i input.mp4 -ss 00:01:00 -to 00:05:00 -q:a 2 clip.mp3 # trim\nffmpeg -y -i input.mp4 -filter:v \"setpts=0.5*PTS\" -an fast.mp4 # speed 2x\nffmpeg -y -i input.mp4 -t 10 -vf \"fps=10,scale=640:-1\" output.gif # GIF\n```\n\nAlways use `-y`, save to `~/.screenpipe/exports/`.\n\n---\n\n## 6. Retranscribe — `POST /audio/retranscribe`\n\n```bash\ncurl -X POST http://localhost:3030/audio/retranscribe \\\n -H \"Content-Type: application/json\" \\\n -d '{\"start\": \"1h ago\", \"end\": \"now\"}'\n```\n\nOptional: `engine` (`whisper-large-v3-turbo`|`whisper-large-v3`|`deepgram`|`qwen3-asr`), `vocabulary` (array of `{\"word\": \"...\", \"replacement\": \"...\"}` for bias/replacement), `prompt` (topic context for Whisper).\n\nKeep ranges short (1h max). Show old vs new transcription.\n\n---\n\n## 7. Raw SQL — `POST /raw_sql`\n\n```bash\ncurl -X POST http://localhost:3030/raw_sql \\\n -H \"Content-Type: application/json\" \\\n -d '{\"query\": \"SELECT ... LIMIT 100\"}'\n```\n\n**Rules**: Every SELECT needs LIMIT. Always filter by time. Read-only. For time math, see the timestamp caveat below.\n\n**Timestamp caveat**: DB timestamps are stored as RFC3339 strings — usually `2026-06-26T18:01:14.214586+00:00` (frames / audio_transcriptions / ui_events), though some tables (e.g. `meetings.meeting_start`, memories) use a `Z` suffix with milliseconds: `2026-06-26T18:01:14.214Z`. Do not compare either form directly to SQLite `datetime()` strings like `timestamp > datetime('now', '-10 seconds')`: the `T` vs space makes it a lexical string comparison and can include stale same-day rows. Use `datetime(timestamp) > datetime('now', '-10 seconds')` (works for both forms), or for indexed string comparisons use an RFC3339-shaped cutoff: `timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-10 seconds')`.\n\n**WARNING**: Do NOT use frame counts for time estimates — frames are event-driven, not fixed-interval. Use `/activity-summary` for screen time.\n\n### Schema\n\n| Table | Key Columns | Time Column |\n|-------|-------------|-------------|\n| `frames` | `app_name`, `window_name`, `browser_url`, `focused` | `timestamp` |\n| `ocr_text` | `text`, `app_name`, `window_name` | join via `frame_id` |\n| `elements` | `source`, `role`, `text`, `bounds_*` | join via `frame_id` |\n| `audio_transcriptions` | `transcription`, `device`, `speaker_id`, `is_input_device` | `timestamp` |\n| `audio_chunks` | `file_path` | `timestamp` |\n| `speakers` | `name`, `metadata` | — |\n| `ui_events` | `event_type`, `app_name`, `window_title`, `browser_url` | `timestamp` |\n| `accessibility` | `app_name`, `window_name`, `text_content`, `browser_url` | `timestamp` |\n| `meetings` | `meeting_app`, `title`, `attendees`, `detection_source` | `meeting_start` |\n| `memories` | `content`, `source`, `tags`, `importance` | `created_at` |\n\n### Example Queries\n\n```sql\n-- Most used apps (last 24h)\nSELECT app_name, COUNT(*) as frames FROM frames\nWHERE timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours') AND app_name IS NOT NULL\nGROUP BY app_name ORDER BY frames DESC LIMIT 20\n\n-- Most visited domains\nSELECT CASE WHEN INSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), '/') > 0\n THEN SUBSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), 1, INSTR(SUBSTR(browser_url, INSTR(browser_url, '://') + 3), '/') - 1)\n ELSE SUBSTR(browser_url, INSTR(browser_url, '://') + 3) END as domain,\nCOUNT(*) as visits FROM frames\nWHERE timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours') AND browser_url IS NOT NULL\nGROUP BY domain ORDER BY visits DESC LIMIT 20\n\n-- Speaker stats\nSELECT COALESCE(NULLIF(s.name, ''), 'Unknown') as speaker, COUNT(*) as segments\nFROM audio_transcriptions at LEFT JOIN speakers s ON at.speaker_id = s.id\nWHERE at.timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours')\nGROUP BY at.speaker_id ORDER BY segments DESC LIMIT 20\n\n-- Context switches per hour\nSELECT strftime('%H:00', timestamp) as hour, COUNT(*) as switches\nFROM ui_events WHERE event_type = 'app_switch' AND timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours')\nGROUP BY hour ORDER BY hour LIMIT 24\n```\n\nCommon patterns: `GROUP BY date(timestamp)` (daily), `GROUP BY strftime('%H:00', timestamp)` (hourly), `HAVING frames > 5` (filter noise).\n\n---\n\n## 8. Connections — `GET /connections`\n\n```bash\n# List all integrations (Telegram, Slack, Discord, Email, Todoist, Teams, 40+)\ncurl http://localhost:3030/connections\n\n# Get saved credentials for a webhook/token integration\ncurl http://localhost:3030/connections/telegram\n```\n\n**Credential integrations** — `GET /connections/<id>` returns saved fields to use with the service API directly:\n- **Telegram**: `bot_token` + `chat_id` → `POST https://api.telegram.org/bot{token}/sendMessage`\n- **Slack**: `webhook_url` → `POST {webhook_url}` with `{\"text\": \"...\"}`\n- **Discord**: `webhook_url` → `POST {webhook_url}` with `{\"content\": \"...\"}`\n- **Todoist**: `api_token` → `POST https://api.todoist.com/api/v1/tasks` with Bearer auth\n- **Teams**: `webhook_url` → `POST {webhook_url}` with `{\"text\": \"...\"}`\n- **Email**: `smtp_host`, `smtp_port`, `smtp_user`, `smtp_pass`, `from_address`\n\n**OAuth/proxy integrations** — tokens are stored in SecretStore and are never exposed via `GET /connections/<id>`. Call the local proxy instead; it injects auth and forwards to the upstream API:\n\n```bash\n# GitHub — create an issue (repo owner/name from pipe settings)\ncurl -X POST http://localhost:3030/connections/github/proxy/repos/OWNER/REPO/issues \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\":\"Found a bug\",\"body\":\"Steps to reproduce...\"}'\n\n# GitHub — comment on an issue\ncurl -X POST http://localhost:3030/connections/github/proxy/repos/OWNER/REPO/issues/42/comments \\\n -H \"Content-Type: application/json\" \\\n -d '{\"body\":\"Thanks for the report!\"}'\n\n# Generic OAuth proxy pattern (Zoom, Vercel, Google Docs, Microsoft 365, etc.)\ncurl -X POST http://localhost:3030/connections/<id>/proxy/<upstream-api-path> \\\n -H \"Content-Type: application/json\" \\\n -d '{...}'\n```\n\nDo **not** call `https://api.github.com/...` directly from a pipe — use `/connections/github/proxy/...` instead. There is no `/connections/<id>/token` endpoint.\n\nIf not connected, tell user to set up in Settings > Connections.\n\n---\n\n## 9. Meetings — `GET /meetings`, `PUT /meetings/:id`\n\n```bash\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/meetings?start_time=1d%20ago&end_time=now&limit=10&offset=0\"\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/meetings?q=alice%40acme.com\"\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/meetings/42\"\n\n# Update mutable fields. This is a partial update body: omitted fields stay as-is.\ncurl -X PUT http://localhost:3030/meetings/42 \\\n -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\":\"Q3 planning\", \"note\":\"<existing note>\\n\\n## Summary\\n<summary>\"}'\n```\n\nReturns detected meetings (from calendar, app detection, window titles, UI elements, multi-speaker audio). `q` is a case-insensitive substring filter against title, attendees, and notes.\n\nMeeting updates use `PUT /meetings/:id`, not PATCH. Before appending an AI-generated summary, read the current meeting first and include the existing `note` text in the new note body so user-written notes are preserved.\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `id` | integer | Meeting ID |\n| `meeting_start` | ISO 8601 | Start time |\n| `meeting_end` | ISO 8601? | End time (null if ongoing) |\n| `meeting_app` | string | App (zoom, teams, meet, etc.) |\n| `title` | string? | Meeting title |\n| `attendees` | string? | Attendees |\n| `note` | string? | User notes / appended AI summaries |\n| `detection_source` | string | How detected (`app`, `calendar`, `ui`, etc.) |\n\nAlso available via raw SQL: `SELECT * FROM meetings WHERE meeting_start > strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now', '-24 hours') LIMIT 20`\n\n---\n\n## 10. Speakers — Management & Reassignment\n\n```bash\n# Search speakers by name\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/speakers/search?name=John\"\n\n# Get unnamed speakers (for labeling)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/speakers/unnamed?limit=20&offset=0\"\n\n# Get speakers similar to a given speaker (by voice embedding)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/speakers/similar?speaker_id=29&limit=5\"\n\n# Update speaker name/metadata\ncurl -X POST http://localhost:3030/speakers/update \\\n -H \"Content-Type: application/json\" \\\n -d '{\"id\": 29, \"name\": \"Jordan\"}'\n\n# Reassign speaker for an audio chunk (propagates to similar chunks by default)\ncurl -X POST http://localhost:3030/speakers/reassign \\\n -H \"Content-Type: application/json\" \\\n -d '{\"audio_chunk_id\": 456, \"new_speaker_name\": \"Jordan\", \"propagate_similar\": true}'\n# Returns: new_speaker_id, transcriptions_updated, old_assignments (for undo)\n\n# Undo a speaker reassignment\ncurl -X POST http://localhost:3030/speakers/undo-reassign \\\n -H \"Content-Type: application/json\" \\\n -d '{\"old_assignments\": [{\"transcription_id\": 1, \"old_speaker_id\": 29}]}'\n\n# Merge two speakers (keeps one, merges the other into it)\ncurl -X POST http://localhost:3030/speakers/merge \\\n -H \"Content-Type: application/json\" \\\n -d '{\"speaker_to_keep_id\": 5, \"speaker_to_merge_id\": 29}'\n\n# Mark speaker as hallucination (false detection)\ncurl -X POST http://localhost:3030/speakers/hallucination \\\n -H \"Content-Type: application/json\" \\\n -d '{\"speaker_id\": 29}'\n\n# Delete a speaker (also removes associated audio chunk files)\ncurl -X POST http://localhost:3030/speakers/delete \\\n -H \"Content-Type: application/json\" \\\n -d '{\"id\": 29}'\n```\n\n### Speaker Reassignment Workflow\n\nWhen the user says \"that was actually Jordan, not Karishma\":\n1. Search audio results to find the `chunk_id` for the misidentified audio\n2. Call `POST /speakers/reassign` with `audio_chunk_id` and `new_speaker_name`\n3. With `propagate_similar: true` (default), it also fixes similar-sounding chunks\n\n---\n\n## 11. Memories — High-Signal Persistent Knowledge\n\n**Memories are the highest-signal data source in screenpipe.** They contain curated facts, user preferences, decisions, and project context — distilled from hours of screen/audio data. Always check memories when answering questions or building context.\n\n### When to Query Memories\n\n**Query memories FIRST (before or alongside `/search`)** when:\n- The user asks about preferences, decisions, or past context\n- You need background on a project, person, or workflow\n- You're generating a summary, recommendation, or action plan\n- You're unsure about user preferences or past decisions\n- Any task where historical context would improve the output\n\n**Rule: If you're calling `/search`, also call `/memories` in parallel.** Memories provide the \"why\" behind the raw screen data. Search gives you what happened; memories tell you what matters.\n\n### API\n\n```bash\n# Search memories (FTS) — do this often!\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/memories?q=preference&limit=20\"\n\n# List recent memories (high importance first)\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/memories?min_importance=0.5&limit=20\"\n\n# Filter by source or tags\ncurl -H \"Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY\" \"http://localhost:3030/memories?source=user&tags=project&limit=20\"\n\n# Create a memory\ncurl -X POST http://localhost:3030/memories \\\n -H \"Content-Type: application/json\" \\\n -d '{\"content\": \"User prefers dark mode\", \"source\": \"user\", \"tags\": [\"preference\", \"ui\"], \"importance\": 0.7}'\n\n# Update a memory\ncurl -X PUT http://localhost:3030/memories/1 \\\n -H \"Content-Type: application/json\" \\\n -d '{\"content\": \"User prefers dark mode in all apps\", \"importance\": 0.8}'\n\n# Delete a memory\ncurl -X DELETE http://localhost:3030/memories/1\n```\n\nParameters for `GET /memories`: `q` (FTS search), `source`, `tags`, `min_importance`, `start_time`, `end_time`, `limit`, `offset`.\n\nMemories also appear in `/search?content_type=memory`.\n\n### Creating Memories\n\nWhen you learn something important about the user (preferences, decisions, project context), store it as a memory. Use `importance` 0.0-1.0 to rank signal. Only store genuinely useful long-lived facts, not transient observations.\n\n---\n\n## 12. Notifications — `POST http://localhost:11435/notify`\n\nSend a notification to the screenpipe desktop UI. This uses the Tauri sidecar server (port 11435), **not** the main API (port 3030).\n\nThe notification body supports **markdown**: `**bold**`, `` `inline code` ``, and `[link text](url)`. Links can be web URLs, file paths, or screenpipe deeplinks.\n\n```bash\n# Simple notification\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"3 new voice memos\", \"body\": \"found recordings from today\"}'\n\n# Markdown body with links\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Meeting summary\", \"body\": \"**Q3 Planning** notes saved\\n\\nopen [meeting notes](~/Documents/notes/q3.md) or view [recording](screenpipe://timeline)\"}'\n\n# Link to a local file (absolute path or ~ path)\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Export complete\", \"body\": \"saved to [report.csv](~/Downloads/report.csv)\"}'\n\n# With action buttons\n# Use `type: \"link\"` for external URLs and `type: \"deeplink\"` for\n# screenpipe:// in-app routes. `type: \"dismiss\"` closes the notification.\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Meeting summary\", \"body\": \"**Q3 Planning**\\n- Budget approved\", \"actions\": [{\"id\": \"view\", \"label\": \"view\", \"type\": \"deeplink\", \"url\": \"screenpipe://timeline\"}, {\"id\": \"skip\", \"label\": \"skip\", \"type\": \"dismiss\"}]}'\n\n# External URL action (opens in browser)\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"PR ready for review\", \"body\": \"nice work\", \"actions\": [{\"id\": \"open\", \"label\": \"open pr\", \"type\": \"link\", \"url\": \"https://github.com/screenpipe/screenpipe/pull/1234\"}]}'\n\n# Custom auto-dismiss (5 seconds)\ncurl -X POST http://localhost:11435/notify \\\n -H \"Content-Type: application/json\" \\\n -d '{\"title\": \"Saved\", \"body\": \"Note saved\", \"timeout\": 5000}'\n```\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `title` | string | **Yes** | Notification title |\n| `body` | string | **Yes** | Markdown body (`**bold**`, `` `code` ``, `[text](url)`) |\n| `type` | string | No | Category (default \"pipe\") |\n| `timeout` | integer | No | Auto-dismiss in ms (default 20000) |\n| `autoDismissMs` | integer | No | Alias for timeout |\n| `actions` | array | No | Action buttons |\n\n**Supported link types in body markdown:**\n- Web URLs: `[docs](https://docs.screenpi.pe)` — opens in browser\n- File paths: `[notes](~/notes/file.md)` or `[log](/var/log/app.log)` — opens in default app\n- Deeplinks: `[timeline](screenpipe://timeline)` — navigates within screenpipe\n\nReturns `{\"success\": true, \"message\": \"Notification sent successfully\"}`.\n\n---\n\n## 13. Other Endpoints\n\n```bash\ncurl http://localhost:3030/health # Health check\ncurl http://localhost:3030/audio/list # Audio devices\ncurl http://localhost:3030/vision/list # Monitors\n```\n\n---\n\n## Deep Links\n\nReference specific moments with clickable links:\n\n```markdown\n[10:30 AM — Chrome](screenpipe://frame/12345) # screen text results (use frame_id)\n[meeting at 3pm](screenpipe://timeline?timestamp=ISO8601) # Audio results (use timestamp)\n```\n\nOnly use IDs/timestamps from actual search results. Never fabricate.\n\n## Showing Videos\n\nShow `file_path` from search results as inline code for playable video:\n```\n`/Users/name/.screenpipe/data/monitor_1_2024-01-15_10-30-00.mp4`\n```\n";export const SCREENPIPE_CLI_SKILL_MD = "---\nname: screenpipe-cli\ndescription: Manage screenpipe pipes (scheduled AI automations) and connections (Telegram, Slack, Discord, etc.) via the CLI. Use when the user asks to create, list, enable, disable, run, or debug pipes, or manage service connections from the command line.\n---\n\n# Screenpipe CLI\n\nUse `bun x screenpipe@latest` to run CLI commands. No separate install needed.\n\n**IMPORTANT**: Always run `bun x` commands from a clean temp directory to avoid node_modules conflicts:\n```bash\ncd \"$(mktemp -d)\" && bun x screenpipe@latest <command>\n```\n\n## Shell\n\n- **All platforms** → `bash` (on Windows, the bundled git-portable bash is used automatically)\n\n---\n\n## Pipe Management\n\nPipes are markdown-based AI automations that run on schedule. Each pipe lives at `~/.screenpipe/pipes/<name>/pipe.md`.\n\n### Commands\n\n```bash\nbun x screenpipe@latest pipe list # List all pipes (compact table)\nbun x screenpipe@latest pipe enable <name> # Enable a pipe\nbun x screenpipe@latest pipe disable <name> # Disable a pipe\nbun x screenpipe@latest pipe run <name> # Run once immediately (for testing)\nbun x screenpipe@latest pipe logs <name> # View execution logs\nbun x screenpipe@latest pipe install <url-or-path> # Install from GitHub or local path\nbun x screenpipe@latest pipe delete <name> # Delete a pipe\nbun x screenpipe@latest pipe models list # View AI model presets\n```\n\n### Creating a Pipe\n\nCreate `~/.screenpipe/pipes/<name>/pipe.md` with YAML frontmatter + prompt:\n\n```markdown\n---\nschedule: every 30m\nenabled: true\npreset: [\"Primary\", \"Fallback\"]\n---\n\nYour prompt instructions here. The AI agent executes this on schedule.\n\n## What to do\n\n1. Query screenpipe search API for recent activity\n2. Process results\n3. Output summary / send notification\n```\n\n**Schedule syntax**: `every 30m`, `every 1h`, `every day at 9am`, `every monday at 9am`, or cron: `*/30 * * * *`, `0 9 * * *`\n\n**Config fields**: `schedule`, `enabled` (bool), `preset` (string or array — e.g. `\"Oai\"` or `[\"Primary\", \"Fallback\"]`), `history` (bool — include previous output as context)\n\nScreenpipe prepends a context header with time range, timezone, OS, and API URL before each execution. No template variables needed.\n\nAfter creating:\n```bash\nbun x screenpipe@latest pipe install ~/.screenpipe/pipes/my-pipe\nbun x screenpipe@latest pipe enable my-pipe\nbun x screenpipe@latest pipe run my-pipe # test immediately\n```\n\n### Editing Config\n\nEdit frontmatter in `~/.screenpipe/pipes/<name>/pipe.md` directly, or use the API:\n\n```bash\ncurl -X POST http://localhost:3030/pipes/<name>/config \\\n -H \"Content-Type: application/json\" \\\n -d '{\"config\": {\"schedule\": \"every 1h\", \"enabled\": true}}'\n```\n\n### Rules\n\n1. Use `pipe list` (not `--json`) — table output is compact\n2. Never dump full pipe JSON — can be 15MB+\n3. Check logs first when debugging: `pipe logs <name>`\n4. Use `pipe run <name>` to test before waiting for schedule\n\n---\n\n## Connection Management\n\nManage integrations (Telegram, Slack, Discord, Email, Todoist, Teams) from the CLI.\n\n### Commands\n\n```bash\nbun x screenpipe@latest connection list # List all connections + status\nbun x screenpipe@latest connection list --json # JSON output\nbun x screenpipe@latest connection get <id> # Show saved credentials\nbun x screenpipe@latest connection get <id> --json # JSON output\nbun x screenpipe@latest connection set <id> key=val # Save credentials\nbun x screenpipe@latest connection test <id> # Test a connection\nbun x screenpipe@latest connection remove <id> # Remove credentials\n```\n\n### Examples\n\n```bash\n# Set up Telegram\nbun x screenpipe@latest connection set telegram bot_token=123456:ABC-DEF chat_id=5776185278\n\n# Set up Slack webhook\nbun x screenpipe@latest connection set slack webhook_url=https://hooks.slack.com/services/...\n\n# Verify it works\nbun x screenpipe@latest connection test telegram\n\n# Check what's connected\nbun x screenpipe@latest connection list\n```\n\nConnection IDs: `telegram`, `slack`, `discord`, `email`, `todoist`, `teams`, `google-calendar`, `openclaw`\n\nCredentials are stored locally at `~/.screenpipe/connections.json`.\n\n**Per-integration details**: don't guess API shapes from this skill. Run `connection list` or `connection get <id>` — each entry includes a self-describing `description` with credential fields, endpoints, and example bodies. Only fetch the integration you need.\n\n## Publishing pipes to the store\n\n```bash\nscreenpipe pipe publish <pipe-name>\n```\n\nReads `~/.screenpipe/pipes/<pipe-name>/pipe.md`, extracts title/description/icon/category from YAML frontmatter, and publishes to the screenpipe pipe store. Requires auth (SCREENPIPE_API_KEY env var or `~/.screenpipe/auth.json`).\n";diff --git a/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md b/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.mdindex c734020d8..ce5d410ce 100644--- a/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md+++ b/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md@@ -153,7 +153,9 @@ curl -X POST http://localhost:3030/raw_sql -H "Content-Type: application/json" \-d '{"query": "SELECT ... LIMIT 100"}'```-**Rules:** every SELECT needs LIMIT · always filter by time (`datetime('now','-24 hours')`) · read-only. **Never use frame counts for time estimates** — frames are event-driven; use `/activity-summary` for screen time.+**Rules:** every SELECT needs LIMIT · always filter by time · read-only. **Never use frame counts for time estimates** — frames are event-driven; use `/activity-summary` for screen time.++**Timestamp caveat:** DB timestamps are stored as RFC3339 strings — usually `2026-06-26T18:01:14.214586+00:00` (frames / audio_transcriptions / ui_events), though some tables (e.g. `meetings.meeting_start`, memories) use a `Z` suffix with milliseconds: `2026-06-26T18:01:14.214Z`. Do not compare either form directly to SQLite `datetime()` strings like `timestamp > datetime('now','-10 seconds')`: the `T` vs space makes it a lexical string comparison and can include stale same-day rows. Use `datetime(timestamp) > datetime('now','-10 seconds')` (works for both forms), or for indexed string comparisons use an RFC3339-shaped cutoff: `timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00','now','-10 seconds')`.| Table | Key Columns | Time Column ||-------|-------------|-------------|@@ -171,12 +173,12 @@ curl -X POST http://localhost:3030/raw_sql -H "Content-Type: application/json" \```sql-- Most used apps (last 24h)SELECT app_name, COUNT(*) AS frames FROM frames-WHERE timestamp > datetime('now','-24 hours') AND app_name IS NOT NULL+WHERE timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00','now','-24 hours') AND app_name IS NOT NULLGROUP BY app_name ORDER BY frames DESC LIMIT 20;-- Context switches per hourSELECT strftime('%H:00', timestamp) AS hour, COUNT(*) AS switches-FROM ui_events WHERE event_type='app_switch' AND timestamp > datetime('now','-24 hours')+FROM ui_events WHERE event_type='app_switch' AND timestamp > strftime('%Y-%m-%dT%H:%M:%f+00:00','now','-24 hours')GROUP BY hour ORDER BY hour LIMIT 24;```