agent-working-memory 0.14.5 → 0.14.6

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 CHANGED
@@ -27,89 +27,54 @@ Restart Claude Code. 19 tools appear. No cloud, no API keys, nothing leaves your
27
27
 
28
28
  ## What it does, measured
29
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).
30
+ Reproducible from this repository against a frozen copy of a **real 30,000-memory store**, not
31
+ synthetic data. Current numbers, stamped with the commit that produced them:
32
+ [`docs/benchmarks-current.md`](docs/benchmarks-current.md).
32
33
 
33
34
  | | |
34
35
  |---|---|
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. |
36
+ | **Returns the right memory first** | **92.7%** of identifier queries · **92.0%** of topic queries · **96.7%** in the top five |
37
+ | **Stays silent when it should** | **90.0%** correct abstention on questions about facts never stored |
38
+ | **Costs the same at any scale** | Scoped recall answers in **~630 tokens flat**. Carrying the store instead: ~1.3M tokens |
39
+ | **Lets a cheap model punch up** | Small model + AWM beat a frontier model on a 15-task domain workload: **14/15 vs 7/15**, at ~1/40th the cost |
41
40
 
42
41
  Two independently built fixtures agree within a point. Warm recall takes about half a second.
43
42
 
44
43
  <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.
44
+ <summary>Two more, from real work rather than fixtures</summary>
67
45
 
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.
46
+ **Halves the digging.** Same agent, same tools, four real support tickets: with memory, 2× the
47
+ specific facts the real answer needed and half the database queries (49 vs 100). On one ticket
48
+ the memoryless arm ran 25 queries, exhausted its budget and answered nothing; the memory arm
49
+ answered in 4.
71
50
 
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.
51
+ **Holds decisions for months.** On a six-month application project, recorded decisions were
52
+ recalled a median of 30 days after being written — some after 167. 41% of the technical
53
+ identifiers the agent used had entered the conversation *only* through a recall.
54
+ </details>
75
55
 
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.
56
+ ---
80
57
 
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.
58
+ ## Is this for you?
83
59
 
84
- <details>
85
- <summary>Against a typical RAG / vector store, feature by feature</summary>
60
+ The honest version, because the overhead is real and it does not pay back for everyone.
86
61
 
87
- | | Typical vector store | AWM |
62
+ | If you are… | What you actually get | It pays back when |
88
63
  |---|---|---|
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
64
+ | **A solo developer on one long-lived project** | The agent stops re-asking what you already told it, and stops re-proposing approaches you rejected | The project outgrows the context window — roughly, when you start saying "I have explained this before" |
65
+ | **A team sharing conventions** | One pool where a decision written by anyone is recalled by everyone, with corrections superseding rather than accumulating | More than one person is steering agents at the same codebase |
66
+ | **Running support or operations agents** | Ticket-scoped recall by real identifiers, so the second agent to touch a ticket knows what the first one did | Work arrives as a queue that several sessions or people share |
67
+ | **Building multi-agent pipelines** | A shared substrate with per-agent scoping, so specialists cooperate without sharing one context window | You have specialised agents that need the same facts |
68
+ | **Cost-constrained** | A small local model with good recall beats a frontier model without it on domain work | Your workload is narrow and repetitive rather than novel each time |
69
+ | **Somewhere cloud memory is not allowed** | One SQLite file on the machine. No account, no telemetry, no egress | Compliance makes hosted memory a non-starter |
103
70
 
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
71
+ **Skip it if:** your tasks are short and one-off with nothing worth reusing; you want a hosted
72
+ service someone else operates; you need memory synced across machines out of the box; or you were
73
+ hoping to replace your code, tickets and docs as the source of truth. AWM is a fast path back to
74
+ what was already decided — recall first, verify against the source when it matters, supersede when
75
+ reality differs.
109
76
 
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.
77
+ It is also **not** a chatbot, a generic vector database, or a RAG pipeline over your files.
113
78
 
114
79
  ---
115
80
 
@@ -120,18 +85,35 @@ npm install -g agent-working-memory
120
85
  awm setup --global # MCP config, CLAUDE.md guidance, hooks
