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