agent-working-memory 0.11.0 → 0.12.3

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 (115) hide show
  1. package/README.md +71 -297
  2. package/dist/adapters/claude-code.d.ts.map +1 -1
  3. package/dist/adapters/claude-code.js +63 -3
  4. package/dist/adapters/claude-code.js.map +1 -1
  5. package/dist/adapters/common.d.ts.map +1 -1
  6. package/dist/adapters/common.js +358 -306
  7. package/dist/adapters/common.js.map +1 -1
  8. package/dist/api/routes.d.ts.map +1 -1
  9. package/dist/api/routes.js +29 -7
  10. package/dist/api/routes.js.map +1 -1
  11. package/dist/coordination/routes.d.ts.map +1 -1
  12. package/dist/coordination/routes.js +174 -170
  13. package/dist/coordination/routes.js.map +1 -1
  14. package/dist/core/embeddings.d.ts.map +1 -1
  15. package/dist/core/embeddings.js +4 -1
  16. package/dist/core/embeddings.js.map +1 -1
  17. package/dist/core/entity-extract.d.ts +3 -0
  18. package/dist/core/entity-extract.d.ts.map +1 -0
  19. package/dist/core/entity-extract.js +47 -0
  20. package/dist/core/entity-extract.js.map +1 -0
  21. package/dist/core/format-recall.d.ts +16 -0
  22. package/dist/core/format-recall.d.ts.map +1 -0
  23. package/dist/core/format-recall.js +24 -0
  24. package/dist/core/format-recall.js.map +1 -0
  25. package/dist/core/query-expander.js +1 -1
  26. package/dist/core/query-expander.js.map +1 -1
  27. package/dist/core/reranker.js +1 -1
  28. package/dist/core/reranker.js.map +1 -1
  29. package/dist/core/salience.d.ts.map +1 -1
  30. package/dist/core/salience.js +14 -2
  31. package/dist/core/salience.js.map +1 -1
  32. package/dist/core/whoami.d.ts +24 -0
  33. package/dist/core/whoami.d.ts.map +1 -0
  34. package/dist/core/whoami.js +66 -0
  35. package/dist/core/whoami.js.map +1 -0
  36. package/dist/core/write-pipeline.d.ts +9 -0
  37. package/dist/core/write-pipeline.d.ts.map +1 -1
  38. package/dist/core/write-pipeline.js +109 -68
  39. package/dist/core/write-pipeline.js.map +1 -1
  40. package/dist/core/write-telemetry.d.ts +33 -0
  41. package/dist/core/write-telemetry.d.ts.map +1 -0
  42. package/dist/core/write-telemetry.js +110 -0
  43. package/dist/core/write-telemetry.js.map +1 -0
  44. package/dist/engine/activation.d.ts +22 -12
  45. package/dist/engine/activation.d.ts.map +1 -1
  46. package/dist/engine/activation.js +133 -17
  47. package/dist/engine/activation.js.map +1 -1
  48. package/dist/engine/consolidation-scheduler.d.ts +1 -1
  49. package/dist/engine/consolidation-scheduler.js +1 -1
  50. package/dist/engine/consolidation.d.ts +1 -0
  51. package/dist/engine/consolidation.d.ts.map +1 -1
  52. package/dist/engine/consolidation.js +18 -0
  53. package/dist/engine/consolidation.js.map +1 -1
  54. package/dist/engine/eval.d.ts.map +1 -1
  55. package/dist/engine/eval.js +5 -1
  56. package/dist/engine/eval.js.map +1 -1
  57. package/dist/hooks/sidecar.d.ts +26 -0
  58. package/dist/hooks/sidecar.d.ts.map +1 -1
  59. package/dist/hooks/sidecar.js +30 -0
  60. package/dist/hooks/sidecar.js.map +1 -1
  61. package/dist/index.js +20 -2
  62. package/dist/index.js.map +1 -1
  63. package/dist/mcp.d.ts +2 -1
  64. package/dist/mcp.d.ts.map +1 -1
  65. package/dist/mcp.js +222 -108
  66. package/dist/mcp.js.map +1 -1
  67. package/dist/recipes/index.d.ts +57 -0
  68. package/dist/recipes/index.d.ts.map +1 -0
  69. package/dist/recipes/index.js +81 -0
  70. package/dist/recipes/index.js.map +1 -0
  71. package/dist/storage/pglite-schema.d.ts.map +1 -1
  72. package/dist/storage/pglite-schema.js +27 -0
  73. package/dist/storage/pglite-schema.js.map +1 -1
  74. package/dist/storage/pglite.d.ts +5 -0
  75. package/dist/storage/pglite.d.ts.map +1 -1
  76. package/dist/storage/pglite.js +180 -138
  77. package/dist/storage/pglite.js.map +1 -1
  78. package/dist/storage/postgres.d.ts +5 -0
  79. package/dist/storage/postgres.d.ts.map +1 -1
  80. package/dist/storage/postgres.js +180 -138
  81. package/dist/storage/postgres.js.map +1 -1
  82. package/dist/storage/sqlite.d.ts +9 -0
  83. package/dist/storage/sqlite.d.ts.map +1 -1
  84. package/dist/storage/sqlite.js +394 -326
  85. package/dist/storage/sqlite.js.map +1 -1
  86. package/dist/types/engram.d.ts +14 -0
  87. package/dist/types/engram.d.ts.map +1 -1
  88. package/dist/types/engram.js.map +1 -1
  89. package/package.json +1 -1
  90. package/src/adapters/claude-code.ts +66 -3
  91. package/src/adapters/common.ts +567 -515
  92. package/src/api/routes.ts +999 -971
  93. package/src/coordination/routes.ts +2155 -2150
  94. package/src/core/embeddings.ts +4 -1
  95. package/src/core/entity-extract.ts +47 -0
  96. package/src/core/format-recall.ts +25 -0
  97. package/src/core/query-expander.ts +1 -1
  98. package/src/core/reranker.ts +1 -1
  99. package/src/core/salience.ts +529 -514
  100. package/src/core/whoami.ts +92 -0
  101. package/src/core/write-pipeline.ts +60 -8
  102. package/src/core/write-telemetry.ts +131 -0
  103. package/src/engine/activation.ts +1468 -1369
  104. package/src/engine/consolidation-scheduler.ts +1 -1
  105. package/src/engine/consolidation.ts +887 -869
  106. package/src/engine/eval.ts +6 -1
  107. package/src/hooks/sidecar.ts +55 -0
  108. package/src/index.ts +248 -227
  109. package/src/mcp.ts +1387 -1270
  110. package/src/recipes/index.ts +125 -0
  111. package/src/storage/pglite-schema.ts +27 -0
  112. package/src/storage/pglite.ts +1420 -1372
  113. package/src/storage/postgres.ts +1523 -1475
  114. package/src/storage/sqlite.ts +1936 -1861
  115. package/src/types/engram.ts +22 -0
