clipmem 0.2.8

macOS clipboard memory backed by SQLite and searchable from OpenClaw
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# Command reference

Exhaustive flag-level reference for every `clipmem` command and
subcommand. For conceptual explanations and usage guidance, see
[searching and filtering](searching-and-filtering.md),
[output formats](output-formats.md), and
[managing your archive](managing-your-archive.md).

## Subcommand overview

| Command | Default format | Supports `toon`? | Purpose |
|---|---|---|---|
| `recall [QUERY]` | `md` | yes | Ranked best-first answer with alternatives |
| `search <QUERY>` | `text` | yes | Lexical / FTS match over the archive |
| `recent` | `text` | yes | Recent unique snapshots (deduplicated) |
| `timeline` | `text` | yes | Chronological capture events (not deduplicated) |
| `stats` | `text` | no | Archive aggregates and leaderboards |
| `get <ID>` | `text` | no | Nested detail for one snapshot |
| `restore <ID>` | `text` || Restore a stored snapshot to the clipboard |
| `export <ID>` | raw bytes || Write one representation to disk |
| `forget <ID>` | `text` || Hard-delete one snapshot and its history |
| `purge` | `text` || Delete old snapshots by age |
| `settings show` | `text` | no | Show capture policy |
| `settings pause` | `text` || Pause or resume capture |
| `settings api-key-filter` | `text` || Enable or disable API key filtering |
| `settings retention` | `text` || Set retention duration |
| `settings ignore` | `text` | no | Manage ignored bundle IDs |
| `setup` ||| Initialize and start background capture |
| `service start` ||| Start background capture |
| `service stop` ||| Stop background capture |
| `service status` | `text` || Report watcher state and freshness |
| `service uninstall` ||| Remove managed service definition |
| `watch` ||| Continuous foreground polling |
| `capture-once` ||| Single clipboard capture |
| `doctor` | `text` || SQLite and FTS5 diagnostics |
| `agents openclaw install-skill` ||| Install packaged skill |
| `agents openclaw uninstall-skill` ||| Remove installed skill |
| `agents openclaw print-skill` ||| Print SKILL.md to stdout |
| `agents openclaw doctor` | `text` || Integration health check |

## Global flags

- `--db <path>` — override the SQLite database path. Default:
  `~/Library/Application Support/clipmem/clipmem.sqlite3`.

## Shared retrieval filters

These flags are accepted by `search`, `recent`, `timeline`, `stats`,
`recall`, `get`, and `export`:

| Flag | Type | Description |
|---|---|---|
| `--since <RFC3339>` | timestamp | Captures at or after this time |
| `--until <RFC3339>` | timestamp | Captures at or before this time |
| `--hours <N>` | integer | Last N hours (ignored if `--since` set) |
| `--app <name>` | string | Case-insensitive substring match on app name |
| `--bundle-id <id>` | string | Case-insensitive exact match on bundle ID |
| `--kind <type>` | enum | `text`, `html`, `rtf`, `url`, `file`, `image`, `pdf`, `binary`, `other` |
| `--has-text` | flag | Require non-empty text representation |
| `--has-url` | flag | Require URL representation |
| `--has-file-url` | flag | Require file URL representation |
| `--has-image` | flag | Require image representation |
| `--has-pdf` | flag | Require PDF representation |
| `--min-bytes <N>` | integer | Minimum snapshot byte count |
| `--max-bytes <N>` | integer | Maximum snapshot byte count |

---

## Retrieval commands

### `clipmem recall [QUERY]`

Best-first ranked answer with alternatives.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `md\|json\|toon` | `md` | Output format |
| `--mode` | `auto\|fts\|literal` | `auto` | Search mode |
| `--limit` | 1-250 | 5 | Ranked candidates to consider |
| `--full` | flag || Expand best candidate text |
| `--quote` | flag || Force quoted best-text output |
| `--min-score` | 0.0-1.0 || Minimum match score threshold |
| `--prefer-recent` | flag || Bias ranking toward recency |
| `--prefer-app` | string || Bias toward matching app |
| + shared filters | | | |

