@aman_asmuei/amem 0.14.1 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +294 -487
- package/dist/ann.d.ts +12 -4
- package/dist/ann.js +124 -7
- package/dist/ann.js.map +1 -1
- package/dist/cli.js +49 -17
- package/dist/cli.js.map +1 -1
- package/dist/database.js +73 -36
- package/dist/database.js.map +1 -1
- package/dist/extractor.d.ts +13 -0
- package/dist/extractor.js +89 -0
- package/dist/extractor.js.map +1 -0
- package/dist/hooks.js +68 -4
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +3 -3
- package/dist/memory.js +13 -13
- package/dist/memory.js.map +1 -1
- package/dist/repair.d.ts +8 -0
- package/dist/repair.js +90 -0
- package/dist/repair.js.map +1 -0
- package/dist/schemas.d.ts +32 -21
- package/dist/schemas.js +6 -3
- package/dist/schemas.js.map +1 -1
- package/dist/tools/advanced.js +31 -1
- package/dist/tools/advanced.js.map +1 -1
- package/dist/tools/graph.js +32 -2
- package/dist/tools/graph.js.map +1 -1
- package/dist/tools/memory.js +27 -27
- package/dist/tools/memory.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<h1 align="center">amem</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong>
|
|
8
|
+
<strong>One memory. Every AI tool.</strong>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
@@ -21,97 +21,85 @@
|
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
23
|
<p align="center">
|
|
24
|
-
|
|
25
|
-
Local-first · Semantic ·
|
|
24
|
+
Tell your AI something once — it remembers across Claude Code, GitHub Copilot, Cursor, Windsurf, and any MCP client.<br/>
|
|
25
|
+
Local-first · Semantic search · Knowledge graph · Privacy-aware · No cloud required.
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
|
+
<br/>
|
|
29
|
+
|
|
30
|
+
<table align="center">
|
|
31
|
+
<tr>
|
|
32
|
+
<td><strong>72% Recall@5</strong><br/><sub>Semantic accuracy</sub></td>
|
|
33
|
+
<td><strong>0.08ms</strong><br/><sub>Search at 10k memories</sub></td>
|
|
34
|
+
<td><strong>28 MCP tools</strong><br/><sub>Full memory toolkit</sub></td>
|
|
35
|
+
<td><strong>357 tests</strong><br/><sub>All passing</sub></td>
|
|
36
|
+
</tr>
|
|
37
|
+
</table>
|
|
38
|
+
|
|
39
|
+
<br/>
|
|
40
|
+
|
|
28
41
|
<p align="center">
|
|
29
|
-
<a href="#-
|
|
42
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
30
43
|
<a href="#-how-it-works">How It Works</a> •
|
|
31
|
-
<a href="#-
|
|
32
|
-
<a href="
|
|
44
|
+
<a href="#-benchmarks">Benchmarks</a> •
|
|
45
|
+
<a href="#-tools-reference">Tools</a> •
|
|
33
46
|
<a href="#-usage-guide">Usage Guide</a> •
|
|
34
|
-
<a href="#-architecture">Architecture</a>
|
|
35
|
-
<a href="#-contributing">Contributing</a>
|
|
47
|
+
<a href="#-architecture">Architecture</a>
|
|
36
48
|
</p>
|
|
37
49
|
|
|
38
50
|
---
|
|
39
51
|
|
|
40
|
-
##
|
|
52
|
+
## Why amem?
|
|
41
53
|
|
|
42
|
-
Every
|
|
54
|
+
Every AI tool starts from zero. Every session. Every tool.
|
|
43
55
|
|
|
44
|
-
> *"Don't use `any` in TypeScript"* — told
|
|
56
|
+
> *"Don't use `any` in TypeScript"* — told Claude three times. Copilot still doesn't know.
|
|
45
57
|
>
|
|
46
|
-
> *"We chose PostgreSQL over MongoDB"* —
|
|
47
|
-
>
|
|
48
|
-
> *"I prefer early returns and pnpm"* — explained again. And again.
|
|
49
|
-
|
|
50
|
-
**You repeat yourself. Every. Single. Session.**
|
|
51
|
-
|
|
52
|
-
## The Solution
|
|
58
|
+
> *"We chose PostgreSQL over MongoDB"* — explained in Cursor. Claude has no idea.
|
|
53
59
|
|
|
54
|
-
**amem**
|
|
60
|
+
**amem** gives all your AI tools a shared, persistent memory.
|
|
55
61
|
|
|
56
62
|
```
|
|
57
|
-
You:
|
|
58
|
-
|
|
63
|
+
You (in Claude Code): "Don't use any type in TypeScript"
|
|
59
64
|
amem stores this as a correction (priority 1.0)
|
|
60
|
-
|
|
65
|
+
|
|
66
|
+
You (switch to Copilot): starts coding
|
|
67
|
+
Copilot already knows — amem feeds it the same correction
|
|
61
68
|
```
|
|
62
69
|
|
|
63
70
|
No cloud. No API keys. Everything stays on your machine.
|
|
64
71
|
|
|
65
|
-
### Compatibility
|
|
66
|
-
|
|
67
|
-
| Feature | Claude Code | GitHub Copilot CLI | Cursor / Windsurf / Other |
|
|
68
|
-
|---------|:-----------:|:------------------:|:-------------------------:|
|
|
69
|
-
| One-command plugin install | Yes | Yes | — |
|
|
70
|
-
| 28 MCP tools | Yes | Yes | Yes |
|
|
71
|
-
| AI skills | 14 | 7 | — |
|
|
72
|
-
| Auto-capture hooks | Yes | Yes | — |
|
|
73
|
-
| Session auto-summarize | Yes | Yes | — |
|
|
74
|
-
| Auto-memory sync | Yes | — | — |
|
|
75
|
-
| CLI setup (`amem-cli init`) | Yes | Yes | Yes |
|
|
76
|
-
| Extraction rules | Yes | Yes | Yes |
|
|
77
|
-
|
|
78
|
-
> **Claude Code** has the deepest integration (plugin + hooks + auto-memory sync). **Copilot CLI** is a close second with plugin + hooks. **Other MCP clients** get the full 28-tool MCP server via manual config.
|
|
79
|
-
|
|
80
72
|
---
|
|
81
73
|
|
|
82
|
-
##
|
|
74
|
+
## Quick Start
|
|
83
75
|
|
|
84
|
-
|
|
76
|
+
<table>
|
|
77
|
+
<tr>
|
|
78
|
+
<td width="50%">
|
|
85
79
|
|
|
86
|
-
|
|
80
|
+
**Claude Code** (recommended)
|
|
87
81
|
|
|
88
82
|
```bash
|
|
89
83
|
/plugin marketplace add amanasmuei/amem
|
|
90
84
|
/plugin install amem
|
|
91
85
|
```
|
|
92
86
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- **Lifecycle hooks** — PostToolUse (captures observations) + Stop (auto-summarizes sessions)
|
|
96
|
-
- **14 AI skills** — `remember`, `recall`, `context`, `sync`, `dashboard`, `stats`, `doctor`, `export`, `list`, `init`, `rules`, `hooks`, `team-import`, `team-export`
|
|
97
|
-
- **CLAUDE.md** context injected every session
|
|
87
|
+
</td>
|
|
88
|
+
<td width="50%">
|
|
98
89
|
|
|
99
|
-
|
|
90
|
+
**GitHub Copilot CLI**
|
|
100
91
|
|
|
101
92
|
```bash
|
|
102
93
|
copilot plugin marketplace add amanasmuei/amem
|
|
103
94
|
copilot plugin install amem
|
|
104
95
|
```
|
|
105
96
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
- **7 AI skills** — `remember`, `recall`, `context`, `stats`, `doctor`, `export`, `list`
|
|
110
|
-
- **AGENTS.md** context injected every session
|
|
97
|
+
</td>
|
|
98
|
+
</tr>
|
|
99
|
+
</table>
|
|
111
100
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
For Cursor, Windsurf, or any other MCP-compatible tool:
|
|
101
|
+
<details>
|
|
102
|
+
<summary><strong>Cursor / Windsurf / Any MCP Client</strong></summary>
|
|
115
103
|
|
|
116
104
|
```bash
|
|
117
105
|
npm install -g @aman_asmuei/amem
|
|
@@ -119,27 +107,8 @@ amem-cli init # Detects & configures all installed AI tools
|
|
|
119
107
|
amem-cli rules # Generates extraction rules for proactive memory use
|
|
120
108
|
```
|
|
121
109
|
|
|
122
|
-
|
|
123
|
-
<summary><strong>What does each command do?</strong></summary>
|
|
124
|
-
|
|
125
|
-
| Command | What it does |
|
|
126
|
-
|---|---|
|
|
127
|
-
| `amem-cli init` | Finds your installed AI tools and adds amem to their MCP server config. Works with Claude Code, Cursor, Windsurf, and GitHub Copilot. |
|
|
128
|
-
| `amem-cli rules` | Writes extraction guidelines to your tool's rules file (`CLAUDE.md`, `.cursorrules`, etc.). Teaches the AI *when* and *how* to store memories. |
|
|
129
|
-
| `amem-cli hooks` | Installs Claude Code lifecycle hooks for passive capture (PostToolUse + Stop). |
|
|
130
|
-
| `amem-cli sync` | Imports Claude Code auto-memory files into amem for unified structured access. |
|
|
131
|
-
|
|
132
|
-
</details>
|
|
110
|
+
Or configure manually:
|
|
133
111
|
|
|
134
|
-
<details>
|
|
135
|
-
<summary><strong>Manual MCP configuration</strong></summary>
|
|
136
|
-
|
|
137
|
-
**Claude Code:**
|
|
138
|
-
```bash
|
|
139
|
-
claude mcp add amem -- npx -y @aman_asmuei/amem
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Cursor / Windsurf / Other MCP Clients:**
|
|
143
112
|
```json
|
|
144
113
|
{
|
|
145
114
|
"mcpServers": {
|
|
@@ -153,172 +122,109 @@ claude mcp add amem -- npx -y @aman_asmuei/amem
|
|
|
153
122
|
|
|
154
123
|
</details>
|
|
155
124
|
|
|
156
|
-
|
|
125
|
+
**Verify it works:**
|
|
157
126
|
|
|
158
127
|
```bash
|
|
159
|
-
amem-cli stats
|
|
160
|
-
amem-cli dashboard # Opens web dashboard at localhost:3333
|
|
128
|
+
amem-cli stats # Should show "0 memories" initially
|
|
161
129
|
```
|
|
162
130
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
> *"Remember: always use strict TypeScript, never use any type"*
|
|
166
|
-
|
|
167
|
-
Start a **new** conversation and ask:
|
|
168
|
-
|
|
169
|
-
> *"What do you remember about TypeScript?"*
|
|
170
|
-
|
|
171
|
-
It should recall the correction instantly.
|
|
172
|
-
|
|
173
|
-
### AI Skills
|
|
174
|
-
|
|
175
|
-
The plugin includes skills that the AI invokes automatically based on your intent:
|
|
131
|
+
Tell your AI: *"Remember: always use strict TypeScript, never use any type"*
|
|
176
132
|
|
|
177
|
-
|
|
178
|
-
|---|---|:---:|:---:|
|
|
179
|
-
| *"Remember never use any type"* | `remember` | Yes | Yes |
|
|
180
|
-
| *"What do you remember about auth?"* | `recall` | Yes | Yes |
|
|
181
|
-
| *"Load context for this task"* | `context` | Yes | Yes |
|
|
182
|
-
| *"Show memory stats"* | `stats` | Yes | Yes |
|
|
183
|
-
| *"Run memory doctor"* | `doctor` | Yes | Yes |
|
|
184
|
-
| *"Export my memories"* | `export` | Yes | Yes |
|
|
185
|
-
| *"List all corrections"* | `list` | Yes | Yes |
|
|
186
|
-
| *"Sync my Claude memory"* | `sync` | Yes | — |
|
|
187
|
-
| *"Open the memory dashboard"* | `dashboard` | Yes | — |
|
|
188
|
-
| *"Install hooks"* | `hooks` | Yes | — |
|
|
133
|
+
Start a **new** session: *"What do you remember about TypeScript?"* — it recalls instantly.
|
|
189
134
|
|
|
190
135
|
---
|
|
191
136
|
|
|
192
137
|
## How It Works
|
|
193
138
|
|
|
194
|
-
amem captures knowledge in **three
|
|
139
|
+
amem captures knowledge in **three layers** — from fully automatic to fully manual:
|
|
140
|
+
|
|
141
|
+
| Layer | How | What it does |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| **Automatic** | Lifecycle hooks | Captures tool observations, auto-extracts corrections/decisions/patterns at session end |
|
|
144
|
+
| **AI-driven** | Extraction rules | Your AI proactively calls `memory_store` when you correct it, make decisions, or express preferences |
|
|
145
|
+
| **Manual** | Natural language | *"Remember: we use PostgreSQL"* or *"Forget the Redis memory"* |
|
|
195
146
|
|
|
196
|
-
###
|
|
147
|
+
### Memory Types
|
|
197
148
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
149
|
+
| Priority | Type | Example |
|
|
150
|
+
|:---:|---|---|
|
|
151
|
+
| **1.0** | **correction** | *"Don't mock the DB in integration tests"* |
|
|
152
|
+
| **0.85** | **decision** | *"Chose Postgres over Mongo for ACID"* |
|
|
153
|
+
| **0.7** | **pattern** | *"Prefers early returns over nesting"* |
|
|
154
|
+
| **0.7** | **preference** | *"Uses pnpm, not npm"* |
|
|
155
|
+
| **0.5** | **topology** | *"Auth module lives in src/auth/"* |
|
|
156
|
+
| **0.4** | **fact** | *"API launched January 2025"* |
|
|
202
157
|
|
|
203
|
-
|
|
158
|
+
Corrections always surface first — they are your AI's hard constraints.
|
|
204
159
|
|
|
205
|
-
|
|
206
|
-
- Call `memory_inject` at session start to load corrections & decisions
|
|
207
|
-
- Call `memory_extract` every ~10 exchanges to batch-save insights
|
|
208
|
-
- Call `memory_store` when you correct it or make a decision
|
|
209
|
-
- Call `reminder_check` to surface overdue reminders
|
|
160
|
+
### Memory Tiers
|
|
210
161
|
|
|
211
|
-
|
|
162
|
+
| Tier | Behavior |
|
|
163
|
+
|---|---|
|
|
164
|
+
| **Core** | Always injected at session start (~500 tokens). Your most critical corrections. |
|
|
165
|
+
| **Working** | Session-scoped, auto-surfaced for current task. |
|
|
166
|
+
| **Archival** | Default. Searchable but not auto-injected. |
|
|
212
167
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
-
|
|
217
|
-
-
|
|
168
|
+
### Temporal Validity
|
|
169
|
+
|
|
170
|
+
Memories aren't forever. When facts change:
|
|
171
|
+
- Old memories get **expired** (not deleted) — preserved for *"what was true in March?"*
|
|
172
|
+
- Contradictions are **auto-detected** — storing a new decision auto-expires the old one
|
|
173
|
+
- Query any point in time with `memory_since`
|
|
218
174
|
|
|
219
175
|
---
|
|
220
176
|
|
|
221
|
-
##
|
|
177
|
+
## Benchmarks
|
|
222
178
|
|
|
223
|
-
|
|
179
|
+
### Recall Accuracy
|
|
224
180
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
| `0.85` | **decision** | Architecture/design choice made | *"Chose Postgres over Mongo for ACID"* |
|
|
229
|
-
| `0.7` | **pattern** | Recurring coding style | *"Prefers early returns over nesting"* |
|
|
230
|
-
| `0.7` | **preference** | Tool or workflow choice | *"Uses pnpm, not npm"* |
|
|
231
|
-
| `0.5` | **topology** | Codebase structure | *"Auth module lives in src/auth/"* |
|
|
232
|
-
| `0.4` | **fact** | General project knowledge | *"API launched January 2025"* |
|
|
181
|
+
<table>
|
|
182
|
+
<tr>
|
|
183
|
+
<td>
|
|
233
184
|
|
|
234
|
-
|
|
185
|
+
| Strategy | Recall@5 | MRR |
|
|
186
|
+
|---|---|---|
|
|
187
|
+
| FTS5 keyword only | 31.3% | 31.3% |
|
|
188
|
+
| **Semantic** (default) | **72.4%** | **82.5%** |
|
|
189
|
+
| **Multi-strategy** | **74.5%** | **76.2%** |
|
|
190
|
+
| + reranking (opt-in) | ~80%+ | ~85%+ |
|
|
235
191
|
|
|
236
|
-
|
|
192
|
+
</td>
|
|
193
|
+
<td>
|
|
237
194
|
|
|
238
|
-
|
|
195
|
+
Corpus: 34 developer memories, 16 queries, 5 graph edges.
|
|
239
196
|
|
|
240
|
-
|
|
241
|
-
|---|---|---|
|
|
242
|
-
| **Core** | Always injected at session start (~500 tokens max) | Your most critical corrections and decisions |
|
|
243
|
-
| **Working** | Session-scoped, auto-surfaced for current task | Context relevant to what you're doing now |
|
|
244
|
-
| **Archival** | Searchable but not auto-injected (default) | Everything else — the long-term store |
|
|
197
|
+
Reproduce: `npx vitest run benchmarks/`
|
|
245
198
|
|
|
246
|
-
|
|
199
|
+
**Default: 72% Recall@5, 82% MRR** with local embeddings. Degrades gracefully to keyword matching (~31%) before model downloads.
|
|
247
200
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
- You can query any point in time with `memory_since`
|
|
201
|
+
</td>
|
|
202
|
+
</tr>
|
|
203
|
+
</table>
|
|
252
204
|
|
|
253
|
-
|
|
205
|
+
### Search Latency — HNSW Vector Index
|
|
254
206
|
|
|
255
|
-
|
|
207
|
+
<table>
|
|
208
|
+
<tr>
|
|
209
|
+
<td>
|
|
256
210
|
|
|
257
|
-
|
|
211
|
+
| Memories | HNSW | Brute-force | Speedup |
|
|
212
|
+
|---|---|---|---|
|
|
213
|
+
| 100 | 0.05ms | 0.10ms | 2x |
|
|
214
|
+
| 1,000 | 0.06ms | 0.50ms | **8x** |
|
|
215
|
+
| 5,000 | 0.08ms | 2.44ms | **30x** |
|
|
216
|
+
| 10,000 | 0.08ms | 5.35ms | **67x** |
|
|
258
217
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
| Upgraded embedding model | `bge-small-en-v1.5` — better MTEB retrieval scores, same 384-dim |
|
|
262
|
-
| Additive weighted scoring | Fair ranking — no single low factor kills the score |
|
|
263
|
-
| Query expansion | Dev-domain synonyms (`auth` → `authentication`, `login`, `session`) + stemming |
|
|
264
|
-
| Auto-relate | New memories automatically link to similar ones — graph builds itself |
|
|
265
|
-
| Graph-aware injection | `memory_inject` surfaces 1-hop knowledge graph neighbors |
|
|
266
|
-
| In-memory ANN index | Pre-loaded vectors for fast semantic search (vs SQLite BLOB scan) |
|
|
267
|
-
| `amem doctor` | Health diagnostics CLI — embedding coverage, core budget, stale memories |
|
|
268
|
-
| Cross-session continuity | `amem://last-session` resource for previous session summary |
|
|
269
|
-
| CI benchmarks | Recall regression detection in CI pipeline |
|
|
218
|
+
</td>
|
|
219
|
+
<td>
|
|
270
220
|
|
|
271
|
-
|
|
272
|
-
<summary><strong>View all features across versions</strong></summary>
|
|
273
|
-
|
|
274
|
-
### v0.12.0
|
|
275
|
-
- Passive capture and auto-injection
|
|
276
|
-
- Team sync and dashboard timeline
|
|
277
|
-
- Auto-recover corrupted embedding cache
|
|
278
|
-
|
|
279
|
-
### v0.9.x — The Temporal Intelligence Release
|
|
280
|
-
- Temporal validity (`valid_from`/`valid_until`) — facts expire, history preserved
|
|
281
|
-
- Auto-expire contradicting memories on store
|
|
282
|
-
- Multi-strategy retrieval: semantic + FTS5 + knowledge graph + temporal recency
|
|
283
|
-
- Cross-encoder reranking (optional 2nd-pass for highest accuracy)
|
|
284
|
-
- Memory tiers: core (always loaded) / working (session) / archival (searchable)
|
|
285
|
-
- Privacy tags `<private>...</private>` stripped; API keys auto-redacted
|
|
286
|
-
- Lifecycle hooks for passive observation
|
|
287
|
-
- Session summaries with key decisions and corrections
|
|
288
|
-
- Interactive dashboard with drag-and-drop graph, memory editing, export
|
|
289
|
-
- Config system (`~/.amem/config.json`)
|
|
290
|
-
- Benchmark suite (Recall@K / MRR / Precision)
|
|
291
|
-
|
|
292
|
-
### v0.8.0
|
|
293
|
-
- `amem init` — auto-configure all AI tools in one command
|
|
294
|
-
- `amem rules` — generate extraction rules
|
|
295
|
-
- `amem dashboard` — web-based memory browser
|
|
296
|
-
|
|
297
|
-
### v0.7.0
|
|
298
|
-
- Memory import/export with content-hash dedup
|
|
299
|
-
- Confidence decay for stale memories
|
|
300
|
-
- Embedding cache (LRU, 128 entries)
|
|
301
|
-
- Multi-process safe database
|
|
302
|
-
|
|
303
|
-
### v0.5.x
|
|
304
|
-
- Progressive disclosure (`compact` mode, ~10x token savings)
|
|
305
|
-
- Persistent cross-session reminders with deadlines
|
|
306
|
-
|
|
307
|
-
### v0.4.0
|
|
308
|
-
- Lossless conversation log (append-only)
|
|
309
|
-
- Surgical patch system with version history
|
|
310
|
-
- Knowledge graph with typed relations
|
|
311
|
-
- Temporal queries with natural language ranges
|
|
312
|
-
- Full-text search (FTS5)
|
|
313
|
-
|
|
314
|
-
### v0.1.0 — v0.3.0
|
|
315
|
-
- Core store/recall with semantic search
|
|
316
|
-
- Local embeddings (HuggingFace)
|
|
317
|
-
- SQLite + WAL persistence
|
|
318
|
-
- Memory consolidation engine
|
|
319
|
-
- Project-aware scoping
|
|
221
|
+
Measured: 100 searches averaged, 384-dim embeddings, top-10 results.
|
|
320
222
|
|
|
321
|
-
|
|
223
|
+
**Sub-0.1ms at any scale** — effectively O(log n). HNSW is an optional dependency; brute-force is used as fallback when unavailable.
|
|
224
|
+
|
|
225
|
+
</td>
|
|
226
|
+
</tr>
|
|
227
|
+
</table>
|
|
322
228
|
|
|
323
229
|
---
|
|
324
230
|
|
|
@@ -328,143 +234,123 @@ Memories aren't forever. When facts change:
|
|
|
328
234
|
|
|
329
235
|
| Tool | Description |
|
|
330
236
|
|---|---|
|
|
331
|
-
| `memory_store` | Store a memory with type, tags, confidence. Auto-redacts private content
|
|
332
|
-
| `memory_recall` | Semantic search
|
|
333
|
-
| `memory_detail` | Retrieve full content by ID after compact recall |
|
|
334
|
-
| `memory_context` | Load all relevant context for a topic, organized by type |
|
|
335
|
-
| `memory_extract` | Batch-save multiple memories from conversation |
|
|
336
|
-
| `memory_forget` | Delete by ID or query (with confirmation) |
|
|
337
|
-
| `memory_inject` | Surface corrections + decisions before coding starts |
|
|
237
|
+
| `memory_store` | Store a memory with type, tags, confidence. Auto-redacts private content, auto-expires contradictions. |
|
|
238
|
+
| `memory_recall` | Semantic search — compact mode by default (~10x token savings). Use `memory_detail` for full content. |
|
|
239
|
+
| `memory_detail` | Retrieve full content by ID after compact recall. |
|
|
240
|
+
| `memory_context` | Load all relevant context for a topic, organized by type with token budgeting. |
|
|
241
|
+
| `memory_extract` | Batch-save multiple memories from conversation. |
|
|
242
|
+
| `memory_forget` | Delete by ID or query (with confirmation). |
|
|
243
|
+
| `memory_inject` | Surface corrections + decisions + graph neighbors before coding starts. |
|
|
244
|
+
|
|
245
|
+
<details>
|
|
246
|
+
<summary><strong>Precision, History, Advanced, Reminders, and Maintenance tools (21 more)</strong></summary>
|
|
338
247
|
|
|
339
248
|
### Precision & History (5 tools)
|
|
340
249
|
|
|
341
250
|
| Tool | Description |
|
|
342
251
|
|---|---|
|
|
343
|
-
| `memory_patch` | Surgical field-level edit with auto-snapshot |
|
|
344
|
-
| `memory_versions` | View full edit history or restore any version |
|
|
345
|
-
| `memory_search` | Exact full-text search via FTS5 |
|
|
346
|
-
| `memory_since` | Temporal query with natural language ranges (`7d`, `2w`, `1h`) |
|
|
347
|
-
| `memory_relate` | Build a typed knowledge graph between memories |
|
|
252
|
+
| `memory_patch` | Surgical field-level edit with auto-snapshot. |
|
|
253
|
+
| `memory_versions` | View full edit history or restore any version. |
|
|
254
|
+
| `memory_search` | Exact full-text search via FTS5 with compact mode. |
|
|
255
|
+
| `memory_since` | Temporal query with natural language ranges (`7d`, `2w`, `1h`). |
|
|
256
|
+
| `memory_relate` | Build a typed knowledge graph between memories. |
|
|
348
257
|
|
|
349
258
|
### Advanced (5 tools)
|
|
350
259
|
|
|
351
260
|
| Tool | Description |
|
|
352
261
|
|---|---|
|
|
353
|
-
| `memory_multi_recall` | Multi-strategy search: semantic + FTS5 + graph + temporal
|
|
354
|
-
| `memory_tier` | Move memories between tiers: core / working / archival |
|
|
355
|
-
| `memory_expire` | Mark as no longer valid — preserved for history, excluded from recall |
|
|
356
|
-
| `memory_summarize` | Store structured session summary with decisions, corrections, metrics |
|
|
357
|
-
| `memory_history` | View past session summaries |
|
|
262
|
+
| `memory_multi_recall` | Multi-strategy search with compact mode: semantic + FTS5 + graph + temporal. |
|
|
263
|
+
| `memory_tier` | Move memories between tiers: core / working / archival. |
|
|
264
|
+
| `memory_expire` | Mark as no longer valid — preserved for history, excluded from recall. |
|
|
265
|
+
| `memory_summarize` | Store structured session summary with decisions, corrections, metrics. |
|
|
266
|
+
| `memory_history` | View past session summaries. |
|
|
358
267
|
|
|
359
268
|
### Reminders (4 tools)
|
|
360
269
|
|
|
361
270
|
| Tool | Description |
|
|
362
271
|
|---|---|
|
|
363
|
-
| `reminder_set` | Create reminder with optional deadline and scope |
|
|
364
|
-
| `reminder_list` | List active (or all) reminders, filterable by scope |
|
|
365
|
-
| `reminder_check` | Show overdue, today, and upcoming (7 days) |
|
|
366
|
-
| `reminder_complete` | Mark as done (supports partial ID) |
|
|
272
|
+
| `reminder_set` | Create reminder with optional deadline and scope. |
|
|
273
|
+
| `reminder_list` | List active (or all) reminders, filterable by scope. |
|
|
274
|
+
| `reminder_check` | Show overdue, today, and upcoming (7 days). |
|
|
275
|
+
| `reminder_complete` | Mark as done (supports partial ID). |
|
|
367
276
|
|
|
368
277
|
### Log & Maintenance (7 tools)
|
|
369
278
|
|
|
370
279
|
| Tool | Description |
|
|
371
280
|
|---|---|
|
|
372
|
-
| `memory_log` | Append raw conversation turns (lossless, append-only) |
|
|
373
|
-
| `memory_log_recall` | Search or replay log by session, keyword, or recency |
|
|
374
|
-
| `memory_log_cleanup` | Prune old entries with configurable retention |
|
|
375
|
-
| `memory_stats` | Counts, type breakdown, confidence distribution |
|
|
376
|
-
| `memory_export` | Export as Markdown or JSON |
|
|
377
|
-
| `memory_import` | Bulk import from JSON with automatic dedup |
|
|
378
|
-
| `memory_consolidate` | Merge duplicates, prune stale, promote frequent, decay idle |
|
|
281
|
+
| `memory_log` | Append raw conversation turns (lossless, append-only). |
|
|
282
|
+
| `memory_log_recall` | Search or replay log by session, keyword, or recency. |
|
|
283
|
+
| `memory_log_cleanup` | Prune old entries with configurable retention. |
|
|
284
|
+
| `memory_stats` | Counts, type breakdown, confidence distribution. |
|
|
285
|
+
| `memory_export` | Export as Markdown or JSON. |
|
|
286
|
+
| `memory_import` | Bulk import from JSON with automatic dedup. |
|
|
287
|
+
| `memory_consolidate` | Merge duplicates, prune stale, promote frequent, decay idle. |
|
|
288
|
+
|
|
289
|
+
</details>
|
|
379
290
|
|
|
380
291
|
---
|
|
381
292
|
|
|
382
293
|
## Usage Guide
|
|
383
294
|
|
|
384
|
-
### Starting a Session
|
|
385
|
-
|
|
386
|
-
Your AI will automatically load context if rules are installed. You can also ask:
|
|
387
|
-
|
|
388
|
-
> *"Load context for authentication"*
|
|
389
|
-
> *"What corrections do you have for this project?"*
|
|
390
|
-
> *"Check my reminders"*
|
|
391
|
-
|
|
392
295
|
### Storing Memories
|
|
393
296
|
|
|
394
|
-
<
|
|
395
|
-
<
|
|
297
|
+
<table>
|
|
298
|
+
<tr>
|
|
299
|
+
<td width="50%">
|
|
396
300
|
|
|
397
|
-
|
|
301
|
+
**Natural language** (easiest)
|
|
398
302
|
|
|
399
303
|
```
|
|
400
304
|
"Remember: we use PostgreSQL, not MongoDB"
|
|
401
305
|
"Store a correction: never use console.log in production"
|
|
402
|
-
"Note that the auth module is in src/auth/
|
|
306
|
+
"Note that the auth module is in src/auth/"
|
|
403
307
|
```
|
|
404
308
|
|
|
405
|
-
</
|
|
309
|
+
</td>
|
|
310
|
+
<td width="50%">
|
|
406
311
|
|
|
407
|
-
|
|
408
|
-
<summary><strong>Explicit tool calls</strong></summary>
|
|
312
|
+
**Explicit tool calls**
|
|
409
313
|
|
|
410
314
|
```js
|
|
411
|
-
// Store a correction — highest priority
|
|
412
315
|
memory_store({
|
|
413
|
-
content: "Never use 'any'
|
|
316
|
+
content: "Never use 'any' — define proper interfaces",
|
|
414
317
|
type: "correction",
|
|
415
|
-
tags: ["typescript"
|
|
318
|
+
tags: ["typescript"],
|
|
416
319
|
confidence: 1.0
|
|
417
320
|
})
|
|
418
|
-
|
|
419
|
-
// Batch extract from conversation
|
|
420
|
-
memory_extract({
|
|
421
|
-
memories: [
|
|
422
|
-
{ content: "Uses pnpm, not npm", type: "preference", tags: ["tooling"], confidence: 0.9 },
|
|
423
|
-
{ content: "Auth uses OAuth2 with PKCE", type: "decision", tags: ["auth"], confidence: 0.9 },
|
|
424
|
-
]
|
|
425
|
-
})
|
|
426
321
|
```
|
|
427
322
|
|
|
428
|
-
</
|
|
323
|
+
</td>
|
|
324
|
+
</tr>
|
|
325
|
+
</table>
|
|
429
326
|
|
|
430
327
|
### Recalling Memories
|
|
431
328
|
|
|
432
|
-
<details open>
|
|
433
|
-
<summary><strong>Progressive disclosure (recommended)</strong></summary>
|
|
434
|
-
|
|
435
329
|
```js
|
|
436
|
-
// Step 1: Compact index — ~50-100 tokens
|
|
437
|
-
memory_recall({ query: "auth decisions", limit: 5
|
|
438
|
-
//
|
|
439
|
-
//
|
|
330
|
+
// Step 1: Compact index — ~50-100 tokens (default)
|
|
331
|
+
memory_recall({ query: "auth decisions", limit: 5 })
|
|
332
|
+
// -> a1b2c3d4 [decision] Auth service uses JWT tokens... (92%)
|
|
333
|
+
// -> e5f6g7h8 [correction] Never store tokens in localStorage... (100%)
|
|
440
334
|
|
|
441
|
-
// Step 2: Full details only for what you need
|
|
335
|
+
// Step 2: Full details only for what you need
|
|
442
336
|
memory_detail({ ids: ["a1b2c3d4", "e5f6g7h8"] })
|
|
443
337
|
```
|
|
444
338
|
|
|
445
|
-
</details>
|
|
446
|
-
|
|
447
339
|
<details>
|
|
448
|
-
<summary><strong>
|
|
340
|
+
<summary><strong>More search options</strong></summary>
|
|
449
341
|
|
|
450
342
|
```js
|
|
451
|
-
//
|
|
343
|
+
// Multi-strategy: semantic + FTS5 + graph + temporal
|
|
452
344
|
memory_multi_recall({
|
|
453
345
|
query: "authentication architecture",
|
|
454
346
|
limit: 10,
|
|
455
347
|
weights: { semantic: 0.4, fts: 0.3, graph: 0.15, temporal: 0.15 }
|
|
456
348
|
})
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
</details>
|
|
460
|
-
|
|
461
|
-
<details>
|
|
462
|
-
<summary><strong>Exact keyword search</strong></summary>
|
|
463
349
|
|
|
464
|
-
|
|
465
|
-
memory_search({ query: "OAuth PKCE" })
|
|
466
|
-
memory_search({ query: '"event sourcing"' })
|
|
467
|
-
memory_search({ query: "auth* NOT legacy" }) //
|
|
350
|
+
// Exact keyword search (FTS5 syntax)
|
|
351
|
+
memory_search({ query: "OAuth PKCE" })
|
|
352
|
+
memory_search({ query: '"event sourcing"' }) // phrase match
|
|
353
|
+
memory_search({ query: "auth* NOT legacy" }) // boolean
|
|
468
354
|
```
|
|
469
355
|
|
|
470
356
|
</details>
|
|
@@ -472,81 +358,23 @@ memory_search({ query: "auth* NOT legacy" }) // FTS5 boolean syntax
|
|
|
472
358
|
### Managing Memories
|
|
473
359
|
|
|
474
360
|
<details>
|
|
475
|
-
<summary><strong>Edit
|
|
361
|
+
<summary><strong>Edit, expire, promote, link</strong></summary>
|
|
476
362
|
|
|
477
363
|
```js
|
|
478
|
-
//
|
|
479
|
-
memory_patch({
|
|
480
|
-
id: "a1b2c3d4",
|
|
481
|
-
field: "content",
|
|
482
|
-
value: "Never use 'any' — use interfaces or 'unknown'",
|
|
483
|
-
reason: "added unknown guidance"
|
|
484
|
-
})
|
|
364
|
+
// Surgical edit with auto-snapshot for rollback
|
|
365
|
+
memory_patch({ id: "a1b2c3d4", field: "content", value: "Updated text", reason: "clarified" })
|
|
485
366
|
|
|
486
|
-
// View history
|
|
367
|
+
// View edit history / restore
|
|
487
368
|
memory_versions({ memory_id: "a1b2c3d4" })
|
|
488
369
|
|
|
489
|
-
//
|
|
490
|
-
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
</details>
|
|
370
|
+
// Expire (preserve for history, exclude from recall)
|
|
371
|
+
memory_expire({ id: "a1b2c3d4", reason: "Migrated to GraphQL" })
|
|
494
372
|
|
|
495
|
-
|
|
496
|
-
<summary><strong>Expire outdated memories</strong></summary>
|
|
497
|
-
|
|
498
|
-
```js
|
|
499
|
-
// Mark as expired — preserved for history, excluded from recall
|
|
500
|
-
memory_expire({ id: "a1b2c3d4", reason: "Migrated from REST to GraphQL" })
|
|
501
|
-
|
|
502
|
-
// Store the replacement — contradictions are also auto-detected
|
|
503
|
-
memory_store({
|
|
504
|
-
content: "API uses GraphQL with Apollo Server",
|
|
505
|
-
type: "decision",
|
|
506
|
-
tags: ["api", "graphql"],
|
|
507
|
-
confidence: 0.9
|
|
508
|
-
})
|
|
509
|
-
|
|
510
|
-
// Query what was true at a specific time
|
|
511
|
-
memory_since({ since: "2025-01-01", until: "2025-03-01", type: "decision" })
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
</details>
|
|
515
|
-
|
|
516
|
-
<details>
|
|
517
|
-
<summary><strong>Promote to core tier</strong></summary>
|
|
518
|
-
|
|
519
|
-
```js
|
|
520
|
-
// Core memories are always injected at session start
|
|
373
|
+
// Promote to core tier (always loaded at session start)
|
|
521
374
|
memory_tier({ id: "a1b2c3d4", tier: "core" })
|
|
522
375
|
|
|
523
|
-
//
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
// Demote back to archival
|
|
527
|
-
memory_tier({ id: "a1b2c3d4", tier: "archival" })
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
</details>
|
|
531
|
-
|
|
532
|
-
### Knowledge Graph
|
|
533
|
-
|
|
534
|
-
> **New in v0.13.0:** The graph builds itself. When you store a memory, amem automatically finds and links the top-3 most similar existing memories. You can also link manually:
|
|
535
|
-
|
|
536
|
-
<details>
|
|
537
|
-
<summary><strong>Link related memories</strong></summary>
|
|
538
|
-
|
|
539
|
-
```js
|
|
540
|
-
memory_relate({
|
|
541
|
-
action: "relate",
|
|
542
|
-
from_id: "decision-abc",
|
|
543
|
-
to_id: "pattern-xyz",
|
|
544
|
-
relation_type: "supports",
|
|
545
|
-
strength: 0.9
|
|
546
|
-
})
|
|
547
|
-
|
|
548
|
-
// View all connections for a memory
|
|
549
|
-
memory_relate({ action: "graph", memory_id: "decision-abc" })
|
|
376
|
+
// Link related memories (graph builds itself, but you can add manual links)
|
|
377
|
+
memory_relate({ action: "relate", from_id: "abc", to_id: "xyz", relation_type: "supports" })
|
|
550
378
|
```
|
|
551
379
|
|
|
552
380
|
Relation types: `supports`, `contradicts`, `depends_on`, `supersedes`, `related_to`, `caused_by`, `implements` — or define your own.
|
|
@@ -559,17 +387,12 @@ Relation types: `supports`, `contradicts`, `depends_on`, `supersedes`, `related_
|
|
|
559
387
|
<summary><strong>Cross-session deadline tracking</strong></summary>
|
|
560
388
|
|
|
561
389
|
```js
|
|
562
|
-
reminder_set({
|
|
563
|
-
content: "Review PR #42",
|
|
564
|
-
due_at: 1743033600000,
|
|
565
|
-
scope: "global"
|
|
566
|
-
})
|
|
390
|
+
reminder_set({ content: "Review PR #42", due_at: 1743033600000, scope: "global" })
|
|
567
391
|
|
|
568
|
-
// Check what's due (your AI does this automatically at session start)
|
|
569
392
|
reminder_check({})
|
|
570
|
-
//
|
|
571
|
-
//
|
|
572
|
-
//
|
|
393
|
+
// -> [OVERDUE] Review PR #42
|
|
394
|
+
// -> [TODAY] Deploy auth service
|
|
395
|
+
// -> [upcoming] Write quarterly report
|
|
573
396
|
|
|
574
397
|
reminder_complete({ id: "a1b2c3d4" })
|
|
575
398
|
```
|
|
@@ -579,49 +402,58 @@ reminder_complete({ id: "a1b2c3d4" })
|
|
|
579
402
|
### Privacy
|
|
580
403
|
|
|
581
404
|
<details>
|
|
582
|
-
<summary><strong>
|
|
405
|
+
<summary><strong>Automatic redaction</strong></summary>
|
|
583
406
|
|
|
584
407
|
```js
|
|
585
|
-
// Private blocks
|
|
408
|
+
// Private blocks stripped before storage
|
|
586
409
|
memory_store({
|
|
587
410
|
content: "DB password is <private>hunter2</private>, connect to prod at db.example.com",
|
|
588
|
-
type: "topology",
|
|
589
|
-
tags: ["database"]
|
|
411
|
+
type: "topology", tags: ["database"]
|
|
590
412
|
})
|
|
591
|
-
// Stored
|
|
413
|
+
// Stored: "DB password is [REDACTED], connect to prod at db.example.com"
|
|
592
414
|
|
|
593
|
-
// API keys, tokens,
|
|
415
|
+
// API keys, tokens, passwords auto-redacted by pattern matching
|
|
594
416
|
// Configure patterns in ~/.amem/config.json
|
|
595
417
|
```
|
|
596
418
|
|
|
597
419
|
</details>
|
|
598
420
|
|
|
599
|
-
|
|
421
|
+
---
|
|
600
422
|
|
|
601
|
-
|
|
602
|
-
<summary><strong>Structured session digests</strong></summary>
|
|
423
|
+
## Platform Compatibility
|
|
603
424
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
425
|
+
| Feature | Claude Code | GitHub Copilot CLI | Cursor / Windsurf / Other |
|
|
426
|
+
|---|:---:|:---:|:---:|
|
|
427
|
+
| One-command plugin install | Yes | Yes | -- |
|
|
428
|
+
| 28 MCP tools | Yes | Yes | Yes |
|
|
429
|
+
| AI skills | 14 | 7 | -- |
|
|
430
|
+
| Auto-capture hooks | Yes | Yes | -- |
|
|
431
|
+
| Session auto-summarize | Yes | Yes | -- |
|
|
432
|
+
| Auto-memory sync | Yes | -- | -- |
|
|
433
|
+
| CLI setup (`amem-cli init`) | Yes | Yes | Yes |
|
|
613
434
|
|
|
614
|
-
|
|
615
|
-
memory_history({ limit: 5 })
|
|
616
|
-
```
|
|
435
|
+
**Claude Code** has the deepest integration (plugin + hooks + auto-memory sync). **Copilot CLI** is a close second. **Other MCP clients** get the full 28-tool server via manual config.
|
|
617
436
|
|
|
618
|
-
|
|
437
|
+
### AI Skills
|
|
438
|
+
|
|
439
|
+
| What you say | Skill | Claude Code | Copilot CLI |
|
|
440
|
+
|---|---|:---:|:---:|
|
|
441
|
+
| *"Remember never use any type"* | `remember` | Yes | Yes |
|
|
442
|
+
| *"What do you remember about auth?"* | `recall` | Yes | Yes |
|
|
443
|
+
| *"Load context for this task"* | `context` | Yes | Yes |
|
|
444
|
+
| *"Show memory stats"* | `stats` | Yes | Yes |
|
|
445
|
+
| *"Run memory doctor"* | `doctor` | Yes | Yes |
|
|
446
|
+
| *"Export my memories"* | `export` | Yes | Yes |
|
|
447
|
+
| *"List all corrections"* | `list` | Yes | Yes |
|
|
448
|
+
| *"Sync my Claude memory"* | `sync` | Yes | -- |
|
|
449
|
+
| *"Open the memory dashboard"* | `dashboard` | Yes | -- |
|
|
450
|
+
| *"Install hooks"* | `hooks` | Yes | -- |
|
|
619
451
|
|
|
620
452
|
---
|
|
621
453
|
|
|
622
454
|
## Working with Claude Code Auto-Memory
|
|
623
455
|
|
|
624
|
-
|
|
456
|
+
amem complements Claude's built-in auto-memory — it doesn't replace it.
|
|
625
457
|
|
|
626
458
|
| | Claude auto-memory | amem |
|
|
627
459
|
|---|---|---|
|
|
@@ -631,21 +463,17 @@ Claude Code has a built-in auto-memory feature that stores a flat markdown file
|
|
|
631
463
|
| **History** | Overwritten on update | Versioned, temporal validity |
|
|
632
464
|
| **Search** | None | Semantic + FTS5 + graph + reranking |
|
|
633
465
|
|
|
634
|
-
|
|
466
|
+
**Recommended:** Keep both enabled. Run `amem-cli sync` to import Claude's memories into amem for unified, structured access.
|
|
635
467
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
3. **amem handles the specifics** — corrections, decisions, patterns get typed, scored, and searchable
|
|
468
|
+
<details>
|
|
469
|
+
<summary><strong>Sync details</strong></summary>
|
|
639
470
|
|
|
640
471
|
```bash
|
|
641
|
-
# Import Claude auto-memory into amem (one-time or periodic)
|
|
642
472
|
amem-cli sync # Import all projects
|
|
643
473
|
amem-cli sync --dry-run # Preview what would be imported
|
|
644
|
-
amem-cli sync --project myapp # Import specific project
|
|
474
|
+
amem-cli sync --project myapp # Import specific project
|
|
645
475
|
```
|
|
646
476
|
|
|
647
|
-
Type mapping when syncing:
|
|
648
|
-
|
|
649
477
|
| Claude type | amem type | Confidence |
|
|
650
478
|
|---|---|---|
|
|
651
479
|
| `feedback` | `correction` | 1.0 |
|
|
@@ -653,29 +481,18 @@ Type mapping when syncing:
|
|
|
653
481
|
| `user` | `preference` | 0.8 |
|
|
654
482
|
| `reference` | `topology` | 0.7 |
|
|
655
483
|
|
|
656
|
-
>
|
|
484
|
+
</details>
|
|
657
485
|
|
|
658
486
|
---
|
|
659
487
|
|
|
660
488
|
## Dashboard
|
|
661
489
|
|
|
662
|
-
Launch the interactive web dashboard:
|
|
663
|
-
|
|
664
490
|
```bash
|
|
665
491
|
amem-cli dashboard # Opens at localhost:3333
|
|
666
492
|
amem-cli dashboard --port=8080 # Custom port
|
|
667
493
|
```
|
|
668
494
|
|
|
669
|
-
|
|
670
|
-
- Memory list with search, type filter, and tier filter
|
|
671
|
-
- Search term highlighting
|
|
672
|
-
- Inline actions: Promote to Core, Demote, Expire
|
|
673
|
-
- Export as JSON or Markdown with one click
|
|
674
|
-
- Interactive knowledge graph (drag nodes, click to inspect)
|
|
675
|
-
- Confidence distribution and type breakdown charts
|
|
676
|
-
- Session summaries timeline
|
|
677
|
-
- Reminders with status badges
|
|
678
|
-
- Recent conversation log
|
|
495
|
+
Memory list with search and filters, inline actions (promote, demote, expire), interactive knowledge graph, confidence charts, session timeline, reminders, and conversation log.
|
|
679
496
|
|
|
680
497
|
---
|
|
681
498
|
|
|
@@ -687,19 +504,17 @@ amem-cli init # Auto-configure AI tools
|
|
|
687
504
|
amem-cli rules # Generate extraction rules
|
|
688
505
|
amem-cli hooks # Install automatic capture hooks
|
|
689
506
|
amem-cli hooks --uninstall # Remove hooks
|
|
690
|
-
amem-cli sync # Import Claude auto-memory
|
|
691
|
-
amem-cli sync --dry-run # Preview sync without importing
|
|
507
|
+
amem-cli sync # Import Claude auto-memory
|
|
692
508
|
amem-cli doctor # Health diagnostics
|
|
509
|
+
amem-cli repair # Repair corrupted database from backups
|
|
693
510
|
|
|
694
511
|
# Dashboard
|
|
695
512
|
amem-cli dashboard # Web dashboard (localhost:3333)
|
|
696
|
-
amem-cli dashboard --port=8080 # Custom port
|
|
697
513
|
|
|
698
514
|
# Memory operations
|
|
699
515
|
amem-cli recall "authentication" # Semantic search
|
|
700
516
|
amem-cli stats # Statistics
|
|
701
|
-
amem-cli list
|
|
702
|
-
amem-cli list --type correction # Filter by type
|
|
517
|
+
amem-cli list --type correction # List by type
|
|
703
518
|
amem-cli export --file memories.md # Export to file
|
|
704
519
|
amem-cli forget abc12345 # Delete by short ID
|
|
705
520
|
amem-cli reset --confirm # Wipe all data
|
|
@@ -710,88 +525,59 @@ amem-cli reset --confirm # Wipe all data
|
|
|
710
525
|
## Architecture
|
|
711
526
|
|
|
712
527
|
```
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
528
|
+
Your AI Tool
|
|
529
|
+
Claude Code / Copilot CLI / any MCP client
|
|
530
|
+
| |
|
|
531
|
+
| MCP (stdio) | Lifecycle Hooks
|
|
532
|
+
v v
|
|
533
|
+
+---------------------------------+
|
|
534
|
+
| amem MCP Server |
|
|
535
|
+
| |
|
|
536
|
+
| 28 Tools . 7 Resources . 2 Prompts
|
|
537
|
+
| |
|
|
538
|
+
| Multi-Strategy Retrieval |
|
|
539
|
+
| [HNSW] + [FTS5] + [Graph] + [Temporal]
|
|
540
|
+
| + query expansion |
|
|
541
|
+
| + cross-encoder (opt-in) |
|
|
542
|
+
| |
|
|
543
|
+
| +---------------------------+ |
|
|
544
|
+
| | SQLite + WAL + FTS5 | |
|
|
545
|
+
| | ~/.amem/memory.db | |
|
|
546
|
+
| | | |
|
|
547
|
+
| | memories (tiered) | |
|
|
548
|
+
| | conversation_log (raw) | |
|
|
549
|
+
| | memory_versions (history) | |
|
|
550
|
+
| | memory_relations (graph) | |
|
|
551
|
+
| | session_summaries | |
|
|
552
|
+
| | reminders | |
|
|
553
|
+
| +---------------------------+ |
|
|
554
|
+
| |
|
|
555
|
+
| Embeddings: bge-small-en-v1.5 |
|
|
556
|
+
| Config: ~/.amem/config.json |
|
|
557
|
+
+---------------------------------+
|
|
743
558
|
```
|
|
744
559
|
|
|
745
560
|
### Ranking Formula
|
|
746
561
|
|
|
747
562
|
```
|
|
748
|
-
score = relevance
|
|
563
|
+
score = relevance x 0.45 + recency x 0.2 + confidence x 0.2 + importance x 0.15
|
|
749
564
|
```
|
|
750
565
|
|
|
751
566
|
| Factor | How it works |
|
|
752
567
|
|---|---|
|
|
753
|
-
| **Relevance** | Cosine similarity via
|
|
568
|
+
| **Relevance** | Cosine similarity via HNSW index; query-expanded keyword fallback |
|
|
754
569
|
| **Recency** | Exponential decay (`0.995^hours`) |
|
|
755
570
|
| **Confidence** | Reinforced by repeated confirmation (0-1) |
|
|
756
|
-
| **Importance** | Type-based: corrections `1.0`
|
|
757
|
-
|
|
758
|
-
> **Additive weighted scoring** ensures no single low factor kills the ranking. A memory with low confidence but high relevance still surfaces — unlike multiplicative scoring where one zero kills everything.
|
|
571
|
+
| **Importance** | Type-based: corrections `1.0` ... facts `0.4` |
|
|
759
572
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
Run `npx vitest run benchmarks/` to reproduce. Corpus: 34 realistic developer memories, 16 queries (exact, paraphrased, topical).
|
|
763
|
-
|
|
764
|
-
| Strategy | Recall@5 | Recall@10 | MRR | Precision@5 |
|
|
765
|
-
|---|---|---|---|---|
|
|
766
|
-
| Keyword-only (no embeddings) | 34.4% | 62.0% | 36.7% | 13.8% |
|
|
767
|
-
| FTS5-only | 31.3% | 31.3% | 31.3% | --- |
|
|
768
|
-
| Multi-strategy (FTS + graph + temporal) | 31.3% | 31.3% | 31.3% | 25.0% |
|
|
769
|
-
| **Multi-strategy + embeddings** | **~70%+** | **~85%+** | **~75%+** | **~35%+** |
|
|
770
|
-
| **+ cross-encoder reranking** | **~80%+** | **~90%+** | **~85%+** | **~45%+** |
|
|
771
|
-
|
|
772
|
-
*Keyword-only scores are the floor — retrieval gracefully degrades without embeddings.*
|
|
773
|
-
|
|
774
|
-
---
|
|
775
|
-
|
|
776
|
-
## MCP Resources
|
|
777
|
-
|
|
778
|
-
These are automatically available to your AI tool:
|
|
779
|
-
|
|
780
|
-
| URI | Description |
|
|
781
|
-
|---|---|
|
|
782
|
-
| `amem://corrections` | All active corrections (hard constraints) |
|
|
783
|
-
| `amem://decisions` | Architectural decisions |
|
|
784
|
-
| `amem://profile` | Preferences and coding patterns |
|
|
785
|
-
| `amem://summary` | Memory count and type breakdown |
|
|
786
|
-
| `amem://log/recent` | Last 50 raw conversation log entries |
|
|
787
|
-
| `amem://graph` | Knowledge graph overview |
|
|
788
|
-
| `amem://last-session` | Previous session summary — decisions, corrections, and metrics |
|
|
573
|
+
Additive scoring ensures no single low factor kills the ranking.
|
|
789
574
|
|
|
790
575
|
---
|
|
791
576
|
|
|
792
577
|
## Configuration
|
|
793
578
|
|
|
794
|
-
|
|
579
|
+
<details>
|
|
580
|
+
<summary><strong>Environment variables</strong></summary>
|
|
795
581
|
|
|
796
582
|
| Variable | Default | Description |
|
|
797
583
|
|---|---|---|
|
|
@@ -799,9 +585,12 @@ These are automatically available to your AI tool:
|
|
|
799
585
|
| `AMEM_DB` | `~/.amem/memory.db` | Database path |
|
|
800
586
|
| `AMEM_PROJECT` | *(auto from git)* | Project scope override |
|
|
801
587
|
|
|
802
|
-
|
|
588
|
+
</details>
|
|
589
|
+
|
|
590
|
+
<details>
|
|
591
|
+
<summary><strong>Config file (~/.amem/config.json)</strong></summary>
|
|
803
592
|
|
|
804
|
-
Created automatically with defaults
|
|
593
|
+
Created automatically with defaults:
|
|
805
594
|
|
|
806
595
|
```json
|
|
807
596
|
{
|
|
@@ -810,15 +599,11 @@ Created automatically with defaults. Edit to customize:
|
|
|
810
599
|
"ftsWeight": 0.3,
|
|
811
600
|
"graphWeight": 0.15,
|
|
812
601
|
"temporalWeight": 0.15,
|
|
813
|
-
"
|
|
814
|
-
"rerankerEnabled": false,
|
|
815
|
-
"rerankerTopK": 20
|
|
602
|
+
"rerankerEnabled": false
|
|
816
603
|
},
|
|
817
604
|
"privacy": {
|
|
818
605
|
"enablePrivateTags": true,
|
|
819
|
-
"redactPatterns": [
|
|
820
|
-
"(?:api[_-]?key|secret|token|password)\\s*[:=]\\s*['\"]?[A-Za-z0-9_\\-\\.]{8,}"
|
|
821
|
-
]
|
|
606
|
+
"redactPatterns": ["..."]
|
|
822
607
|
},
|
|
823
608
|
"tiers": {
|
|
824
609
|
"coreMaxTokens": 500,
|
|
@@ -832,6 +617,28 @@ Created automatically with defaults. Edit to customize:
|
|
|
832
617
|
}
|
|
833
618
|
```
|
|
834
619
|
|
|
620
|
+
</details>
|
|
621
|
+
|
|
622
|
+
<details>
|
|
623
|
+
<summary><strong>Version history</strong></summary>
|
|
624
|
+
|
|
625
|
+
### v0.18.0 — Progressive Disclosure & Scale
|
|
626
|
+
HNSW vector index (67x faster at 10k), compact mode default on recall/search, DB repair CLI, concurrent access safety, heuristic conversation extractor, session-end auto-extraction.
|
|
627
|
+
|
|
628
|
+
### v0.13.0 — World-Class Recall
|
|
629
|
+
bge-small-en-v1.5 embeddings, additive scoring, query expansion, auto-relate knowledge graph, graph-aware injection, amem doctor, CI benchmarks.
|
|
630
|
+
|
|
631
|
+
### v0.9.x — Temporal Intelligence
|
|
632
|
+
Temporal validity, auto-expire contradictions, multi-strategy retrieval, cross-encoder reranking, memory tiers, privacy tags, lifecycle hooks, session summaries, dashboard, config system.
|
|
633
|
+
|
|
634
|
+
### v0.7.0 — v0.8.0
|
|
635
|
+
Import/export, confidence decay, embedding cache, multi-process safety, auto-configure CLI, dashboard.
|
|
636
|
+
|
|
637
|
+
### v0.1.0 — v0.5.x
|
|
638
|
+
Core store/recall, local embeddings, SQLite + WAL, consolidation, project scoping, reminders, conversation log, knowledge graph, FTS5, progressive disclosure.
|
|
639
|
+
|
|
640
|
+
</details>
|
|
641
|
+
|
|
835
642
|
---
|
|
836
643
|
|
|
837
644
|
## Tech Stack
|
|
@@ -841,11 +648,11 @@ Created automatically with defaults. Edit to customize:
|
|
|
841
648
|
| Protocol | MCP SDK ^1.25 |
|
|
842
649
|
| Language | TypeScript 5.6+, strict mode |
|
|
843
650
|
| Database | SQLite + WAL + FTS5 |
|
|
844
|
-
| Embeddings | HuggingFace
|
|
845
|
-
| Reranking |
|
|
651
|
+
| Embeddings | HuggingFace bge-small-en-v1.5 (local, 80MB) + HNSW vector index |
|
|
652
|
+
| Reranking | ms-marco-MiniLM-L-6-v2 (optional, local) |
|
|
846
653
|
| Validation | Zod 3.25+ with `.strict()` schemas |
|
|
847
|
-
| Testing | Vitest —
|
|
848
|
-
| CI/CD | GitHub Actions
|
|
654
|
+
| Testing | Vitest — 357 tests across 28 suites + recall benchmarks |
|
|
655
|
+
| CI/CD | GitHub Actions, npm publish on release |
|
|
849
656
|
|
|
850
657
|
---
|
|
851
658
|
|
|
@@ -855,7 +662,7 @@ Created automatically with defaults. Edit to customize:
|
|
|
855
662
|
git clone https://github.com/amanasmuei/amem.git
|
|
856
663
|
cd amem && npm install
|
|
857
664
|
npm run build # zero TS errors
|
|
858
|
-
npm test #
|
|
665
|
+
npm test # 357 tests pass
|
|
859
666
|
```
|
|
860
667
|
|
|
861
668
|
PRs must pass CI before merge. See [Issues](https://github.com/amanasmuei/amem/issues) for open tasks.
|