agentrem 1.0.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 ADDED
@@ -0,0 +1,194 @@
1
+ # 🧠 agentrem — Reminders for AI Agents
2
+
3
+ Structured reminders CLI + MCP server that gives AI agents persistent, priority-aware memory with triggers, recurrence, dependencies, and full-text search.
4
+
5
+ **Why?** AI agents forget between sessions. agentrem gives them a reminder system that persists across sessions, triggers on time/keywords/conditions, and fits within token budgets.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g agentrem
11
+ agentrem init
12
+ ```
13
+
14
+ ## Connect to Your AI Tool
15
+
16
+ ### Claude Desktop / Claude Code
17
+
18
+ Add to your Claude Desktop MCP config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
19
+
20
+ ```json
21
+ {
22
+ "mcpServers": {
23
+ "agentrem": {
24
+ "command": "agentrem-mcp",
25
+ "args": []
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Or if using `npx`:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "agentrem": {
37
+ "command": "npx",
38
+ "args": ["-y", "agentrem", "mcp"]
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ Restart Claude Desktop. You'll see agentrem tools available (add, check, list, search, complete, snooze, etc.).
45
+
46
+ ### Cursor / Windsurf / Any MCP Client
47
+
48
+ Same pattern — point your MCP config to:
49
+
50
+ ```bash
51
+ agentrem-mcp
52
+ # or
53
+ npx agentrem mcp
54
+ ```
55
+
56
+ ### OpenClaw
57
+
58
+ agentrem works as a CLI tool that OpenClaw agents call directly:
59
+
60
+ ```bash
61
+ # Session start hook
62
+ agentrem check --type time,session --budget 800
63
+
64
+ # Keyword scanning on messages
65
+ agentrem check --type keyword --text "user message here"
66
+
67
+ # Periodic maintenance
68
+ agentrem check --escalate && agentrem gc --days 30
69
+ ```
70
+
71
+ ### Any Agent with Shell Access
72
+
73
+ If your agent can run shell commands, it can use agentrem directly:
74
+
75
+ ```bash
76
+ agentrem add "Follow up on PR review" --due "+4h" --priority 2
77
+ agentrem check
78
+ agentrem complete <id>
79
+ ```
80
+
81
+ ## Quick Start
82
+
83
+ ```bash
84
+ # Time-triggered reminder
85
+ agentrem add "Deploy v2.1 to staging" --due "+2h" --priority 2 --tags "deploy,staging"
86
+
87
+ # Keyword-triggered (fires when text matches)
88
+ agentrem add "Review security checklist" --trigger keyword --keywords "deploy,release" --match any
89
+
90
+ # Session reminder (fires every session start)
91
+ agentrem add "Check CI pipeline status" --trigger session
92
+
93
+ # Recurring weekly reminder
94
+ agentrem add "Weekly sync prep" --due "monday 9am" --recur 1w
95
+
96
+ # Check what's triggered
97
+ agentrem check
98
+
99
+ # List all active
100
+ agentrem list
101
+
102
+ # Full-text search
103
+ agentrem search "deploy staging"
104
+
105
+ # Complete
106
+ agentrem complete <id>
107
+ ```
108
+
109
+ ## CLI Commands
110
+
111
+ | Command | Description |
112
+ |---------|-------------|
113
+ | `init` | Initialize database (`--force` to recreate with backup) |
114
+ | `add <content>` | Create a reminder |
115
+ | `check` | Check for triggered reminders |
116
+ | `list` | List reminders with filters |
117
+ | `search <query>` | Full-text search across all fields |
118
+ | `complete <id>` | Mark done (auto-creates next if recurring) |
119
+ | `snooze <id>` | Snooze (`--until` or `--for`) |
120
+ | `edit <id>` | Edit reminder fields |
121
+ | `delete [id]` | Soft-delete (`--permanent` for hard delete) |
122
+ | `stats` | Show statistics |
123
+ | `gc` | Garbage collect old reminders |
124
+ | `history [id]` | View audit trail |
125
+ | `undo <history_id>` | Revert a change |
126
+ | `export` | Export to JSON |
127
+ | `import <file>` | Import from JSON |
128
+ | `schema` | Show database schema |
129
+
130
+ ## Trigger Types
131
+
132
+ | Type | Fires when... | Key flags |
133
+ |------|--------------|-----------|
134
+ | `time` | Due datetime is reached | `--due` |
135
+ | `keyword` | Text matches keywords | `--keywords`, `--match` |
136
+ | `condition` | Shell command matches expected output | `--check`, `--expect` |
137
+ | `session` | Every session check | — |
138
+ | `heartbeat` | Every heartbeat check | — |
139
+ | `manual` | Only via explicit check | — |
140
+
141
+ ## Priority Levels
142
+
143
+ | Level | Label | Behavior |
144
+ |-------|-------|----------|
145
+ | 1 | 🔴 Critical | Always surfaced |
146
+ | 2 | 🟡 High | Surfaced within 60% budget |
147
+ | 3 | 🔵 Normal | Surfaced within 85% budget |
148
+ | 4 | ⚪ Low | Counted but not surfaced |
149
+ | 5 | 💤 Someday | Skipped entirely |
150
+
151
+ ## Features
152
+
153
+ - **Recurrence** — `--recur 1d/2w/1m` auto-creates next instance on completion
154
+ - **Dependencies** — `--depends-on <id>` blocks until dependency is completed
155
+ - **Decay** — `--decay <datetime>` auto-expires after a date
156
+ - **Max fires** — `--max-fires <n>` auto-completes after N triggers
157
+ - **Escalation** — `check --escalate` promotes overdue (P3→P2 after 48h, P2→P1 after 24h)
158
+ - **Token budget** — `check --budget <n>` limits output to fit context windows
159
+ - **Full-text search** — FTS5 across content, context, tags, notes
160
+ - **Undo** — revert any change via audit history
161
+ - **Multi-agent** — `--agent <name>` isolates reminders per agent
162
+ - **Export/Import** — JSON backup with merge and replace modes
163
+
164
+ ## MCP Server
165
+
166
+ The MCP server exposes all functionality as tools, resources, and prompts for AI clients.
167
+
168
+ ### Tools
169
+ `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`
170
+
171
+ ### Resources
172
+ - `agentrem://reminders/active` — all active reminders
173
+ - `agentrem://reminders/overdue` — overdue reminders
174
+ - `agentrem://stats` — statistics
175
+ - `agentrem://schema` — database schema
176
+
177
+ ### Prompts
178
+ - `triage` — review and prioritize active reminders
179
+ - `guided-creation` — interactive reminder creation
180
+ - `session-briefing` — session start briefing
181
+
182
+ ## Development
183
+
184
+ ```bash
185
+ git clone https://github.com/fraction12/agentrem.git
186
+ cd agentrem
187
+ npm install
188
+ npm run build
189
+ npm test # 292 tests
190
+ ```
191
+
192
+ ## License
193
+
194
+ MIT
package/dist/core.d.ts ADDED
@@ -0,0 +1,138 @@
1
+ import type Database from 'better-sqlite3';
2
+ import { type Reminder, type HistoryEntry } from './types.js';
3
+ export interface AddOptions {
4
+ content: string;
5
+ due?: string;
6
+ trigger?: string;
7
+ priority?: number;
8
+ tags?: string;
9
+ context?: string;
10
+ category?: string;
11
+ keywords?: string;
12
+ match?: string;
13
+ check?: string;
14
+ expect?: string;
15
+ decay?: string;
16
+ maxFires?: number;
17
+ recur?: string;
18
+ agent?: string;
19
+ dependsOn?: string;
20
+ source?: string;
21
+ dryRun?: boolean;
22
+ }
23
+ export declare function coreAdd(db: Database.Database, opts: AddOptions): Reminder;
24
+ export interface CheckOptions {
25
+ type?: string;
26
+ text?: string;
27
+ budget?: number;
28
+ format?: string;
29
+ agent?: string;
30
+ escalate?: boolean;
31
+ dryRun?: boolean;
32
+ }
33
+ export interface CheckResult {
34
+ included: Reminder[];
35
+ overflowCounts: Record<number, number>;
36
+ totalTriggered: number;
37
+ }
38
+ export declare function coreCheck(db: Database.Database, opts: CheckOptions): CheckResult;
39
+ export interface ListOptions {
40
+ status?: string;
41
+ priority?: string;
42
+ tag?: string;
43
+ trigger?: string;
44
+ due?: string;
45
+ agent?: string;
46
+ category?: string;
47
+ limit?: number;
48
+ all?: boolean;
49
+ }
50
+ export declare function coreList(db: Database.Database, opts: ListOptions): Reminder[];
51
+ export interface SearchOptions {
52
+ query: string;
53
+ status?: string;
54
+ limit?: number;
55
+ }
56
+ export declare function coreSearch(db: Database.Database, opts: SearchOptions): Reminder[];
57
+ export interface CompleteResult {
58
+ completed: Reminder;
59
+ nextRecurrence: Reminder | null;
60
+ }
61
+ export declare function coreComplete(db: Database.Database, id: string, notes?: string): CompleteResult;
62
+ export declare function coreSnooze(db: Database.Database, id: string, until?: string, forDuration?: string): Reminder;
63
+ export interface EditOptions {
64
+ content?: string;
65
+ context?: string;
66
+ priority?: number;
67
+ due?: string;
68
+ tags?: string;
69
+ addTags?: string;
70
+ removeTags?: string;
71
+ category?: string;
72
+ decay?: string;
73
+ maxFires?: number;
74
+ keywords?: string;
75
+ agent?: string;
76
+ }
77
+ export declare function coreEdit(db: Database.Database, id: string, opts: EditOptions): Reminder;
78
+ export interface DeleteOptions {
79
+ id?: string;
80
+ permanent?: boolean;
81
+ status?: string;
82
+ olderThan?: string;
83
+ }
84
+ export interface DeleteResult {
85
+ count: number;
86
+ permanent: boolean;
87
+ }
88
+ export declare function coreDelete(db: Database.Database, opts: DeleteOptions): DeleteResult;
89
+ export interface StatsResult {
90
+ totalActive: number;
91
+ byPriority: {
92
+ priority: number;
93
+ count: number;
94
+ label: string;
95
+ }[];
96
+ overdue: number;
97
+ snoozed: number;
98
+ completedWeek: number;
99
+ expired: number;
100
+ byTrigger: {
101
+ type: string;
102
+ count: number;
103
+ }[];
104
+ nextDue: {
105
+ content: string;
106
+ triggerAt: string;
107
+ } | null;
108
+ lastCreated: string | null;
109
+ dbSizeBytes: number;
110
+ }
111
+ export declare function coreStats(db: Database.Database): StatsResult;
112
+ export interface GcResult {
113
+ count: number;
114
+ reminders: {
115
+ id: string;
116
+ status: string;
117
+ content: string;
118
+ }[];
119
+ }
120
+ export declare function coreGc(db: Database.Database, olderThan?: number, dryRun?: boolean): GcResult;
121
+ export declare function coreHistory(db: Database.Database, id?: string, limit?: number): HistoryEntry[];
122
+ export declare function coreUndo(db: Database.Database, historyId: number): void;
123
+ export interface ExportData {
124
+ exported_at: string;
125
+ schema_version: number;
126
+ reminder_count: number;
127
+ reminders: Record<string, unknown>[];
128
+ history: Record<string, unknown>[];
129
+ }
130
+ export declare function coreExport(db: Database.Database, status?: string): ExportData;
131
+ export interface ImportResult {
132
+ imported: number;
133
+ skipped: number;
134
+ historyImported: number;
135
+ }
136
+ export declare function coreImport(db: Database.Database, data: ExportData, merge?: boolean, replace?: boolean, dryRun?: boolean): ImportResult;
137
+ export declare function coreSchema(db: Database.Database):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