```bash
clipmem recall "what was that command I copied?"
clipmem recall "find the URL" --format json
clipmem recall --prefer-recent --hours 24
clipmem recall "exact text" --quote --full
```

### `clipmem search <QUERY>`

Direct lexical matching over stored text.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json\|jsonl\|md\|toon` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |
| `--mode` | `auto\|fts\|literal` | `auto` | Search mode |
| `--limit` | 1-250 | 10 | Page size |
| `--cursor` | string || Resume from prior `next_cursor` |
| + shared filters | | | |

```bash
clipmem search "git commit -m"
clipmem search "https://example.com" --format json
clipmem search --mode literal "foo:bar"
clipmem search --mode fts "\"launchctl\" AND bootstrap"
```

### `clipmem recent`

Recent unique clipboard states, deduplicated by snapshot.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json\|jsonl\|md\|toon` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |
| `--limit` | 1-250 | 10 | Page size |
| `--cursor` | string || Resume from prior `next_cursor` |
| + shared filters | | | |

```bash
clipmem recent
clipmem recent --hours 24 --app safari
clipmem recent --format json --limit 25 --cursor "<next_cursor>"
```

### `clipmem timeline`

Chronological capture events, one row per observation.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json\|jsonl\|md\|toon` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |
| `--sort` | `asc\|desc` | `desc` | Chronological sort order |
| `--limit` | 1-250 | 10 | Page size |
| `--cursor` | string || Resume from prior `next_cursor` |
| + shared filters | | | |

```bash
clipmem timeline --hours 24
clipmem timeline --sort asc --format json
clipmem timeline --app safari --has-url --limit 25 --format json
```

### `clipmem stats`

Archive aggregates and leaderboards for matching captures and
snapshots.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |
| + shared filters | | | |

```bash
clipmem stats
clipmem stats --hours 24
clipmem stats --app safari --format json
```

### `clipmem get <SNAPSHOT_ID>`

Nested item/representation detail for a single snapshot.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json\|jsonl\|md` | `text` | Output format (no `toon`) |
| `--json` | flag || Alias for `--format json` |
| `--events` | 1-250 | 10 | Recent capture events to include |
| + shared filters | | | |

```bash
clipmem get 42
clipmem get 42 --format json
clipmem get 42 --events 25 --format md
```

---

## Action commands

### `clipmem restore <SNAPSHOT_ID>`

Restore the full stored snapshot back onto the macOS clipboard.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |

```bash
clipmem restore 42
clipmem restore 42 --format json
```

### `clipmem export <SNAPSHOT_ID>`

Write one stored representation as raw bytes to a file.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--item` | integer | required | 0-based item index |
| `--uti` | string | required | Representation UTI |
| `--out` | path | required | Destination file path |
| `--force` | flag || Replace existing regular file |
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |
| + shared filters | | | |

```bash
clipmem export 42 --item 0 --uti public.png --out ./clipboard.png
clipmem export 42 --item 0 --uti public.png --out ./clipboard.png \
  --force
clipmem export 42 --item 0 --uti public.png --out ./clipboard.png \
  --format json
```

### `clipmem forget <SNAPSHOT_ID>`

Irreversibly delete one snapshot and its capture history.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |

```bash
clipmem forget 42
clipmem forget 42 --format json
```

### `clipmem purge`

Delete snapshots older than a given duration.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--older-than` | duration | required | Age threshold (`Nd`, `Nh`, `Nm`) |
| `--dry-run` | flag || Preview without deleting |
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |

```bash
clipmem purge --older-than 30d
clipmem purge --older-than 12h --dry-run
clipmem purge --older-than 30d --dry-run --format json
```

---

## Management commands

### `clipmem setup`

Initialize the database, seed one capture, and start background
capture.

```bash
clipmem setup
clipmem setup --db /tmp/clipmem.sqlite3
```

