@aman_asmuei/amem 0.4.0 → 0.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 +258 -148
- package/dist/database.d.ts +18 -1
- package/dist/database.js +105 -13
- package/dist/database.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/tools.js +230 -20
- package/dist/tools.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,101 +1,88 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/logo.png" alt="amem" width="
|
|
2
|
+
<img src="assets/logo.png" alt="amem" width="160" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<
|
|
5
|
+
<h1 align="center">amem</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<a
|
|
9
|
-
<a href="https://github.com/amanasmuei/amem/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" /></a>
|
|
10
|
-
<a href="https://github.com/amanasmuei/amem/actions"><img src="https://img.shields.io/github/actions/workflow/status/amanasmuei/amem/ci.yml?style=flat-square&label=tests" /></a>
|
|
11
|
-
<img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square" />
|
|
12
|
-
<img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?style=flat-square" />
|
|
8
|
+
<strong>Give your AI a memory it never forgets.</strong>
|
|
13
9
|
</p>
|
|
14
10
|
|
|
15
11
|
<p align="center">
|
|
16
|
-
<
|
|
17
|
-
|
|
12
|
+
<a href="https://www.npmjs.com/package/@aman_asmuei/amem"><img src="https://img.shields.io/npm/v/@aman_asmuei/amem?style=for-the-badge&logo=npm&logoColor=white&color=cb3837" alt="npm version" /></a>
|
|
13
|
+
|
|
14
|
+
<a href="https://github.com/amanasmuei/amem/actions"><img src="https://img.shields.io/github/actions/workflow/status/amanasmuei/amem/ci.yml?style=for-the-badge&logo=github&label=CI" alt="CI status" /></a>
|
|
15
|
+
|
|
16
|
+
<a href="https://github.com/amanasmuei/amem/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="MIT License" /></a>
|
|
17
|
+
|
|
18
|
+
<img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?style=for-the-badge" alt="MCP compatible" />
|
|
19
|
+
|
|
20
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A518-brightgreen?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js 18+" />
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<b>amem</b> (<b>A</b>man's <b>Mem</b>ory) is a persistent memory layer for AI coding tools.<br/>
|
|
25
|
+
Local-first · Semantic · Lossless · Works with Claude Code, Cursor, Windsurf & any MCP client.
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
30
|
+
<a href="#-features">Features</a> •
|
|
31
|
+
<a href="#-tools-reference">Tools</a> •
|
|
32
|
+
<a href="#-usage-examples">Examples</a> •
|
|
33
|
+
<a href="#-architecture">Architecture</a> •
|
|
34
|
+
<a href="#-contributing">Contributing</a>
|
|
18
35
|
</p>
|
|
19
36
|
|
|
20
37
|
---
|
|
21
38
|
|
|
22
39
|
## The Problem
|
|
23
40
|
|
|
24
|
-
Every time you start a new conversation with an AI coding assistant, it starts from zero
|
|
41
|
+
Every time you start a new conversation with an AI coding assistant, it starts from zero.
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
> *"Don't use `any` in TypeScript"* — told it **three times**, still does it.
|
|
44
|
+
>
|
|
45
|
+
> *"We chose PostgreSQL over MongoDB"* — doesn't remember why.
|
|
46
|
+
>
|
|
47
|
+
> *"I prefer early returns and pnpm"* — explained again. And again.
|
|
48
|
+
>
|
|
49
|
+
> A critical decision from **last week**? Gone.
|
|
30
50
|
|
|
31
|
-
You repeat yourself. Every. Single. Session
|
|
51
|
+
**You repeat yourself. Every. Single. Session.**
|
|
32
52
|
|
|
33
53
|
## The Solution
|
|
34
54
|
|
|
35
|
-
**amem**
|
|
55
|
+
**amem** plugs into any MCP-compatible AI tool and gives it persistent, searchable, lossless memory.
|
|
36
56
|
|
|
37
57
|
```
|
|
38
58
|
You: "Don't use any type in TypeScript"
|
|
39
59
|
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
amem stores this as a correction (priority 1.0)
|
|
61
|
+
next session, your AI already knows
|
|
42
62
|
```
|
|
43
63
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## What's New in v0.4.0
|
|
47
|
-
|
|
48
|
-
| Feature | Description |
|
|
49
|
-
|---|---|
|
|
50
|
-
| 🗒️ **Lossless conversation log** | `memory_log` / `memory_log_recall` — append-only raw turns, nothing ever summarized or lost |
|
|
51
|
-
| 🔧 **Patch system** | `memory_patch` — surgical field-level edits, auto-versioned before every change |
|
|
52
|
-
| 📜 **Version history** | `memory_versions` — full edit history, restore any past snapshot |
|
|
53
|
-
| 🕸️ **Knowledge graph** | `memory_relate` — typed relations between memories (supports, causes, implements…) |
|
|
54
|
-
| ⏱️ **Temporal queries** | `memory_since` — "what changed last week?" in natural language |
|
|
55
|
-
| 🔍 **Full-text search** | `memory_search` — exact FTS5 keyword search, complements semantic recall |
|
|
56
|
-
| ⚡ **FTS5 auto-sync** | SQLite triggers keep the index in sync on every insert, update, delete |
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Feature Comparison
|
|
61
|
-
|
|
62
|
-
| Feature | amem v0.4 | Claude Code |
|
|
63
|
-
|---|---|---|
|
|
64
|
-
| Session memory | ✅ SQLite — persists across sessions | ✅ Context window only |
|
|
65
|
-
| Persistent identity | ✅ `~/.amem/memory.db` | ✅ `CLAUDE.md` |
|
|
66
|
-
| Auto accumulation | ✅ `memory_extract` batch | ✅ `MEMORY.md` auto |
|
|
67
|
-
| Memory consolidation | ✅ Merge · prune · promote | ✅ Auto-dream |
|
|
68
|
-
| Semantic recall | ✅ Cosine similarity + keyword | ✅ Chat search |
|
|
69
|
-
| Per-project scope | ✅ Auto git-detected | ✅ `./CLAUDE.md` |
|
|
70
|
-
| Memory export | ✅ Markdown + CLI | 🟡 "Write verbatim" |
|
|
71
|
-
| **Lossless history** | ✅ Append-only conversation log | 🔴 Lossy summarization |
|
|
72
|
-
| **Patch system** | ✅ Field-level, auto-versioned | 🔴 None |
|
|
73
|
-
| **Version history** | ✅ Full edit history + restore | 🔴 None |
|
|
74
|
-
| **Knowledge graph** | ✅ Typed memory relations | 🔴 None |
|
|
75
|
-
| **Temporal queries** | ✅ "since 7d", date ranges | 🔴 None |
|
|
76
|
-
| **Full-text search** | ✅ FTS5 exact match | 🔴 None |
|
|
64
|
+
No cloud. No API keys. Everything stays on your machine.
|
|
77
65
|
|
|
78
66
|
---
|
|
79
67
|
|
|
80
|
-
##
|
|
68
|
+
## Quick Start
|
|
81
69
|
|
|
82
|
-
### Install
|
|
70
|
+
### 1. Install
|
|
83
71
|
|
|
84
72
|
```bash
|
|
85
73
|
npm install -g @aman_asmuei/amem
|
|
86
74
|
```
|
|
87
75
|
|
|
88
|
-
|
|
76
|
+
### 2. Connect
|
|
89
77
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
**Claude Code**
|
|
78
|
+
<details open>
|
|
79
|
+
<summary><strong>Claude Code</strong> (one command)</summary>
|
|
93
80
|
|
|
94
81
|
```bash
|
|
95
82
|
claude mcp add amem -- npx -y @aman_asmuei/amem
|
|
96
83
|
```
|
|
97
84
|
|
|
98
|
-
Or
|
|
85
|
+
Or add to `~/.claude/settings.json`:
|
|
99
86
|
|
|
100
87
|
```json
|
|
101
88
|
{
|
|
@@ -108,7 +95,10 @@ Or manually in `~/.claude/settings.json`:
|
|
|
108
95
|
}
|
|
109
96
|
```
|
|
110
97
|
|
|
111
|
-
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
<details>
|
|
101
|
+
<summary><strong>Cursor / Windsurf / Other MCP Clients</strong></summary>
|
|
112
102
|
|
|
113
103
|
```json
|
|
114
104
|
{
|
|
@@ -118,22 +108,73 @@ Or manually in `~/.claude/settings.json`:
|
|
|
118
108
|
}
|
|
119
109
|
```
|
|
120
110
|
|
|
121
|
-
|
|
111
|
+
</details>
|
|
112
|
+
|
|
113
|
+
### 3. Use
|
|
114
|
+
|
|
115
|
+
Restart your AI tool — you'll see **19 tools**, **6 resources**, and **2 prompts** ready to go.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Features
|
|
120
|
+
|
|
121
|
+
### v0.5.0
|
|
122
|
+
|
|
123
|
+
| | Feature | Description |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| **NEW** | Reminders system | `reminder_set` / `reminder_list` / `reminder_check` / `reminder_complete` — persistent cross-session reminders with deadline tracking |
|
|
126
|
+
|
|
127
|
+
### v0.4.0
|
|
128
|
+
|
|
129
|
+
| | Feature | Description |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| **NEW** | Lossless conversation log | `memory_log` / `memory_log_recall` — append-only raw turns, nothing summarized or lost |
|
|
132
|
+
| **NEW** | Patch system | `memory_patch` — surgical field-level edits with auto-versioning |
|
|
133
|
+
| **NEW** | Version history | `memory_versions` — immutable snapshots, restore any past state |
|
|
134
|
+
| **NEW** | Knowledge graph | `memory_relate` — typed bidirectional relations between memories |
|
|
135
|
+
| **NEW** | Temporal queries | `memory_since` — natural language time ranges (`7d`, `2w`, `1h`) |
|
|
136
|
+
| **NEW** | Full-text search | `memory_search` — FTS5 exact match, auto-synced on every write |
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary><strong>View all features across versions</strong></summary>
|
|
140
|
+
|
|
141
|
+
### v0.3.0
|
|
142
|
+
|
|
143
|
+
- Memory consolidation engine (merge, prune, promote)
|
|
144
|
+
- Project detection and scope-aware filtering
|
|
145
|
+
- Auto-migration for scope fields
|
|
146
|
+
|
|
147
|
+
### v0.2.0
|
|
148
|
+
|
|
149
|
+
- Structured output with Zod schemas
|
|
150
|
+
- `memory_inject` for proactive context surfacing
|
|
151
|
+
- Evaluation suite
|
|
152
|
+
|
|
153
|
+
### v0.1.0
|
|
154
|
+
|
|
155
|
+
- Core memory store/recall with semantic search
|
|
156
|
+
- Local embeddings (HuggingFace all-MiniLM-L6-v2)
|
|
157
|
+
- SQLite persistence with WAL mode
|
|
158
|
+
- MCP resources and prompts
|
|
159
|
+
|
|
160
|
+
</details>
|
|
122
161
|
|
|
123
162
|
---
|
|
124
163
|
|
|
125
164
|
## Memory Types
|
|
126
165
|
|
|
127
|
-
|
|
128
|
-
|---|---|---|---|
|
|
129
|
-
| 1.0 | **correction** | Rules that must never be broken | *"Don't mock the DB in integration tests"* |
|
|
130
|
-
| 0.85 | **decision** | Architectural choices + rationale | *"Chose Postgres over Mongo for ACID compliance"* |
|
|
131
|
-
| 0.7 | **pattern** | Coding style and habits | *"Prefers early returns over nested conditionals"* |
|
|
132
|
-
| 0.7 | **preference** | Tool and workflow choices | *"Uses pnpm, not npm"* |
|
|
133
|
-
| 0.5 | **topology** | Where things are in the codebase | *"Auth module lives in src/auth/, uses JWT"* |
|
|
134
|
-
| 0.4 | **fact** | General project knowledge | *"API uses REST, launched January 2025"* |
|
|
166
|
+
Memories are scored and prioritized automatically:
|
|
135
167
|
|
|
136
|
-
|
|
168
|
+
| Priority | Type | Example |
|
|
169
|
+
|:---:|---|---|
|
|
170
|
+
| `1.0` | **correction** | *"Don't mock the DB in integration tests"* |
|
|
171
|
+
| `0.85` | **decision** | *"Chose Postgres over Mongo for ACID compliance"* |
|
|
172
|
+
| `0.7` | **pattern** | *"Prefers early returns over nested conditionals"* |
|
|
173
|
+
| `0.7` | **preference** | *"Uses pnpm, not npm"* |
|
|
174
|
+
| `0.5` | **topology** | *"Auth module lives in src/auth/, uses JWT"* |
|
|
175
|
+
| `0.4` | **fact** | *"API uses REST, launched January 2025"* |
|
|
176
|
+
|
|
177
|
+
> **Corrections always surface first.** They are your AI's hard constraints.
|
|
137
178
|
|
|
138
179
|
---
|
|
139
180
|
|
|
@@ -141,9 +182,9 @@ Corrections always surface first. They are your AI's hard constraints.
|
|
|
141
182
|
|
|
142
183
|
### Core Memory
|
|
143
184
|
|
|
144
|
-
| Tool |
|
|
185
|
+
| Tool | Description |
|
|
145
186
|
|---|---|
|
|
146
|
-
| `memory_store` | Store a
|
|
187
|
+
| `memory_store` | Store a memory with type, tags, and confidence |
|
|
147
188
|
| `memory_recall` | Semantic search — natural language, ranked by relevance |
|
|
148
189
|
| `memory_context` | Load all relevant context for a topic, organized by type |
|
|
149
190
|
| `memory_extract` | Batch-save multiple memories from a conversation |
|
|
@@ -152,31 +193,42 @@ Corrections always surface first. They are your AI's hard constraints.
|
|
|
152
193
|
|
|
153
194
|
### Precision & History
|
|
154
195
|
|
|
155
|
-
| Tool |
|
|
196
|
+
| Tool | Description |
|
|
156
197
|
|---|---|
|
|
157
|
-
| `memory_patch` | Surgical field-level edit
|
|
158
|
-
| `memory_versions` | View full edit history or restore any
|
|
159
|
-
| `memory_search` | Exact full-text search
|
|
160
|
-
| `memory_since` | Temporal query
|
|
161
|
-
| `memory_relate` | Build knowledge graph
|
|
198
|
+
| `memory_patch` | Surgical field-level edit with auto-snapshot |
|
|
199
|
+
| `memory_versions` | View full edit history or restore any version |
|
|
200
|
+
| `memory_search` | Exact full-text search via FTS5 |
|
|
201
|
+
| `memory_since` | Temporal query with natural language ranges |
|
|
202
|
+
| `memory_relate` | Build a knowledge graph between memories |
|
|
203
|
+
|
|
204
|
+
### Reminders
|
|
205
|
+
|
|
206
|
+
| Tool | Description |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `reminder_set` | Create a reminder with optional due date and scope |
|
|
209
|
+
| `reminder_list` | List active (or all) reminders, filterable by scope |
|
|
210
|
+
| `reminder_check` | Check for overdue, today, and upcoming reminders (next 7 days) |
|
|
211
|
+
| `reminder_complete` | Mark a reminder as done (supports partial ID matching) |
|
|
162
212
|
|
|
163
213
|
### Log & Maintenance
|
|
164
214
|
|
|
165
|
-
| Tool |
|
|
215
|
+
| Tool | Description |
|
|
166
216
|
|---|---|
|
|
167
|
-
| `memory_log` | Append raw conversation turns
|
|
168
|
-
| `memory_log_recall` | Search or replay log
|
|
169
|
-
| `memory_stats` | Memory count, type breakdown, confidence
|
|
170
|
-
| `memory_export` | Export all memories as
|
|
171
|
-
| `memory_consolidate` | Merge duplicates
|
|
217
|
+
| `memory_log` | Append raw conversation turns (lossless, append-only) |
|
|
218
|
+
| `memory_log_recall` | Search or replay log by session, keyword, or recency |
|
|
219
|
+
| `memory_stats` | Memory count, type breakdown, confidence stats |
|
|
220
|
+
| `memory_export` | Export all memories as Markdown |
|
|
221
|
+
| `memory_consolidate` | Merge duplicates, prune stale, promote frequent memories |
|
|
172
222
|
|
|
173
223
|
---
|
|
174
224
|
|
|
175
225
|
## Usage Examples
|
|
176
226
|
|
|
177
|
-
|
|
227
|
+
<details open>
|
|
228
|
+
<summary><strong>Store & Recall</strong></summary>
|
|
178
229
|
|
|
179
|
-
```
|
|
230
|
+
```js
|
|
231
|
+
// Store a correction — highest priority, always surfaces first
|
|
180
232
|
memory_store({
|
|
181
233
|
content: "Never use 'any' type — always define proper interfaces",
|
|
182
234
|
type: "correction",
|
|
@@ -184,39 +236,50 @@ memory_store({
|
|
|
184
236
|
confidence: 1.0
|
|
185
237
|
})
|
|
186
238
|
|
|
239
|
+
// Semantic search
|
|
187
240
|
memory_recall({ query: "TypeScript best practices", limit: 5 })
|
|
188
241
|
```
|
|
189
242
|
|
|
190
|
-
|
|
243
|
+
</details>
|
|
191
244
|
|
|
192
|
-
|
|
245
|
+
<details>
|
|
246
|
+
<summary><strong>Patch a memory (surgical, versioned)</strong></summary>
|
|
247
|
+
|
|
248
|
+
```js
|
|
193
249
|
memory_patch({
|
|
194
250
|
id: "a1b2c3d4",
|
|
195
251
|
field: "content",
|
|
196
252
|
value: "Never use 'any' — define interfaces, use 'unknown' for unknown types",
|
|
197
253
|
reason: "added unknown guidance"
|
|
198
254
|
})
|
|
255
|
+
|
|
256
|
+
// Every patch auto-snapshots. Restore any version:
|
|
257
|
+
memory_versions({ memory_id: "a1b2c3d4" })
|
|
199
258
|
```
|
|
200
259
|
|
|
201
|
-
|
|
260
|
+
</details>
|
|
202
261
|
|
|
203
|
-
|
|
262
|
+
<details>
|
|
263
|
+
<summary><strong>Lossless conversation log</strong></summary>
|
|
204
264
|
|
|
205
|
-
```
|
|
206
|
-
|
|
265
|
+
```js
|
|
266
|
+
// Preserve raw turns verbatim
|
|
207
267
|
memory_log({ session_id: "2025-03-25", role: "user", content: "Let's use OAuth2 with PKCE" })
|
|
208
|
-
memory_log({ session_id: "2025-03-25", role: "assistant", content: "Good call — removes token storage risk
|
|
268
|
+
memory_log({ session_id: "2025-03-25", role: "assistant", content: "Good call — removes token storage risk..." })
|
|
209
269
|
|
|
210
|
-
|
|
270
|
+
// Replay a session
|
|
211
271
|
memory_log_recall({ session_id: "2025-03-25" })
|
|
212
272
|
|
|
213
|
-
|
|
273
|
+
// Search across all sessions
|
|
214
274
|
memory_log_recall({ query: "OAuth PKCE", limit: 10 })
|
|
215
275
|
```
|
|
216
276
|
|
|
217
|
-
|
|
277
|
+
</details>
|
|
218
278
|
|
|
219
|
-
|
|
279
|
+
<details>
|
|
280
|
+
<summary><strong>Knowledge graph</strong></summary>
|
|
281
|
+
|
|
282
|
+
```js
|
|
220
283
|
memory_relate({
|
|
221
284
|
action: "relate",
|
|
222
285
|
from_id: "decision-abc",
|
|
@@ -225,80 +288,119 @@ memory_relate({
|
|
|
225
288
|
strength: 0.9
|
|
226
289
|
})
|
|
227
290
|
|
|
291
|
+
// View connections
|
|
228
292
|
memory_relate({ action: "graph", memory_id: "decision-abc" })
|
|
229
293
|
```
|
|
230
294
|
|
|
231
295
|
Relation types: `supports`, `contradicts`, `depends_on`, `supersedes`, `related_to`, `caused_by`, `implements` — or define your own.
|
|
232
296
|
|
|
233
|
-
|
|
297
|
+
</details>
|
|
234
298
|
|
|
299
|
+
<details>
|
|
300
|
+
<summary><strong>Temporal queries</strong></summary>
|
|
301
|
+
|
|
302
|
+
```js
|
|
303
|
+
memory_since({ since: "7d" }) // last 7 days
|
|
304
|
+
memory_since({ since: "1w", type: "decision" }) // decisions this week
|
|
305
|
+
memory_since({ since: "2025-03-01", until: "2025-03-15" }) // date range
|
|
235
306
|
```
|
|
236
|
-
memory_since({ since: "7d" }) # last 7 days
|
|
237
|
-
memory_since({ since: "1w", type: "decision" }) # decisions this week
|
|
238
|
-
memory_since({ since: "2025-03-01", until: "2025-03-15" }) # date range
|
|
239
|
-
```
|
|
240
307
|
|
|
241
|
-
|
|
308
|
+
</details>
|
|
309
|
+
|
|
310
|
+
<details>
|
|
311
|
+
<summary><strong>Reminders</strong></summary>
|
|
242
312
|
|
|
313
|
+
```js
|
|
314
|
+
// Set a reminder with a deadline
|
|
315
|
+
reminder_set({
|
|
316
|
+
content: "Review PR #42",
|
|
317
|
+
due_at: 1743033600000, // Unix timestamp for Thursday
|
|
318
|
+
scope: "global"
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
// Check what's due
|
|
322
|
+
reminder_check({})
|
|
323
|
+
// → [OVERDUE] Review PR #42 (3/27/2026) [a1b2c3d4]
|
|
324
|
+
// → [TODAY] Deploy auth service (3/25/2026) [e5f6g7h8]
|
|
325
|
+
// → [upcoming] Write quarterly report (3/31/2026) [i9j0k1l2]
|
|
326
|
+
|
|
327
|
+
// Mark as done
|
|
328
|
+
reminder_complete({ id: "a1b2c3d4" })
|
|
329
|
+
// → Completed: "Review PR #42"
|
|
330
|
+
|
|
331
|
+
// List all active reminders
|
|
332
|
+
reminder_list({ include_completed: false })
|
|
243
333
|
```
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
334
|
+
|
|
335
|
+
</details>
|
|
336
|
+
|
|
337
|
+
<details>
|
|
338
|
+
<summary><strong>Full-text search (FTS5)</strong></summary>
|
|
339
|
+
|
|
340
|
+
```js
|
|
341
|
+
memory_search({ query: "OAuth PKCE" }) // exact terms
|
|
342
|
+
memory_search({ query: '"event sourcing"' }) // phrase match
|
|
343
|
+
memory_search({ query: "auth* NOT legacy" }) // FTS5 boolean syntax
|
|
247
344
|
```
|
|
248
345
|
|
|
346
|
+
</details>
|
|
347
|
+
|
|
249
348
|
---
|
|
250
349
|
|
|
251
|
-
##
|
|
350
|
+
## Architecture
|
|
252
351
|
|
|
253
352
|
```
|
|
254
|
-
|
|
255
|
-
│
|
|
256
|
-
│
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
│
|
|
261
|
-
│
|
|
262
|
-
│
|
|
263
|
-
│
|
|
264
|
-
│
|
|
265
|
-
│
|
|
266
|
-
│
|
|
267
|
-
│
|
|
268
|
-
│
|
|
269
|
-
│
|
|
270
|
-
│
|
|
271
|
-
│
|
|
272
|
-
│
|
|
273
|
-
│
|
|
274
|
-
|
|
353
|
+
┌──────────────────────────────────────────────┐
|
|
354
|
+
│ Your AI Tool │
|
|
355
|
+
│ Claude Code · Cursor · Windsurf · any │
|
|
356
|
+
└─────────────────┬────────────────────────────┘
|
|
357
|
+
│ MCP Protocol (stdio)
|
|
358
|
+
┌─────────────────▼────────────────────────────┐
|
|
359
|
+
│ amem MCP Server │
|
|
360
|
+
│ │
|
|
361
|
+
│ 19 Tools · 6 Resources · 2 Prompts │
|
|
362
|
+
│ │
|
|
363
|
+
│ ┌────────────────────────────────────┐ │
|
|
364
|
+
│ │ SQLite + WAL + FTS5 │ │
|
|
365
|
+
│ │ ~/.amem/memory.db │ │
|
|
366
|
+
│ │ │ │
|
|
367
|
+
│ │ memories (scored) │ │
|
|
368
|
+
│ │ conversation_log (lossless) │ │
|
|
369
|
+
│ │ memory_versions (history) │ │
|
|
370
|
+
│ │ memory_relations (graph) │ │
|
|
371
|
+
│ │ reminders (cross-session) │ │
|
|
372
|
+
│ │ memories_fts (FTS5 index) │ │
|
|
373
|
+
│ └────────────────────────────────────┘ │
|
|
374
|
+
│ │
|
|
375
|
+
│ Local Embeddings (all-MiniLM-L6-v2, 80MB) │
|
|
376
|
+
└──────────────────────────────────────────────┘
|
|
275
377
|
```
|
|
276
378
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
### Smart ranking
|
|
379
|
+
### Ranking Formula
|
|
280
380
|
|
|
281
381
|
```
|
|
282
382
|
score = relevance × recency × confidence × importance
|
|
283
383
|
```
|
|
284
384
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
385
|
+
| Factor | How it works |
|
|
386
|
+
|---|---|
|
|
387
|
+
| **Relevance** | Cosine similarity via local embeddings, keyword fallback |
|
|
388
|
+
| **Recency** | Exponential decay (`0.995^hours`) |
|
|
389
|
+
| **Confidence** | Reinforced by repeated confirmation |
|
|
390
|
+
| **Importance** | Type-based: corrections `1.0` → facts `0.4` |
|
|
289
391
|
|
|
290
392
|
---
|
|
291
393
|
|
|
292
394
|
## MCP Resources
|
|
293
395
|
|
|
294
|
-
|
|
|
396
|
+
| URI | Description |
|
|
295
397
|
|---|---|
|
|
296
|
-
| `amem://corrections` | All active corrections
|
|
297
|
-
| `amem://decisions` |
|
|
298
|
-
| `amem://profile` |
|
|
398
|
+
| `amem://corrections` | All active corrections (hard constraints) |
|
|
399
|
+
| `amem://decisions` | Architectural decisions |
|
|
400
|
+
| `amem://profile` | Preferences and coding patterns |
|
|
299
401
|
| `amem://summary` | Memory count and type breakdown |
|
|
300
402
|
| `amem://log/recent` | Last 50 raw conversation log entries |
|
|
301
|
-
| `amem://graph` | Knowledge graph
|
|
403
|
+
| `amem://graph` | Knowledge graph overview |
|
|
302
404
|
|
|
303
405
|
---
|
|
304
406
|
|
|
@@ -325,17 +427,17 @@ amem-cli forget abc12345 # Delete by short ID
|
|
|
325
427
|
|
|
326
428
|
---
|
|
327
429
|
|
|
328
|
-
##
|
|
430
|
+
## Tech Stack
|
|
329
431
|
|
|
330
432
|
| Layer | Technology |
|
|
331
433
|
|---|---|
|
|
332
434
|
| Protocol | MCP SDK ^1.25 |
|
|
333
|
-
| Language | TypeScript 5.6
|
|
435
|
+
| Language | TypeScript 5.6+, strict mode, zero `any` |
|
|
334
436
|
| Database | SQLite + WAL + FTS5 |
|
|
335
437
|
| Embeddings | HuggingFace Xenova/all-MiniLM-L6-v2 (local, 80MB) |
|
|
336
|
-
| Validation | Zod 3.25+ `.strict()` schemas |
|
|
337
|
-
| Testing | Vitest — 92 tests
|
|
338
|
-
| CI/CD | GitHub Actions
|
|
438
|
+
| Validation | Zod 3.25+ with `.strict()` schemas |
|
|
439
|
+
| Testing | Vitest — 92 tests across 7 suites |
|
|
440
|
+
| CI/CD | GitHub Actions → npm publish on release |
|
|
339
441
|
|
|
340
442
|
---
|
|
341
443
|
|
|
@@ -348,12 +450,20 @@ npm run build # zero TS errors
|
|
|
348
450
|
npm test # 92 tests pass
|
|
349
451
|
```
|
|
350
452
|
|
|
351
|
-
PRs must pass CI before merge.
|
|
453
|
+
PRs must pass CI before merge. See [Issues](https://github.com/amanasmuei/amem/issues) for open tasks.
|
|
352
454
|
|
|
353
455
|
---
|
|
354
456
|
|
|
355
|
-
|
|
457
|
+
<p align="center">
|
|
458
|
+
Built by <a href="https://github.com/amanasmuei"><strong>Aman Asmuei</strong></a>
|
|
459
|
+
</p>
|
|
356
460
|
|
|
357
|
-
|
|
461
|
+
<p align="center">
|
|
462
|
+
<a href="https://github.com/amanasmuei/amem">GitHub</a> ·
|
|
463
|
+
<a href="https://www.npmjs.com/package/@aman_asmuei/amem">npm</a> ·
|
|
464
|
+
<a href="https://github.com/amanasmuei/amem/issues">Issues</a>
|
|
465
|
+
</p>
|
|
358
466
|
|
|
359
|
-
|
|
467
|
+
<p align="center">
|
|
468
|
+
<sub>MIT License</sub>
|
|
469
|
+
</p>
|
package/dist/database.d.ts
CHANGED
|
@@ -78,6 +78,23 @@ export interface AmemDatabase {
|
|
|
78
78
|
getRelatedMemories(memoryId: string): Memory[];
|
|
79
79
|
getMemoriesByDateRange(from: number, to: number): Memory[];
|
|
80
80
|
getMemoriesSince(timestamp: number): Memory[];
|
|
81
|
-
fullTextSearch(query: string, limit?: number): Memory[];
|
|
81
|
+
fullTextSearch(query: string, limit?: number, scopeProject?: string): Memory[];
|
|
82
|
+
insertReminder(content: string, dueAt: number | null, scope: string): string;
|
|
83
|
+
listReminders(includeCompleted?: boolean, scope?: string): Array<{
|
|
84
|
+
id: string;
|
|
85
|
+
content: string;
|
|
86
|
+
dueAt: number | null;
|
|
87
|
+
completed: boolean;
|
|
88
|
+
createdAt: number;
|
|
89
|
+
scope: string;
|
|
90
|
+
}>;
|
|
91
|
+
checkReminders(): Array<{
|
|
92
|
+
id: string;
|
|
93
|
+
content: string;
|
|
94
|
+
dueAt: number | null;
|
|
95
|
+
status: "overdue" | "today" | "upcoming";
|
|
96
|
+
scope: string;
|
|
97
|
+
}>;
|
|
98
|
+
completeReminder(id: string): boolean;
|
|
82
99
|
}
|
|
83
100
|
export declare function createDatabase(dbPath: string): AmemDatabase;
|