记忆

Clipboard Memory

试用

在 Mac 上检索本地剪贴板历史,找回之前复制过的文本、命令、链接、图片或 PDF。

它能做什么

读取 macOS 剪贴板状态的本地 SQLite 归档,以 JSON 为主的命令行接口便于程序化查询。支持按相关性排序的召回、按时间顺序回放、精确字符串搜索、针对图片与 PDF 的原始字节导出,以及按应用、时间窗口、内容形态过滤。可用于找回命令、链接或片段,不必退回到 Web 或代码库搜索。

什么时候用它

  • 找回重启前刚复制过的那段命令或代码片段
  • 重新找出之前从 Safari 复制的 URL
  • 取出最近一次剪贴板内容里的图片或 PDF 原始文件
  • 按应用和时间窗口逐条浏览今天的剪贴板时间线

技能文档

Recall what the user copied on this Mac before reaching for generic search. clipmem maintains a local, privacy-preserving SQLite archive of every clipboard state macOS emits, and exposes a JSON-first CLI built for agents. This package is installed by clipmem agents openclaw install-skill; the canonical cross-agent source lives under skills/clipboard-memory/.

Use this skill when

The user asks things like:

  • "what was that command I copied?"
  • "show me the URL I copied from Safari earlier"
  • "find that snippet, path, note, or link I copied yesterday"
  • "give me the exact text I copied, not a summary"
  • "what did I copy before I restarted?"
  • "paste me back that SQL I was looking at"
  • "get the PDF I copied last week"
  • "show me everything I copied from Xcode today"

Do not use this skill for

  • web search or current-events lookups
  • searching the repository or local files the user never copied
  • content the user typed but never copied to the clipboard
  • anything on a non-macOS machine (clipmem captures NSPasteboard only)

Prerequisites

Before querying, confirm the setup is healthy — otherwise empty results may be a stale watcher, not a true miss:

  1. Background capture must be running. clipmem setup is the canonical fix; Homebrew users can also use brew services start clipmem.
  2. The binary clipmem must be on PATH with write access to ~/Library/Application Support/clipmem/clipmem.sqlite3.
  3. Run scripts/check-setup.sh once per session when results look wrong. It exits 0 on a healthy host, 1 if the watcher is stale, 2 if the binary is missing, 3 if clipmem doctor fails. The prose equivalent is in references/setup-check.md.
  4. If OpenClaw cannot see the binary, run clipmem agents openclaw doctor and follow its remediation lines.

Command ladder

Always pick the narrowest command that answers the question, and always pass --format json (or --format toon for plain enumeration) so you can parse the response deterministically.

  1. clipmem recall — best-first ranked answer with alternatives. Start here for almost every request.
  2. clipmem timeline — chronological capture events (one row per copy), including repeated copies of the same content. Use for "today", "yesterday", "in order", or "every time".
  3. clipmem search — direct lexical / FTS matching. Use when you need precise substring hits or the user gave you an exact phrase.
  4. clipmem get — nested item/representation detail for a single snapshot already in hand.
  5. clipmem export --item --uti --out [--force] — raw bytes. Use when the stored content is binary/image/PDF and best_text is empty or partial. Prefer a fresh output path; use --force only to replace an existing regular file.
  6. clipmem ocr candidates, clipmem ocr get, clipmem ocr clear, and clipmem storage image-candidates — inspect queued OCR or image optimization work before running batch workflows, or clear one stale OCR result.
  7. clipmem settings reset --format json — reset capture policy and ignored apps when the user explicitly asks to restore defaults.
  8. clipmem service providers --format json — inspect service provider state without starting or stopping capture.
  9. clipmem service revision --format json — inspect archive revision counters without probing service providers.
  10. clipmem app settings, clipmem app launch-at-login, clipmem app update-check run, or clipmem app quit with --format json — inspect or change menu bar app preferences and app-owned state when the user asks about app defaults, update checks, or quitting the app.
  11. clipmem agents context --format json — compact health, settings, app state, recent activity, revision, stats, privacy, and capability context before multi-step work.

Primitive command taxonomy

Primitive commands expose one bounded read or mutation that can be composed directly. Convenience workflows such as recall, setup, purge, ocr run, and storage optimize-images remain useful, but verify uncertain results with search, recent, timeline, or get, and preview broad mutations with candidate or dry-run commands when available.

The full flag reference, JSON envelope, and kind values live in references/commands.md, references/json-schema.md, and references/examples.md.