Re-running `setup` is safe and updates the managed service definition.

### `clipmem service start`

Start background capture using the preferred service provider.

### `clipmem service stop`

Stop background capture without uninstalling the service definition.

### `clipmem service status`

Report provider state, freshness, and service wiring.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--json` | flag || Emit status as JSON |

```bash
clipmem service status
clipmem service status --json
```

### `clipmem service uninstall`

Remove the managed service definition.

### `clipmem watch`

Continuously poll the clipboard and archive observed changes.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--interval-ms` | integer | 400 | Poll interval in milliseconds |
| `--quiet` | flag || Suppress per-capture status lines |
| `--skip-initial` | flag || Skip the already-present clipboard state |

```bash
clipmem watch
clipmem watch --interval-ms 350
clipmem watch --skip-initial --quiet
```

Intervals below 50ms are clamped to 50ms at runtime.

### `clipmem capture-once`

Capture the current clipboard state once.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--json` | flag || Emit captured snapshot as JSON |

```bash
clipmem capture-once
clipmem capture-once --json
```

---

## Settings commands

### `clipmem settings show`

Show the current capture policy.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |

### `clipmem settings pause <on|off>`

Persistently pause (`on`) or resume (`off`) capture.

### `clipmem settings api-key-filter <on|off>`

Enable (`on`) or disable (`off`) API key filtering.

### `clipmem settings retention <duration|forever>`

Set retention to a duration (`30d`, `12h`, `15m`) or `forever` to
disable automatic pruning.

### `clipmem settings ignore add <BUNDLE_ID>`

Add a bundle ID to the ignore list.

### `clipmem settings ignore remove <BUNDLE_ID>`

Remove a bundle ID from the ignore list.

### `clipmem settings ignore list`

List ignored bundle IDs.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--format` | `text\|json` | `text` | Output format |
| `--json` | flag || Alias for `--format json` |

---

## Diagnostics

### `clipmem doctor`

Print SQLite and FTS5 diagnostics.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--json` | flag || Emit diagnostics as JSON |

```bash
clipmem doctor
clipmem doctor --json
```

A nonzero exit code means required checks failed.

---

## Agent integration

### `clipmem agents openclaw install-skill`

Install the packaged clipboard-memory skill into OpenClaw.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--shared` | flag || Install to shared directory (`~/.openclaw/skills/`) |
| `--dest` | path || Install to a specific directory |
| `--force` | flag || Replace an existing skill directory |

```bash
clipmem agents openclaw install-skill
clipmem agents openclaw install-skill --shared
clipmem agents openclaw install-skill --dest /path/to/skill --force
```

### `clipmem agents openclaw uninstall-skill`

Remove an installed skill directory.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--shared` | flag || Remove from shared directory |
| `--dest` | path || Remove from a specific directory |

### `clipmem agents openclaw print-skill`

Print the packaged SKILL.md to stdout for inspection.

### `clipmem agents openclaw doctor`

Check host PATH, installed skill state, and sandbox guidance.

| Flag | Type | Default | Description |
|---|---|---|---|
| `--shared` | flag || Check shared directory |
| `--dest` | path || Check a specific directory |

```bash
clipmem agents openclaw doctor
clipmem agents openclaw doctor --shared
```

A nonzero exit code means required integration checks failed.

---

## Environment variables

- `CLIPMEM_OPENCLAW_WORKSPACE` — overrides the OpenClaw workspace root
  used by `agents openclaw install-skill` and `agents openclaw doctor`.
  Falls back to `openclaw config get agents.defaults.workspace`, then
  `~/.openclaw/workspace`.
- `HOME` — resolves `~/` in default paths.

## Exit codes

| Code | Meaning |
|---|---|
| `0` | Success |
| `1` | Uncategorized runtime failure |
| `2` | Invalid arguments |
| `3` | Not found |
| `4` | Unsupported format for this subcommand |
| `5` | Database error |
| `6` | Platform error (macOS API or filesystem) |