agentrem 1.4.0 → 1.5.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
@@ -1,37 +1,27 @@
1
- # 🧠 agentrem — Reminders for AI Agents
1
+ # 🔔 agentrem
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/agentrem)](https://www.npmjs.com/package/agentrem)
4
- [![CI](https://github.com/fraction12/agentrem/actions/workflows/ci.yml/badge.svg)](https://github.com/fraction12/agentrem/actions/workflows/ci.yml)
5
4
  [![Tests](https://img.shields.io/badge/tests-392%20passing-brightgreen)](https://github.com/fraction12/agentrem)
5
+ [![CI](https://github.com/fraction12/agentrem/actions/workflows/ci.yml/badge.svg)](https://github.com/fraction12/agentrem/actions/workflows/ci.yml)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![Node.js](https://img.shields.io/node/v/agentrem)](https://nodejs.org)
8
8
  [![MCP](https://img.shields.io/badge/MCP-compatible-blue)](https://modelcontextprotocol.io)
9
9
 
10
- Structured reminders CLI + MCP server that gives AI agents persistent, priority-aware memory with triggers, recurrence, dependencies, full-text search, and native OS notifications.
10
+ Structured reminders for AI agents. Persistent, searchable, works across sessions.
11
11
 
12
- **Why?** AI agents forget between sessions. agentrem gives them a reminder system that persists across sessions, triggers on time/keywords/conditions, fires native desktop notifications, and fits within token budgets.
13
-
14
- ## Install
12
+ ## Instant Start
15
13
 
16
14
  ```bash
17
- npm install -g agentrem
18
- agentrem init
15
+ npx agentrem add "Deploy to prod" --due tomorrow --priority 2
16
+ npx agentrem check
17
+ npx agentrem list
19
18
  ```
20
19
 
21
- ## Connect to Your AI Tool
22
-
23
- ### Claude Code (Recommended)
24
-
25
- Claude Code has shell access, so it works out of the box — no MCP config needed.
20
+ ---
26
21
 
27
- **1. Install globally:**
22
+ ## For AI Agents
28
23
 
29
- ```bash
30
- npm install -g agentrem
31
- agentrem init
32
- ```
33
-
34
- **2. Add to your `CLAUDE.md`:**
24
+ Copy this into your `CLAUDE.md` / `AGENTS.md` (or run `agentrem setup` to generate it):
35
25
 
36
26
  ```markdown
37
27
  ## Reminders
@@ -53,19 +43,11 @@ agentrem add "<content>" --due "<when>" --priority <1-5> --tags "<tags>"
53
43
  - `agentrem --help` — full reference
54
44
  ```
55
45
 
56
- **3. That's it.** Next time you tell Claude Code "remind me to deploy tomorrow at 9am", it runs:
57
-
58
- ```bash
59
- agentrem add "Deploy to production" --due "tomorrow" --priority 2
60
- ```
46
+ ---
61
47
 
62
- Next session, `agentrem check` surfaces it automatically.
63
-
64
- ### Claude Desktop (MCP)
65
-
66
- For Claude Desktop (the chat app), use the MCP server:
48
+ ## MCP Server
67
49
 
68
- Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
50
+ For Claude Desktop and any MCP client — add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
69
51
 
70
52
  ```json
71
53
  {
@@ -78,7 +60,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
78
60
  }
79
61
  ```
80
62
 
81
- Or without global install:
63
+ No global install? Use `npx`:
82
64
 
83
65
  ```json
84
66
  {
@@ -91,113 +73,49 @@ Or without global install:
91
73
  }
92
74
  ```
93
75
 
94
- Restart Claude Desktop. You'll see agentrem tools available (add, check, list, search, complete, snooze, etc.).
95
-
96
- ### Cursor / Windsurf / Any MCP Client
97
-
98
- Same MCP pattern — point your config to `agentrem-mcp` or `npx agentrem mcp`.
99
-
100
- ### OpenClaw
101
-
102
- agentrem works as a CLI tool that OpenClaw agents call directly:
103
-
104
- ```bash
105
- # Session start hook
106
- agentrem check --type time,session --budget 800
107
-
108
- # Keyword scanning on messages
109
- agentrem check --type keyword --text "user message here"
110
-
111
- # Periodic maintenance
112
- agentrem check --escalate && agentrem gc --days 30
113
- ```
114
-
115
- ### Any Agent with Shell Access
116
-
117
- If your agent can run shell commands, it can use agentrem directly:
118
-
119
- ```bash
120
- agentrem add "Follow up on PR review" --due "+4h" --priority 2
121
- agentrem check
122
- agentrem complete <id>
123
- ```
124
-
125
- ## Quick Start
126
-
127
- ```bash
128
- # Run the interactive walkthrough (first time)
129
- agentrem quickstart
130
-
131
- # Time-triggered reminder
132
- agentrem add "Deploy v2.1 to staging" --due "+2h" --priority 2 --tags "deploy,staging"
133
-
134
- # Natural language dates
135
- agentrem add "Send weekly report" --due "tomorrow" --priority 2
136
- agentrem add "Check alerts" --due "in 30 minutes"
137
- agentrem add "Quarterly review" --due "2026-04-01" --priority 3
138
-
139
- # Keyword-triggered (fires when text matches)
140
- agentrem add "Review security checklist" --trigger keyword --keywords "deploy,release" --match any
141
-
142
- # Session reminder (fires every session start)
143
- agentrem add "Check CI pipeline status" --trigger session
144
-
145
- # Recurring weekly reminder
146
- agentrem add "Weekly sync prep" --due "2026-02-24T09:00:00" --recur 1w
147
-
148
- # Check what's triggered
149
- agentrem check
150
-
151
- # List all active
152
- agentrem list
153
-
154
- # Full-text search
155
- agentrem search "deploy staging"
156
-
157
- # Complete
158
- agentrem complete <id>
159
-
160
- # Run self-diagnostics
161
- agentrem doctor
162
- ```
163
-
164
- ## CLI Commands
165
-
166
- | Command | Description |
167
- |---------|-------------|
168
- | `init` | Initialize database (`--force` to recreate with backup) |
169
- | `add <content>` | Create a reminder |
170
- | `check` | Check for triggered reminders |
171
- | `list` | List reminders with filters |
172
- | `search <query>` | Full-text search across all fields |
173
- | `complete <id>` | Mark done (auto-creates next if recurring) |
174
- | `snooze <id>` | Snooze (`--until` or `--for`) |
175
- | `edit <id>` | Edit reminder fields |
176
- | `delete [id]` | Soft-delete (`--permanent` for hard delete) |
177
- | `stats` | Show statistics |
178
- | `gc` | Garbage collect old reminders |
179
- | `history [id]` | View audit trail |
180
- | `undo <history_id>` | Revert a change |
181
- | `export` | Export to JSON |
182
- | `import <file>` | Import from JSON |
183
- | `schema` | Show database schema |
184
- | `watch` | Background daemon: poll + fire OS notifications |
185
- | `doctor` | Self-diagnostic check |
186
- | `quickstart` | Interactive first-run walkthrough |
187
- | `setup` | Print CLAUDE.md snippet (`--mcp` for MCP config) |
188
-
189
- ## Trigger Types
76
+ Run `agentrem setup --mcp` to print this config. MCP tools: `add_reminder` · `check_reminders` · `list_reminders` · `search_reminders` · `complete_reminder` · `snooze_reminder` · `edit_reminder` · `delete_reminder` · `get_stats` · `undo_change` · `export_reminders` · `import_reminders`
77
+
78
+ ---
79
+
80
+ ## All Commands
81
+
82
+ | Command | Key Flags | Example |
83
+ |---------|-----------|---------|
84
+ | `add <content>` | `--due` `--priority` `--tags` `--trigger` `--recur` `--agent` `--dry-run` | `agentrem add "PR review" --due "+4h" --priority 2` |
85
+ | `check` | `--type` `--text` `--budget` `--format` `--json` `--escalate` `--agent` | `agentrem check --type time,session --budget 800 --json` |
86
+ | `list` | `--status` `--priority` `--tag` `--due` `--limit` `--json` `--all` `--agent` | `agentrem list --priority 1,2 --json` |
87
+ | `search <query>` | `--status` `--limit` `--json` | `agentrem search "deploy staging" --json` |
88
+ | `complete <id>` | `--notes` | `agentrem complete abc12345` |
89
+ | `snooze <id>` | `--until` `--for` | `agentrem snooze abc12345 --for 2h` |
90
+ | `edit <id>` | `--content` `--due` `--priority` `--tags` `--add-tags` `--remove-tags` | `agentrem edit abc12345 --priority 1` |
91
+ | `delete [id]` | `--permanent` `--status` `--older-than` | `agentrem delete abc12345 --permanent` |
92
+ | `stats` | `--json` | `agentrem stats --json` |
93
+ | `history [id]` | `--limit` `--json` | `agentrem history --limit 20 --json` |
94
+ | `undo <history_id>` | — | `agentrem undo 42` |
95
+ | `gc` | `--older-than` `--dry-run` | `agentrem gc --older-than 30` |
96
+ | `export` | `--out` `--status` | `agentrem export --out backup.json` |
97
+ | `import <file>` | `--merge` `--replace` `--dry-run` | `agentrem import backup.json --merge` |
98
+ | `watch` | `--interval` `--once` `--verbose` `--install` `--uninstall` `--status` `--agent` | `agentrem watch --install` |
99
+ | `setup` | `--mcp` | `agentrem setup` / `agentrem setup --mcp` |
100
+ | `doctor` | `--json` | `agentrem doctor` |
101
+ | `init` | `--force` | `agentrem init` |
102
+ | `quickstart` | | `agentrem quickstart` |
103
+ | `schema` | — | `agentrem schema` |
104
+
105
+ **`--json` is available on `check`, `list`, `search`, `stats`, `history`, `doctor` — use it for structured output in your agent.**
106
+
107
+ ### Trigger Types
190
108
 
191
109
  | Type | Fires when... | Key flags |
192
110
  |------|--------------|-----------|
193
111
  | `time` | Due datetime is reached | `--due` |
194
- | `keyword` | Text matches keywords | `--keywords`, `--match` |
195
- | `condition` | Shell command matches expected output | `--check`, `--expect` |
196
- | `session` | Every session check | — |
112
+ | `keyword` | Message text matches | `--keywords`, `--match any\|all\|regex` |
113
+ | `condition` | Shell command output matches | `--check`, `--expect` |
114
+ | `session` | Every session start check | — |
197
115
  | `heartbeat` | Every heartbeat check | — |
198
- | `manual` | Only via explicit check | — |
116
+ | `manual` | Explicit `check` only | — |
199
117
 
200
- ## Priority Levels
118
+ ### Priority Levels
201
119
 
202
120
  | Level | Label | Behavior |
203
121
  |-------|-------|----------|
@@ -207,124 +125,89 @@ agentrem doctor
207
125
  | 4 | ⚪ Low | Counted but not surfaced |
208
126
  | 5 | 💤 Someday | Skipped entirely |
209
127
 
128
+ ---
129
+
210
130
  ## Natural Language Dates
211
131
 
212
- `--due` (and `--until`, `--decay`) accept many formats:
132
+ `--due`, `--until`, and `--decay` all accept natural language:
213
133
 
214
134
  ```bash
215
- --due "now" # Immediately
216
- --due "today" # Today at 23:59
217
- --due "tomorrow" # Tomorrow at 09:00
218
- --due "in 5 minutes" # Relative natural language
135
+ --due "now" # Immediately
136
+ --due "today" # Today at 23:59
137
+ --due "tomorrow" # Tomorrow at 09:00
138
+ --due "in 5 minutes"
219
139
  --due "in 2 hours"
220
140
  --due "in 3 days"
221
141
  --due "in 1 week"
222
- --due "+5m" # Short relative
142
+ --due "+5m" # Short relative
223
143
  --due "+2h"
224
144
  --due "+3d"
225
145
  --due "+1w"
226
- --due "2026-02-22T09:00:00" # ISO datetime
227
- --due "2026-02-22" # ISO date
146
+ --due "2026-04-01T09:00:00" # ISO datetime
147
+ --due "2026-04-01" # ISO date
228
148
  ```
229
149
 
150
+ ---
151
+
230
152
  ## Background Watcher
231
153
 
232
- `agentrem watch` polls for due reminders and fires native OS notifications. Perfect for always-on setups or running as a background service.
154
+ `agentrem watch` polls for due reminders and fires native OS notifications.
233
155
 
234
156
  ```bash
235
- # Run in foreground
236
- agentrem watch # Poll every 30s
157
+ agentrem watch # Poll every 30s (foreground)
237
158
  agentrem watch --interval 60 # Custom interval
159
+ agentrem watch --once # Single check and exit
238
160
  agentrem watch --agent jarvis # Watch for a specific agent
239
- agentrem watch --once # Single check, then exit
240
161
  agentrem watch --verbose # Show poll log
241
162
 
242
- # Service management (auto-start on boot)
243
- agentrem watch --install # Install as launchd/systemd service
244
- agentrem watch --install --interval 60 # Install with custom interval
245
- agentrem watch --uninstall # Remove service
246
- agentrem watch --status # Check if installed and running
163
+ # Install as OS service (auto-start on boot)
164
+ agentrem watch --install
165
+ agentrem watch --install --interval 60
166
+ agentrem watch --status
167
+ agentrem watch --uninstall
247
168
  ```
248
169
 
249
- The watcher uses a 5-minute per-reminder cooldown to avoid notification spam. It checks all trigger types (`time`, `heartbeat`, `session`, `condition`) and runs escalation automatically.
170
+ **Service files:** macOS `~/Library/LaunchAgents/com.agentrem.watch.plist` · Linux `~/.config/systemd/user/agentrem-watch.service` · Logs `~/.agentrem/logs/watch.log`
250
171
 
251
- **Service files:**
252
- - macOS: `~/Library/LaunchAgents/com.agentrem.watch.plist`
253
- - Linux: `~/.config/systemd/user/agentrem-watch.service`
254
- - Logs: `~/.agentrem/logs/watch.log`
172
+ ---
255
173
 
256
174
  ## Native Notifications 🔔
257
175
 
258
- agentrem ships a custom Swift app (`Agentrem.app`) in `assets/`. On macOS, notifications show:
176
+ On macOS, agentrem ships a bundled Swift app (`Agentrem.app`) so notifications appear with a bell icon — not a terminal icon.
259
177
 
260
- - **App name:** "agentrem" with a 🔔 bell icon (not a terminal icon)
261
- - **Priority-based sounds:** P1=Hero, P2=Ping, P3=Pop
262
- - **Cheeky overdue messages:** e.g. "so... you forgot about this one 😅"
178
+ | Priority | Sound |
179
+ |----------|-------|
180
+ | P1 🔴 Critical | Hero |
181
+ | P2 🟡 High | Ping |
182
+ | P3 🔵 Normal | Pop |
263
183
 
264
- **Notification backend priority:**
184
+ **Backend fallback order:** `Agentrem.app` → `terminal-notifier` → `osascript` → `console`
265
185
 
266
- | Backend | When used |
267
- |---------|-----------|
268
- | `Agentrem.app` | Preferred on macOS (bundled, no dependencies) |
269
- | `terminal-notifier` | Fallback if app is missing |
270
- | `osascript` | macOS AppleScript fallback |
271
- | `console` | Linux / last resort |
186
+ Notifications include a **Complete** button and cheeky overdue messages. To rebuild the Swift app: `npm run build:notify`
272
187
 
273
- To rebuild the Swift app from source:
188
+ ---
274
189
 
275
- ```bash
276
- npm run build:notify
277
- ```
190
+ ## Why agentrem?
278
191
 
279
- ## Features
280
-
281
- - **Natural language dates** `--due "tomorrow"`, `"in 5 minutes"`, `"+2h"`, ISO formats
282
- - **Background watcher** — `agentrem watch` daemon with OS service management
283
- - **Native notifications** — custom macOS app with bell icon, priority sounds, cheeky overdue messages
284
- - **Recurrence** — `--recur 1d/2w/1m` auto-creates next instance on completion
285
- - **Dependencies** — `--depends-on <id>` blocks until dependency is completed
286
- - **Decay** — `--decay <datetime>` auto-expires after a date
287
- - **Max fires** — `--max-fires <n>` auto-completes after N triggers
288
- - **Escalation** — `check --escalate` promotes overdue (P3→P2 after 48h, P2→P1 after 24h)
289
- - **Token budget** — `check --budget <n>` limits output to fit context windows
290
- - **Full-text search** — FTS5 across content, context, tags, notes
291
- - **Undo** — revert any change via audit history
292
- - **Multi-agent** — `--agent <name>` isolates reminders per agent
293
- - **Export/Import** — JSON backup with merge and replace modes
294
- - **Doctor** — `agentrem doctor` runs self-diagnostics
295
- - **Quickstart** — `agentrem quickstart` for interactive first-run setup
296
-
297
- ## MCP Server
298
-
299
- The MCP server exposes all functionality as tools, resources, and prompts for AI clients.
300
-
301
- ### Tools
302
- `add_reminder` · `check_reminders` · `list_reminders` · `search_reminders` · `complete_reminder` · `snooze_reminder` · `edit_reminder` · `delete_reminder` · `get_stats` · `get_history` · `undo_change` · `garbage_collect` · `export_reminders` · `import_reminders`
192
+ ```
193
+ # vs flat files / memory.md
194
+ agentrem check --json # structured output your agent can parse; memory.md can't do that
195
+ ```
303
196
 
304
- ### Resources
305
- - `agentrem://reminders/active` all active reminders
306
- - `agentrem://reminders/overdue`overdue reminders
307
- - `agentrem://stats` statistics
308
- - `agentrem://schema` — database schema
197
+ - **Persistent across sessions** — SQLite-backed, survives restarts, not just in-context notes
198
+ - **Priority-aware + token budgets** — `check --budget 800` fits within any context window without overflow
199
+ - **Triggerable**time, keyword, condition, session, heartbeat triggers; not just static lists
200
+ - **Agent-native** — `--json` everywhere, `--agent` namespacing, MCP server for chat clients
309
201
 
310
- ### Prompts
311
- - `triage` — review and prioritize active reminders
312
- - `guided-creation` — interactive reminder creation
313
- - `session-briefing` — session start briefing
202
+ ---
314
203
 
315
- ## Development
204
+ ## Install
316
205
 
317
206
  ```bash
318
- git clone https://github.com/fraction12/agentrem.git
319
- cd agentrem
320
- npm install
321
- npm run build
322
- npm test # 392 tests
323
-
324
- # Rebuild native notification app (Swift)
325
- npm run build:notify
207
+ npm install -g agentrem
208
+ agentrem init
326
209
  ```
327
210
 
328
- ## License
211
+ Then run `agentrem setup` to get your `CLAUDE.md` snippet, or `agentrem setup --mcp` for Claude Desktop.
329
212
 
330
- MIT
213
+ MIT License
package/dist/api.d.ts ADDED
@@ -0,0 +1,93 @@
1
+ import { type StatsResult } from './core.js';
2
+ import type { Reminder } from './types.js';
3
+ export type { Reminder } from './types.js';
4
+ export type { StatsResult } from './core.js';
5
+ export interface CheckResult {
6
+ /** Reminders that fired and fit within the token budget */
7
+ included: Reminder[];
8
+ /** Count of reminders not returned per priority level due to budget */
9
+ overflowCounts: Record<number, number>;
10
+ /** Total number of reminders that triggered (before budget trim) */
11
+ totalTriggered: number;
12
+ }
13
+ /** Reset the internal DB singleton (useful for testing with custom DB paths). */
14
+ export declare function _resetDb(): void;
15
+ export interface AddOptions {
16
+ due?: string;
17
+ priority?: number;
18
+ tags?: string;
19
+ agent?: string;
20
+ context?: string;
21
+ trigger?: string;
22
+ category?: string;
23
+ keywords?: string;
24
+ recur?: string;
25
+ }
26
+ /**
27
+ * Add a new reminder.
28
+ * @example
29
+ * const rem = await add('Review PR', { due: 'tomorrow', priority: 2 });
30
+ */
31
+ export declare function add(content: string, opts?: AddOptions): Promise<Reminder>;
32
+ export interface CheckOptions {
33
+ type?: string;
34
+ budget?: number;
35
+ agent?: string;
36
+ format?: 'text' | 'json';
37
+ }
38
+ /**
39
+ * Check for triggered reminders. Returns all reminders that are currently
40
+ * due/active within the given token budget.
41
+ * @example
42
+ * const { included } = await check({ budget: 500 });
43
+ */
44
+ export declare function check(opts?: CheckOptions): Promise<CheckResult>;
45
+ export interface ListOptions {
46
+ filter?: string;
47
+ agent?: string;
48
+ limit?: number;
49
+ status?: string;
50
+ priority?: string;
51
+ tag?: string;
52
+ }
53
+ /**
54
+ * List reminders.
55
+ * @example
56
+ * const reminders = await list({ limit: 10 });
57
+ */
58
+ export declare function list(opts?: ListOptions): Promise<Reminder[]>;
59
+ /**
60
+ * Mark a reminder as completed.
61
+ * @example
62
+ * const done = await complete('abc123');
63
+ */
64
+ export declare function complete(id: string, notes?: string): Promise<Reminder>;
65
+ export interface SnoozeOptions {
66
+ for: string;
67
+ }
68
+ /**
69
+ * Snooze a reminder for a duration.
70
+ * @example
71
+ * const snoozed = await snooze('abc123', { for: '2h' });
72
+ */
73
+ export declare function snooze(id: string, opts: SnoozeOptions): Promise<Reminder>;
74
+ export interface SearchOptions {
75
+ limit?: number;
76
+ agent?: string;
77
+ }
78
+ /**
79
+ * Full-text search reminders.
80
+ * @example
81
+ * const results = await search('PR review');
82
+ */
83
+ export declare function search(query: string, opts?: SearchOptions): Promise<Reminder[]>;
84
+ /**
85
+ * Get reminder statistics.
86
+ * @example
87
+ * const s = await stats();
88
+ * console.log(s.totalActive);
89
+ */
90
+ export declare function stats(opts?: {
91
+ agent?: string;
92
+ }): Promise<StatsResult>;
93
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAMA,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,uEAAuE;IACvE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;CACxB;AAeD,iFAAiF;AACjF,wBAAgB,QAAQ,IAAI,IAAI,CAK/B;AAID,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAc/E;AAED,MAAM,WAAW,YAAY;I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,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3E"}
package/dist/api.js ADDED
@@ -0,0 +1,111 @@
1
+ // ── Programmatic JavaScript API ───────────────────────────────────────────
2
+ // Clean async wrappers for use by agents and scripts.
3
+ // import { add, check, list, complete, search } from 'agentrem'
4
+ import { initDb, getDb } from './db.js';
5
+ import { coreAdd, coreCheck, coreList, coreSearch, coreComplete, coreSnooze, coreStats, } from './core.js';
6
+ // ── Lazy DB singleton ──────────────────────────────────────────────────────
7
+ let _db = null;
8
+ function db() {
9
+ if (!_db) {
10
+ // Auto-init on first call so `import { add } from 'agentrem'` just works
11
+ initDb(false);
12
+ _db = getDb();
13
+ }
14
+ return _db;
15
+ }
16
+ /** Reset the internal DB singleton (useful for testing with custom DB paths). */
17
+ export function _resetDb() {
18
+ if (_db) {
19
+ try {
20
+ _db.close();
21
+ }
22
+ catch { /* ignore */ }
23
+ _db = null;
24
+ }
25
+ }
26
+ /**
27
+ * Add a new reminder.
28
+ * @example
29
+ * const rem = await add('Review PR', { due: 'tomorrow', priority: 2 });
30
+ */
31
+ export async function add(content, opts) {
32
+ const result = coreAdd(db(), {
33
+ content,
34
+ due: opts?.due,
35
+ priority: opts?.priority,
36
+ tags: opts?.tags,
37
+ agent: opts?.agent,
38
+ context: opts?.context,
39
+ trigger: opts?.trigger,
40
+ category: opts?.category,
41
+ keywords: opts?.keywords,
42
+ recur: opts?.recur,
43
+ });
44
+ return result;
45
+ }
46
+ /**
47
+ * Check for triggered reminders. Returns all reminders that are currently
48
+ * due/active within the given token budget.
49
+ * @example
50
+ * const { included } = await check({ budget: 500 });
51
+ */
52
+ export async function check(opts) {
53
+ return coreCheck(db(), {
54
+ type: opts?.type,
55
+ budget: opts?.budget,
56
+ agent: opts?.agent,
57
+ });
58
+ }
59
+ /**
60
+ * List reminders.
61
+ * @example
62
+ * const reminders = await list({ limit: 10 });
63
+ */
64
+ export async function list(opts) {
65
+ return coreList(db(), {
66
+ agent: opts?.agent,
67
+ limit: opts?.limit,
68
+ status: opts?.status,
69
+ priority: opts?.priority,
70
+ tag: opts?.tag ?? opts?.filter,
71
+ });
72
+ }
73
+ /**
74
+ * Mark a reminder as completed.
75
+ * @example
76
+ * const done = await complete('abc123');
77
+ */
78
+ export async function complete(id, notes) {
79
+ const { completed } = coreComplete(db(), id, notes);
80
+ return completed;
81
+ }
82
+ /**
83
+ * Snooze a reminder for a duration.
84
+ * @example
85
+ * const snoozed = await snooze('abc123', { for: '2h' });
86
+ */
87
+ export async function snooze(id, opts) {
88
+ return coreSnooze(db(), id, undefined, opts.for);
89
+ }
90
+ /**
91
+ * Full-text search reminders.
92
+ * @example
93
+ * const results = await search('PR review');
94
+ */
95
+ export async function search(query, opts) {
96
+ return coreSearch(db(), {
97
+ query,
98
+ limit: opts?.limit,
99
+ });
100
+ }
101
+ /**
102
+ * Get reminder statistics.
103
+ * @example
104
+ * const s = await stats();
105
+ * console.log(s.totalActive);
106
+ */
107
+ export async function stats(opts) {
108
+ void opts; // agent filter not currently in coreStats; included for API compat
109
+ return coreStats(db());
110
+ }
111
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,sDAAsD;AACtD,gEAAgE;AAGhE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,SAAS,GAEV,MAAM,WAAW,CAAC;AAmBnB,8EAA8E;AAE9E,IAAI,GAAG,GAA6B,IAAI,CAAC;AAEzC,SAAS,EAAE;IACT,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,yEAAyE;QACzE,MAAM,CAAC,KAAK,CAAC,CAAC;QACd,GAAG,GAAG,KAAK,EAAE,CAAC;IAChB,CAAC;IACD,OAAO,GAAG,CAAC;A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,QAAQ,EAAE,IAAI,EAAE,QAAQ;QACxB,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM;KAC/B,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,EAAU,EAAE,KAAc;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,EAAU,EAAE,IAAmB;IAC1D,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC;AAOD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,KAAa,EAAE,IAAoB;IAC9D,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE;QACtB,KAAK;QACL,KAAK,EAAE,IAAI,EAAE,KAAK;KACnB,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAyB;IACnD,KAAK,IAAI,CAAC,CAAC,mEAAmE;IAC9E,OAAO,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;AACzB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const SCHEMA_VERSION = 1;
2
- export declare const VERSION = "1.4.0";
2
+ export declare const VERSION = "1.5.0";
3
3
  export declare const PRIORITY_LABELS: Record<number, string>;
4
4
  export declare const PRIORITY_COLORS: Record<number, string>;
5
5
  export declare const VALID_TRIGGERS: Set<string>;
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // ── Types ──────────────────────────────────────────────────────────────────
2
2
  export const SCHEMA_VERSION = 1;
3
- export const VERSION = '1.4.0';
3
+ export const VERSION = '1.5.0';
4
4
  export const PRIORITY_LABELS = {
5
5
  1: '🔴 Critical',
6
6
  2: '🟡 High',
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "agentrem",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Structured reminders CLI for AI agents with MCP server",
5
5
  "type": "module",
6
- "main": "dist/index.js",
6
+ "main": "dist/api.js",
7
+ "types": "dist/api.d.ts",
8
+ "exports": {
9
+ ".": "./dist/api.js",
10
+ "./mcp": "./dist/mcp/server.js"
11
+ },
7
12
  "bin": {
8
13
  "agentrem": "dist/index.js",
9
14
  "agentrem-mcp": "dist/mcp/server.js"
@@ -18,6 +23,7 @@
18
23
  ],
19
24
  "scripts": {
20
25
  "build": "tsc",
26
+ "postbuild": "chmod +x dist/index.js dist/mcp/server.js",
21
27
  "build:notify": "bash scripts/build-notify.sh",
22
28
  "dev": "tsc --watch",
23
29
  "test": "vitest run",