agent-working-memory 0.7.17 → 0.8.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.
Files changed (186) hide show
  1. package/README.md +156 -15
  2. package/dist/adapters/common.js +202 -202
  3. package/dist/adapters/http.js +22 -22
  4. package/dist/api/routes.d.ts +1 -1
  5. package/dist/api/routes.d.ts.map +1 -1
  6. package/dist/api/routes.js +258 -79
  7. package/dist/api/routes.js.map +1 -1
  8. package/dist/cli/migrate.d.ts +42 -0
  9. package/dist/cli/migrate.d.ts.map +1 -0
  10. package/dist/cli/migrate.js +268 -0
  11. package/dist/cli/migrate.js.map +1 -0
  12. package/dist/cli.js +147 -103
  13. package/dist/cli.js.map +1 -1
  14. package/dist/coordination/circuit-breaker.d.ts +24 -0
  15. package/dist/coordination/circuit-breaker.d.ts.map +1 -0
  16. package/dist/coordination/circuit-breaker.js +70 -0
  17. package/dist/coordination/circuit-breaker.js.map +1 -0
  18. package/dist/coordination/failure-modes.d.ts +21 -0
  19. package/dist/coordination/failure-modes.d.ts.map +1 -0
  20. package/dist/coordination/failure-modes.js +49 -0
  21. package/dist/coordination/failure-modes.js.map +1 -0
  22. package/dist/coordination/peer-decisions.js +7 -7
  23. package/dist/coordination/routes.d.ts.map +1 -1
  24. package/dist/coordination/routes.js +44 -1
  25. package/dist/coordination/routes.js.map +1 -1
  26. package/dist/coordination/schema.d.ts.map +1 -1
  27. package/dist/coordination/schema.js +18 -0
  28. package/dist/coordination/schema.js.map +1 -1
  29. package/dist/coordination/schemas.d.ts +9 -9
  30. package/dist/coordination/stale.d.ts +9 -1
  31. package/dist/coordination/stale.d.ts.map +1 -1
  32. package/dist/coordination/stale.js +53 -9
  33. package/dist/coordination/stale.js.map +1 -1
  34. package/dist/core/embeddings.d.ts +16 -10
  35. package/dist/core/embeddings.d.ts.map +1 -1
  36. package/dist/core/embeddings.js +54 -38
  37. package/dist/core/embeddings.js.map +1 -1
  38. package/dist/core/ml-worker-entry.d.ts +17 -0
  39. package/dist/core/ml-worker-entry.d.ts.map +1 -0
  40. package/dist/core/ml-worker-entry.js +193 -0
  41. package/dist/core/ml-worker-entry.js.map +1 -0
  42. package/dist/core/ml-worker.d.ts +59 -0
  43. package/dist/core/ml-worker.d.ts.map +1 -0
  44. package/dist/core/ml-worker.js +253 -0
  45. package/dist/core/ml-worker.js.map +1 -0
  46. package/dist/core/query-expander.d.ts +13 -15
  47. package/dist/core/query-expander.d.ts.map +1 -1
  48. package/dist/core/query-expander.js +48 -54
  49. package/dist/core/query-expander.js.map +1 -1
  50. package/dist/core/reranker.d.ts +9 -19
  51. package/dist/core/reranker.d.ts.map +1 -1
  52. package/dist/core/reranker.js +33 -35
  53. package/dist/core/reranker.js.map +1 -1
  54. package/dist/core/salience.d.ts +32 -5
  55. package/dist/core/salience.d.ts.map +1 -1
  56. package/dist/core/salience.js +201 -28
  57. package/dist/core/salience.js.map +1 -1
  58. package/dist/core/write-pipeline.d.ts +10 -2
  59. package/dist/core/write-pipeline.d.ts.map +1 -1
  60. package/dist/core/write-pipeline.js +218 -49
  61. package/dist/core/write-pipeline.js.map +1 -1
  62. package/dist/engine/activation.d.ts +2 -2
  63. package/dist/engine/activation.d.ts.map +1 -1
  64. package/dist/engine/activation.js +238 -115
  65. package/dist/engine/activation.js.map +1 -1
  66. package/dist/engine/confidence.d.ts +62 -0
  67. package/dist/engine/confidence.d.ts.map +1 -0
  68. package/dist/engine/confidence.js +100 -0
  69. package/dist/engine/confidence.js.map +1 -0
  70. package/dist/engine/connections.d.ts +47 -8
  71. package/dist/engine/connections.d.ts.map +1 -1
  72. package/dist/engine/connections.js +83 -22
  73. package/dist/engine/connections.js.map +1 -1
  74. package/dist/engine/consolidation-scheduler.d.ts +46 -10
  75. package/dist/engine/consolidation-scheduler.d.ts.map +1 -1
  76. package/dist/engine/consolidation-scheduler.js +170 -50
  77. package/dist/engine/consolidation-scheduler.js.map +1 -1
  78. package/dist/engine/consolidation.d.ts +16 -2
  79. package/dist/engine/consolidation.d.ts.map +1 -1
  80. package/dist/engine/consolidation.js +143 -44
  81. package/dist/engine/consolidation.js.map +1 -1
  82. package/dist/engine/eval.d.ts +2 -2
  83. package/dist/engine/eval.d.ts.map +1 -1
  84. package/dist/engine/eval.js +9 -9
  85. package/dist/engine/eval.js.map +1 -1
  86. package/dist/engine/eviction.d.ts +4 -4
  87. package/dist/engine/eviction.d.ts.map +1 -1
  88. package/dist/engine/eviction.js +15 -15
  89. package/dist/engine/eviction.js.map +1 -1
  90. package/dist/engine/retraction.d.ts +93 -5
  91. package/dist/engine/retraction.d.ts.map +1 -1
  92. package/dist/engine/retraction.js +238 -19
  93. package/dist/engine/retraction.js.map +1 -1
  94. package/dist/engine/staging.d.ts +1 -1
  95. package/dist/engine/staging.d.ts.map +1 -1
  96. package/dist/engine/staging.js +3 -3
  97. package/dist/engine/staging.js.map +1 -1
  98. package/dist/hooks/sidecar.d.ts +1 -1
  99. package/dist/hooks/sidecar.d.ts.map +1 -1
  100. package/dist/hooks/sidecar.js +4 -4
  101. package/dist/hooks/sidecar.js.map +1 -1
  102. package/dist/index.js +48 -31
  103. package/dist/index.js.map +1 -1
  104. package/dist/mcp.js +167 -141
  105. package/dist/mcp.js.map +1 -1
  106. package/dist/storage/factory.d.ts +55 -0
  107. package/dist/storage/factory.d.ts.map +1 -0
  108. package/dist/storage/factory.js +135 -0
  109. package/dist/storage/factory.js.map +1 -0
  110. package/dist/storage/pglite-schema.d.ts +20 -0
  111. package/dist/storage/pglite-schema.d.ts.map +1 -0
  112. package/dist/storage/pglite-schema.js +165 -0
  113. package/dist/storage/pglite-schema.js.map +1 -0
  114. package/dist/storage/pglite.d.ts +187 -0
  115. package/dist/storage/pglite.d.ts.map +1 -0
  116. package/dist/storage/pglite.js +1114 -0
  117. package/dist/storage/pglite.js.map +1 -0
  118. package/dist/storage/sqlite.d.ts +117 -0
  119. package/dist/storage/sqlite.d.ts.map +1 -1
  120. package/dist/storage/sqlite.js +357 -8
  121. package/dist/storage/sqlite.js.map +1 -1
  122. package/dist/storage/store.d.ts +63 -0
  123. package/dist/storage/store.d.ts.map +1 -0
  124. package/dist/storage/store.js +27 -0
  125. package/dist/storage/store.js.map +1 -0
  126. package/dist/types/engram.d.ts +92 -2
  127. package/dist/types/engram.d.ts.map +1 -1
  128. package/dist/types/engram.js.map +1 -1
  129. package/package.json +3 -1
  130. package/src/adapters/claude-code.ts +218 -218
  131. package/src/adapters/codex.ts +252 -252
  132. package/src/adapters/common.ts +411 -411
  133. package/src/adapters/cursor.ts +135 -135
  134. package/src/adapters/http.ts +93 -93
  135. package/src/adapters/index.ts +31 -31
  136. package/src/adapters/types.ts +75 -75
  137. package/src/api/index.ts +3 -3
  138. package/src/api/routes.ts +970 -714
  139. package/src/cli/migrate.ts +307 -0
  140. package/src/cli.ts +755 -719
  141. package/src/coordination/circuit-breaker.ts +83 -0
  142. package/src/coordination/events.ts +90 -90
  143. package/src/coordination/failure-modes.ts +50 -0
  144. package/src/coordination/peer-decisions.ts +105 -105
  145. package/src/coordination/plugin-loader.ts +60 -60
  146. package/src/coordination/plugin.ts +44 -44
  147. package/src/coordination/routes.ts +56 -1
  148. package/src/coordination/schema.ts +13 -0
  149. package/src/coordination/stale.ts +80 -11
  150. package/src/coordination/types.ts +311 -311
  151. package/src/coordination/write-mutex.ts +69 -69
  152. package/src/core/auto-tagger.ts +168 -168
  153. package/src/core/decay.ts +63 -63
  154. package/src/core/embeddings.ts +110 -93
  155. package/src/core/index.ts +5 -5
  156. package/src/core/logger.ts +36 -36
  157. package/src/core/ml-worker-entry.ts +194 -0
  158. package/src/core/ml-worker.ts +281 -0
  159. package/src/core/query-expander.ts +122 -128
  160. package/src/core/reranker.ts +119 -125
  161. package/src/core/salience.ts +200 -33
  162. package/src/core/write-pipeline.ts +521 -343
  163. package/src/engine/activation.ts +235 -109
  164. package/src/engine/confidence.ts +120 -0
  165. package/src/engine/connections.ts +162 -103
  166. package/src/engine/consolidation-scheduler.ts +242 -125
  167. package/src/engine/consolidation.ts +138 -45
  168. package/src/engine/eval.ts +102 -102
  169. package/src/engine/eviction.ts +101 -101
  170. package/src/engine/index.ts +8 -8
  171. package/src/engine/retraction.ts +366 -116
  172. package/src/engine/staging.ts +74 -74
  173. package/src/hooks/sidecar.ts +5 -5
  174. package/src/index.ts +226 -212
  175. package/src/mcp.ts +1145 -1121
  176. package/src/storage/factory.ts +147 -0
  177. package/src/storage/index.ts +3 -3
  178. package/src/storage/pglite-schema.ts +166 -0
  179. package/src/storage/pglite.ts +1363 -0
  180. package/src/storage/sqlite.ts +402 -7
  181. package/src/storage/store.ts +80 -0
  182. package/src/types/agent.ts +67 -67
  183. package/src/types/checkpoint.ts +46 -46
  184. package/src/types/engram.ts +101 -3
  185. package/src/types/eval.ts +100 -100
  186. package/src/types/index.ts +6 -6
