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
Bump app to v2.0.142
Louis Beaumontad4e62663f4e
diff --git a/.claude/agents/posthog.md b/.claude/agents/posthog.mdindex ed60392d0..397ae1d88 100644--- a/.claude/agents/posthog.md+++ b/.claude/agents/posthog.md@@ -8,6 +8,60 @@ allowed-tools: Bash, ReadQuery and manage PostHog product analytics for Screenpipe applications.+---++## ⚠️ IMPORTANT: Real Metrics vs Vanity Metrics++**DO NOT use these as DAU/engagement metrics (vanity):**+- `resource_usage` - passive health pings every few seconds+- `app_still_running` - background heartbeat+- `health_check_unhealthy` - error pings+- `enabled_pipes_hourly` - hourly background check+- `$autocapture`, `$pageview`, `$pageleave` - passive web events+- `$set`, `$identify` - identity events++**ALWAYS use CORE ACTIONS for real engagement:**+- `search_performed` - user actively searched+- `timeline_opened` - user opened timeline view+- `shortcut_used` - user used keyboard shortcut+- `timeline_selection_made` - user selected content in timeline+- `timeline_date_changed` - user navigated timeline++**Key Metrics to Track:**+1. **Real DAU** = unique users doing core actions (target: 200+)+2. **Activation Rate** = core_action_users / app_started_users (target: 40%+, currently ~23%)+3. **Onboarding Completion** = onboarding_completed / onboarding_login_viewed (target: 50%+)++---++## Quick Health Check (Run This First)++```bash+# Real DAU + Activation Rate - THE MOST IMPORTANT QUERY+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT toDate(timestamp) as day, uniq(distinct_id) as real_dau FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY GROUP BY day ORDER BY day"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; print('Real DAU (core actions):'); [print(f' {r[0]}: {r[1]}') for r in json.load(open('/tmp/ph.json')).get('results',[])]"+```++```bash+# Activation Rate (% of users who do a core action)+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT count(distinct a.distinct_id) as started, count(distinct c.distinct_id) as activated FROM (SELECT distinct_id FROM events WHERE event = '\''app_started'\'' AND timestamp > now() - INTERVAL 7 DAY) a LEFT JOIN (SELECT distinct_id FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY) c ON a.distinct_id = c.distinct_id"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; r=json.load(open('/tmp/ph.json'))['results'][0]; print(f'Activation: {r[1]}/{r[0]} = {r[1]/r[0]*100:.1f}%')"+```++```bash+# Onboarding Funnel+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT event, uniq(distinct_id) as users FROM events WHERE event LIKE '\''%onboarding%'\'' AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; print('Onboarding Funnel:'); [print(f' {r[0]}: {r[1]}') for r in json.load(open('/tmp/ph.json')).get('results',[])]"+```++---+## Configuration**Host:** `https://eu.i.posthog.com`@@ -38,39 +92,78 @@ export $(cat /Users/louisbeaumont/Documents/screenpipe/.env.local | xargs) && cu----## Bash Queries (macOS/Linux)+## Project IDs (Hardcoded)-**Note:** All commands below assume you have sourced `.env.local` first.+| Project | ID |+|---------|-----|+| screenpipe | 27525 |+| mediar-app | 64593 |+| mediar-merged | 65690 |-### Get Project ID+----Run this first to get your project ID:+## Weekly Review Queries+Run these every week to track progress on the metrics that matter:++### 1. Real DAU Trend (Core Actions)```bash-curl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \- "https://eu.i.posthog.com/api/projects/" | \- python3 -c "import sys,json; r=json.load(sys.stdin); [print(f'[{p[\"id\"]}] {p[\"name\"]}') for p in r.get('results', [])]"+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT toDate(timestamp) as day, uniq(distinct_id) as real_dau FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 14 DAY GROUP BY day ORDER BY day"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; print('Real DAU (14d):'); [print(f' {r[0]}: {r[1]}') for r in json.load(open('/tmp/ph.json')).get('results',[])]"+```++### 2. Activation Rate (The Key Metric)+```bash+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT count(distinct a.distinct_id) as started, count(distinct c.distinct_id) as activated FROM (SELECT distinct_id FROM events WHERE event = '\''app_started'\'' AND timestamp > now() - INTERVAL 7 DAY) a LEFT JOIN (SELECT distinct_id FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY) c ON a.distinct_id = c.distinct_id"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; r=json.load(open('/tmp/ph.json'))['results'][0]; print(f'Activation: {r[1]}/{r[0]} = {r[1]/r[0]*100:.1f}% (target: 40%+)')"+```++### 3. Real WAU (Weekly Active on Core Actions)+```bash+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT uniq(distinct_id) as real_wau FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; print(f'Real WAU: {json.load(open(\"/tmp/ph.json\"))[\"results\"][0][0]}')"+```++### 4. Core Action Breakdown+```bash+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT event, count() as cnt, uniq(distinct_id) as users FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'', '\''ai_chat_message'\'') AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; print('Core Actions (7d):'); [print(f' {r[0]}: {r[2]} users, {r[1]} events') for r in json.load(open('/tmp/ph.json')).get('results',[])]"```+### 5. Onboarding Drop-off+```bash+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT event, uniq(distinct_id) as users FROM events WHERE event IN ('\''onboarding_login_viewed'\'', '\''onboarding_usecases_viewed'\'', '\''onboarding_status_viewed'\'', '\''onboarding_completed'\'') AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC"}}' \+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \+ python3 -c "import json; print('Onboarding Funnel (7d):'); [print(f' {r[0]}: {r[1]} users') for r in json.load(open('/tmp/ph.json')).get('results',[])]"+```++---++## Bash Queries (macOS/Linux)++**Note:** All commands below assume you have sourced `.env.local` first. Project ID for screenpipe is **27525**.+### List All Insights```bash-PROJECT_ID="YOUR_PROJECT_ID" # Get from above querycurl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \- "https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/?limit=20" | \- python3 -c "-import sys,json-r=json.load(sys.stdin)-for i in r.get('results', []):- print(f'[{i[\"id\"]}] {i[\"name\"]}')- print(f' Type: {i.get(\"filters\", {}).get(\"insight\", \"?\")} | Created: {i[\"created_at\"]}')-"+ "https://eu.i.posthog.com/api/projects/27525/insights/?limit=20" > /tmp/ph.json && \+ python3 -c "import json; [print(f'[{i[\"id\"]}] {i[\"name\"]}') for i in json.load(open('/tmp/ph.json')).get('results', [])]"```### List All Dashboards```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \"https://eu.i.posthog.com/api/projects/$PROJECT_ID/dashboards/" | \python3 -c "@@ -85,7 +178,7 @@ for d in r.get('results', []):### Query Recent Events```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -108,7 +201,7 @@ for row in r.get('results', []):### Query Events by Platform/OS```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -123,7 +216,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \### Query User Onboarding Funnel```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -138,7 +231,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \### Get Insight Results```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"INSIGHT_ID="YOUR_INSIGHT_ID"curl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \"https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/$INSIGHT_ID/" | \@@ -214,7 +307,7 @@ $response.results | ForEach-Object { Write-Host "$($_[0]): $($_[1])" }### Create Pageviews by Page Insight```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -233,7 +326,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \### Create User Funnel Insight```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -258,7 +351,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \### Create Dashboard```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -313,7 +406,7 @@ When investigating user drop-off or issues in onboarding:1. Query onboarding events by OS:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -327,7 +420,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \2. Check onboarding completion rate by step:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -361,7 +454,7 @@ These insights track audio deduplication performance across versions. Use them tCompare deduplication performance across releases:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -387,7 +480,7 @@ for row in r.get('results', []):Track dedup rate over the past 7 days:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -413,7 +506,7 @@ for row in r.get('results', []):Find users where deduplication might not be working:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -430,7 +523,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \Compare dedup performance across operating systems:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -457,7 +550,7 @@ for row in r.get('results', []):Create a dashboard with audio quality insights:```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -470,7 +563,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \### Create Audio Dedup Rate Trend Insight```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{@@ -488,7 +581,7 @@ curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \### Create Audio Quality by Version Insight```bash-PROJECT_ID="YOUR_PROJECT_ID"+PROJECT_ID="27525"curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \-H "Content-Type: application/json" \-d '{diff --git a/screenpipe-app-tauri/components/global-chat.tsx b/screenpipe-app-tauri/components/global-chat.tsxindex a1749d9cb..3d2cc49c1 100644--- a/screenpipe-app-tauri/components/global-chat.tsx+++ b/screenpipe-app-tauri/components/global-chat.tsx@@ -1283,38 +1283,146 @@ export function GlobalChat() {}}- // Continue conversation with tool results- console.log("[Chat] Starting continuation stream with tool results", {- totalMessages: conversationMessages.length + toolResults.length- });- accumulatedText = "";- streamCompleted = false;- let continueChunkCount = 0;- const continueStream = await openai.chat.completions.create(- {- model: activePreset.model || "gpt-4",- messages: [...conversationMessages, ...toolResults],- stream: true,- },- { signal: abortControllerRef.current?.signal }- );+ // Continue conversation with tool results - support multiple rounds of tool calls+ let allMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [...conversationMessages, ...toolResults];+ const maxToolRounds = 5; // Prevent infinite loops++ for (let toolRound = 1; toolRound <= maxToolRounds; toolRound++) {+ console.log("[Chat] Starting continuation stream (round " + toolRound + ")", {+ totalMessages: allMessages.length+ });+ accumulatedText = "";+ streamCompleted = false;+ let continueChunkCount = 0;+ const continueToolCalls: { id: string; function: { name: string; arguments: string } }[] = [];++ // Create stream - use type assertion to avoid circular type inference in loop+ const continueStream = (await openai.chat.completions.create(+ {+ model: activePreset.model || "gpt-4",+ messages: allMessages,+ tools: TOOLS,+ stream: true,+ },+ { signal: abortControllerRef.current?.signal }+ )) as AsyncIterable<OpenAI.Chat.Completions.ChatCompletionChunk>;++ for await (const chunk of continueStream) {+ continueChunkCount++;+ const delta = chunk.choices[0]?.delta;+ const finishReason = chunk.choices[0]?.finish_reason;++ if (continueChunkCount <= 3 || continueChunkCount % 20 === 0 || finishReason) {+ console.log("[Chat] Continue chunk", continueChunkCount, {+ hasContent: !!delta?.content,+ hasToolCalls: !!delta?.tool_calls,+ finishReason+ });+ }++ if (finishReason) {+ streamCompleted = true;+ console.log("[Chat] Continuation stream completed with finish_reason:", finishReason);+ }- for await (const chunk of continueStream) {- continueChunkCount++;- const content = chunk.choices[0]?.delta?.content;- const finishReason = chunk.choices[0]?.finish_reason;+ if (delta?.content) {+ accumulatedText += delta.content;+ setMessages((prev) =>+ prev.map((m) =>+ m.id === assistantMessageId+ ? { ...m, content: accumulatedText }+ : m+ )+ );+ }- if (continueChunkCount <= 3 || continueChunkCount % 20 === 0 || finishReason) {- console.log("[Chat] Continue chunk", continueChunkCount, { hasContent: !!content, finishReason });+ // Handle tool calls in continuation+ if (delta?.tool_calls) {+ for (const toolCall of delta.tool_calls) {+ const index = toolCall.index;+ if (!continueToolCalls[index]) {+ continueToolCalls[index] = {+ id: toolCall.id || "",+ function: { name: "", arguments: "" },+ };+ console.log("[Chat] Continuation tool call started:", toolCall.function?.name);+ }+ if (toolCall.id) continueToolCalls[index].id = toolCall.id;+ if (toolCall.function?.name) continueToolCalls[index].function.name = toolCall.function.name;+ if (toolCall.function?.arguments) continueToolCalls[index].function.arguments += toolCall.function.arguments;+ }+ }}- if (finishReason) {- streamCompleted = true;- console.log("[Chat] Continuation stream completed with finish_reason:", finishReason);+ console.log("[Chat] Continuation stream loop ended", {+ toolRound,+ continueChunkCount,+ streamCompleted,+ continueToolCallsCount: continueToolCalls.length,+ textLength: accumulatedText.length+ });++ // If no more tool calls, we're done+ if (continueToolCalls.length === 0) {+ break;}- if (content) {- accumulatedText += content;+ // Execute the new tool calls+ console.log("[Chat] Executing additional tool calls (round " + toolRound + ")");+ const additionalToolResults: OpenAI.Chat.ChatCompletionMessageParam[] = [];++ additionalToolResults.push({+ role: "assistant",+ content: accumulatedText || null,+ tool_calls: continueToolCalls.map((tc) => ({+ id: tc.id,+ type: "function" as const,+ function: {+ name: tc.function.name,+ arguments: tc.function.arguments,+ },+ })),+ });++ for (const toolCall of continueToolCalls) {+ if (toolCall.function.name === "search_content") {+ try {+ const args = JSON.parse(toolCall.function.arguments || "{}");+ console.log("[Chat] Executing search_content tool (round " + toolRound + ")", args);+ const result = await executeSearchTool(args);+ console.log("[Chat] Search result length:", result.length);+ additionalToolResults.push({+ role: "tool",+ tool_call_id: toolCall.id,+ content: result,+ });+ } catch (e) {+ console.error("[Chat] Tool execution error:", e);+ additionalToolResults.push({+ role: "tool",+ tool_call_id: toolCall.id,+ content: `Error parsing tool arguments: ${e}`,+ });+ }+ }+ }++ // Update messages for next round+ allMessages = [...allMessages, ...additionalToolResults];++ // Update UI to show searching+ setMessages((prev) =>+ prev.map((m) =>+ m.id === assistantMessageId+ ? { ...m, content: accumulatedText + `\n\n*Searching (round ${toolRound})...*` }+ : m+ )+ );++ // Check if we've hit max rounds+ if (toolRound >= maxToolRounds) {+ console.warn("[Chat] Reached maximum tool rounds, stopping");+ accumulatedText += "\n\n*(Reached maximum search rounds)*";setMessages((prev) =>prev.map((m) =>m.id === assistantMessageId@@ -1322,21 +1430,16 @@ export function GlobalChat() {: m));+ break;}}- console.log("[Chat] Continuation stream loop ended", {- continueChunkCount,- streamCompleted,- textLength: accumulatedText.length- });+ // Note: If we exited the loop at maxToolRounds, show a message+ // (This is handled inside the loop by the break condition)// Check for incomplete continuation streamif (!streamCompleted && accumulatedText) {- console.warn("[Chat] Continuation stream ended without finish_reason", {- continueChunkCount,- textLength: accumulatedText.length- });+ console.warn("[Chat] Continuation stream ended without finish_reason");accumulatedText += "\n\n*(Response may be incomplete due to connection issue)*";setMessages((prev) =>prev.map((m) =>diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex f4eed88d2..ec23d3679 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "2.0.141"+version = "2.0.142"description = "24/7 memory for your desktop. 100% local."authors = ["you"]license = ""