@aman_asmuei/amem 0.1.3 → 0.2.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 +267 -75
- package/dist/cli.js +3 -18
- package/dist/cli.js.map +1 -1
- package/dist/embeddings.js.map +1 -1
- package/dist/index.js +34 -30
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +338 -0
- package/dist/schemas.js +106 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tools.d.ts +3 -0
- package/dist/tools.js +647 -267
- package/dist/tools.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,8 +11,9 @@ Your AI assistant forgets everything the moment a conversation ends.<br/>
|
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
[](https://github.com/amanasmuei/amem/actions)
|
|
13
13
|
[](https://nodejs.org)
|
|
14
|
+
[](https://modelcontextprotocol.io)
|
|
14
15
|
|
|
15
|
-
[Get Started](
|
|
16
|
+
[Get Started](#get-started) · [How It Works](#how-it-works) · [Tools](#tools) · [Resources & Prompts](#resources--prompts) · [CLI](#cli) · [FAQ](#faq) · [Contributing](#contributing)
|
|
16
17
|
|
|
17
18
|
</div>
|
|
18
19
|
|
|
@@ -48,28 +49,28 @@ amem organizes memories into six types, ranked by importance:
|
|
|
48
49
|
|
|
49
50
|
| Priority | Type | What it captures | Example |
|
|
50
51
|
|:--------:|------|-----------------|---------|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
52
|
+
| 1.0 | **Correction** | Mistakes to never repeat | *"Don't mock the database in integration tests"* |
|
|
53
|
+
| 0.85 | **Decision** | Architectural choices + why | *"Chose Postgres over MongoDB for ACID compliance"* |
|
|
54
|
+
| 0.7 | **Pattern** | Coding style & habits | *"Prefers early returns over nested conditionals"* |
|
|
55
|
+
| 0.7 | **Preference** | Tool & workflow choices | *"Uses pnpm, not npm"* |
|
|
56
|
+
| 0.5 | **Topology** | Where things are | *"Auth module lives in src/auth/, uses JWT"* |
|
|
57
|
+
| 0.4 | **Fact** | General project knowledge | *"API uses REST, launched January 2025"* |
|
|
57
58
|
|
|
58
59
|
Corrections always surface first. They're the "never do this" rules your AI should always follow.
|
|
59
60
|
|
|
60
61
|
---
|
|
61
62
|
|
|
62
|
-
##
|
|
63
|
+
## Get Started
|
|
63
64
|
|
|
64
65
|
### Step 1: Install
|
|
65
66
|
|
|
66
67
|
You need [Node.js](https://nodejs.org) 18 or higher. Then:
|
|
67
68
|
|
|
68
69
|
```bash
|
|
69
|
-
|
|
70
|
+
npm install -g @aman_asmuei/amem
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
That's it. amem
|
|
73
|
+
That's it. amem is now installed on your machine.
|
|
73
74
|
|
|
74
75
|
### Step 2: Connect your AI tool
|
|
75
76
|
|
|
@@ -82,14 +83,13 @@ Add to `~/.claude/settings.json`:
|
|
|
82
83
|
{
|
|
83
84
|
"mcpServers": {
|
|
84
85
|
"amem": {
|
|
85
|
-
"command": "
|
|
86
|
-
"args": ["-y", "@aman_asmuei/amem"]
|
|
86
|
+
"command": "amem"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
Restart Claude Code. You'll see
|
|
92
|
+
Restart Claude Code. You'll see 8 memory tools, 4 resources, and 2 prompts available.
|
|
93
93
|
|
|
94
94
|
</details>
|
|
95
95
|
|
|
@@ -102,8 +102,7 @@ Add to `.cursor/mcp.json` in your project:
|
|
|
102
102
|
{
|
|
103
103
|
"mcpServers": {
|
|
104
104
|
"amem": {
|
|
105
|
-
"command": "
|
|
106
|
-
"args": ["-y", "@aman_asmuei/amem"]
|
|
105
|
+
"command": "amem"
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
}
|
|
@@ -122,8 +121,7 @@ Add to your MCP configuration:
|
|
|
122
121
|
{
|
|
123
122
|
"mcpServers": {
|
|
124
123
|
"amem": {
|
|
125
|
-
"command": "
|
|
126
|
-
"args": ["-y", "@aman_asmuei/amem"]
|
|
124
|
+
"command": "amem"
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
}
|
|
@@ -156,7 +154,7 @@ It knows.
|
|
|
156
154
|
|
|
157
155
|
---
|
|
158
156
|
|
|
159
|
-
##
|
|
157
|
+
## How It Works
|
|
160
158
|
|
|
161
159
|
```
|
|
162
160
|
┌──────────────────────────────────┐
|
|
@@ -164,10 +162,12 @@ It knows.
|
|
|
164
162
|
│ Claude · Cursor · Windsurf │
|
|
165
163
|
└──────────┬───────────────────────┘
|
|
166
164
|
│
|
|
167
|
-
MCP Protocol (
|
|
165
|
+
MCP Protocol (stdio)
|
|
168
166
|
│
|
|
169
167
|
┌──────────▼───────────────────────┐
|
|
170
|
-
│
|
|
168
|
+
│ amem-mcp-server │
|
|
169
|
+
│ │
|
|
170
|
+
│ 8 Tools · 4 Resources · 2 Prompts
|
|
171
171
|
│ │
|
|
172
172
|
│ Store → Score → Deduplicate │
|
|
173
173
|
│ Recall → Rank → Surface │
|
|
@@ -183,51 +183,59 @@ It knows.
|
|
|
183
183
|
|
|
184
184
|
### Smart ranking
|
|
185
185
|
|
|
186
|
-
Every memory gets a score:
|
|
186
|
+
Every memory gets a composite score:
|
|
187
187
|
|
|
188
188
|
```
|
|
189
189
|
score = relevance × recency × confidence × importance
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
- **Relevance** — How closely the memory matches what you're working on (
|
|
193
|
-
- **Recency** —
|
|
194
|
-
- **Confidence** — Memories confirmed multiple times score higher
|
|
195
|
-
- **Importance** — Corrections (1.0) > Decisions (0.85) > Patterns (0.7) > Facts (0.4)
|
|
192
|
+
- **Relevance** — How closely the memory matches what you're working on (cosine similarity via local embeddings, with keyword fallback)
|
|
193
|
+
- **Recency** — Exponential decay (0.995^hours) — recent memories score higher, old ones gradually fade
|
|
194
|
+
- **Confidence** — Memories confirmed multiple times score higher (0.0 to 1.0)
|
|
195
|
+
- **Importance** — Type-based weight: Corrections (1.0) > Decisions (0.85) > Patterns (0.7) > Facts (0.4)
|
|
196
196
|
|
|
197
197
|
### Conflict detection
|
|
198
198
|
|
|
199
199
|
Store a memory that contradicts an existing one? amem catches it:
|
|
200
200
|
|
|
201
|
-
- **>85% similar but different**
|
|
202
|
-
- **>80% similar and agreeing**
|
|
203
|
-
- **
|
|
201
|
+
- **>85% similar but different** — Flags the conflict, updates the existing memory's confidence
|
|
202
|
+
- **>80% similar and agreeing** — Reinforces the existing memory (+0.1 confidence)
|
|
203
|
+
- **60-80% related** — Touches related memories to keep them fresh
|
|
204
|
+
- **No match** — Stores as new
|
|
204
205
|
|
|
205
206
|
### Memory evolution
|
|
206
207
|
|
|
207
|
-
When you store a new memory, related existing memories get reinforced automatically
|
|
208
|
+
When you store a new memory, related existing memories (60-80% similarity) get reinforced automatically — their access timestamps update, keeping your knowledge base connected and current.
|
|
208
209
|
|
|
209
210
|
---
|
|
210
211
|
|
|
211
|
-
##
|
|
212
|
+
## Tools
|
|
213
|
+
|
|
214
|
+
amem gives your AI **8 tools** it can use during conversation. All tools include:
|
|
212
215
|
|
|
213
|
-
|
|
216
|
+
- **Strict input validation** with Zod schemas (invalid inputs are rejected with clear error messages)
|
|
217
|
+
- **Tool annotations** (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so clients understand tool behavior
|
|
218
|
+
- **Structured error handling** — errors return `isError: true` with actionable suggestions
|
|
214
219
|
|
|
215
220
|
### Core tools
|
|
216
221
|
|
|
217
|
-
| Tool | What it does |
|
|
218
|
-
|
|
219
|
-
| `memory_store` | Save a single memory with type, tags, and confidence |
|
|
220
|
-
| `memory_recall` | Search memories by meaning (
|
|
221
|
-
| `memory_context` | Load
|
|
222
|
-
| `memory_extract` | Batch-save multiple memories
|
|
223
|
-
| `memory_forget` | Delete outdated or incorrect memories |
|
|
222
|
+
| Tool | What it does | Annotations |
|
|
223
|
+
|------|-------------|-------------|
|
|
224
|
+
| `memory_store` | Save a single memory with type, tags, and confidence | write, non-destructive |
|
|
225
|
+
| `memory_recall` | Search memories by meaning (semantic + keyword fallback) | read-only, idempotent |
|
|
226
|
+
| `memory_context` | Load all relevant context for a topic, organized by type | read-only, idempotent |
|
|
227
|
+
| `memory_extract` | Batch-save multiple memories from a conversation | write, non-destructive |
|
|
228
|
+
| `memory_forget` | Delete outdated or incorrect memories (with confirmation) | write, destructive |
|
|
229
|
+
| `memory_inject` | Proactively inject corrections + decisions for a topic (use before coding) | read-only, idempotent |
|
|
224
230
|
|
|
225
231
|
### Utility tools
|
|
226
232
|
|
|
227
|
-
| Tool | What it does |
|
|
228
|
-
|
|
229
|
-
| `memory_stats` |
|
|
230
|
-
| `memory_export` | Export all memories as
|
|
233
|
+
| Tool | What it does | Annotations |
|
|
234
|
+
|------|-------------|-------------|
|
|
235
|
+
| `memory_stats` | Memory count, type breakdown, confidence distribution, embedding coverage | read-only, idempotent |
|
|
236
|
+
| `memory_export` | Export all memories as markdown (truncates at 50K chars) | read-only, idempotent |
|
|
237
|
+
|
|
238
|
+
All tools return both human-readable text (`content`) and machine-readable JSON (`structuredContent`) with validated `outputSchema`.
|
|
231
239
|
|
|
232
240
|
### Example: Storing a memory
|
|
233
241
|
|
|
@@ -240,6 +248,8 @@ memory_store({
|
|
|
240
248
|
})
|
|
241
249
|
```
|
|
242
250
|
|
|
251
|
+
> Stored correction memory (a1b2c3d4). Confidence: 1. Tags: [typescript, types]. Total memories: 42.
|
|
252
|
+
|
|
243
253
|
### Example: Recalling memories
|
|
244
254
|
|
|
245
255
|
```
|
|
@@ -247,17 +257,19 @@ memory_recall({ query: "TypeScript best practices", limit: 5 })
|
|
|
247
257
|
```
|
|
248
258
|
|
|
249
259
|
```
|
|
260
|
+
Found 2 memories for "TypeScript best practices":
|
|
261
|
+
|
|
250
262
|
1. [correction] Never use 'any' type — always define proper interfaces
|
|
251
|
-
Score: 0.892 | Confidence: 100% | Age: 2d ago
|
|
263
|
+
Score: 0.892 | Confidence: 100% | Age: 2d ago | Tags: [typescript, types]
|
|
252
264
|
|
|
253
265
|
2. [pattern] User prefers strict TypeScript with no implicit any
|
|
254
|
-
Score: 0.756 | Confidence: 85% | Age: 5d ago
|
|
266
|
+
Score: 0.756 | Confidence: 85% | Age: 5d ago | Tags: [typescript]
|
|
255
267
|
```
|
|
256
268
|
|
|
257
269
|
### Example: Loading context for a task
|
|
258
270
|
|
|
259
271
|
```
|
|
260
|
-
memory_context({ topic: "authentication system" })
|
|
272
|
+
memory_context({ topic: "authentication system", max_tokens: 2000 })
|
|
261
273
|
```
|
|
262
274
|
|
|
263
275
|
```markdown
|
|
@@ -280,43 +292,79 @@ Your AI can extract multiple memories from a single conversation:
|
|
|
280
292
|
```
|
|
281
293
|
memory_extract({
|
|
282
294
|
memories: [
|
|
283
|
-
{ content: "Don't mock the DB in integration tests", type: "correction", confidence: 1.0 },
|
|
284
|
-
{ content: "Chose event sourcing for audit trail", type: "decision", confidence: 0.9 }
|
|
295
|
+
{ content: "Don't mock the DB in integration tests", type: "correction", tags: ["testing"], confidence: 1.0 },
|
|
296
|
+
{ content: "Chose event sourcing for audit trail", type: "decision", tags: ["architecture"], confidence: 0.9 }
|
|
285
297
|
]
|
|
286
298
|
})
|
|
287
299
|
```
|
|
288
300
|
|
|
289
|
-
|
|
301
|
+
```
|
|
302
|
+
Extraction complete: 2 stored, 0 reinforced.
|
|
303
|
+
Total memories: 44.
|
|
290
304
|
|
|
291
|
-
|
|
305
|
+
+ Stored [correction]: "Don't mock the DB in integration tests" (a1b2c3d4)
|
|
306
|
+
+ Stored [decision]: "Chose event sourcing for audit trail" (e5f6g7h8)
|
|
307
|
+
```
|
|
292
308
|
|
|
293
|
-
|
|
309
|
+
### Example: Forgetting memories
|
|
310
|
+
|
|
311
|
+
Delete by ID or by query (with a safety confirmation step):
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
memory_forget({ query: "old project", confirm: false })
|
|
315
|
+
```
|
|
294
316
|
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
amem-cli forget abc12345 # Delete by ID
|
|
317
|
+
```
|
|
318
|
+
Found 3 memories matching "old project". Preview:
|
|
319
|
+
1. [a1b2c3d4] Old project used Express.js
|
|
320
|
+
2. [e5f6g7h8] Old project had no tests
|
|
321
|
+
|
|
322
|
+
Call again with confirm=true to delete these.
|
|
302
323
|
```
|
|
303
324
|
|
|
304
325
|
---
|
|
305
326
|
|
|
306
|
-
##
|
|
327
|
+
## Resources & Prompts
|
|
328
|
+
|
|
329
|
+
### MCP Resources
|
|
307
330
|
|
|
308
|
-
amem exposes **4 resources** that AI clients can read proactively:
|
|
331
|
+
amem exposes **4 resources** that AI clients can read proactively at the start of a conversation:
|
|
309
332
|
|
|
310
|
-
| Resource | What it provides |
|
|
311
|
-
|
|
333
|
+
| Resource URI | What it provides |
|
|
334
|
+
|-------------|-----------------|
|
|
312
335
|
| `amem://corrections` | All active corrections — hard rules the AI should always follow |
|
|
313
336
|
| `amem://decisions` | Past architectural decisions and their rationale |
|
|
314
337
|
| `amem://profile` | Your preferences and coding patterns |
|
|
315
|
-
| `amem://summary` | Quick overview
|
|
338
|
+
| `amem://summary` | Quick overview: memory count and breakdown by type |
|
|
339
|
+
|
|
340
|
+
### MCP Prompts
|
|
341
|
+
|
|
342
|
+
amem provides **2 prompts** that teach AI clients how to use the memory system effectively:
|
|
343
|
+
|
|
344
|
+
| Prompt | Purpose |
|
|
345
|
+
|--------|---------|
|
|
346
|
+
| `extraction-guide` | Guidelines for *what* to extract from conversations — when to save corrections vs. decisions vs. facts, how often, and what to avoid |
|
|
347
|
+
| `session-start` | How to load relevant context at the beginning of a conversation — load topic context, apply corrections as hard constraints, reference memories naturally |
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## CLI
|
|
352
|
+
|
|
353
|
+
amem includes a standalone command-line interface for managing memories directly:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
amem-cli recall "authentication" # Search memories semantically
|
|
357
|
+
amem-cli stats # Show statistics with visual bars
|
|
358
|
+
amem-cli list # List all memories
|
|
359
|
+
amem-cli list --type correction # Filter by type
|
|
360
|
+
amem-cli export # Export to stdout as markdown
|
|
361
|
+
amem-cli export --file memories.md # Export to file
|
|
362
|
+
amem-cli forget abc12345 # Delete by ID (short IDs supported)
|
|
363
|
+
```
|
|
316
364
|
|
|
317
365
|
---
|
|
318
366
|
|
|
319
|
-
##
|
|
367
|
+
## Configuration
|
|
320
368
|
|
|
321
369
|
amem works out of the box with zero configuration. For advanced use:
|
|
322
370
|
|
|
@@ -325,9 +373,59 @@ amem works out of the box with zero configuration. For advanced use:
|
|
|
325
373
|
| `AMEM_DIR` | `~/.amem` | Where amem stores data |
|
|
326
374
|
| `AMEM_DB` | `~/.amem/memory.db` | Database file path |
|
|
327
375
|
|
|
376
|
+
Set `AMEM_DB` per-project for isolated memories:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
AMEM_DB=./project-memories.db amem
|
|
380
|
+
```
|
|
381
|
+
|
|
328
382
|
---
|
|
329
383
|
|
|
330
|
-
##
|
|
384
|
+
## Technical Details
|
|
385
|
+
|
|
386
|
+
### Stack
|
|
387
|
+
|
|
388
|
+
| Layer | Technology |
|
|
389
|
+
|-------|------------|
|
|
390
|
+
| Protocol | [MCP](https://modelcontextprotocol.io/) SDK ^1.25 (modern `registerTool`/`registerResource`/`registerPrompt` APIs) |
|
|
391
|
+
| Language | TypeScript 5.6+ (strict mode, ES2022, zero `any` types) |
|
|
392
|
+
| Database | SQLite via better-sqlite3 (WAL mode, prepared statements, indexed) |
|
|
393
|
+
| Embeddings | HuggingFace Transformers — Xenova/all-MiniLM-L6-v2 (384-dim, local, optional) |
|
|
394
|
+
| Validation | Zod 3.25+ (`.strict()` on all schemas, `.min()` constraints, descriptive errors) |
|
|
395
|
+
| Testing | Vitest — 33 tests across 4 suites |
|
|
396
|
+
| CI/CD | GitHub Actions — Node 18/20/22 |
|
|
397
|
+
|
|
398
|
+
### MCP Best Practices
|
|
399
|
+
|
|
400
|
+
amem follows the [MCP best practices](https://modelcontextprotocol.io/) checklist:
|
|
401
|
+
|
|
402
|
+
- All 8 tools use `server.registerTool()` with `title`, `description`, `inputSchema`, `outputSchema`, and `annotations`
|
|
403
|
+
- All tool handlers wrapped in `try-catch` with `isError: true` on failures
|
|
404
|
+
- All Zod schemas use `.strict()` to reject unknown fields
|
|
405
|
+
- All error messages are actionable (suggest next steps)
|
|
406
|
+
- Server name follows convention: `amem-mcp-server`
|
|
407
|
+
- Transport: stdio (correct for local-first tool)
|
|
408
|
+
- Logging to stderr (not stdout)
|
|
409
|
+
- Graceful shutdown on SIGINT/SIGTERM
|
|
410
|
+
|
|
411
|
+
### Architecture
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
src/
|
|
415
|
+
├── index.ts Entry point — server, prompts, resources, transport
|
|
416
|
+
├── tools.ts 8 MCP tools with annotations, validation, structured output
|
|
417
|
+
├── schemas.ts Zod output schemas for structuredContent responses
|
|
418
|
+
├── memory.ts Scoring engine, conflict detection, recall algorithm
|
|
419
|
+
├── database.ts SQLite schema, prepared statements, CRUD interface
|
|
420
|
+
├── embeddings.ts Local embedding pipeline + cosine similarity
|
|
421
|
+
└── cli.ts Standalone CLI for direct memory management
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**~1,300 lines of TypeScript.** Clean separation of concerns, no circular dependencies.
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## FAQ
|
|
331
429
|
|
|
332
430
|
<details>
|
|
333
431
|
<summary><strong>Is my data sent to the cloud?</strong></summary>
|
|
@@ -339,7 +437,7 @@ No. Everything stays on your machine. amem uses a local SQLite database at `~/.a
|
|
|
339
437
|
<details>
|
|
340
438
|
<summary><strong>Does it work offline?</strong></summary>
|
|
341
439
|
|
|
342
|
-
Yes. After the first run (which downloads the embedding model), amem works completely offline.
|
|
440
|
+
Yes. After the first run (which downloads the embedding model), amem works completely offline. If the model isn't available, amem falls back to keyword matching — it never crashes.
|
|
343
441
|
|
|
344
442
|
</details>
|
|
345
443
|
|
|
@@ -353,53 +451,147 @@ Any tool that supports the [Model Context Protocol (MCP)](https://modelcontextpr
|
|
|
353
451
|
<details>
|
|
354
452
|
<summary><strong>How much memory/disk does it use?</strong></summary>
|
|
355
453
|
|
|
356
|
-
The embedding model is ~80MB (downloaded once). The SQLite database grows with your memories — typically a few MB even after months of use. CPU usage is minimal.
|
|
454
|
+
The embedding model is ~80MB (downloaded once, cached locally). The SQLite database grows with your memories — typically a few MB even after months of use. CPU usage is minimal; the server idles at near-zero when not processing requests.
|
|
357
455
|
|
|
358
456
|
</details>
|
|
359
457
|
|
|
360
458
|
<details>
|
|
361
459
|
<summary><strong>Can I see what's stored?</strong></summary>
|
|
362
460
|
|
|
363
|
-
Yes! Use `amem-cli list` to see all memories, `amem-cli stats` for
|
|
461
|
+
Yes! Use `amem-cli list` to see all memories, `amem-cli stats` for a visual overview, or `amem-cli export --file backup.md` to export everything as readable markdown. You can also ask your AI to call `memory_stats` or `memory_export`.
|
|
364
462
|
|
|
365
463
|
</details>
|
|
366
464
|
|
|
367
465
|
<details>
|
|
368
466
|
<summary><strong>Can I delete specific memories?</strong></summary>
|
|
369
467
|
|
|
370
|
-
Yes. Use `amem-cli forget <id>` or ask your AI to call `memory_forget`.
|
|
468
|
+
Yes. Use `amem-cli forget <id>` (short IDs work — just the first 8 characters) or ask your AI to call `memory_forget`. Query-based deletion requires a confirmation step to prevent accidents: `memory_forget({ query: "old project", confirm: true })`.
|
|
371
469
|
|
|
372
470
|
</details>
|
|
373
471
|
|
|
374
472
|
<details>
|
|
375
473
|
<summary><strong>Does it slow down my AI?</strong></summary>
|
|
376
474
|
|
|
377
|
-
No. Memory operations typically take under 50ms. Embedding generation for new memories takes ~200ms. The server runs as a lightweight background process.
|
|
475
|
+
No. Memory operations typically take under 50ms. Embedding generation for new memories takes ~200ms. The server runs as a lightweight background process over stdio.
|
|
378
476
|
|
|
379
477
|
</details>
|
|
380
478
|
|
|
381
479
|
<details>
|
|
382
480
|
<summary><strong>Can I use it across multiple projects?</strong></summary>
|
|
383
481
|
|
|
384
|
-
Yes. amem stores memories globally at `~/.amem/memory.db`
|
|
482
|
+
Yes. By default, amem stores memories globally at `~/.amem/memory.db` — all your AI conversations across all projects share the same memory. Set `AMEM_DB` per-project for isolated memories.
|
|
483
|
+
|
|
484
|
+
</details>
|
|
485
|
+
|
|
486
|
+
<details>
|
|
487
|
+
<summary><strong>What happens if the embedding model isn't available?</strong></summary>
|
|
488
|
+
|
|
489
|
+
amem gracefully falls back to keyword-based matching. Semantic search won't work, but storing, recalling (by keyword), and all other operations continue normally. The server never crashes due to missing embeddings.
|
|
490
|
+
|
|
491
|
+
</details>
|
|
492
|
+
|
|
493
|
+
<details>
|
|
494
|
+
<summary><strong>How does conflict detection work?</strong></summary>
|
|
495
|
+
|
|
496
|
+
When you store a new memory, amem computes cosine similarity against all existing memories. If a match exceeds 85% similarity but the content is different, it flags a conflict and updates the existing memory's confidence instead of creating a duplicate. You get a clear message explaining what happened and how to rephrase if the memories are genuinely different.
|
|
385
497
|
|
|
386
498
|
</details>
|
|
387
499
|
|
|
388
500
|
---
|
|
389
501
|
|
|
390
|
-
##
|
|
502
|
+
## Contributing
|
|
503
|
+
|
|
504
|
+
Contributions are welcome! Here's how to get involved.
|
|
505
|
+
|
|
506
|
+
### Development setup
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
git clone https://github.com/amanasmuei/amem.git
|
|
510
|
+
cd amem
|
|
511
|
+
npm install
|
|
512
|
+
npm run build
|
|
513
|
+
npm test
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### Scripts
|
|
517
|
+
|
|
518
|
+
| Script | What it does |
|
|
519
|
+
|--------|-------------|
|
|
520
|
+
| `npm run build` | Compile TypeScript to `dist/` |
|
|
521
|
+
| `npm run dev` | Watch mode — recompile on save |
|
|
522
|
+
| `npm test` | Run all 33 tests with Vitest |
|
|
523
|
+
| `npm run test:watch` | Run tests in watch mode |
|
|
524
|
+
| `npm start` | Start the MCP server (`node dist/index.js`) |
|
|
525
|
+
|
|
526
|
+
### Project structure
|
|
527
|
+
|
|
528
|
+
```
|
|
529
|
+
amem/
|
|
530
|
+
├── src/
|
|
531
|
+
│ ├── index.ts # MCP server entry point, prompts, resources
|
|
532
|
+
│ ├── tools.ts # 7 tool definitions with validation & error handling
|
|
533
|
+
│ ├── memory.ts # Scoring engine, conflict detection, recall
|
|
534
|
+
│ ├── database.ts # SQLite schema, prepared statements, CRUD
|
|
535
|
+
│ ├── embeddings.ts # Local embedding pipeline + cosine similarity
|
|
536
|
+
│ └── cli.ts # Standalone CLI
|
|
537
|
+
├── tests/
|
|
538
|
+
│ ├── database.test.ts
|
|
539
|
+
│ ├── embeddings.test.ts
|
|
540
|
+
│ ├── memory.test.ts
|
|
541
|
+
│ └── tools.test.ts
|
|
542
|
+
├── .github/
|
|
543
|
+
│ └── workflows/
|
|
544
|
+
│ ├── ci.yml # Test on push/PR (Node 18/20/22)
|
|
545
|
+
│ └── publish.yml # Publish to npm on GitHub Release
|
|
546
|
+
├── package.json
|
|
547
|
+
├── tsconfig.json
|
|
548
|
+
└── vitest.config.ts
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Making changes
|
|
552
|
+
|
|
553
|
+
1. Fork the repository
|
|
554
|
+
2. Create a feature branch: `git checkout -b feature/your-feature`
|
|
555
|
+
3. Make your changes
|
|
556
|
+
4. Ensure the build is clean: `npm run build`
|
|
557
|
+
5. Ensure all tests pass: `npm test`
|
|
558
|
+
6. Commit and push your branch
|
|
559
|
+
7. Open a Pull Request against `main`
|
|
560
|
+
|
|
561
|
+
### CI/CD
|
|
562
|
+
|
|
563
|
+
**GitHub Actions** runs automatically on every push and pull request:
|
|
564
|
+
|
|
565
|
+
- **CI workflow** (`ci.yml`) — builds and tests against Node.js 18, 20, and 22 on Ubuntu
|
|
566
|
+
- **Publish workflow** (`publish.yml`) — triggered on GitHub Release, builds, tests, and publishes to npm with `--access public`
|
|
567
|
+
|
|
568
|
+
All PRs must pass the CI pipeline before merging.
|
|
569
|
+
|
|
570
|
+
### Reporting issues
|
|
571
|
+
|
|
572
|
+
Found a bug or have a feature idea?
|
|
573
|
+
|
|
574
|
+
- **Bug reports**: [Open an issue](https://github.com/amanasmuei/amem/issues/new) with steps to reproduce, expected vs. actual behavior, and your Node.js version
|
|
575
|
+
- **Feature requests**: [Open an issue](https://github.com/amanasmuei/amem/issues/new) describing the use case and how it would improve the memory system
|
|
576
|
+
- **Questions**: [Start a discussion](https://github.com/amanasmuei/amem/discussions) (or open an issue)
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
## Roadmap
|
|
391
581
|
|
|
392
|
-
- [x]
|
|
393
|
-
- [x] Semantic search with local embeddings
|
|
582
|
+
- [x] 8 MCP tools with full annotations, validation, and error handling
|
|
583
|
+
- [x] Semantic search with local embeddings (graceful fallback to keywords)
|
|
394
584
|
- [x] Smart conflict detection and deduplication
|
|
395
585
|
- [x] Memory evolution (related memories reinforce each other)
|
|
396
586
|
- [x] CLI for direct memory management
|
|
397
587
|
- [x] MCP prompts and resources for proactive context
|
|
398
588
|
- [x] Published on npm
|
|
589
|
+
- [x] `outputSchema` + `structuredContent` for machine-readable tool responses
|
|
590
|
+
- [x] Proactive context injection (`memory_inject` tool)
|
|
591
|
+
- [x] Evaluation suite (10 standardized eval questions)
|
|
399
592
|
- [ ] Memory verification against filesystem
|
|
400
593
|
- [ ] Knowledge graph with entity relationships
|
|
401
594
|
- [ ] Team memory (shared context across developers)
|
|
402
|
-
- [ ] Proactive mid-conversation context injection
|
|
403
595
|
|
|
404
596
|
---
|
|
405
597
|
|
|
@@ -407,7 +599,7 @@ Yes. amem stores memories globally at `~/.amem/memory.db` by default. All your A
|
|
|
407
599
|
|
|
408
600
|
**Built by [Aman Asmuei](https://github.com/amanasmuei)**
|
|
409
601
|
|
|
410
|
-
[
|
|
602
|
+
[GitHub](https://github.com/amanasmuei/amem) · [npm](https://www.npmjs.com/package/@aman_asmuei/amem) · [Report Bug](https://github.com/amanasmuei/amem/issues) · [Request Feature](https://github.com/amanasmuei/amem/issues)
|
|
411
603
|
|
|
412
604
|
MIT License
|
|
413
605
|
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createDatabase } from "./database.js";
|
|
3
3
|
import { recallMemories, MemoryType } from "./memory.js";
|
|
4
4
|
import { generateEmbedding } from "./embeddings.js";
|
|
5
|
+
import { formatAge, TYPE_ORDER } from "./tools.js";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import os from "node:os";
|
|
7
8
|
import fs from "node:fs";
|
|
@@ -121,8 +122,7 @@ function handleStats() {
|
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
123
124
|
console.log(" By type:");
|
|
124
|
-
const
|
|
125
|
-
for (const t of typeOrder) {
|
|
125
|
+
for (const t of TYPE_ORDER) {
|
|
126
126
|
const count = stats.byType[t] || 0;
|
|
127
127
|
if (count > 0) {
|
|
128
128
|
const bar = "\u2588".repeat(Math.min(count, 40));
|
|
@@ -163,11 +163,10 @@ function handleExport(args) {
|
|
|
163
163
|
console.log("No memories to export.");
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
const typeOrder = ["correction", "decision", "pattern", "preference", "topology", "fact"];
|
|
167
166
|
let md = `# Amem Memory Export\n\n`;
|
|
168
167
|
md += `*Exported: ${new Date().toISOString()}*\n`;
|
|
169
168
|
md += `*Total: ${all.length} memories*\n\n`;
|
|
170
|
-
for (const t of
|
|
169
|
+
for (const t of TYPE_ORDER) {
|
|
171
170
|
const memories = all.filter(m => m.type === t);
|
|
172
171
|
if (memories.length === 0)
|
|
173
172
|
continue;
|
|
@@ -235,18 +234,4 @@ function handleForget(args) {
|
|
|
235
234
|
db.deleteMemory(match.id);
|
|
236
235
|
console.log(`Deleted: "${match.content}" (${match.type})`);
|
|
237
236
|
}
|
|
238
|
-
function formatAge(timestamp) {
|
|
239
|
-
const ms = Date.now() - timestamp;
|
|
240
|
-
const minutes = Math.floor(ms / 60000);
|
|
241
|
-
if (minutes < 60)
|
|
242
|
-
return `${minutes}m ago`;
|
|
243
|
-
const hours = Math.floor(minutes / 60);
|
|
244
|
-
if (hours < 24)
|
|
245
|
-
return `${hours}h ago`;
|
|
246
|
-
const days = Math.floor(hours / 24);
|
|
247
|
-
if (days < 30)
|
|
248
|
-
return `${days}d ago`;
|
|
249
|
-
const months = Math.floor(days / 30);
|
|
250
|
-
return `${months}mo ago`;
|
|
251
|
-
}
|
|
252
237
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAwB,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1E,MAAM,OAAO,GAAG,OAAO,CAAC,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