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

chore(packages): drop dead @screenpipe/{agent,sync,skills} trio

Louis Beaumontb1c2a94486e8
diff --git a/packages/agent/README.md b/packages/agent/README.md
deleted file mode 100644
index ec3bdb579..000000000
--- a/packages/agent/README.md
+++ /dev/null
@@ -1,113 +0,0 @@
-# @screenpipe/agent
-
-**One-liner to connect Screenpipe to your AI agent.**
-
-Set up full Screenpipe integration with any AI agent (OpenClaw, OpenClaw, etc.) in one command. Includes data sync, skills, and optional morning summaries.
-
-## Quick Start
-
-```bash
-# Full setup with morning summaries at 8am
-bunx @screenpipe/agent --setup openclaw --morning 08:00
-
-# That's it! You'll get daily briefings via Telegram/WhatsApp/etc.
-```
-
-## What It Does
-
-1. **Syncs your screen data** - Daemon runs locally, syncs to your agent every hour
-2. **Installs skills** - recall, search, digest, context
-3. **Schedules morning summary** - Agent sends you daily briefing at specified time
-4. **Just works** - Survives reboots, runs in background
-
-## Usage
-
-```bash
-# Setup with morning summary
-bunx @screenpipe/agent --setup user@server --morning 08:00
-
-# Setup without morning summary
-bunx @screenpipe/agent --setup user@server
-
-# Custom sync interval (30 min)
-bunx @screenpipe/agent --setup user@server --sync-interval 1800
-
-# Check status
-bunx @screenpipe/agent --status user@server
-
-# Remove integration
-bunx @screenpipe/agent --remove user@server
-```
-
-## Options
-
-| Flag | Description |
-|------|-------------|
-| `--setup <host>` | Set up full integration |
-| `--remove <host>` | Remove integration |
-| `--status <host>` | Check integration status |
-| `--morning <HH:MM>` | Schedule morning summary |
-| `--sync-interval <s>` | Sync frequency (default: 3600) |
-| `--skip-sync` | Don't set up data sync |
-| `--skip-skills` | Don't install skills |
-
-## Requirements
-
-- [Screenpipe](https://screenpi.pe) running locally
-- SSH access to your agent server
-- AI agent that supports skills (OpenClaw, OpenClaw, etc.)
-
-## What You Get
-
-After setup, ask your agent:
-
-- "What was I working on yesterday?"
-- "Find when I saw that error message"
-- "Summarize my screen activity today"
-- "What meetings did I have this week?"
-
-With `--morning`, you'll receive a daily briefing at the specified time:
-
-```
-Good morning! Here's your briefing:
-
-**Yesterday's Focus:**
-- VS Code: ~3 hours
-- Chrome: ~2 hours
-- Slack: ~45 min
-
-**Action Items Found:**
-- [ ] Fix auth bug
-- [ ] Review PR #234
-
-**Pattern:** Deep focus morning, meetings afternoon.
-```
-
-## How It Works
-
-```
-Your Computer Your Agent Server
-┌─────────────┐ ┌─────────────────┐
-│ Screenpipe │ ──sync daemon──▶ │ ~/.screenpipe/ │
-│ (records) │ (hourly) │ db.sqlite │
-└─────────────┘ └────────┬────────┘
- │
- ▼
- ┌─────────────────┐
- │ AI Agent │
- │ (OpenClaw) │
- │ │
- │ Skills query │
- │ the database │
- └────────┬────────┘
- │
- ▼
- ┌─────────────────┐
- │ Telegram/ │
- │ WhatsApp/etc │
- └─────────────────┘
-```
-
-## License
-
-MIT - Part of [Screenpipe](https://github.com/screenpipe/screenpipe)
diff --git a/packages/agent/bun.lock b/packages/agent/bun.lock
deleted file mode 100644
index 9fe9eeb42..000000000
--- a/packages/agent/bun.lock
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "lockfileVersion": 1,
- "configVersion": 1,
- "workspaces": {
- "": {
- "name": "@screenpipe/agent",
- "devDependencies": {
- "@types/bun": "latest",
- "typescript": "^5.0.0",
- },
- },
- },
- "packages": {
- "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="],
-
- "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA=="],
-
- "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="],
-
- "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
-
- "undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
- }
-}
diff --git a/packages/agent/dist/index.js b/packages/agent/dist/index.js
deleted file mode 100755
index 1757a6efa..000000000
--- a/packages/agent/dist/index.js
+++ /dev/null
@@ -1,430 +0,0 @@
-#!/usr/bin/env bun
-// @bun
-
-// src/index.ts
-import { execSync } from "child_process";
-import { homedir, platform } from "os";
-import { writeFileSync, mkdirSync, unlinkSync } from "fs";
-import { join } from "path";
-function parseArgs() {
- const args = process.argv.slice(2);
- const config = {
- command: "help",
- remote: "",
- morning: null,
- syncInterval: 3600,
- skipSync: false,
- skipSkills: false,
- verbose: false
- };
- for (let i = 0;i < args.length; i++) {
- const arg = args[i];
- switch (arg) {
- case "--setup":
- case "-s":
- config.command = "setup";
- config.remote = args[++i] || "";
- break;
- case "--remove":
- case "-r":
- config.command = "remove";
- config.remote = args[++i] || "";
- break;
- case "--status":
- config.command = "status";
- config.remote = args[++i] || "";
- break;
- case "--morning":
- case "-m":
- config.morning = args[++i] || "08:00";
- break;
- case "--sync-interval":
- config.syncInterval = parseInt(args[++i]) || 3600;
- break;
- case "--skip-sync":
- config.skipSync = true;
- break;
- case "--skip-skills":
- config.skipSkills = true;
- break;
- case "--verbose":
- case "-v":
- config.verbose = true;
- break;
- case "--help":
- case "help":
- config.command = "help";
- break;
- }
- }
- return config;
-}
-function printHelp() {
- console.log(`
-@screenpipe/agent - One-liner to connect Screenpipe to your AI agent
-
-USAGE:
- bunx @screenpipe/agent --setup <host> [options]
- bunx @screenpipe/agent --remove <host>
- bunx @screenpipe/agent --status <host>
-
-OPTIONS:
- --setup <host> Set up full Screenpipe integration
- --remove <host> Remove Screenpipe integration
- --status <host> Check integration status
-
- --morning <HH:MM> Add morning summary at specified time (e.g., 08:00)
- --sync-interval <s> Sync frequency in seconds (default: 3600)
- --skip-sync Don't set up data sync
- --skip-skills Don't install skills
- -v, --verbose Show debug output
-
-EXAMPLES:
- # Full setup with morning summaries at 8am
- bunx @screenpipe/agent --setup clawdbot --morning 08:00
-
- # Setup with custom sync interval (30 min)
- bunx @screenpipe/agent --setup [email protected] --morning 07:30 --sync-interval 1800
-
- # Remove integration
- bunx @screenpipe/agent --remove clawdbot
-
-WHAT IT DOES:
- 1. Sets up screen data sync daemon (survives reboot)
- 2. Installs screenpipe skills (recall, search, digest, context)
- 3. Adds morning summary cron job to your agent
- 4. Your agent sends you daily briefings via Telegram/WhatsApp/etc
-`);
-}
-function log(step, total, msg) {
- console.log(`
-[${step}/${total}] ${msg}`);
-}
-function exec(cmd, verbose) {
- if (verbose)
- console.log(` $ ${cmd}`);
- try {
- return execSync(cmd, { encoding: "utf-8", stdio: verbose ? "inherit" : "pipe" }) || "";
- } catch (e) {
- if (verbose)
- console.error(` Error: ${e.message}`);
- throw e;
- }
-}
-function testSSH(remote) {
- try {
- execSync(`ssh -o ConnectTimeout=5 ${remote} "echo ok"`, { stdio: "pipe" });
- return true;
- } catch {
- return false;
- }
-}
-var MORNING_SKILL = `---
-name: screenpipe-morning
-description: Morning briefing from yesterday's screen activity. Run this skill daily to get a summary of what you worked on and action items.
-tools: Bash
----
-
-# Screenpipe Morning Briefing
-
-Generate a morning summary from yesterday's screen activity.
-
-## Query Yesterday's Activity
-
-\`\`\`bash
-sqlite3 -header ~/.screenpipe/db.sqlite "
- SELECT
- o.app_name,
- COUNT(*) as frames,
- ROUND(COUNT(*) * 5.0 / 60, 1) as approx_minutes
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now', '-1 day')
- GROUP BY o.app_name
- ORDER BY frames DESC
- LIMIT 10;
-"
-\`\`\`
-
-## Extract Action Items
-
-Search for patterns like "TODO", "need to", "should", "must", "action item":
-
-\`\`\`bash
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT DISTINCT substr(o.text, 1, 200)
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now', '-1 day')
- AND (o.text LIKE '%TODO%'
- OR o.text LIKE '%need to%'
- OR o.text LIKE '%action item%'
- OR o.text LIKE '%reminder%')
- LIMIT 20;
-"
-\`\`\`
-
-## Output Format
-
-Send the user a concise morning briefing:
-
-\`\`\`
-Good morning! Here's your briefing:
-
-**Yesterday's Focus:**
-- VS Code: ~3 hours (screenpipe repo)
-- Chrome: ~2 hours (docs, GitHub)
-- Slack: ~45 min
-
-**Action Items Found:**
-- [ ] Fix auth bug in login.ts
-- [ ] Review PR #234
-- [ ] Send weekly update
-
-**Pattern:** Deep focus morning, fragmented afternoon.
-\`\`\`
-`;
-async function setupMorningCron(remote, time, verbose) {
- const [hour, minute] = time.split(":").map((x) => parseInt(x) || 0);
- console.log(" \u2192 Installing morning skill...");
- const skillContent = MORNING_SKILL.replace(/`/g, "\\`");
- exec(`ssh ${remote} "mkdir -p ~/clawd/skills/screenpipe && cat > ~/clawd/skills/screenpipe/morning.md << 'SKILLEOF'
-${MORNING_SKILL}
-SKILLEOF"`, verbose);
- console.log(" \u2192 Adding cron job...");
- const cronCmd = `${minute} ${hour} * * * cd ~ && echo "Run screenpipe-morning skill and send me the summary" | tee /tmp/screenpipe-morning-trigger.txt`;
- exec(`ssh ${remote} "(crontab -l 2>/dev/null | grep -v screenpipe-morning; echo '${cronCmd}') | crontab -"`, verbose);
- const triggerScript = `#!/bin/bash
-# Screenpipe Morning Summary Trigger
-# This file is created at the scheduled time to trigger the morning summary
-echo "Morning summary requested at $(date)"
-`;
- exec(`ssh ${remote} "cat > ~/clawd/screenpipe-morning-trigger.sh << 'EOF'
-${triggerScript}
-EOF
-chmod +x ~/clawd/screenpipe-morning-trigger.sh"`, verbose);
-}
-async function setup(config) {
- if (!config.remote) {
- console.error("Error: --setup requires a host (e.g., --setup clawdbot)");
- process.exit(1);
- }
- const totalSteps = 4;
- console.log(`
-\uD83D\uDE80 Setting up Screenpipe integration with ${config.remote}...
-`);
- log(1, totalSteps, "Testing connection...");
- if (!testSSH(config.remote)) {
- console.error(` \u2717 Cannot connect to ${config.remote}`);
- console.error(` Make sure SSH is configured: ssh ${config.remote}`);
- process.exit(1);
- }
- console.log(` \u2192 Connected to ${config.remote} \u2713`);
- if (!config.skipSync) {
- log(2, totalSteps, "Setting up screen data sync...");
- try {
- exec(`bunx @screenpipe/sync --daemon --remote ${config.remote}:~/.screenpipe/ --interval ${config.syncInterval}`, config.verbose);
- console.log(` \u2192 Daemon installed, syncs every ${config.syncInterval}s`);
- } catch (e) {
- console.log(" \u2192 Running sync setup...");
- const home = homedir();
- const dbPath = join(home, ".screenpipe", "db.sqlite");
- exec(`ssh ${config.remote} "mkdir -p ~/.screenpipe"`, config.verbose);
- try {
- exec(`rsync -az "${dbPath}" ${config.remote}:~/.screenpipe/db.sqlite`, config.verbose);
- console.log(" \u2192 Initial sync complete");
- } catch {
- console.log(" \u2192 Will sync on next daemon run");
- }
- if (platform() === "darwin") {
- const plistPath = join(home, "Library/LaunchAgents/com.screenpipe.agent-sync.plist");
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>com.screenpipe.agent-sync</string>
- <key>ProgramArguments</key>
- <array>
- <string>/bin/bash</string>
- <string>-c</string>
- <string>rsync -az ~/.screenpipe/db.sqlite ${config.remote}:~/.screenpipe/db.sqlite 2>/dev/null || true</string>
- </array>
- <key>StartInterval</key>
- <integer>${config.syncInterval}</integer>
- <key>RunAtLoad</key>
- <true/>
- <key>StandardOutPath</key>
- <string>/tmp/screenpipe-agent-sync.log</string>
- <key>StandardErrorPath</key>
- <string>/tmp/screenpipe-agent-sync.err</string>
-</dict>
-</plist>`;
- mkdirSync(join(home, "Library/LaunchAgents"), { recursive: true });
- writeFileSync(plistPath, plist);
- try {
- execSync(`launchctl unload "${plistPath}" 2>/dev/null`);
- } catch {}
- execSync(`launchctl load "${plistPath}"`);
- console.log(` \u2192 Daemon installed, syncs every ${config.syncInterval}s`);
- }
- }
- } else {
- log(2, totalSteps, "Skipping sync setup (--skip-sync)");
- }
- if (!config.skipSkills) {
- log(3, totalSteps, "Installing screenpipe skills...");
- try {
- exec(`bunx @screenpipe/skills install --remote ${config.remote}`, config.verbose);
- console.log(" \u2192 recall, search, digest, context installed");
- } catch {
- console.log(" \u2192 Installing skills directly...");
- exec(`ssh ${config.remote} "mkdir -p ~/clawd/skills/screenpipe"`, config.verbose);
- const digestSkill = `---
-name: screenpipe-digest
-description: Get a summary of screen activity
-tools: Bash
----
-
-Query ~/.screenpipe/db.sqlite for activity summary.
-
-\\\`\\\`\\\`bash
-sqlite3 ~/.screenpipe/db.sqlite "SELECT app_name, COUNT(*) FROM ocr_text GROUP BY app_name ORDER BY COUNT(*) DESC LIMIT 10;"
-\\\`\\\`\\\`
-`;
- exec(`ssh ${config.remote} "echo '${digestSkill}' > ~/clawd/skills/screenpipe/digest.md"`, config.verbose);
- console.log(" \u2192 Basic skills installed");
- }
- } else {
- log(3, totalSteps, "Skipping skills installation (--skip-skills)");
- }
- if (config.morning) {
- log(4, totalSteps, `Adding morning summary at ${config.morning}...`);
- await setupMorningCron(config.remote, config.morning, config.verbose);
- console.log(` \u2192 Scheduled for ${config.morning} daily`);
- } else {
- log(4, totalSteps, "Skipping morning summary (use --morning HH:MM to enable)");
- }
- console.log(`
-\u2705 Done! Screenpipe is connected to ${config.remote}
-`);
- if (config.morning) {
- console.log(` \uD83D\uDCEC You'll receive daily summaries at ${config.morning}`);
- }
- console.log(` \uD83D\uDCA1 Ask your agent: "What was I working on yesterday?"`);
- console.log(`
- To remove: bunx @screenpipe/agent --remove ${config.remote}
-`);
-}
-async function remove(config) {
- if (!config.remote) {
- console.error("Error: --remove requires a host");
- process.exit(1);
- }
- console.log(`
-\uD83D\uDDD1\uFE0F Removing Screenpipe integration from ${config.remote}...
-`);
- const home = homedir();
- if (platform() === "darwin") {
- const plistPath = join(home, "Library/LaunchAgents/com.screenpipe.agent-sync.plist");
- try {
- execSync(`launchctl unload "${plistPath}" 2>/dev/null`);
- unlinkSync(plistPath);
- console.log(" \u2713 Local sync daemon removed");
- } catch {
- console.log(" - No local daemon found");
- }
- const syncPlistPath = join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
- try {
- execSync(`launchctl unload "${syncPlistPath}" 2>/dev/null`);
- unlinkSync(syncPlistPath);
- console.log(" \u2713 Sync daemon removed");
- } catch {}
- }
- try {
- exec(`ssh ${config.remote} "crontab -l 2>/dev/null | grep -v screenpipe | crontab -"`, config.verbose);
- console.log(" \u2713 Remote cron jobs removed");
- } catch {
- console.log(" - No remote cron found");
- }
- try {
- exec(`ssh ${config.remote} "rm -rf ~/clawd/skills/screenpipe"`, config.verbose);
- console.log(" \u2713 Remote skills removed");
- } catch {
- console.log(" - No remote skills found");
- }
- console.log(`
-\u2705 Screenpipe integration removed
-`);
-}
-async function status(config) {
- if (!config.remote) {
- console.error("Error: --status requires a host");
- process.exit(1);
- }
- console.log(`
-\uD83D\uDCCA Screenpipe integration status for ${config.remote}
-`);
- const sshOk = testSSH(config.remote);
- console.log(` SSH connection: ${sshOk ? "\u2713" : "\u2717"}`);
- if (!sshOk) {
- console.log(`
- Cannot connect to remote. Check SSH config.
-`);
- return;
- }
- if (platform() === "darwin") {
- try {
- const result = execSync("launchctl list | grep screenpipe", { encoding: "utf-8" });
- console.log(` Local sync daemon: \u2713 running`);
- } catch {
- console.log(` Local sync daemon: \u2717 not running`);
- }
- }
- try {
- const dbSize = exec(`ssh ${config.remote} "du -h ~/.screenpipe/db.sqlite 2>/dev/null | cut -f1"`, false).trim();
- console.log(` Remote database: \u2713 ${dbSize}`);
- } catch {
- console.log(` Remote database: \u2717 not found`);
- }
- try {
- const skills = exec(`ssh ${config.remote} "ls ~/clawd/skills/screenpipe/*.md 2>/dev/null | wc -l"`, false).trim();
- console.log(` Skills installed: \u2713 ${skills} skills`);
- } catch {
- console.log(` Skills installed: \u2717 none`);
- }
- try {
- const cron = exec(`ssh ${config.remote} "crontab -l 2>/dev/null | grep screenpipe-morning"`, false).trim();
- if (cron) {
- console.log(` Morning summary: \u2713 scheduled`);
- } else {
- console.log(` Morning summary: - not scheduled`);
- }
- } catch {
- console.log(` Morning summary: - not scheduled`);
- }
- console.log("");
-}
-async function main() {
- const config = parseArgs();
- switch (config.command) {
- case "setup":
- await setup(config);
- break;
- case "remove":
- await remove(config);
- break;
- case "status":
- await status(config);
- break;
- case "help":
- default:
- printHelp();
- }
-}
-main().catch((e) => {
- console.error(`
-\u274C Error: ${e.message}
-`);
- process.exit(1);
-});
diff --git a/packages/agent/package.json b/packages/agent/package.json
deleted file mode 100644
index 2d53f6e40..000000000
--- a/packages/agent/package.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "@screenpipe/agent",
- "version": "0.2.0",
- "description": "One-liner to connect Screenpipe to your AI agent. Uses Claude Code CLI for AI summaries. Sync screen data, install skills, schedule morning summaries.",
- "type": "module",
- "bin": {
- "screenpipe-agent": "dist/index.js"
- },
- "scripts": {
- "build": "bun build src/index.ts --outdir dist --target node",
- "dev": "bun run src/index.ts",
- "prepublishOnly": "bun run build"
- },
- "files": [
- "dist"
- ],
- "keywords": [
- "screenpipe",
- "ai-agent",
- "openclaw",
-
- "memory",
- "morning-summary"
- ],
- "author": "Louis Beaumont <[email protected]>",
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "https://github.com/screenpipe/screenpipe",
- "directory": "packages/agent"
- },
- "devDependencies": {
- "@types/bun": "latest",
- "typescript": "^5.0.0"
- }
-}
diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts
deleted file mode 100644
index 3bd5d65d9..000000000
--- a/packages/agent/src/index.ts
+++ /dev/null
@@ -1,525 +0,0 @@
-#!/usr/bin/env bun
-/**
- * @screenpipe/agent - One-liner to connect Screenpipe to your AI agent
- *
- * Usage:
- * bunx @screenpipe/agent --setup openclaw --morning 08:00
- * bunx @screenpipe/agent --remove openclaw
- */
-
-import { execSync, spawn } from "child_process";
-import { homedir, platform } from "os";
-import { writeFileSync, mkdirSync, readFileSync, unlinkSync } from "fs";
-import { join } from "path";
-
-interface Config {
- command: "setup" | "remove" | "status" | "help";
- remote: string;
- morning: string | null;
- syncInterval: number;
- skipSync: boolean;
- skipSkills: boolean;
- verbose: boolean;
-}
-
-function parseArgs(): Config {
- const args = process.argv.slice(2);
- const config: Config = {
- command: "help",
- remote: "",
- morning: null,
- syncInterval: 3600,
- skipSync: false,
- skipSkills: false,
- verbose: false,
- };
-
- for (let i = 0; i < args.length; i++) {
- const arg = args[i];
- switch (arg) {
- case "--setup":
- case "-s":
- config.command = "setup";
- config.remote = args[++i] || "";
- break;
- case "--remove":
- case "-r":
- config.command = "remove";
- config.remote = args[++i] || "";
- break;
- case "--status":
- config.command = "status";
- config.remote = args[++i] || "";
- break;
- case "--morning":
- case "-m":
- config.morning = args[++i] || "08:00";
- break;
- case "--sync-interval":
- config.syncInterval = parseInt(args[++i]) || 3600;
- break;
- case "--skip-sync":
- config.skipSync = true;
- break;
- case "--skip-skills":
- config.skipSkills = true;
- break;
- case "--verbose":
- case "-v":
- config.verbose = true;
- break;
- case "--help":
- case "help":
- config.command = "help";
- break;
- }
- }
-
- return config;
-}
-
-function printHelp() {
- console.log(`
-@screenpipe/agent - One-liner to connect Screenpipe to your AI agent
-
-USAGE:
- bunx @screenpipe/agent --setup <host> [options]
- bunx @screenpipe/agent --remove <host>
- bunx @screenpipe/agent --status <host>
-
-OPTIONS:
- --setup <host> Set up full Screenpipe integration
- --remove <host> Remove Screenpipe integration
- --status <host> Check integration status
-
- --morning <HH:MM> Add morning summary at specified time (e.g., 08:00)
- --sync-interval <s> Sync frequency in seconds (default: 3600)
- --skip-sync Don't set up data sync
- --skip-skills Don't install skills
- -v, --verbose Show debug output
-
-EXAMPLES:
- # Full setup with morning summaries at 8am
- bunx @screenpipe/agent --setup openclaw --morning 08:00
-
- # Setup with custom sync interval (30 min)
- bunx @screenpipe/agent --setup [email protected] --morning 07:30 --sync-interval 1800
-
- # Remove integration
- bunx @screenpipe/agent --remove openclaw
-
-WHAT IT DOES:
- 1. Sets up screen data sync daemon (survives reboot)
- 2. Installs screenpipe skills (recall, search, digest, context)
- 3. Adds morning summary cron job to your agent
- 4. Your agent sends you daily briefings via Telegram/WhatsApp/etc
-`);
-}
-
-function log(step: number, total: number, msg: string) {
- console.log(`\n[${step}/${total}] ${msg}`);
-}
-
-function exec(cmd: string, verbose: boolean): string {
- if (verbose) console.log(` $ ${cmd}`);
- try {
- return execSync(cmd, { encoding: "utf-8", stdio: verbose ? "inherit" : "pipe" }) || "";
- } catch (e: any) {
- if (verbose) console.error(` Error: ${e.message}`);
- throw e;
- }
-}
-
-function testSSH(remote: string): boolean {
- try {
- execSync(`ssh -o ConnectTimeout=5 ${remote} "echo ok"`, { stdio: "pipe" });
- return true;
- } catch {
- return false;
- }
-}
-
-// Morning summary skill with cron instructions
-const MORNING_SKILL = `---
-name: screenpipe-morning
-description: Morning briefing from yesterday's screen activity. Run this skill daily to get a summary of what you worked on and action items.
-tools: Bash
----
-
-# Screenpipe Morning Briefing
-
-Generate a morning summary from yesterday's screen activity.
-
-## Query Yesterday's Activity
-
-\`\`\`bash
-sqlite3 -header ~/.screenpipe/db.sqlite "
- SELECT
- o.app_name,
- COUNT(*) as frames,
- ROUND(COUNT(*) * 5.0 / 60, 1) as approx_minutes
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now', '-1 day')
- GROUP BY o.app_name
- ORDER BY frames DESC
- LIMIT 10;
-"
-\`\`\`
-
-## Extract Action Items
-
-Search for patterns like "TODO", "need to", "should", "must", "action item":
-
-\`\`\`bash
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT DISTINCT substr(o.text, 1, 200)
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now', '-1 day')
- AND (o.text LIKE '%TODO%'
- OR o.text LIKE '%need to%'
- OR o.text LIKE '%action item%'
- OR o.text LIKE '%reminder%')
- LIMIT 20;
-"
-\`\`\`
-
-## Output Format
-
-Send the user a concise morning briefing:
-
-\`\`\`
-Good morning! Here's your briefing:
-
-**Yesterday's Focus:**
-- VS Code: ~3 hours (screenpipe repo)
-- Chrome: ~2 hours (docs, GitHub)
-- Slack: ~45 min
-
-**Action Items Found:**
-- [ ] Fix auth bug in login.ts
-- [ ] Review PR #234
-- [ ] Send weekly update
-
-**Pattern:** Deep focus morning, fragmented afternoon.
-\`\`\`
-`;
-
-async function setupMorningCron(remote: string, time: string, verbose: boolean) {
- const [hour, minute] = time.split(":").map((x) => parseInt(x) || 0);
-
- // Install the morning skill
- console.log(" → Installing morning skill...");
- const skillContent = MORNING_SKILL.replace(/`/g, "\\`");
- exec(
- `ssh ${remote} "mkdir -p ~/clawd/skills/screenpipe && cat > ~/clawd/skills/screenpipe/morning.md << 'SKILLEOF'
-${MORNING_SKILL}
-SKILLEOF"`,
- verbose
- );
-
- // Add cron job on remote
- console.log(" → Adding cron job...");
-
- // Create the cron command - runs the morning summary
- const cronCmd = `${minute} ${hour} * * * cd ~ && echo "Run screenpipe-morning skill and send me the summary" | tee /tmp/screenpipe-morning-trigger.txt`;
-
- // Add to crontab (preserving existing entries)
- exec(
- `ssh ${remote} "(crontab -l 2>/dev/null | grep -v screenpipe-morning; echo '${cronCmd}') | crontab -"`,
- verbose
- );
-
- // Also create a script that can be triggered
- const triggerScript = `#!/bin/bash
-# Screenpipe Morning Summary Trigger
-# This file is created at the scheduled time to trigger the morning summary
-echo "Morning summary requested at $(date)"
-`;
-
- exec(
- `ssh ${remote} "cat > ~/clawd/screenpipe-morning-trigger.sh << 'EOF'
-${triggerScript}
-EOF
-chmod +x ~/clawd/screenpipe-morning-trigger.sh"`,
- verbose
- );
-}
-
-async function setup(config: Config) {
- if (!config.remote) {
- console.error("Error: --setup requires a host (e.g., --setup openclaw)");
- process.exit(1);
- }
-
- const totalSteps = 4;
- console.log(`\n🚀 Setting up Screenpipe integration with ${config.remote}...\n`);
-
- // Step 1: Test SSH connection
- log(1, totalSteps, "Testing connection...");
- if (!testSSH(config.remote)) {
- console.error(` ✗ Cannot connect to ${config.remote}`);
- console.error(` Make sure SSH is configured: ssh ${config.remote}`);
- process.exit(1);
- }
- console.log(` → Connected to ${config.remote} ✓`);
-
- // Step 2: Set up sync daemon
- if (!config.skipSync) {
- log(2, totalSteps, "Setting up screen data sync...");
- try {
- // Install sync daemon locally
- exec(
- `bunx @screenpipe/sync --daemon --remote ${config.remote}:~/.screenpipe/ --interval ${config.syncInterval}`,
- config.verbose
- );
- console.log(` → Daemon installed, syncs every ${config.syncInterval}s`);
- } catch (e) {
- console.log(" → Running sync setup...");
- // Fallback: run sync package directly
- const home = homedir();
- const dbPath = join(home, ".screenpipe", "db.sqlite");
-
- // Create remote directory
- exec(`ssh ${config.remote} "mkdir -p ~/.screenpipe"`, config.verbose);
-
- // Initial sync
- try {
- exec(`rsync -az "${dbPath}" ${config.remote}:~/.screenpipe/db.sqlite`, config.verbose);
- console.log(" → Initial sync complete");
- } catch {
- console.log(" → Will sync on next daemon run");
- }
-
- // Set up local daemon using launchd/systemd
- if (platform() === "darwin") {
- const plistPath = join(home, "Library/LaunchAgents/com.screenpipe.agent-sync.plist");
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>com.screenpipe.agent-sync</string>
- <key>ProgramArguments</key>
- <array>
- <string>/bin/bash</string>
- <string>-c</string>
- <string>rsync -az ~/.screenpipe/db.sqlite ${config.remote}:~/.screenpipe/db.sqlite 2>/dev/null || true</string>
- </array>
- <key>StartInterval</key>
- <integer>${config.syncInterval}</integer>
- <key>RunAtLoad</key>
- <true/>
- <key>StandardOutPath</key>
- <string>/tmp/screenpipe-agent-sync.log</string>
- <key>StandardErrorPath</key>
- <string>/tmp/screenpipe-agent-sync.err</string>
-</dict>
-</plist>`;
- mkdirSync(join(home, "Library/LaunchAgents"), { recursive: true });
- writeFileSync(plistPath, plist);
- try { execSync(`launchctl unload "${plistPath}" 2>/dev/null`); } catch {}
- execSync(`launchctl load "${plistPath}"`);
- console.log(` → Daemon installed, syncs every ${config.syncInterval}s`);
- }
- }
- } else {
- log(2, totalSteps, "Skipping sync setup (--skip-sync)");
- }
-
- // Step 3: Install skills
- if (!config.skipSkills) {
- log(3, totalSteps, "Installing screenpipe skills...");
- try {
- exec(`bunx @screenpipe/skills install --remote ${config.remote}`, config.verbose);
- console.log(" → recall, search, digest, context installed");
- } catch {
- // Fallback: install skills manually
- console.log(" → Installing skills directly...");
- exec(`ssh ${config.remote} "mkdir -p ~/clawd/skills/screenpipe"`, config.verbose);
-
- // Minimal skill installation
- const digestSkill = `---
-name: screenpipe-digest
-description: Get a summary of screen activity
-tools: Bash
----
-
-Query ~/.screenpipe/db.sqlite for activity summary.
-
-\\\`\\\`\\\`bash
-sqlite3 ~/.screenpipe/db.sqlite "SELECT app_name, COUNT(*) FROM ocr_text GROUP BY app_name ORDER BY COUNT(*) DESC LIMIT 10;"
-\\\`\\\`\\\`
-`;
- exec(
- `ssh ${config.remote} "echo '${digestSkill}' > ~/clawd/skills/screenpipe/digest.md"`,
- config.verbose
- );
- console.log(" → Basic skills installed");
- }
- } else {
- log(3, totalSteps, "Skipping skills installation (--skip-skills)");
- }
-
- // Step 4: Set up morning summary
- if (config.morning) {
- log(4, totalSteps, `Adding morning summary at ${config.morning}...`);
- await setupMorningCron(config.remote, config.morning, config.verbose);
- console.log(` → Scheduled for ${config.morning} daily`);
- } else {
- log(4, totalSteps, "Skipping morning summary (use --morning HH:MM to enable)");
- }
-
- // Done!
- console.log(`\n✅ Done! Screenpipe is connected to ${config.remote}\n`);
-
- if (config.morning) {
- console.log(` 📬 You'll receive daily summaries at ${config.morning}`);
- }
-
- console.log(` 💡 Ask your agent: "What was I working on yesterday?"`);
- console.log(`\n To remove: bunx @screenpipe/agent --remove ${config.remote}\n`);
-}
-
-async function remove(config: Config) {
- if (!config.remote) {
- console.error("Error: --remove requires a host");
- process.exit(1);
- }
-
- console.log(`\n🗑️ Removing Screenpipe integration from ${config.remote}...\n`);
-
- // Remove local daemon
- const home = homedir();
- if (platform() === "darwin") {
- const plistPath = join(home, "Library/LaunchAgents/com.screenpipe.agent-sync.plist");
- try {
- execSync(`launchctl unload "${plistPath}" 2>/dev/null`);
- unlinkSync(plistPath);
- console.log(" ✓ Local sync daemon removed");
- } catch {
- console.log(" - No local daemon found");
- }
-
- // Also remove the @screenpipe/sync daemon if it exists
- const syncPlistPath = join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
- try {
- execSync(`launchctl unload "${syncPlistPath}" 2>/dev/null`);
- unlinkSync(syncPlistPath);
- console.log(" ✓ Sync daemon removed");
- } catch {}
- }
-
- // Remove remote cron
- try {
- exec(
- `ssh ${config.remote} "crontab -l 2>/dev/null | grep -v screenpipe | crontab -"`,
- config.verbose
- );
- console.log(" ✓ Remote cron jobs removed");
- } catch {
- console.log(" - No remote cron found");
- }
-
- // Remove remote skills
- try {
- exec(`ssh ${config.remote} "rm -rf ~/clawd/skills/screenpipe"`, config.verbose);
- console.log(" ✓ Remote skills removed");
- } catch {
- console.log(" - No remote skills found");
- }
-
- console.log("\n✅ Screenpipe integration removed\n");
-}
-
-async function status(config: Config) {
- if (!config.remote) {
- console.error("Error: --status requires a host");
- process.exit(1);
- }
-
- console.log(`\n📊 Screenpipe integration status for ${config.remote}\n`);
-
- // Check SSH
- const sshOk = testSSH(config.remote);
- console.log(` SSH connection: ${sshOk ? "✓" : "✗"}`);
-
- if (!sshOk) {
- console.log("\n Cannot connect to remote. Check SSH config.\n");
- return;
- }
-
- // Check local daemon
- if (platform() === "darwin") {
- try {
- const result = execSync("launchctl list | grep screenpipe", { encoding: "utf-8" });
- console.log(` Local sync daemon: ✓ running`);
- } catch {
- console.log(` Local sync daemon: ✗ not running`);
- }
- }
-
- // Check remote DB
- try {
- const dbSize = exec(
- `ssh ${config.remote} "du -h ~/.screenpipe/db.sqlite 2>/dev/null | cut -f1"`,
- false
- ).trim();
- console.log(` Remote database: ✓ ${dbSize}`);
- } catch {
- console.log(` Remote database: ✗ not found`);
- }
-
- // Check skills
- try {
- const skills = exec(
- `ssh ${config.remote} "ls ~/clawd/skills/screenpipe/*.md 2>/dev/null | wc -l"`,
- false
- ).trim();
- console.log(` Skills installed: ✓ ${skills} skills`);
- } catch {
- console.log(` Skills installed: ✗ none`);
- }
-
- // Check morning cron
- try {
- const cron = exec(
- `ssh ${config.remote} "crontab -l 2>/dev/null | grep screenpipe-morning"`,
- false
- ).trim();
- if (cron) {
- console.log(` Morning summary: ✓ scheduled`);
- } else {
- console.log(` Morning summary: - not scheduled`);
- }
- } catch {
- console.log(` Morning summary: - not scheduled`);
- }
-
- console.log("");
-}
-
-async function main() {
- const config = parseArgs();
-
- switch (config.command) {
- case "setup":
- await setup(config);
- break;
- case "remove":
- await remove(config);
- break;
- case "status":
- await status(config);
- break;
- case "help":
- default:
- printHelp();
- }
-}
-
-main().catch((e) => {
- console.error(`\n❌ Error: ${e.message}\n`);
- process.exit(1);
-});
diff --git a/packages/agent/tsconfig.json b/packages/agent/tsconfig.json
deleted file mode 100644
index 021397787..000000000
--- a/packages/agent/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2022",
- "module": "ESNext",
- "moduleResolution": "bundler",
- "esModuleInterop": true,
- "strict": true,
- "skipLibCheck": true,
- "outDir": "dist",
- "declaration": true,
- "types": ["bun-types"]
- },
- "include": ["src/**/*"]
-}
diff --git a/packages/skills/README.md b/packages/skills/README.md
deleted file mode 100644
index 61edaa392..000000000
--- a/packages/skills/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# @screenpipe/skills
-
-**Screenpipe skills for AI agents.**
-
-One-liner to install Screenpipe skills to your AI agent (OpenClaw, Claude Code, etc). Your agent can then query your screen history, get daily digests, and search memories.
-
-## Quick Start
-
-```bash
-# Install to remote agent (e.g., OpenClaw)
-bunx @screenpipe/skills install --remote openclaw
-
-# Install locally
-bunx @screenpipe/skills install
-
-# List available skills
-bunx @screenpipe/skills list
-```
-
-## Skills Included
-
-| Skill | Trigger | What it does |
-|-------|---------|--------------|
-| **recall** | "What was I doing at 3pm?" | Query screen history by time |
-| **search** | "Find when I saw error 404" | Full-text search memories |
-| **digest** | "What did I work on today?" | Daily activity summaries |
-| **context** | "Context for the auth refactor" | Get context for a topic |
-
-## Requirements
-
-- [Screenpipe](https://screenpi.pe) installed and running
-- Screen data synced to agent via `bunx @screenpipe/sync --daemon`
-- SQLite3 available on the agent
-
-## Full Setup
-
-```bash
-# 1. Sync your screen data to the agent
-bunx @screenpipe/sync --daemon --remote openclaw:~/.screenpipe/
-
-# 2. Install skills
-bunx @screenpipe/skills install --remote openclaw
-
-# 3. Ask your agent
-"What was I doing at 3pm yesterday?"
-"Find when I last saw the budget spreadsheet"
-"Summarize my work today"
-```
-
-## How It Works
-
-Skills are markdown files that teach your AI agent how to query the Screenpipe SQLite database:
-
-```sql
--- Example: Get today's app usage
-SELECT app_name, COUNT(*) as frames
-FROM ocr_text o
-JOIN frames f ON o.frame_id = f.id
-WHERE date(f.timestamp) = date('now')
-GROUP BY app_name
-ORDER BY frames DESC;
-```
-
-The agent reads these skill files and uses them to answer your questions about your screen history.
-
-## License
-
-MIT - Part of [Screenpipe](https://github.com/screenpipe/screenpipe)
diff --git a/packages/skills/bun.lock b/packages/skills/bun.lock
deleted file mode 100644
index cef35dca7..000000000
--- a/packages/skills/bun.lock
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "lockfileVersion": 1,
- "configVersion": 1,
- "workspaces": {
- "": {
- "name": "@screenpipe/skills",
- "devDependencies": {
- "@types/bun": "latest",
- "typescript": "^5.0.0",
- },
- },
- },
- "packages": {
- "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="],
-
- "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA=="],
-
- "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="],
-
- "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
-
- "undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
- }
-}
diff --git a/packages/skills/dist/index.js b/packages/skills/dist/index.js
deleted file mode 100755
index 94b2a3b40..000000000
--- a/packages/skills/dist/index.js
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/env bun
-// @bun
-
-// src/index.ts
-import { readdir, readFile, mkdir, writeFile } from "fs/promises";
-import { execSync } from "child_process";
-import { join, dirname } from "path";
-import { fileURLToPath } from "url";
-import { homedir } from "os";
-var __dirname2 = dirname(fileURLToPath(import.meta.url));
-var SKILLS_DIR = join(__dirname2, "..", "skills");
-function parseArgs() {
- const args = process.argv.slice(2);
- const config = {
- command: "help",
- remote: null,
- outputDir: join(homedir(), "clawd", "skills", "screenpipe"),
- verbose: false
- };
- for (let i = 0;i < args.length; i++) {
- const arg = args[i];
- switch (arg) {
- case "install":
- config.command = "install";
- break;
- case "list":
- config.command = "list";
- break;
- case "--remote":
- case "-r":
- config.remote = args[++i];
- break;
- case "--output":
- case "-o":
- config.outputDir = args[++i];
- break;
- case "--verbose":
- case "-v":
- config.verbose = true;
- break;
- case "--help":
- case "help":
- config.command = "help";
- break;
- }
- }
- return config;
-}
-function printHelp() {
- console.log(`
-@screenpipe/skills - Install Screenpipe skills to AI agents
-
-USAGE:
- bunx @screenpipe/skills <command> [options]
-
-COMMANDS:
- install Install skills to local or remote agent
- list List available skills
-
-OPTIONS:
- -r, --remote <host> Install to remote server via SSH (e.g., clawdbot)
- -o, --output <dir> Local output directory (default: ~/clawd/skills/screenpipe)
- -v, --verbose Show debug output
-
-EXAMPLES:
- # Install to local Clawdbot
- bunx @screenpipe/skills install
-
- # Install to remote server
- bunx @screenpipe/skills install --remote clawdbot
-
- # Install to custom directory
- bunx @screenpipe/skills install --output ~/.claude/skills/screenpipe
-
- # List available skills
- bunx @screenpipe/skills list
-
-SKILLS INCLUDED:
- - recall : Query screen history by time ("What was I doing at 3pm?")
- - search : Full-text search memories ("Find when I saw error 404")
- - digest : Daily activity summaries ("What did I work on today?")
- - context : Get context for a topic ("Context for the auth refactor")
-`);
-}
-async function listSkills() {
- console.log(`
-\uD83D\uDCE6 Available Screenpipe Skills:
-`);
- const files = await readdir(SKILLS_DIR);
- for (const file of files) {
- if (!file.endsWith(".md"))
- continue;
- const content = await readFile(join(SKILLS_DIR, file), "utf-8");
- const nameMatch = content.match(/name:\s*(.+)/);
- const descMatch = content.match(/description:\s*(.+)/);
- const name = nameMatch?.[1] || file.replace(".md", "");
- const desc = descMatch?.[1] || "No description";
- console.log(` ${name}`);
- console.log(` ${desc}
-`);
- }
-}
-async function installSkills(config) {
- const files = await readdir(SKILLS_DIR);
- const skills = files.filter((f) => f.endsWith(".md"));
- console.log(`
-\uD83D\uDCE6 Installing ${skills.length} Screenpipe skills...
-`);
- if (config.remote) {
- console.log(` Target: ${config.remote}:~/clawd/skills/screenpipe/`);
- try {
- execSync(`ssh ${config.remote} "mkdir -p ~/clawd/skills/screenpipe"`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- } catch (e) {
- console.error(`[error] Failed to create remote directory`);
- process.exit(1);
- }
- for (const skill of skills) {
- const src = join(SKILLS_DIR, skill);
- const dest = `${config.remote}:~/clawd/skills/screenpipe/${skill}`;
- try {
- execSync(`scp "${src}" "${dest}"`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- console.log(` \u2713 ${skill}`);
- } catch (e) {
- console.error(` \u2717 ${skill} - failed`);
- }
- }
- console.log(`
-\u2705 Skills installed to ${config.remote}`);
- console.log(` Your agent can now use: recall, search, digest, context`);
- } else {
- console.log(` Target: ${config.outputDir}/`);
- await mkdir(config.outputDir, { recursive: true });
- for (const skill of skills) {
- const src = join(SKILLS_DIR, skill);
- const dest = join(config.outputDir, skill);
- const content = await readFile(src, "utf-8");
- await writeFile(dest, content);
- console.log(` \u2713 ${skill}`);
- }
- console.log(`
-\u2705 Skills installed locally`);
- console.log(` Your agent can now use: recall, search, digest, context`);
- }
-}
-async function main() {
- const config = parseArgs();
- switch (config.command) {
- case "install":
- await installSkills(config);
- break;
- case "list":
- await listSkills();
- break;
- case "help":
- default:
- printHelp();
- }
-}
-main().catch((e) => {
- console.error(`[error] ${e.message}`);
- process.exit(1);
-});
diff --git a/packages/skills/package.json b/packages/skills/package.json
deleted file mode 100644
index 93dbc9563..000000000
--- a/packages/skills/package.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "name": "@screenpipe/skills",
- "version": "0.1.1",
- "description": "Screenpipe skills for AI agents (OpenClaw, Claude Code, etc). Query your screen history, get daily digests, search memories.",
- "type": "module",
- "bin": {
- "screenpipe-skills": "dist/index.js"
- },
- "scripts": {
- "build": "bun build src/index.ts --outdir dist --target node",
- "dev": "bun run src/index.ts",
- "prepublishOnly": "bun run build"
- },
- "files": [
- "dist",
- "skills"
- ],
- "keywords": [
- "screenpipe",
- "ai-agent",
- "openclaw",
- "skills",
- "memory",
- "screen-recording"
- ],
- "author": "Louis Beaumont <[email protected]>",
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "https://github.com/screenpipe/screenpipe",
- "directory": "packages/skills"
- },
- "devDependencies": {
- "@types/bun": "latest",
- "typescript": "^5.0.0"
- }
-}
diff --git a/packages/skills/skills/context.md b/packages/skills/skills/context.md
deleted file mode 100644
index 147ac6ce6..000000000
--- a/packages/skills/skills/context.md
+++ /dev/null
@@ -1,113 +0,0 @@
----
-name: screenpipe-context
-description: Get context for a task or topic. "What do I know about project X?" "Context for the auth refactor"
-tools: Bash
----
-
-# Screenpipe Context
-
-Pull relevant screen history for a specific topic, project, or task.
-
-## Database Location
-
-```
-~/.screenpipe/db.sqlite
-```
-
-## Query Patterns
-
-```bash
-# Search for topic across all time
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT
- date(f.timestamp) as day,
- o.app_name,
- o.window_name,
- substr(o.text, 1, 300) as content
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE o.text LIKE '%auth%' OR o.text LIKE '%authentication%'
- ORDER BY f.timestamp DESC
- LIMIT 50;
-"
-
-# Get window titles related to topic
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT DISTINCT
- o.app_name,
- o.window_name,
- COUNT(*) as times_seen
- FROM ocr_text o
- WHERE o.window_name LIKE '%project-name%'
- GROUP BY o.window_name
- ORDER BY times_seen DESC
- LIMIT 20;
-"
-
-# Timeline of when topic was worked on
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT
- date(f.timestamp) as day,
- COUNT(*) as frames,
- GROUP_CONCAT(DISTINCT o.app_name) as apps
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE o.text LIKE '%screenpipe%'
- GROUP BY day
- ORDER BY day DESC
- LIMIT 14;
-"
-
-# Extract code snippets related to topic
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT f.timestamp, substr(o.text, 1, 500)
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE o.app_name IN ('VS Code', 'Cursor', 'Zed', 'Terminal')
- AND o.text LIKE '%function%'
- AND o.text LIKE '%auth%'
- ORDER BY f.timestamp DESC
- LIMIT 10;
-"
-```
-
-## Your Task
-
-When the user needs context about something:
-
-1. Extract the topic/project/task from their question
-2. Search across all history for related content
-3. Group by:
- - When (which days/times)
- - Where (which apps)
- - What (relevant content snippets)
-4. Synthesize into useful context
-
-## Output Format
-
-```markdown
-## Context: [Topic]
-
-### Timeline
-- First seen: 2026-01-15
-- Last worked on: 2026-01-29
-- Total days: 8
-
-### Apps Used
-- VS Code (45 frames) - main development
-- Chrome (23 frames) - docs, Stack Overflow
-- Slack (12 frames) - discussions
-
-### Key Files/Windows
-- `auth.ts` - main auth logic
-- `login.tsx` - login UI
-- GitHub PR #234
-
-### Relevant Content
-- [snippet 1]
-- [snippet 2]
-
-### Recent Activity
-- Yesterday: Fixed token refresh bug
-- 3 days ago: Added OAuth support
-```
diff --git a/packages/skills/skills/digest.md b/packages/skills/skills/digest.md
deleted file mode 100644
index 54247c466..000000000
--- a/packages/skills/skills/digest.md
+++ /dev/null
@@ -1,102 +0,0 @@
----
-name: screenpipe-digest
-description: Get a summary of screen activity. "What did I work on today?" "Summarize yesterday"
-tools: Bash
----
-
-# Screenpipe Daily Digest
-
-Generate summaries of screen activity from the SQLite database.
-
-## Database Location
-
-```
-~/.screenpipe/db.sqlite
-```
-
-## Query Patterns
-
-```bash
-# App usage breakdown for today
-sqlite3 -header -column ~/.screenpipe/db.sqlite "
- SELECT
- o.app_name,
- COUNT(*) as frames,
- ROUND(COUNT(*) * 5.0 / 60, 1) as approx_minutes
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now')
- GROUP BY o.app_name
- ORDER BY frames DESC
- LIMIT 15;
-"
-
-# Timeline of app switches
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT
- strftime('%H:%M', f.timestamp) as time,
- o.app_name,
- o.window_name
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now')
- GROUP BY strftime('%H', f.timestamp), o.app_name
- ORDER BY f.timestamp;
-"
-
-# Sample of content from each app today
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT o.app_name, substr(o.text, 1, 200) as sample
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now')
- GROUP BY o.app_name
- LIMIT 10;
-"
-
-# First and last activity
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT
- MIN(f.timestamp) as first_activity,
- MAX(f.timestamp) as last_activity
- FROM frames f
- WHERE date(f.timestamp) = date('now');
-"
-```
-
-## Your Task
-
-When the user asks for a digest or summary:
-
-1. Query app usage breakdown (time per app)
-2. Get a timeline of major activities
-3. Sample content from each major app
-4. Summarize into a coherent narrative:
- - What apps were used and for how long
- - What was the user working on
- - Any patterns (deep work, meetings, browsing)
-
-## Output Format
-
-```markdown
-## Daily Digest - [Date]
-
-### Time Breakdown
-- VS Code: ~3 hours (screenpipe repo)
-- Chrome: ~2 hours (GitHub, Docs)
-- Slack: ~45 min
-
-### Timeline
-- 9am-11am: Deep work on auth feature
-- 11am-12pm: Code review, Slack
-- 2pm-5pm: Debugging, testing
-
-### Key Activities
-- Fixed authentication bug
-- Reviewed 3 PRs
-- Slack discussion about launch
-
-### Patterns
-- Good focus block in morning
-- Fragmented afternoon (12 app switches)
-```
diff --git a/packages/skills/skills/recall.md b/packages/skills/skills/recall.md
deleted file mode 100644
index 47291b026..000000000
--- a/packages/skills/skills/recall.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-name: screenpipe-recall
-description: Query your screen history by time. "What was I doing at 3pm?" "What did I see yesterday morning?"
-tools: Bash
----
-
-# Screenpipe Recall
-
-Query the local Screenpipe SQLite database to recall what was on screen at a specific time.
-
-## Database Location
-
-```
-~/.screenpipe/db.sqlite
-```
-
-## Query Patterns
-
-```bash
-# Get screen content from a specific hour
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT f.timestamp, o.text, o.app_name, o.window_name
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE f.timestamp LIKE '2026-01-29 15:%'
- ORDER BY f.timestamp DESC
- LIMIT 20;
-"
-
-# Get content from time range
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT f.timestamp, o.app_name, substr(o.text, 1, 200) as text_preview
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE f.timestamp BETWEEN '2026-01-29 14:00:00' AND '2026-01-29 16:00:00'
- ORDER BY f.timestamp
- LIMIT 50;
-"
-
-# Get today's activity by app
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT o.app_name, COUNT(*) as frames
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE date(f.timestamp) = date('now')
- GROUP BY o.app_name
- ORDER BY frames DESC;
-"
-```
-
-## Your Task
-
-When the user asks about what they were doing at a specific time:
-
-1. Parse the time from their question (e.g., "3pm" → "15:00", "yesterday morning" → yesterday's date + "09:00-12:00")
-2. Query the database with appropriate time filters
-3. Summarize what apps were used and what content was visible
-4. If they ask about a specific topic, filter by text content
-
-## Examples
-
-User: "What was I doing at 3pm?"
-→ Query for frames around 15:00 today, summarize apps and content
-
-User: "What did I work on yesterday afternoon?"
-→ Query for yesterday's date, 12:00-18:00, group by app
-
-User: "When did I last look at the budget spreadsheet?"
-→ Search for "budget" in text, return timestamps
diff --git a/packages/skills/skills/search.md b/packages/skills/skills/search.md
deleted file mode 100644
index 28cb1a937..000000000
--- a/packages/skills/skills/search.md
+++ /dev/null
@@ -1,81 +0,0 @@
----
-name: screenpipe-search
-description: Full-text search your screen history. "Find when I saw error 404" "Search for meeting notes"
-tools: Bash
----
-
-# Screenpipe Search
-
-Full-text search across all screen recordings using SQLite FTS5.
-
-## Database Location
-
-```
-~/.screenpipe/db.sqlite
-```
-
-## Query Patterns
-
-```bash
-# Full-text search (FTS5)
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT f.timestamp, o.app_name, o.window_name, snippet(ocr_text_fts, 1, '>>>', '<<<', '...', 30) as match
- FROM ocr_text_fts
- JOIN ocr_text o ON o.rowid = ocr_text_fts.rowid
- JOIN frames f ON o.frame_id = f.id
- WHERE ocr_text_fts MATCH 'error'
- ORDER BY f.timestamp DESC
- LIMIT 20;
-"
-
-# Search with multiple terms
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT f.timestamp, o.app_name, substr(o.text, 1, 300)
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE o.text LIKE '%API%' AND o.text LIKE '%key%'
- ORDER BY f.timestamp DESC
- LIMIT 20;
-"
-
-# Search in specific app
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT f.timestamp, o.window_name, substr(o.text, 1, 200)
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE o.app_name = 'Slack' AND o.text LIKE '%deadline%'
- ORDER BY f.timestamp DESC
- LIMIT 20;
-"
-
-# Count occurrences by day
-sqlite3 ~/.screenpipe/db.sqlite "
- SELECT date(f.timestamp) as day, COUNT(*) as mentions
- FROM ocr_text o
- JOIN frames f ON o.frame_id = f.id
- WHERE o.text LIKE '%screenpipe%'
- GROUP BY day
- ORDER BY day DESC
- LIMIT 10;
-"
-```
-
-## Your Task
-
-When the user wants to search their screen history:
-
-1. Extract search terms from their query
-2. Use FTS5 for fast full-text search, or LIKE for simple patterns
-3. Return relevant matches with timestamps and context
-4. Summarize findings (when, where, how often)
-
-## Examples
-
-User: "Find when I saw that error message about authentication"
-→ Search for "authentication" + "error", return timestamps and apps
-
-User: "Search for anything about the Q4 budget"
-→ Search for "Q4" + "budget", show matches with context
-
-User: "How many times did I look at Twitter today?"
-→ Count frames where app_name contains Twitter for today
diff --git a/packages/skills/src/index.ts b/packages/skills/src/index.ts
deleted file mode 100644
index fe7b7fb2b..000000000
--- a/packages/skills/src/index.ts
+++ /dev/null
@@ -1,198 +0,0 @@
-#!/usr/bin/env bun
-/**
- * @screenpipe/skills - Install Screenpipe skills to AI agents
- *
- * Usage:
- * bunx @screenpipe/skills install # Install locally
- * bunx @screenpipe/skills install --remote openclaw # Install to remote
- * bunx @screenpipe/skills list # List available skills
- */
-
-import { readdir, readFile, mkdir, writeFile } from "fs/promises";
-import { execSync } from "child_process";
-import { join, dirname } from "path";
-import { fileURLToPath } from "url";
-import { homedir } from "os";
-
-const __dirname = dirname(fileURLToPath(import.meta.url));
-const SKILLS_DIR = join(__dirname, "..", "skills");
-
-interface Config {
- command: "install" | "list" | "help";
- remote: string | null;
- outputDir: string;
- verbose: boolean;
-}
-
-function parseArgs(): Config {
- const args = process.argv.slice(2);
- const config: Config = {
- command: "help",
- remote: null,
- outputDir: join(homedir(), "clawd", "skills", "screenpipe"),
- verbose: false,
- };
-
- for (let i = 0; i < args.length; i++) {
- const arg = args[i];
- switch (arg) {
- case "install":
- config.command = "install";
- break;
- case "list":
- config.command = "list";
- break;
- case "--remote":
- case "-r":
- config.remote = args[++i];
- break;
- case "--output":
- case "-o":
- config.outputDir = args[++i];
- break;
- case "--verbose":
- case "-v":
- config.verbose = true;
- break;
- case "--help":
- case "help":
- config.command = "help";
- break;
- }
- }
-
- return config;
-}
-
-function printHelp() {
- console.log(`
-@screenpipe/skills - Install Screenpipe skills to AI agents
-
-USAGE:
- bunx @screenpipe/skills <command> [options]
-
-COMMANDS:
- install Install skills to local or remote agent
- list List available skills
-
-OPTIONS:
- -r, --remote <host> Install to remote server via SSH (e.g., openclaw)
- -o, --output <dir> Local output directory (default: ~/clawd/skills/screenpipe)
- -v, --verbose Show debug output
-
-EXAMPLES:
- # Install to local OpenClaw
- bunx @screenpipe/skills install
-
- # Install to remote server
- bunx @screenpipe/skills install --remote openclaw
-
- # Install to custom directory
- bunx @screenpipe/skills install --output ~/.claude/skills/screenpipe
-
- # List available skills
- bunx @screenpipe/skills list
-
-SKILLS INCLUDED:
- - recall : Query screen history by time ("What was I doing at 3pm?")
- - search : Full-text search memories ("Find when I saw error 404")
- - digest : Daily activity summaries ("What did I work on today?")
- - context : Get context for a topic ("Context for the auth refactor")
-`);
-}
-
-async function listSkills() {
- console.log("\n📦 Available Screenpipe Skills:\n");
-
- const files = await readdir(SKILLS_DIR);
- for (const file of files) {
- if (!file.endsWith(".md")) continue;
-
- const content = await readFile(join(SKILLS_DIR, file), "utf-8");
- const nameMatch = content.match(/name:\s*(.+)/);
- const descMatch = content.match(/description:\s*(.+)/);
-
- const name = nameMatch?.[1] || file.replace(".md", "");
- const desc = descMatch?.[1] || "No description";
-
- console.log(` ${name}`);
- console.log(` ${desc}\n`);
- }
-}
-
-async function installSkills(config: Config) {
- const files = await readdir(SKILLS_DIR);
- const skills = files.filter((f) => f.endsWith(".md"));
-
- console.log(`\n📦 Installing ${skills.length} Screenpipe skills...\n`);
-
- if (config.remote) {
- // Remote install via SSH
- console.log(` Target: ${config.remote}:~/clawd/skills/screenpipe/`);
-
- // Create remote directory
- try {
- execSync(`ssh ${config.remote} "mkdir -p ~/clawd/skills/screenpipe"`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- } catch (e) {
- console.error(`[error] Failed to create remote directory`);
- process.exit(1);
- }
-
- // Copy each skill
- for (const skill of skills) {
- const src = join(SKILLS_DIR, skill);
- const dest = `${config.remote}:~/clawd/skills/screenpipe/${skill}`;
-
- try {
- execSync(`scp "${src}" "${dest}"`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- console.log(` ✓ ${skill}`);
- } catch (e) {
- console.error(` ✗ ${skill} - failed`);
- }
- }
-
- console.log(`\n✅ Skills installed to ${config.remote}`);
- console.log(` Your agent can now use: recall, search, digest, context`);
- } else {
- // Local install
- console.log(` Target: ${config.outputDir}/`);
-
- await mkdir(config.outputDir, { recursive: true });
-
- for (const skill of skills) {
- const src = join(SKILLS_DIR, skill);
- const dest = join(config.outputDir, skill);
- const content = await readFile(src, "utf-8");
- await writeFile(dest, content);
- console.log(` ✓ ${skill}`);
- }
-
- console.log(`\n✅ Skills installed locally`);
- console.log(` Your agent can now use: recall, search, digest, context`);
- }
-}
-
-async function main() {
- const config = parseArgs();
-
- switch (config.command) {
- case "install":
- await installSkills(config);
- break;
- case "list":
- await listSkills();
- break;
- case "help":
- default:
- printHelp();
- }
-}
-
-main().catch((e) => {
- console.error(`[error] ${e.message}`);
- process.exit(1);
-});
diff --git a/packages/skills/tsconfig.json b/packages/skills/tsconfig.json
deleted file mode 100644
index 021397787..000000000
--- a/packages/skills/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2022",
- "module": "ESNext",
- "moduleResolution": "bundler",
- "esModuleInterop": true,
- "strict": true,
- "skipLibCheck": true,
- "outDir": "dist",
- "declaration": true,
- "types": ["bun-types"]
- },
- "include": ["src/**/*"]
-}
diff --git a/packages/sync/README.md b/packages/sync/README.md
deleted file mode 100644
index 71d4a87b9..000000000
--- a/packages/sync/README.md
+++ /dev/null
@@ -1,149 +0,0 @@
-# @screenpipe/sync
-
-**Sync your Screenpipe data to remote AI agents.**
-
-One-liner to sync daily summaries to a remote server (e.g., [OpenClaw](https://github.com/openclaw/openclaw)). Uses Claude Code CLI for AI-powered extraction.
-
-## Quick Start
-
-```bash
-# AI summary to stdout
-bunx @screenpipe/sync
-
-# Save daily summaries locally
-bunx @screenpipe/sync --output ~/Documents/brain/context --git
-
-# Sync summaries to remote server
-bunx @screenpipe/sync --output /tmp/summaries --remote user@host:~/screenpipe-pkm
-
-# Persistent daemon (survives reboot)
-bunx @screenpipe/sync --daemon --output /tmp/summaries --remote user@host:~/clawd/screenpipe-pkm
-```
-
-## What It Extracts
-
-| Category | Description |
-|----------|-------------|
-| **Todos** | Action items visible on screen or mentioned |
-| **Goals** | Objectives, intentions, targets mentioned |
-| **Decisions** | Choices made or discussed |
-| **Activities** | Key tasks worked on, by app |
-| **Meetings** | Calls, conversations, collaborations |
-| **Blockers** | Problems, frustrations, obstacles |
-| **Insights** | AI observations about work patterns |
-
-## Example Output
-
-```markdown
-# Daily Context - 2026-01-31
-
-> Analyzed 480 minutes of screen activity
-
-## Apps Used
-- **VS Code**: ~180 min
-- **Chrome**: ~120 min
-- **Slack**: ~60 min
-
-## Todos Extracted
-- Fix authentication bug in login.ts
-- Review PR #234 for payment integration
-- Send weekly update to investors
-
-## Goals Mentioned
-- Ship v2.9 by Friday
-- Reach 50% activation rate
-
-## AI Insights
-- Heavy context switching between Slack and VS Code
-- Deep focus block from 2-4pm on auth refactor
-```
-
-## Options
-
-| Flag | Description | Default |
-|------|-------------|---------|
-| `-o, --output <dir>` | Save to directory | stdout |
-| `-h, --hours <n>` | Hours to analyze | 12 |
-| `-g, --git` | Auto commit & push | false |
-| `-r, --remote <host>` | Sync via SSH | - |
-| `-d, --daemon` | Install persistent sync | false |
-| `--interval <secs>` | Daemon interval | 3600 |
-| `--stop` | Stop daemon | - |
-| `--json` | JSON output | markdown |
-| `-v, --verbose` | Debug output | false |
-
-## AI Summarization
-
-Uses [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) if available:
-
-```bash
-# Install Claude Code CLI
-npm install -g @anthropic-ai/claude-code
-
-# Verify it works
-claude --version
-```
-
-Falls back to structured extraction (no AI) if CLI not found.
-
-## OpenClaw Integration
-
-For daily digests via Telegram:
-
-1. **Local Mac** syncs summaries hourly:
-```bash
-bunx @screenpipe/sync --daemon --output /tmp/summaries --remote openclaw:~/clawd/screenpipe-pkm
-```
-
-2. **OpenClaw** has native cron that reads files and sends digest:
-```bash
-# Already configured - runs at 9pm PT
-sudo docker exec openclaw-gateway node dist/index.js cron list
-```
-
-## Use Cases
-
-### Daily Journaling
-```bash
-bunx @screenpipe/sync --output ~/journal --hours 16
-```
-
-### Weekly Review Prep
-```bash
-bunx @screenpipe/sync --hours 168 --json > week.json
-```
-
-### Daemon Mode (Recommended)
-```bash
-# Install persistent sync - survives reboot
-bunx @screenpipe/sync --daemon -r user@host:~/screenpipe-pkm
-
-# Check status
-# macOS: cat /tmp/screenpipe-sync.log
-# Linux: systemctl --user status screenpipe-sync.timer
-
-# Stop daemon
-bunx @screenpipe/sync --stop
-```
-
-## How It Works
-
-1. **Query** - Fetches OCR data from local Screenpipe API
-2. **Dedupe** - Removes duplicate/similar screen captures
-3. **Extract** - Claude Code CLI analyzes for structured data
-4. **Format** - Outputs markdown or JSON
-5. **Sync** - SCPs to remote server
-
-## Requirements
-
-- [Screenpipe](https://github.com/screenpipe/screenpipe) running locally
-- [Bun](https://bun.sh) runtime
-- [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) (optional, for AI extraction)
-
-## Privacy
-
-All processing happens locally. Screen data never leaves your machine unless you explicitly sync summaries to a remote.
-
-## License
-
-MIT - Part of the [Screenpipe](https://github.com/screenpipe/screenpipe) project.
diff --git a/packages/sync/bun.lock b/packages/sync/bun.lock
deleted file mode 100644
index deb6ac438..000000000
--- a/packages/sync/bun.lock
+++ /dev/null
@@ -1,97 +0,0 @@
-{
- "lockfileVersion": 1,
- "configVersion": 1,
- "workspaces": {
- "": {
- "name": "@screenpipe/sync",
- "dependencies": {
- "@anthropic-ai/sdk": "^0.39.0",
- },
- "devDependencies": {
- "@types/bun": "latest",
- "typescript": "^5.0.0",
- },
- },
- },
- "packages": {
- "@anthropic-ai/sdk": ["@anthropic-ai/[email protected]", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-eMyDIPRZbt1CCLErRCi3exlAvNkBtRe+kW5vvJyef93PmNr/clstYgHhtvmkxN82nlKgzyGPCyGxrm0JQ1ZIdg=="],
-
- "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="],
-
- "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg=="],
-
- "@types/node-fetch": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*", "form-data": "^4.0.4" } }, "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw=="],
-
- "abort-controller": ["[email protected]", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="],
-
- "agentkeepalive": ["[email protected]", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="],
-
- "asynckit": ["[email protected]", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
-
- "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="],
-
- "call-bind-apply-helpers": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
-
- "combined-stream": ["[email protected]", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="],
-
- "delayed-stream": ["[email protected]", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="],
-
- "dunder-proto": ["[email protected]", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
-
- "es-define-property": ["[email protected]", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
-
- "es-errors": ["[email protected]", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
-
- "es-object-atoms": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
-
- "es-set-tostringtag": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="],
-
- "event-target-shim": ["[email protected]", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="],
-
- "form-data": ["[email protected]", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.2", "mime-types": "^2.1.12" } }, "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w=="],
-
- "form-data-encoder": ["[email protected]", "", {}, "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A=="],
-
- "formdata-node": ["[email protected]", "", { "dependencies": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.3" } }, "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ=="],
-
- "function-bind": ["[email protected]", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
-
- "get-intrinsic": ["[email protected]", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
-
- "get-proto": ["[email protected]", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
-
- "gopd": ["[email protected]", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
-
- "has-symbols": ["[email protected]", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
-
- "has-tostringtag": ["[email protected]", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
-
- "hasown": ["[email protected]", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
-
- "humanize-ms": ["[email protected]", "", { "dependencies": { "ms": "^2.0.0" } }, "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ=="],
-
- "math-intrinsics": ["[email protected]", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
-
- "mime-db": ["[email protected]", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
-
- "mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
-
- "ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
-
- "node-domexception": ["[email protected]", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="],
-
- "node-fetch": ["[email protected]", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
-
- "tr46": ["[email protected]", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
-
- "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
-
- "undici-types": ["[email protected]", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
-
- "web-streams-polyfill": ["[email protected]", "", {}, "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug=="],
-
- "webidl-conversions": ["[email protected]", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
-
- "whatwg-url": ["[email protected]", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
- }
-}
diff --git a/packages/sync/dist/index.js b/packages/sync/dist/index.js
deleted file mode 100755
index 0657fb73c..000000000
--- a/packages/sync/dist/index.js
+++ /dev/null
@@ -1,583 +0,0 @@
-#!/usr/bin/env bun
-// @bun
-import { createRequire } from "node:module";
-var __require = /* @__PURE__ */ createRequire(import.meta.url);
-
-// src/index.ts
-import { execSync } from "child_process";
-function parseArgs() {
- const args = process.argv.slice(2);
- const home = process.env.HOME || process.env.USERPROFILE || "~";
- const config = {
- screenpipeUrl: process.env.SCREENPIPE_URL || "http://localhost:3030",
- outputDir: null,
- hours: 12,
- gitPush: false,
- remote: null,
- format: "markdown",
- verbose: false,
- dbSync: false,
- dbPath: process.env.SCREENPIPE_DB || `${home}/.screenpipe/db.sqlite`,
- daemon: false,
- daemonInterval: 3600,
- daemonStop: false
- };
- for (let i = 0;i < args.length; i++) {
- const arg = args[i];
- switch (arg) {
- case "--output":
- case "-o":
- config.outputDir = args[++i];
- break;
- case "--hours":
- case "-h":
- config.hours = parseInt(args[++i]) || 12;
- break;
- case "--git":
- case "-g":
- config.gitPush = true;
- break;
- case "--remote":
- case "-r":
- config.remote = args[++i];
- break;
- case "--json":
- config.format = "json";
- break;
- case "--verbose":
- case "-v":
- config.verbose = true;
- break;
- case "--db":
- case "--db-sync":
- config.dbSync = true;
- break;
- case "--db-path":
- config.dbPath = args[++i];
- break;
- case "--daemon":
- case "-d":
- config.daemon = true;
- config.dbSync = true;
- break;
- case "--interval":
- config.daemonInterval = parseInt(args[++i]) || 3600;
- break;
- case "--stop":
- config.daemonStop = true;
- break;
- case "--help":
- printHelp();
- process.exit(0);
- }
- }
- return config;
-}
-function printHelp() {
- console.log(`
-screenpipe-sync - Extract daily context from Screenpipe
-
-USAGE:
- bunx @screenpipe/sync [options]
-
-MODES:
- Summary mode (default): AI-powered daily summary extraction
- DB sync mode (--db): Copy raw SQLite database to remote
-
-OPTIONS:
- -o, --output <dir> Save summary to directory (default: stdout)
- -h, --hours <n> Hours of history to analyze (default: 12)
- -g, --git Auto commit and push after writing
- -r, --remote <host> Sync to remote via SSH (user@host:path)
- --json Output as JSON instead of markdown
- -v, --verbose Show debug output
-
- --db, --db-sync Sync raw SQLite database instead of summary
- --db-path <path> Path to Screenpipe DB (default: ~/.screenpipe/db.sqlite)
-
- -d, --daemon Install persistent background sync (survives reboot)
- --interval <secs> Sync interval in seconds (default: 3600 = 1 hour)
- --stop Stop and remove the daemon
-
-ENVIRONMENT:
- SCREENPIPE_URL Screenpipe API URL (default: http://localhost:3030)
- SCREENPIPE_DB Path to Screenpipe database
-
-AI SUMMARIZATION:
- Uses Claude Code CLI if available (claude --print)
- Falls back to structured extraction if no AI CLI found
-
-EXAMPLES:
- # AI summary to stdout
- bunx @screenpipe/sync
-
- # Save daily summaries locally
- bunx @screenpipe/sync --output ~/Documents/brain/context --git
-
- # Sync raw database to remote (e.g., Clawdbot)
- bunx @screenpipe/sync --db --remote user@clawdbot:~/.screenpipe/
-
- # Full sync: DB + daily summary
- bunx @screenpipe/sync --db -r clawdbot:~/.screenpipe && bunx @screenpipe/sync -o ~/context -g
-
- # ONE-LINER: Permanent background sync (survives reboot)
- bunx @screenpipe/sync --daemon --remote user@server:~/.screenpipe/
-
- # Stop the daemon
- bunx @screenpipe/sync --stop
-
-OUTPUT (summary mode):
- - Todo items extracted from screen content
- - Goals and intentions mentioned
- - Decisions made
- - Key activities by app
- - Meetings and conversations
- - Blockers and problems
- - AI-generated insights
-
-OUTPUT (db mode):
- - Copies ~/.screenpipe/db.sqlite to remote
- - Remote can query SQLite directly for full history
-`);
-}
-async function queryScreenpipe(config) {
- const startTime = new Date(Date.now() - config.hours * 60 * 60 * 1000);
- const url = new URL(`${config.screenpipeUrl}/search`);
- url.searchParams.set("content_type", "ocr");
- url.searchParams.set("limit", "500");
- url.searchParams.set("start_time", startTime.toISOString());
- if (config.verbose) {
- console.error(`[screenpipe] Querying: ${url}`);
- }
- try {
- const res = await fetch(url.toString());
- if (!res.ok) {
- throw new Error(`Screenpipe API error: ${res.status}`);
- }
- const data = await res.json();
- return data.data || [];
- } catch (e) {
- console.error(`[error] Failed to connect to Screenpipe at ${config.screenpipeUrl}`);
- console.error(` Make sure Screenpipe is running.`);
- process.exit(1);
- }
-}
-function processResults(results) {
- const byApp = {};
- const timeline = [];
- const seen = new Set;
- for (const r of results) {
- if (r.type !== "OCR")
- continue;
- const text = r.content.text?.trim();
- if (!text || text.length < 20)
- continue;
- const hash = text.slice(0, 100);
- if (seen.has(hash))
- continue;
- seen.add(hash);
- const app = r.content.app_name || "Unknown";
- byApp[app] = byApp[app] || [];
- byApp[app].push(text);
- timeline.push({
- time: r.content.timestamp,
- app,
- text: text.slice(0, 500)
- });
- }
- return { byApp, timeline };
-}
-var EXTRACTION_PROMPT = `You are analyzing screen capture data from a user's computer to create a structured daily summary.
-
-INPUT: Raw OCR text from screen captures, organized by app.
-
-OUTPUT: A structured extraction in this exact JSON format:
-{
- "todos": ["actionable items mentioned or visible on screen"],
- "goals": ["goals, objectives, intentions mentioned"],
- "decisions": ["decisions made or discussed"],
- "activities": ["key activities/tasks worked on"],
- "meetings": ["meetings, calls, conversations"],
- "blockers": ["problems, blockers, frustrations"],
- "insights": ["2-3 AI observations about the day's work patterns"]
-}
-
-RULES:
-- Extract ACTUAL content seen on screen, not generic statements
-- Todos should be actionable (start with verb)
-- Be specific: "Fix auth bug in login.ts" not "worked on code"
-- Deduplicate similar items
-- Max 10 items per category
-- If no relevant content for a category, use empty array
-- Insights should note patterns (context switching, focus blocks, late nights, etc.)
-
-Analyze this screen data:
-`;
-function hasClaudeCli() {
- try {
- execSync("which claude", { stdio: "pipe" });
- return true;
- } catch {
- return false;
- }
-}
-async function extractWithAI(byApp, config) {
- const condensed = Object.entries(byApp).map(([app, texts]) => {
- const sample = texts.slice(0, 20).join(`
----
-`).slice(0, 3000);
- return `## ${app}
-${sample}`;
- }).join(`
-
-`).slice(0, 15000);
- const prompt = EXTRACTION_PROMPT + condensed;
- if (hasClaudeCli()) {
- if (config.verbose)
- console.error(`[ai] Using Claude Code CLI (${condensed.length} chars)`);
- try {
- const fs = await import("fs/promises");
- const os = await import("os");
- const path = await import("path");
- const tmpFile = path.join(os.tmpdir(), `screenpipe-prompt-${Date.now()}.txt`);
- await fs.writeFile(tmpFile, prompt);
- const result = execSync(`cat "${tmpFile}" | claude --print`, {
- encoding: "utf-8",
- maxBuffer: 10485760,
- timeout: 120000
- });
- await fs.unlink(tmpFile).catch(() => {});
- const jsonMatch = result.match(/\{[\s\S]*\}/);
- if (jsonMatch) {
- return JSON.parse(jsonMatch[0]);
- }
- } catch (e) {
- console.error(`[error] Claude CLI failed: ${e.message}`);
- }
- } else {
- if (config.verbose)
- console.error(`[ai] Claude CLI not found`);
- }
- console.error("[info] No AI CLI found - using structured extraction");
- console.error(" Install Claude Code CLI for AI summaries: npm install -g @anthropic-ai/claude-code");
- return {
- todos: [],
- goals: [],
- decisions: [],
- activities: Object.keys(byApp).slice(0, 10).map((app) => `Used ${app}`),
- meetings: [],
- blockers: [],
- insights: ["Structured extraction only - install Claude Code CLI for AI insights"]
- };
-}
-function formatMarkdown(summary) {
- const { date, apps, todos, goals, decisions, activities, meetings, blockers, insights } = summary;
- const appList = Object.entries(apps).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([app, mins]) => `- **${app}**: ~${mins} min`).join(`
-`);
- const formatList = (items) => items.length > 0 ? items.map((i) => `- ${i}`).join(`
-`) : "_None extracted_";
- return `# Daily Context - ${date}
-
-> Auto-generated by @screenpipe/sync
-> Analyzed ${summary.rawMinutes} minutes of screen activity
-
-## \uD83D\uDCF1 Apps Used
-${appList}
-
-## \u2705 Todos Extracted
-${formatList(todos)}
-
-## \uD83C\uDFAF Goals Mentioned
-${formatList(goals)}
-
-## \uD83D\uDD00 Decisions Made
-${formatList(decisions)}
-
-## \uD83D\uDCBB Key Activities
-${formatList(activities)}
-
-## \uD83D\uDC65 Meetings & Conversations
-${formatList(meetings)}
-
-## \uD83D\uDEA7 Blockers & Problems
-${formatList(blockers)}
-
-## \uD83D\uDCA1 AI Insights
-${formatList(insights)}
-
----
-_Generated at ${new Date().toISOString()}_
-`;
-}
-async function writeOutput(content, config, filename) {
- if (!config.outputDir) {
- console.log(content);
- return;
- }
- const fs = await import("fs/promises");
- const path = await import("path");
- const dir = path.resolve(config.outputDir);
- await fs.mkdir(dir, { recursive: true });
- const filepath = path.join(dir, filename);
- await fs.writeFile(filepath, content);
- console.error(`[ok] Written to ${filepath}`);
- if (config.gitPush) {
- const { execSync: execSync2 } = await import("child_process");
- try {
- execSync2(`cd "${dir}" && git add -A && git commit -m "sync: ${filename}" && git push`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- console.error(`[ok] Git pushed`);
- } catch (e) {
- console.error(`[warn] Git push failed - maybe no changes?`);
- }
- }
- if (config.remote) {
- const { execSync: execSync2 } = await import("child_process");
- try {
- execSync2(`scp "${filepath}" "${config.remote}/"`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- console.error(`[ok] Synced to ${config.remote}`);
- } catch (e) {
- console.error(`[error] Remote sync failed: ${e}`);
- }
- }
-}
-async function setupDaemon(config) {
- const fs = await import("fs/promises");
- const { execSync: execSync2 } = await import("child_process");
- const os = await import("os");
- const path = await import("path");
- const home = os.homedir();
- const platform = os.platform();
- if (!config.remote && !config.outputDir) {
- console.error(`[error] --daemon requires --remote or --output`);
- console.error(` Example: bunx @screenpipe/sync --daemon -r user@host:~/.screenpipe/`);
- process.exit(1);
- }
- const remotePart = config.remote ? `--remote ${config.remote}` : "";
- const outputPart = config.outputDir ? `--output ${config.outputDir}` : "";
- const gitPart = config.gitPush ? "--git" : "";
- if (platform === "darwin") {
- const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>com.screenpipe.sync</string>
- <key>ProgramArguments</key>
- <array>
- <string>/bin/bash</string>
- <string>-c</string>
- <string>export PATH="$HOME/.bun/bin:/usr/local/bin:/opt/homebrew/bin:$PATH" &amp;&amp; bunx @screenpipe/sync --db ${remotePart} ${outputPart} ${gitPart}</string>
- </array>
- <key>StartInterval</key>
- <integer>${config.daemonInterval}</integer>
- <key>RunAtLoad</key>
- <true/>
- <key>StandardOutPath</key>
- <string>/tmp/screenpipe-sync.log</string>
- <key>StandardErrorPath</key>
- <string>/tmp/screenpipe-sync.err</string>
- <key>EnvironmentVariables</key>
- <dict>
- <key>HOME</key>
- <string>${home}</string>
- </dict>
-</dict>
-</plist>`;
- await fs.mkdir(path.dirname(plistPath), { recursive: true });
- await fs.writeFile(plistPath, plist);
- try {
- execSync2(`launchctl unload "${plistPath}" 2>/dev/null || true`);
- execSync2(`launchctl load "${plistPath}"`);
- } catch (e) {
- console.error(`[error] Failed to load LaunchAgent: ${e}`);
- process.exit(1);
- }
- console.log(`[ok] Daemon installed (macOS LaunchAgent)`);
- console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
- console.log(` Logs: /tmp/screenpipe-sync.log`);
- console.log(` Stop: bunx @screenpipe/sync --stop`);
- } else if (platform === "linux") {
- const serviceDir = path.join(home, ".config/systemd/user");
- const servicePath = path.join(serviceDir, "screenpipe-sync.service");
- const timerPath = path.join(serviceDir, "screenpipe-sync.timer");
- const service = `[Unit]
-Description=Screenpipe Sync
-
-[Service]
-Type=oneshot
-ExecStart=/bin/bash -c 'export PATH="$HOME/.bun/bin:$PATH" && bunx @screenpipe/sync --db ${remotePart} ${outputPart} ${gitPart}'
-Environment=HOME=${home}
-
-[Install]
-WantedBy=default.target`;
- const timer = `[Unit]
-Description=Screenpipe Sync Timer
-
-[Timer]
-OnBootSec=60
-OnUnitActiveSec=${config.daemonInterval}s
-Persistent=true
-
-[Install]
-WantedBy=timers.target`;
- await fs.mkdir(serviceDir, { recursive: true });
- await fs.writeFile(servicePath, service);
- await fs.writeFile(timerPath, timer);
- try {
- execSync2("systemctl --user daemon-reload");
- execSync2("systemctl --user enable --now screenpipe-sync.timer");
- } catch (e) {
- console.error(`[error] Failed to enable systemd timer: ${e}`);
- process.exit(1);
- }
- console.log(`[ok] Daemon installed (systemd user timer)`);
- console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
- console.log(` Status: systemctl --user status screenpipe-sync.timer`);
- console.log(` Stop: bunx @screenpipe/sync --stop`);
- } else {
- console.error(`[error] Daemon not supported on ${platform}`);
- console.error(` Use cron instead: */60 * * * * bunx @screenpipe/sync --db ${remotePart}`);
- process.exit(1);
- }
-}
-async function stopDaemon() {
- const { execSync: execSync2 } = await import("child_process");
- const os = await import("os");
- const fs = await import("fs/promises");
- const path = await import("path");
- const home = os.homedir();
- const platform = os.platform();
- if (platform === "darwin") {
- const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
- try {
- execSync2(`launchctl unload "${plistPath}" 2>/dev/null`);
- await fs.unlink(plistPath);
- console.log(`[ok] Daemon stopped and removed`);
- } catch {
- console.log(`[ok] Daemon was not running`);
- }
- } else if (platform === "linux") {
- try {
- execSync2("systemctl --user disable --now screenpipe-sync.timer 2>/dev/null");
- console.log(`[ok] Daemon stopped and disabled`);
- } catch {
- console.log(`[ok] Daemon was not running`);
- }
- }
-}
-async function syncDatabase(config) {
- const fs = await import("fs/promises");
- const { execSync: execSync2 } = await import("child_process");
- try {
- await fs.access(config.dbPath);
- } catch {
- console.error(`[error] Database not found at ${config.dbPath}`);
- console.error(` Set --db-path or SCREENPIPE_DB environment variable`);
- process.exit(1);
- }
- const stats = await fs.stat(config.dbPath);
- const sizeMB = (stats.size / 1024 / 1024).toFixed(1);
- console.error(`[db] Found database: ${config.dbPath} (${sizeMB} MB)`);
- if (!config.remote && !config.outputDir) {
- console.error(`[error] --db requires --remote or --output to specify destination`);
- process.exit(1);
- }
- if (config.outputDir) {
- const path = await import("path");
- const destDir = path.resolve(config.outputDir);
- await fs.mkdir(destDir, { recursive: true });
- const destPath = path.join(destDir, "db.sqlite");
- console.error(`[db] Copying to ${destPath}...`);
- await fs.copyFile(config.dbPath, destPath);
- try {
- await fs.copyFile(`${config.dbPath}-wal`, `${destPath}-wal`);
- await fs.copyFile(`${config.dbPath}-shm`, `${destPath}-shm`);
- } catch {}
- console.error(`[ok] Database copied to ${destPath}`);
- if (config.gitPush) {
- try {
- execSync2(`cd "${destDir}" && git add -A && git commit -m "db sync $(date +%Y-%m-%d)" && git push`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- console.error(`[ok] Git pushed`);
- } catch {
- console.error(`[warn] Git push failed - maybe no changes?`);
- }
- }
- }
- if (config.remote) {
- console.error(`[db] Syncing to ${config.remote}...`);
- try {
- execSync2(`rsync -avz --progress "${config.dbPath}" "${config.remote}/db.sqlite"`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- console.error(`[ok] Database synced to ${config.remote}`);
- } catch {
- try {
- execSync2(`scp "${config.dbPath}" "${config.remote}/db.sqlite"`, {
- stdio: config.verbose ? "inherit" : "pipe"
- });
- console.error(`[ok] Database copied to ${config.remote}`);
- } catch (e) {
- console.error(`[error] Failed to sync database: ${e}`);
- process.exit(1);
- }
- }
- }
- console.error(`[done] Database sync complete`);
-}
-async function main() {
- const config = parseArgs();
- const today = new Date().toISOString().split("T")[0];
- if (config.daemonStop) {
- await stopDaemon();
- return;
- }
- if (config.daemon) {
- await setupDaemon(config);
- return;
- }
- if (config.dbSync) {
- await syncDatabase(config);
- return;
- }
- console.error(`[screenpipe-sync] Analyzing last ${config.hours} hours...`);
- const results = await queryScreenpipe(config);
- console.error(`[ok] Retrieved ${results.length} screen captures`);
- if (results.length === 0) {
- console.error("[warn] No screen data found. Is Screenpipe running?");
- process.exit(0);
- }
- const { byApp, timeline } = processResults(results);
- console.error(`[ok] Processed ${Object.keys(byApp).length} apps`);
- const appMinutes = {};
- for (const app of Object.keys(byApp)) {
- appMinutes[app] = Math.round(byApp[app].length * 5 / 60);
- }
- console.error(`[ai] Extracting todos, goals, decisions...`);
- const extracted = await extractWithAI(byApp, config);
- const summary = {
- date: today,
- apps: appMinutes,
- todos: extracted.todos || [],
- goals: extracted.goals || [],
- decisions: extracted.decisions || [],
- activities: extracted.activities || [],
- meetings: extracted.meetings || [],
- blockers: extracted.blockers || [],
- insights: extracted.insights || [],
- rawMinutes: Math.round(results.length * 5 / 60)
- };
- const filename = config.format === "json" ? `${today}.json` : `${today}.md`;
- const content = config.format === "json" ? JSON.stringify(summary, null, 2) : formatMarkdown(summary);
- await writeOutput(content, config, filename);
-}
-main().catch((e) => {
- console.error(`[fatal] ${e.message}`);
- process.exit(1);
-});
diff --git a/packages/sync/package.json b/packages/sync/package.json
deleted file mode 100644
index 11d0787f8..000000000
--- a/packages/sync/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "@screenpipe/sync",
- "version": "0.5.0",
- "description": "Sync Screenpipe activity to structured daily summaries. Uses Claude Code CLI for AI extraction.",
- "type": "module",
- "bin": {
- "screenpipe-sync": "dist/index.js"
- },
- "scripts": {
- "build": "bun build src/index.ts --outdir dist --target node",
- "dev": "bun run src/index.ts",
- "prepublishOnly": "bun run build"
- },
- "keywords": [
- "screenpipe",
- "productivity",
- "ai",
- "screen-recording",
- "daily-summary",
- "claude-code",
- "context-sync"
- ],
- "author": "Louis Beaumont <[email protected]>",
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "https://github.com/screenpipe/screenpipe",
- "directory": "packages/sync"
- },
- "devDependencies": {
- "@types/bun": "latest",
- "typescript": "^5.0.0"
- }
-}
diff --git a/packages/sync/src/index.ts b/packages/sync/src/index.ts
deleted file mode 100644
index 40fd5815b..000000000
--- a/packages/sync/src/index.ts
+++ /dev/null
@@ -1,768 +0,0 @@
-#!/usr/bin/env bun
-/**
- * @screenpipe/sync - Daily context sync from Screenpipe
- *
- * Usage:
- * bunx @screenpipe/sync # Summary to stdout
- * bunx @screenpipe/sync --output ~/notes # Save to folder
- * bunx @screenpipe/sync --hours 8 # Last 8 hours
- * bunx @screenpipe/sync --git # Auto commit & push
- * bunx @screenpipe/sync --remote host:path # Sync to remote
- */
-
-import { execSync } from "child_process";
-
-// ============================================================================
-// Types
-// ============================================================================
-
-interface ScreenpipeResult {
- type: "OCR" | "Audio";
- content: {
- text: string;
- timestamp: string;
- app_name?: string;
- window_name?: string;
- };
-}
-
-interface DailySummary {
- date: string;
- apps: Record<string, number>;
- todos: string[];
- goals: string[];
- decisions: string[];
- activities: string[];
- meetings: string[];
- blockers: string[];
- insights: string[];
- rawMinutes: number;
-}
-
-interface Config {
- screenpipeUrl: string;
- outputDir: string | null;
- hours: number;
- gitPush: boolean;
- remote: string | null;
- format: "markdown" | "json";
- verbose: boolean;
- dbSync: boolean;
- dbPath: string;
- daemon: boolean;
- daemonInterval: number;
- daemonStop: boolean;
-}
-
-// ============================================================================
-// CLI Parsing
-// ============================================================================
-
-function parseArgs(): Config {
- const args = process.argv.slice(2);
- const home = process.env.HOME || process.env.USERPROFILE || "~";
- const config: Config = {
- screenpipeUrl: process.env.SCREENPIPE_URL || "http://localhost:3030",
- outputDir: null,
- hours: 12,
- gitPush: false,
- remote: null,
- format: "markdown",
- verbose: false,
- dbSync: false,
- dbPath: process.env.SCREENPIPE_DB || `${home}/.screenpipe/db.sqlite`,
- daemon: false,
- daemonInterval: 3600,
- daemonStop: false,
- };
-
- for (let i = 0; i < args.length; i++) {
- const arg = args[i];
- switch (arg) {
- case "--output":
- case "-o":
- config.outputDir = args[++i];
- break;
- case "--hours":
- case "-h":
- config.hours = parseInt(args[++i]) || 12;
- break;
- case "--git":
- case "-g":
- config.gitPush = true;
- break;
- case "--remote":
- case "-r":
- config.remote = args[++i];
- break;
- case "--json":
- config.format = "json";
- break;
- case "--verbose":
- case "-v":
- config.verbose = true;
- break;
- case "--db":
- case "--db-sync":
- config.dbSync = true;
- break;
- case "--db-path":
- config.dbPath = args[++i];
- break;
- case "--daemon":
- case "-d":
- config.daemon = true;
- config.dbSync = true; // daemon mode always syncs DB
- break;
- case "--interval":
- config.daemonInterval = parseInt(args[++i]) || 3600;
- break;
- case "--stop":
- config.daemonStop = true;
- break;
- case "--help":
- printHelp();
- process.exit(0);
- }
- }
-
- return config;
-}
-
-function printHelp() {
- console.log(`
-screenpipe-sync - Extract daily context from Screenpipe
-
-USAGE:
- bunx @screenpipe/sync [options]
-
-MODES:
- Summary mode (default): AI-powered daily summary extraction
- DB sync mode (--db): Copy raw SQLite database to remote
-
-OPTIONS:
- -o, --output <dir> Save summary to directory (default: stdout)
- -h, --hours <n> Hours of history to analyze (default: 12)
- -g, --git Auto commit and push after writing
- -r, --remote <host> Sync to remote via SSH (user@host:path)
- --json Output as JSON instead of markdown
- -v, --verbose Show debug output
-
- --db, --db-sync Sync raw SQLite database instead of summary
- --db-path <path> Path to Screenpipe DB (default: ~/.screenpipe/db.sqlite)
-
- -d, --daemon Install persistent background sync (survives reboot)
- --interval <secs> Sync interval in seconds (default: 3600 = 1 hour)
- --stop Stop and remove the daemon
-
-ENVIRONMENT:
- SCREENPIPE_URL Screenpipe API URL (default: http://localhost:3030)
- SCREENPIPE_DB Path to Screenpipe database
-
-AI SUMMARIZATION:
- Uses Claude Code CLI if available (claude --print)
- Falls back to structured extraction if no AI CLI found
-
-EXAMPLES:
- # AI summary to stdout
- bunx @screenpipe/sync
-
- # Save daily summaries locally
- bunx @screenpipe/sync --output ~/Documents/brain/context --git
-
- # Sync raw database to remote (e.g., OpenClaw)
- bunx @screenpipe/sync --db --remote user@openclaw:~/.screenpipe/
-
- # Full sync: DB + daily summary
- bunx @screenpipe/sync --db -r openclaw:~/.screenpipe && bunx @screenpipe/sync -o ~/context -g
-
- # ONE-LINER: Permanent background sync (survives reboot)
- bunx @screenpipe/sync --daemon --remote user@server:~/.screenpipe/
-
- # Stop the daemon
- bunx @screenpipe/sync --stop
-
-OUTPUT (summary mode):
- - Todo items extracted from screen content
- - Goals and intentions mentioned
- - Decisions made
- - Key activities by app
- - Meetings and conversations
- - Blockers and problems
- - AI-generated insights
-
-OUTPUT (db mode):
- - Copies ~/.screenpipe/db.sqlite to remote
- - Remote can query SQLite directly for full history
-`);
-}
-
-// ============================================================================
-// Screenpipe API
-// ============================================================================
-
-async function queryScreenpipe(
- config: Config
-): Promise<ScreenpipeResult[]> {
- const startTime = new Date(Date.now() - config.hours * 60 * 60 * 1000);
- const url = new URL(`${config.screenpipeUrl}/search`);
- url.searchParams.set("content_type", "ocr");
- url.searchParams.set("limit", "500");
- url.searchParams.set("start_time", startTime.toISOString());
-
- if (config.verbose) {
- console.error(`[screenpipe] Querying: ${url}`);
- }
-
- try {
- const res = await fetch(url.toString());
- if (!res.ok) {
- throw new Error(`Screenpipe API error: ${res.status}`);
- }
- const data = await res.json();
- return data.data || [];
- } catch (e) {
- console.error(`[error] Failed to connect to Screenpipe at ${config.screenpipeUrl}`);
- console.error(` Make sure Screenpipe is running.`);
- process.exit(1);
- }
-}
-
-// ============================================================================
-// Data Processing
-// ============================================================================
-
-function processResults(results: ScreenpipeResult[]): {
- byApp: Record<string, string[]>;
- timeline: { time: string; app: string; text: string }[];
-} {
- const byApp: Record<string, string[]> = {};
- const timeline: { time: string; app: string; text: string }[] = [];
- const seen = new Set<string>();
-
- for (const r of results) {
- if (r.type !== "OCR") continue;
- const text = r.content.text?.trim();
- if (!text || text.length < 20) continue;
-
- // Dedupe similar content
- const hash = text.slice(0, 100);
- if (seen.has(hash)) continue;
- seen.add(hash);
-
- const app = r.content.app_name || "Unknown";
- byApp[app] = byApp[app] || [];
- byApp[app].push(text);
-
- timeline.push({
- time: r.content.timestamp,
- app,
- text: text.slice(0, 500),
- });
- }
-
- return { byApp, timeline };
-}
-
-// ============================================================================
-// AI Extraction
-// ============================================================================
-
-const EXTRACTION_PROMPT = `You are analyzing screen capture data from a user's computer to create a structured daily summary.
-
-INPUT: Raw OCR text from screen captures, organized by app.
-
-OUTPUT: A structured extraction in this exact JSON format:
-{
- "todos": ["actionable items mentioned or visible on screen"],
- "goals": ["goals, objectives, intentions mentioned"],
- "decisions": ["decisions made or discussed"],
- "activities": ["key activities/tasks worked on"],
- "meetings": ["meetings, calls, conversations"],
- "blockers": ["problems, blockers, frustrations"],
- "insights": ["2-3 AI observations about the day's work patterns"]
-}
-
-RULES:
-- Extract ACTUAL content seen on screen, not generic statements
-- Todos should be actionable (start with verb)
-- Be specific: "Fix auth bug in login.ts" not "worked on code"
-- Deduplicate similar items
-- Max 10 items per category
-- If no relevant content for a category, use empty array
-- Insights should note patterns (context switching, focus blocks, late nights, etc.)
-
-Analyze this screen data:
-`;
-
-function hasClaudeCli(): boolean {
- try {
- execSync("which claude", { stdio: "pipe" });
- return true;
- } catch {
- return false;
- }
-}
-
-async function extractWithAI(
- byApp: Record<string, string[]>,
- config: Config
-): Promise<Partial<DailySummary>> {
- // Prepare condensed input (limit to avoid token explosion)
- const condensed = Object.entries(byApp)
- .map(([app, texts]) => {
- const sample = texts.slice(0, 20).join("\n---\n").slice(0, 3000);
- return `## ${app}\n${sample}`;
- })
- .join("\n\n")
- .slice(0, 15000);
-
- const prompt = EXTRACTION_PROMPT + condensed;
-
- // Use Claude Code CLI if available
- if (hasClaudeCli()) {
- if (config.verbose) console.error(`[ai] Using Claude Code CLI (${condensed.length} chars)`);
- try {
- // Write prompt to temp file to avoid shell escaping issues
- const fs = await import("fs/promises");
- const os = await import("os");
- const path = await import("path");
- const tmpFile = path.join(os.tmpdir(), `screenpipe-prompt-${Date.now()}.txt`);
- await fs.writeFile(tmpFile, prompt);
-
- const result = execSync(`claude --print < "${tmpFile}"`, {
- encoding: "utf-8",
- maxBuffer: 10 * 1024 * 1024,
- timeout: 120000, // 2 min timeout
- });
-
- await fs.unlink(tmpFile).catch(() => {});
-
- const jsonMatch = result.match(/\{[\s\S]*\}/);
- if (jsonMatch) {
- return JSON.parse(jsonMatch[0]);
- }
- } catch (e: any) {
- console.error(`[error] Claude CLI failed: ${e.message}`);
- }
- } else {
- if (config.verbose) console.error(`[ai] Claude CLI not found`);
- }
-
- // Fallback: structured extraction (no AI)
- console.error("[info] No AI CLI found - using structured extraction");
- console.error(" Install Claude Code CLI for AI summaries: npm install -g @anthropic-ai/claude-code");
-
- return {
- todos: [],
- goals: [],
- decisions: [],
- activities: Object.keys(byApp).slice(0, 10).map((app) => `Used ${app}`),
- meetings: [],
- blockers: [],
- insights: ["Structured extraction only - install Claude Code CLI for AI insights"],
- };
-}
-
-// ============================================================================
-// Output Formatting
-// ============================================================================
-
-function formatMarkdown(summary: DailySummary): string {
- const { date, apps, todos, goals, decisions, activities, meetings, blockers, insights } = summary;
-
- const appList = Object.entries(apps)
- .sort((a, b) => b[1] - a[1])
- .slice(0, 10)
- .map(([app, mins]) => `- **${app}**: ~${mins} min`)
- .join("\n");
-
- const formatList = (items: string[]) =>
- items.length > 0 ? items.map((i) => `- ${i}`).join("\n") : "_None extracted_";
-
- return `# Daily Context - ${date}
-
-> Auto-generated by @screenpipe/sync
-> Analyzed ${summary.rawMinutes} minutes of screen activity
-
-## 📱 Apps Used
-${appList}
-
-## ✅ Todos Extracted
-${formatList(todos)}
-
-## 🎯 Goals Mentioned
-${formatList(goals)}
-
-## 🔀 Decisions Made
-${formatList(decisions)}
-
-## 💻 Key Activities
-${formatList(activities)}
-
-## 👥 Meetings & Conversations
-${formatList(meetings)}
-
-## 🚧 Blockers & Problems
-${formatList(blockers)}
-
-## 💡 AI Insights
-${formatList(insights)}
-
----
-_Generated at ${new Date().toISOString()}_
-`;
-}
-
-// ============================================================================
-// Output Handlers
-// ============================================================================
-
-async function writeOutput(content: string, config: Config, filename: string) {
- if (!config.outputDir) {
- console.log(content);
- return;
- }
-
- const fs = await import("fs/promises");
- const path = await import("path");
-
- const dir = path.resolve(config.outputDir);
- await fs.mkdir(dir, { recursive: true });
-
- const filepath = path.join(dir, filename);
- await fs.writeFile(filepath, content);
- console.error(`[ok] Written to ${filepath}`);
-
- if (config.gitPush) {
- const { execSync } = await import("child_process");
- try {
- execSync(`cd "${dir}" && git add -A && git commit -m "sync: ${filename}" && git push`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- console.error(`[ok] Git pushed`);
- } catch (e) {
- console.error(`[warn] Git push failed - maybe no changes?`);
- }
- }
-
- if (config.remote) {
- const { execSync } = await import("child_process");
- try {
- execSync(`scp "${filepath}" "${config.remote}/"`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- console.error(`[ok] Synced to ${config.remote}`);
- } catch (e) {
- console.error(`[error] Remote sync failed: ${e}`);
- }
- }
-}
-
-// ============================================================================
-// Main
-// ============================================================================
-
-async function setupDaemon(config: Config) {
- const fs = await import("fs/promises");
- const { execSync } = await import("child_process");
- const os = await import("os");
- const path = await import("path");
-
- const home = os.homedir();
- const platform = os.platform();
-
- if (!config.remote && !config.outputDir) {
- console.error(`[error] --daemon requires --remote or --output`);
- console.error(` Example: bunx @screenpipe/sync --daemon -r user@host:~/.screenpipe/`);
- process.exit(1);
- }
-
- const remotePart = config.remote ? `--remote ${config.remote}` : "";
- const outputPart = config.outputDir ? `--output ${config.outputDir}` : "";
- const gitPart = config.gitPush ? "--git" : "";
-
- if (platform === "darwin") {
- // macOS: LaunchAgent
- const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>com.screenpipe.sync</string>
- <key>ProgramArguments</key>
- <array>
- <string>/bin/bash</string>
- <string>-c</string>
- <string>export PATH="$HOME/.bun/bin:/usr/local/bin:/opt/homebrew/bin:$PATH" &amp;&amp; bunx @screenpipe/sync --db ${remotePart} ${outputPart} ${gitPart}</string>
- </array>
- <key>StartInterval</key>
- <integer>${config.daemonInterval}</integer>
- <key>RunAtLoad</key>
- <true/>
- <key>StandardOutPath</key>
- <string>/tmp/screenpipe-sync.log</string>
- <key>StandardErrorPath</key>
- <string>/tmp/screenpipe-sync.err</string>
- <key>EnvironmentVariables</key>
- <dict>
- <key>HOME</key>
- <string>${home}</string>
- </dict>
-</dict>
-</plist>`;
-
- await fs.mkdir(path.dirname(plistPath), { recursive: true });
- await fs.writeFile(plistPath, plist);
-
- try {
- execSync(`launchctl unload "${plistPath}" 2>/dev/null || true`);
- execSync(`launchctl load "${plistPath}"`);
- } catch (e) {
- console.error(`[error] Failed to load LaunchAgent: ${e}`);
- process.exit(1);
- }
-
- console.log(`[ok] Daemon installed (macOS LaunchAgent)`);
- console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
- console.log(` Logs: /tmp/screenpipe-sync.log`);
- console.log(` Stop: bunx @screenpipe/sync --stop`);
-
- } else if (platform === "linux") {
- // Linux: systemd user service
- const serviceDir = path.join(home, ".config/systemd/user");
- const servicePath = path.join(serviceDir, "screenpipe-sync.service");
- const timerPath = path.join(serviceDir, "screenpipe-sync.timer");
-
- const service = `[Unit]
-Description=Screenpipe Sync
-
-[Service]
-Type=oneshot
-ExecStart=/bin/bash -c 'export PATH="$HOME/.bun/bin:$PATH" && bunx @screenpipe/sync --db ${remotePart} ${outputPart} ${gitPart}'
-Environment=HOME=${home}
-
-[Install]
-WantedBy=default.target`;
-
- const timer = `[Unit]
-Description=Screenpipe Sync Timer
-
-[Timer]
-OnBootSec=60
-OnUnitActiveSec=${config.daemonInterval}s
-Persistent=true
-
-[Install]
-WantedBy=timers.target`;
-
- await fs.mkdir(serviceDir, { recursive: true });
- await fs.writeFile(servicePath, service);
- await fs.writeFile(timerPath, timer);
-
- try {
- execSync("systemctl --user daemon-reload");
- execSync("systemctl --user enable --now screenpipe-sync.timer");
- } catch (e) {
- console.error(`[error] Failed to enable systemd timer: ${e}`);
- process.exit(1);
- }
-
- console.log(`[ok] Daemon installed (systemd user timer)`);
- console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
- console.log(` Status: systemctl --user status screenpipe-sync.timer`);
- console.log(` Stop: bunx @screenpipe/sync --stop`);
-
- } else {
- console.error(`[error] Daemon not supported on ${platform}`);
- console.error(` Use cron instead: */60 * * * * bunx @screenpipe/sync --db ${remotePart}`);
- process.exit(1);
- }
-}
-
-async function stopDaemon() {
- const { execSync } = await import("child_process");
- const os = await import("os");
- const fs = await import("fs/promises");
- const path = await import("path");
-
- const home = os.homedir();
- const platform = os.platform();
-
- if (platform === "darwin") {
- const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
- try {
- execSync(`launchctl unload "${plistPath}" 2>/dev/null`);
- await fs.unlink(plistPath);
- console.log(`[ok] Daemon stopped and removed`);
- } catch {
- console.log(`[ok] Daemon was not running`);
- }
- } else if (platform === "linux") {
- try {
- execSync("systemctl --user disable --now screenpipe-sync.timer 2>/dev/null");
- console.log(`[ok] Daemon stopped and disabled`);
- } catch {
- console.log(`[ok] Daemon was not running`);
- }
- }
-}
-
-async function syncDatabase(config: Config) {
- const fs = await import("fs/promises");
- const { execSync } = await import("child_process");
-
- // Check if DB exists
- try {
- await fs.access(config.dbPath);
- } catch {
- console.error(`[error] Database not found at ${config.dbPath}`);
- console.error(` Set --db-path or SCREENPIPE_DB environment variable`);
- process.exit(1);
- }
-
- const stats = await fs.stat(config.dbPath);
- const sizeMB = (stats.size / 1024 / 1024).toFixed(1);
- console.error(`[db] Found database: ${config.dbPath} (${sizeMB} MB)`);
-
- if (!config.remote && !config.outputDir) {
- console.error(`[error] --db requires --remote or --output to specify destination`);
- process.exit(1);
- }
-
- // Copy to local output dir
- if (config.outputDir) {
- const path = await import("path");
- const destDir = path.resolve(config.outputDir);
- await fs.mkdir(destDir, { recursive: true });
- const destPath = path.join(destDir, "db.sqlite");
-
- console.error(`[db] Copying to ${destPath}...`);
- await fs.copyFile(config.dbPath, destPath);
-
- // Also copy WAL files if they exist (for consistency)
- try {
- await fs.copyFile(`${config.dbPath}-wal`, `${destPath}-wal`);
- await fs.copyFile(`${config.dbPath}-shm`, `${destPath}-shm`);
- } catch {
- // WAL files may not exist, that's ok
- }
-
- console.error(`[ok] Database copied to ${destPath}`);
-
- if (config.gitPush) {
- try {
- execSync(`cd "${destDir}" && git add -A && git commit -m "db sync $(date +%Y-%m-%d)" && git push`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- console.error(`[ok] Git pushed`);
- } catch {
- console.error(`[warn] Git push failed - maybe no changes?`);
- }
- }
- }
-
- // Sync to remote
- if (config.remote) {
- console.error(`[db] Syncing to ${config.remote}...`);
- try {
- // Use rsync for efficiency (only transfers changes)
- execSync(`rsync -avz --progress "${config.dbPath}" "${config.remote}/db.sqlite"`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- console.error(`[ok] Database synced to ${config.remote}`);
- } catch {
- // Fallback to scp if rsync not available
- try {
- execSync(`scp "${config.dbPath}" "${config.remote}/db.sqlite"`, {
- stdio: config.verbose ? "inherit" : "pipe",
- });
- console.error(`[ok] Database copied to ${config.remote}`);
- } catch (e) {
- console.error(`[error] Failed to sync database: ${e}`);
- process.exit(1);
- }
- }
- }
-
- console.error(`[done] Database sync complete`);
-}
-
-async function main() {
- const config = parseArgs();
- const today = new Date().toISOString().split("T")[0];
-
- // Stop daemon
- if (config.daemonStop) {
- await stopDaemon();
- return;
- }
-
- // Daemon mode - install persistent sync
- if (config.daemon) {
- await setupDaemon(config);
- return;
- }
-
- // DB sync mode
- if (config.dbSync) {
- await syncDatabase(config);
- return;
- }
-
- console.error(`[screenpipe-sync] Analyzing last ${config.hours} hours...`);
-
- // 1. Query Screenpipe
- const results = await queryScreenpipe(config);
- console.error(`[ok] Retrieved ${results.length} screen captures`);
-
- if (results.length === 0) {
- console.error("[warn] No screen data found. Is Screenpipe running?");
- process.exit(0);
- }
-
- // 2. Process results
- const { byApp, timeline } = processResults(results);
- console.error(`[ok] Processed ${Object.keys(byApp).length} apps`);
-
- // 3. Calculate app usage (rough estimate: each capture ≈ 5 seconds)
- const appMinutes: Record<string, number> = {};
- for (const app of Object.keys(byApp)) {
- appMinutes[app] = Math.round((byApp[app].length * 5) / 60);
- }
-
- // 4. AI extraction
- console.error(`[ai] Extracting todos, goals, decisions...`);
- const extracted = await extractWithAI(byApp, config);
-
- // 5. Build summary
- const summary: DailySummary = {
- date: today,
- apps: appMinutes,
- todos: extracted.todos || [],
- goals: extracted.goals || [],
- decisions: extracted.decisions || [],
- activities: extracted.activities || [],
- meetings: extracted.meetings || [],
- blockers: extracted.blockers || [],
- insights: extracted.insights || [],
- rawMinutes: Math.round((results.length * 5) / 60),
- };
-
- // 6. Output
- const filename =
- config.format === "json" ? `${today}.json` : `${today}.md`;
-
- const content =
- config.format === "json"
- ? JSON.stringify(summary, null, 2)
- : formatMarkdown(summary);
-
- await writeOutput(content, config, filename);
-}
-
-main().catch((e) => {
- console.error(`[fatal] ${e.message}`);
- process.exit(1);
-});
diff --git a/packages/sync/tsconfig.json b/packages/sync/tsconfig.json
deleted file mode 100644
index 021397787..000000000
--- a/packages/sync/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2022",
- "module": "ESNext",
- "moduleResolution": "bundler",
- "esModuleInterop": true,
- "strict": true,
- "skipLibCheck": true,
- "outDir": "dist",
- "declaration": true,
- "types": ["bun-types"]
- },
- "include": ["src/**/*"]
-}