package/README.md CHANGED
@@ -22,14 +22,14 @@ Use it through Claude Code via MCP or as a local HTTP service for custom agents.
22
22
 
23
23
  ## Quick Start
24
24
 
25
- **Node.js 20+** required — check with `node --version`.
25
+ **Node.js 22 LTS+** required — check with `node --version`. (Node 20 reached EOL 2026-04-30; AWM 0.8.6+ requires 22.)
26
26
 
27
27
  ```bash
28
28
  npm install -g agent-working-memory
29
29
  awm setup --global
30
30
  ```
31
31
 
32
- Restart Claude Code. That's it — 16 memory tools appear automatically.
32
+ Restart Claude Code. That's it — 19 tools appear automatically (17 memory + 2 onboarding).
33
33
 
34
34
  ### Upgrading
35
35
 
@@ -70,12 +70,17 @@ First conversation will be ~30 seconds slower while ML models download (~200MB t
70
70
 
71
71
  ## Why it's different
72
72
 
73
+ > **New to the vocabulary?** Terms like *engram, salience, activation, Hebbian, staging*
74
+ > are defined plainly, one paragraph each, in
75
+ > [`docs/onboarding-vocabulary.md`](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/onboarding-vocabulary.md) — a 5-minute read if any of the table below is unfamiliar.
76
+
73
77
  Most "memory for AI" projects are vector databases with a retrieval wrapper. AWM goes further:
74
78
 
75
79
  | | Typical RAG / Vector Store | AWM |
76
80
  |---|---|---|
77
81
  | **Storage** | Everything | Salience-filtered with low-confidence fallback (novel events go active, borderline enter staging, low-salience stored at reduced confidence) |
78
82
  | **Retrieval** | Cosine similarity | 10-phase pipeline: dual BM25 (keyword + expanded) + vectors + reranking + graph walk + decay + coref expansion |
83
+ | **Named things** | Vocabulary-dependent — misses if the query doesn't lexically match | Entity inverted index: exact lookup on named entities ("ticket 19252", a person's name), immune to phrasing mismatch |
79
84
  | **Connections** | None | Hebbian edges that strengthen when memories co-activate |
80
85
  | **Over time** | Grows forever, gets noisier | Consolidation: diameter-enforced clustering, cross-topic bridges, synaptic-tagged decay |
81
86
  | **Forgetting** | Manual cleanup | Cognitive forgetting: unused memories fade, reinforced knowledge persists (access-count modulated) |