package/README.md CHANGED
@@ -86,18 +86,25 @@ The design is based on cognitive science — ACT-R activation decay, Hebbian lea
86
86
 
87
87
  ---
88
88
 
89
- ## Benchmarks (v0.6.0)
90
-
91
- ### Eval Harness (new in v0.6.0)
92
-
93
- | Suite | Score | Threshold | What it tests |
94
- |-------|-------|-----------|---------------|
95
- | Retrieval | **Recall@5 = 0.800** | >= 0.80 | 200 facts, 50 queries — BM25 + vector + reranker pipeline precision |
96
- | Associative | **success@10 = 1.000** | >= 0.70 | 20 multi-hop causal chains — graph walk finds non-obvious connections |
97
- | Redundancy | **dedup F1 = 0.966** | >= 0.80 | 50 clusters × 4 paraphrases — consolidation removes duplicates correctly |
98
- | Temporal | **Spearman = 0.932** | >= 0.75 | 25 facts with controlled age/access — ACT-R decay ranking accuracy |
99
-
100
- Key finding: **consolidation improves retrieval by 30%** — post-consolidation recall (0.950) exceeds pre-consolidation (0.650). Removing redundant noise helps ranking.
89
+ ## Benchmarks
90
+
91
+ ### Eval Harness
92
+
93
+ | Suite | Score (v0.8.5) | Score (v0.6.0 baseline) | Threshold | What it tests |
94
+ |-------|---|---|-----------|---------------|
95
+ | Retrieval | **Recall@5 = 0.980** | 0.800 | >= 0.80 | 200 facts, 50 queries — BM25 + vector + reranker pipeline precision |
96
+ | Associative | **success@10 = 1.000** | 1.000 | >= 0.70 | 20 multi-hop causal chains — graph walk finds non-obvious connections |
97
+ | Redundancy | **dedup F1 = 0.966** | 0.966 | >= 0.80 | 50 clusters × 4 paraphrases — consolidation removes duplicates correctly |
98
+ | Temporal | **Spearman = 0.932** | 0.932 | >= 0.75 | 25 facts with controlled age/access — ACT-R decay ranking accuracy |
99
+
100
+ > **v0.8.5 recall fix:** A regression intermediate-step had Recall@5 drop to
101
+ > 0.46. Root cause: the entity-bridge boost (Phase 3.7) inverted top-1 in
102
+ > dense same-concept corpora — it rewarded clones that shared tags with
103
+ > the anchor while excluding the anchor itself. Fix: proportional gating
104
+ > so the boost scales with the textMatch gap between candidate and anchor.
105
+ > Clones near the anchor get near-zero boost; genuine lateral candidates
106
+ > (low textMatch, shared entities) still get the full boost.
107
+ > Result: Recall@5 0.46 → 0.980 with all 4 eval suites green.
101
108
 