Critical behaviour rules

  • Before answering from a stale, empty, or ambiguous archive, run clipmem agents context --format json and use generated_at, health, settings, app state, recent activity, revision, stats, privacy, and capability fields to decide whether to broaden search or diagnose setup.
  • Always use --format json when you will parse the response. --format toon is for token-efficient enumeration only. --format jsonl is for streaming many rows into a pipeline. Never parse md or text.
  • Treat recall as a convenience ranking helper, not an authority. For uncertain cases, compose primitive commands in this order: search, recent, timeline, get, then OS follow-through such as pbcopy, open, or open -R.
  • Never claim "nothing found" until you have broadened the search once and checked truncated / next_cursor.
  • When best_match_confidence is "low" or there are several plausible hits, present the top candidates instead of pretending certainty.
  • For exact-text requests, quote best_text verbatim. Do not paraphrase commands, SQL, code, URLs, or file paths unless the user asked for a summary.

Capability map

The repo-side agent-native action parity contract lives in docs/action-parity.md. Use it when you need the maintained map from user-visible outcomes to agent-accessible commands, entity CRUD expectations, and derived-cache boundaries.

Output format rule

  • --format json — structured output. Retrieval envelopes are stable within schema_version: 2; management and inspection commands use command-specific JSON shapes, so parse documented keys directly.
  • --format toon — flat, token-efficient list. Prefer for high-cardinality enumeration (timeline, search, recent, recall) when you only need the top fields. Note: get does not support toon.
  • --format jsonl — newline-delimited records. Use when streaming many rows into a pipeline.
  • --format md / --format text — human-readable previews only; never parse these.

--json is an alias for --format json on search, recent, timeline, get, service revision, capture-once, and doctor.

Which command for which intent

User intentFirst command
"what was that thing I copied" (no time cue)recall "" --format json
"what did I copy today / yesterday / in order"timeline --hours --format json
"recent unique things I copied"recent --hours --format json
exact substring or punctuation-heavy querysearch --mode literal "" --format json
already have a snapshot idget --format json
need raw image / PDF bytesget then export --item --uti --out

recall vs recent vs timeline:

  • recall ranks across the archive and returns a best candidate plus alternatives.
  • recent deduplicates by snapshot — identical copies collapse into one row.
  • timeline is event-centric — every capture event is its own row, even if the content repeats.

Quick examples

# best-first answer
clipmem recall "that command I copied" --format json --limit 5

# Safari today, token-efficient
clipmem recall --prefer-recent --app safari --hours 24 --format toon

# exact URL yesterday
clipmem recall "url" --has-url --hours 48 --format json

# chronological sweep, paginated
clipmem timeline --hours 24 --limit 25 --format json
clipmem timeline --hours 24 --limit 25 --cursor "" --format json

# recover an image
clipmem get 42 --format json
clipmem export 42 --item 0 --uti public.png --out ./clipboard.png
clipmem export 42 --item 0 --uti public.png --out ./clipboard.png --force

Reading the response

Read these JSON fields first; walk nested items[].representations[] only after a get call:

  • best_candidate.best_text — the flattened primary text.
  • best_candidate.urls — URL array (empty when none).
  • best_candidate.file_paths — file-URL array.
  • why_selected, best_match_confidence, alternatives (only on recall).
  • next_cursor, truncated — pagination state.
  • schema_version — pin to 2 for stability.

Full schema in references/json-schema.md.

Troubleshooting

If recall looks empty or weak, widen --hours, drop source filters, or switch to timeline / search. For setup issues, sandbox PATH problems, or binary-only snapshots, see references/troubleshooting.md.

Exit codes

0 success · 1 uncategorized runtime · 2 invalid args · 3 not found · 4 unsupported format · 5 database error · 6 platform error.

常见问题

能在 Windows 或 Linux 上用吗?
不能。clipmem 只读取 NSPasteboard,运行在 macOS 上。
查询返回为空可能是什么原因?
大多是后台捕获进程已停止。技能附带 setup 检查脚本和 `clipmem agents context --format json` 诊断命令,可以确认 watcher、二进制与数据库是否健康后再放宽搜索条件。
返回结果应该怎么解析?
每次查询都使用 `--format json`(高频枚举可改用 `--format toon`),信封稳定在 `schema_version: 2` 之下;分页通过 `next_cursor` 与 `truncated` 字段读取。

相关技能

在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。

作者 Iván552 次安装18 星标

Inspect, back up, search, export, and update OpenClaw long-term memory stored with MemoryOS. Use when Codex needs to manage MemoryOS memory files for an Open...

24 次安装

Privacy-first, self-hosted chat memory for OpenClaw — save and recall conversation history across sessions without any cloud dependency.

4 次安装1 星标

Use clip2md to configure an access token, save web pages or article URLs as Markdown clipping tasks, check remaining daily/permanent quota, query task status, and wait for clipping completion or failure. Use when the user mentions clip2md, 剪藏, clip, 保存网页为 Markdown, 查询额度, 提交链接, 查询任务, 等待剪藏完成, or wants

Build and drill spaced-repetition packs with recallit — turn a PDF, URL, repo, or plain concept into honest, source-grounded flashcards, then run the daily r...

2 次安装

curates and archives durable organizational memory from project progress, meeting notes, feishu chat content, user clarifications, and markdown materials. us...

7 次安装