agentrem 1.5.2 → 1.6.1

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/llms-full.txt CHANGED
@@ -1,5 +1,7 @@
1
1
  # agentrem — Full API Reference
2
2
 
3
+ SQLite-backed structured reminders for AI agents.
4
+
3
5
  ## Installation
4
6
 
5
7
  ```bash
@@ -22,6 +24,8 @@ agentrem init # Create ~/.agentrem/reminders.db
22
24
  agentrem init --force # Recreate (backs up existing)
23
25
  ```
24
26
 
27
+ ---
28
+
25
29
  ### agentrem add <content>
26
30
 
27
31
  Create a reminder.
@@ -35,15 +39,15 @@ Create a reminder.
35
39
  | `--context, -c <ctx>` | Additional context string | `--context "PR #42 needs review"` |
36
40
  | `--category <cat>` | Category | `--category work` |
37
41
  | `--keywords, -k <kw>` | Keywords for keyword trigger | `--keywords "deploy,release,ship"` |
38
- | `--match <mode>` | Keyword match mode: any/all/regex | `--match any` |
42
+ | `--match <mode>` | Keyword match mode: any/all/regex (default: any) | `--match any` |
39
43
  | `--check <cmd>` | Shell command for condition trigger | `--check "curl -s http://localhost:3000/health"` |
40
44
  | `--expect <output>` | Expected output for condition trigger | `--expect "ok"` |
41
45
  | `--decay <datetime>` | Auto-expire after this datetime | `--decay "+7d"` |
42
46
  | `--max-fires <n>` | Auto-complete after N triggers | `--max-fires 3` |
43
47
  | `--recur, -r <rule>` | Recurrence: 1d, 2d, 1w, 2w, 1m | `--recur 1w` |