102
109
  ### Full Test Suite
103
110
 
@@ -113,6 +120,7 @@ Key finding: **consolidation improves retrieval by 30%** — post-consolidation
113
120
  | `npm run test:ab` | **AWM 20/22 vs Baseline 18/22** | AWM outperforms keyword baseline on architecture + testing topics |
114
121
  | `npm run test:sleep` | **71.4%** | 60 memories, 4 topic clusters, consolidation impact across 3 cycles |
115
122
  | `npm run test:tokens` | **56.3% savings, 2.3x efficiency** | Memory-guided context vs full history, keyword accuracy 72.5% |
123
+ | `scripts/measure-claude-vs-awm.ts` | **9.8× lower aggregate cost vs file_retrieval** | Real Claude Code session audit: AWM recall vs Read/Grep/Glob workflows |
116
124
  | `npm run test:pilot` | **14/15 pass** | Production-like queries with noise rejection (5/5 noise rejected) |
117
125
  | `npm run test:locomo` | **28.2%** | Industry-standard LoCoMo conversational memory benchmark (1,986 QA pairs) |
118
126
 
@@ -277,6 +285,46 @@ curl -X POST http://localhost:8400/memory/activate \
277
285
  }'
278
286
  ```
279
287
 
288
+ ### Substrate primitives (new in 0.8)
289
+
290
+ For long-running structured projects — novels, codebases, investigations,
291
+ design docs — where the agent needs to track typed state across hundreds
292
+ of writes without polluting cognitive retrieval. Full reference at
293
+ [`docs/reference.md`](docs/reference.md).
294
+
295
+ ```bash
296
+ # "Latest emotional state per character" — one round trip
297
+ curl -X POST http://localhost:8400/memory/latest-by-tag -d '{
298
+ "agentId": "novel-x", "tagKey": "character=",
299
+ "scopeTagsAll": ["topic=emotional-state"], "sortBy": "sequence"
300
+ }'
301
+
302
+ # "Top 40 active promises by weight, excluding resolved" — filter + sort native
303
+ curl -X POST http://localhost:8400/memory/top-by -d '{
304
+ "agentId": "novel-x", "sortField": "weight=", "order": "desc",
305
+ "filterTagsAll": ["topic=promise", "state=active"],
306
+ "filterTagsNone": ["kind=advancement"], "limit": 40
307
+ }'
308
+
309
+ # Atomic write-and-supersede by concept match (Form B)
310
+ curl -X POST http://localhost:8400/memory/supersede -d '{
311
+ "agentId": "novel-x",
312
+ "matchConcept": "Mara's deferred disclosure",
313
+ "newEngram": {
314
+ "concept": "Mara's disclosure — RESOLVED in Ch 3",
315
+ "content": "...", "memory_class": "structural"
316
+ }
317
+ }'
318
+
319
+ # Race-free chronology
320
+ curl http://localhost:8400/memory/sequence/novel-x/next
321
+ ```
322
+
323
+ New `memory_class: "structural"` keeps high-volume system-written records
324
+ (chapter analyses, promise advancements, commit logs) out of cognitive
325
+ `/activate` while preserving them with canonical-level salience. See the
326
+ [CHANGELOG entry for 0.8.0](CHANGELOG.md) for the full design.
327
+
280
328
  ---
281
329
 
282
330
  ## How It Works
@@ -395,6 +443,18 @@ npm run test:locomo # LoCoMo industry benchmark (28.2%)
395
443
  | `AWM_DISABLE_RERANK_SKIP` | *(unset)* | Set to `1` to disable the reranker skip on clear-winner queries (0.7.10+). Forces every recall through the cross-encoder |
396
444
  | `AWM_DISABLE_EXPANSION_CACHE` | *(unset)* | Set to `1` to disable the query expansion skip heuristic + LRU cache (0.7.11+). Forces every recall through the flan-t5-small expander |
397
445
  | `AWM_WORKSPACE` | *(unset)* | Default workspace for cross-agent recall in hive setups |
446
+ | `AWM_STORE_BACKEND` | `sqlite` | `sqlite` (better-sqlite3 + FTS5) or `pglite` (PGlite + pgvector + pgroonga). 0.8.x. |
447
+ | `AWM_DB_PATH` | `memory.db` (SQLite) / `./memory-pglite` (PGlite) | Storage path. Directory for PGlite, file for SQLite. |
448
+ | `AWM_CONF_SHARPNESS_W` | `0.4` | Weight of `top1 / mean(top5)` in recall confidence (PR-1, v0.8.5) |
449
+ | `AWM_CONF_CLIFF_W` | `0.3` | Weight of `(top1 - top10) / top1` in recall confidence (PR-1, v0.8.5) |
450
+ | `AWM_CONF_FLOOR_W` | `0.3` | Weight of `top1` absolute score in recall confidence (PR-1, v0.8.5) |
451
+ | `AWM_FADE_DAYS_SINCE_ACCESS` | `45` | Days without access before a stale active engram fades (v0.8.5) |
452
+ | `AWM_FADE_KEEP_CHARS` | `150` | Chars retained in faded engram content (v0.8.5) |
453
+ | `AWM_FADE_MIN_CONTENT_LEN` | `250` | Don't fade engrams shorter than this — nothing to trim (v0.8.5) |
454
+ | `AWM_FADE_MAX_PER_CYCLE` | `25` | Max engrams faded per consolidation cycle — gradual, not sudden (v0.8.5) |
455
+ | `AWM_GRANULARITY_COMPACT_LEN` | `200` | Char cap for `granularity: 'compact'` summaries (v0.8.5) |
456
+ | `AWM_GRANULARITY_FULL_LEN` | `1000` | Char cap for top result under `granularity: 'auto'` when confidence ≥ threshold (v0.8.5) |
457
+ | `AWM_GRANULARITY_AUTO_THRESHOLD` | `0.4` | Recall-confidence threshold above which `'auto'` granularity gives the top result a long-form summary (v0.8.5) |
398
458
 
399
459
  ## Tech Stack
400
460
 
@@ -413,6 +473,81 @@ npm run test:locomo # LoCoMo industry benchmark (28.2%)
413
473
 
414
474
  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.
415
475
 
476
+ ## What's New in v0.8.5
477
+
478
+ A research-grounded hardening pass on recall quality, retraction propagation,
479
+ and lifecycle management. Every change is **fully additive** — existing
480
+ callers keep working without modification. Full validation at the milestone:
481
+ `vitest run` 549/549 pass; `test:self` 97.6% EXCELLENT (was 91.4% on 0.8.0);
482
+ `test:ab` AWM 89.3% vs Baseline 83.0% (+6.4 points); `test:perf` 4/4 PASS.
483
+
484
+ - **Recall confidence as data (PR-1).** Every `ActivationResult` now carries
485
+ a `confidence` field in [0, 1] — a score-distribution-aware signal
486
+ (sharpness + cliff + floor blended via weighted geometric mean) that tells
487
+ the caller how trustworthy the recall set is. Same value on every result
488
+ in a recall — it describes the *set*, not the individual. Research grounding:
489
+ Geifman & El-Yaniv (NeurIPS 2017), Roitero et al (SIGIR 2022). Default
490
+ behavior unchanged; this is data, not a gate.
491
+
492
+ - **Opt-in confidence-based abstention (PR-2).** Callers can pass
493
+ `requireConfidence` (typical values: 0.10 strict, 0.25 balanced, 0.40
494
+ aggressive). When set, the engine returns `[]` on recalls whose
495
+ distribution shape falls below the threshold — defeats the
496
+ "best-of-bad-bunch" leak where a noisy recall returns a weak top result
497
+ that the agent then trusts.
498
+
499
+ - **Coherence-weighted retraction (#18).** Retraction penalty propagation
500
+ is no longer uniform. Multiplier scales with local neighborhood cohesion:
501
+ dense topically-coherent clusters (a narrative) get heavier penalties when
502
+ the seed is wrong; hub structures (popular node with heterogeneous edges)
503
+ get lighter penalties. Implements Carrillo et al, "Continued Influence
504
+ Effect" (ICCM 2025).
505
+
506
+ - **Counter-narrative replacement on supersede/correction (#19).** When
507
+ retraction creates a counter-content correction, the new engram inherits
508
+ the original's `'connection'` edges (scaled 0.7×, capped at 10
509
+ inheritances, with `invalidation` / `causal` / `temporal` skipped). The
510
+ corrected fact takes over the graph role of the wrong fact rather than
511
+ leaving the corrected fact disconnected.
512
+
513
+ - **Content fade stage (#20) — Paper 1.** New intermediate `'fading'`
514
+ lifecycle stage between `'active'` and `'archived'`. Engrams accessed
515
+ before but stale (no access in 45+ days, content > 250 chars) get content
516
+ trimmed to 150 chars + `… [faded]` marker. Concept, tags, and embedding
517
+ preserved — the engram still participates in BM25 + vector recall, just
518
+ with less body to score against. Models human memory's loss of surface
519
+ detail while retaining cue-association pathways (PLOS Comp Biology on
520
+ storage degradation). Heavily-used (`accessCount >= 10`), `canonical`,
521
+ `structural`, and retracted engrams excluded.
522
+
523
+ - **Adaptive output granularity (#21) — Paper 3.** New
524
+ `granularity: 'full' | 'compact' | 'auto'` on `ActivationQuery`.
525
+ `'compact'` attaches a 200-char `summary` to every result. `'auto'` is
526
+ confidence-adaptive: when recall confidence ≥ 0.4, the top result gets
527
+ a long-form summary and the rest are compact; when confidence is low,
528
+ everything is compact so the agent can scan a diverse set without
529
+ drowning in content. Engram body never modified — just the response shape.
530
+ Models cognitive teaming (Brill 2018 ACT-R collaboration).
531
+
532
+ ## What's New in v0.8.1
533
+
534
+ - **Coordination control layer** — `FailureMode` classifier + mutation-hint
535
+ retry on `cleanupStale`, per-worker `CircuitBreaker`, and voluntary
536
+ `POST /assignment/:id/fail` endpoint. Designed to reduce the 11.5%
537
+ failure-with-no-retry rate observed in production hive runs (81/703).
538
+ Two new schema columns on `coord_assignments` plus a `coord_circuit_state`
539
+ table — both additive `CREATE IF NOT EXISTS` migrations.
540
+
541
+ ## What's New in v0.8.0
542
+
543
+ - **Substrate primitives for long-running structured projects** — four new
544
+ HTTP endpoints (`/memory/latest-by-tag`, `/memory/top-by`,
545
+ `/memory/resolve`, `/memory/supersede` Form B), three query operators
546
+ (`tagsAll`, `tagsAny`, `tagsNone`), and a fourth `memory_class` value
547
+ (`structural`). Optional engram columns `sequence` + `references_json`
548
+ enable race-free chronology and typed cross-record links. Designed against
549
+ the NovelForge 36,000-word "Drawdown" test bed.
550
+
416
551
  ## What's New in v0.7.16
417
552
 
418
553
  - **`awm setup --global` template now teaches *write quality*.** Two new sections in `AWM_INSTRUCTION_CONTENT`:
@@ -524,15 +659,21 @@ See [CHANGELOG.md](CHANGELOG.md) for full details.
524
659
 
525
660
  ## Project Status
526
661
 
527
- AWM is in active development (v0.7.15). The core memory pipeline, consolidation system, multi-agent coordination, and MCP integration are stable and used daily in production coding workflows.
662
+ AWM is in active development (v0.8.5). The core memory pipeline, consolidation
663
+ system, multi-agent coordination, and MCP integration are stable and used
664
+ daily in production coding workflows.
528
665
 
529
666
  - Core retrieval and consolidation: **stable**
530
667
  - MCP tools and Claude Code integration: **stable**
531
- - Multi-agent coordination: **stable** (v0.6.0)
668
+ - Multi-agent coordination: **stable** (v0.8.1 hardening)
532
669
  - Task management: **stable**
533
670
  - Hook sidecar and auto-checkpoint: **stable**
534
671
  - HTTP API: **stable** (for custom agents)
535
- - Eval harness: **stable** (v0.6.0)
672
+ - Eval harness: **stable** (v0.6.0, extended through 0.8.x)
673
+ - Recall confidence + opt-in abstention (PR-1, PR-2): **stable** (v0.8.5)
674
+ - Coherence-weighted retraction + counter-narrative inheritance: **stable** (v0.8.5)
675
+ - Content fade stage + adaptive output granularity: **stable** (v0.8.5)
676
+ - PGlite backend (alternative to SQLite, with pgvector + ivfflat): **stable** (v0.8.x)
536
677
 
537
678
  See [CHANGELOG.md](CHANGELOG.md) for version history.
538
679
 
@@ -164,207 +164,207 @@ export function upsertAwmSection(filePath, newContent, options = {}) {
164
164
  writeFileSync(filePath, rebuilt);
165
165
  return `${fname}: AWM section updated (preserved surrounding content)`;
166
166
  }
167
- export const AWM_INSTRUCTION_CONTENT = `
168
- ## Memory (AWM) — MANDATORY
169
-
170
- **AWM is THE memory system.** Use it via the \`agent-working-memory\` MCP server
171
- (preferred) or HTTP at \`http://127.0.0.1:8400\` (fallback). The file-based
172
- auto-memory at \`~/.claude/projects/.../memory/*.md\` is a LEGACY bootstrap path —
173
- **do not write new memories to it.** All persistent knowledge goes through AWM.
174
-
175
- If MCP tools aren't loaded at session start, use ToolSearch with
176
- \`select:mcp__agent-working-memory__memory_recall,mcp__agent-working-memory__memory_write\`
177
- to load them. If the MCP server isn't responsive, restart with \`/mcp\` or use
178
- the HTTP endpoints (\`POST /memory/write-batch\`, \`POST /memory/activate\`)
179
- directly — but **DO NOT fall back to markdown files**. Files drift the moment
180
- you write them; AWM stays current because every agent reads + writes the same store.
181
-
182
- ### Lifecycle (always do these, in this order)
183
- 1. **Session start**: call \`memory_restore\` to recover previous context.
184
- 2. **Starting a task**: call \`memory_task_begin\` (checkpoints + recalls relevant memories).
185
- 3. **During work**: call \`memory_recall\` BEFORE stating any fact, BEFORE searching
186
- the filesystem, BEFORE making architectural decisions. Recall is ~300ms — cheaper
187
- than one filesystem search.
188
- 4. **As you learn things**: call \`memory_write\` proactively. Don't batch.
189
- 5. **Finishing a task**: call \`memory_task_end\` with a summary.
190
- 6. **Auto-checkpoint** is handled by hooks (compaction, session-end, 15-min timer). No action needed.
191
-
192
- ### Write memory when:
193
- - A project decision is made or changed
194
- - A root cause is discovered after debugging
195
- - A reusable implementation pattern is established
196
- - A user preference, constraint, or requirement is clarified
197
- - A prior assumption is found to be wrong
198
- - A significant piece of work is completed
199
-
200
- ### Writing for recall (the highest-leverage section)
201
- A memory's recall quality is set the moment you write it. AWM is fast at
202
- finding what's findable — but if the write is shaped wrong, no retriever
203
- can rescue it. Be slightly more verbose at the front than feels natural:
204
- the first 1-2 sentences are what BM25, the embedding model, and concept
205
- extraction all see most strongly.
206
-
207
- - **Lead with the rule or fact.** Don't open with context or backstory.
208
- "Don't mock the database in integration tests." comes first; the reason
209
- comes second. Recall scans the head of the body, not the tail.
210
- - **Pick the most specific topic.** Not \`auth\` — \`auth-magic-link-rate-limit\`.
211
- Topic is a hard filter at recall time. Generic topics hide the memory in
212
- a noisy bucket where it competes with everything else in the area.
213
- - **Include 2+ retrievable identifiers.** File paths, function names, table
214
- columns, ticket IDs, exact error strings, the literal terms a future query
215
- will use. \`AccountingService.closePeriod()\` beats "the accounting code."
216
- \`tblMemberDetails.activation_date\` beats "the activation column."
217
- \`schema/072-period-close.sql\` beats "the migration."
218
- - **Write in the vocabulary of the future question.** When you imagine asking
219
- this in three months, what nouns will you use? Use those nouns. Don't
220
- paraphrase the user's domain language into your own neutral summary.
221
- - **Reserve canonical for stable invariants.** Decisions, requirements,
222
- hard facts, cross-agent shared context. Working class (default) is correct
223
- for findings, observations, and progress notes. The canonical floor is
224
- 0.7 salience — overusing it pollutes the canonical layer and the floor
225
- loses meaning.
226
- - **Include the why for feedback memories.** A rule without a reason can't
227
- be applied to edge cases. "Don't mock the database" is brittle. "Don't
228
- mock the database — last quarter mocked tests masked a broken migration"
229
- is portable to new situations.
230
-
231
- ### Tagging rules (REQUIRED — AWM's prefix-tag retrieval boost depends on these)
232
-
233
- Every \`memory_write\` should pass these structured fields. AWM stores each as a
234
- prefix-tag like \`proj=\`, \`topic=\`, \`intent=\`, etc. and uses them for BM25
235
- and entity-bridge boosts at recall time.
236
-
237
- | Field | Required? | Format | Example |
238
- |---|---|---|---|
239
- | \`project\` | **YES** | one short word matching the current project | \`"EquiHub"\`, \`"AWM"\`, \`"USEA-Agent"\` |
240
- | \`topic\` | **YES** | one or more lowercase area words | \`"database-migration"\`, \`"benchmarks"\` |
241
- | \`intent\` | **YES** | one of: \`decision\` / \`finding\` / \`todo\` / \`question\` / \`context\` | \`"finding"\` |
242
- | \`confidence_level\` | **YES** | \`verified\` (tested) / \`observed\` (read in code) / \`assumed\` (reasoning) | \`"verified"\` |
243
- | \`source\` | recommended | \`code-reading\` / \`debugging\` / \`discussion\` / \`research\` / \`testing\` / \`observation\` | \`"testing"\` |
244
- | \`memory_class\` | when stable | \`canonical\` (source-of-truth, 0.7 floor, never staged) / \`working\` (default) / \`ephemeral\` | \`"canonical"\` |
245
- | \`session_id\` | recommended | current conversation ID for entity-bridge boost | autogenerated |
246
- | \`tags\` | when applicable | extra prefix-tags for IDs and dates | \`["ticket=18360", "date=2026-05-11"]\` |
247
-
248
- **Always add identifier tags when present in the content:**
249
- - \`ticket=<id>\` for Freshdesk tickets
250
- - \`member=<id>\` for member IDs
251
- - \`horse=<id>\` for horse_member_id
252
- - \`usef=<id>\` for USEF lookups
253
- - \`date=YYYY-MM-DD\` for temporal anchoring (ISO format)
254
- - \`person=<Name>\` for stakeholder quotes / decisions
255
- - \`version=<X.Y.Z>\` for release-specific findings
256
-
257
- ### Memory classes (controls how strictly the salience filter gates the write)
258
- - \`memory_class: canonical\` — source-of-truth memories. Floor 0.7 salience, never staged.
259
- Use for: user-stated decisions, project requirements, verified architectural facts,
260
- cross-agent shared context. **In a hive (multi-agent) setup, always use \`canonical\`
261
- for writes that other agents must be able to recall** — the default \`working\` class
262
- may get filtered.
263
- - \`memory_class: working\` (default) — observations and findings. Salience-gated.
264
- - \`memory_class: ephemeral\` — short-lived context that should decay quickly.
265
-
266
- ### Salience auto-promotion (defense in depth)
267
- The salience filter automatically promotes certain content patterns even if you forget
268
- to set \`memory_class\` explicitly:
269
- - **User feedback** — content starting with "Robert said…", "Katherine directed…",
270
- "Nancy decided…" etc. auto-promotes to canonical. So quoting the user verbatim
271
- always preserves the decision.
272
- - **Verified operational records** — content with an action verb (Submitted, Finalized,
273
- Completed, Reconciled, Triaged, Posted, Resolved, Stamped, Pushed, Deployed, Migrated,
274
- Imported, Exported, Backfilled) plus 2+ concrete identifiers (ISO date \`YYYY-MM-DD\`,
275
- or contextual numeric IDs like "event 18969", "ticket #18330", "USEF 341980") gets
276
- a 0.45 salience floor. So batch summaries with real IDs survive even when topic
277
- terms repeat.
278
-
279
- If neither pattern applies and you want a memory to definitely survive, set
280
- \`memory_class: canonical\` explicitly. Don't rely on auto-promotion for important writes.
281
-
282
- ### Recall memory when:
283
- - **BEFORE stating ANY fact about how a system works** — recall first; if AWM doesn't
284
- have it, read the code. Never guess and present it as fact.
285
- - **BEFORE searching the filesystem** — recall first; AWM is faster and has cross-session
286
- knowledge that file search doesn't.
287
- - Starting work on a new task or subsystem
288
- - Re-entering code you haven't touched recently
289
- - After a failed attempt — check if there's prior knowledge
290
- - Before refactoring or making architectural changes
291
- - When a topic comes up that you might have prior context on
292
-
293
- Recall is fast (~300ms typical). Use it freely.
294
-
295
- ### Recall strategy (when one query isn't enough)
296
- AWM's adaptive retrieval handles most query variations natively — synonym
297
- expansion, multi-channel scoring, embedding + BM25 + reranker agreement.
298
- A single recall is usually enough.
299
-
300
- When it isn't:
301
- - **If the first recall returns nothing or returns the wrong things, reformulate.**
302
- Try a second query with different phrasing — synonyms, more specific nouns,
303
- the exact identifier from the code rather than the conceptual name. Two or
304
- three recalls cost less than one filesystem search.
305
- - **Use the words a domain expert would use, not generic English.** "Period
306
- close lock" not "accounting feature"; "magic link rate limit" not "auth issue."
307
- - **For broad exploration, pass \`mode: "exploratory"\`** — wider candidate
308
- pool, lower precision floor. For specific lookups, leave mode unset (auto).
309
- - **Don't ensemble more than 3 reformulations.** If three different phrasings
310
- return nothing, the memory probably isn't there — read the code instead of
311
- burning more recalls.
312
-
313
- ### Keep memory fresh
314
- - After recalling a memory, if you observe the real state is different → call
315
- \`memory_supersede\` immediately with the corrected version.
316
- - After using a recalled memory: call \`memory_feedback\` (useful/not-useful) so the
317
- activation engine learns what's valuable.
318
- - If you discover a memory is factually wrong: \`memory_retract\` to remove it.
319
- - **If you bypass AWM (file-memory, in-context notes, "I'll just remember"), the memory
320
- drifts out of date. The system relies on you to keep it current. This is the #1
321
- failure mode.**
322
-
323
- ### Example — good vs bad memory_write
324
-
325
- **BAD** (no prefix tags, vague concept, can't be recalled by future queries):
326
- \`\`\`
327
- memory_write(
328
- concept="found a bug",
329
- content="The thing I was looking at was broken so I fixed it."
330
- )
331
- \`\`\`
332
-
333
- **GOOD** (rich identifiers, structured metadata, prefix tags):
334
- \`\`\`
335
- memory_write(
336
- concept="EquiHub period-close BLOCKED check missing server-side",
337
- content="apps/web/app/(accounting)/accounting/period-close/page.tsx had client-only BLOCKED enforcement. Fixed by adding server-side check in AccountingService.closePeriod() per schema/072-period-close.sql. Without server-side check a malicious request could bypass via direct API call.",
338
- project="EquiHub",
339
- topic="accounting",
340
- intent="finding",
341
- confidence_level="verified",
342
- source="debugging",
343
- memory_class="canonical",
344
- tags=["ticket=18360", "person=Robert", "date=2026-05-11", "topic=period-close", "topic=security"]
345
- )
346
- \`\`\`
347
-
348
- ### Also:
349
- - To track work items: memory_task_add, memory_task_update, memory_task_list, memory_task_next
350
- - AWM is shared across all agents in real time. When any agent writes or supersedes a
351
- memory, every other agent can recall it immediately.
352
-
353
- ### Diagnostics / escape hatches (env vars, only if you know why)
354
- The 0.7.6→0.7.14 work cut recall latency from 11s to ~300ms. Each optimization
355
- is gated by an env-var so it can be disabled for A/B testing if a regression
356
- appears in your workload:
357
-
358
- - \`AWM_DISABLE_POOL_FILTER=1\` (0.7.7+) — disables the candidate pool reduction
359
- pre-filter in recall. Reverts to scoring all active candidates.
360
- - \`AWM_DISABLE_SLIM_CACHE=1\` (0.7.10+) — disables the in-memory slim cache.
361
- Reverts to per-recall SQL fetch + Buffer→Float32Array conversion.
362
- - \`AWM_DISABLE_RERANK_SKIP=1\` (0.7.10+) — disables the cross-encoder skip on
363
- clear-winner queries. Forces every recall through the reranker.
364
- - \`AWM_DISABLE_EXPANSION_CACHE=1\` (0.7.11+) — disables the query expansion
365
- skip heuristic + LRU cache. Forces every recall through flan-t5-small.
366
-
367
- In production, leave these all unset. Use only when diagnosing a suspected
368
- recall-quality regression.
167
+ export const AWM_INSTRUCTION_CONTENT = `
168
+ ## Memory (AWM) — MANDATORY
169
+
170
+ **AWM is THE memory system.** Use it via the \`agent-working-memory\` MCP server
171
+ (preferred) or HTTP at \`http://127.0.0.1:8400\` (fallback). The file-based
172
+ auto-memory at \`~/.claude/projects/.../memory/*.md\` is a LEGACY bootstrap path —
173
+ **do not write new memories to it.** All persistent knowledge goes through AWM.
174
+
175
+ If MCP tools aren't loaded at session start, use ToolSearch with
176
+ \`select:mcp__agent-working-memory__memory_recall,mcp__agent-working-memory__memory_write\`
177
+ to load them. If the MCP server isn't responsive, restart with \`/mcp\` or use
178
+ the HTTP endpoints (\`POST /memory/write-batch\`, \`POST /memory/activate\`)
179
+ directly — but **DO NOT fall back to markdown files**. Files drift the moment
180
+ you write them; AWM stays current because every agent reads + writes the same store.
181
+
182
+ ### Lifecycle (always do these, in this order)
183
+ 1. **Session start**: call \`memory_restore\` to recover previous context.
184
+ 2. **Starting a task**: call \`memory_task_begin\` (checkpoints + recalls relevant memories).
185
+ 3. **During work**: call \`memory_recall\` BEFORE stating any fact, BEFORE searching
186
+ the filesystem, BEFORE making architectural decisions. Recall is ~300ms — cheaper
187
+ than one filesystem search.
188
+ 4. **As you learn things**: call \`memory_write\` proactively. Don't batch.
189
+ 5. **Finishing a task**: call \`memory_task_end\` with a summary.
190
+ 6. **Auto-checkpoint** is handled by hooks (compaction, session-end, 15-min timer). No action needed.
191
+
192
+ ### Write memory when:
193
+ - A project decision is made or changed
194
+ - A root cause is discovered after debugging
195
+ - A reusable implementation pattern is established
196
+ - A user preference, constraint, or requirement is clarified
197
+ - A prior assumption is found to be wrong
198
+ - A significant piece of work is completed
199
+
200
+ ### Writing for recall (the highest-leverage section)
201
+ A memory's recall quality is set the moment you write it. AWM is fast at
202
+ finding what's findable — but if the write is shaped wrong, no retriever
203
+ can rescue it. Be slightly more verbose at the front than feels natural:
204
+ the first 1-2 sentences are what BM25, the embedding model, and concept
205
+ extraction all see most strongly.
206
+
207
+ - **Lead with the rule or fact.** Don't open with context or backstory.
208
+ "Don't mock the database in integration tests." comes first; the reason
209
+ comes second. Recall scans the head of the body, not the tail.
210
+ - **Pick the most specific topic.** Not \`auth\` — \`auth-magic-link-rate-limit\`.
211
+ Topic is a hard filter at recall time. Generic topics hide the memory in
212
+ a noisy bucket where it competes with everything else in the area.
213
+ - **Include 2+ retrievable identifiers.** File paths, function names, table
214
+ columns, ticket IDs, exact error strings, the literal terms a future query
215
+ will use. \`AccountingService.closePeriod()\` beats "the accounting code."
216
+ \`tblMemberDetails.activation_date\` beats "the activation column."
217
+ \`schema/072-period-close.sql\` beats "the migration."
218
+ - **Write in the vocabulary of the future question.** When you imagine asking
219
+ this in three months, what nouns will you use? Use those nouns. Don't
220
+ paraphrase the user's domain language into your own neutral summary.
221
+ - **Reserve canonical for stable invariants.** Decisions, requirements,
222
+ hard facts, cross-agent shared context. Working class (default) is correct
223
+ for findings, observations, and progress notes. The canonical floor is
224
+ 0.7 salience — overusing it pollutes the canonical layer and the floor
225
+ loses meaning.
226
+ - **Include the why for feedback memories.** A rule without a reason can't
227
+ be applied to edge cases. "Don't mock the database" is brittle. "Don't
228
+ mock the database — last quarter mocked tests masked a broken migration"
229
+ is portable to new situations.
230
+
231
+ ### Tagging rules (REQUIRED — AWM's prefix-tag retrieval boost depends on these)
232
+
233
+ Every \`memory_write\` should pass these structured fields. AWM stores each as a
234
+ prefix-tag like \`proj=\`, \`topic=\`, \`intent=\`, etc. and uses them for BM25
235
+ and entity-bridge boosts at recall time.
236
+
237
+ | Field | Required? | Format | Example |
238
+ |---|---|---|---|
239
+ | \`project\` | **YES** | one short word matching the current project | \`"EquiHub"\`, \`"AWM"\`, \`"USEA-Agent"\` |
240
+ | \`topic\` | **YES** | one or more lowercase area words | \`"database-migration"\`, \`"benchmarks"\` |
241
+ | \`intent\` | **YES** | one of: \`decision\` / \`finding\` / \`todo\` / \`question\` / \`context\` | \`"finding"\` |
242
+ | \`confidence_level\` | **YES** | \`verified\` (tested) / \`observed\` (read in code) / \`assumed\` (reasoning) | \`"verified"\` |
243
+ | \`source\` | recommended | \`code-reading\` / \`debugging\` / \`discussion\` / \`research\` / \`testing\` / \`observation\` | \`"testing"\` |
244
+ | \`memory_class\` | when stable | \`canonical\` (source-of-truth, 0.7 floor, never staged) / \`working\` (default) / \`ephemeral\` | \`"canonical"\` |
245
+ | \`session_id\` | recommended | current conversation ID for entity-bridge boost | autogenerated |
246
+ | \`tags\` | when applicable | extra prefix-tags for IDs and dates | \`["ticket=18360", "date=2026-05-11"]\` |
247
+
248
+ **Always add identifier tags when present in the content:**
249
+ - \`ticket=<id>\` for Freshdesk tickets
250
+ - \`member=<id>\` for member IDs
251
+ - \`horse=<id>\` for horse_member_id
252
+ - \`usef=<id>\` for USEF lookups
253
+ - \`date=YYYY-MM-DD\` for temporal anchoring (ISO format)
254
+ - \`person=<Name>\` for stakeholder quotes / decisions
255
+ - \`version=<X.Y.Z>\` for release-specific findings
256
+
257
+ ### Memory classes (controls how strictly the salience filter gates the write)
258
+ - \`memory_class: canonical\` — source-of-truth memories. Floor 0.7 salience, never staged.
259
+ Use for: user-stated decisions, project requirements, verified architectural facts,
260
+ cross-agent shared context. **In a hive (multi-agent) setup, always use \`canonical\`
261
+ for writes that other agents must be able to recall** — the default \`working\` class
262
+ may get filtered.
263
+ - \`memory_class: working\` (default) — observations and findings. Salience-gated.
264
+ - \`memory_class: ephemeral\` — short-lived context that should decay quickly.
265
+
266
+ ### Salience auto-promotion (defense in depth)
267
+ The salience filter automatically promotes certain content patterns even if you forget
268
+ to set \`memory_class\` explicitly:
269
+ - **User feedback** — content starting with "Robert said…", "Katherine directed…",
270
+ "Nancy decided…" etc. auto-promotes to canonical. So quoting the user verbatim
271
+ always preserves the decision.
272
+ - **Verified operational records** — content with an action verb (Submitted, Finalized,
273
+ Completed, Reconciled, Triaged, Posted, Resolved, Stamped, Pushed, Deployed, Migrated,
274
+ Imported, Exported, Backfilled) plus 2+ concrete identifiers (ISO date \`YYYY-MM-DD\`,
275
+ or contextual numeric IDs like "event 18969", "ticket #18330", "USEF 341980") gets
276
+ a 0.45 salience floor. So batch summaries with real IDs survive even when topic
277
+ terms repeat.
278
+
279
+ If neither pattern applies and you want a memory to definitely survive, set
280
+ \`memory_class: canonical\` explicitly. Don't rely on auto-promotion for important writes.
281
+
282
+ ### Recall memory when:
283
+ - **BEFORE stating ANY fact about how a system works** — recall first; if AWM doesn't
284
+ have it, read the code. Never guess and present it as fact.
285
+ - **BEFORE searching the filesystem** — recall first; AWM is faster and has cross-session
286
+ knowledge that file search doesn't.
287
+ - Starting work on a new task or subsystem
288
+ - Re-entering code you haven't touched recently
289
+ - After a failed attempt — check if there's prior knowledge
290
+ - Before refactoring or making architectural changes
291
+ - When a topic comes up that you might have prior context on
292
+
293
+ Recall is fast (~300ms typical). Use it freely.
294
+
295
+ ### Recall strategy (when one query isn't enough)
296
+ AWM's adaptive retrieval handles most query variations natively — synonym
297
+ expansion, multi-channel scoring, embedding + BM25 + reranker agreement.
298
+ A single recall is usually enough.
299
+
300
+ When it isn't:
301
+ - **If the first recall returns nothing or returns the wrong things, reformulate.**
302
+ Try a second query with different phrasing — synonyms, more specific nouns,
303
+ the exact identifier from the code rather than the conceptual name. Two or
304
+ three recalls cost less than one filesystem search.
305
+ - **Use the words a domain expert would use, not generic English.** "Period
306
+ close lock" not "accounting feature"; "magic link rate limit" not "auth issue."
307
+ - **For broad exploration, pass \`mode: "exploratory"\`** — wider candidate
308
+ pool, lower precision floor. For specific lookups, leave mode unset (auto).
309
+ - **Don't ensemble more than 3 reformulations.** If three different phrasings
310
+ return nothing, the memory probably isn't there — read the code instead of
311
+ burning more recalls.
312
+
313
+ ### Keep memory fresh
314
+ - After recalling a memory, if you observe the real state is different → call
315
+ \`memory_supersede\` immediately with the corrected version.
316
+ - After using a recalled memory: call \`memory_feedback\` (useful/not-useful) so the
317
+ activation engine learns what's valuable.
318
+ - If you discover a memory is factually wrong: \`memory_retract\` to remove it.
319
+ - **If you bypass AWM (file-memory, in-context notes, "I'll just remember"), the memory
320
+ drifts out of date. The system relies on you to keep it current. This is the #1
321
+ failure mode.**
322
+
323
+ ### Example — good vs bad memory_write
324
+
325
+ **BAD** (no prefix tags, vague concept, can't be recalled by future queries):
326
+ \`\`\`
327
+ memory_write(
328
+ concept="found a bug",
329
+ content="The thing I was looking at was broken so I fixed it."
330
+ )
331
+ \`\`\`
332
+
333
+ **GOOD** (rich identifiers, structured metadata, prefix tags):
334
+ \`\`\`
335
+ memory_write(
336
+ concept="EquiHub period-close BLOCKED check missing server-side",
337
+ content="apps/web/app/(accounting)/accounting/period-close/page.tsx had client-only BLOCKED enforcement. Fixed by adding server-side check in AccountingService.closePeriod() per schema/072-period-close.sql. Without server-side check a malicious request could bypass via direct API call.",
338
+ project="EquiHub",
339
+ topic="accounting",
340
+ intent="finding",
341
+ confidence_level="verified",
342
+ source="debugging",
343
+ memory_class="canonical",
344
+ tags=["ticket=18360", "person=Robert", "date=2026-05-11", "topic=period-close", "topic=security"]
345
+ )
346
+ \`\`\`
347
+
348
+ ### Also:
349
+ - To track work items: memory_task_add, memory_task_update, memory_task_list, memory_task_next
350
+ - AWM is shared across all agents in real time. When any agent writes or supersedes a
351
+ memory, every other agent can recall it immediately.
352
+
353
+ ### Diagnostics / escape hatches (env vars, only if you know why)
354
+ The 0.7.6→0.7.14 work cut recall latency from 11s to ~300ms. Each optimization
355
+ is gated by an env-var so it can be disabled for A/B testing if a regression
356
+ appears in your workload:
357
+
358
+ - \`AWM_DISABLE_POOL_FILTER=1\` (0.7.7+) — disables the candidate pool reduction
359
+ pre-filter in recall. Reverts to scoring all active candidates.
360
+ - \`AWM_DISABLE_SLIM_CACHE=1\` (0.7.10+) — disables the in-memory slim cache.
361
+ Reverts to per-recall SQL fetch + Buffer→Float32Array conversion.
362
+ - \`AWM_DISABLE_RERANK_SKIP=1\` (0.7.10+) — disables the cross-encoder skip on
363
+ clear-winner queries. Forces every recall through the reranker.
364
+ - \`AWM_DISABLE_EXPANSION_CACHE=1\` (0.7.11+) — disables the query expansion
365
+ skip heuristic + LRU cache. Forces every recall through flan-t5-small.
366
+
367
+ In production, leave these all unset. Use only when diagnosing a suspected
368
+ recall-quality regression.
369
369
  `.trimStart();
370
370
  //# sourceMappingURL=common.js.map