@danielsimonjr/memory-mcp 12.2.3 → 12.5.2

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 (158) hide show
  1. package/README.md +88 -102
  2. package/dist/index.js +6 -0
  3. package/dist/server/toolDefinitions.d.ts.map +1 -1
  4. package/dist/server/toolDefinitions.js +745 -3
  5. package/dist/server/toolHandlers.d.ts +1 -9
  6. package/dist/server/toolHandlers.d.ts.map +1 -1
  7. package/dist/server/toolHandlers.js +859 -11
  8. package/package.json +9 -6
  9. package/dist/core/EntityManager.d.ts +0 -263
  10. package/dist/core/EntityManager.d.ts.map +0 -1
  11. package/dist/core/EntityManager.js +0 -478
  12. package/dist/core/GraphStorage.d.ts +0 -344
  13. package/dist/core/GraphStorage.d.ts.map +0 -1
  14. package/dist/core/GraphStorage.js +0 -708
  15. package/dist/core/GraphTraversal.d.ts +0 -136
  16. package/dist/core/GraphTraversal.d.ts.map +0 -1
  17. package/dist/core/GraphTraversal.js +0 -556
  18. package/dist/core/HierarchyManager.d.ts +0 -111
  19. package/dist/core/HierarchyManager.d.ts.map +0 -1
  20. package/dist/core/HierarchyManager.js +0 -224
  21. package/dist/core/ManagerContext.d.ts +0 -72
  22. package/dist/core/ManagerContext.d.ts.map +0 -1
  23. package/dist/core/ManagerContext.js +0 -118
  24. package/dist/core/ObservationManager.d.ts +0 -85
  25. package/dist/core/ObservationManager.d.ts.map +0 -1
  26. package/dist/core/ObservationManager.js +0 -123
  27. package/dist/core/RelationManager.d.ts +0 -131
  28. package/dist/core/RelationManager.d.ts.map +0 -1
  29. package/dist/core/RelationManager.js +0 -210
  30. package/dist/core/SQLiteStorage.d.ts +0 -354
  31. package/dist/core/SQLiteStorage.d.ts.map +0 -1
  32. package/dist/core/SQLiteStorage.js +0 -917
  33. package/dist/core/StorageFactory.d.ts +0 -45
  34. package/dist/core/StorageFactory.d.ts.map +0 -1
  35. package/dist/core/StorageFactory.js +0 -64
  36. package/dist/core/TransactionManager.d.ts +0 -259
  37. package/dist/core/TransactionManager.d.ts.map +0 -1
  38. package/dist/core/TransactionManager.js +0 -392
  39. package/dist/core/index.d.ts +0 -16
  40. package/dist/core/index.d.ts.map +0 -1
  41. package/dist/core/index.js +0 -17
  42. package/dist/features/AnalyticsManager.d.ts +0 -44
  43. package/dist/features/AnalyticsManager.d.ts.map +0 -1
  44. package/dist/features/AnalyticsManager.js +0 -223
  45. package/dist/features/ArchiveManager.d.ts +0 -121
  46. package/dist/features/ArchiveManager.d.ts.map +0 -1
  47. package/dist/features/ArchiveManager.js +0 -240
  48. package/dist/features/CompressionManager.d.ts +0 -109
  49. package/dist/features/CompressionManager.d.ts.map +0 -1
  50. package/dist/features/CompressionManager.js +0 -404
  51. package/dist/features/IOManager.d.ts +0 -221
  52. package/dist/features/IOManager.d.ts.map +0 -1
  53. package/dist/features/IOManager.js +0 -997
  54. package/dist/features/StreamingExporter.d.ts +0 -105
  55. package/dist/features/StreamingExporter.d.ts.map +0 -1
  56. package/dist/features/StreamingExporter.js +0 -150
  57. package/dist/features/TagManager.d.ts +0 -147
  58. package/dist/features/TagManager.d.ts.map +0 -1
  59. package/dist/features/TagManager.js +0 -210
  60. package/dist/features/index.d.ts +0 -12
  61. package/dist/features/index.d.ts.map +0 -1
  62. package/dist/features/index.js +0 -11
  63. package/dist/search/BasicSearch.d.ts +0 -51
  64. package/dist/search/BasicSearch.d.ts.map +0 -1
  65. package/dist/search/BasicSearch.js +0 -137
  66. package/dist/search/BooleanSearch.d.ts +0 -98
  67. package/dist/search/BooleanSearch.d.ts.map +0 -1
  68. package/dist/search/BooleanSearch.js +0 -430
  69. package/dist/search/EmbeddingService.d.ts +0 -178
  70. package/dist/search/EmbeddingService.d.ts.map +0 -1
  71. package/dist/search/EmbeddingService.js +0 -358
  72. package/dist/search/FuzzySearch.d.ts +0 -118
  73. package/dist/search/FuzzySearch.d.ts.map +0 -1
  74. package/dist/search/FuzzySearch.js +0 -312
  75. package/dist/search/RankedSearch.d.ts +0 -71
  76. package/dist/search/RankedSearch.d.ts.map +0 -1
  77. package/dist/search/RankedSearch.js +0 -238
  78. package/dist/search/SavedSearchManager.d.ts +0 -79
  79. package/dist/search/SavedSearchManager.d.ts.map +0 -1
  80. package/dist/search/SavedSearchManager.js +0 -145
  81. package/dist/search/SearchFilterChain.d.ts +0 -120
  82. package/dist/search/SearchFilterChain.d.ts.map +0 -1
  83. package/dist/search/SearchFilterChain.js +0 -185
  84. package/dist/search/SearchManager.d.ts +0 -285
  85. package/dist/search/SearchManager.d.ts.map +0 -1
  86. package/dist/search/SearchManager.js +0 -338
  87. package/dist/search/SearchSuggestions.d.ts +0 -27
  88. package/dist/search/SearchSuggestions.d.ts.map +0 -1
  89. package/dist/search/SearchSuggestions.js +0 -57
  90. package/dist/search/SemanticSearch.d.ts +0 -146
  91. package/dist/search/SemanticSearch.d.ts.map +0 -1
  92. package/dist/search/SemanticSearch.js +0 -313
  93. package/dist/search/TFIDFIndexManager.d.ts +0 -63
  94. package/dist/search/TFIDFIndexManager.d.ts.map +0 -1
  95. package/dist/search/TFIDFIndexManager.js +0 -215
  96. package/dist/search/VectorStore.d.ts +0 -235
  97. package/dist/search/VectorStore.d.ts.map +0 -1
  98. package/dist/search/VectorStore.js +0 -311
  99. package/dist/search/index.d.ts +0 -18
  100. package/dist/search/index.d.ts.map +0 -1
  101. package/dist/search/index.js +0 -21
  102. package/dist/types/index.d.ts +0 -13
  103. package/dist/types/index.d.ts.map +0 -1
  104. package/dist/types/index.js +0 -12
  105. package/dist/types/types.d.ts +0 -1234
  106. package/dist/types/types.d.ts.map +0 -1
  107. package/dist/types/types.js +0 -9
  108. package/dist/utils/compressedCache.d.ts +0 -192
  109. package/dist/utils/compressedCache.d.ts.map +0 -1
  110. package/dist/utils/compressedCache.js +0 -309
  111. package/dist/utils/compressionUtil.d.ts +0 -214
  112. package/dist/utils/compressionUtil.d.ts.map +0 -1
  113. package/dist/utils/compressionUtil.js +0 -247
  114. package/dist/utils/constants.d.ts +0 -245
  115. package/dist/utils/constants.d.ts.map +0 -1
  116. package/dist/utils/constants.js +0 -252
  117. package/dist/utils/entityUtils.d.ts +0 -321
  118. package/dist/utils/entityUtils.d.ts.map +0 -1
  119. package/dist/utils/entityUtils.js +0 -538
  120. package/dist/utils/errors.d.ts +0 -77
  121. package/dist/utils/errors.d.ts.map +0 -1
  122. package/dist/utils/errors.js +0 -121
  123. package/dist/utils/formatters.d.ts +0 -145
  124. package/dist/utils/formatters.d.ts.map +0 -1
  125. package/dist/utils/formatters.js +0 -132
  126. package/dist/utils/index.d.ts +0 -22
  127. package/dist/utils/index.d.ts.map +0 -1
  128. package/dist/utils/index.js +0 -75
  129. package/dist/utils/indexes.d.ts +0 -270
  130. package/dist/utils/indexes.d.ts.map +0 -1
  131. package/dist/utils/indexes.js +0 -526
  132. package/dist/utils/logger.d.ts +0 -24
  133. package/dist/utils/logger.d.ts.map +0 -1
  134. package/dist/utils/logger.js +0 -33
  135. package/dist/utils/parallelUtils.d.ts +0 -72
  136. package/dist/utils/parallelUtils.d.ts.map +0 -1
  137. package/dist/utils/parallelUtils.js +0 -169
  138. package/dist/utils/schemas.d.ts +0 -374
  139. package/dist/utils/schemas.d.ts.map +0 -1
  140. package/dist/utils/schemas.js +0 -484
  141. package/dist/utils/searchAlgorithms.d.ts +0 -99
  142. package/dist/utils/searchAlgorithms.d.ts.map +0 -1
  143. package/dist/utils/searchAlgorithms.js +0 -167
  144. package/dist/utils/searchCache.d.ts +0 -108
  145. package/dist/utils/searchCache.d.ts.map +0 -1
  146. package/dist/utils/searchCache.js +0 -209
  147. package/dist/utils/taskScheduler.d.ts +0 -290
  148. package/dist/utils/taskScheduler.d.ts.map +0 -1
  149. package/dist/utils/taskScheduler.js +0 -466
  150. package/dist/workers/WorkerPool.d.ts +0 -81
  151. package/dist/workers/WorkerPool.d.ts.map +0 -1
  152. package/dist/workers/WorkerPool.js +0 -121
  153. package/dist/workers/index.d.ts +0 -12
  154. package/dist/workers/index.d.ts.map +0 -1
  155. package/dist/workers/index.js +0 -9
  156. package/dist/workers/levenshteinWorker.d.ts +0 -60
  157. package/dist/workers/levenshteinWorker.d.ts.map +0 -1
  158. package/dist/workers/levenshteinWorker.js +0 -98
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Memory MCP Server
2
2
 