44
- | `--agent, -a <name>` | Agent namespace | `--agent jarvis` |
45
- | `--depends-on <id>` | Dependency reminder ID | `--depends-on abc12345` |
46
- | `--source <src>` | Source: agent/user/system | `--source user` |
48
+ | `--agent, -a <name>` | Agent namespace (default: main) | `--agent jarvis` |
49
+ | `--depends-on <id>` | Dependency reminder ID (waits until it's completed) | `--depends-on abc12345` |
50
+ | `--source <src>` | Source: agent/user/system (default: agent) | `--source user` |
47
51
  | `--dry-run` | Preview without creating | |
48
52
 
49
53
  ```bash
@@ -57,23 +61,33 @@ agentrem add "Send report" --due "in 30 minutes"
57
61
  # Keyword trigger
58
62
  agentrem add "Review security" --trigger keyword --keywords "deploy,release" --match any
59
63
 
60
- # Session reminder
61
- agentrem add "Check CI" --trigger session
64
+ # Session reminder (fires every check --type session)
65
+ agentrem add "Check CI" --trigger session --priority 3
62
66
 
63
67
  # Recurring weekly
64
68
  agentrem add "Team sync prep" --due "2026-02-24T09:00:00" --recur 1w
65
69
 
66
- # With dependency
70
+ # With dependency (Deploy won't surface until abc12345 is completed)
67
71
  agentrem add "Deploy" --due "+4h" --depends-on abc12345
68
72
 
69
73
  # With auto-expire
70
74
  agentrem add "Sale ends soon" --due "+1h" --decay "+24h"
75
+
76
+ # Condition trigger (fires when shell command returns expected output)
77
+ agentrem add "Service is down" --trigger condition --check "curl -s http://localhost:3000/health" --expect "ok"
78
+
79
+ # Dry run — preview without creating
80
+ agentrem add "Test" --due "+1h" --dry-run
71
81
  ```
72
82
 
83
+ ---
84
+
73
85
  ### agentrem check
74
86
 
75
87
  Check for triggered reminders. This is the primary integration command.
76
88
 
89
+ #### One-shot mode (default)
90
+
77
91
  | Flag | Description |
78
92
  |------|-------------|
79
93
  | `--type <types>` | Comma-separated trigger types to check |
@@ -81,51 +95,154 @@ Check for triggered reminders. This is the primary integration command.
81
95
  | `--budget <n>` | Token budget limit (default: 800) |
82
96
  | `--format <fmt>` | Output format: full/compact/inline |
83
97
  | `--json` | Output structured JSON |
84
- | `--agent, -a <name>` | Agent namespace |
98
+ | `--agent, -a <name>` | Agent namespace (default: main) |
85
99
  | `--escalate` | Run escalation (P3→P2 after 48h, P2→P1 after 24h) |
86
100
  | `--dry-run` | Preview without updating fire counts |
87
101
 
88
102
  ```bash
89
- agentrem check # All triggers
90
- agentrem check --type time,session --budget 800 # Session start
103
+ agentrem check # All triggers
104
+ agentrem check --type time,session --budget 800 # Session start
91
105
  agentrem check --type keyword --text "deploy now" # Keyword scan
92
106
  agentrem check --escalate # With escalation
93
107
  agentrem check --json # Structured output
108
+ agentrem check --format compact # One-line summary
109
+ agentrem check --format inline # Ultra-compact
94
110
  ```
95
111
 
96
- JSON output example:
112
+ JSON output example (`agentrem check --json`):
97
113
  ```json
98
114
  {
99
115
  "included": [
100
116
  {
101
- "id": "8f103c9c12345678",
117
+ "id": "8f103c9c-1234-5678-abcd-ef0123456789",
102
118
  "content": "Deploy v2",
119
+ "context": null,
103
120
  "trigger_type": "time",
104
121
  "trigger_at": "2026-02-21T15:00:00",
105
122
  "priority": 2,
106
123
  "tags": "deploy",
124
+ "category": null,
107
125
  "status": "active",
108
- "fire_count": 1
126
+ "snoozed_until": null,
127
+ "decay_at": null,
128
+ "fire_count": 1,
129
+ "last_fired": "2026-02-21T15:00:05",
130
+ "max_fires": null,
131
+ "recur_rule": null,
132
+ "depends_on": null,
133
+ "source": "agent",
134
+ "agent": "main",
135
+ "created_at": "2026-02-21T12:00:00",
136
+ "updated_at": "2026-02-21T15:00:05",
137
+ "completed_at": null,
138
+ "notes": null
109
139
  }
110
140
  ],
111
- "overflowCounts": { "2": 0, "3": 0, "4": 1 }
141
+ "overflowCounts": { "1": 0, "2": 0, "3": 0, "4": 1, "5": 0 },
142
+ "totalTriggered": 2
112
143
  }
113
144
  ```
114
145
 
146
+ #### check --watch (blocking mode)
147
+
148
+ Blocks until the next due reminder fires. Does NOT update fire counts or change any state — it only surfaces what is due. Use a regular `agentrem check` after to actually mark reminders as fired.
149
+
150
+ | Flag | Description |
151
+ |------|-------------|
152
+ | `--watch` | Enable blocking watch mode |
153
+ | `--timeout <seconds>` | Seconds before giving up. If no reminder fires, exits with code 1. Omit for indefinite wait. |
154
+ | `--json` | Output full reminder JSON instead of human-readable text |
155
+ | `--type <types>` | Trigger type filter (default: `time`) |
156
+ | `--agent, -a <name>` | Agent filter (default: `main`) |
157
+
158
+ ```bash
159
+ # Wait indefinitely for next time trigger
160
+ agentrem check --watch
161
+
162
+ # Exit 1 if nothing fires within 5 minutes
163
+ agentrem check --watch --timeout 300
164
+
165
+ # Structured JSON output (full Reminder object)
166
+ agentrem check --watch --json
167
+
168
+ # Filter trigger types
169
+ agentrem check --watch --type time,heartbeat
170
+
171
+ # Filter by agent
172
+ agentrem check --watch --agent jarvis --timeout 60
173
+ ```
174
+
175
+ **Exit codes:**
176
+ - `0` — A reminder fired (output on stdout), OR SIGINT/SIGTERM received (no output)
177
+ - `1` — `--timeout` elapsed with no reminder found
178
+
179
+ **Human-readable output (without --json):**
180
+ ```
181
+ 🔔 Reminder due: "Deploy v2" (P2, due 5m ago)
182
+ ```
183
+
184
+ **JSON output (`--watch --json`):** Full Reminder object (same schema as `agentrem list --json` entries):
185
+ ```json
186
+ {
187
+ "id": "8f103c9c-1234-5678-abcd-ef0123456789",
188
+ "content": "Deploy v2",
189
+ "context": null,
190
+ "trigger_type": "time",
191
+ "trigger_at": "2026-02-22T09:00:00",
192
+ "priority": 2,
193
+ "tags": "deploy",
194
+ "category": null,
195
+ "status": "active",
196
+ "snoozed_until": null,
197
+ "decay_at": null,
198
+ "fire_count": 0,
199
+ "last_fired": null,
200
+ "max_fires": null,
201
+ "recur_rule": null,
202
+ "recur_parent_id": null,
203
+ "depends_on": null,
204
+ "related_ids": null,
205
+ "source": "agent",
206
+ "agent": "main",
207
+ "created_at": "2026-02-22T08:00:00",
208
+ "updated_at": "2026-02-22T08:00:00",
209
+ "completed_at": null,
210
+ "notes": null
211
+ }
212
+ ```
213
+
214
+ **Implementation details:**
215
+ - Polls the database every 5 seconds
216
+ - First poll is immediate — returns instantly if a reminder is already due
217
+ - Handles SIGINT/SIGTERM cleanly (exits 0, no output)
218
+ - Only surfaces `time` trigger type by default; use `--type` to include others
219
+ - Does not modify reminders in any way
220
+
221
+ **Usage pattern (poll-then-act):**
222
+ ```bash
223
+ # Wait for a reminder, then act on it
224
+ if agentrem check --watch --timeout 120 --json > /tmp/due.json; then
225
+ cat /tmp/due.json # full reminder object
226
+ agentrem check # now actually mark it as fired
227
+ fi
228
+ ```
229
+
230
+ ---
231
+
115
232
  ### agentrem list
116
233
 
117
234
  List reminders with filters.
118
235
 
119
236
  | Flag | Description |
120
237
  |------|-------------|
121
- | `--status, -s <statuses>` | Filter by status (comma-separated) |
238
+ | `--status, -s <statuses>` | Filter by status: active/snoozed/completed/expired/deleted/failed (comma-separated) |
122
239
  | `--priority <priorities>` | Filter by priority (comma-separated) |
123
- | `--tag <tag>` | Filter by tag |
240
+ | `--tag <tag>` | Filter by tag (substring match) |
124
241
  | `--trigger <type>` | Filter by trigger type |
125
- | `--due <filter>` | Due filter: today/tomorrow/overdue/week/date |
126
- | `--agent, -a <name>` | Agent namespace |
242
+ | `--due <filter>` | Due filter: today/tomorrow/overdue/week/\<date\> |
243
+ | `--agent, -a <name>` | Agent namespace (default: main) |
127
244
  | `--category <cat>` | Category filter |
128
- | `--limit <n>` | Max results |
245
+ | `--limit <n>` | Max results (default: 20) |
129
246
  | `--format <fmt>` | Output: table/json/compact |
130
247
  | `--json` | Output structured JSON |
131
248
  | `--all` | Include all statuses (not just active) |
@@ -135,42 +252,53 @@ agentrem list # All active
135
252
  agentrem list --priority 1,2 # Critical + High
136
253
  agentrem list --tag deploy # By tag
137
254
  agentrem list --due overdue # Overdue only
255
+ agentrem list --due today # Due today
256
+ agentrem list --status snoozed # Snoozed only
257
+ agentrem list --all # All statuses
138
258
  agentrem list --json # Structured output
139
259
  agentrem list --format compact # One line per reminder
260
+ agentrem list --limit 50 # More results
140
261
  ```
141
262
 
263
+ ---
264
+
142
265
  ### agentrem search <query>
143
266
 
144
- Full-text search across content, context, tags, and notes.
267
+ Full-text search across content, context, tags, and notes (SQLite FTS5).
145
268
 
146
269
  | Flag | Description |
147
270
  |------|-------------|
148
- | `--status <statuses>` | Filter by status |
149
- | `--limit <n>` | Max results |
271
+ | `--status <statuses>` | Filter by status (default: active) |
272
+ | `--limit <n>` | Max results (default: 10) |
150
273
  | `--format <fmt>` | Output: table/json |
151
274
  | `--json` | Output structured JSON |
152
275
 
153
276
  ```bash
154
277
  agentrem search "deploy staging"
155
278
  agentrem search "deploy" --json
279
+ agentrem search "PR review" --status active,snoozed --limit 20
156
280
  ```
157
281
 
282
+ ---
283
+
158
284
  ### agentrem complete <id>
159
285
 
160
286
  Mark a reminder as completed. If it has `--recur`, automatically creates the next instance.
161
287
 
162
288
  | Flag | Description |
163
289
  |------|-------------|
164
- | `--notes <text>` | Completion notes |
290
+ | `--notes <text>` | Completion notes (appended to existing notes) |
165
291
 
166
292
  ```bash
167
293
  agentrem complete 8f103c9c
168
294
  agentrem complete 8f103c9c --notes "Deployed successfully"
169
295
  ```
170
296
 
297
+ ---
298
+
171
299
  ### agentrem snooze <id>
172
300
 
173
- Snooze a reminder.
301
+ Snooze a reminder until a specific time or for a duration.
174
302
 
175
303
  | Flag | Description |
176
304
  |------|-------------|
@@ -179,50 +307,63 @@ Snooze a reminder.
179
307
 
180
308
  ```bash
181
309
  agentrem snooze abc12345 --for 2h
310
+ agentrem snooze abc12345 --for 1d
182
311
  agentrem snooze abc12345 --until "tomorrow"
312
+ agentrem snooze abc12345 --until "2026-02-25T09:00:00"
183
313
  ```
184
314
 
315
+ ---
316
+
185
317
  ### agentrem edit <id>
186
318
 
187
- Edit reminder fields.
319
+ Edit one or more reminder fields.
188
320
 
189
321
  | Flag | Description |
190
322
  |------|-------------|
191
323
  | `--content <text>` | New content |
192
324
  | `--context <ctx>` | New context |
193
- | `--priority, -p <n>` | New priority |
325
+ | `--priority, -p <n>` | New priority (1-5) |
194
326
  | `--due, -d <datetime>` | New due date (natural language or ISO) |
195
327
  | `--tags <tags>` | Replace all tags |
196
- | `--add-tags <tags>` | Add tags |
197
- | `--remove-tags <tags>` | Remove tags |
328
+ | `--add-tags <tags>` | Add tags (merges with existing) |
329
+ | `--remove-tags <tags>` | Remove specific tags |
198
330
  | `--category <cat>` | New category |
199
331
  | `--decay <datetime>` | New decay date |
200
332
  | `--max-fires <n>` | New max fires |
201
- | `--keywords, -k <kw>` | New keywords |
202
- | `--agent, -a <name>` | New agent |
333
+ | `--keywords, -k <kw>` | New keywords (for keyword trigger) |
334
+ | `--agent, -a <name>` | Move to different agent |
203
335
 
204
336
  ```bash
205
337
  agentrem edit abc12345 --priority 1
206
338
  agentrem edit abc12345 --due "+4h" --add-tags "urgent"
207
339
  agentrem edit abc12345 --due "in 2 hours"
340
+ agentrem edit abc12345 --content "Updated task description"
341
+ agentrem edit abc12345 --tags "deploy,prod" # replace all tags
342
+ agentrem edit abc12345 --add-tags "critical" # add to existing
343
+ agentrem edit abc12345 --remove-tags "low-priority" # remove specific
208
344
  ```
209
345
 
346
+ ---
347
+
210
348
  ### agentrem delete [id]
211
349
 
212
- Delete a reminder (soft delete by default).
350
+ Delete a reminder (soft delete by default — recoverable via `undo`).
213
351
 
214
352
  | Flag | Description |
215
353
  |------|-------------|
216
354
  | `--permanent` | Hard delete (cannot be undone) |
217
355
  | `--status <status>` | Bulk delete by status |
218
- | `--older-than <days>` | Delete older than N days |
356
+ | `--older-than <days>` | Combined with `--status` to filter by age |
219
357
 
220
358
  ```bash
221
- agentrem delete abc12345 # Soft delete
359
+ agentrem delete abc12345 # Soft delete (recoverable)
222
360
  agentrem delete abc12345 --permanent # Hard delete
223
- agentrem delete --status expired # Bulk delete expired
361
+ agentrem delete --status expired # Bulk soft-delete all expired
362
+ agentrem delete --status completed --older-than 30 # Bulk delete old completed
224
363
  ```
225
364
 
365
+ ---
366
+
226
367
  ### agentrem stats
227
368
 
228
369
  Show statistics.
@@ -240,21 +381,29 @@ JSON output example:
240
381
  ```json
241
382
  {
242
383
  "totalActive": 12,
243
- "byPriority": [{"priority": 1, "count": 2, "label": "critical"}, {"priority": 3, "count": 10, "label": "normal"}],
384
+ "byPriority": [
385
+ {"priority": 1, "count": 2, "label": "critical"},
386
+ {"priority": 3, "count": 10, "label": "normal"}
387
+ ],
244
388
  "overdue": 1,
245
389
  "snoozed": 0,
246
390
  "completedWeek": 5,
247
391
  "expired": 0,
248
- "byTrigger": [{"type": "time", "count": 8}, {"type": "session", "count": 4}],
392
+ "byTrigger": [
393
+ {"type": "time", "count": 8},
394
+ {"type": "session", "count": 4}
395
+ ],
249
396
  "nextDue": {"content": "Deploy v2", "triggerAt": "2026-02-21T15:00:00"},
250
397
  "lastCreated": "2026-02-21T12:00:00",
251
398
  "dbSizeBytes": 65536
252
399
  }
253
400
  ```
254
401
 
402
+ ---
403
+
255
404
  ### agentrem history [id]
256
405
 
257
- View audit trail.
406
+ View audit trail of reminder changes.
258
407
 
259
408
  | Flag | Description |
260
409
  |------|-------------|
@@ -266,20 +415,25 @@ View audit trail.
266
415
  agentrem history # All recent
267
416
  agentrem history abc12345 # For specific reminder
268
417
  agentrem history --json # Structured output
418
+ agentrem history --limit 50
269
419
  ```
270
420
 
421
+ ---
422
+
271
423
  ### agentrem undo <history_id>
272
424
 
273
425
  Revert a specific change from the audit history.
274
426
 
275
427
  ```bash
276
- agentrem history abc12345 # Find the history ID
277
- agentrem undo 42 # Revert change #42
428
+ agentrem history abc12345 # Find the history ID
429
+ agentrem undo 42 # Revert change #42
278
430
  ```
279
431
 
432
+ ---
433
+
280
434
  ### agentrem gc
281
435
 
282
- Garbage collect old completed/expired/deleted reminders.
436
+ Garbage collect old completed/expired/deleted reminders and VACUUM the database.
283
437
 
284
438
  | Flag | Description |
285
439
  |------|-------------|
@@ -292,29 +446,36 @@ agentrem gc --older-than 7 # Remove >7 days old
292
446
  agentrem gc --dry-run # Preview
293
447
  ```
294
448
 
449
+ ---
450
+
295
451
  ### agentrem export / import
296
452
 
297
453
  ```bash
298
- agentrem export # Export to ~/.agentrem/export-TIMESTAMP.json
299
- agentrem export --out backup.json # Export to specific file
300
- agentrem import backup.json # Import
301
- agentrem import backup.json --merge # Skip duplicates
302
- agentrem import backup.json --replace # Replace all
303
- agentrem import backup.json --dry-run # Preview
454
+ agentrem export # Export to ~/.agentrem/export-TIMESTAMP.json
455
+ agentrem export --out backup.json # Export to specific file
456
+ agentrem export --status active # Export only active reminders
457
+ agentrem import backup.json # Import (default: overwrite)
458
+ agentrem import backup.json --merge # Skip duplicates
459
+ agentrem import backup.json --replace # Replace all existing
460
+ agentrem import backup.json --dry-run # Preview import
304
461
  ```
305
462
 
463
+ ---
464
+
306
465
  ### agentrem setup
307
466
 
308
467
  Print integration snippets.
309
468
 
310
469
  ```bash
311
- agentrem setup # Print CLAUDE.md snippet
312
- agentrem setup --mcp # Print Claude Desktop MCP config
470
+ agentrem setup # Print CLAUDE.md / AGENTS.md snippet
471
+ agentrem setup --mcp # Print Claude Desktop MCP config JSON
313
472
  ```
314
473
 
474
+ ---
475
+
315
476
  ### agentrem doctor
316
477
 
317
- Self-diagnostic command. Checks that the database exists and is healthy, schema is valid, and warns about overdue reminders or large DB size.
478
+ Self-diagnostic. Checks DB exists, schema is valid, warns about overdue reminders and large DB size.
318
479
 
319
480
  | Flag | Description |
320
481
  |------|-------------|
@@ -350,29 +511,17 @@ JSON output example:
350
511
  }
351
512
  ```
352
513
 
514
+ ---
515
+
353
516
  ### agentrem quickstart
354
517
 
355
- Interactive first-run walkthrough. Initializes the database (if needed), creates a sample reminder, runs a check, and cleans up — confirming everything works.
518
+ Interactive first-run walkthrough. Initializes the database (if needed), creates a sample reminder, runs a check, and cleans up.
356
519
 
357
520
  ```bash
358
521
  agentrem quickstart
359
522
  ```
360
523
 
361
- Output:
362
- ```
363
- 📦 Step 1/4: Initializing database...
364
- 📝 Step 2/4: Creating a sample reminder...
365
- 🔔 Step 3/4: Checking triggered reminders...
366
- ✅ Step 4/4: Completing the test reminder...
367
-
368
- 🎉 Quickstart complete! agentrem is working.
369
-
370
- Next steps:
371
- agentrem add "My first real reminder" --due "+1h" --priority 2
372
- agentrem check
373
- agentrem setup # Get your CLAUDE.md snippet
374
- agentrem doctor # Run diagnostics anytime
375
- ```
524
+ ---
376
525
 
377
526
  ### agentrem watch
378
527
 
@@ -387,6 +536,8 @@ Background daemon that polls for due reminders and fires native OS notifications
387
536
  | `--install` | Install as OS background service (launchd on macOS, systemd on Linux) |
388
537
  | `--uninstall` | Remove the background service |
389
538
  | `--status` | Show service status |
539
+ | `--on-fire <command>` | Execute shell command when a reminder fires (env vars: AGENTREM_ID, AGENTREM_CONTENT, AGENTREM_PRIORITY, AGENTREM_TAGS, AGENTREM_CONTEXT, AGENTREM_DUE, AGENTREM_FIRE_COUNT) |
540
+ | `--on-fire-timeout <ms>` | Timeout for on-fire command (default: 5000) |
390
541
 
391
542
  ```bash
392
543
  # Run in foreground
@@ -405,8 +556,8 @@ agentrem watch --status # Show installed/running status
405
556
 
406
557
  #### How polling works
407
558
 
408
- - Runs `coreCheck` with types `time,heartbeat,session,condition` and `--escalate` on every tick
409
- - Per-reminder **dedup cooldown**: once a reminder is notified, it won't fire again for 5 minutes
559
+ - Runs check with types `time,heartbeat,session,condition` and escalation on every tick
560
+ - Per-reminder **dedup cooldown**: once notified, won't fire again for 5 minutes
410
561
  - Handles SIGINT/SIGTERM for clean shutdown
411
562
  - First check runs immediately on start
412
563
 
@@ -415,7 +566,6 @@ agentrem watch --status # Show installed/running status
415
566
  **macOS (launchd):**
416
567
  - Writes a LaunchAgent plist to `~/Library/LaunchAgents/com.agentrem.watch.plist`
417
568
  - Logs to `~/.agentrem/logs/watch.log` and `watch.error.log`
418
- - Service label: `com.agentrem.watch`
419
569
  - `KeepAlive: true` — restarts automatically on crash
420
570
 
421
571
  **Linux (systemd):**
@@ -433,17 +583,262 @@ agentrem watch --status # Show installed/running status
433
583
  Detail: launchctl: ...
434
584
  ```
435
585
 
436
- #### watch --once (single check)
586
+ #### watch --on-fire (hooks)
437
587
 
438
- Useful in scripts or cron jobs to check once and exit. Combine with `--verbose` to see what fired:
588
+ Execute a shell command whenever a reminder fires. Reminder data is passed via environment variables (never interpolated into the command string — safe from shell injection).
439
589
 
440
590
  ```bash
441
- agentrem watch --once --verbose
442
- # [agentrem watch] started interval=30s agent=main
443
- # [agentrem watch] 🔔 [8f103c9c] Deploy v2
444
- # [agentrem watch] checked at 2026-02-22T09:00:00.000Z — 1 triggered, 1 notified
591
+ # Forward to OpenClaw for instant Telegram delivery
592
+ agentrem watch --on-fire 'openclaw system event --text "🔔 Reminder: $AGENTREM_CONTENT (P$AGENTREM_PRIORITY)" --mode now'
593
+
594
+ # Webhook
595
+ agentrem watch --on-fire 'curl -X POST -d "{\"text\":\"$AGENTREM_CONTENT\"}" https://hooks.example.com/reminder'
596
+
597
+ # Custom timeout (default 5s)
598
+ agentrem watch --on-fire 'my-slow-script.sh' --on-fire-timeout 15000
445
599
  ```
446
600
 
601
+ - **Fire-and-forget:** errors logged to `~/.agentrem/logs/on-fire.log`, never crash the watcher
602
+ - **Sequential:** multiple reminders process one at a time
603
+ - **Env vars:** `AGENTREM_ID`, `AGENTREM_CONTENT`, `AGENTREM_PRIORITY`, `AGENTREM_TAGS`, `AGENTREM_CONTEXT`, `AGENTREM_DUE`, `AGENTREM_FIRE_COUNT`
604
+
605
+ ---
606
+
607
+ ### agentrem schema
608
+
609
+ Print the database schema (useful for debugging).
610
+
611
+ ```bash
612
+ agentrem schema
613
+ ```
614
+
615
+ ---
616
+
617
+ ## Programmatic JavaScript / TypeScript API
618
+
619
+ Import directly from the package. The DB is auto-initialized on first call.
620
+
621
+ ```bash
622
+ npm install agentrem
623
+ ```
624
+
625
+ ```typescript
626
+ import { add, check, list, complete, snooze, search, stats } from 'agentrem';
627
+ import type { Reminder, CheckResult, StatsResult } from 'agentrem';
628
+ ```
629
+
630
+ ### add(content, opts?)
631
+
632
+ Create a new reminder.
633
+
634
+ ```typescript
635
+ async function add(content: string, opts?: {
636
+ due?: string; // Natural language or ISO datetime
637
+ priority?: number; // 1-5 (default: 3)
638
+ tags?: string; // Comma-separated tags
639
+ agent?: string; // Agent namespace (default: 'main')
640
+ context?: string; // Additional context
641
+ trigger?: string; // time/keyword/session/heartbeat/condition/manual
642
+ category?: string;
643
+ keywords?: string; // Comma-separated, for keyword trigger
644
+ recur?: string; // Recurrence: 1d, 2w, 1m
645
+ }): Promise<Reminder>
646
+
647
+ // Example
648
+ const rem = await add('Review PR #42', { due: 'tomorrow', priority: 2, tags: 'pr,review' });
649
+ console.log(rem.id); // UUID
650
+ ```
651
+
652
+ ### check(opts?)
653
+
654
+ Check for triggered reminders within a token budget.
655
+
656
+ ```typescript
657
+ async function check(opts?: {
658
+ type?: string; // Comma-separated trigger types (default: all)
659
+ budget?: number; // Token budget (default: 800)
660
+ agent?: string; // Agent namespace (default: 'main')
661
+ format?: 'text' | 'json';
662
+ }): Promise<{
663
+ included: Reminder[]; // Reminders that fired within budget
664
+ overflowCounts: Record<number, number>; // Count of reminders outside budget by priority
665
+ totalTriggered: number; // Total triggered (before budget trim)
666
+ }>
667
+
668
+ // Example
669
+ const { included, totalTriggered } = await check({ type: 'time,session', budget: 500 });
670
+ for (const rem of included) {
671
+ console.log(`[${rem.priority}] ${rem.content}`);
672
+ }
673
+ ```
674
+
675
+ ### list(opts?)
676
+
677
+ List reminders.
678
+
679
+ ```typescript
680
+ async function list(opts?: {
681
+ filter?: string; // Tag substring filter (alias for tag)
682
+ agent?: string;
683
+ limit?: number; // default: 20
684
+ status?: string; // Comma-separated statuses (default: 'active')
685
+ priority?: string; // Comma-separated priorities
686
+ tag?: string; // Tag filter
687
+ }): Promise<Reminder[]>
688
+
689
+ // Example
690
+ const reminders = await list({ limit: 10, priority: '1,2' });
691
+ ```
692
+
693
+ ### complete(id, notes?)
694
+
695
+ Mark a reminder as completed.
696
+
697
+ ```typescript
698
+ async function complete(id: string, notes?: string): Promise<Reminder>
699
+
700
+ // Example
701
+ const done = await complete('abc12345', 'Deployed successfully');
702
+ console.log(done.completed_at);
703
+ ```
704
+
705
+ ### snooze(id, opts)
706
+
707
+ Snooze a reminder.
708
+
709
+ ```typescript
710
+ async function snooze(id: string, opts: { for: string }): Promise<Reminder>
711
+
712
+ // Example
713
+ const snoozed = await snooze('abc12345', { for: '2h' });
714
+ console.log(snoozed.snoozed_until);
715
+ ```
716
+
717
+ ### search(query, opts?)
718
+
719
+ Full-text search across content, context, tags, and notes.
720
+
721
+ ```typescript
722
+ async function search(query: string, opts?: {
723
+ limit?: number; // default: 10
724
+ agent?: string;
725
+ }): Promise<Reminder[]>
726
+
727
+ // Example
728
+ const results = await search('deploy staging', { limit: 5 });
729
+ ```
730
+
731
+ ### stats(opts?)
732
+
733
+ Get reminder statistics.
734
+
735
+ ```typescript
736
+ async function stats(opts?: { agent?: string }): Promise<{
737
+ totalActive: number;
738
+ byPriority: { priority: number; count: number; label: string }[];
739
+ overdue: number;
740
+ snoozed: number;
741
+ completedWeek: number;
742
+ expired: number;
743
+ byTrigger: { type: string; count: number }[];
744
+ nextDue: { content: string; triggerAt: string } | null;
745
+ lastCreated: string | null;
746
+ dbSizeBytes: number;
747
+ }>
748
+
749
+ // Example
750
+ const s = await stats();
751
+ console.log(`${s.totalActive} active, ${s.overdue} overdue`);
752
+ ```
753
+
754
+ ### Reminder type
755
+
756
+ ```typescript
757
+ interface Reminder {
758
+ id: string; // UUID
759
+ content: string;
760
+ context: string | null;
761
+ trigger_type: 'time' | 'keyword' | 'condition' | 'session' | 'heartbeat' | 'manual';
762
+ trigger_at: string | null; // ISO datetime string (YYYY-MM-DDTHH:MM:SS)
763
+ trigger_config: string | null; // JSON string for keyword/condition configs
764
+ priority: number; // 1-5
765
+ tags: string | null; // Comma-separated
766
+ category: string | null;
767
+ status: 'active' | 'snoozed' | 'completed' | 'expired' | 'failed' | 'deleted';
768
+ snoozed_until: string | null;
769
+ decay_at: string | null;
770
+ escalation: string | null;
771
+ fire_count: number;
772
+ last_fired: string | null;
773
+ max_fires: number | null;
774
+ recur_rule: string | null; // JSON string e.g. {"interval":1,"unit":"w"}
775
+ recur_parent_id: string | null;
776
+ depends_on: string | null;
777
+ related_ids: string | null;
778
+ source: string; // 'agent' | 'user' | 'system'
779
+ agent: string; // default: 'main'
780
+ created_at: string;
781
+ updated_at: string;
782
+ completed_at: string | null;
783
+ notes: string | null;
784
+ }
785
+ ```
786
+
787
+ ---
788
+
789
+ ## MCP Server
790
+
791
+ ```bash
792
+ agentrem-mcp # Start MCP server (stdio transport)
793
+ ```
794
+
795
+ 14 tools, 4 resources, 3 prompts.
796
+
797
+ ### Claude Desktop Config
798
+
799
+ ```json
800
+ {
801
+ "mcpServers": {
802
+ "agentrem": {
803
+ "command": "agentrem-mcp",
804
+ "args": []
805
+ }
806
+ }
807
+ }
808
+ ```
809
+
810
+ No global install:
811
+
812
+ ```json
813
+ {
814
+ "mcpServers": {
815
+ "agentrem": {
816
+ "command": "npx",
817
+ "args": ["-y", "agentrem", "mcp"]
818
+ }
819
+ }
820
+ }
821
+ ```
822
+
823
+ ### MCP Tools
824
+
825
+ | Tool | Description |
826
+ |------|-------------|
827
+ | `add_reminder` | Create a new reminder |
828
+ | `check_reminders` | Check for triggered reminders |
829
+ | `list_reminders` | List reminders with filters |
830
+ | `search_reminders` | Full-text search |
831
+ | `complete_reminder` | Complete a reminder (handles recurrence) |
832
+ | `snooze_reminder` | Snooze a reminder |
833
+ | `edit_reminder` | Edit reminder fields |
834
+ | `delete_reminder` | Delete (soft or hard) |
835
+ | `get_stats` | Get statistics |
836
+ | `get_history` | View audit trail |
837
+ | `undo_change` | Revert a change by history ID |
838
+ | `garbage_collect` | Clean up old reminders + VACUUM |
839
+ | `export_reminders` | Export as JSON |
840
+ | `import_reminders` | Import from JSON |
841
+
447
842
  ---
448
843
 
449
844
  ## Native Notifications
@@ -468,12 +863,10 @@ agentrem ships a custom Swift app (`Agentrem.app`) bundled in `assets/`. When pr
468
863
  | P3 Normal | Pop |
469
864
  | P4–P5 | (no sound) |
470
865
 
471
- ### Overdue Messages
472
-
473
- The notification subtitle changes based on how overdue a reminder is:
866
+ ### Overdue Messages (notification subtitle)
474
867
 
475
- | Overdue duration | Subtitle |
476
- |-----------------|----------|
868
+ | Overdue | Subtitle |
869
+ |---------|----------|
477
870
  | < 2 min | "just now" |
478
871
  | < 30 min | "X min ago" |
479
872
  | < 1 hour | "about an hour, no biggie" |
@@ -483,6 +876,8 @@ The notification subtitle changes based on how overdue a reminder is:
483
876
  | < 48 hours | "it's been a whole day, dude" |
484
877
  | 2+ days | "I've been here for N days. just saying." |
485
878
 
879
+ Notifications include a **Complete** button (macOS) that lets you complete the reminder from the notification banner without opening a terminal.
880
+
486
881
  ### Rebuilding Agentrem.app
487
882
 
488
883
  ```bash
@@ -493,7 +888,7 @@ npm run build:notify # Recompile Swift source in assets/notify-src/
493
888
 
494
889
  ## Date/Time Formats
495
890
 
496
- All date inputs (`--due`, `--until`, `--decay`, etc.) accept:
891
+ All date inputs (`--due`, `--until`, `--decay`, `--snooze`, etc.) accept:
497
892
 
498
893
  ### Natural language
499
894
  ```
@@ -516,11 +911,11 @@ in 1 week
516
911
 
517
912
  ### ISO 8601
518
913
  ```
519
- 2026-02-22T09:00:00 # Full datetime
914
+ 2026-02-22T09:00:00 # Full datetime with T separator
520
915
  2026-02-22T09:00 # Without seconds
521
916
  2026-02-22 09:00:00 # Space separator
522
917
  2026-02-22 09:00 # Space, no seconds
523
- 2026-02-22 # Date only (00:00:00)
918
+ 2026-02-22 # Date only (time: 00:00:00)
524
919
  ```
525
920
 
526
921
  ---
@@ -534,34 +929,38 @@ in 1 week
534
929
 
535
930
  ---
536
931
 
537
- ## MCP Server
932
+ ## Recurrence Rules
538
933
 
539
- ```bash
540
- agentrem-mcp # Start MCP server (stdio transport)
541
- npx agentrem mcp # Without global install
542
- ```
934
+ | Pattern | Meaning |
935
+ |---------|---------|
936
+ | `1d` | Daily |
937
+ | `2d` | Every 2 days |
938
+ | `1w` | Weekly |
939
+ | `2w` | Every 2 weeks |
940
+ | `1m` | Monthly (~30 days) |
543
941
 
544
- 14 tools, 4 resources, 3 prompts. See README.md for full MCP reference.
942
+ On `agentrem complete <id>`, if the reminder has a `--recur` rule, a new reminder is automatically created with the next occurrence date.
545
943
 
546
- ### Claude Desktop Config
944
+ ---
547
945
 
548
- ```json
549
- {
550
- "mcpServers": {
551
- "agentrem": {
552
- "command": "agentrem-mcp",
553
- "args": []
554
- }
555
- }
556
- }
557
- ```
946
+ ## Token Budget System
558
947
 
559
- ---
948
+ `agentrem check --budget <n>` limits context injection to fit within your token window.
560
949
 
561
- ## agentrem schema
950
+ | Priority | Budget allocation | Truncation |
951
+ |----------|------------------|------------|
952
+ | P1 Critical | Always included | 200 chars |
953
+ | P2 High | Up to 60% of budget | 100 chars |
954
+ | P3 Normal | Up to 85% of budget | 60 chars |
955
+ | P4 Low | Never shown in output (counted in overflow) | — |
956
+ | P5 Someday | Skipped entirely | — |
562
957
 
563
- Print the database schema (useful for debugging).
958
+ Overflow counts are returned in the JSON output's `overflowCounts` field.
564
959
 
565
- ```bash
566
- agentrem schema
567
- ```
960
+ ---
961
+
962
+ ## Escalation
963
+
964
+ Run `agentrem check --escalate` to auto-escalate overdue reminders:
965
+ - P3 Normal overdue > 48h → promoted to P2 High
966
+ - P2 High overdue > 24h → promoted to P1 Critical