@clipy/cli 0.9.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,10 +13,13 @@ plus a [web recorder](https://clipy.online/screen-recorder)) that gives every
13
13
  recording an instant share link, an AI transcript and summary, and
14
14
  [agent-readable context](https://clipy.online/for-agents) — so both humans and AI
15
15
  agents can act on what was recorded. This package is its terminal client.
16
+ The canonical agent operating contract is
17
+ [clipy.online/agents.md](https://clipy.online/agents.md).
16
18
 
17
19
  The read commands are **read-only** with any key. The write commands —
18
- [`record`](#record), the `session`/`mark` flow, and `transcript --replace` — create
19
- recordings or replace a transcript, and work only with an `ingest`-scoped key.
20
+ [`proof`](#proof-from-any-agent-tool), [`record`](#record), the `session`/`mark`
21
+ flow, and `transcript --replace` — create recordings or replace a transcript,
22
+ and work only with an `ingest`-scoped key.
20
23
 
21
24
  ```bash
22
25
  npx @clipy/cli agents install claude # browser-approve login + install the Clipy skill
@@ -57,6 +60,8 @@ to ferry by hand. Without a TTY at all (scripts, CI), use `CLIPY_API_KEY` or
57
60
 
58
61
  ```text
59
62
  clipy list [-n 20] [--page 2] [--status ready,processing] [--json]
63
+ clipy memory search <query> [--kind recording|context] [--json]
64
+ # hybrid search across recordings + imported context
60
65
  clipy search <query> # full-text search titles + descriptions
61
66
  clipy show <id|share-url> # metadata + share link
62
67
  clipy transcript <id> [--marks-only] # one entry per line, timestamped (--srt/--vtt to export)
@@ -68,6 +73,8 @@ clipy context read <bundle-path> # print a local bundle's recording.md
68
73
  clipy download <id> [-o out.mp4] # download the MP4
69
74
  clipy open <id> # open the share page in your browser
70
75
  clipy wait <id> --for both # block until transcript/summary are ready
76
+ clipy proof --frame before.png --frame after.png # screenshots → proof video
77
+ clipy proof --video verification.webm # upload a tool-native recording
71
78
  clipy record --url <app> [--for 15] # record a web app headlessly → a Clipy recording
72
79
  clipy session start --url <app> # start recording in the background while you work
73
80
  clipy mark "reproduced the bug" # drop a live-timestamped note into the session
@@ -83,6 +90,23 @@ clipy mcp # run the Clipy MCP server (npx -y @clipy/m
83
90
  Every recording-reading command accepts either the bare public id (`3kelcef8wo8h`) or the
84
91
  full share URL (`https://clipy.online/video/3kelcef8wo8h`).
85
92
 
93
+ ## Search all Clipy memory
94
+
95
+ `clipy memory search` uses the same hybrid semantic + keyword search as MCP
96
+ `search_memory`, across the owner's recordings and imported/watched context:
97
+
98
+ ```bash
99
+ clipy memory search "authentication flow" --json
100
+ clipy memory search "checkout error" --kind recording --limit 10
101
+ ```
102
+
103
+ Each result identifies its `kind`, title, timestamp or span, `resolution`, plain-text
104
+ snippet, and deep link. Inspect `semantic.status` before treating an empty result as
105
+ conclusive: `unavailable` or `failed` means the semantic index did not run and results
106
+ are keyword-only. `lexical`/`refined` are exact moments, `window` is a span to inspect,
107
+ and `document` has no exact timestamp. `clipy search` remains the legacy
108
+ recording-library search.
109
+
86
110
  ## Import any video as context
87
111
 
88
112
  `clipy context import` turns a YouTube URL or a local video file into an agent-readable
@@ -110,6 +134,38 @@ Synced documents are readable through the context-document API and the `list_con
110
134
  / `get_context_document` / `read_context_document` MCP tools. An imported transcript is
111
135
  untrusted content, exactly like a recording's.
112
136
 
137
+ ## Proof from any agent tool
138
+
139
+ `clipy proof` is the dependency-light handoff for coding agents. The agent keeps
140
+ using whatever browser, computer-use, simulator, or test tool it already has;
141
+ Clipy only assembles and uploads the evidence.
142
+
143
+ Turn saved screenshots into one short proof video:
144
+
145
+ ```bash
146
+ clipy proof \
147
+ --frame /tmp/01-before.png --caption "Before: Save is disabled" \
148
+ --frame /tmp/02-after.png --caption "After: Save is enabled" \
149
+ --frame /tmp/03-reload.png --caption "Reload: the value persists" \
150
+ --hold 3 --title "Settings fix proof" --type bug --wait --json
151
+ ```
152
+
153
+ Or upload an existing recording without re-encoding:
154
+
155
+ ```bash
156
+ clipy proof --video /tmp/verification.webm \
157
+ --note "0: opened settings" --note "6: saved successfully" \
158
+ --title "Settings fix proof" --type bug --wait --json
159
+ ```
160
+
161
+ Frame mode accepts PNG, JPEG, or WebP (up to 50 frames, 5 minutes, 50 MiB per
162
+ image, and 250 MiB total), and requires ffmpeg to create the silent WebM.
163
+ `--width`/`--height` must be even integers from 320–3840. Video mode accepts
164
+ WebM or MP4 and does not require Playwright, Browser Use, Open Browser Use, or
165
+ any other browser automation dependency. Captions and notes become timestamped
166
+ agent narration; they are attestations from the driving agent, not claims
167
+ independently verified by Clipy.
168
+
113
169
  ## Record
114
170
 
115
171
  `clipy record` captures a web app in a **headless** browser and uploads it as a Clipy
@@ -529,7 +585,7 @@ window, so switching tabs mid-recording changes what's filmed without changing t
529
585
 
530
586
  ## Scripting
531
587
 
532
- Every command has machine-readable output. `--json` is supported on **`list`, `search`,
588
+ Every command has machine-readable output. `--json` is supported on **`list`, `memory search`, `search`,
533
589
  `show`, `transcript`, `summary`, `moments`, `wait`, `record`, `session start/stop/status`,
534
590
  `mark`, `chapter`, `doctor`, and `playwright-path`** — stdout is the JSON payload, stderr is progress
535
591
  and hints, and errors exit non-zero with a message on stderr prefixed `error:`. For the
@@ -490,6 +490,7 @@ async function sync(compiled, opts, bundlePath) {
490
490
  documentId: typeof body.id === "string" ? body.id : "",
491
491
  publicId: typeof body.publicId === "string" ? body.publicId : "",
492
492
  created: body.created !== false,
493
+ refreshed: body.refreshed === true,
493
494
  folderName: typeof body.folderName === "string" ? body.folderName : null,
494
495
  classification: parseClassification(body.classification, compiled.manifest.durationMs),
495
496
  };
@@ -597,7 +598,9 @@ export async function cmdContextImport(target, opts) {
597
598
  // Phase 1: the transcript bundle goes up, the verdict comes back.
598
599
  synced = await sync(compiled, opts, bundlePath);
599
600
  const classification = synced.classification;
600
- notify(`Synced ✓ — ${synced.publicId} (private${synced.folderName ? `, filed in ${synced.folderName}` : ""}).`);
601
+ notify(synced.refreshed
602
+ ? `Already in your Knowledge Base — refreshed ✓ — ${synced.publicId} (private${synced.folderName ? `, still filed in ${synced.folderName}` : ""}).`
603
+ : `Synced ✓ — ${synced.publicId} (private${synced.folderName ? `, filed in ${synced.folderName}` : ""}).`);
601
604
  if (classification) {
602
605
  const wanted = classification.frameTimestampsMs.length;
603
606
  const needs = classification.needsVisual && wanted > 0;
@@ -710,7 +713,11 @@ export async function cmdContextImport(target, opts) {
710
713
  recommendedProfile: report?.recommendedProfile ?? null,
711
714
  overallScore: report?.overallScore ?? null,
712
715
  gapCount: report?.gaps.length ?? 0,
713
- ...(synced ? { synced: true, publicId: synced.publicId } : opts.sync ? { synced: false } : {}),
716
+ ...(synced
717
+ ? { synced: true, publicId: synced.publicId, refreshed: synced.refreshed }
718
+ : opts.sync
719
+ ? { synced: false }
720
+ : {}),
714
721
  ...(synced?.folderName ? { folderName: synced.folderName } : {}),
715
722
  classification: synced?.classification ?? null,
716
723
  frames: uploadedFrames.length,
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ import { cmdContextImport } from "./context/importCmd.js";
31
31
  import { cmdContextRead } from "./context/readCmd.js";
32
32
  import { errorEnvelope } from "./context/errors.js";
33
33
  import { supportsWebp } from "./context/ffmpeg.js";
34
+ import { renderProofFrames } from "./proofFrames.js";
34
35
  import { BridgeUnavailableError, bridgeRequest, inspectBridge, listSources, readBridgeInfo, resolveCaptureSource, windowLabel, probeSocketOpenable, probeBridgeHandshake, bridgeInfoFromFile, bridgeAppOutdated, MIN_BRIDGE_APP_VERSION, describeWindow, describeDisplay, } from "./macBridge.js";
35
36
  // Exit quietly when stdout/stderr close early (e.g. `clipy list | head`).
36
37
  for (const stream of [process.stdout, process.stderr]) {
@@ -287,6 +288,10 @@ ${c.bold("AUTH")}
287
288
  ${c.bold("RECORDINGS")}
288
289
  list [-n <N>] [--page <P>] [--status <s,…>] [--json]
289
290
  List your recordings (newest first)
291
+ memory search <query> [--kind recording|context] [--limit N] [--json]
292
+ Hybrid semantic + keyword search across your
293
+ recordings AND imported/watched context;
294
+ returns exact moments and deep links
290
295
  search <query> [--json] Full-text search titles + descriptions
291
296
  show <id|url> [--json] One recording's metadata + share link
292
297
  transcript <id> [--marks-only] [--srt|--vtt|--json]
@@ -318,6 +323,19 @@ ${c.bold("RECORDINGS")}
318
323
  wait <id> [--for transcript|summary|both] [--timeout <sec>]
319
324
  Block until processing artifacts are ready
320
325
 
326
+ ${c.bold("PROOF")} ${c.dim("(tool-neutral evidence; needs an ingest-scoped API key)")}
327
+ proof --frame <png|jpg|webp> [--frame <image> ...]
328
+ Turn screenshots from ANY agent/browser tool
329
+ into one short proof video and upload it
330
+ --caption <text> Caption each frame in order (repeat once per --frame);
331
+ captions become timestamped agent narration
332
+ --hold <sec> Seconds to show each frame (default 3; 0.25–30)
333
+ --width/--height Even output dimensions, 320–3840 (default 1280×720)
334
+ proof --video <webm|mp4> Upload a video the agent/tool already recorded
335
+ --title/--description/--type/--note/--wait/--json
336
+ Same metadata, narration, processing wait, and JSON result
337
+ contract as record; no browser automation dependency
338
+
321
339
  ${c.bold("RECORD")} ${c.dim("(needs an API key with the \"ingest\" permission)")}
322
340
  record --url <http(s) url> [--for <sec>] [--title <t>] [--wait]
323
341
  Capture a web app headlessly and upload it as
@@ -428,7 +446,7 @@ ${c.bold("GLOBAL FLAGS")}
428
446
  --key <key> API key for this invocation (else CLIPY_API_KEY, else stored login)
429
447
  --api-url <url> API base (else CLIPY_API_URL, default https://clipy.online)
430
448
  --json Machine-readable output. Supported on: list, search, show,
431
- transcript, summary, moments, wait, record, session
449
+ transcript, summary, moments, wait, proof, record, session
432
450
  start/stop/status, mark, chapter, doctor, playwright-path
433
451
  -v, --version Print version
434
452
 
@@ -447,7 +465,7 @@ ${c.bold("SETUP")}
447
465
  1. ${c.bold("clipy login")} approve this device in your browser
448
466
  2. ${c.bold("clipy list")} (or: ${c.bold("clipy agents install claude")} to wire up a coding agent)
449
467
 
450
- Write commands — ${c.bold("record")}, ${c.bold("session")}/${c.bold("mark")}, and ${c.bold("transcript --replace")} — need a key
468
+ Write commands — ${c.bold("proof")}, ${c.bold("record")}, ${c.bold("session")}/${c.bold("mark")}, and ${c.bold("transcript --replace")} — need a key
451
469
  with the "ingest" permission. Everything else is read-only.
452
470
  `;
453
471
  async function cmdLogin(ctx, opts) {
@@ -603,6 +621,48 @@ async function cmdList(ctx, opts) {
603
621
  process.stdout.write(c.dim(`page ${pg.page ?? opts.page}/${pg.totalPages ?? "?"} of ${pg.total} recordings — use --page/${"-n"} for more\n`));
604
622
  }
605
623
  }
624
+ async function cmdMemorySearch(ctx, opts) {
625
+ const validKinds = new Set(["recording", "context"]);
626
+ const kinds = opts.kinds.flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
627
+ const invalidKinds = kinds.filter((kind) => !validKinds.has(kind));
628
+ if (invalidKinds.length > 0) {
629
+ die(`--kind must be recording or context (unknown: ${invalidKinds.join(", ")})`, 2);
630
+ }
631
+ const params = new URLSearchParams({ q: opts.query, limit: String(opts.limit) });
632
+ if (kinds.length > 0)
633
+ params.set("kinds", [...new Set(kinds)].join(","));
634
+ const body = await apiJson(ctx, `/api/v1/search?${params.toString()}`);
635
+ if (opts.json) {
636
+ printJson(body);
637
+ return;
638
+ }
639
+ const semantic = body.semantic;
640
+ const degraded = Boolean(body.degraded);
641
+ const results = (body.results ?? []);
642
+ const semanticStatus = semantic?.status ?? (degraded ? "unavailable" : "unknown");
643
+ process.stdout.write(`${c.dim(`semantic: ${semanticStatus}${degraded ? " (keyword-only fallback)" : ""} · ${results.length} result${results.length === 1 ? "" : "s"}`)}\n`);
644
+ if (results.length === 0) {
645
+ if (degraded) {
646
+ process.stdout.write(`${c.yellow("No keyword matches. Semantic search did not run; retry with more literal phrasing before concluding the memory is absent.")}\n`);
647
+ }
648
+ return;
649
+ }
650
+ for (const result of results) {
651
+ const startMs = typeof result.startMs === "number" ? result.startMs : null;
652
+ const endMs = typeof result.endMs === "number" ? result.endMs : null;
653
+ const resolution = result.resolution ?? "unknown";
654
+ const time = startMs == null
655
+ ? ""
656
+ : resolution === "window" && endMs != null
657
+ ? ` · ${fmtDuration(Math.floor(startMs / 1000))}–${fmtDuration(Math.floor(endMs / 1000))}`
658
+ : ` · ${fmtDuration(Math.floor(startMs / 1000))}`;
659
+ process.stdout.write(`\n${c.cyan(`[${result.kind ?? "result"}]`)} ${c.bold(result.title ?? "Untitled")}${c.dim(`${time} · ${resolution}`)}\n`);
660
+ if (result.snippet)
661
+ process.stdout.write(`${result.snippet}\n`);
662
+ if (result.url)
663
+ process.stdout.write(`${c.dim(result.url)}\n`);
664
+ }
665
+ }
606
666
  async function cmdShow(ctx, id, json) {
607
667
  const pid = encodeURIComponent(normalizeId(id, ctx));
608
668
  const body = await apiJson(ctx, `/api/v1/recordings/${pid}`);
@@ -1323,10 +1383,8 @@ async function cmdDoctor(ctx, json) {
1323
1383
  }
1324
1384
  }
1325
1385
  // ---------------------------------------------------------------------------
1326
- // record — the ONE write command. Drives a headless browser (Playwright),
1327
- // captures the page to WebM, and streams it through Clipy's raw-upload
1328
- // pipeline exactly like the web recorder does. Needs an API key with the
1329
- // `ingest` scope. Everything else in this CLI stays read-only.
1386
+ // Ingest write plumbing. `record`, session mode, and `proof` all stream media
1387
+ // through the same raw-upload contract. Needs an API key with `ingest` scope.
1330
1388
  // ---------------------------------------------------------------------------
1331
1389
  /**
1332
1390
  * POST JSON to an ingest endpoint with the API key. Retries transient failures
@@ -1391,7 +1449,7 @@ async function ingestPostJson(ctx, path, payload) {
1391
1449
  throw new Error(`request failed after retries (${path})`);
1392
1450
  }
1393
1451
  /** Upload one chunk as multipart/form-data, retrying transient 429/5xx. */
1394
- async function ingestPostChunk(ctx, recordingId, uploadToken, partNumber, bytes) {
1452
+ async function ingestPostChunk(ctx, recordingId, uploadToken, partNumber, bytes, container = "webm") {
1395
1453
  const key = requireKey(ctx);
1396
1454
  for (let attempt = 1; attempt <= 4; attempt++) {
1397
1455
  // Copy the window into a standalone ArrayBuffer: it satisfies BlobPart
@@ -1402,7 +1460,8 @@ async function ingestPostChunk(ctx, recordingId, uploadToken, partNumber, bytes)
1402
1460
  form.append("recordingId", recordingId);
1403
1461
  form.append("uploadToken", uploadToken);
1404
1462
  form.append("partNumber", String(partNumber));
1405
- form.append("file", new Blob([part], { type: "video/webm" }), `part-${partNumber}.webm`);
1463
+ const mime = container === "mp4" ? "video/mp4" : "video/webm";
1464
+ form.append("file", new Blob([part], { type: mime }), `part-${partNumber}.${container}`);
1406
1465
  const controller = new AbortController();
1407
1466
  const timer = setTimeout(() => controller.abort(), 120_000);
1408
1467
  let res;
@@ -1671,24 +1730,34 @@ function resolveNarrationNotes(parsed, passStartsMs) {
1671
1730
  return { startMs: Math.max(0, Math.round(n.startMs ?? 0)), text: n.text };
1672
1731
  });
1673
1732
  }
1674
- /** WebM/Matroska files start with the EBML magic. Refuse to upload anything
1675
- * else — a crashed Chromium can leave a zero-byte or garbage file behind. */
1676
- function validateWebmFile(videoPath) {
1677
- const size = statSync(videoPath).size;
1733
+ /** WebM/Matroska starts with EBML; MP4 carries an ftyp box at offset 4.
1734
+ * Refuse unknown/empty files before creating a server-side upload session. */
1735
+ function validateVideoFile(videoPath) {
1736
+ const stat = statSync(videoPath);
1737
+ if (!stat.isFile())
1738
+ throw new Error(`recording media is not a file: ${videoPath}`);
1739
+ const size = stat.size;
1678
1740
  if (size === 0)
1679
1741
  throw new Error("recording produced an empty file");
1680
1742
  const fd = openSync(videoPath, "r");
1681
1743
  try {
1682
- const head = Buffer.alloc(4);
1683
- readSync(fd, head, 0, 4, 0);
1684
- if (!(head[0] === 0x1a && head[1] === 0x45 && head[2] === 0xdf && head[3] === 0xa3)) {
1685
- throw new Error("recording file is not valid WebM (corrupt capture?)");
1744
+ const head = Buffer.alloc(8);
1745
+ const bytesRead = readSync(fd, head, 0, 8, 0);
1746
+ if (bytesRead >= 4 &&
1747
+ head[0] === 0x1a &&
1748
+ head[1] === 0x45 &&
1749
+ head[2] === 0xdf &&
1750
+ head[3] === 0xa3) {
1751
+ return { sizeBytes: size, container: "webm" };
1752
+ }
1753
+ if (bytesRead >= 8 && head.subarray(4, 8).toString("ascii") === "ftyp") {
1754
+ return { sizeBytes: size, container: "mp4" };
1686
1755
  }
1756
+ throw new Error("recording file is not valid WebM or MP4 (corrupt capture?)");
1687
1757
  }
1688
1758
  finally {
1689
1759
  closeSync(fd);
1690
1760
  }
1691
- return size;
1692
1761
  }
1693
1762
  // --- Recording kind (--type) -----------------------------------------------
1694
1763
  // Declares what a recording IS, so the AI summary doesn't misread a demo as a
@@ -1736,31 +1805,36 @@ function requireRecordingKind(input) {
1736
1805
  return kind;
1737
1806
  }
1738
1807
  /**
1739
- * Streams a captured WebM through Clipy's raw-upload pipeline
1740
- * (initiate → chunks → finalize → complete). Shared by `clipy record` and
1741
- * session mode. Aborts the server-side upload session on failure.
1808
+ * Streams validated WebM/MP4 media through Clipy's raw-upload pipeline
1809
+ * (initiate → chunks → finalize → complete). Shared by `clipy proof`,
1810
+ * `clipy record`, and session mode. Aborts the server-side upload session on
1811
+ * failure.
1742
1812
  */
1743
- async function uploadWebmToClipy(ctx, opts) {
1744
- const sizeBytes = validateWebmFile(opts.videoPath);
1813
+ async function uploadVideoToClipy(ctx, opts) {
1814
+ const { sizeBytes, container } = validateVideoFile(opts.videoPath);
1745
1815
  opts.log(`${c.dim(`captured ${fmtBytes(sizeBytes)} — uploading…`)}`);
1816
+ const sourceVersion = opts.sourceVersion ?? `cli/${VERSION}`;
1746
1817
  const recordingId = randomUUID();
1747
1818
  let uploadToken = "";
1748
1819
  let publicId = "";
1749
1820
  try {
1750
1821
  // 1) initiate → uploadToken + the video row (createVideoRow so the share
1751
- // link exists immediately). sourcePlatform 'web' is honest: this IS a
1752
- // web-content capture.
1822
+ // link exists immediately). The existing CLI/raw-upload contract uses
1823
+ // sourcePlatform "web"; sourceVersion carries `cli-proof/*` provenance
1824
+ // until the backend grows provider-specific source metadata.
1753
1825
  const init = await ingestPostJson(ctx, "/api/videos/raw-upload/initiate", {
1754
1826
  recordingId,
1755
1827
  createVideoRow: true,
1756
1828
  sourcePlatform: "web",
1757
- sourceVersion: `cli/${VERSION}`,
1829
+ sourceVersion,
1758
1830
  });
1759
1831
  uploadToken = String(init.uploadToken ?? "");
1760
1832
  publicId = String(init.publicId ?? "");
1761
1833
  if (!uploadToken)
1762
1834
  throw new Error("initiate did not return an uploadToken");
1763
- // 2) stream the WebM in sequential 4 MiB parts read straight off disk (a
1835
+ if (!publicId)
1836
+ throw new Error("initiate did not return a publicId");
1837
+ // 2) stream the media in sequential 4 MiB parts read straight off disk (a
1764
1838
  // long capture never has to sit fully in memory). Sequential keeps
1765
1839
  // nextPartNumber advancing so we never trip the out-of-order guard.
1766
1840
  const PART_SIZE = 4 * 1024 * 1024;
@@ -1776,7 +1850,7 @@ async function uploadWebmToClipy(ctx, opts) {
1776
1850
  break;
1777
1851
  // new Blob([...]) snapshots the bytes synchronously, so reusing `window`
1778
1852
  // on the next iteration is safe (the chunk is fully sent before then).
1779
- await ingestPostChunk(ctx, recordingId, uploadToken, partNumber, window.subarray(0, bytesRead));
1853
+ await ingestPostChunk(ctx, recordingId, uploadToken, partNumber, window.subarray(0, bytesRead), container);
1780
1854
  if (process.stderr.isTTY) {
1781
1855
  process.stderr.write(`\r${c.dim(`uploading… part ${partNumber}/${totalParts}`)}`);
1782
1856
  }
@@ -1799,7 +1873,7 @@ async function uploadWebmToClipy(ctx, opts) {
1799
1873
  name: opts.name,
1800
1874
  description: opts.description,
1801
1875
  sourcePlatform: "web",
1802
- sourceVersion: `cli/${VERSION}`,
1876
+ sourceVersion,
1803
1877
  ...(opts.recordingKind ? { recordingKind: opts.recordingKind } : {}),
1804
1878
  ...(opts.narration && (opts.narration.text || opts.narration.notes?.length)
1805
1879
  ? { narration: opts.narration }
@@ -1822,7 +1896,117 @@ async function uploadWebmToClipy(ctx, opts) {
1822
1896
  // page to browsers. Same document as /api/agent-context/<id>.
1823
1897
  contextUrl: `${ctx.apiUrl}/video/${publicId}.md`,
1824
1898
  sizeBytes,
1899
+ container,
1900
+ };
1901
+ }
1902
+ /**
1903
+ * Creates a shareable proof recording from screenshots supplied by any agent
1904
+ * tool, or uploads a WebM/MP4 that tool already recorded. This path deliberately
1905
+ * knows nothing about Playwright, OBU, Computer Use, or browser ownership.
1906
+ */
1907
+ async function cmdProof(ctx, opts) {
1908
+ const hasFrames = opts.framePaths.length > 0;
1909
+ const hasVideo = Boolean(opts.videoPath);
1910
+ if (hasFrames === hasVideo) {
1911
+ die("usage: clipy proof (--frame <image> ... | --video <webm|mp4>) [--caption <text> ...]", 2);
1912
+ }
1913
+ if (!hasFrames && opts.captions.length > 0) {
1914
+ die("--caption is only valid with --frame", 2);
1915
+ }
1916
+ if (opts.captions.length > 0 && opts.captions.length !== opts.framePaths.length) {
1917
+ die(`--caption count (${opts.captions.length}) must match --frame count (${opts.framePaths.length})`, 2);
1918
+ }
1919
+ if (maxPassRef(opts.notes) > 0) {
1920
+ die('proof notes use absolute timestamps such as --note "3: saved state"; passN notes need record --viewports', 2);
1921
+ }
1922
+ requireKey(ctx);
1923
+ const tmpDir = join(tmpdir(), `clipy-proof-${randomUUID()}`);
1924
+ let generatedVideo = false;
1925
+ let videoPath = opts.videoPath ? resolve(opts.videoPath) : "";
1926
+ let durationSeconds = null;
1927
+ let failure = null;
1928
+ const log = (message) => {
1929
+ if (!opts.json)
1930
+ process.stderr.write(`${message}\n`);
1825
1931
  };
1932
+ try {
1933
+ const narrationNotes = resolveNarrationNotes(opts.notes, [0]);
1934
+ if (hasFrames) {
1935
+ mkdirSync(tmpDir, { recursive: true });
1936
+ videoPath = join(tmpDir, "proof.webm");
1937
+ log(c.dim(`assembling ${opts.framePaths.length} proof frame${opts.framePaths.length === 1 ? "" : "s"}…`));
1938
+ const rendered = await renderProofFrames({
1939
+ framePaths: opts.framePaths,
1940
+ outputPath: videoPath,
1941
+ holdSeconds: opts.holdSeconds,
1942
+ width: opts.width,
1943
+ height: opts.height,
1944
+ notify: log,
1945
+ });
1946
+ generatedVideo = true;
1947
+ durationSeconds = rendered.durationSeconds;
1948
+ opts.captions.forEach((caption, index) => {
1949
+ const text = caption.trim();
1950
+ if (!text)
1951
+ return;
1952
+ narrationNotes.push({
1953
+ startMs: Math.round(index * opts.holdSeconds * 1000),
1954
+ endMs: Math.round((index + 1) * opts.holdSeconds * 1000),
1955
+ text: `[proof frame ${index + 1}/${opts.framePaths.length}] ${text}`,
1956
+ });
1957
+ });
1958
+ }
1959
+ else if (!existsSync(videoPath)) {
1960
+ throw new Error(`proof video does not exist: ${videoPath}`);
1961
+ }
1962
+ narrationNotes.sort((a, b) => a.startMs - b.startMs);
1963
+ if (narrationNotes.length > 200) {
1964
+ throw new Error("proof supports at most 200 captions/notes");
1965
+ }
1966
+ const uploaded = await uploadVideoToClipy(ctx, {
1967
+ videoPath,
1968
+ name: opts.name ?? "Agent verification proof",
1969
+ description: opts.description,
1970
+ narration: narrationNotes.length > 0 ? { notes: narrationNotes } : undefined,
1971
+ recordingKind: opts.recordingKind,
1972
+ sourceVersion: `cli-proof/${VERSION}`,
1973
+ log,
1974
+ });
1975
+ if (opts.wait) {
1976
+ await waitForArtifacts(ctx, uploaded.publicId);
1977
+ }
1978
+ const source = hasFrames
1979
+ ? {
1980
+ kind: "proof-frames",
1981
+ frameCount: opts.framePaths.length,
1982
+ holdSeconds: opts.holdSeconds,
1983
+ durationSeconds,
1984
+ }
1985
+ : { kind: "proof-video", container: uploaded.container };
1986
+ if (opts.json) {
1987
+ printJson({
1988
+ id: uploaded.publicId,
1989
+ shareUrl: uploaded.shareUrl,
1990
+ contextUrl: uploaded.contextUrl,
1991
+ sizeBytes: uploaded.sizeBytes,
1992
+ source,
1993
+ });
1994
+ }
1995
+ else {
1996
+ process.stdout.write(`${c.green("✓")} proof uploaded — ${c.bold(uploaded.shareUrl)}\n`);
1997
+ process.stdout.write(`${c.dim("agent context:")} ${uploaded.contextUrl}\n`);
1998
+ }
1999
+ }
2000
+ catch (error) {
2001
+ failure = error;
2002
+ }
2003
+ finally {
2004
+ if (generatedVideo || existsSync(tmpDir)) {
2005
+ rmSync(tmpDir, { recursive: true, force: true });
2006
+ }
2007
+ }
2008
+ if (failure)
2009
+ die(failure.message);
1826
2010
  }
1827
2011
  /**
1828
2012
  * Blank-frame heuristic. We can't decode pixels without a dependency, so JPEG
@@ -2376,7 +2560,7 @@ async function cmdRecord(ctx, opts) {
2376
2560
  }
2377
2561
  // --- Upload ------------------------------------------------------------
2378
2562
  const notes = [...autoNotes, ...resolveNarrationNotes(opts.notes, passStartsMs)].sort((a, b) => a.startMs - b.startMs);
2379
- uploaded = await uploadWebmToClipy(ctx, {
2563
+ uploaded = await uploadVideoToClipy(ctx, {
2380
2564
  videoPath,
2381
2565
  name: opts.name,
2382
2566
  description: opts.description,
@@ -4095,7 +4279,7 @@ async function runSessionDaemon(file) {
4095
4279
  notes = notes.slice(0, 200);
4096
4280
  }
4097
4281
  save({ state: "uploading" });
4098
- const uploaded = await uploadWebmToClipy(ctx, {
4282
+ const uploaded = await uploadVideoToClipy(ctx, {
4099
4283
  videoPath,
4100
4284
  name: state.name,
4101
4285
  description: state.description,
@@ -4214,7 +4398,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
4214
4398
  return;
4215
4399
  }
4216
4400
  process.stdout.write(`${c.green("✓")} Clipy skill installed for ${c.bold(target)} at ${c.dim(path)}\n`);
4217
- process.stdout.write(`${c.dim("It teaches the agent to read clipy.online links and to record with clipy record / session.")}\n`);
4401
+ process.stdout.write(`${c.dim("It teaches the agent to read Clipy links and create proof with clipy proof / record / session.")}\n`);
4218
4402
  return;
4219
4403
  }
4220
4404
  if (sub === "uninstall") {
@@ -4239,7 +4423,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
4239
4423
  // command's shape without trial-and-error. Bump GUIDE_SCHEMA_VERSION when the
4240
4424
  // contract changes.
4241
4425
  // ---------------------------------------------------------------------------
4242
- const GUIDE_SCHEMA_VERSION = 12;
4426
+ const GUIDE_SCHEMA_VERSION = 14;
4243
4427
  /** The stable machine-readable failure taxonomy carried in `--json` error
4244
4428
  * envelopes. Codes are the contract; messages are not. Published through the
4245
4429
  * guide so an agent discovers the full recovery table without the skill. */
@@ -4276,7 +4460,7 @@ function cmdGuide(json) {
4276
4460
  schemaVersion: GUIDE_SCHEMA_VERSION,
4277
4461
  binary: "clipy",
4278
4462
  version: VERSION,
4279
- description: "Clipy (clipy.online) command line: read your screen recordings' transcripts/summaries/key moments, and record web apps headlessly (one-shot or live session with timestamped marks).",
4463
+ description: "Clipy (clipy.online) command line: read recordings, turn screenshots or tool-native video into proof, and record web apps or the Mac screen.",
4280
4464
  outputConvention: {
4281
4465
  jsonFlag: "--json",
4282
4466
  stdout: "primary results (JSON when --json is set) — THE SOURCE OF TRUTH",
@@ -4310,6 +4494,7 @@ function cmdGuide(json) {
4310
4494
  cmdDoc("logout", "clipy logout", "Delete the stored key"),
4311
4495
  cmdDoc("whoami", "clipy whoami", "Check the active key"),
4312
4496
  cmdDoc("list", "clipy list [-n N] [--page P] [--status s,…] [--json]", "List recordings, newest first"),
4497
+ cmdDoc("memory search", "clipy memory search <query> [--kind recording|context]… [--limit N] [--json]", "Hybrid semantic + keyword search across the user's own screen recordings and imported/watched context. Results include kind, publicId, title, timestamp/span, resolution, plain-text snippet, scores, and a deep link. Read semantic.status before trusting an empty result: unavailable/failed means keyword-only fallback. lexical/refined resolutions are exact moments; window is a span; document has no exact timestamp.", ["--kind recording|context", "--limit N", "--json"]),
4313
4498
  cmdDoc("search", "clipy search <query> [--json]", "Full-text search titles + descriptions"),
4314
4499
  cmdDoc("show", "clipy show <id|url> [--json]", "One recording's metadata + share link"),
4315
4500
  cmdDoc("transcript", "clipy transcript <id> [--marks-only] [--srt|--vtt|--json] | clipy transcript <id> --replace <file.json|-> ", "Print the transcript, or REPLACE it (ingest scope; file holds {segments:[{start,end,text}]} or {plaintext}; regenerates the summary). Default text output is ONE ENTRY PER LINE, chronological and timestamp-prefixed, from the same segments --srt/--vtt use — an agent-narration transcript is a list of discrete marks, and concatenating them into one run-on paragraph made it unreadable. --marks-only drops [auto] instrumentation lines (navigations, console errors) so only the narration a human wrote remains; it applies to the default text output (--srt/--vtt/--json are unaffected). A transcript with no segments falls back to plaintext, and --json still carries the raw plaintext for scripts that want the old shape.", ["--marks-only", "--srt", "--vtt", "--json", "--replace <file>"]),
@@ -4321,11 +4506,12 @@ function cmdGuide(json) {
4321
4506
  cmdDoc("download", "clipy download <id> [-o path]", "Download the MP4"),
4322
4507
  cmdDoc("open", "clipy open <id>", "Open the share page in a browser"),
4323
4508
  cmdDoc("wait", "clipy wait <id> [--for transcript|summary|both] [--timeout sec]", "Block until artifacts are ready"),
4509
+ cmdDoc("proof", "clipy proof (--frame <png|jpg|webp>… | --video <webm|mp4>) [--caption <text>…] [--hold sec] [--title t] [--type kind] [--note '3: text']… [--wait] [--json]", "Tool-neutral proof upload. --frame may be repeated to turn screenshots produced by any browser, computer-use, simulator, or test tool into one silent WebM; --caption must be omitted or repeated exactly once per frame and becomes timestamped agent narration. --hold controls each frame's duration (default 3s, 0.25–30; total cap 300s); --width/--height must be even integers from 320–3840 and default to 1280x720. Frame inputs are bounded to 50 MiB each and 250 MiB total. Screenshot stitching needs ffmpeg but does not need Playwright or a browser integration. --video uploads an already-recorded WebM or MP4 without re-encoding and needs no recording dependency. Exactly one source mode is required. --json prints {id, shareUrl, contextUrl, sizeBytes, source}; proof-video source reports only the detected container and never discloses the local path. Captions and notes are driver-attested narration, not Clipy-verified assertions.", ["--frame", "--caption", "--video", "--hold", "--width", "--height", "--title", "--description", "--type", "--note", "--wait", "--json"]),
4324
4510
  cmdDoc("record", "clipy record --url <url> [--for sec] [--viewports list] [--title t] [--type kind] [--note '12: text']… [--storage-state f] [--cookie 'n=v']… [--local-storage 'k=v']… [--init-script f] [--wait] [--json]", "Headless one-shot capture of a web app; notes become the transcript. Notes are absolute ('12: text') or pass-scoped ('pass2: text' / 'pass2@5: text', anchored to a --viewports pass's real start; a malformed pass note is rejected). --type declares the recording kind (bug_report|feature_request|product_demo|walkthrough_tutorial|feedback_review|discussion_talk|other, plus aliases bug/feature/demo/walkthrough/feedback/discussion) so the AI summary reads it correctly. Auth (web capture only, applied before the first navigation so a logged-in SPA's route guard sees it): --storage-state <playwright storageState JSON path>, --cookie 'name=value[; Domain=d; Path=p; Secure; HttpOnly; SameSite=Lax]' (repeatable), --local-storage 'key=value' (repeatable, target origin only), --init-script <js file run before every page load>, --user-data-dir <dir> (launch from a persistent Chromium user-data ROOT with its whole logged-in identity; web only, mutually exclusive with --storage-state; refused if <dir> is a profile subdir — pass the root — or, in direct mode, a live-locked root via SingletonLock/Socket), --profile-directory <name> (with --user-data-dir: pick a NAMED profile like 'Profile 12' from chrome://version; Playwright can't select a profile in place, so Clipy COPIES it into a temp recording root and launches the copy — loudly disclosed, the real profile is never opened or written, and the copy is deleted after upload; no need to quit Chrome, though it warns if Chrome is running since in-use DBs may copy inconsistently). Auth boundary: --storage-state only seeds what the file contains; for cross-origin auth produce it with `npx playwright open --save-storage=auth.json <login-host>`, or use --user-data-dir + --profile-directory to record your real profile, or --source mac-screen --window Chrome. With --source mac-screen: records the real screen via the Clipy Mac app (--type not yet applied on mac; auth flags rejected — the screen is already logged in); --window '<title|app|id>' or --display <id> target one window/display (ids from clipy sources). --json prints {id, shareUrl, contextUrl, sizeBytes}", ["--for", "--viewports", "--title", "--description", "--type", "--note", "--storage-state", "--cookie", "--local-storage", "--init-script", "--user-data-dir", "--profile-directory", "--width", "--height", "--wait", "--source", "--window", "--display", "--json"]),
4325
4511
  cmdDoc("session", "clipy session <start|run|stop|abort|status> [--url <url>] [--max sec] [--type kind] [--source web|mac-screen] [--window w] [--display d] [--expose-cdp] [--storage-state f] [--cookie 'n=v']… [--local-storage 'k=v']… [--init-script f] [--json]", "Background recording session; auto-stops + uploads at --max (default 600s, cap 1800s). --type sets the recording kind (see record). --window/--display (with --source mac-screen) record one window/display. --expose-cdp (web sessions) opens a CDP endpoint (cdpUrl/cdpHttpUrl in the state file + session start/status output) so your own tools can drive the page while it records; OFF by default (any local process could attach), and CLIPY_DISABLE_CDP=1 forces it off. `session run [start flags] -- <command…>` starts a session, runs the command with inherited stdio (env CLIPY_SESSION=1, plus CLIPY_CDP_URL when --expose-cdp), then GUARANTEES cleanup: exit 0 uploads, any non-zero exit or signal discards (session abort) and propagates the child's code — the crash-safe wrapper so a dead driver never records dead air. Accepts the same auth flags as record (--storage-state/--user-data-dir/--profile-directory/--cookie/--local-storage/--init-script; web only, rejected on --source mac-screen). `session run` exports CLIPY_SESSION_FILE to the child so mark/chapter resolve the session from any cwd. --json is supported on start/stop/status (start returns cdpUrl/cdpHttpUrl)", ["run", "--url", "--max", "--type", "--source", "--window", "--display", "--expose-cdp", "--storage-state", "--user-data-dir", "--profile-directory", "--cookie", "--local-storage", "--init-script", "--json"]),
4326
4512
  cmdDoc("mark", "clipy mark \"<text>\" [--observed \"<values>\" --verdict pass|fail] [--assert-selector <css> [--assert-text <substr>]] [--assert-url <glob>] [--fail-mode warn|abort] [--at <sec>|--ago <sec>] [--json]", "Drop a live-timestamped note into the active session. A mark carries at most ONE evidence provenance, and the two are labeled + tallied separately so they can never be pooled. DRIVER-ATTESTED (--observed '<values>' --verdict pass|fail, both required together): you drove the browser and report what YOU observed — renders '<text> [≈ ASSERT driver-attested; observed=<values>]' (pass) / '<text> [≈ FAILED driver-attested; observed=<values>]' (fail) — a HEDGE glyph, never ✓/✗, so a skim distinguishes provenance by shape alone and works in EVERY session type including --source mac-screen. Honesty rule: driver-attested means Clipy vouches the agent SAID it, not that Clipy verified it — put real observed values there. Combining --observed/--verdict with --assert-* is a usage error. CLIPY-VERIFIED assertion marks (Clipy-owned page only) make the note evidence Clipy itself checked: --assert-selector checks a CSS selector matches (its trimmed textContent is recorded as 'observed'); --assert-text requires that element's text to contain a substring (needs --assert-selector); --assert-url matches the page URL against a glob (** = any, * = any non-slash, no * = substring). The daemon evaluates against its live page and annotates the mark: pass ⇒ '<text> [assert ✓ verified-by-clipy; <observed>]', fail ⇒ '<text> [ASSERT ✗ verified-by-clipy; expected …; observed …]' — a false claim cannot read as fact. --fail-mode warn (default) records the ✗; --fail-mode abort DISCARDS the whole session on a failed assertion (no upload) and the CLI exits non-zero. If any assertion was attempted, a leading 0ms [verification] note is prepended, reporting the provenances as SEPARATE segments: '[verification] N clipy-verified: P passed, F failed, K unverified · M driver-attested: P passed, F failed' (a segment is omitted when empty; with only clipy-verified marks the legacy 'N assertion(s): …' rendering is byte-identical). --at <sec> stamps at an absolute recording time; --ago <sec> stamps N seconds before now (mutually exclusive). Assertions/backdating need a web session (rejected on --source mac-screen). Up to 200 marks per recording.", ["--observed", "--verdict", "--assert-selector", "--assert-text", "--assert-url", "--fail-mode", "--at", "--ago", "--json"]),
4327
4513
  cmdDoc("chapter", "clipy chapter \"<label>\" [--json]", "Mark a BEFORE/AFTER section boundary in the active recording (stored as '=== CHAPTER: <label> ==='). The PR-review shape: demo the base branch, run `clipy chapter \"AFTER — fix applied\"`, swap branches + restart the dev server, demo the fix — one video carrying both states. Works on web + --source mac-screen sessions.", ["--json"]),
4328
- cmdDoc("doctor", "clipy doctor [--json]", "One-shot health check: API reachability (GET /api/health, with latency), API key + whoami round-trip, Mac agent bridge (exists/parses/pid/appVersion>=" + MIN_BRIDGE_APP_VERSION + "), Playwright resolvability (and the resolved path/node_modules dir), the CONTEXT-IMPORT prerequisites (yt-dlp presence/path/version, ffmpeg + ffprobe presence/version, and whether that ffmpeg has the libwebp encoder frames need), and install mode (npx/global/local) — each a pass/warn/fail with a fix hint; exits non-zero if any check fails. Read-only: it never installs anything, so a missing yt-dlp/ffmpeg reports WARN with the install command rather than silently downloading a binary. Run it first whenever a context import or a recording fails — it names the missing piece behind ytdlp_missing / ffmpeg_missing / auth_required / server_unreachable instead of leaving you to guess.", ["--json"]),
4514
+ cmdDoc("doctor", "clipy doctor [--json]", "One-shot health check: API reachability (GET /api/health, with latency), API key + whoami round-trip, Mac agent bridge (exists/parses/pid/appVersion>=" + MIN_BRIDGE_APP_VERSION + "), Playwright resolvability (and the resolved path/node_modules dir), context/proof prerequisites (yt-dlp presence/path/version, ffmpeg + ffprobe presence/version, and whether that ffmpeg has libwebp), and install mode (npx/global/local) — each a pass/warn/fail with a fix hint; exits non-zero if any check fails. Read-only: it never installs anything, so a missing yt-dlp/ffmpeg reports WARN with the install command rather than silently downloading a binary. Run it first whenever an import, proof, or recording fails.", ["--json"]),
4329
4515
  cmdDoc("playwright-path", "clipy playwright-path [--json]", "Print the node_modules directory of the Playwright this CLI resolves, so your own --expose-cdp driver scripts can load the same copy: NODE_PATH=$(clipy playwright-path) node driver.js. Exits 1 (empty stdout) if Playwright is unresolvable. --json prints {path, nodeModulesDir, source}", ["--json"]),
4330
4516
  cmdDoc("sources", "clipy sources [--json]", "List displays + windows the Clipy Mac app can capture — ids feed --window/--display. --json gives each entry a `source` {kind,id,title} in the SAME shape session start/record report for the resolved capture, so a caller can compare what it picked against what the camera reports without transforming either."),
4331
4517
  cmdDoc("agents", "clipy agents <status|install|uninstall> <claude|codex|cursor>", "Install the bundled Clipy skill for a coding agent; install triggers a browser login first when no key is configured (interactive terminals only)"),
@@ -4335,7 +4521,8 @@ function cmdGuide(json) {
4335
4521
  notes: [
4336
4522
  "Read commands accept a bare public id or the full https://clipy.online/video/<id> URL.",
4337
4523
  "login opens a browser to approve this device (loopback redirect to 127.0.0.1); use --key/--paste or a piped key on headless boxes.",
4338
- "record/session/mark/transcript --replace are the only write commands; they need a key with the 'ingest' permission.",
4524
+ "proof/record/session/mark/transcript --replace are write commands; they need a key with the 'ingest' permission.",
4525
+ "Tool-neutral proof: use `clipy proof --frame ...` when the agent's existing tool can save screenshots, or `clipy proof --video ...` when it can export WebM/MP4. This never requires installing Playwright, OBU, Browser Use, or another browser driver. Frame mode needs ffmpeg only to encode the supplied images; video mode uploads without re-encoding. Captions/notes are driver-attested narration and must describe literal observed values rather than claim Clipy independently verified them.",
4339
4526
  "Headless captures have no audio: --note flags and session marks become the transcript, labeled agent-narration.",
4340
4527
  "--note is absolute ('12: text') or pass-scoped ('pass2: text' / 'pass2@5: text'); pass-scoped notes anchor to the real start of a --viewports pass, so they don't drift when load time shifts the pass boundaries. A malformed pass note (e.g. 'pass2 text' with no colon) is a usage error, not silently demoted.",
4341
4528
  "--type declares what a recording IS (bug_report/feature_request/product_demo/walkthrough_tutorial/feedback_review/discussion_talk/other, plus short aliases) so the AI summary doesn't misread a demo as a bug report. Applied on web today; --source mac-screen support is pending a Clipy app update.",
@@ -4450,6 +4637,10 @@ async function main() {
4450
4637
  title: { type: "string" },
4451
4638
  description: { type: "string" },
4452
4639
  note: { type: "string", multiple: true },
4640
+ frame: { type: "string", multiple: true },
4641
+ caption: { type: "string", multiple: true },
4642
+ video: { type: "string" },
4643
+ hold: { type: "string" },
4453
4644
  viewports: { type: "string" },
4454
4645
  max: { type: "string" },
4455
4646
  replace: { type: "string" },
@@ -4457,6 +4648,7 @@ async function main() {
4457
4648
  language: { type: "string" },
4458
4649
  folder: { type: "string" },
4459
4650
  tag: { type: "string", multiple: true },
4651
+ kind: { type: "string", multiple: true },
4460
4652
  sync: { type: "boolean", default: false },
4461
4653
  // Opt out of Phase 2: sync and take the server's verdict, but never
4462
4654
  // download media or write frames.
@@ -4587,6 +4779,20 @@ async function main() {
4587
4779
  await cmdList(ctx, { q, n: num(values.n ?? values.limit, 20), page: num(values.page, 1), status: values.status, json });
4588
4780
  return;
4589
4781
  }
4782
+ case "memory": {
4783
+ if (rest[0] !== "search")
4784
+ die("usage: clipy memory search <query> [--kind recording|context] [--limit N] [--json]", 2);
4785
+ const query = rest.slice(1).join(" ").trim();
4786
+ if (!query)
4787
+ die("usage: clipy memory search <query> [--kind recording|context] [--limit N] [--json]", 2);
4788
+ await cmdMemorySearch(ctx, {
4789
+ query,
4790
+ kinds: values.kind ?? [],
4791
+ limit: num(values.limit ?? values.n, 20),
4792
+ json,
4793
+ });
4794
+ return;
4795
+ }
4590
4796
  case "show":
4591
4797
  if (!rest[0])
4592
4798
  die("usage: clipy show <id|url>", 2);
@@ -4731,6 +4937,29 @@ async function main() {
4731
4937
  }
4732
4938
  return;
4733
4939
  }
4940
+ case "proof": {
4941
+ const framePaths = (values.frame ?? []).map((path) => path.trim());
4942
+ const captions = (values.caption ?? []).map((caption) => caption.trim());
4943
+ const videoPath = values.video?.trim() ||
4944
+ (framePaths.length === 0 ? rest[0]?.trim() : undefined);
4945
+ const holdRaw = Number(values.hold ?? 3);
4946
+ await cmdProof(ctx, {
4947
+ framePaths,
4948
+ captions,
4949
+ videoPath: videoPath || undefined,
4950
+ holdSeconds: holdRaw,
4951
+ width: num(values.width, 1280),
4952
+ height: num(values.height, 720),
4953
+ name: (values.title ?? values.name)?.trim() ||
4954
+ undefined,
4955
+ description: values.description?.trim() || undefined,
4956
+ recordingKind: values.type ? requireRecordingKind(String(values.type)) : undefined,
4957
+ notes: (values.note ?? []).map(parseNoteFlag),
4958
+ wait: Boolean(values.wait),
4959
+ json,
4960
+ });
4961
+ return;
4962
+ }
4734
4963
  case "record": {
4735
4964
  const source = String(values.source ?? "web");
4736
4965
  if (source !== "web" && source !== "mac-screen") {
@@ -0,0 +1,83 @@
1
+ import { existsSync, statSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ import { resolveFf, runFf } from "./context/ffmpeg.js";
4
+ const MAX_FRAMES = 50;
5
+ const MAX_TOTAL_SECONDS = 300;
6
+ const MAX_IMAGE_BYTES = 50 * 1024 * 1024;
7
+ const MAX_TOTAL_IMAGE_BYTES = 250 * 1024 * 1024;
8
+ const SUPPORTED_IMAGE_EXTENSIONS = /\.(?:png|jpe?g|webp)$/i;
9
+ function evenDimension(value, label) {
10
+ if (!Number.isInteger(value) || value < 320 || value > 3840) {
11
+ throw new Error(`${label} must be an integer between 320 and 3840`);
12
+ }
13
+ if (value % 2 !== 0) {
14
+ throw new Error(`${label} must be even for WebM encoding`);
15
+ }
16
+ return value;
17
+ }
18
+ function validateFrames(paths) {
19
+ if (paths.length === 0)
20
+ throw new Error("proof needs at least one --frame");
21
+ if (paths.length > MAX_FRAMES) {
22
+ throw new Error(`proof accepts at most ${MAX_FRAMES} frames`);
23
+ }
24
+ let totalBytes = 0;
25
+ return paths.map((input) => {
26
+ const path = resolve(input);
27
+ if (!existsSync(path))
28
+ throw new Error(`proof frame does not exist: ${path}`);
29
+ const stat = statSync(path);
30
+ if (!stat.isFile())
31
+ throw new Error(`proof frame is not a file: ${path}`);
32
+ if (stat.size === 0)
33
+ throw new Error(`proof frame is empty: ${path}`);
34
+ if (stat.size > MAX_IMAGE_BYTES) {
35
+ throw new Error(`proof frame exceeds 50 MiB: ${path}`);
36
+ }
37
+ totalBytes += stat.size;
38
+ if (totalBytes > MAX_TOTAL_IMAGE_BYTES) {
39
+ throw new Error("proof frames exceed the 250 MiB total input limit");
40
+ }
41
+ if (!SUPPORTED_IMAGE_EXTENSIONS.test(path)) {
42
+ throw new Error(`unsupported proof frame format (use PNG, JPEG, or WebP): ${path}`);
43
+ }
44
+ return path;
45
+ });
46
+ }
47
+ /**
48
+ * Turns a bounded sequence of screenshots into a silent WebM. Each screenshot
49
+ * is held for the same duration; narration/captions remain separate so the
50
+ * server can expose them as timestamped agent evidence.
51
+ *
52
+ * Every argument goes directly to spawn(), never through a shell. Frame paths
53
+ * may therefore contain whitespace or shell metacharacters safely.
54
+ */
55
+ export async function renderProofFrames(opts) {
56
+ const framePaths = validateFrames(opts.framePaths);
57
+ if (!Number.isFinite(opts.holdSeconds) || opts.holdSeconds < 0.25 || opts.holdSeconds > 30) {
58
+ throw new Error("--hold must be between 0.25 and 30 seconds");
59
+ }
60
+ const durationSeconds = framePaths.length * opts.holdSeconds;
61
+ if (durationSeconds > MAX_TOTAL_SECONDS) {
62
+ throw new Error(`proof video is capped at ${MAX_TOTAL_SECONDS} seconds`);
63
+ }
64
+ const width = evenDimension(opts.width, "--width");
65
+ const height = evenDimension(opts.height, "--height");
66
+ const ffmpeg = await resolveFf("ffmpeg", opts.notify);
67
+ const args = ["-hide_banner", "-loglevel", "error"];
68
+ for (const framePath of framePaths) {
69
+ args.push("-loop", "1", "-t", String(opts.holdSeconds), "-i", framePath);
70
+ }
71
+ const filters = framePaths.map((_frame, index) => `[${index}:v]scale=${width}:${height}:force_original_aspect_ratio=decrease,` +
72
+ `pad=${width}:${height}:(ow-iw)/2:(oh-ih)/2:color=black,` +
73
+ `setsar=1,fps=30,format=yuv420p[v${index}]`);
74
+ filters.push(`${framePaths.map((_frame, index) => `[v${index}]`).join("")}` +
75
+ `concat=n=${framePaths.length}:v=1:a=0[outv]`);
76
+ args.push("-filter_complex", filters.join(";"), "-map", "[outv]", "-c:v", "libvpx", "-deadline", "good", "-cpu-used", "4", "-crf", "28", "-b:v", "0", "-an", "-y", opts.outputPath);
77
+ const result = await runFf(ffmpeg, args, Math.max(120_000, durationSeconds * 10_000));
78
+ if (result.code !== 0) {
79
+ const detail = result.stderr.trim().slice(-1_000);
80
+ throw new Error(`ffmpeg could not create the proof video${detail ? `: ${detail}` : ""}`);
81
+ }
82
+ return { videoPath: opts.outputPath, framePaths, durationSeconds };
83
+ }
package/dist/skill.js CHANGED
@@ -10,23 +10,30 @@
10
10
  */
11
11
  export const CLIPY_SKILL_MD = `---
12
12
  name: clipy
13
- description: Read and create Clipy screen recordings, and turn any video into agent-readable context. Use when the user shares a clipy.online/video/<id> URL (watch, summarize, or act on a recording, bug report, or walkthrough), shares a YouTube URL or local video file as context/reference for a task ("implement what this video shows", "give me the context of this video" — import it with clipy context import), OR asks you to record your own work — demo a feature you built, capture a UI fix, or show a bug reproduction — and share it as a link.
13
+ description: Read and create Clipy screen recordings, turn screenshots or tool-native video into proof, and turn any video into agent-readable context. Use when the user shares a clipy.online/video/<id> URL (watch, summarize, or act on a recording, bug report, or walkthrough), shares a YouTube URL or local video file as context/reference for a task ("implement what this video shows", "give me the context of this video" — import it with clipy context import), OR asks you to verify your own work and share proof through Clipy.
14
14
  ---
15
15
 
16
16
  # Clipy — recordings you can read AND make
17
17
 
18
- Written for @clipy/cli + @clipy/mcp 0.9.0 (the two versions move in lockstep). If
18
+ Written for @clipy/cli + @clipy/mcp 0.11.0 (the two versions move in lockstep). If
19
19
  \`clipy --version\` reports older, upgrade first: \`npm i -g @clipy/cli@latest\`.
20
20
 
21
21
  Clipy (clipy.online) is the screen recorder built to be agent-readable. Every
22
22
  recording has a share link, an AI transcript + summary, key moments, and a
23
- machine-readable context document. With the CLI you can also CREATE recordings:
24
- capture a running web app headlessly, or capture the real Mac screen through the
25
- running Clipy app, narrate with timestamped marks, and hand back a watchable link.
23
+ machine-readable context document. With the CLI you can also CREATE proof:
24
+ combine screenshots from whatever tool you already use, upload a tool-native
25
+ WebM/MP4, capture a running web app headlessly, or capture the real Mac screen
26
+ through the running Clipy app, then hand back a watchable link.
26
27
 
27
28
  Commands below use \`clipy\`. If it is not on PATH, prefix with \`npx @clipy/cli\`
28
29
  (identical). Exit codes: \`0\` ok · \`1\` error · \`2\` usage · \`3\` artifact not ready.
29
30
 
31
+ The canonical live operating contract is \`https://clipy.online/agents.md\`. Fetch
32
+ it when network access is available. It explains which surface to choose, auth and
33
+ scope boundaries, environment/profile preflight, proof, search, REST, safety, and
34
+ honest fallbacks. For the exact installed version, trust \`clipy guide --json\`;
35
+ for an MCP connection, trust its \`tools/list\` response.
36
+
30
37
  ## Reading a recording (no auth needed for public links)
31
38
 
32
39
  1. Given \`https://clipy.online/video/<id>\`, read the context document — either
@@ -46,6 +53,28 @@ Commands below use \`clipy\`. If it is not on PATH, prefix with \`npx @clipy/cli
46
53
  5. For bug reports / feedback: enumerate the extracted issues as a numbered list
47
54
  (with timestamps) before implementing anything.
48
55
 
56
+ ## Search everything the user remembers
57
+
58
+ When the user refers to something they recorded, watched, imported, showed, or
59
+ discussed, search BOTH libraries first:
60
+
61
+ clipy memory search "authentication flow" --json
62
+
63
+ This is hybrid semantic + keyword search across Clipy recordings and imported/
64
+ watched context. Use \`--kind recording\` or \`--kind context\` only when the user
65
+ clearly means one side. MCP equivalent: \`search_memory\`.
66
+
67
+ Read \`semantic.status\` before trusting an empty result. \`unavailable\` or
68
+ \`failed\` means the semantic index did not run and results are keyword-only:
69
+ say so and retry with literal phrasing rather than concluding the memory is absent.
70
+ For each hit, \`resolution=lexical|refined\` is an exact moment, \`window\` is a
71
+ span to inspect, and \`document\` is a whole-document match without an exact time.
72
+ Follow a recording hit with \`clipy transcript\` / \`clipy context\`; follow a
73
+ context hit with MCP \`read_context_document\`.
74
+
75
+ \`clipy search\` is the legacy recording-library search. Prefer
76
+ \`clipy memory search\` for new agent work.
77
+
49
78
  ## Turning someone else's video into context (clipy context import)
50
79
 
51
80
  When the user hands you a YouTube URL or a local video file AS REFERENCE — "follow
@@ -203,6 +232,118 @@ Headless web capture also needs Playwright (kept out of the base install):
203
232
  Wiring up a coding agent? \`clipy agents install <claude|codex|cursor>\` does the
204
233
  browser login (if no key yet) and installs this skill.
205
234
 
235
+ ## Choose the proof path before recording
236
+
237
+ Do not start by launching a browser. First determine WHERE the agent is running,
238
+ WHAT must be verified, and WHETHER the target depends on an existing login.
239
+
240
+ 1. Read the repository's own \`AGENTS.md\` / \`CLAUDE.md\` / browser-testing
241
+ instructions. If they name a Chrome profile, test account, browser, port, or
242
+ authentication fixture, that project-specific choice wins.
243
+ 2. Inspect the change and make a coverage checklist: changed routes/pages,
244
+ important states and interactions, required identities/roles, and requested
245
+ viewports. A UI PR review should prove the built app on every material changed
246
+ surface, not merely record one convenient page.
247
+ 3. Run \`clipy doctor --json\`. Use its auth, Mac bridge, Playwright, and install
248
+ results to identify what this machine can actually do.
249
+ 4. Classify the environment and choose the narrowest truthful path:
250
+ - **Interactive Mac with an already-authenticated browser:** preserve that
251
+ real session. Prefer the current agent/browser tool's own WebM/MP4 or
252
+ screenshots and hand them to \`clipy proof\`. For continuous native proof,
253
+ use \`clipy sources --json\`, select the exact Chrome/app window, and record
254
+ it with \`--source mac-screen --window <exact-id>\`.
255
+ - **Interactive Windows/Linux desktop:** the Mac bridge is unavailable. Reuse
256
+ the existing browser/computer-use tool's video or screenshots with
257
+ \`clipy proof\`; otherwise use Playwright with an existing approved auth
258
+ state. Never fall back to whole-display capture silently.
259
+ - **SSH server / container / CI:** assume there is no usable desktop session.
260
+ For public routes, isolated headless Playwright is appropriate. For
261
+ authenticated routes, first reuse the repository's test login,
262
+ Playwright \`storageState\`, init script, or existing agent-owned browser
263
+ recording. If none exists, report the authentication blocker; do not type
264
+ personal credentials, copy cookies out of an unrelated browser, or record a
265
+ signed-out substitute and call it proof.
266
+ - **Public/local route with no login dependency:** a fresh isolated headless
267
+ browser is normally the cleanest option.
268
+
269
+ Before capture, visibly confirm the resolved target: expected URL, expected
270
+ signed-in/signed-out state, expected account/role when it is safe to display, and
271
+ the exact window/profile named by the repository or user. If any of those are
272
+ wrong, abort that take.
273
+
274
+ If another tool already owns the browser or its CDP debugger, do not attach Clipy
275
+ as a second debugger. Let that tool produce video/screenshots and use
276
+ \`clipy proof\`. Clipy-owned headless sessions are for cases where Clipy is the
277
+ browser owner; \`--source mac-screen\` is for an exact real Mac window.
278
+
279
+ ### UI PR / multi-page proof
280
+
281
+ For a request such as "review this UI PR and record every changed page":
282
+
283
+ - Derive the route/state checklist from the diff and acceptance criteria.
284
+ - Start the app build the user will actually run, then verify each checklist
285
+ item in that running artifact.
286
+ - Reuse one authenticated identity across the run when the routes share it.
287
+ Navigate within one recording and add a \`clipy chapter\` for every page or
288
+ major state, plus literal observed-value marks for the decisive result.
289
+ - Capture relevant responsive states when layout is part of the change.
290
+ - If the current tool records video, prefer one concise walkthrough and upload
291
+ it with \`clipy proof --video\`. If it only captures screenshots, use a focused
292
+ frame sequence; the frame limit is 50.
293
+ - If pages require different accounts, browser profiles, native apps, or privacy
294
+ boundaries, make separate proof recordings. Do not weaken authentication or
295
+ expose unrelated windows merely to force everything into one video.
296
+ - Return a short coverage list beside the watch and \`.md\` URLs so the reviewer
297
+ can see exactly which routes/states the recording proves.
298
+
299
+ ## Universal proof — use the tool the agent already has
300
+
301
+ When the user says "once you are done, verify it and send proof through Clipy",
302
+ finish the work and normal tests first. Then use the narrowest proof path the
303
+ current environment already supports. Do not install Open Browser Use, Browser
304
+ Use, Playwright, or another browser driver merely to make proof.
305
+
306
+ If the current browser/computer/simulator tool can save screenshots, capture a
307
+ short evidence sequence and let Clipy combine it:
308
+
309
+ clipy proof \\
310
+ --frame /absolute/path/01-target.png \\
311
+ --caption "Target: Settings page loaded; Save is disabled" \\
312
+ --frame /absolute/path/02-result.png \\
313
+ --caption "Result: Save is enabled after changing Time zone" \\
314
+ --frame /absolute/path/03-persisted.png \\
315
+ --caption "Persistence: Asia/Kolkata remains selected after reload" \\
316
+ --hold 3 --title "Settings time-zone fix" --type bug --wait --json
317
+
318
+ - Use 2–4 frames when possible: identify the target, show the decisive action or
319
+ result, then show persistence/reload or a second viewport when relevant.
320
+ - \`--caption\` is optional; if used, repeat it exactly once per \`--frame\`.
321
+ Captions become timestamped agent narration.
322
+ - Frame mode accepts PNG, JPEG, and WebP, up to 50 images / 5 minutes, 50 MiB
323
+ per image and 250 MiB total. Output dimensions must be even integers between
324
+ 320 and 3840. It needs ffmpeg only to encode the supplied images; it does not
325
+ launch or control a browser.
326
+ - Captions are driver-attested evidence: record literal UI text, values, URL,
327
+ status, or dimensions you actually observed. They are not independent Clipy
328
+ assertions, so never phrase an inference as a verified fact.
329
+
330
+ If the current tool already recorded a video, hand the completed artifact to
331
+ Clipy without re-encoding:
332
+
333
+ clipy proof --video /absolute/path/verification.webm \\
334
+ --title "Export flow verification" --type demo \\
335
+ --note "0: Export page loaded" --note "6: Download completed" \\
336
+ --wait --json
337
+
338
+ \`--video\` accepts WebM or MP4 and needs no browser automation dependency.
339
+ Playwright's \`recordVideo\`, a Browser Use export, a CI artifact, or any other
340
+ recorder is equally valid; Clipy is the proof sink, not the browser driver.
341
+
342
+ Capture only the relevant UI. Do not include secrets, private messages, customer
343
+ data, or unrelated windows. After upload, read the returned result, then run
344
+ \`clipy context <id>\` and confirm the narration matches the frames/video before
345
+ sharing both URLs.
346
+
206
347
  ## Making a recording — headless web app
207
348
 
208
349
  One-shot capture of a running app (notes become the transcript, see below):
@@ -552,6 +693,9 @@ mic-free on the strength of the flag you passed.
552
693
  never record a full display without the user's explicit go-ahead.
553
694
  - Never record surfaces showing secrets (.env files, API keys, tokens, customer
554
695
  data) — the recording gets a shareable link.
696
+ - For \`clipy proof\`, screenshots/video must come from the verification you
697
+ actually performed. Captions and notes are agent attestations, so use literal
698
+ observed values and never imply Clipy independently checked them.
555
699
  - ALWAYS verify before sharing: after upload run \`clipy wait <id> --for both\`
556
700
  then \`clipy context <id>\` and confirm the transcript matches what you meant to
557
701
  show.
@@ -574,7 +718,8 @@ Playwright installed).
574
718
  If \`clipy\` misbehaves or a flag is missing, check the version:
575
719
  \`clipy --version\` vs \`npm view @clipy/cli version\`. Upgrade with
576
720
  \`npm i -g @clipy/cli@latest\`. \`clipy guide --json\` prints a machine-readable
577
- manifest of every command, flag, env var, and exit code.
721
+ manifest of every command, flag, env var, and exit code. The site-wide surface
722
+ contract is \`https://clipy.online/agents.md\`.
578
723
 
579
724
  ## Deeper access
580
725
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipy/cli",
3
- "version": "0.9.3",
3
+ "version": "0.11.0",
4
4
  "description": "Command-line interface for Clipy — list, search, and read your screen recordings' transcripts, AI summaries, and key moments from the terminal.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,8 +39,10 @@
39
39
  "prepublishOnly": "npm run build",
40
40
  "start": "node dist/index.js",
41
41
  "test:auth": "npm run build && node scripts/mock-auth-server.test.mjs && node scripts/doctor.test.mjs",
42
+ "test:proof": "npm run build && node scripts/proof-frames.test.mjs",
43
+ "test:memory": "npm run build && node scripts/memory-search.test.mjs",
42
44
  "test:session": "npm run build && node scripts/auth-guard.test.mjs && node scripts/session-control.test.mjs",
43
- "test": "npm run test:auth && npm run test:session && node scripts/context-sync.test.mjs && node scripts/context-frames.test.mjs && node scripts/context-youtube-transcript.test.mjs && node scripts/context-youtube-url-lang.test.mjs && node scripts/context-retry.test.mjs && node scripts/context-json-envelope.test.mjs && node scripts/context-ytdlp-update.test.mjs",
45
+ "test": "npm run test:auth && npm run test:session && node scripts/proof-frames.test.mjs && node scripts/memory-search.test.mjs && node scripts/context-sync.test.mjs && node scripts/context-frames.test.mjs && node scripts/context-youtube-transcript.test.mjs && node scripts/context-youtube-url-lang.test.mjs && node scripts/context-retry.test.mjs && node scripts/context-json-envelope.test.mjs && node scripts/context-ytdlp-update.test.mjs",
44
46
  "prebuild": "node scripts/sync-context-core.mjs",
45
47
  "test:context": "npm run build && node scripts/context-sync.test.mjs && node scripts/context-frames.test.mjs && node scripts/context-youtube-transcript.test.mjs && node scripts/context-youtube-url-lang.test.mjs && node scripts/context-retry.test.mjs && node scripts/context-json-envelope.test.mjs && node scripts/context-ytdlp-update.test.mjs"
46
48
  },