3
- [![Version](https://img.shields.io/badge/version-12.2.0-blue.svg)](https://github.com/danielsimonjr/memory-mcp)
3
+ [![Version](https://img.shields.io/badge/version-12.5.1-blue.svg)](https://github.com/danielsimonjr/memory-mcp)
4
4
  [![NPM](https://img.shields.io/npm/v/@danielsimonjr/memory-mcp.svg)](https://www.npmjs.com/package/@danielsimonjr/memory-mcp)
5
5
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
6
6
  [![MCP](https://img.shields.io/badge/MCP-1.0-purple.svg)](https://modelcontextprotocol.io)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.6-blue.svg)](https://www.typescriptlang.org/)
8
- [![Coverage](https://img.shields.io/badge/coverage-96.6%25-brightgreen.svg)](docs/architecture/TEST_COVERAGE.md)
8
+ [![Coverage](https://img.shields.io/badge/coverage-80.7%25-yellow.svg)](docs/architecture/TEST_COVERAGE.md)
9
9
 
10
10
  An **enhanced fork** of the official [Model Context Protocol](https://modelcontextprotocol.io) memory server with advanced features for **hierarchical nesting**, **intelligent compression**, **semantic search**, **graph algorithms**, **archiving**, **advanced search**, and **multi-format import/export**.
11
11
 
12
- > **Enterprise-grade knowledge graph** with **160 tools** including hierarchical organization, semantic search with embeddings, graph traversal algorithms, duplicate detection, smart archiving, project scoping, temporal knowledge graph, semantic forget, agent diary, **entity bitemporal validity (η.4.4)**, **optimistic concurrency control (η.5.5.c)**, **role-based access control (η.6.1)**, **W3C Linked Data exports** (Turtle / JSON-LD / RDF/XML — η.5.4), **PII redaction on export** (η.6.3), **procedural memory (3B.4)**, **active retrieval (3B.5)**, **causal reasoning (3B.6)**, and **world model (3B.7)** for long-term memory management.
12
+ > **Enterprise-grade knowledge graph** with **213 tools** including hierarchical organization, semantic search with embeddings, graph traversal algorithms, duplicate detection, smart archiving, project scoping, temporal knowledge graph, semantic forget, agent diary, **entity bitemporal validity (η.4.4)**, **optimistic concurrency control (η.5.5.c)**, **role-based access control (η.6.1)**, **W3C Linked Data exports** (Turtle / JSON-LD / RDF/XML — η.5.4), **PII redaction on export** (η.6.3), **procedural memory (3B.4)**, **active retrieval (3B.5)**, **causal reasoning (3B.6)**, **world model (3B.7)**, **`do_not_remember` exclusions**, **decision rationale** (ADR memory + markdown dual-write), **structured project context** (facts / conventions / commands / glossary), **heuristic guidelines**, **tool affordance + ToolCallObserver pipeline** (with MCP shim), **observation dedup**, and **spell correction** (memoryjs v2.1.0 — Phase 16) for long-term memory management.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -46,9 +46,10 @@ An **enhanced fork** of the official [Model Context Protocol](https://modelconte
46
46
  | **Memory Compression** | 4 | Intelligent duplicate detection and merging with similarity scoring |
47
47
  | **Advanced Search** | 7 | TF-IDF ranking, boolean queries, fuzzy matching, auto-select |
48
48
  | **Observation Normalization** | 1 | Coreference resolution and temporal anchoring |
49
- | **Tag Management** | 11 | Tags, aliases, bulk operations, importance scores |
49
+ | **Tag Management** | 6 | Tags, bulk operations, importance scores |
50
+ | **Tag Aliases** | 5 | Tag synonym/alias management |
50
51
  | **Saved Searches** | 5 | Store and execute frequent queries |
51
- | **Import/Export** | 2 | 7 export formats with brotli compression, 3 import formats |
52
+ | **Import/Export** | 2 | 7 export formats (incl. W3C Linked Data: Turtle / JSON-LD / RDF/XML) with brotli + PII redaction; 3 import formats |
52
53
  | **Graph Analytics** | 2 | Statistics, validation, integrity checks |
53
54
  | **Ref Index** | 4 | Cross-session symbolic reference registration and resolution |
54
55
  | **Artifacts** | 3 | Named versioned content blobs attached to entities |
@@ -64,6 +65,7 @@ An **enhanced fork** of the official [Model Context Protocol](https://modelconte
64
65
  | **Collaborative** | 1 | Multi-agent context synthesis |
65
66
  | **Failure Handling** | 2 | Session failure distillation and graceful session end |
66
67
  | **Cognitive Load** | 2 | Working-memory load analysis and adaptive reduction |
68
+ | **Dream Engine** | 3 | Background memory maintenance: 8-phase sleep-cycle consolidation |
67
69
  | **Project Scoping** | 1 | List and filter entities by project |
68
70
  | **Memory Versioning** | 2 | Entity version chains and per-entity version history |
69
71
  | **Semantic Forget** | 1 | Two-tier deletion: exact match → semantic similarity fallback |
@@ -71,6 +73,21 @@ An **enhanced fork** of the official [Model Context Protocol](https://modelconte
71
73
  | **Temporal KG** | 3 | Temporal relation invalidation, time-travel queries, relation timeline |
72
74
  | **Ingestion** | 1 | Format-agnostic conversation/document ingestion pipeline |
73
75
  | **Agent Diary** | 2 | Per-agent persistent journal write and read |
76
+ | **Session & Working Memory** | 9 | Session lifecycle, working memory CRUD, TTL, promotion, context wake-up *(Phase 14)* |
77
+ | **Auto-Enhancement** | 3 | Auto-link entity mentions, fact extraction, contradiction detection *(Phase 14)* |
78
+ | **Context Compression** | 1 | N-gram text abbreviation with legend for token savings *(Phase 14)* |
79
+ | **Consolidation Pipeline** | 3 | Session consolidation, pattern detection, entity summarization *(Phase 14)* |
80
+ | **Decay & Salience** | 5 | Time-based decay, importance scoring, weak memory cleanup, reinforcement *(Phase 14)* |
81
+ | **Multi-Agent** | 5 | Agent registration, cross-agent search, visibility, conflict resolution *(Phase 14)* |
82
+ | **Observability** | 4 | D3.js graph visualization, transcript splitting, query cost estimation *(Phase 14)* |
83
+ | **Dedup** | 1 | Priority-based smart deduplication *(Phase 14)* |
84
+ | **Entity Bitemporal** | 5 | Time-travel queries: invalidate entities/observations, entity_as_of, timelines *(Phase 15 / η.4.4)* |
85
+ | **Optimistic Concurrency** | 1 | `update_entity` with `expectedVersion` → `VersionConflictError` on stale *(Phase 15 / η.5.5.c)* |
86
+ | **RBAC** | 4 | Role-based access control: assign/revoke/check/list reader/writer/admin/owner permissions *(Phase 15 / η.6.1)* |
87
+ | **Procedural Memory** | 5 | Executable how-to sequences with EWMA-refined success rate *(Phase 15 / 3B.4)* |
88
+ | **Active Retrieval** | 1 | Iterative query rewriting until coverage threshold met *(Phase 15 / 3B.5)* |
89
+ | **Causal Reasoning** | 4 | Chain discovery, counterfactual queries, cycle detection *(Phase 15 / 3B.6)* |
90
+ | **World Model** | 3 | Graph snapshots, fact validation, outcome prediction *(Phase 15 / 3B.7)* |
74
91
 
75
92
  ### Comparison with Official Memory Server
76
93
 
@@ -93,8 +110,8 @@ An **enhanced fork** of the official [Model Context Protocol](https://modelconte
93
110
  | **Backup & Restore** | ❌ | ✅ Compressed snapshots |
94
111
  | **Intelligent Search** | ❌ | ✅ Hybrid + Query Analysis + Reflection |
95
112
  | **Observation Normalization** | ❌ | ✅ Coreference resolution + temporal anchoring |
96
- | **Total Tools** | 11 | **106** |
97
- | **Code Structure** | Monolithic | **Modular** (77 files) |
113
+ | **Total Tools** | 11 | **160** |
114
+ | **Code Structure** | Monolithic | **Modular** (5 src files in this repo; core graph in [`@danielsimonjr/memoryjs`](https://www.npmjs.com/package/@danielsimonjr/memoryjs)) |
98
115
 
99
116
  ## Quick Start
100
117
 
@@ -163,7 +180,7 @@ cd memory-mcp
163
180
  npm install
164
181
  npm run build
165
182
 
166
- # Run tests (2800+ tests)
183
+ # Run tests (665 tests, >80% statement coverage)
167
184
  npm test
168
185
 
169
186
  # Type check
@@ -628,7 +645,7 @@ node dist/migrate-from-jsonl-to-sqlite.js --from memory.db --to memory.jsonl
628
645
  ```bash
629
646
  npm install # Install dependencies
630
647
  npm run build # Build TypeScript
631
- npm test # Run tests (2800+ tests)
648
+ npm test # Run tests (665 tests across 26 files; >80% coverage)
632
649
  npm run typecheck # Strict type checking
633
650
  npm run watch # Development watch mode
634
651
  npm run clean # Remove dist/ directory
@@ -637,113 +654,78 @@ npm run docs:deps # Generate dependency graph
637
654
 
638
655
  ### Architecture
639
656
 
657
+ After the **Phase 13 extraction**, this repo is a thin MCP wrapper. All graph logic, managers, and storage live in [`@danielsimonjr/memoryjs`](https://www.npmjs.com/package/@danielsimonjr/memoryjs) (currently `^1.15.0`).
658
+
640
659
  ```
641
- ┌─────────────────────────────────────────────────────┐
642
- │ Layer 1: MCP Protocol Layer │
643
- server/MCPServer.ts + toolDefinitions (160 tools)
644
- + toolHandlers + responseCompressor
645
- └──────────────────────┬──────────────────────────────┘
646
-
647
- ┌──────────────────────┴──────────────────────────────┐
648
- │ Layer 2: Managers + Context (Lazy Initialization) │
649
- │ ManagerContext (aliased as KnowledgeGraphManager)
650
- │ • EntityManager (CRUD + hierarchy + archive) │
651
- │ • RelationManager (relation CRUD) │
652
- │ • SearchManager (search + compression + stats) │
653
- │ • IOManager (import + export + backup) │
654
- │ • TagManager (tag aliases) │
655
- │ • GraphTraversal (path finding, centrality) │
656
- │ • SemanticSearch (embeddings, similarity) │
657
- └──────────────────────┬──────────────────────────────┘
658
-
659
- ┌──────────────────────┴──────────────────────────────┐
660
- │ Layer 3: Storage Layer │
661
- │ core/GraphStorage.ts (JSONL + in-memory cache) │
662
- │ core/SQLiteStorage.ts (better-sqlite3 + FTS5) │
663
- │ core/StorageFactory.ts (backend selection) │
664
- └─────────────────────────────────────────────────────┘
660
+ memory-mcp (this repo) @danielsimonjr/memoryjs (npm dep)
661
+ ┌──────────────────────────┐ ┌──────────────────────────────────┐
662
+ src/index.ts │ │ ManagerContext (lazy init)
663
+ src/server/MCPServer.ts │───────▶│ EntityManager, RelationManager
664
+ │ src/server/toolDefs.ts │imports │ SearchManager, IOManager, etc. │
665
+ src/server/toolHandlers │ │ GraphStorage / SQLiteStorage │
666
+ │ src/server/responseComp.│ │ StorageFactory + 100+ modules │
667
+ └──────────────────────────┘ └──────────────────────────────────┘
668
+ 5 source files 77+ source files (extracted)
669
+ MCP protocol + dispatch All graph + search + storage
665
670
  ```
666
671
 
672
+ | Layer | Lives in | Files |
673
+ |-------|----------|-------|
674
+ | MCP protocol (stdio transport, tool registration, dispatch) | `memory-mcp` | 5 |
675
+ | Tool schemas (160 tools across 51 categories) | `memory-mcp` (`toolDefinitions.ts`) | 1 |
676
+ | Handler registry + Zod validation + response compression | `memory-mcp` (`toolHandlers.ts` + `responseCompressor.ts`) | 2 |
677
+ | Managers (Entity / Relation / Search / IO / Tag / Hierarchy / Analytics / Compression / Archive / GraphTraversal / SemanticSearch / RankedSearch / etc.) | `memoryjs` | 100+ |
678
+ | Storage (JSONL + SQLite with FTS5 + StorageFactory + TransactionManager) | `memoryjs` | — |
679
+ | Embedding providers (OpenAI / local / none) + VectorStore | `memoryjs` | — |
680
+
667
681
  ### Project Structure
668
682
 
669
683
  ```
670
684
  memory-mcp/
671
- ├── src/ # Source (77 TypeScript files)
672
- │ ├── index.ts # Entry point
673
- ├── core/ # Core managers (12 files)
674
- ├── ManagerContext.ts # Context holder (lazy init)
675
- ├── EntityManager.ts # Entity CRUD + hierarchy
676
- ├── RelationManager.ts # Relation CRUD
677
- │ ├── GraphStorage.ts # JSONL I/O + caching
678
- │ │ ├── SQLiteStorage.ts # SQLite with better-sqlite3
679
- ├── TransactionManager.ts # ACID transactions
680
- ├── StorageFactory.ts # Storage backend factory
681
- ├── HierarchyManager.ts # Tree operations
682
- ├── ObservationManager.ts # Observation CRUD
683
- │ ├── GraphTraversal.ts # Path finding, centrality
684
- │ │ ├── GraphEventEmitter.ts # Event system
685
- │ │ └── index.ts
686
- │ ├── server/ # MCP protocol (4 files)
687
- ├── MCPServer.ts # Server setup
688
- ├── toolDefinitions.ts # 160 tool schemas
689
- ├── toolHandlers.ts # Handler registry
690
- └── responseCompressor.ts # Brotli compression
691
- ├── search/ # Search implementations (29 files)
692
- ├── SearchManager.ts # Search orchestrator
693
- ├── BasicSearch.ts # Text matching
694
- ├── RankedSearch.ts # TF-IDF scoring
695
- │ ├── BooleanSearch.ts # AND/OR/NOT logic
696
- │ │ ├── FuzzySearch.ts # Typo tolerance
697
- │ │ ├── SemanticSearch.ts # Embedding-based
698
- │ │ ├── EmbeddingService.ts # Provider abstraction
699
- │ │ ├── VectorStore.ts # Vector storage
700
- │ │ └── ... # + 12 more
701
- │ ├── features/ # Advanced capabilities (9 files)
702
- │ │ ├── IOManager.ts # Import/export/backup
703
- │ │ ├── TagManager.ts # Tag aliases
704
- │ │ ├── AnalyticsManager.ts # Graph stats
705
- │ │ ├── ArchiveManager.ts # Entity archival
706
- │ │ ├── CompressionManager.ts # Duplicate detection
707
- │ │ ├── StreamingExporter.ts # Large graph exports
708
- │ │ ├── ObservationNormalizer.ts # Coreference resolution
709
- │ │ ├── KeywordExtractor.ts # Keyword extraction
710
- │ │ └── index.ts
711
- │ ├── types/ # TypeScript definitions (2 files)
712
- │ ├── utils/ # Shared utilities (18 files)
713
- │ └── workers/ # Worker pool (2 files)
714
- ├── tests/ # Test suite (97 files, 2800+ tests)
715
- │ ├── unit/ # Unit tests
716
- │ ├── integration/ # Integration tests
717
- │ ├── e2e/ # End-to-end tests
718
- │ └── performance/ # Benchmarks
719
- ├── dist/ # Compiled output
720
- ├── docs/ # Documentation
721
- │ ├── architecture/ # Architecture docs
722
- │ ├── guides/ # User guides
723
- │ └── reports/ # Sprint reports
724
- ├── tools/ # Standalone utilities
725
- │ ├── chunking-for-files/ # File splitting
726
- │ ├── compress-for-context/ # CTON compression
727
- │ ├── create-dependency-graph/ # Dependency analyzer
728
- │ └── migrate-from-jsonl-to-sqlite/
729
- ├── CHANGELOG.md # Version history
730
- └── README.md # This file
685
+ ├── src/ # Source (5 TypeScript files)
686
+ │ ├── index.ts # Entry point: ManagerContext + start MCPServer; re-exports memoryjs types
687
+ └── server/
688
+ ├── MCPServer.ts # MCP Server setup, stdio transport, request handlers
689
+ ├── toolDefinitions.ts # 160 tool schemas (name, description, inputSchema)
690
+ ├── toolHandlers.ts # Handler registry: validate args → call manager → format response
691
+ └── responseCompressor.ts # Brotli + base64 wrapper for >256KB payloads
692
+ ├── tests/ # Test suite (26 files, 665 tests, >80% statement coverage)
693
+ │ ├── unit/ # Unit tests (response compressor, tool defs, validate-fact handler)
694
+ │ ├── integration/ # MCP server lifecycle
695
+ │ ├── e2e/tools/ # Per-category tool tests + handler-smoke broad coverage
696
+ │ ├── knowledge-graph.test.ts # Core graph operations (smoke against memoryjs)
697
+ └── file-path.test.ts # Storage path resolution
698
+ ├── dist/ # Compiled output (rebuilt on `npm install` via `prepare`)
699
+ ├── docs/ # Documentation
700
+ │ ├── architecture/ # API.md, ARCHITECTURE.md, COMPONENTS.md, OVERVIEW.md, TEST_COVERAGE.md
701
+ │ ├── guides/ # HIERARCHY.md, COMPRESSION.md, ARCHIVING.md, QUERY_LANGUAGE.md
702
+ │ ├── development/ # WORKFLOW.md
703
+ │ ├── roadmap/ # FUTURE_FEATURES.md, PERFORMANCE_AND_CAPABILITIES.md
704
+ │ └── reports/ # Historical sprint reports
705
+ ├── tools/ # Standalone utilities (each builds independently)
706
+ │ ├── chunking-for-files/ # File splitting
707
+ │ ├── compress-for-context/ # CTON compression
708
+ │ ├── create-dependency-graph/ # Dependency analyzer
709
+ └── migrate-from-jsonl-to-sqlite/ # Storage backend converter
710
+ ├── CHANGELOG.md # Version history
711
+ └── README.md # This file
731
712
  ```
732
713
 
733
714
  ### Dependencies
734
715
 
735
- **Production:**
736
- - `@modelcontextprotocol/sdk`: ^1.21.1
737
- - `better-sqlite3`: ^11.7.0
738
- - `zod`: ^4.1.13
739
- - `async-mutex`: ^0.5.0
740
- - `@danielsimonjr/workerpool`: ^10.0.1
716
+ **Production** (3 direct deps — everything else is transitive via memoryjs):
717
+ - `@danielsimonjr/memoryjs`: ^1.15.0 — knowledge graph engine (storage, managers, search, embeddings, RBAC, OCC, bitemporal, causal, etc.)
718
+ - `@modelcontextprotocol/sdk`: ^1.21.1 — MCP protocol implementation
719
+ - `zod`: ^3.24.1 — runtime input validation (schemas re-exported from memoryjs)
741
720
 
742
721
  **Development:**
743
722
  - `typescript`: ^5.6.2
744
723
  - `vitest`: ^4.0.13
745
724
  - `@vitest/coverage-v8`: ^4.0.13
746
- - `@types/better-sqlite3`: ^7.6.12
725
+ - `shx`: ^0.4.0 — cross-platform shell commands for `clean` script
726
+ - `@types/node`: ^22
727
+
728
+ > Note: `better-sqlite3`, `async-mutex`, `@danielsimonjr/workerpool`, and the embedding providers (OpenAI / `@xenova/transformers`) are **transitive deps via `@danielsimonjr/memoryjs`** since the Phase 13 extraction. They are not listed in this repo's `package.json`.
747
729
 
748
730
  ## Documentation
749
731
 
@@ -785,9 +767,13 @@ We welcome contributions!
785
767
 
786
768
  All notable changes are documented in **[CHANGELOG.md](CHANGELOG.md)**.
787
769
 
788
- **Current version**: v12.2.0 - [View full changelog](CHANGELOG.md)
770
+ **Current version**: v12.3.0 - [View full changelog](CHANGELOG.md)
789
771
 
790
772
  Recent highlights:
773
+ - **v12.3.0** (213 tools): **Phase 16** — 53 new tools surfacing memoryjs v2.1.0 across seven new manager surfaces: `do_not_remember` exclusion rules (5), decision rationale + ADR markdown dual-write (10), structured project context (12), heuristic guidelines (10), tool affordance + `ToolCallObserver` producer pipeline (11), observation dedup (2), spell correction (3). Bumped `@danielsimonjr/memoryjs` dep `^1.15.0` → `^2.1.0`.
774
+ - **v12.2.3**: Publishability — switched `@danielsimonjr/memoryjs` dep from local `file:` link to published `^1.15.0` (npm rejects `file:` deps for published packages).
775
+ - **v12.2.2**: Doc-only — roadmap completion audit grading Phase 6-15 status against current code.
776
+ - **v12.2.1**: Doc-only — comprehensive consistency pass across 68 markdown documents to align with v12.2.0's 160-tool surface.
791
777
  - **v12.2.0** (160 tools): 23 new tools — entity bitemporal validity (η.4.4), OCC update (η.5.5.c), RBAC (η.6.1), procedural memory (3B.4), active retrieval (3B.5), causal reasoning (3B.6), world model (3B.7), plus W3C Linked Data exports (η.5.4) and PII redaction (η.6.3) wired into existing `export_graph`. Plus four pre-publish fixes from end-to-end MCP smoke testing (memoryjs v1.14+).
792
778
  - **v12.1.0** (106 tools): 12 new tools — Project Scoping, Memory Versioning, Semantic Forget, Profiles, Temporal KG, Ingestion, Agent Diary (memoryjs v1.8.0/v1.9.0)
793
779
  - **v12.0.0** (94 tools): 32 new tools — Ref Index, Artifacts, Temporal Search, Distillation, Freshness, LLM Query, Governance, Role Profiles, Entropy, Consolidation, Formatter, Collaborative, Failure Handling, Cognitive Load
@@ -820,7 +806,7 @@ Enhanced fork of [Model Context Protocol memory server](https://github.com/model
820
806
  - Multi-format import/export with merge strategies
821
807
  - SQLite backend with better-sqlite3 (3-10x faster)
822
808
  - Transaction support with ACID guarantees
823
- - Comprehensive test suite (2800+ tests, 97 test files)
809
+ - Comprehensive test suite (665 tests, 26 test files in this wrapper repo; full-coverage core graph tests live in `@danielsimonjr/memoryjs`)
824
810
 
825
811
  ---
826
812
 
package/dist/index.js CHANGED
@@ -16,6 +16,12 @@ export { ManagerContext };
16
16
  // Backward compatibility alias
17
17
  export { ManagerContext as KnowledgeGraphManager };
18
18
  let managerContext;
19
+ // Exit cleanly when our stdio pipe closes (e.g., Claude Code's /reload-plugins
20
+ // tearing down the connection). Without this, other event-loop refs — file
21
+ // watchers, the embeddings pool, the consolidation timer — can keep the
22
+ // process alive as an orphan until manually killed.
23
+ process.stdin.on("end", () => process.exit(0));
24
+ process.stdin.on("close", () => process.exit(0));
19
25
  async function main() {
20
26
  // Initialize memory file path with backward compatibility
21
27
  const memoryFilePath = await ensureMemoryFilePath();
@@ -1 +1 @@
1
- {"version":3,"file":"toolDefinitions.d.ts","sourceRoot":"","sources":["../../src/server/toolDefinitions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,EAqlF3C,CAAC"}
1
+ {"version":3,"file":"toolDefinitions.d.ts","sourceRoot":"","sources":["../../src/server/toolDefinitions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,EAm0G3C,CAAC"}