agent-working-memory 0.14.0 → 0.14.5
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 +244 -653
- package/dist/core/whoami.d.ts +9 -1
- package/dist/core/whoami.d.ts.map +1 -1
- package/dist/core/whoami.js +12 -2
- package/dist/core/whoami.js.map +1 -1
- package/dist/engine/activation.d.ts +2 -0
- package/dist/engine/activation.d.ts.map +1 -1
- package/dist/engine/activation.js +29 -3
- package/dist/engine/activation.js.map +1 -1
- package/dist/engine/eval.d.ts +15 -0
- package/dist/engine/eval.d.ts.map +1 -1
- package/dist/engine/eval.js +23 -0
- package/dist/engine/eval.js.map +1 -1
- package/dist/hooks/sidecar.d.ts +18 -2
- package/dist/hooks/sidecar.d.ts.map +1 -1
- package/dist/hooks/sidecar.js +30 -4
- package/dist/hooks/sidecar.js.map +1 -1
- package/dist/mcp.js +71 -14
- package/dist/mcp.js.map +1 -1
- package/dist/storage/pglite.d.ts +7 -0
- package/dist/storage/pglite.d.ts.map +1 -1
- package/dist/storage/pglite.js +17 -3
- package/dist/storage/pglite.js.map +1 -1
- package/dist/storage/postgres.d.ts +7 -0
- package/dist/storage/postgres.d.ts.map +1 -1
- package/dist/storage/postgres.js +17 -3
- package/dist/storage/postgres.js.map +1 -1
- package/dist/storage/sqlite.d.ts +12 -0
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +24 -3
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/types/engram.d.ts +40 -0
- package/dist/types/engram.d.ts.map +1 -1
- package/dist/types/eval.d.ts +2 -0
- package/dist/types/eval.d.ts.map +1 -1
- package/package.json +20 -2
- package/src/core/whoami.ts +11 -1
- package/src/engine/activation.ts +29 -3
- package/src/engine/eval.ts +34 -0
- package/src/hooks/sidecar.ts +50 -6
- package/src/mcp.ts +74 -15
- package/src/storage/pglite.ts +22 -4
- package/src/storage/postgres.ts +22 -4
- package/src/storage/sqlite.ts +26 -4
- package/src/types/engram.ts +41 -0
- package/src/types/eval.ts +3 -1
package/README.md
CHANGED
|
@@ -1,653 +1,244 @@
|
|
|
1
|
-
# AgentWorkingMemory (AWM)
|
|
2
|
-
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
|
88
|
-
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
| `memory_task_next` | Get the highest-priority actionable task |
|
|
246
|
-
| `memory_task_begin` | Start a task — auto-checkpoints and recalls context |
|
|
247
|
-
| `memory_task_end` | End a task — writes summary and checkpoints |
|
|
248
|
-
| `compress_output` | Encode a structured tool output as TOON — ~50-65% fewer tokens, lossless, output-only |
|
|
249
|
-
| `retrieve_original` | Get the verbatim source back for a `compress_output` ref |
|
|
250
|
-
|
|
251
|
-
### Onboarding Tools (2)
|
|
252
|
-
|
|
253
|
-
For warm-starting a cold store from a project's own docs/repo — see [What's New in v0.11.0](#whats-new-in-v0110).
|
|
254
|
-
|
|
255
|
-
| Tool | Purpose |
|
|
256
|
-
|------|---------|
|
|
257
|
-
| `onboard_scan` | Extract candidate memories from a project's docs/repo for review |
|
|
258
|
-
| `onboard_questions` | Anchored interview questions to refine what a cold store should know |
|
|
259
|
-
|
|
260
|
-
### Separate Memory Pools
|
|
261
|
-
|
|
262
|
-
By default, all projects share one memory pool. For isolated pools per folder, place a `.mcp.json` in each parent folder with a different `AWM_AGENT_ID`:
|
|
263
|
-
|
|
264
|
-
```
|
|
265
|
-
C:\Users\you\work\.mcp.json -> AWM_AGENT_ID: "work"
|
|
266
|
-
C:\Users\you\personal\.mcp.json -> AWM_AGENT_ID: "personal"
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Claude Code uses the closest `.mcp.json` ancestor. Same database, isolation by agent ID.
|
|
270
|
-
|
|
271
|
-
### Incognito Mode
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
AWM_INCOGNITO=1 claude
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Registers zero tools — Claude doesn't see memory at all. All other tools and MCP servers work normally.
|
|
278
|
-
|
|
279
|
-
### Auto-Checkpoint Hooks
|
|
280
|
-
|
|
281
|
-
Installed by `awm setup --global`:
|
|
282
|
-
|
|
283
|
-
- **Stop** — reminds Claude to write/recall after each response
|
|
284
|
-
- **PreCompact** — auto-checkpoints before context compression
|
|
285
|
-
- **SessionEnd** — auto-checkpoints and consolidates on close
|
|
286
|
-
- **15-min timer** — silent auto-checkpoint while session is active
|
|
287
|
-
|
|
288
|
-
### Auto-Backup
|
|
289
|
-
|
|
290
|
-
The HTTP server automatically copies the database to a `backups/` directory on startup with a timestamp. Cheap insurance against data loss.
|
|
291
|
-
|
|
292
|
-
### Activity Log
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
tail -f "$(npm root -g)/agent-working-memory/data/awm.log"
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
Real-time: writes, recalls, reinforcements, checkpoints, consolidation, hook events.
|
|
299
|
-
|
|
300
|
-
### Activity Stats
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
curl http://127.0.0.1:8401/stats
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
Returns daily counts: `{"writes": 8, "recalls": 9, "hooks": 3, "total": 25}`
|
|
307
|
-
|
|
308
|
-
---
|
|
309
|
-
|
|
310
|
-
## Memory Invocation Strategy
|
|
311
|
-
|
|
312
|
-
AWM combines deterministic hooks for guaranteed memory operations at lifecycle transitions with agent-directed usage during active work.
|
|
313
|
-
|
|
314
|
-
### Deterministic triggers (always happen)
|
|
315
|
-
|
|
316
|
-
| Event | Action |
|
|
317
|
-
|-------|--------|
|
|
318
|
-
| Session start | `memory_restore` — recover state + recall context |
|
|
319
|
-
| Pre-compaction | Auto-checkpoint via hook sidecar |
|
|
320
|
-
| Session end | Auto-checkpoint + full consolidation |
|
|
321
|
-
| Every 15 min | Silent auto-checkpoint (if active) |
|
|
322
|
-
| Task start | `memory_task_begin` — checkpoint + recall |
|
|
323
|
-
| Task end | `memory_task_end` — summary + checkpoint |
|
|
324
|
-
|
|
325
|
-
### Agent-directed triggers (when these situations occur)
|
|
326
|
-
|
|
327
|
-
**Write memory when:**
|
|
328
|
-
- A project decision is made or changed
|
|
329
|
-
- A root cause is discovered
|
|
330
|
-
- A reusable implementation pattern is established
|
|
331
|
-
- A preference, constraint, or requirement is clarified
|
|
332
|
-
- A prior assumption is found to be wrong
|
|
333
|
-
|
|
334
|
-
**Recall memory when:**
|
|
335
|
-
- Starting work on a new task or subsystem
|
|
336
|
-
- Re-entering code you haven't touched recently
|
|
337
|
-
- After context compaction
|
|
338
|
-
- After a failed attempt (check if there's prior knowledge)
|
|
339
|
-
- Before refactoring or making architectural changes
|
|
340
|
-
|
|
341
|
-
**Retract when:**
|
|
342
|
-
- A stored memory turns out to be wrong or outdated
|
|
343
|
-
|
|
344
|
-
**Feedback when:**
|
|
345
|
-
- A recalled memory was used (useful) or irrelevant (not useful)
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
## HTTP API
|
|
350
|
-
|
|
351
|
-
For custom agents, scripts, or non-Claude-Code workflows:
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
awm serve # From npm install
|
|
355
|
-
npx tsx src/index.ts # From source
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
# Write
|
|
360
|
-
curl -X POST http://localhost:8400/memory/write -H "Content-Type: application/json" -d '{
|
|
361
|
-
"agentId": "my-agent",
|
|
362
|
-
"concept": "Express error handling",
|
|
363
|
-
"content": "Use centralized error middleware as the last app.use()",
|
|
364
|
-
"eventType": "causal", "surprise": 0.5, "causalDepth": 0.7
|
|
365
|
-
}'
|
|
366
|
-
|
|
367
|
-
# Recall
|
|
368
|
-
curl -X POST http://localhost:8400/memory/activate -H "Content-Type: application/json" -d '{
|
|
369
|
-
"agentId": "my-agent",
|
|
370
|
-
"context": "How should I handle errors in my Express API?"
|
|
371
|
-
}'
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
**Substrate primitives (0.8+)** — for long-running structured projects (novels,
|
|
375
|
-
codebases, investigations) where an agent tracks typed state across hundreds of writes
|
|
376
|
-
without polluting cognitive retrieval: `/memory/latest-by-tag` (latest per tag key),
|
|
377
|
-
`/memory/top-by` (native filter + sort), `/memory/supersede` (atomic write-and-supersede
|
|
378
|
-
by concept match), `/memory/sequence/:agentId/next` (race-free chronology). The
|
|
379
|
-
`memory_class: "structural"` class keeps high-volume system-written records out of
|
|
380
|
-
cognitive `/activate` while preserving them at canonical salience.
|
|
381
|
-
|
|
382
|
-
Every endpoint, with request/response schemas and worked examples:
|
|
383
|
-
[`docs/reference.md`](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/reference.md).
|
|
384
|
-
|
|
385
|
-
---
|
|
386
|
-
|
|
387
|
-
## How It Works
|
|
388
|
-
|
|
389
|
-
### The Memory Lifecycle
|
|
390
|
-
|
|
391
|
-
1. **Write** — Salience scoring evaluates novelty, surprise, causal depth, and effort. High-salience memories go active; borderline ones enter staging; low-salience stored at reduced confidence for recall fallback. Near-duplicates reinforce existing memories instead of creating copies.
|
|
392
|
-
|
|
393
|
-
2. **Connect** — Vector embedding (BGE-small-en-v1.5, 384d). Temporal edges link to recent memories. Hebbian edges form between co-retrieved memories. Coref expansion resolves pronouns to entity names.
|
|
394
|
-
|
|
395
|
-
3. **Retrieve** — 10-phase pipeline: coref expansion + query expansion + dual BM25 (keyword-stripped + expanded) + semantic vectors + Rocchio pseudo-relevance feedback + ACT-R temporal decay (synaptic-tagged) + Hebbian boost + entity-bridge boost + graph walk + cross-encoder reranking + multi-channel agreement gate.
|
|
396
|
-
|
|
397
|
-
4. **Consolidate** — 7-phase sleep cycle: diameter-enforced clustering (prevents chaining), edge strengthening (access-weighted), cross-topic bridge formation (direct closest-pair), confidence-modulated decay (synaptic tagging extends half-life), synaptic homeostasis, cognitive forgetting, staging sweep. Embedding backfill ensures all memories are clusterable.
|
|
398
|
-
|
|
399
|
-
5. **Feedback** — Useful/not-useful signals adjust confidence, affecting retrieval rank and forgetting resistance.
|
|
400
|
-
|
|
401
|
-
### Cognitive Foundations
|
|
402
|
-
|
|
403
|
-
- **ACT-R activation decay** (Anderson 1993) — memories decay with time, strengthen with use. Synaptic tagging: heavily-accessed memories decay slower (log-scaled).
|
|
404
|
-
- **Hebbian learning** — co-retrieved memories form stronger associative edges
|
|
405
|
-
- **Complementary Learning Systems** — fast capture (salience + staging) + slow consolidation (sleep cycle)
|
|
406
|
-
- **Synaptic homeostasis** — edge weight normalization prevents hub domination
|
|
407
|
-
- **Forgetting as feature** — noise removal improves signal-to-noise for connected memories
|
|
408
|
-
- **Diameter-enforced clustering** — prevents semantic chaining (e.g., physics->biophysics->cooking = 1 cluster)
|
|
409
|
-
- **Multi-channel agreement** — OOD detection requires multiple retrieval channels to agree
|
|
410
|
-
|
|
411
|
-
---
|
|
412
|
-
|
|
413
|
-
## Architecture
|
|
414
|
-
|
|
415
|
-
```
|
|
416
|
-
src/
|
|
417
|
-
core/ # Cognitive primitives
|
|
418
|
-
embeddings.ts - Local vector embeddings (BGE-small-en-v1.5, 384d)
|
|
419
|
-
reranker.ts - Cross-encoder passage scoring (ms-marco-MiniLM)
|
|
420
|
-
query-expander.ts - Synonym expansion (flan-t5-small)
|
|
421
|
-
salience.ts - Write-time importance scoring (novelty + salience + reinforce-on-duplicate)
|
|
422
|
-
decay.ts - ACT-R temporal activation decay
|
|
423
|
-
hebbian.ts - Association strengthening/weakening
|
|
424
|
-
logger.ts - Append-only activity log (data/awm.log)
|
|
425
|
-
engine/ # Processing pipelines
|
|
426
|
-
activation.ts - 10-phase retrieval pipeline (dual BM25, coref, agreement gate)
|
|
427
|
-
consolidation.ts - 7-phase sleep cycle (diameter clustering, direct bridging, synaptic tagging)
|
|
428
|
-
connections.ts - Discover links between memories
|
|
429
|
-
staging.ts - Weak signal buffer (promote or discard)
|
|
430
|
-
retraction.ts - Negative memory / corrections
|
|
431
|
-
eviction.ts - Capacity enforcement
|
|
432
|
-
hooks/
|
|
433
|
-
sidecar.ts - Hook HTTP server (auto-checkpoint, stats, timer)
|
|
434
|
-
storage/
|
|
435
|
-
sqlite.ts - SQLite + FTS5 persistence layer
|
|
436
|
-
api/
|
|
437
|
-
routes.ts - HTTP endpoints (memory + task + system)
|
|
438
|
-
mcp.ts - MCP server (19 tools: 17 memory + 2 onboarding, incognito support)
|
|
439
|
-
cli.ts - CLI (setup, serve, hook config)
|
|
440
|
-
index.ts - HTTP server entry point (auto-backup on startup)
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
For detailed architecture including pipeline phases, database schema, and system diagrams, see [docs/architecture.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/architecture.md).
|
|
444
|
-
|
|
445
|
-
---
|
|
446
|
-
|
|
447
|
-
## Testing & Evaluation
|
|
448
|
-
|
|
449
|
-
```bash
|
|
450
|
-
npx vitest run # Unit: salience, decay, hebbian, supersession
|
|
451
|
-
npm run eval # 4 benchmark suites
|
|
452
|
-
npm run eval -- --suite=retrieval # One suite
|
|
453
|
-
npm run eval -- --bm25-only # Ablation: isolate a channel's contribution
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
### Real-store benchmark (0.13.x — replaces LoCoMo)
|
|
457
|
-
|
|
458
|
-
Measures the pipeline against a **frozen snapshot of a real store**, so passage lengths,
|
|
459
|
-
decay, supersession and Hebbian weights are all real rather than synthetic. Ground truth
|
|
460
|
-
is a unique-identifier hold-out verified through FTS, so it needs no hand labeling. And
|
|
461
|
-
correct **abstention scores positively** — selectivity is the product, so a benchmark
|
|
462
|
-
that punishes silence is measuring the wrong system.
|
|
463
|
-
|
|
464
|
-
```bash
|
|
465
|
-
node tests/realstore-eval/snapshot.mjs # freeze a copy of the live store
|
|
466
|
-
npx tsx tests/realstore-eval/runner.ts # identifier fixture (regression guard)
|
|
467
|
-
REALSTORE_FIXTURE=fixture-category.json \
|
|
468
|
-
npx tsx tests/realstore-eval/runner.ts # category fixture (retrievability)
|
|
469
|
-
bash tests/realstore-eval/campaign/full-comparison.sh # baseline vs recommended, all suites
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
Each run works on a **copy** — activation mutates access counts, and a benchmark must
|
|
473
|
-
not drift the thing it measures. The runner prints the active flag fingerprint, so every
|
|
474
|
-
result records which configuration produced it.
|
|
475
|
-
|
|
476
|
-
Per-suite methodology, scoring, and the remaining `test:*` scripts:
|
|
477
|
-
[`docs/benchmarks.md`](docs/benchmarks.md).
|
|
478
|
-
|
|
479
|
-
---
|
|
480
|
-
|
|
481
|
-
## Environment Variables
|
|
482
|
-
|
|
483
|
-
**Recommended recall configuration (0.13.x)** — default-OFF, but measured wins. Enable
|
|
484
|
-
all three together (see [Benchmarks](#benchmarks)):
|
|
485
|
-
|
|
486
|
-
```bash
|
|
487
|
-
AWM_RERANK2=1 AWM_RERANK_WINDOW=query AWM_RERANK_TAGS=1
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
| Variable | Effect |
|
|
491
|
-
|---|---|
|
|
492
|
-
| `AWM_RERANK2=1` | Second-stage reorder of the returned window by cross-encoder score alone, after the abstention gate. **+9.7pp s@1.** Must be paired with `AWM_RERANK_WINDOW=query` |
|
|
493
|
-
| `AWM_RERANK_WINDOW=query` | Spend the rerank char budget on the window densest in query terms instead of the first N chars. **25% → 87.5%** long-memory s@1 |
|
|
494
|
-
| `AWM_RERANK_TAGS=1` | Append structured tags to the rerank passage, so category words that exist only as tags reach the deciding stage. **+7.4pp s@1** |
|
|
495
|
-
|
|
496
|
-
Verify what a running process actually has — `memory_whoami` prints a `Recall config:`
|
|
497
|
-
line and `GET /health` reports the same fingerprint. A submodule bump can report a new
|
|
498
|
-
version while the flags never reached the process; on version alone that looks like success.
|
|
499
|
-
|
|
500
|
-
**Core settings:**
|
|
501
|
-
|
|
502
|
-
| Variable | Default | Purpose |
|
|
503
|
-
|----------|---------|---------|
|
|
504
|
-
| `AWM_DB_PATH` | `memory.db` (SQLite) / `./memory-pglite` (PGlite) | Storage path — file for SQLite, directory for PGlite |
|
|
505
|
-
| `AWM_STORE_BACKEND` | `sqlite` | `sqlite` (WAL, multi-process safe) · `pglite` (single-process) · `postgres` (networked, **experimental**) |
|
|
506
|
-
| `AWM_AGENT_ID` | `claude-code` | Agent id — the memory namespace. Pin it explicitly; an unpinned session lands in a per-directory UUID space nothing else can recall |
|
|
507
|
-
| `AWM_WORKSPACE` | *(unset)* | Default workspace for cross-agent recall in hive setups |
|
|
508
|
-
| `AWM_PORT` / `AWM_HOOK_PORT` | `8400` / `8401` | HTTP server and hook sidecar ports |
|
|
509
|
-
| `AWM_API_KEY` / `AWM_HOOK_SECRET` | *(none)* | Bearer tokens. Binding beyond loopback without an API key fails closed |
|
|
510
|
-
| `AWM_INCOGNITO` | *(unset)* | `1` disables all tools |
|
|
511
|
-
| `AWM_EMBED_MODEL` / `AWM_EMBED_DIMS` | `Xenova/bge-small-en-v1.5` / `384` | ⚠ `cosineSimilarity` returns **0** on dimension mismatch — migrate the whole corpus or not at all |
|
|
512
|
-
|
|
513
|
-
Every variable — including the salience, decay, fade, confidence, granularity and
|
|
514
|
-
diagnostic knobs, each with its measured effect and the **rejected** experiments and why
|
|
515
|
-
they lost — is documented in [`docs/reference.md`](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/reference.md).
|
|
516
|
-
|
|
517
|
-
---
|
|
518
|
-
|
|
519
|
-
## Tech Stack
|
|
520
|
-
|
|
521
|
-
| Component | Technology |
|
|
522
|
-
|-----------|-----------|
|
|
523
|
-
| Language | TypeScript (ES2022, strict) |
|
|
524
|
-
| Database | SQLite via better-sqlite3 + FTS5 |
|
|
525
|
-
| HTTP | Fastify 5 |
|
|
526
|
-
| MCP | @modelcontextprotocol/sdk |
|
|
527
|
-
| ML Runtime | @huggingface/transformers (local ONNX) |
|
|
528
|
-
| Embeddings | BGE-small-en-v1.5 (BAAI, retrieval-optimized, 384d) |
|
|
529
|
-
| Reranker | ms-marco-MiniLM-L-6-v2 (cross-encoder) |
|
|
530
|
-
| Query Expansion | flan-t5-small (synonym generation) |
|
|
531
|
-
| Tests | Vitest 4 |
|
|
532
|
-
| Validation | Zod 4 |
|
|
533
|
-
|
|
534
|
-
All three ML models run locally via ONNX. No external API calls for retrieval. The entire system is a single SQLite file + a Node.js process.
|
|
535
|
-
|
|
536
|
-
## What's New in v0.14.0 (latest)
|
|
537
|
-
|
|
538
|
-
Retrieval-quality releases, all additive. Corpus provenance differs per result and is
|
|
539
|
-
named in [Benchmarks](#benchmarks) — only the tags result and the combined figure come
|
|
540
|
-
from a real-store snapshot.
|
|
541
|
-
|
|
542
|
-
- **Second-stage rerank (`AWM_RERANK2`)** — final order was a blend that capped the
|
|
543
|
-
cross-encoder at 70% of the vote. It disagrees with that blend about rank 1 on 38.6%
|
|
544
|
-
of queries, and where the disagreement is decidable **the cross-encoder is right 77%
|
|
545
|
-
of the time**. Re-sorting by its score: **+9.7pp s@1**, no added inference. Placed
|
|
546
|
-
after the abstention gate so it cannot affect selectivity — predicted 0 broken / 0
|
|
547
|
-
fixed on adversarial, and measured exactly that.
|
|
548
|
-
- **Query-aware rerank window (`AWM_RERANK_WINDOW=query`)** — truncating passages to
|
|
549
|
-
the first 400 chars is necessary (cross-encoders pad to the longest passage in a
|
|
550
|
-
batch), but a *prefix* is the wrong 400. Real canonical memories are median 1,965
|
|
551
|
-
chars, 98.7% exceed 400, and **99.9%** of long ones carry their identifiers only
|
|
552
|
-
past char 400. Same budget, densest window: **25% → 87.5%**.
|
|
553
|
-
- **`memory_whoami` reports the effective recall config** — version alone does not
|
|
554
|
-
answer "what am I actually running". This caught a real deployment failure the day
|
|
555
|
-
it shipped: a project-level `.mcp.json` was overriding the config being edited, so
|
|
556
|
-
the new version reported success while the flags never reached the process.
|
|
557
|
-
- **Tags into the rerank passage (`AWM_RERANK_TAGS`)** — **+7.4pp s@1**, with no
|
|
558
|
-
re-embed, no new model and no write-path change; existing corpora benefit immediately
|
|
559
|
-
because the tags are already stored.
|
|
560
|
-
- **Writing guidance corrected at the source** — the shipped advice was *causing* the
|
|
561
|
-
problem it warned about. "Pick the most specific topic" pushed authors away from
|
|
562
|
-
category words, reliably producing memories that are maximally specific and
|
|
563
|
-
categorically anonymous. Two new rules: **name the CATEGORY as well as the
|
|
564
|
-
specifics**, and **tags are not a substitute for body text** (only BM25 indexes tags —
|
|
565
|
-
the embedding and the rerank passage are both built from `concept + content`, so a
|
|
566
|
-
tag-only word is invisible to two of three channels, including the one that now
|
|
567
|
-
decides ordering).
|
|
568
|
-
|
|
569
|
-
### Previously, in v0.12.x
|
|
570
|
-
|
|
571
|
-
`memory_whoami` instance identity · entity inverted index (`AWM_ENTITY_INDEX_FETCH=1`,
|
|
572
|
-
opt-in) · local-first security defaults (loopback bind, fail-closed without an API key)
|
|
573
|
-
· write-path slow-write telemetry · memory-spine provenance (`origin_class`,
|
|
574
|
-
`valid_from`/`valid_to`) · cognition recipes at `memory_task_end` · engram ids in
|
|
575
|
-
recall results · eager warm at MCP startup + sidecar warm recall.
|
|
576
|
-
|
|
577
|
-
Full version-by-version history — every release back to v0.6.0, including the
|
|
578
|
-
0.7.6→0.7.14 latency work (11s→300ms) and the 0.8.5 recall-quality hardening pass —
|
|
579
|
-
lives in [CHANGELOG.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/CHANGELOG.md).
|
|
580
|
-
|
|
581
|
-
## Integrations
|
|
582
|
-
|
|
583
|
-
AWM is a standard MCP server, so it plugs into any MCP-capable agent host with
|
|
584
|
-
**no adapter code** — the same server Claude Code uses. Point two hosts at the
|
|
585
|
-
same `AWM_DB_PATH` (with a shared `AWM_AGENT_ID`/`AWM_WORKSPACE`) and they share
|
|
586
|
-
one cognitive memory.
|
|
587
|
-
|
|
588
|
-
### Hermes Agent (Nous Research)
|
|
589
|
-
|
|
590
|
-
1. Make AWM available where Hermes runs (e.g. a derived Docker image — the
|
|
591
|
-
Hermes image already bundles Node):
|
|
592
|
-
|
|
593
|
-
```dockerfile
|
|
594
|
-
FROM hermes-agent:local
|
|
595
|
-
USER root
|
|
596
|
-
RUN npm install -g agent-working-memory@latest
|
|
597
|
-
ENV HF_HOME=/opt/data/.cache/huggingface
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
2. Register it in `~/.hermes/config.yaml`:
|
|
601
|
-
|
|
602
|
-
```yaml
|
|
603
|
-
mcp_servers:
|
|
604
|
-
awm:
|
|
605
|
-
command: node
|
|
606
|
-
args: ["/usr/local/lib/node_modules/agent-working-memory/dist/mcp.js"]
|
|
607
|
-
env:
|
|
608
|
-
AWM_AGENT_ID: hermes
|
|
609
|
-
AWM_DB_PATH: /opt/data/awm/hermes.db # on a persistent volume
|
|
610
|
-
HF_HOME: /opt/data/.cache/huggingface
|
|
611
|
-
timeout: 600 # first call downloads the embedder
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
3. AWM's tools appear to the agent as `mcp_awm_memory_write`,
|
|
615
|
-
`mcp_awm_memory_recall`, etc. Works with any Hermes model provider
|
|
616
|
-
(verified on Anthropic and Azure `gpt-5-4-mini`).
|
|
617
|
-
|
|
618
|
-
Full recipe — model-provider examples, the Azure GPT-5.x `/openai/v1` note, and
|
|
619
|
-
gotchas (incl. the Windows CRLF/s6 clone fix) — is in
|
|
620
|
-
[docs/integrations/hermes.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/integrations/hermes.md).
|
|
621
|
-
|
|
622
|
-
## Project Status
|
|
623
|
-
|
|
624
|
-
AWM is in active development (v0.14.0). The core memory pipeline, consolidation
|
|
625
|
-
system, multi-agent coordination, and MCP integration are stable and used
|
|
626
|
-
daily in production coding workflows.
|
|
627
|
-
|
|
628
|
-
- Core retrieval and consolidation: **stable**
|
|
629
|
-
- MCP tools and Claude Code integration: **stable** (19 tools: 17 memory + 2 onboarding)
|
|
630
|
-
- Other MCP hosts (e.g. [Hermes Agent](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/integrations/hermes.md)): **supported** — AWM drops in as an MCP memory server with no adapter code
|
|
631
|
-
- Multi-agent coordination: **stable** (v0.8.1 hardening)
|
|
632
|
-
- Task management: **stable**
|
|
633
|
-
- Hook sidecar and auto-checkpoint: **stable** — plus `POST /memory/activate` warm recall for hooks (v0.12.2)
|
|
634
|
-
- HTTP API: **stable** (for custom agents)
|
|
635
|
-
- Eval harness: **stable** (v0.6.0, extended through 0.8.x); gauntlet acceptance test added (v0.12.0)
|
|
636
|
-
- Recall confidence + opt-in abstention (PR-1, PR-2): **stable** (v0.8.5)
|
|
637
|
-
- Coherence-weighted retraction + counter-narrative inheritance: **stable** (v0.8.5)
|
|
638
|
-
- Content fade stage + adaptive output granularity: **stable** (v0.8.5)
|
|
639
|
-
- PGlite backend (alternative to SQLite, with pgvector + ivfflat): **stable** (v0.8.x)
|
|
640
|
-
- Networked Postgres backend (`pg` + pgvector, multi-connection): **experimental** (v0.10.0)
|
|
641
|
-
- Backend-agnostic `import`/`export` (embeddings included, cross-backend port): **stable** (v0.10.0)
|
|
642
|
-
- Instance identity (`memory_whoami`), local-first security defaults, write-path telemetry, memory-spine provenance (`origin_class`/`valid_from`/`valid_to`), cognition recipes: **stable** (v0.12.0)
|
|
643
|
-
- Entity inverted index + guarded index-backed retrieval: **stable, opt-in** (`AWM_ENTITY_INDEX_FETCH=1`, default off pending broader eval) (v0.12.0)
|
|
644
|
-
- Second-stage rerank, query-aware rerank window, tags-into-rerank: **stable, opt-in** (`AWM_RERANK2=1 AWM_RERANK_WINDOW=query AWM_RERANK_TAGS=1` — enable together) (v0.13.4-0.13.6)
|
|
645
|
-
- Real-store benchmark (`tests/realstore-eval/`), replacing LoCoMo: **stable** (v0.13.x)
|
|
646
|
-
|
|
647
|
-
See [CHANGELOG.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/CHANGELOG.md) for version history.
|
|
648
|
-
|
|
649
|
-
---
|
|
650
|
-
|
|
651
|
-
## License
|
|
652
|
-
|
|
653
|
-
Apache 2.0 — see [LICENSE](https://github.com/CompleteIdeas/agent-working-memory/blob/master/LICENSE) and [NOTICE](https://github.com/CompleteIdeas/agent-working-memory/blob/master/NOTICE).
|
|
1
|
+
# AgentWorkingMemory (AWM)
|
|
2
|
+
|
|
3
|
+
**Give your AI coding agent a memory that survives the conversation — and knows when to stay quiet.**
|
|
4
|
+
|
|
5
|
+
Every session with an AI assistant starts blank. It has forgotten what your team decided last
|
|
6
|
+
week, which approach was tried and rejected, and which table actually holds the thing it needs.
|
|
7
|
+
So it re-derives all of it — reading files, running searches, asking you — and on a large project
|
|
8
|
+
it will confidently rebuild something that was already decided against.
|
|
9
|
+
|
|
10
|
+
AWM fixes that with one local process and one SQLite file. The agent writes short notes as it
|
|
11
|
+
learns; AWM decides which are worth keeping, hands back the two or three that matter when asked,
|
|
12
|
+
and says **nothing** when nothing fits.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g agent-working-memory && awm setup --global
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Restart Claude Code. 19 tools appear. No cloud, no API keys, nothing leaves your machine.
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/for-decision-makers.md"><b>Deciding whether to adopt it? →</b></a> ·
|
|
22
|
+
<a href="https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/walkthrough.md"><b>Want the mechanism walked through? →</b></a> ·
|
|
23
|
+
<a href="https://completeideas.github.io/agent-working-memory/"><b>Docs site →</b></a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## What it does, measured
|
|
29
|
+
|
|
30
|
+
Every number below is reproducible from this repository against a frozen copy of a **real
|
|
31
|
+
30,000-memory store** — not synthetic test data. Method and corrections: [`docs/benchmarks.md`](docs/benchmarks.md).
|
|
32
|
+
|
|
33
|
+
| | |
|
|
34
|
+
|---|---|
|
|
35
|
+
| **Returns the right memory first** | **92.7%** of identifier queries · **92.0%** of topic queries · ~97% in the top five |
|
|
36
|
+
| **Stays silent when it should** | **90%** correct abstention on questions about facts never stored |
|
|
37
|
+
| **Halves the digging** | Same agent, same tools, four real support tickets: with memory, **2× the specific facts** the real answer needed and **half the database queries** (49 vs 100). On one ticket the memoryless arm ran 25 queries, exhausted its budget and answered nothing; the memory arm answered in 4. |
|
|
38
|
+
| **Holds decisions for months** | On a six-month application project, recorded decisions were recalled a median of **30 days** after being written — some after **167 days**. 41% of the technical identifiers the agent used had entered the conversation *only* through a recall. |
|
|
39
|
+
| **Costs a fraction to answer** | Scoped recall answers in **~630 tokens flat** regardless of store size. Carrying the memory store instead: ~1.3M tokens. Reading the codebase: doesn't fit in any window. |
|
|
40
|
+
| **Lets a cheap model punch up** | A small model plus AWM out-performed a frontier model on a 15-task domain workload at **~1/40th the cost** — **14/15 vs 7/15**, $0.007 vs $0.277 per task. |
|
|
41
|
+
|
|
42
|
+
Two independently built fixtures agree within a point. Warm recall takes about half a second.
|
|
43
|
+
|
|
44
|
+
<details>
|
|
45
|
+
<summary><b>How these numbers were corrected upward in September 2026</b> — read before comparing to older figures</summary>
|
|
46
|
+
|
|
47
|
+
Earlier published figures (s@1 63.8% category, 70.0% identifier) were **understated by the
|
|
48
|
+
measuring instrument, not the engine**. Two defects, both found and fixed in 0.14.4–0.14.5: the
|
|
49
|
+
benchmark's decay clock ran on the wall clock, so the "frozen" snapshot aged a day per day; and the
|
|
50
|
+
runner queried every gold as the `work` agent while a quarter to a third belonged to `personal`,
|
|
51
|
+
so agent isolation cut them before scoring. Nothing in retrieval changed between 63.8 and 92.0.
|
|
52
|
+
The within-day *deltas* published earlier (e.g. the +7.4pp tags win) stand. Full account in
|
|
53
|
+
[`docs/benchmarks.md`](docs/benchmarks.md) → correction notes.
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Why it works when a vector store doesn't
|
|
59
|
+
|
|
60
|
+
Most "memory for AI" stores everything and retrieves by similarity. AWM makes the opposite bet:
|
|
61
|
+
**a memory is only useful if it is selective.**
|
|
62
|
+
|
|
63
|
+
**It refuses most of what it sees.** Every write is scored for importance before storage —
|
|
64
|
+
is it new, is it a decision or a root cause, does it name its subject? About a third of what
|
|
65
|
+
the agent offers is kept at full confidence. The rest never competes, so recall stays sharp as
|
|
66
|
+
the store grows.
|
|
67
|
+
|
|
68
|
+
**It forgets gracefully.** Memories that keep getting used stay strong; ones nobody touches
|
|
69
|
+
fade from ranking without being deleted. The model is borrowed from cognitive science (ACT-R),
|
|
70
|
+
and it means no one curates the store.
|
|
71
|
+
|
|
72
|
+
**It tells you when it doesn't know.** When the top candidates are only marginally better than
|
|
73
|
+
the tenth, AWM returns nothing and says how many it withheld. A confident wrong memory is more
|
|
74
|
+
expensive than an admitted gap — the benchmark scores the silence as a win.
|
|
75
|
+
|
|
76
|
+
**It knows what changed.** When a fact is corrected, the old memory is marked superseded and
|
|
77
|
+
carries a visible warning if it ever surfaces. A notes file has two paragraphs that read with
|
|
78
|
+
equal confidence; AWM knows which one won. One project has 108 such supersessions — an agent
|
|
79
|
+
resuming it gets one current state, not five.
|
|
80
|
+
|
|
81
|
+
**It stays local and per-person.** One SQLite file, three small ONNX models (~200 MB, once).
|
|
82
|
+
Work and personal memories are separate pools; several sessions share a pool safely.
|
|
83
|
+
|
|
84
|
+
<details>
|
|
85
|
+
<summary>Against a typical RAG / vector store, feature by feature</summary>
|
|
86
|
+
|
|
87
|
+
| | Typical vector store | AWM |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| Storage | Everything | Salience-filtered: active / staging / low-confidence fallback |
|
|
90
|
+
| Retrieval | Cosine similarity | Keyword + vector candidates → liveness scoring → cross-encoder rerank → abstention gate |
|
|
91
|
+
| Forgetting | Manual cleanup | ACT-R decay; reinforced knowledge persists |
|
|
92
|
+
| Correction | Delete and re-insert | Supersede with a visible pointer; retract with confidence propagation to neighbours |
|
|
93
|
+
| Duplicates | Stored again | Reinforce the existing memory instead |
|
|
94
|
+
| Wrong answers | Best of a bad set | Returns nothing, says why |
|
|
95
|
+
| Named things | Vocabulary-dependent | Entity index on tickets, people, tables, files |
|
|
96
|
+
| Feedback | None | Useful / not-useful adjusts confidence and rank |
|
|
97
|
+
| Multi-agent | Per-instance | Shared store, per-agent scoping, opt-in shared workspace |
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Who uses it
|
|
103
|
+
|
|
104
|
+
- **Long-running coding agents** that need cross-session project knowledge
|
|
105
|
+
- **Support and operations agents** that must remember what was already decided on a ticket
|
|
106
|
+
- **Multi-agent pipelines** where specialised agents share one memory
|
|
107
|
+
- **Local-first teams** for whom cloud memory is not acceptable
|
|
108
|
+
- **Any MCP host** — Claude Code, [Hermes Agent](docs/integrations/hermes.md), or your own agent over a local HTTP API
|
|
109
|
+
|
|
110
|
+
**Not** a chatbot, a hosted service, a generic vector database, or a replacement for your
|
|
111
|
+
code and tickets as the source of truth. Recall first; verify against the source when it
|
|
112
|
+
matters; supersede when reality differs.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Get started
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm install -g agent-working-memory
|
|
120
|
+
awm setup --global # MCP config, CLAUDE.md guidance, hooks
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Requires **Node.js 22+**. Restart Claude Code; the first conversation is ~30 s slower while the
|
|
124
|
+
models download. Upgrading is the same two commands — the database is preserved and every
|
|
125
|
+
release to date has been backward compatible.
|
|
126
|
+
|
|
127
|
+
Starting on an existing project? Warm-start the store from its own docs so recall is useful
|
|
128
|
+
on day one:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
awm onboard ./docs --repo . --project <name> # review the pack, then
|
|
132
|
+
awm import <pack> --db <path> --dedupe
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
| Next | |
|
|
136
|
+
|---|---|
|
|
137
|
+
| Install, first write, first recall | [`docs/quickstart.md`](docs/quickstart.md) |
|
|
138
|
+
| Separate pools per project, incognito mode, hooks | [`docs/claude-code-setup.md`](docs/claude-code-setup.md) |
|
|
139
|
+
| Teams and multi-agent | [`docs/team-setup-guide.md`](docs/team-setup-guide.md) |
|
|
140
|
+
| Custom agents over HTTP | [`docs/reference.md`](docs/reference.md) |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Recommended configuration
|
|
145
|
+
|
|
146
|
+
Three retrieval improvements ship default-off and should be enabled **together**:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
AWM_RERANK2=1 AWM_RERANK_WINDOW=query AWM_RERANK_TAGS=1
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Second-stage rerank by the cross-encoder's own score; a 400-character rerank window placed on
|
|
153
|
+
the densest query-term region rather than the prefix (**25% → 87.5%** on long memories); and
|
|
154
|
+
tags fed into the rerank passage (**+7.4pp**). `memory_whoami` prints the active fingerprint so
|
|
155
|
+
you can confirm a running process actually has them. Every other variable, with its measured
|
|
156
|
+
effect and the experiments that were rejected: [`docs/reference.md`](docs/reference.md).
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## How it works, in one paragraph
|
|
161
|
+
|
|
162
|
+
A write is scored for salience — novelty against the existing store, event type, whether it
|
|
163
|
+
names identifiers — and lands active, staged, or low-confidence. A recall casts a wide net with
|
|
164
|
+
keyword and vector search, scores each candidate for relevance and liveness, lets linked
|
|
165
|
+
memories vote, hands the shortlist to a cross-encoder that actually reads the text, then checks
|
|
166
|
+
whether the score distribution justifies answering at all. A maintenance pass on session end
|
|
167
|
+
clusters, decays unused links, and archives what has gone cold. Corrections supersede rather
|
|
168
|
+
than overwrite.
|
|
169
|
+
|
|
170
|
+
The whole thing, one memory followed end to end with every threshold sourced:
|
|
171
|
+
[`docs/walkthrough.md`](docs/walkthrough.md). The pipeline internals for engineers, with the
|
|
172
|
+
attribution study behind the defaults: [`pipeline-walkthrough.html`](https://completeideas.github.io/agent-working-memory/pipeline-walkthrough.html).
|
|
173
|
+
The theory and its citations: [`docs/cognitive-model.md`](docs/cognitive-model.md).
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Honest limits
|
|
178
|
+
|
|
179
|
+
- No help on small one-off tasks — the overhead pays back when knowledge is reused or the
|
|
180
|
+
project outgrows the context window.
|
|
181
|
+
- Recall is bounded by what was written. A memory that never names its subject can't be found
|
|
182
|
+
by it. The writing guidance exists for this reason.
|
|
183
|
+
- The association graph, as of this release, rarely changes a final answer; the reranker does.
|
|
184
|
+
- It is 0.x, and it says so: the benchmark was corrected three times this month when the
|
|
185
|
+
instrument turned out to be wrong. The corrections are documented in place, not revised away.
|
|
186
|
+
|
|
187
|
+
Everything else, with evidence and workarounds: [`docs/known-limitations.md`](docs/known-limitations.md).
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## What's new — v0.14.5
|
|
192
|
+
|
|
193
|
+
Nothing in the retrieval engine changed in the last four point releases; what changed is how it
|
|
194
|
+
is measured, invoked, and reports on itself.
|
|
195
|
+
|
|
196
|
+
- **Benchmark instrument corrected twice; real numbers are higher.** Identifier s@1 92.7%,
|
|
197
|
+
category 92.0%, abstention unchanged at 90%. The runner now pins its clock and queries as each
|
|
198
|
+
gold's own agent.
|
|
199
|
+
- **Feedback joins to its recall.** `memory_recall` ends with `[recall_id: …]`;
|
|
200
|
+
`memory_feedback` accepts it. Before this every feedback row in the live store was orphaned.
|
|
201
|
+
`memory_stats` now reports outcome numbers instead of activity counters.
|
|
202
|
+
- **One hook sidecar per session.** Each session's process binds the first free port from 8401
|
|
203
|
+
upward; `memory_whoami` reports the port it actually holds.
|
|
204
|
+
- **An empty recall no longer claims absence.** `RECALL ABSTAINED` with the withheld count,
|
|
205
|
+
instead of "No relevant memories found."
|
|
206
|
+
|
|
207
|
+
Full history back to v0.6.0: [CHANGELOG.md](CHANGELOG.md).
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Reference
|
|
212
|
+
|
|
213
|
+
The README points outward; it does not duplicate. Everything below is the authoritative source.
|
|
214
|
+
|
|
215
|
+
| | |
|
|
216
|
+
|---|---|
|
|
217
|
+
| **All 19 MCP tools**, every HTTP endpoint with schemas, every environment variable with its measured effect | [`docs/reference.md`](docs/reference.md) |
|
|
218
|
+
| Architecture, pipelines, schema, backends (SQLite · PGlite · Postgres) | [`docs/architecture.md`](docs/architecture.md) · [`docs/pglite-feature-parity.md`](docs/pglite-feature-parity.md) |
|
|
219
|
+
| Every eval suite — what it measures, how to run it, and how each number was corrected | [`docs/benchmarks.md`](docs/benchmarks.md) |
|
|
220
|
+
| Building an agent on AWM as a substrate (PRIME → ACT → VERIFY → LEARN) | [`docs/patterns/awm-native-harness.md`](docs/patterns/awm-native-harness.md) · [agent playbook](https://completeideas.github.io/agent-working-memory/awm-for-agents.html) |
|
|
221
|
+
| Running it as a service; backup, restore, migration | [`docs/deployment.md`](docs/deployment.md) |
|
|
222
|
+
| Behaviour as the store grows | [`docs/using-awm-at-scale.md`](docs/using-awm-at-scale.md) |
|
|
223
|
+
| The vocabulary — engram, salience, activation, Hebbian, staging | [`docs/onboarding-vocabulary.md`](docs/onboarding-vocabulary.md) |
|
|
224
|
+
| When something is wrong | [`docs/troubleshooting.md`](docs/troubleshooting.md) |
|
|
225
|
+
| Full index | [`docs/README.md`](docs/README.md) |
|
|
226
|
+
|
|
227
|
+
**Stack:** TypeScript · SQLite + FTS5 (or PGlite / Postgres) · Fastify · `@modelcontextprotocol/sdk` ·
|
|
228
|
+
local ONNX via `@huggingface/transformers` — bge-small-en-v1.5 embeddings, ms-marco-MiniLM cross-encoder,
|
|
229
|
+
flan-t5-small expansion. Node 22+.
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
npx vitest run # 737 tests
|
|
233
|
+
npm run eval # benchmark suites
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Status
|
|
239
|
+
|
|
240
|
+
Active development, v0.14.5. Core retrieval, consolidation, MCP integration, hooks, task
|
|
241
|
+
management, and the HTTP API are stable and in daily production use. PGlite backend stable;
|
|
242
|
+
networked Postgres experimental. Real-store benchmark replaces LoCoMo as of 0.13.x.
|
|
243
|
+
|
|
244
|
+
**License:** Apache 2.0 — [LICENSE](LICENSE) · [NOTICE](NOTICE)
|