121
86
  ```
122
87
 
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.
88
+ Requires **Node.js 22+**. Restart Claude Code.
89
+
90
+ **What to expect.** The first conversation is ~30 s slower while three small ONNX models download
91
+ (~200 MB, once). After that the agent has 19 memory tools, and the hooks save state on compaction
92
+ and session end without you doing anything. For the first day or two recall will be thin — it only
93
+ knows what has been written. That is the normal shape of it, not a fault.
126
94
 
127
- Starting on an existing project? Warm-start the store from its own docs so recall is useful
128
- on day one:
95
+ **Starting on an existing project?** Warm-start the store from its own docs so recall is useful on
96
+ day one:
129
97
 
130
98
  ```bash
131
99
  awm onboard ./docs --repo . --project <name> # review the pack, then
132
100
  awm import <pack> --db <path> --dedupe
133
101
  ```
134
102
 
103
+ **Turn on the three retrieval improvements.** They ship default-off and belong together:
104
+
105
+ ```bash
106
+ AWM_RERANK2=1 AWM_RERANK_WINDOW=query AWM_RERANK_TAGS=1
107
+ ```
108
+
109
+ Second-stage rerank by the cross-encoder's own score; a 400-character rerank window placed on the
110
+ densest query-term region rather than the prefix (**25% → 87.5%** on long memories); and tags fed
111
+ into the rerank passage (**+7.4pp**). `awm setup` writes them on a fresh install. `memory_whoami`
112
+ prints the active fingerprint so you can confirm a running process has them.
113
+
114
+ **Check it worked:** `awm doctor claude-code` reports the live sidecars, which agent each serves,
115
+ and whether anything needs a re-run of setup.
116
+
135
117
  | Next | |
136
118
  |---|---|
137
119
  | Install, first write, first recall | [`docs/quickstart.md`](docs/quickstart.md) |
@@ -141,73 +123,81 @@ awm import <pack> --db <path> --dedupe
141
123
 
142
124
  ---
143
125
 
144
- ## Recommended configuration
126
+ ## Why it works when a vector store doesn't
145
127
 
146
- Three retrieval improvements ship default-off and should be enabled **together**:
128
+ Most "memory for AI" stores everything and retrieves by similarity. AWM makes the opposite bet:
129
+ **a memory is only useful if it is selective.**
147
130
 
148
- ```bash
149
- AWM_RERANK2=1 AWM_RERANK_WINDOW=query AWM_RERANK_TAGS=1
150
- ```
131
+ **It refuses most of what it sees.** Every write is scored for importance before storage — is it
132
+ new, is it a decision or a root cause, does it name its subject? About a third of what the agent
133
+ offers is kept at full confidence. The rest never competes, so recall stays sharp as the store
134
+ grows.
135
+
136
+ **It forgets gracefully.** Memories that keep getting used stay strong; ones nobody touches fade
137
+ from ranking without being deleted. The model is borrowed from cognitive science (ACT-R), and it
138
+ means no one curates the store.
139
+
140
+ **It tells you when it doesn't know.** When the top candidates are only marginally better than the
141
+ tenth, AWM returns nothing and says how many it withheld. A confident wrong memory is more
142
+ expensive than an admitted gap — the benchmark scores the silence as a win.
143
+
144
+ **It knows what changed.** When a fact is corrected, the old memory is marked superseded and
145
+ carries a visible warning if it ever surfaces. A notes file has two paragraphs that read with equal
146
+ confidence; AWM knows which one won. One project has 108 such supersessions — an agent resuming it
147
+ gets one current state, not five.
151
148
 
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).
149
+ **It stays local and per-person.** One SQLite file, three small ONNX models. Work and personal
150
+ memories are separate pools; several sessions share a pool safely.
151
+
152
+ <details>
153
+ <summary>Against a typical RAG / vector store, feature by feature</summary>
154
+
155
+ | | Typical vector store | AWM |
156
+ |---|---|---|
157
+ | Storage | Everything | Salience-filtered: active / staging / low-confidence fallback |
158
+ | Retrieval | Cosine similarity | Keyword + vector candidates → liveness scoring → cross-encoder rerank → abstention gate |
159
+ | Forgetting | Manual cleanup | ACT-R decay; reinforced knowledge persists |
160
+ | Correction | Delete and re-insert | Supersede with a visible pointer; retract with confidence propagation to neighbours |
161
+ | Duplicates | Stored again | Reinforce the existing memory instead |
162
+ | Wrong answers | Best of a bad set | Returns nothing, says why |
163
+ | Named things | Vocabulary-dependent | Entity index on tickets, people, tables, files |
164
+ | Feedback | None | Useful / not-useful adjusts confidence and rank |
165
+ | Multi-agent | Per-instance | Shared store, per-agent scoping, opt-in shared workspace |
166
+ </details>
157
167
 
158
168
  ---
159
169
 
160
170
  ## How it works, in one paragraph
161
171
 
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.
172
+ A write is scored for salience — novelty against the existing store, event type, whether it names
173
+ identifiers — and lands active, staged, or low-confidence. A recall casts a wide net with keyword
174
+ and vector search, scores each candidate for relevance and liveness, lets linked memories vote,
175
+ hands the shortlist to a cross-encoder that actually reads the text, then checks whether the score
176
+ distribution justifies answering at all. A maintenance pass on session end clusters, decays unused
177
+ links, and archives what has gone cold. Corrections supersede rather than overwrite.
169
178
 
170
179
  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).
180
+ [`docs/walkthrough.md`](docs/walkthrough.md). The mental model an engineer needs to predict its
181
+ behaviour — proposers, deciders, and when it stays silent:
182
+ [`How AWM decides what to say`](https://completeideas.github.io/agent-working-memory/pipeline-walkthrough.html).
173
183
  The theory and its citations: [`docs/cognitive-model.md`](docs/cognitive-model.md).
174
184
 
175
185
  ---
176
186
 
177
187
  ## Honest limits
178
188
 
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.
189
+ - No help on small one-off tasks — the overhead pays back when knowledge is reused or the project
190
+ outgrows the context window.
191
+ - Recall is bounded by what was written. A memory that never names its subject cannot be found by
192
+ it. The writing guidance exists for this reason.
183
193
  - 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.
194
+ - It is 0.x. Benchmark figures have been corrected upward more than once after the *instrument*
195
+ turned out to be wrong; every correction is documented in place rather than revised away.
186
196
 
187
197
  Everything else, with evidence and workarounds: [`docs/known-limitations.md`](docs/known-limitations.md).
188
198
 
189
199
  ---
190
200
 
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
201
  ## Reference
212
202
 
213
203
  The README points outward; it does not duplicate. Everything below is the authoritative source.
@@ -216,7 +206,8 @@ The README points outward; it does not duplicate. Everything below is the author
216
206
  |---|---|
217
207
  | **All 19 MCP tools**, every HTTP endpoint with schemas, every environment variable with its measured effect | [`docs/reference.md`](docs/reference.md) |
218
208
  | 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) |
209
+ | Current benchmark numbers, generated and stamped | [`docs/benchmarks-current.md`](docs/benchmarks-current.md) |
210
+ | What each eval suite measures, and the measurement caveats | [`docs/benchmarks.md`](docs/benchmarks.md) |
220
211
  | 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
212
  | Running it as a service; backup, restore, migration | [`docs/deployment.md`](docs/deployment.md) |
222
213
  | Behaviour as the store grows | [`docs/using-awm-at-scale.md`](docs/using-awm-at-scale.md) |
@@ -229,16 +220,21 @@ local ONNX via `@huggingface/transformers` — bge-small-en-v1.5 embeddings, ms-
229
220
  flan-t5-small expansion. Node 22+.
230
221
 
231
222
  ```bash
232
- npx vitest run # 737 tests
233
- npm run eval # benchmark suites
223
+ npx vitest run # 760 tests
224
+ npm run bench # benchmark suites
225
+ npm run test:docker # clean-room install of the packed tarball
226
+ npm run test:linux # build + full suite on Linux (760/760)
234
227
  ```
235
228
 
236
229
  ---
237
230
 
238
231
  ## Status
239
232
 
240
- Active development, v0.14.5. Core retrieval, consolidation, MCP integration, hooks, task
233
+ Active development, v0.14.6. Core retrieval, consolidation, MCP integration, hooks, task
241
234
  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.
235
+ networked Postgres experimental.
236
+
237
+ Release notes, and every benchmark correction recorded against the release that made it:
238
+ [CHANGELOG.md](CHANGELOG.md).
243
239
 
244
240
  **License:** Apache 2.0 — [LICENSE](LICENSE) · [NOTICE](NOTICE)
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,YAAY,CAAC;AAsC7E,QAAA,MAAM,OAAO,EAAE,UAoOd,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,YAAY,CAAC;AAwG7E,QAAA,MAAM,OAAO,EAAE,UAoQd,CAAC;AAEF,eAAe,OAAO,CAAC"}