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

feat: pi skills, standalone chat improvements

Louis Beaumont00cabc4315c7
diff --git a/Cargo.toml b/Cargo.toml
index 37ded1802..c99cc6623 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ exclude = ["apps/screenpipe-app-tauri/src-tauri"]
resolver = "2"
[workspace.package]
-version = "0.3.61"
+version = "0.3.62"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/screenpipe/screenpipe"
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index fb81e2862..ab7984970 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -154,11 +154,221 @@ interface SearchResult {
};
}
+interface ToolCall {
+ id: string;
+ toolName: string;
+ args: Record<string, any>;
+ result?: string;
+ isError?: boolean;
+ isRunning: boolean;
+}
+
+type ContentBlock =
+ | { type: "text"; text: string }
+ | { type: "tool"; toolCall: ToolCall };
+
interface Message {
id: string;
role: "user" | "assistant";
- content: string;
+ content: string; // full text for copy/history
timestamp: number;
+ contentBlocks?: ContentBlock[];
+}
+
+// Tool icons by name
+const TOOL_ICONS: Record<string, string> = {
+ bash: "⚡",
+ read: "📄",
+ edit: "✏️",
+ write: "📝",
+ grep: "🔍",
+ find: "🔎",
+ ls: "📁",
+};
+
+function ToolCallBlock({ toolCall }: { toolCall: ToolCall }) {
+ const [expanded, setExpanded] = useState(false);
+ const icon = TOOL_ICONS[toolCall.toolName] || "🔧";
+
+ // Format args for display
+ const argsPreview = toolCall.toolName === "bash"
+ ? toolCall.args.command || ""
+ : toolCall.toolName === "read"
+ ? toolCall.args.path || ""
+ : toolCall.toolName === "edit"
+ ? toolCall.args.path || ""
+ : toolCall.toolName === "write"
+ ? toolCall.args.path || ""
+ : JSON.stringify(toolCall.args).slice(0, 100);
+
+ return (
+ <div className="rounded-lg border border-border/50 bg-background/50 text-xs font-mono overflow-hidden">
+ <button
+ onClick={() => setExpanded(!expanded)}
+ className="w-full flex items-center gap-2 px-3 py-1.5 hover:bg-muted/50 transition-colors text-left"
+ >
+ {toolCall.isRunning ? (
+ <Loader2 className="h-3 w-3 animate-spin text-muted-foreground flex-shrink-0" />
+ ) : toolCall.isError ? (
+ <span className="text-destructive flex-shrink-0">✗</span>
+ ) : (
+ <span className="text-green-500 flex-shrink-0">✓</span>
+ )}
+ <span className="text-muted-foreground flex-shrink-0">{icon}</span>
+ <span className="font-semibold flex-shrink-0">{toolCall.toolName}</span>
+ <span className="text-muted-foreground truncate flex-1">{argsPreview}</span>
+ <span className="text-muted-foreground flex-shrink-0">{expanded ? "▾" : "▸"}</span>
+ </button>
+ {expanded && (
+ <div className="border-t border-border/50">
+ {/* Args */}
+ <div className="px-3 py-2 bg-neutral-900 dark:bg-neutral-950 text-neutral-300">
+ <div className="text-[10px] uppercase tracking-wider text-neutral-500 mb-1">input</div>
+ <pre className="whitespace-pre-wrap break-words text-neutral-100 max-h-[200px] overflow-y-auto">
+ {toolCall.toolName === "bash" ? toolCall.args.command : JSON.stringify(toolCall.args, null, 2)}
+ </pre>
+ </div>
+ {/* Result */}
+ {toolCall.result !== undefined && (
+ <div className="px-3 py-2 bg-neutral-900/80 dark:bg-neutral-950/80 text-neutral-300 border-t border-neutral-800">
+ <div className="text-[10px] uppercase tracking-wider text-neutral-500 mb-1">
+ {toolCall.isError ? "error" : "output"}
+ </div>
+ <pre className={cn(
+ "whitespace-pre-wrap break-words max-h-[300px] overflow-y-auto",
+ toolCall.isError ? "text-red-400" : "text-neutral-100"
+ )}>
+ {toolCall.result}
+ </pre>
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ );
+}
+
+// Markdown renderer for text blocks
+function MarkdownBlock({ text, isUser }: { text: string; isUser: boolean }) {
+ return (
+ <MemoizedReactMarkdown
+ className={cn(
+ "prose prose-sm max-w-none break-words overflow-hidden",
+ isUser ? "prose-invert" : "dark:prose-invert"
+ )}
+ remarkPlugins={[remarkGfm]}
+ components={{
+ p({ children }) {
+ return <p className="mb-2 last:mb-0 leading-relaxed">{children}</p>;
+ },
+ a({ href, children, ...props }) {
+ const isMediaLink = href?.toLowerCase().match(/\.(mp4|mp3|wav|webm)$/);
+ if (isMediaLink && href) {
+ return <VideoComponent filePath={href} className="my-2" />;
+ }
+
+ if (href?.startsWith("screenpipe://timeline")) {
+ const handleTimelineClick = async (e: React.MouseEvent<HTMLAnchorElement>) => {
+ e.preventDefault();
+ try {
+ const url = new URL(href);
+ const timestamp = url.searchParams.get("timestamp");
+ if (timestamp) {
+ const date = new Date(timestamp);
+ if (!isNaN(date.getTime())) {
+ await commands.showWindow("Main");
+ await emit("navigate-to-timestamp", timestamp);
+ }
+ }
+ } catch (error) {
+ console.error("Failed to navigate to timeline:", error);
+ }
+ };
+
+ return (
+ <a
+ href={href}
+ onClick={handleTimelineClick}
+ className="underline underline-offset-2 text-blue-500 hover:text-blue-400 cursor-pointer inline"
+ {...props}
+ >
+ {children}
+ </a>
+ );
+ }
+
+ return (
+ <a href={href} target="_blank" rel="noopener noreferrer" className="underline underline-offset-2" {...props}>
+ {children}
+ </a>
+ );
+ },
+ pre({ children, ...props }) {
+ return (
+ <pre className="overflow-x-auto rounded-lg bg-neutral-900 dark:bg-neutral-950 text-neutral-100 p-3 my-2 text-xs max-w-full" {...props}>
+ {children}
+ </pre>
+ );
+ },
+ code({ className, children, ...props }) {
+ const content = String(children).replace(/\n$/, "");
+ const isMedia = content.trim().toLowerCase().match(/\.(mp4|mp3|wav|webm)$/);
+ const match = /language-(\w+)/.exec(className || "");
+ const language = match?.[1] || "";
+ const isCodeBlock = className?.includes("language-");
+
+ if (language === "mermaid") {
+ return <MermaidDiagram chart={content} />;
+ }
+
+ if (isMedia) {
+ return <VideoComponent filePath={content.trim()} className="my-2" />;
+ }
+
+ if (isCodeBlock) {
+ return (
+ <code className="font-mono text-xs block whitespace-pre text-neutral-100" {...props}>
+ {content}
+ </code>
+ );
+ }
+
+ return (
+ <code className="px-1.5 py-0.5 rounded bg-neutral-800 dark:bg-neutral-900 text-neutral-100 font-mono text-xs" {...props}>
+ {content}
+ </code>
+ );
+ },
+ }}
+ >
+ {text}
+ </MemoizedReactMarkdown>
+ );
+}
+
+// Renders message content with interleaved text and tool call blocks
+function MessageContent({ message }: { message: Message }) {
+ const isUser = message.role === "user";
+
+ // If we have content blocks (Pi messages with tool calls), render them in order
+ if (message.contentBlocks && message.contentBlocks.length > 0) {
+ return (
+ <>
+ {message.contentBlocks.map((block, i) => {
+ if (block.type === "text" && block.text.trim()) {
+ return <MarkdownBlock key={`text-${i}`} text={block.text} isUser={isUser} />;
+ }
+ if (block.type === "tool") {
+ return <ToolCallBlock key={block.toolCall.id} toolCall={block.toolCall} />;
+ }
+ return null;
+ })}
+ </>
+ );
+ }
+
+ // Fallback: plain text message (user messages, non-Pi assistant messages)
+ return <MarkdownBlock text={message.content} isUser={isUser} />;
}
export function StandaloneChat() {
@@ -197,6 +407,7 @@ export function StandaloneChat() {
const [piStarting, setPiStarting] = useState(false);
const piStreamingTextRef = useRef<string>("");
const piMessageIdRef = useRef<string | null>(null);
+ const piContentBlocksRef = useRef<ContentBlock[]>([]);
const piStartInFlightRef = useRef(false);
const piRestartCountRef = useRef(0);
const piStoppedIntentionallyRef = useRef(false);
@@ -217,27 +428,8 @@ export function StandaloneChat() {
reader.readAsDataURL(file);
}, []);
- // Load active conversation from settings on mount
- useEffect(() => {
- if (!isSettingsLoaded) return;
-
- const history = settings.chatHistory;
- if (history?.activeConversationId && history.historyEnabled !== false) {
- const activeConv = history.conversations.find(
- c => c.id === history.activeConversationId
- );
- if (activeConv && activeConv.messages.length > 0) {
- setMessages(activeConv.messages.map(m => ({
- id: m.id,
- role: m.role,
- content: m.content,
- timestamp: m.timestamp,
- })));
- setConversationId(activeConv.id);
- }
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isSettingsLoaded]);
+ // Always start with a fresh conversation — history is accessible via the History button
+ // (No auto-load of last active conversation)
// Save conversation to settings
const saveConversation = async (msgs: Message[]) => {
@@ -709,7 +901,8 @@ export function StandaloneChat() {
// Auto-set Pi project dir
useEffect(() => {
if (isPi && !piProjectDir) {
- setPiProjectDir("/tmp/screenpipe-pi-chat");
+ const home = process.env.HOME || process.env.USERPROFILE || "/tmp";
+ setPiProjectDir(`${home}/.screenpipe/pi-chat`);
}
}, [isPi, piProjectDir]);
@@ -770,29 +963,62 @@ export function StandaloneChat() {
const evt = data.assistantMessageEvent;
if (evt.type === "text_delta" && evt.delta) {
piStreamingTextRef.current += evt.delta;
+
+ // Append to last text block or create new one
+ const blocks = piContentBlocksRef.current;
+ const lastBlock = blocks[blocks.length - 1];
+ if (lastBlock && lastBlock.type === "text") {
+ lastBlock.text += evt.delta;
+ } else {
+ blocks.push({ type: "text", text: evt.delta });
+ }
+
if (piMessageIdRef.current) {
const msgId = piMessageIdRef.current;
const content = piStreamingTextRef.current;
+ const contentBlocks = [...blocks];
setMessages((prev) =>
- prev.map((m) => m.id === msgId ? { ...m, content } : m)
+ prev.map((m) => m.id === msgId ? { ...m, content, contentBlocks } : m)
);
}
}
} else if (data.type === "tool_execution_start") {
if (piMessageIdRef.current) {
const msgId = piMessageIdRef.current;
- const currentText = piStreamingTextRef.current;
- const toolInfo = `\n\n*Running ${data.toolName}...*`;
+ const toolCall: ToolCall = {
+ id: data.toolCallId || Date.now().toString(),
+ toolName: data.toolName || "unknown",
+ args: data.args || {},
+ isRunning: true,
+ };
+ // Add tool block (text before it is already its own block)
+ piContentBlocksRef.current.push({ type: "tool", toolCall });
+ const contentBlocks = [...piContentBlocksRef.current];
setMessages((prev) =>
- prev.map((m) => m.id === msgId ? { ...m, content: currentText + toolInfo } : m)
+ prev.map((m) => m.id === msgId ? { ...m, contentBlocks } : m)
);
}
} else if (data.type === "tool_execution_end") {
if (piMessageIdRef.current) {
const msgId = piMessageIdRef.current;
- const content = piStreamingTextRef.current;
+ const toolCallId = data.toolCallId;
+ const resultText = data.result?.content
+ ?.map((c: any) => c.text || "")
+ .join("\n") || "";
+ const truncated = resultText.length > 2000
+ ? resultText.slice(0, 2000) + "\n... (truncated)"
+ : resultText;
+ // Update the tool block in-place
+ for (const block of piContentBlocksRef.current) {
+ if (block.type === "tool" && block.toolCall.id === toolCallId) {
+ block.toolCall.isRunning = false;
+ block.toolCall.result = truncated;
+ block.toolCall.isError = data.isError;
+ }
+ }
+ const contentBlocks = [...piContentBlocksRef.current];
setMessages((prev) =>
- prev.map((m) => m.id === msgId ? { ...m, content } : m)
+ prev.map((m) => m.id === msgId ? { ...m, contentBlocks } : m)
);
}
} else if (data.type === "agent_end") {
@@ -800,12 +1026,14 @@ export function StandaloneChat() {
if (piMessageIdRef.current) {
const msgId = piMessageIdRef.current;
const content = piStreamingTextRef.current || "Done";
+ const contentBlocks = [...piContentBlocksRef.current];
setMessages((prev) =>
- prev.map((m) => m.id === msgId ? { ...m, content } : m)
+ prev.map((m) => m.id === msgId ? { ...m, content, contentBlocks } : m)
);
}
piStreamingTextRef.current = "";
piMessageIdRef.current = null;
+ piContentBlocksRef.current = [];
setIsLoading(false);
setIsStreaming(false);
} else if (data.type === "response" && data.success === false) {
@@ -817,6 +1045,7 @@ export function StandaloneChat() {
}
piStreamingTextRef.current = "";
piMessageIdRef.current = null;
+ piContentBlocksRef.current = [];
setIsLoading(false);
setIsStreaming(false);
}
@@ -864,6 +1093,7 @@ export function StandaloneChat() {
piStreamingTextRef.current = "";
piMessageIdRef.current = assistantMessageId;
+ piContentBlocksRef.current = [];
setMessages((prev) => [...prev, newUserMessage]);
setInput("");
@@ -1620,7 +1850,7 @@ export function StandaloneChat() {
exit={{ opacity: 0, y: -10 }}
transition={{ duration: 0.2 }}
className={cn(
- "relative flex gap-3",
+ "relative flex gap-3 min-w-0",
message.role === "user" ? "flex-row-reverse" : "flex-row"
)}
>
@@ -1638,120 +1868,16 @@ export function StandaloneChat() {
<PipeAIIcon size={16} animated={false} />
)}
</div>
- <div className="group/message flex-1 flex flex-col">
+ <div className="group/message flex-1 flex flex-col min-w-0">
<div
className={cn(
- "relative rounded-xl px-4 py-3 text-sm border",
+ "relative rounded-xl px-4 py-3 text-sm border overflow-hidden",
message.role === "user"
? "bg-foreground text-background border-foreground"
: "bg-muted/30 border-border/50"
)}
>
- <MemoizedReactMarkdown
- className={cn(
- "prose prose-sm max-w-none",
- message.role === "user" ? "prose-invert" : "dark:prose-invert"
- )}
- remarkPlugins={[remarkGfm]}
- components={{
- p({ children }) {
- return <p className="mb-2 last:mb-0 leading-relaxed">{children}</p>;
- },
- a({ href, children, ...props }) {
- const isMediaLink = href?.toLowerCase().match(/\.(mp4|mp3|wav|webm)$/);
- if (isMediaLink && href) {
- return <VideoComponent filePath={href} className="my-2" />;
- }
-
- // Handle screenpipe:// timeline deep links in-app
- if (href?.startsWith("screenpipe://timeline")) {
- const handleTimelineClick = async (e: React.MouseEvent<HTMLAnchorElement>) => {
- e.preventDefault();
- try {
- const url = new URL(href);
- const timestamp = url.searchParams.get("timestamp");
- if (timestamp) {
- const date = new Date(timestamp);
- if (!isNaN(date.getTime())) {
- await commands.showWindow("Main");
- await emit("navigate-to-timestamp", timestamp);
- toast({
- title: "navigating to timestamp",
- description: `jumping to ${date.toLocaleString()}`,
- });
- }
- }
- } catch (error) {
- console.error("Failed to navigate to timeline:", error);
- toast({
- title: "navigation failed",
- description: "could not navigate to the timeline",
- variant: "destructive",
- });
- }
- };
-
- return (
- <a
- href={href}
- onClick={handleTimelineClick}
- className="underline underline-offset-2 text-blue-500 hover:text-blue-400 cursor-pointer inline"
- {...props}
- >
- {children}
- </a>
- );
- }
-
- return (
- <a href={href} target="_blank" rel="noopener noreferrer" className="underline underline-offset-2" {...props}>
- {children}
- </a>
- );
- },
- pre({ children, ...props }) {
- return (
- <pre className="overflow-x-auto rounded-lg bg-neutral-900 dark:bg-neutral-950 text-neutral-100 p-3 my-2 text-xs" style={{ maxWidth: 'calc(100% - 0px)' }} {...props}>
- {children}
- </pre>
- );
- },
- code({ className, children, ...props }) {
- const content = String(children).replace(/\n$/, "");
- const isMedia = content.trim().toLowerCase().match(/\.(mp4|mp3|wav|webm)$/);
- const match = /language-(\w+)/.exec(className || "");
- const language = match?.[1] || "";
- const isCodeBlock = className?.includes("language-");
-
- // Render mermaid diagrams
- if (language === "mermaid") {
- return <MermaidDiagram chart={content} />;
- }
-
- if (isMedia) {
- return <VideoComponent filePath={content.trim()} className="my-2" />;
- }
-
- // Code block (inside pre) - just the code, pre handles styling
- if (isCodeBlock) {
- return (
- <code className="font-mono text-xs block whitespace-pre text-neutral-100" {...props}>
- {content}
- </code>
- );
- }
-
- // Inline code
- return (
- <code className="px-1.5 py-0.5 rounded bg-neutral-800 dark:bg-neutral-900 text-neutral-100 font-mono text-xs" {...props}>
- {content}
- </code>
- );
- },
- }}
- >
- {message.content}
- </MemoizedReactMarkdown>
+ <MessageContent message={message} />
{/* Upgrade button for daily limit errors */}
{message.role === "assistant" &&
(message.content.includes("used all your free queries") ||
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 4dc16e600..c4b76fdf8 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9007,7 +9007,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.267"
+version = "2.0.268"
dependencies = [
"anyhow",
"async-stream",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 7decabe4e..458e51fb1 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.267"
+version = "2.0.268"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md b/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md
new file mode 100644
index 000000000..3828c719d
--- /dev/null
+++ b/apps/screenpipe-app-tauri/src-tauri/assets/skills/screenpipe-search/SKILL.md
@@ -0,0 +1,171 @@
+---
+name: screenpipe-search
+description: Search the user's screen recordings, audio transcriptions, and UI interactions via the local Screenpipe API at localhost:3030. Use when the user asks about their screen activity, meetings, apps they used, what they saw/heard, or anything about their computer usage history.
+---
+
+# Screenpipe Search
+
+Search the user's locally-recorded screen and audio data. Screenpipe continuously captures screen text (OCR), audio transcriptions, and UI events (clicks, keystrokes, app switches).
+
+The API runs at `http://localhost:3030`.
+
+## Search API
+
+```bash
+curl "http://localhost:3030/search?q=QUERY&content_type=all&limit=10&start_time=ISO8601&end_time=ISO8601"
+```
+
+### Parameters
+
+| Parameter | Type | Required | Description |
+|-----------|------|----------|-------------|
+| `q` | string | No | Search keywords. Be specific. |
+| `content_type` | string | No | `all` (default), `ocr`, `audio`, `vision`, `input` |
+| `limit` | integer | No | Max results 1-20. Default: 10 |
+| `offset` | integer | No | Pagination offset. Default: 0 |
+| `start_time` | ISO 8601 | **Yes** | Start of time range. ALWAYS include this. |
+| `end_time` | ISO 8601 | No | End of time range. Defaults to now. |
+| `app_name` | string | No | Filter by app (e.g. "Google Chrome", "Slack", "zoom.us", "Code") |
+| `window_name` | string | No | Filter by window title substring |
+| `speaker_name` | string | No | Filter audio by speaker name (case-insensitive partial match) |
+| `focused` | boolean | No | Only return results from focused windows |
+
+### Content Types
+
+- `vision` or `ocr` — Screen text captured via OCR
+- `audio` — Audio transcriptions (meetings, voice)
+- `input` — UI events: clicks, keystrokes, clipboard, app switches
+- `all` — Everything (default)
+
+### CRITICAL RULES
+
+1. **ALWAYS include `start_time`** — the database has hundreds of thousands of entries. Queries without time bounds WILL timeout.
+2. **Start with short time ranges** — default to last 1-2 hours. Only expand if no results found.
+3. **Use `app_name` filter** whenever the user mentions a specific app.
+4. **Keep `limit` low** (5-10) initially. Only increase if the user needs more.
+5. **"recent"** = last 30 minutes. **"today"** = since midnight. **"yesterday"** = yesterday's date range.
+6. If a search times out, retry with a narrower time range (e.g. 30 mins instead of 2 hours).
+
+### Example Searches
+
+```bash
+# What happened in the last hour
+curl "http://localhost:3030/search?content_type=all&limit=10&start_time=$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ)"
+
+# Slack messages today
+curl "http://localhost:3030/search?app_name=Slack&content_type=ocr&limit=10&start_time=$(date -u +%Y-%m-%dT00:00:00Z)"
+
+# Audio transcriptions from meetings
+curl "http://localhost:3030/search?content_type=audio&limit=5&start_time=$(date -u -v-4H +%Y-%m-%dT%H:%M:%SZ)"
+
+# What a specific person said
+curl "http://localhost:3030/search?content_type=audio&speaker_name=John&limit=10&start_time=$(date -u -v-24H +%Y-%m-%dT%H:%M:%SZ)"
+
+# Browser activity
+curl "http://localhost:3030/search?app_name=Google%20Chrome&content_type=ocr&limit=10&start_time=$(date -u -v-2H +%Y-%m-%dT%H:%M:%SZ)"
+```
+
+### Response Format
+
+```json
+{
+ "data": [
+ {
+ "type": "OCR",
+ "content": {
+ "frame_id": 12345,
+ "text": "screen text captured...",
+ "timestamp": "2024-01-15T10:30:00Z",
+ "file_path": "/path/to/video.mp4",
+ "offset_index": 42,
+ "app_name": "Google Chrome",
+ "window_name": "GitHub - screenpipe",
+ "tags": [],
+ "frame": null
+ }
+ },
+ {
+ "type": "Audio",
+ "content": {
+ "chunk_id": 678,
+ "transcription": "what they said...",
+ "timestamp": "2024-01-15T10:31:00Z",
+ "file_path": "/path/to/audio.mp4",
+ "offset_index": 5,
+ "tags": [],
+ "speaker": {
+ "id": 1,
+ "name": "John",
+ "metadata": ""
+ }
+ }
+ },
+ {
+ "type": "UI",
+ "content": {
+ "id": 999,
+ "text": "Clicked button 'Submit'",
+ "timestamp": "2024-01-15T10:32:00Z",
+ "app_name": "Safari",
+ "window_name": "Forms",
+ "initial_traversal_at": null
+ }
+ }
+ ],
+ "pagination": {
+ "limit": 10,
+ "offset": 0,
+ "total": 42
+ }
+}
+```
+
+## Other Useful Endpoints
+
+### Health Check
+```bash
+curl http://localhost:3030/health
+```
+
+### List Audio Devices
+```bash
+curl http://localhost:3030/audio/list
+```
+
+### List Monitors
+```bash
+curl http://localhost:3030/vision/list
+```
+
+### Raw SQL (advanced)
+```bash
+curl -X POST http://localhost:3030/raw_sql -H "Content-Type: application/json" -d '{"query": "SELECT COUNT(*) FROM ocr_text"}'
+```
+
+### Speakers
+```bash
+# Search speakers
+curl "http://localhost:3030/speakers/search?name=John"
+
+# List unnamed speakers
+curl http://localhost:3030/speakers/unnamed
+```
+
+## Showing Videos
+
+When referencing video files from search results, show the `file_path` to the user in an inline code block so it renders as a playable video:
+
+```
+`/Users/name/.screenpipe/data/monitor_1_2024-01-15_10-30-00.mp4`
+```
+
+Do NOT use markdown links or multi-line code blocks for videos.
+
+## Tips
+
+- The user's data is 100% local. You are querying their local machine.
+- Timestamps in results are UTC. Convert to the user's local timezone when displaying.
+- If asked "what did I work on today?", search with broad terms and short time ranges, then summarize by app/activity.
+- If asked about meetings, use `content_type=audio`.
+- If asked about a specific app, always use the `app_name` filter.
+- Combine multiple searches to build a complete picture (e.g., screen + audio for a meeting).
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index b4c75dc76..6588f89a2 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -200,6 +200,26 @@ fn find_pi_executable() -> Option<String> {
None
}
+/// Ensure the screenpipe-search skill exists in the project's .pi/skills directory
+fn ensure_screenpipe_skill(project_dir: &str) -> Result<(), String> {
+ let skill_dir = std::path::Path::new(project_dir)
+ .join(".pi")
+ .join("skills")
+ .join("screenpipe-search");
+ let skill_path = skill_dir.join("SKILL.md");
+
+ // Always overwrite to keep skill up-to-date with app version
+ std::fs::create_dir_all(&skill_dir)
+ .map_err(|e| format!("Failed to create skill dir: {}", e))?;
+
+ let skill_content = include_str!("../assets/skills/screenpipe-search/SKILL.md");
+ std::fs::write(&skill_path, skill_content)
+ .map_err(|e| format!("Failed to write screenpipe-search skill: {}", e))?;
+
+ debug!("Screenpipe search skill installed at {:?}", skill_path);
+ Ok(())
+}
+
/// Ensure Pi is configured to use screenpipe as the AI provider
fn ensure_pi_config(user_token: Option<&str>) -> Result<(), String> {
let config_dir = get_pi_config_dir()?;
@@ -306,6 +326,9 @@ pub async fn pi_start(
std::fs::create_dir_all(&project_dir)
.map_err(|e| format!("Failed to create project directory: {}", e))?;
+ // Ensure screenpipe-search skill exists in project
+ ensure_screenpipe_skill(&project_dir)?;
+
// Ensure Pi is configured
ensure_pi_config(user_token.as_deref())?;