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

add context window protection rule to search, analytics, and elements skills

Louis Beaumont0cda9bfdeaee
diff --git a/crates/screenpipe-core/assets/skills/screenpipe-analytics/SKILL.md b/crates/screenpipe-core/assets/skills/screenpipe-analytics/SKILL.md
index 13c839b91..4fe865f05 100644
--- a/crates/screenpipe-core/assets/skills/screenpipe-analytics/SKILL.md
+++ b/crates/screenpipe-core/assets/skills/screenpipe-analytics/SKILL.md
@@ -34,6 +34,7 @@ Returns a JSON array of row objects.
4. **Use datetime() for time math** — SQLite syntax: `datetime('now', '-1 hours')`, `datetime('now', '-7 days')`, `date('now')`.
5. **Default to last 24 hours** unless the user asks for a different range.
6. **"today"** = `date(timestamp) = date('now')`. **"yesterday"** = `date(timestamp) = date('now', '-1 day')`. **"this week"** = `timestamp > datetime('now', '-7 days')`.
+7. **Protect your context window.** SQL results can be large. Always write curl output to a file first (`curl ... -o /tmp/sp_result.json`), then check its size (`wc -c /tmp/sp_result.json`). If over 5KB, read only the first 50-100 lines to understand the structure, then extract what you need with `jq` or targeted reads. NEVER dump a full large API response into your context.
## Database Schema
diff --git a/crates/screenpipe-core/assets/skills/screenpipe-elements/SKILL.md b/crates/screenpipe-core/assets/skills/screenpipe-elements/SKILL.md
index 0ba90ea5f..d1fad89c0 100644
--- a/crates/screenpipe-core/assets/skills/screenpipe-elements/SKILL.md
+++ b/crates/screenpipe-core/assets/skills/screenpipe-elements/SKILL.md
@@ -146,6 +146,7 @@ curl "http://localhost:3030/frames/6789/context"
3. **Use `source=accessibility` for structured queries** — accessibility data has proper roles, hierarchy, and bounds. OCR is flat text.
4. **Use `/frames/{id}/context` for URL extraction** — it parses link nodes and regex-scans for URLs automatically.
5. **Start with short time ranges** — last 1-2 hours. Expand only if needed.
+6. **Protect your context window.** Element queries can return hundreds of results. Always write curl output to a file first (`curl ... -o /tmp/sp_result.json`), then check its size (`wc -c /tmp/sp_result.json`). If over 5KB, read only the first 50-100 lines to understand the structure, then extract what you need with `jq` or targeted reads. NEVER dump a full large API response into your context.
## Example Workflows
diff --git a/crates/screenpipe-core/assets/skills/screenpipe-search/SKILL.md b/crates/screenpipe-core/assets/skills/screenpipe-search/SKILL.md
index 721f0acb3..93bf5d3e7 100644
--- a/crates/screenpipe-core/assets/skills/screenpipe-search/SKILL.md
+++ b/crates/screenpipe-core/assets/skills/screenpipe-search/SKILL.md
@@ -75,6 +75,7 @@ Don't jump straight to heavy `/search` calls. Escalate through these steps, stop
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).
7. **Prefer lightweight endpoints first** — use `/activity-summary` before `/search`, and `/elements` before fetching full frames.
+8. **Protect your context window.** API responses can be large. Always write curl output to a file first (`curl ... -o /tmp/sp_result.json`), then check its size (`wc -c /tmp/sp_result.json`). If over 5KB, read only the first 50-100 lines to understand the structure, then extract what you need with `jq` or targeted reads. NEVER dump a full large API response into your context.
### Example Searches