@@ -132,7 +137,13 @@ Two structural advantages a file or a flat vector store cannot match:
132
137
  Two kinds of tests, both reproducible (see [Testing & Evaluation](#testing--evaluation)).
133
138
  First, **recall quality** — does the pipeline return the right memory? Second,
134
139
  **behavior under stress** — does it stay honest, filter noise, and hold up as the
135
- store grows and ages? Numbers below were re-run on the 0.9-staged line (2026-06-17).
140
+ store grows and ages? Numbers below were last re-run on the 0.9-staged line
141
+ (2026-06-17) — the retrieval pipeline itself is unchanged since, but re-run these
142
+ yourself (`npm run eval`) if you want current-build numbers; 0.12.x added
143
+ reliability/telemetry/entity-index work on top, not retrieval-scoring changes.
144
+ See [`docs/gauntlet-baseline-2026-07-30.md`](docs/gauntlet-baseline-2026-07-30.md)
145
+ for the newer end-to-end memory-ablation acceptance test (74%±5pp memory-dependent
146
+ vs 0% no-memory control).
136
147
 
137
148
  ### 1 · Recall quality (eval harness)
138
149
 
@@ -221,7 +232,7 @@ even on a corpus far too small to play to its strengths.
221
232
 
222
233
  ## Features
223
234
 
224
- ### Memory Tools (16)
235
+ ### Memory Tools (17 + 2 onboarding = 19)
225
236
 
226
237
  | Tool | Purpose |
227
238
  |------|---------|
@@ -231,6 +242,7 @@ even on a corpus far too small to play to its strengths.
231
242
  | `memory_retract` | Invalidate a wrong memory with optional correction |
232
243
  | `memory_supersede` | Replace outdated memory with current version |
233
244
  | `memory_stats` | View memory health metrics and activity |
245
+ | `memory_whoami` | Identify the instance — agent id, workspace, backend, store path, sibling agent spaces |
234
246
  | `memory_checkpoint` | Save execution state (survives context compaction) |
235
247
  | `memory_restore` | Recover state + relevant context at session start |
236
248
  | `memory_task_add` | Create a prioritized task |
@@ -242,6 +254,15 @@ even on a corpus far too small to play to its strengths.
242
254
  | `compress_output` | Encode a structured tool output as TOON — ~50-65% fewer tokens, lossless, output-only |
243
255
  | `retrieve_original` | Get the verbatim source back for a `compress_output` ref |
244
256
 
257
+ ### Onboarding Tools (2)
258
+
259
+ 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).
260
+
261
+ | Tool | Purpose |
262
+ |------|---------|
263
+ | `onboard_scan` | Extract candidate memories from a project's docs/repo for review |
264
+ | `onboard_questions` | Anchored interview questions to refine what a cold store should know |
265
+
245
266
  ### Separate Memory Pools
246
267
 
247
268
  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`:
@@ -459,7 +480,7 @@ src/
459
480
  sqlite.ts - SQLite + FTS5 persistence layer
460
481
  api/
461
482
  routes.ts - HTTP endpoints (memory + task + system)
462
- mcp.ts - MCP server (14 tools, incognito support)
483
+ mcp.ts - MCP server (19 tools: 17 memory + 2 onboarding, incognito support)
463
484
  cli.ts - CLI (setup, serve, hook config)
464
485
  index.ts - HTTP server entry point (auto-backup on startup)
465
486
  ```
@@ -524,6 +545,9 @@ npm run test:locomo # LoCoMo industry benchmark (28.2%)
524
545
  | `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 |
525
546
  | `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 |
526
547
  | `AWM_WORKSPACE` | *(unset)* | Default workspace for cross-agent recall in hive setups |
548
+ | `AWM_SLOW_WRITE_MS` | `250` | Slow-write telemetry threshold in ms; any write over this logs one stderr line with a phase-time breakdown (embed/novelty/persist, event-loop lag, cold-load ms). `0` disables (v0.12.0) |
549
+ | `AWM_ENTITY_INDEX_FETCH` | *(unset)* | Set to `1` to let query-named entities ("ticket 19252", a person's name) resolve through the entity inverted index for a guaranteed reranker audition, including alias hops. Default off pending broader eval (v0.12.0) |
550
+ | `AWM_ENTITY_INDEX_CAP` | `12` | Max entity-index candidates injected per recall when `AWM_ENTITY_INDEX_FETCH=1` (v0.12.0) |
527
551
  | `AWM_STORE_BACKEND` | `sqlite` | `sqlite` (better-sqlite3 + FTS5), `pglite` (PGlite + pgvector + pgroonga), or `postgres` (node-postgres + pgvector, networked/multi-connection — **experimental**, 0.10.0). |
528
552
  | `AWM_DB_PATH` | `memory.db` (SQLite) / `./memory-pglite` (PGlite) | Storage path. Directory for PGlite, file for SQLite. Ignored for `postgres` (uses `AWM_DATABASE_URL`). |
529
553
  | `AWM_DATABASE_URL` | *(unset)* | Postgres connection string when `AWM_STORE_BACKEND=postgres` (0.10.0). |
@@ -555,294 +579,42 @@ npm run test:locomo # LoCoMo industry benchmark (28.2%)
555
579
 
556
580
  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.
557
581
 
558
- ## What's New in v0.11.0
559
-
560
- **`awm onboard` warm-start a cold store from a project's own knowledge.** A fresh store
561
- knows nothing, so recall returns nothing until interactions accumulate; onboarding seeds it up
562
- front so an agent is useful from the first turn.
563
-
564
- - **Scan:** `awm onboard <docs> --repo <path> --project <name>` extracts atomic, recall-shaped
565
- memories from docs (one per heading) + the repo (stack, layout) → an `awm import`-compatible
566
- pack + a human review file. Edit, then `awm import --dedupe`. Model-free, no API keys.
567
- - **Agent-driven interview (no AWM→LLM calls):** two MCP tools — `onboard_scan` (candidate
568
- memories to refine) and `onboard_questions` (anchored on "what is the goal of this memory
569
- system?"). The host agent (Codex, Claude Code) refines, confirms with you, and writes them.
570
- Works air-gapped.
571
- - **The skill is a memory:** `awm setup` seeds a canonical "onboard a new project" skill the
572
- agent can recall; a cold-store nudge in `memory_restore` reminds it to warm-start.
573
-
574
- Also folds in the **0.10.1** version-reporting fix (below) and fixes the npm README links
575
- (absolute GitHub / Pages URLs + the `repository` field).
576
-
577
- ## What's New in v0.10.1
578
-
579
- A patch no functional or recall-behavior change.
580
-
581
- - **Reported version is now the truth.** Hand-maintained version strings had drifted
582
- (a 0.10.0 build announced `0.8.5`/`0.8.8`/`0.9.2` on the banner, `/health`, the MCP
583
- server, and the export payload). A new `src/version.ts` reads `version` from
584
- `package.json` at runtime, so the reported number can never diverge from the build.
585
- - README now documents the v0.10.0 Postgres backend (below) + `AWM_STORE_BACKEND=postgres`
586
- / `AWM_DATABASE_URL`.
587
-
588
- ## What's New in v0.10.0
589
-
590
- A networked **Postgres** backend + backend-agnostic memory portability, plus
591
- correctness/stability fixes from a deep audit. No API changes existing SQLite
592
- callers keep working unmodified.
593
-
594
- - **New `postgres` backend** (`AWM_STORE_BACKEND=postgres`, `AWM_DATABASE_URL=…`).
595
- A real-server adapter over node-postgres (`pg`) + pgvector — the first backend
596
- that is multi-**connection** safe (vs SQLite's single-machine WAL and PGlite's
597
- single-process WASM), for cloud / multi-replica deployments. Sub-1.0 on purpose:
598
- the backend is **experimental** until the remaining SQLite-only paths
599
- (coordination, hot backups, integrity check) are ported and cross-backend
600
- recall-quality parity is confirmed.
601
- - **Backend-agnostic `awm import` / `awm export`.** Both route through `openStore()`,
602
- so you can export from any backend and **import INTO Postgres or PGlite** (import
603
- was previously SQLite-only). **Export now includes embedding vectors** — a faithful,
604
- recall-ready port with no re-embed when source/target embedding models match
605
- (`--no-embeddings` to skip for a model mismatch). New flags: `--all-stages`,
606
- `--include-retracted`; associations + supersession links are preserved.
607
- - **`awm merge` no longer silently drops data.** The old hand-rolled merge used a
608
- truncated schema (no `embedding`, `memory_class`, task/supersession columns) and
609
- never populated FTS — killing both vector and BM25 recall for merged rows. Rewritten
610
- to route every source engram through the authoritative `EngramStore`/`createEngram`
611
- path (+ stage/retracted/supersession restore), wrapped in `try/finally`.
612
- - **`awm import` preserves stage + retracted** — previously `--include-retracted`
613
- resurrected retracted memories and flattened all stages to `active`.
614
- - **Cross-agent contamination guard (write pipeline)** — a workspace/hive recall can
615
- surface another agent's same-concept engram; the reinforce/supersede branch now
616
- refuses to mutate an engram whose `agentId` differs from the writer's.
617
- - **Hive degradation is visible** — `getWorkspaceAgentIds` on Postgres/PGlite emits a
618
- one-time warning (workspace coordination is SQLite-only) instead of silently
619
- returning self-only.
620
-
621
- ## What's New in v0.9.0
622
-
623
- A recall-quality default + new tuning knobs + a builder/researcher doc set.
624
- Every change is an **env-revertible default** with no API changes — existing
625
- callers keep working unmodified. Validated: official LoCoMo **22.7% → 25.7%**
626
- (every category up) **and** adversarial precision **73.4 → 74.9** (strictly
627
- better on each axis); recall latency ~35 → ~77ms (sub-100ms, tunable); zero
628
- regression across the standard suite (eval 4-suite identical, 569/569 unit,
629
- edge 32/34, workday = old config).
630
-
631
- - **Wide rerank pool + top-K abstention (the win).** A pipeline-attribution
632
- study (new tracer, `tests/locomo-eval/trace.ts`) found the dominant recall
633
- loss wasn't candidate generation *or* the reranker — it was the stage between:
634
- ~50% of answerable queries had gold that *cleared the candidate floor* but was
635
- squeezed out of the rerank pool by the decay-compressed composite **before the
636
- high-lift (+3.29) reranker saw it**. Fix: the composite becomes a cheap **wide
637
- pre-filter** (`AWM_TOPN_MULT=8`, was 3×), the reranker discriminates on a wider
638
- pool (`AWM_RERANK_POOL=max(limit*4,40)`, was `max(limit*2,15)`), and the
639
- out-of-domain abstention gate judges only the **post-rerank top-K**
640
- (`AWM_ABSTAIN_GATE_K=5`) so widening for recall doesn't inflate the in-domain
641
- signal. Reverses the v0.7.13 "pool reduction" change. See
642
- [reference.md → Recall tuning](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/reference.md#recall-tuning-env-overrides).
643
-
644
- - **Tunable similarity floors.** `AWM_SIM_FLOOR_TARGETED` / `_EXPLORATORY`
645
- (defaults 0.50 / 0.35, unchanged) and the candidate-entry floors are now env
646
- overrides for retuning against a different embedder.
647
-
648
- - **Opt-in / experimental flags (default-off).** `AWM_QUERY_BRIDGE`
649
- (query-named-entity boost — lifts attribution "what does X think" 36% → 92% on
650
- a controlled eval; small adversarial cost, so opt-in), `AWM_AUTOTAG`
651
- (write-time `entity:`/`cat:` meta-tags), `AWM_BROAD_EDGES`. `AWM_SPREAD`
652
- (in-engine spreading activation) is **parked** — it regressed recall by
653
- displacing gold; multi-hop is solved harness-side instead (see the playbook).
654
-
655
- - **New docs for builders & researchers.** [`docs/awm-for-agents.html`](https://completeideas.github.io/agent-working-memory/awm-for-agents.html)
656
- — the agent playbook (why AWM exists, the PRIME→ACT→VERIFY→LEARN harness, the
657
- full agent feature surface, how multi-hop is solved, and the honest gauntlet
658
- findings). [`docs/pipeline-walkthrough.html`](https://completeideas.github.io/agent-working-memory/pipeline-walkthrough.html)
659
- redesigned for devs/researchers. Both are published on GitHub Pages. A new
660
- **Storage Backends + Postgres roadmap** section in
661
- [architecture.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/docs/architecture.md) documents SQLite (default) vs PGlite
662
- and the path to a networked-Postgres backend (v1 target).
663
-
664
- ## What's New in v0.8.5
665
-
666
- A research-grounded hardening pass on recall quality, retraction propagation,
667
- and lifecycle management. Every change is **fully additive** — existing
668
- callers keep working without modification. Full validation at the milestone:
669
- `vitest run` 549/549 pass; `test:self` 97.6% EXCELLENT (was 91.4% on 0.8.0);
670
- `test:ab` AWM 89.3% vs Baseline 83.0% (+6.4 points); `test:perf` 4/4 PASS.
671
-
672
- - **Recall confidence as data (PR-1).** Every `ActivationResult` now carries
673
- a `confidence` field in [0, 1] — a score-distribution-aware signal
674
- (sharpness + cliff + floor blended via weighted geometric mean) that tells
675
- the caller how trustworthy the recall set is. Same value on every result
676
- in a recall — it describes the *set*, not the individual. Research grounding:
677
- Geifman & El-Yaniv (NeurIPS 2017), Roitero et al (SIGIR 2022). Default
678
- behavior unchanged; this is data, not a gate.
679
-
680
- - **Opt-in confidence-based abstention (PR-2).** Callers can pass
681
- `requireConfidence` (typical values: 0.10 strict, 0.25 balanced, 0.40
682
- aggressive). When set, the engine returns `[]` on recalls whose
683
- distribution shape falls below the threshold — defeats the
684
- "best-of-bad-bunch" leak where a noisy recall returns a weak top result
685
- that the agent then trusts.
686
-
687
- - **Coherence-weighted retraction (#18).** Retraction penalty propagation
688
- is no longer uniform. Multiplier scales with local neighborhood cohesion:
689
- dense topically-coherent clusters (a narrative) get heavier penalties when
690
- the seed is wrong; hub structures (popular node with heterogeneous edges)
691
- get lighter penalties. Implements Carrillo et al, "Continued Influence
692
- Effect" (ICCM 2025).
693
-
694
- - **Counter-narrative replacement on supersede/correction (#19).** When
695
- retraction creates a counter-content correction, the new engram inherits
696
- the original's `'connection'` edges (scaled 0.7×, capped at 10
697
- inheritances, with `invalidation` / `causal` / `temporal` skipped). The
698
- corrected fact takes over the graph role of the wrong fact rather than
699
- leaving the corrected fact disconnected.
700
-
701
- - **Content fade stage (#20) — Paper 1.** New intermediate `'fading'`
702
- lifecycle stage between `'active'` and `'archived'`. Engrams accessed
703
- before but stale (no access in 45+ days, content > 250 chars) get content
704
- trimmed to 150 chars + `… [faded]` marker. Concept, tags, and embedding
705
- preserved — the engram still participates in BM25 + vector recall, just
706
- with less body to score against. Models human memory's loss of surface
707
- detail while retaining cue-association pathways (PLOS Comp Biology on
708
- storage degradation). Heavily-used (`accessCount >= 10`), `canonical`,
709
- `structural`, and retracted engrams excluded.
710
-
711
- - **Adaptive output granularity (#21) — Paper 3.** New
712
- `granularity: 'full' | 'compact' | 'auto'` on `ActivationQuery`.
713
- `'compact'` attaches a 200-char `summary` to every result. `'auto'` is
714
- confidence-adaptive: when recall confidence ≥ 0.4, the top result gets
715
- a long-form summary and the rest are compact; when confidence is low,
716
- everything is compact so the agent can scan a diverse set without
717
- drowning in content. Engram body never modified — just the response shape.
718
- Models cognitive teaming (Brill 2018 ACT-R collaboration).
719
-
720
- ## What's New in v0.8.1
721
-
722
- - **Coordination control layer** — `FailureMode` classifier + mutation-hint
723
- retry on `cleanupStale`, per-worker `CircuitBreaker`, and voluntary
724
- `POST /assignment/:id/fail` endpoint. Designed to reduce the 11.5%
725
- failure-with-no-retry rate observed in production hive runs (81/703).
726
- Two new schema columns on `coord_assignments` plus a `coord_circuit_state`
727
- table — both additive `CREATE IF NOT EXISTS` migrations.
728
-
729
- ## What's New in v0.8.0
730
-
731
- - **Substrate primitives for long-running structured projects** — four new
732
- HTTP endpoints (`/memory/latest-by-tag`, `/memory/top-by`,
733
- `/memory/resolve`, `/memory/supersede` Form B), three query operators
734
- (`tagsAll`, `tagsAny`, `tagsNone`), and a fourth `memory_class` value
735
- (`structural`). Optional engram columns `sequence` + `references_json`
736
- enable race-free chronology and typed cross-record links. Designed against
737
- the NovelForge 36,000-word "Drawdown" test bed.
738
-
739
- ## What's New in v0.7.16
740
-
741
- - **`awm setup --global` template now teaches *write quality*.** Two new sections in `AWM_INSTRUCTION_CONTENT`:
742
- - **Writing for recall** — explicit guidance that recall quality is determined at write time. Lead with the rule/fact, pick the most specific topic, include 2+ retrievable identifiers (file paths, function names, IDs), write in the vocabulary of the future query, reserve canonical for stable invariants, include the *why* for feedback memories.
743
- - **Recall strategy** — formalizes the multi-query reformulation pattern observed in practice. When one query returns nothing, agents reformulate (synonyms, more specific nouns, exact identifiers). Recall is ~300ms — two-three reformulations cost less than one filesystem search. Cap at three to prevent loops.
744
-
745
- These document the writer + reader behaviors AWM was always designed around but were previously implicit. No retriever change — pure system-prompt improvement. Run `npm install -g agent-working-memory@latest && awm setup --global` to apply.
746
-
747
- - **LongMemEval headline number updated.** Re-running the benchmark on 0.7.16 (single-session-user, 50 questions, same adapter as the original 0.7.1 baseline): **68% accuracy with gpt-4o-mini**, up from the original 40-50%. Recall latency 0.12s avg (was 7-11s on 0.7.2). Multi-tier reader sweep on the same memory inputs:
748
- - gpt-4o-mini (cheap, non-thinking): 68%
749
- - gpt-4o (strong, non-thinking): 68%
750
- - o4-mini (cheap, thinking): 78%
751
- - gpt-5-mini (mid, thinking): 80%
752
-
753
- Non-thinking models cap at 68% on this category — the bottleneck is reasoning over recalled context, not raw scale. Thinking models add 10-12pp. Memory quality is fixed; reader determines the ceiling.
754
-
755
- ## What's New in v0.7.15
756
-
757
- - **Documentation refresh** — `awm setup --global` now writes a CLAUDE.md template that documents all four perf env-var escape hatches (`AWM_DISABLE_POOL_FILTER`, `AWM_DISABLE_SLIM_CACHE`, `AWM_DISABLE_RERANK_SKIP`, `AWM_DISABLE_EXPANSION_CACHE`) instead of just the first one. Troubleshooting / quickstart / user-guide docs updated to reflect the current ~300ms recall floor. No code change — version bumped solely so the new template ships via `npm install -g agent-working-memory@latest`.
758
-
759
- ## What's New in v0.7.14
760
-
761
- - **Recall latency 0.4-0.8s → 0.3-0.6s (~25-50% on top of 0.7.13)** — three fixes:
762
- 1. **Batched cross-encoder inference** — reranker now tokenizes + runs all query-passage pairs in one batched forward pass. 15-passage rerank: 210ms → 27ms (~7×).
763
- 2. **Truncate passages to 400 chars before rerank** — cross-encoder has 512-token max anyway and pads to the longest passage; full content (5000+ chars) meant everything padded to max length. Truncation drops tokenization + inference 3-4× on long memory pools.
764
- 3. **Eager slim-cache populate at startup** — first user recall no longer pays the ~600ms cache populate cost.
765
-
766
- Recall quality A/B: 8/8 top-1, 4.50/5 top-5. **Cumulative since 0.7.4 baseline: 11s → 0.3-0.6s (~25-37× faster).**
767
-
768
- ## What's New in v0.7.13
769
-
770
- - **Reranker pool size reduction** — cross-encoder pool dropped from `max(limit*3, 30)` to `max(limit*2, 15)`. For typical agent queries (limit=5 or 10), that's 15-20 candidates reranked instead of 30, halving the cross-encoder cost. Top-K quality preserved (8/8 top-1, identical top-5/top-10 overlap) — reranking the 21st-30th candidates was wasted when the user only wants top-5 anyway.
771
- > **⚠️ Superseded in 0.9.0 — this reduction was reversed.** A pipeline-attribution study found that "wasted" tail was actually where ~50% of retrievable answers were being squeezed out *before* the reranker saw them (the small 8-query A/B above missed it). 0.9.0 widens the pool back to `max(limit*4, 40)` and adds a top-K abstention gate — lifting LoCoMo recall 22.7%→25.7% **and** adversarial precision 73.4→74.9, with no regression. See the CHANGELOG and `docs/reference.md` → "Recall tuning."
772
-
773
- ## What's New in v0.7.12
774
-
775
- - **Recall latency 0.9s → 0.4-0.8s (~40-60% on top of 0.7.11)** — phase-breakdown showed `getAssociationsForBatch` over ~300 survivors was 222ms (25% of remaining floor) but the scoring loop only reads `count` + `sumWeight` from each engram's edges. New `getAssociationStatsForBatch` returns scalar stats via a single GROUP BY aggregate. Graph walk still uses full associations, but only on top-N (~30) so its lookups are cheap. Recall quality A/B: 8/8 top-1, 4.50/5 top-5. **Cumulative since 0.7.4 baseline: 11-23s → 0.4-0.8s (~25× faster median).**
776
-
777
- ## What's New in v0.7.11
778
-
779
- - **Query expansion skip + LRU cache** — flan-t5-small was 164ms per recall (18% of post-0.7.10 floor). Two fixes in `core/query-expander.ts`: (1) skip heuristic for long/specific queries (>50 chars OR ≥5 distinct meaningful tokens), and (2) 500-entry LRU cache for repeated queries. ~30% of typical agent recalls hit the skip; repeated recalls hit the cache. Avg savings: ~100-150ms per recall. Recall quality A/B: 8/8 top-1, 4.63/5 top-5. Disable via `AWM_DISABLE_EXPANSION_CACHE=1`.
780
-
781
- ## What's New in v0.7.10
782
-
783
- - **Recall latency 1.4s → 0.9s median (~35% on top of 0.7.9)** — two more fixes after phase-breakdown showed the slim fetch was still 310ms (Buffer→Float32Array on every recall) and the reranker was 354ms (40% of remaining cost):
784
- 1. **In-memory slim cache** — `Map<id, SlimCacheEntry>` populated once per process, mutated in lock-step with engram writes/updates/retracts. Slim fetch 306ms → **5ms** with warm cache (~60×). Disable via `AWM_DISABLE_SLIM_CACHE=1`. Memory cost ~15MB at 10K engrams.
785
- 2. **Reranker skip on clear winners** — when BM25 has a clear top-1 (textMatch ≥ 0.8, ≥1.5× the next score, small pool), skip the cross-encoder. Saves ~300ms on confident queries. Disable via `AWM_DISABLE_RERANK_SKIP=1`.
786
-
787
- Quality preserved: 8/8 top-1, 4.63/5 top-5, 9.75/10 top-10 on the A/B suite. **Cumulative since 0.7.4 baseline: 11s → 0.9s (~12-15× faster).**
788
-
789
- ## What's New in v0.7.9
790
-
791
- - **Recall latency 1.6s → 1.0s end-to-end (~30% on top of 0.7.7)** — phase-breakdown showed the fullSELECT-over-10K-engrams was the new bottleneck (440ms / 40% of recall) due to row materialization of content/tags/JSON for rows the pre-filter doesn't read. Two-pass fetch: slim `(id, concept, embedding)` for the cosine + filter pass, then hydrate only the survivors via `getEngramsByIds`. Recall quality A/B verified 8/8 top-1 identical, top-K overlap slightly improved (4.75/5 vs 4.50). **Cumulative since 0.7.4 baseline: 11-23s → 1.0-1.6s (~10-20× faster).**
792
-
793
- ## What's New in v0.7.8
794
-
795
- - **Install template updated for the 0.7.5/0.7.6/0.7.7 behaviors** — `awm setup` now writes a richer CLAUDE.md that teaches agents about memory classes (`canonical | working | ephemeral`), salience auto-promotion patterns (`detectUserFeedback` for stakeholder quotes, `detectVerifiedFinding` for operational records with action-verb + concrete IDs), and the new env-var escape hatches. Existing installs upgrade via `npm install -g agent-working-memory@latest && awm setup --global` then restart Claude Code. No functional code change in this release — version bumped solely so the new template ships.
796
-
797
- ## What's New in v0.7.7
798
-
799
- - **Recall latency 2.5s → 1.0s end-to-end (~50% on top of 0.7.6)** — phase-breakdown spike showed that after the 0.7.6 BM25 fix, the new bottleneck was `getAssociationsForBatch` over all ~10K candidates (68% of recall latency). Added a cheap pre-filter before deep scoring: candidates survive only if they have a BM25 hit, a cosine z-score above the gate, or concept-token overlap with the query. From ~10K candidates → typically 100-300 survivors. Graph-walk correctness preserved (it only boosts neighbors with `textMatch >= 0.05`, which would also pass this filter). Recall quality A/B verified: 8/8 top-1 matches, 90% top-5 overlap, 94% top-10 overlap on diverse queries. Set `AWM_DISABLE_POOL_FILTER=1` to revert. **Cumulative since 0.7.4 baseline: 11-23s → 0.9-1.6s (~10-15× faster).**
800
-
801
- ## What's New in v0.7.6
802
-
803
- - **Recall latency 11-23s → 2.5s end-to-end (~5× faster)** — measurement spike found the slow path was a SQLite query-plan trap, not vector search. The BM25 query `JOIN engrams_fts ON e.rowid + WHERE MATCH + ORDER BY rank LIMIT N` materialized all matching rows (with 1.5KB embedding blobs) before the LIMIT applied. CTE prefilter forces FTS5 LIMIT first, then joins only the top-K rowids. Same SQLite, same data, same results — 567× faster for wide OR queries (3682ms → 6.5ms verified). Also added `getAssociationsForBatch` to replace the per-candidate N+1 in the activation scoring loop. Top-K results are byte-identical to the old query (verified by the equivalence test in `spike/`).
804
- - **Salience filter — auto-promote verified operational records** — operational batch summaries (e.g., "Submitted 6 events 2026-05-07 — IDs 18969, 18971…") were being discarded at salience 0.14 because BM25 novelty couldn't distinguish "useful new operational record" from "duplicate observation" when topic terminology repeated. New `detectVerifiedFinding()` pattern detector parallel to `detectUserFeedback()`: requires action-verb header (Submitted/Finalized/Completed/Reconciled/Triaged/etc.) plus ≥2 concrete identifiers (ISO date or contextual numeric ID). Matched memories get a 0.45 salience floor (active disposition, not canonical). 7 new tests, 23 salience tests pass.
805
-
806
- ## What's New in v0.7.4
807
-
808
- - **Channel push telemetry** — new `GET /telemetry/channels` JSON endpoint and Prometheus counters (`coord_channel_push_attempts_total`, `..._delivered_total`, `..._failed_total{reason}`, `..._no_session_total`, `..._fallback_mailbox_total`, `..._session_disconnects_total`). Surfaces real delivery rate so coordination reliability can be measured rather than guessed.
809
- - **Role-based `/channel/push` addressing** — accepts `{role, workspace, message}` as alternative to `{agentId, message}`. Server resolves role+workspace to most-recently-seen alive agent. Lets workers notify the coordinator without hardcoding its UUID (which changes across coordinator restarts). Enables event-driven worker → coordinator hand-off in place of fragile coordinator self-polling.
810
- - **`/checkin` writes role on every call** — previously the UPDATE on existing rows preserved a stale role from initial registration; now agents can correct their own role via re-checkin.
811
- - **`/workers` JOINs channel sessions** — `alive` field is now `recent_pulse OR connected_channel_session`. Stops false-dead duplicate-spawn loops where a busy worker's `/pulse` went stale during long tool sequences while their channel-server stayed reachable.
812
- - **`cleanupStale` runs on a 5-minute schedule** — was only invoked manually; now zombie agents get marked dead automatically with a 600s threshold (forgiving for long edits).
813
- - **`user_feedback` salience event type** — new event type with bonus 0.3 (highest of any). Auto-detect heuristic on `memory_write` content matching `^(Robert|Katherine|Nancy|...) (said|verbatim|directed|decided|...)` forces `memoryClass='canonical'` so user-stated decisions can't be discarded by the BM25 novelty floor in populated DBs.
814
-
815
- ### v0.7.3
816
-
817
- - **Salience filter production tuning** — fixed BM25 novelty floor that was discarding ~17% salience for most writes in 10K+ engram DBs. Quadratic dampening curve (`max(0.05, 1 - topScore²)`); concept-match penalty scoped to last 30 days; floor lowered 0.10 → 0.05.
818
- - Maintenance scripts for backup pruning + lme/bench database cleanup.
819
-
820
- ### v0.7.2
821
-
822
- - Workspace recall fix (was returning UUIDs not names in v0.7.1 release).
823
-
824
- ### v0.7.1
825
-
826
- - **Agent-provided metadata tags** — `memory_write` accepts `project`, `topic`, `source`, `confidence_level`, `session_id`, `intent`. Stored as searchable prefixed tags (`proj=X`, `sid=Z`). Session ID tags alone improved LongMemEval recall 3x.
827
- - **Dual synthesis** — consolidation creates two types of summary memories: session summaries (tag-based, for perfect recall) and pattern syntheses (cross-session, for novel recall/creative connections).
828
- - **Bulk write + supersession** — `POST /memory/write-batch` for batch ingestion with `POST /memory/supersede` for knowledge updates.
829
- - **LongMemEval benchmark** — adapter built, baseline established at 40-50% with gpt-4o-mini.
830
-
831
- ### v0.7.0
832
-
833
- - Workspace-scoped recall, validation-gated Hebbian (Kairos), multi-graph traversal (MAGMA), power-law edge decay (DASH).
834
-
835
- ### v0.6.1
836
-
837
- - Embedding version tracking, batch backfill, deeper retraction propagation, retrieval timeouts, channel push delivery.
838
-
839
- ### v0.6.0
840
-
841
- - **Memory taxonomy** — memories classified as `episodic`, `semantic`, `procedural`, or `unclassified`. Auto-classified on write. Filter by type on recall.
842
- - **Query-adaptive retrieval** — pipeline adapts to query type: `targeted` | `exploratory` | `balanced` | `auto`.
843
- - **Decision propagation** — decisions broadcast to coordination layer for cross-agent discovery.
844
- - **Eval harness** — `npm run eval` benchmarks retrieval, associative, redundancy, and temporal performance.
845
- - **DB hardening** — busy_timeout, integrity check on startup, hot backups every 10 min, WAL checkpoint on shutdown.
582
+ ## What's New in v0.12.x (latest)
583
+
584
+ Three releases (0.12.0-0.12.2), eval-driven. All additive, no breaking API changes.
585
+
586
+ - **Instance identity (`memory_whoami`)** — agent id, workspace, mode, backend, store
587
+ path, code provenance, sibling agent spaces. Call it first whenever you're unsure
588
+ which store or which running code you're talking to.
589
+ - **Entity inverted index** structured identifier tags (`ticket=`, `person=`, bare
590
+ ids) feed an exact-match index. A query naming an entity resolves through it even
591
+ when the wording doesn't lexically match. Default off (`AWM_ENTITY_INDEX_FETCH=1`),
592
+ guaranteed reranker audition, no score boost.
593
+ - **Local-first security defaults** HTTP binds `127.0.0.1` by default; widening
594
+ beyond loopback without `AWM_API_KEY` fails closed.
595
+ - **Write-path telemetry** always-on slow-write attribution (`AWM_SLOW_WRITE_MS`,
596
+ default 250ms) names the phase, event-loop lag, and cold-load cost on any write
597
+ that's slow enough to matter.
598
+ - **Memory spine (provenance)** `origin_class`, `recipe_id`, `valid_from`/`valid_to`
599
+ on every write. `valid_to` expires operational facts instead of relying on the
600
+ reader to notice they're stale; recall renders `[valid until ...]` on results
601
+ carrying it.
602
+ - **Cognition recipes** — AWM contains no LLM. When memory needs real thinking
603
+ (distilling a procedure, reflecting on a failure), `memory_task_end` hands the host
604
+ agent a versioned prompt+contract pair (`skill-derivation@1`, `friction-lesson@1`)
605
+ to run as its own focused pass, then validates the write-back.
606
+ - **Recall results carry engram ids** (`[id: <uuid>]`) feed a recalled memory
607
+ straight into `memory_supersede`/`memory_feedback` with no separate lookup.
608
+ - **Eager warm at MCP startup + sidecar warm recall** model load overlaps session
609
+ start instead of your first message; the hook sidecar gained `POST /memory/activate`
610
+ for ~0.8s warm recall from a hook, with no standing server needed.
611
+ - **Gauntlet baseline** — end-to-end memory ablation now anchors acceptance:
612
+ **74%±5pp memory-dependent vs 0% no-memory control**, six of nine probes at 100%.
613
+ See [`docs/gauntlet-baseline-2026-07-30.md`](docs/gauntlet-baseline-2026-07-30.md).
614
+
615
+ Full version-by-version history every release back to v0.6.0, including the
616
+ 0.7.6→0.7.14 latency work (11s→300ms) and the 0.8.5 recall-quality hardening pass —
617
+ lives in the changelog, not here:
846
618
 
847
619
  See [CHANGELOG.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/CHANGELOG.md) for full details.
848
620
 
@@ -889,24 +661,26 @@ gotchas (incl. the Windows CRLF/s6 clone fix) — is in
889
661
 
890
662
  ## Project Status
891
663
 
892
- AWM is in active development (v0.8.5). The core memory pipeline, consolidation
664
+ AWM is in active development (v0.12.2). The core memory pipeline, consolidation
893
665
  system, multi-agent coordination, and MCP integration are stable and used
894
666
  daily in production coding workflows.
895
667
 
896
668
  - Core retrieval and consolidation: **stable**
897
- - MCP tools and Claude Code integration: **stable**
669
+ - MCP tools and Claude Code integration: **stable** (19 tools: 17 memory + 2 onboarding)
898
670
  - 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
899
671
  - Multi-agent coordination: **stable** (v0.8.1 hardening)
900
672
  - Task management: **stable**
901
- - Hook sidecar and auto-checkpoint: **stable**
673
+ - Hook sidecar and auto-checkpoint: **stable** — plus `POST /memory/activate` warm recall for hooks (v0.12.2)
902
674
  - HTTP API: **stable** (for custom agents)
903
- - Eval harness: **stable** (v0.6.0, extended through 0.8.x)
675
+ - Eval harness: **stable** (v0.6.0, extended through 0.8.x); gauntlet acceptance test added (v0.12.0)
904
676
  - Recall confidence + opt-in abstention (PR-1, PR-2): **stable** (v0.8.5)
905
677
  - Coherence-weighted retraction + counter-narrative inheritance: **stable** (v0.8.5)
906
678
  - Content fade stage + adaptive output granularity: **stable** (v0.8.5)
907
679
  - PGlite backend (alternative to SQLite, with pgvector + ivfflat): **stable** (v0.8.x)
908
680
  - Networked Postgres backend (`pg` + pgvector, multi-connection): **experimental** (v0.10.0)
909
681
  - Backend-agnostic `import`/`export` (embeddings included, cross-backend port): **stable** (v0.10.0)
682
+ - 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)
683
+ - Entity inverted index + guarded index-backed retrieval: **stable, opt-in** (`AWM_ENTITY_INDEX_FETCH=1`, default off pending broader eval) (v0.12.0)
910
684
 
911
685
  See [CHANGELOG.md](https://github.com/CompleteIdeas/agent-working-memory/blob/master/CHANGELOG.md) for version history.
912
686
 
@@ -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;AAG7E,QAAA,MAAM,OAAO,EAAE,UAwMd,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;AAsC7E,QAAA,MAAM,OAAO,EAAE,UAoOd,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -9,6 +9,40 @@
9
9
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
10
10
  import { join, dirname, basename } from 'node:path';
11
11
  import { resolveMcpCommand, homedir, AWM_INSTRUCTION_CONTENT, upsertAwmSection } from './common.js';
12
+ /**
13
+ * DB-mutation reminder hook (PostToolUse on Bash|PowerShell).
14
+ * Fires when a shell command runs sqlcmd/mysql/psql with mutation keywords and
15
+ * injects a reminder that the mutation must be recorded via memory_write.
16
+ * Origin: 2026-07-29 tblOSCMPImportDivisionMatch incident — an unrecorded
17
+ * script INSERT broke a production upload six days later, and no recall could
18
+ * surface a cause that was never written.
19
+ */
20
+ const DB_MUTATION_HOOK_SCRIPT = `#!/usr/bin/env node
21
+ // AWM DB-mutation reminder hook (PostToolUse on Bash|PowerShell). Installed by awm setup.
22
+ let raw = '';
23
+ process.stdin.on('data', (d) => (raw += d));
24
+ process.stdin.on('end', () => {
25
+ try {
26
+ const j = JSON.parse(raw || '{}');
27
+ const cmd = (j.tool_input && j.tool_input.command) || '';
28
+ const isDbClient = /\\b(sqlcmd|mysql|psql)\\b/i.test(cmd) || /(sqlcmd|mysql|psql)\\.exe/i.test(cmd);
29
+ const isMutation = /\\b(INSERT|UPDATE|DELETE|ALTER|TRUNCATE|DROP|MERGE)\\b/i.test(cmd);
30
+ if (isDbClient && isMutation) {
31
+ console.log(JSON.stringify({
32
+ hookSpecificOutput: {
33
+ hookEventName: 'PostToolUse',
34
+ additionalContext:
35
+ 'AWM REMINDER: this command contains a production DB mutation (INSERT/UPDATE/DELETE/ALTER/DROP/TRUNCATE/MERGE). ' +
36
+ 'The change is NOT complete until it is recorded: call memory_write NOW with the table, what changed, row counts, date, and why ' +
37
+ '(memory_class canonical if other agents must recall it), and confirm a rollback/backup exists. ' +
38
+ 'If the keywords were only in a string/comment or on temp tables (#...), no write is needed.',
39
+ },
40
+ }));
41
+ }
42
+ } catch (e) { /* never block the tool result */ }
43
+ process.exit(0);
44
+ });
45
+ `;
12
46
  const adapter = {
13
47
  id: 'claude-code',
14
48
  name: 'Claude Code',
@@ -102,12 +136,34 @@ const adapter = {
102
136
  timeout: 5,
103
137
  }],
104
138
  }];
139
+ // PostToolUse — DB-mutation reminder: a production data change is not
140
+ // complete until it is memory_written. Deploy the script, then merge the
141
+ // hook entry (preserve any unrelated PostToolUse groups the user has).
142
+ const hooksDir = join(homedir(), '.claude', 'hooks');
143
+ if (!existsSync(hooksDir)) {
144
+ mkdirSync(hooksDir, { recursive: true });
145
+ }
146
+ const mutationHookPath = join(hooksDir, 'awm-db-mutation-reminder.cjs');
147
+ writeFileSync(mutationHookPath, DB_MUTATION_HOOK_SCRIPT);
148
+ const mutationHookCmd = `node "${mutationHookPath.replace(/\\/g, '/')}"`;
149
+ const otherPostToolUse = (settings.hooks.PostToolUse || []).filter((g) => !JSON.stringify(g).includes('awm-db-mutation-reminder'));
150
+ settings.hooks.PostToolUse = [
151
+ ...otherPostToolUse,
152
+ {
153
+ matcher: 'Bash|PowerShell',
154
+ hooks: [{
155
+ type: 'command',
156
+ command: mutationHookCmd,
157
+ timeout: 10,
158
+ }],
159
+ },
160
+ ];
105
161
  const settingsDir = dirname(settingsPath);
106
162
  if (!existsSync(settingsDir)) {
107
163
  mkdirSync(settingsDir, { recursive: true });
108
164
  }
109
165
  writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
110
- return `Hooks: Stop + PreCompact + SessionEnd (port ${ctx.hookPort})`;
166
+ return `Hooks: Stop + PreCompact + SessionEnd (port ${ctx.hookPort}) + PostToolUse DB-mutation reminder`;
111
167
  },
112
168
  diagnose(ctx) {
113
169
  const results = [];
@@ -183,8 +239,12 @@ const adapter = {
183
239
  try {
184
240
  const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
185
241
  const hasHooks = settings.hooks?.PreCompact && settings.hooks?.SessionEnd;
186
- if (hasHooks) {
187
- results.push({ check: 'Hooks', status: 'ok', message: 'PreCompact + SessionEnd configured' });
242
+ const hasMutationHook = JSON.stringify(settings.hooks?.PostToolUse || []).includes('awm-db-mutation-reminder');
243
+ if (hasHooks && hasMutationHook) {
244
+ results.push({ check: 'Hooks', status: 'ok', message: 'PreCompact + SessionEnd + DB-mutation reminder configured' });
245
+ }
246
+ else if (hasHooks) {
247
+ results.push({ check: 'Hooks', status: 'warn', message: 'Checkpoint hooks ok; DB-mutation reminder missing (re-run awm setup)' });
188
248
  }
189
249
  else {
190
250
  results.push({ check: 'Hooks', status: 'warn', message: 'Hooks partially configured' });
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sCAAsC;AAEtC;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpG,MAAM,OAAO,GAAe;IAC1B,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,aAAa;IACnB,oBAAoB,EAAE,IAAI;IAC1B,mBAAmB,EAAE,IAAI;IAEzB,cAAc,CAAC,GAAiB;QAC9B,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAElD,4DAA4D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