@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
@@ -1846,9 +1846,30 @@ export const toolDefinitions = [
1846
1846
  additionalProperties: false,
1847
1847
  },
1848
1848
  },
1849
- // Phase 13: Config tool
1850
- // TODO: set_project_scope requires server state management (activeProjectId on MCPServer)
1851
- // Skipped in this pass implement when MCPServer exposes mutable server state to handlers.
1849
+ // Phase 13 (v12.3.2 backport): Active project scope. Mutable per-server state stored in a
1850
+ // WeakMap keyed on ManagerContext (see toolHandlers.ts projectScopeMap). Handlers that
1851
+ // want to apply the active scope may call getActiveProjectScope(ctx).
1852
+ {
1853
+ name: 'set_project_scope',
1854
+ description: 'Set the active project scope for this server session. New entities passed without an explicit projectId may be auto-stamped with this value by scope-aware handlers; pass an empty string to clear the scope. Returns { projectId } where projectId is the new active scope (null when cleared).',
1855
+ inputSchema: {
1856
+ type: 'object',
1857
+ properties: {
1858
+ projectId: { type: 'string', description: 'Project ID to scope to. Empty string clears the active scope.' },
1859
+ },
1860
+ required: ['projectId'],
1861
+ additionalProperties: false,
1862
+ },
1863
+ },
1864
+ {
1865
+ name: 'get_project_scope',
1866
+ description: 'Returns the active project scope for this server session (set via set_project_scope). Returns { projectId } where projectId is null when no scope is active.',
1867
+ inputSchema: {
1868
+ type: 'object',
1869
+ properties: {},
1870
+ additionalProperties: false,
1871
+ },
1872
+ },
1852
1873
  // ==================== SESSION & WORKING MEMORY TOOLS ====================
1853
1874
  {
1854
1875
  name: 'session_start',
@@ -2605,6 +2626,727 @@ export const toolDefinitions = [
2605
2626
  additionalProperties: false,
2606
2627
  },
2607
2628
  },
2629
+ // ==================== v2.1.0 TOOL AFFORDANCE TOOLS ====================
2630
+ {
2631
+ name: 'record_tool_outcome',
2632
+ description: 'v2.1.0 — Record a single tool-call outcome directly via ToolAffordanceManager (bypasses ToolCallObserver). Creates the record on first call; appends to rolling window on subsequent. Throws "conflict" on concurrent writer mismatch.',
2633
+ inputSchema: {
2634
+ type: 'object',
2635
+ properties: {
2636
+ toolName: { type: 'string' },
2637
+ outcome: { type: 'string', enum: ['success', 'failure', 'partial'] },
2638
+ errorMessage: { type: 'string', description: 'Required when outcome is failure or partial (ranked in commonFailureModes).' },
2639
+ durationMs: { type: 'number', minimum: 0, description: 'Wall-clock duration. Optional.' },
2640
+ },
2641
+ required: ['toolName', 'outcome'],
2642
+ additionalProperties: false,
2643
+ },
2644
+ },
2645
+ {
2646
+ name: 'get_tool_affordance_stats',
2647
+ description: 'v2.1.0 — Flat rolling stats for a tool: success_rate, total_calls, common_failure_modes, avg_duration_ms.',
2648
+ inputSchema: {
2649
+ type: 'object',
2650
+ properties: { toolName: { type: 'string' } },
2651
+ required: ['toolName'],
2652
+ additionalProperties: false,
2653
+ },
2654
+ },
2655
+ {
2656
+ name: 'suggest_tool',
2657
+ description: 'v2.1.0 — Suggest tools matching a task hint, ranked by successRate × recency factor (1.0 at ≤1d, linearly decays to 0.1 at ≥30d).',
2658
+ inputSchema: {
2659
+ type: 'object',
2660
+ properties: {
2661
+ taskHint: { type: 'string', description: 'Substring matched against toolName.' },
2662
+ limit: { type: 'number', minimum: 1, description: 'Max candidates. Default 5.' },
2663
+ minScore: { type: 'number', minimum: 0, maximum: 1, description: 'Default 0.' },
2664
+ },
2665
+ required: ['taskHint'],
2666
+ additionalProperties: false,
2667
+ },
2668
+ },
2669
+ {
2670
+ name: 'list_tool_affordances',
2671
+ description: 'v2.1.0 — All recorded ToolAffordanceRecords.',
2672
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
2673
+ },
2674
+ {
2675
+ name: 'remove_tool_affordance',
2676
+ description: 'v2.1.0 — Drop a tool-affordance record by toolName.',
2677
+ inputSchema: {
2678
+ type: 'object',
2679
+ properties: { toolName: { type: 'string' } },
2680
+ required: ['toolName'],
2681
+ additionalProperties: false,
2682
+ },
2683
+ },
2684
+ {
2685
+ name: 'observe_tool_start',
2686
+ description: 'v2.1.0 — Begin observing a tool call. Returns a callId the caller threads through observe_tool_complete / observe_tool_error / observe_tool_partial / observe_tool_cancel. Emits toolCall:start on the observer EventEmitter.',
2687
+ inputSchema: {
2688
+ type: 'object',
2689
+ properties: {
2690
+ toolName: { type: 'string' },
2691
+ args: { type: 'object', additionalProperties: true, description: 'Optional structured args for telemetry.' },
2692
+ },
2693
+ required: ['toolName'],
2694
+ additionalProperties: false,
2695
+ },
2696
+ },
2697
+ {
2698
+ name: 'observe_tool_complete',
2699
+ description: 'v2.1.0 — Record successful completion. Computes durationMs from observe_tool_start. No-op on unknown callId.',
2700
+ inputSchema: {
2701
+ type: 'object',
2702
+ properties: {
2703
+ callId: { type: 'string' },
2704
+ result: { type: 'string', description: 'Optional summary string for telemetry.' },
2705
+ },
2706
+ required: ['callId'],
2707
+ additionalProperties: false,
2708
+ },
2709
+ },
2710
+ {
2711
+ name: 'observe_tool_error',
2712
+ description: 'v2.1.0 — Record failure with an error message. No-op on unknown callId.',
2713
+ inputSchema: {
2714
+ type: 'object',
2715
+ properties: {
2716
+ callId: { type: 'string' },
2717
+ errorMessage: { type: 'string' },
2718
+ },
2719
+ required: ['callId', 'errorMessage'],
2720
+ additionalProperties: false,
2721
+ },
2722
+ },
2723
+ {
2724
+ name: 'observe_tool_partial',
2725
+ description: 'v2.1.0 — Record a partial result (tool returned a usable but incomplete result). No-op on unknown callId.',
2726
+ inputSchema: {
2727
+ type: 'object',
2728
+ properties: {
2729
+ callId: { type: 'string' },
2730
+ reason: { type: 'string' },
2731
+ },
2732
+ required: ['callId', 'reason'],
2733
+ additionalProperties: false,
2734
+ },
2735
+ },
2736
+ {
2737
+ name: 'observe_tool_cancel',
2738
+ description: 'v2.1.0 — Drop an in-flight observation without recording (e.g. user cancelled). No-op on unknown callId.',
2739
+ inputSchema: {
2740
+ type: 'object',
2741
+ properties: { callId: { type: 'string' } },
2742
+ required: ['callId'],
2743
+ additionalProperties: false,
2744
+ },
2745
+ },
2746
+ {
2747
+ name: 'tool_observer_in_flight_count',
2748
+ description: 'v2.1.0 — Diagnostic: number of in-flight (started but not yet completed) tool-call observations.',
2749
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
2750
+ },
2751
+ // ==================== v2.1.0 HEURISTIC GUIDELINES TOOLS ====================
2752
+ {
2753
+ name: 'add_heuristic',
2754
+ description: 'v2.1.0 — Register a new condition→action heuristic. Storage-backed; default confidence 0.5. Pass an explicit content-addressed id (e.g. h_<sha256(condition|action)>) for caller-managed idempotency.',
2755
+ inputSchema: {
2756
+ type: 'object',
2757
+ properties: {
2758
+ condition: { type: 'string', description: 'Natural-language condition that triggers the action.' },
2759
+ action: { type: 'string', description: 'Recommended action when the condition matches.' },
2760
+ priority: { type: 'number', description: 'Tie-breaker when multiple match (higher wins).' },
2761
+ initialConfidence: { type: 'number', minimum: 0, maximum: 1, description: 'Default 0.5.' },
2762
+ importance: { type: 'number', minimum: 0, maximum: 10 },
2763
+ agentId: { type: 'string' },
2764
+ id: { type: 'string', description: 'Optional explicit id for idempotent registration.' },
2765
+ },
2766
+ required: ['condition', 'action'],
2767
+ additionalProperties: false,
2768
+ },
2769
+ },
2770
+ {
2771
+ name: 'get_heuristic',
2772
+ description: 'v2.1.0 — Sync lookup by HeuristicId.',
2773
+ inputSchema: {
2774
+ type: 'object',
2775
+ properties: { id: { type: 'string' } },
2776
+ required: ['id'],
2777
+ additionalProperties: false,
2778
+ },
2779
+ },
2780
+ {
2781
+ name: 'list_heuristics',
2782
+ description: 'v2.1.0 — All registered heuristics.',
2783
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
2784
+ },
2785
+ {
2786
+ name: 'heuristic_count',
2787
+ description: 'v2.1.0 — Count of stored heuristics.',
2788
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
2789
+ },
2790
+ {
2791
+ name: 'match_heuristics',
2792
+ description: 'v2.1.0 — Find heuristics whose condition matches input via Jaccard token-overlap × confidence; sorted descending, then by priority.',
2793
+ inputSchema: {
2794
+ type: 'object',
2795
+ properties: {
2796
+ input: { type: 'string', description: 'Text to match against heuristic conditions.' },
2797
+ limit: { type: 'number', minimum: 1, description: 'Max matches returned. Default 10.' },
2798
+ minScore: { type: 'number', minimum: 0, maximum: 1, description: 'Minimum score. Default 0.1.' },
2799
+ },
2800
+ required: ['input'],
2801
+ additionalProperties: false,
2802
+ },
2803
+ },
2804
+ {
2805
+ name: 'reinforce_heuristic',
2806
+ description: 'v2.1.0 — Record a successful application: bumps support; raises confidence asymptotically (new = old + (1-old)*0.1). OCC-protected — surfaces "conflict" when concurrent writer collides.',
2807
+ inputSchema: {
2808
+ type: 'object',
2809
+ properties: { id: { type: 'string' } },
2810
+ required: ['id'],
2811
+ additionalProperties: false,
2812
+ },
2813
+ },
2814
+ {
2815
+ name: 'record_heuristic_contradiction',
2816
+ description: 'v2.1.0 — Record a counter-example: bumps contradictions; lowers confidence (new = old - old*0.2). OCC-protected.',
2817
+ inputSchema: {
2818
+ type: 'object',
2819
+ properties: { id: { type: 'string' } },
2820
+ required: ['id'],
2821
+ additionalProperties: false,
2822
+ },
2823
+ },
2824
+ {
2825
+ name: 'detect_heuristic_conflicts',
2826
+ description: 'v2.1.0 — Pair-wise overlap/contradiction detection across stored heuristics. Surfaces overlap (same condition tokens, different actions) and contradiction (opposing actions on overlapping conditions; negation prefixes such as "do not" / "never" / "avoid").',
2827
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
2828
+ },
2829
+ {
2830
+ name: 'remove_heuristic',
2831
+ description: 'v2.1.0 — Drop a heuristic by id.',
2832
+ inputSchema: {
2833
+ type: 'object',
2834
+ properties: { id: { type: 'string' } },
2835
+ required: ['id'],
2836
+ additionalProperties: false,
2837
+ },
2838
+ },
2839
+ {
2840
+ name: 'clear_heuristics',
2841
+ description: 'v2.1.0 — Drop every heuristic (across all entities of type "heuristic").',
2842
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
2843
+ },
2844
+ // ==================== v2.1.0 PROJECT CONTEXT TOOLS ====================
2845
+ {
2846
+ name: 'upsert_project_context',
2847
+ description: 'v2.1.0 — Merge structured project knowledge into the ProjectContextRecord for `projectId`. Array fields (facts/conventions/commands/glossary) append + dedup; scalars overwrite. One record per projectId.',
2848
+ inputSchema: {
2849
+ type: 'object',
2850
+ properties: {
2851
+ projectId: { type: 'string', description: 'Project identifier (unique key).' },
2852
+ facts: { type: 'array', items: { type: 'string' } },
2853
+ conventions: { type: 'array', items: { type: 'string' } },
2854
+ commands: {
2855
+ type: 'array',
2856
+ items: {
2857
+ type: 'object',
2858
+ properties: {
2859
+ name: { type: 'string' },
2860
+ command: { type: 'string' },
2861
+ purpose: { type: 'string' },
2862
+ },
2863
+ required: ['name', 'command', 'purpose'],
2864
+ },
2865
+ },
2866
+ glossary: {
2867
+ type: 'array',
2868
+ items: {
2869
+ type: 'object',
2870
+ properties: {
2871
+ term: { type: 'string' },
2872
+ definition: { type: 'string' },
2873
+ },
2874
+ required: ['term', 'definition'],
2875
+ },
2876
+ },
2877
+ },
2878
+ required: ['projectId'],
2879
+ additionalProperties: false,
2880
+ },
2881
+ },
2882
+ {
2883
+ name: 'get_project_context',
2884
+ description: 'v2.1.0 — Sync lookup of the ProjectContextRecord for projectId.',
2885
+ inputSchema: {
2886
+ type: 'object',
2887
+ properties: { projectId: { type: 'string' } },
2888
+ required: ['projectId'],
2889
+ additionalProperties: false,
2890
+ },
2891
+ },
2892
+ {
2893
+ name: 'append_project_fact',
2894
+ description: 'v2.1.0 — Append one fact to a project context (auto-creates the record on first call; dedups).',
2895
+ inputSchema: {
2896
+ type: 'object',
2897
+ properties: { projectId: { type: 'string' }, fact: { type: 'string' } },
2898
+ required: ['projectId', 'fact'],
2899
+ additionalProperties: false,
2900
+ },
2901
+ },
2902
+ {
2903
+ name: 'append_project_convention',
2904
+ description: 'v2.1.0 — Append one convention to a project context (auto-creates; dedups).',
2905
+ inputSchema: {
2906
+ type: 'object',
2907
+ properties: { projectId: { type: 'string' }, convention: { type: 'string' } },
2908
+ required: ['projectId', 'convention'],
2909
+ additionalProperties: false,
2910
+ },
2911
+ },
2912
+ {
2913
+ name: 'append_project_command',
2914
+ description: 'v2.1.0 — Append a documented project command (dedup by name).',
2915
+ inputSchema: {
2916
+ type: 'object',
2917
+ properties: {
2918
+ projectId: { type: 'string' },
2919
+ name: { type: 'string', description: 'Short command name (e.g. "test").' },
2920
+ command: { type: 'string', description: 'The command line (e.g. "npm test").' },
2921
+ purpose: { type: 'string', description: 'What the command does.' },
2922
+ },
2923
+ required: ['projectId', 'name', 'command', 'purpose'],
2924
+ additionalProperties: false,
2925
+ },
2926
+ },
2927
+ {
2928
+ name: 'append_project_glossary_term',
2929
+ description: 'v2.1.0 — Append a glossary term (dedup by term).',
2930
+ inputSchema: {
2931
+ type: 'object',
2932
+ properties: {
2933
+ projectId: { type: 'string' },
2934
+ term: { type: 'string' },
2935
+ definition: { type: 'string' },
2936
+ },
2937
+ required: ['projectId', 'term', 'definition'],
2938
+ additionalProperties: false,
2939
+ },
2940
+ },
2941
+ {
2942
+ name: 'remove_project_fact',
2943
+ description: 'v2.1.0 — Remove a single fact. Returns true if found.',
2944
+ inputSchema: {
2945
+ type: 'object',
2946
+ properties: { projectId: { type: 'string' }, fact: { type: 'string' } },
2947
+ required: ['projectId', 'fact'],
2948
+ additionalProperties: false,
2949
+ },
2950
+ },
2951
+ {
2952
+ name: 'remove_project_convention',
2953
+ description: 'v2.1.0 — Remove a single convention. Returns true if found.',
2954
+ inputSchema: {
2955
+ type: 'object',
2956
+ properties: { projectId: { type: 'string' }, convention: { type: 'string' } },
2957
+ required: ['projectId', 'convention'],
2958
+ additionalProperties: false,
2959
+ },
2960
+ },
2961
+ {
2962
+ name: 'remove_project_command',
2963
+ description: 'v2.1.0 — Remove a command by name. Returns true if found.',
2964
+ inputSchema: {
2965
+ type: 'object',
2966
+ properties: { projectId: { type: 'string' }, commandName: { type: 'string' } },
2967
+ required: ['projectId', 'commandName'],
2968
+ additionalProperties: false,
2969
+ },
2970
+ },
2971
+ {
2972
+ name: 'remove_project_glossary_term',
2973
+ description: 'v2.1.0 — Remove a glossary entry by term. Returns true if found.',
2974
+ inputSchema: {
2975
+ type: 'object',
2976
+ properties: { projectId: { type: 'string' }, term: { type: 'string' } },
2977
+ required: ['projectId', 'term'],
2978
+ additionalProperties: false,
2979
+ },
2980
+ },
2981
+ {
2982
+ name: 'clear_project_context',
2983
+ description: 'v2.1.0 — Wipe the four arrays (facts/conventions/commands/glossary) for projectId; keeps the entity.',
2984
+ inputSchema: {
2985
+ type: 'object',
2986
+ properties: { projectId: { type: 'string' } },
2987
+ required: ['projectId'],
2988
+ additionalProperties: false,
2989
+ },
2990
+ },
2991
+ {
2992
+ name: 'format_project_context_for_llm',
2993
+ description: 'v2.1.0 — Render the ProjectContextRecord as a prose summary suitable for the wakeUp L0 layer or a system prompt. Honors budgetChars with ellipsis truncation.',
2994
+ inputSchema: {
2995
+ type: 'object',
2996
+ properties: {
2997
+ projectId: { type: 'string' },
2998
+ budgetChars: { type: 'number', minimum: 1, description: 'Character cap for the rendered prose.' },
2999
+ },
3000
+ required: ['projectId'],
3001
+ additionalProperties: false,
3002
+ },
3003
+ },
3004
+ // ==================== v2.1.0 DECISION RATIONALE TOOLS ====================
3005
+ {
3006
+ name: 'propose_decision',
3007
+ description: 'v2.1.0 — Propose a new architecture-decision-record (ADR-equivalent). Creates a "proposed" DecisionRecord. Default importance 8.',
3008
+ inputSchema: {
3009
+ type: 'object',
3010
+ properties: {
3011
+ context: { type: 'string', description: 'Problem-space description (the question the decision answers)' },
3012
+ decision: { type: 'string', description: 'The chosen path' },
3013
+ alternatives: { type: 'array', items: { type: 'string' }, description: 'Considered-but-not-chosen options. Default [].' },
3014
+ consequences: { type: 'array', items: { type: 'string' }, description: 'Anticipated downstream effects. Default [].' },
3015
+ relatedFiles: { type: 'array', items: { type: 'string' }, description: 'Optional paths to related ADRs / code.' },
3016
+ supersedes: { type: 'string', description: 'Optional backward link to the decision being replaced (DecisionId).' },
3017
+ sourceSessionId: { type: 'string' },
3018
+ sourceProjectId: { type: 'string' },
3019
+ importance: { type: 'number', minimum: 0, maximum: 10, description: 'Entity-level importance. Default 8.' },
3020
+ agentId: { type: 'string', description: 'Owning agent.' },
3021
+ },
3022
+ required: ['context', 'decision'],
3023
+ additionalProperties: false,
3024
+ },
3025
+ },
3026
+ {
3027
+ name: 'accept_decision',
3028
+ description: 'v2.1.0 — Transition a proposed decision to accepted. Returns one of: accepted | already-accepted | not-found | illegal-transition | conflict | vanished-mid-update.',
3029
+ inputSchema: {
3030
+ type: 'object',
3031
+ properties: { id: { type: 'string', description: 'DecisionId' } },
3032
+ required: ['id'],
3033
+ additionalProperties: false,
3034
+ },
3035
+ },
3036
+ {
3037
+ name: 'reject_decision',
3038
+ description: 'v2.1.0 — Transition a proposed decision to rejected with a reason. Returns rejected | already-rejected | not-found | illegal-transition | conflict | vanished-mid-update.',
3039
+ inputSchema: {
3040
+ type: 'object',
3041
+ properties: {
3042
+ id: { type: 'string', description: 'DecisionId' },
3043
+ reason: { type: 'string', description: 'Why the decision is being rejected.' },
3044
+ },
3045
+ required: ['id', 'reason'],
3046
+ additionalProperties: false,
3047
+ },
3048
+ },
3049
+ {
3050
+ name: 'supersede_decision',
3051
+ description: 'v2.1.0 — Mark an accepted decision as superseded by another. illegal-transition when target is not accepted. not-found when target or replacement is missing.',
3052
+ inputSchema: {
3053
+ type: 'object',
3054
+ properties: {
3055
+ id: { type: 'string', description: 'Decision being superseded' },
3056
+ by: { type: 'string', description: 'DecisionId of the replacement' },
3057
+ },
3058
+ required: ['id', 'by'],
3059
+ additionalProperties: false,
3060
+ },
3061
+ },
3062
+ {
3063
+ name: 'find_decisions_by_context',
3064
+ description: 'v2.1.0 — Substring search across context, decision, and consequences fields.',
3065
+ inputSchema: {
3066
+ type: 'object',
3067
+ properties: { query: { type: 'string', description: 'Substring to search for' } },
3068
+ required: ['query'],
3069
+ additionalProperties: false,
3070
+ },
3071
+ },
3072
+ {
3073
+ name: 'get_decision_chain',
3074
+ description: 'v2.1.0 — Walk the supersedes link backward from the supplied id to the original proposal. Returns chain oldest-first; cycle-protected.',
3075
+ inputSchema: {
3076
+ type: 'object',
3077
+ properties: { id: { type: 'string', description: 'Any DecisionId in the chain' } },
3078
+ required: ['id'],
3079
+ additionalProperties: false,
3080
+ },
3081
+ },
3082
+ {
3083
+ name: 'list_decisions',
3084
+ description: 'v2.1.0 — List decisions, optionally filtered by status / sourceSessionId / sourceProjectId.',
3085
+ inputSchema: {
3086
+ type: 'object',
3087
+ properties: {
3088
+ status: { type: 'string', enum: ['proposed', 'accepted', 'superseded', 'rejected'] },
3089
+ sourceSessionId: { type: 'string' },
3090
+ sourceProjectId: { type: 'string' },
3091
+ limit: { type: 'number', minimum: 1 },
3092
+ },
3093
+ additionalProperties: false,
3094
+ },
3095
+ },
3096
+ {
3097
+ name: 'get_decision',
3098
+ description: 'v2.1.0 — Sync lookup by DecisionId.',
3099
+ inputSchema: {
3100
+ type: 'object',
3101
+ properties: { id: { type: 'string', description: 'DecisionId' } },
3102
+ required: ['id'],
3103
+ additionalProperties: false,
3104
+ },
3105
+ },
3106
+ {
3107
+ name: 'export_decision_as_adr_markdown',
3108
+ description: 'v2.1.0 — Render a stored decision as ADR-format markdown (# title, Status, Context, Decision, Consequences bullet list, Alternatives bullet list, optional Supersedes link).',
3109
+ inputSchema: {
3110
+ type: 'object',
3111
+ properties: { id: { type: 'string', description: 'DecisionId' } },
3112
+ required: ['id'],
3113
+ additionalProperties: false,
3114
+ },
3115
+ },
3116
+ {
3117
+ name: 'parse_adr_markdown',
3118
+ description: 'v2.1.0 — Parse a hand-written or previously-exported ADR markdown into a DecisionInput shape (static; no persistence). Returns null when required Context or Decision sections are missing.',
3119
+ inputSchema: {
3120
+ type: 'object',
3121
+ properties: { text: { type: 'string', description: 'Raw ADR markdown text' } },
3122
+ required: ['text'],
3123
+ additionalProperties: false,
3124
+ },
3125
+ },
3126
+ // ==================== v2.1.0 do_not_remember (Exclusion) TOOLS ====================
3127
+ {
3128
+ name: 'add_exclusion_rule',
3129
+ description: 'v2.1.0 — Add a content-pattern exclusion rule (do_not_remember). Hard-deletes existing matches (per `scope`) and write-blocks future ones when consulted by upstream callers. v1 substring-only.',
3130
+ inputSchema: {
3131
+ type: 'object',
3132
+ properties: {
3133
+ pattern: { type: 'string', description: 'Substring to match (case-insensitive).' },
3134
+ scope: {
3135
+ type: 'string',
3136
+ enum: ['future-only', 'past-only', 'both'],
3137
+ description: 'When the rule applies. Default: both.',
3138
+ },
3139
+ entityType: { type: 'string', description: 'Optional restriction by entityType.' },
3140
+ reason: { type: 'string', description: 'Free-text justification (e.g. "GDPR request 2026-05-15").' },
3141
+ },
3142
+ required: ['pattern'],
3143
+ additionalProperties: false,
3144
+ },
3145
+ },
3146
+ {
3147
+ name: 'list_exclusion_rules',
3148
+ description: 'v2.1.0 — Return every registered ExclusionRule.',
3149
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
3150
+ },
3151
+ {
3152
+ name: 'remove_exclusion_rule',
3153
+ description: 'v2.1.0 — Drop an exclusion rule by id. Does NOT restore previously deleted memories — the contract is "user said forget".',
3154
+ inputSchema: {
3155
+ type: 'object',
3156
+ properties: { id: { type: 'string', description: 'Rule id (exclusion-...)' } },
3157
+ required: ['id'],
3158
+ additionalProperties: false,
3159
+ },
3160
+ },
3161
+ {
3162
+ name: 'check_exclusion',
3163
+ description: 'v2.1.0 — Check whether content would be blocked by any active forward-blocking rule. Returns {blocked, ruleId?, reason?}. Past-only rules are skipped.',
3164
+ inputSchema: {
3165
+ type: 'object',
3166
+ properties: {
3167
+ content: { type: 'string', description: 'Content to test.' },
3168
+ entityType: { type: 'string', description: 'Optional entityType — narrows entityType-scoped rules.' },
3169
+ },
3170
+ required: ['content'],
3171
+ additionalProperties: false,
3172
+ },
3173
+ },
3174
+ {
3175
+ name: 'find_matching_memories_for_rule',
3176
+ description: 'v2.1.0 — Dry-run preview: return entities whose observations would match the candidate exclusion pattern. Does NOT persist the rule.',
3177
+ inputSchema: {
3178
+ type: 'object',
3179
+ properties: {
3180
+ pattern: { type: 'string', description: 'Candidate substring pattern.' },
3181
+ entityType: { type: 'string', description: 'Optional entityType restriction.' },
3182
+ },
3183
+ required: ['pattern'],
3184
+ additionalProperties: false,
3185
+ },
3186
+ },
3187
+ // ==================== v2.1.0 OBSERVATION DEDUP TOOLS ====================
3188
+ {
3189
+ name: 'find_duplicate_observations',
3190
+ description: 'v2.1.0 — Find verbatim duplicate observation strings across distinct entities (SHA-256 exact tier). Complementary to MemoryEngine.checkDuplicate (turn-level) and CompressionManager.findDuplicates (whole-entity). Report-only.',
3191
+ inputSchema: {
3192
+ type: 'object',
3193
+ properties: {
3194
+ entityType: {
3195
+ oneOf: [
3196
+ { type: 'string', description: 'Single entityType to include' },
3197
+ { type: 'array', items: { type: 'string' }, description: 'Multiple entityTypes to include' },
3198
+ ],
3199
+ description: 'Optional entityType filter (single or array). Omit to scan all.',
3200
+ },
3201
+ projectId: { type: 'string', description: 'Restrict to entities with this projectId.' },
3202
+ sessionId: { type: 'string', description: 'Restrict to entities with this sessionId.' },
3203
+ minOccurrences: { type: 'number', minimum: 2, description: 'Minimum occurrences to count as a group. Default 2.' },
3204
+ maxGroups: { type: 'number', minimum: 1, description: 'Cap on groups returned. Default 100.' },
3205
+ },
3206
+ additionalProperties: false,
3207
+ },
3208
+ },
3209
+ {
3210
+ name: 'find_jaccard_duplicate_observations',
3211
+ description: 'v2.1.0 — Find near-duplicate observation strings across distinct entities via token-Jaccard similarity with union-find grouping. More expensive than the exact tier (O(o²)); opt-in for higher recall.',
3212
+ inputSchema: {
3213
+ type: 'object',
3214
+ properties: {
3215
+ entityType: {
3216
+ oneOf: [
3217
+ { type: 'string' },
3218
+ { type: 'array', items: { type: 'string' } },
3219
+ ],
3220
+ },
3221
+ projectId: { type: 'string' },
3222
+ sessionId: { type: 'string' },
3223
+ minOccurrences: { type: 'number', minimum: 2 },
3224
+ maxGroups: { type: 'number', minimum: 1 },
3225
+ },
3226
+ additionalProperties: false,
3227
+ },
3228
+ },
3229
+ // ==================== v2.1.0 SPELL CORRECTION TOOLS ====================
3230
+ {
3231
+ name: 'spell_suggest',
3232
+ description: 'v2.1.0 — Suggest close matches for a (potentially misspelled) query over the vocabulary of entity names + tag values. Two-stage: bigram-Jaccard pre-filter (NGramIndex) + Levenshtein re-rank.',
3233
+ inputSchema: {
3234
+ type: 'object',
3235
+ properties: {
3236
+ query: { type: 'string', description: 'The (potentially misspelled) query string' },
3237
+ limit: { type: 'number', minimum: 1, description: 'Maximum corrections to return. Default 5.' },
3238
+ minScore: { type: 'number', minimum: 0, maximum: 1, description: 'Minimum final similarity score (1 - distance/maxLen). Default 0.4.' },
3239
+ maxDistance: { type: 'number', minimum: 0, description: 'Maximum Levenshtein edit distance to allow. Default 3.' },
3240
+ },
3241
+ required: ['query'],
3242
+ additionalProperties: false,
3243
+ },
3244
+ },
3245
+ {
3246
+ name: 'spell_rebuild_vocabulary',
3247
+ description: 'v2.1.0 — Force a rebuild of the SpellChecker vocabulary + n-gram index. Call after bulk entity churn; the lazy cache is otherwise correct for low-churn graphs.',
3248
+ inputSchema: {
3249
+ type: 'object',
3250
+ properties: {},
3251
+ additionalProperties: false,
3252
+ },
3253
+ },
3254
+ {
3255
+ name: 'spell_vocabulary_size',
3256
+ description: 'v2.1.0 — Return the count of unique terms in the SpellChecker vocabulary (entity names + tag values by default). Mostly diagnostic.',
3257
+ inputSchema: {
3258
+ type: 'object',
3259
+ properties: {},
3260
+ additionalProperties: false,
3261
+ },
3262
+ },
3263
+ // ==================== v12.5.0 ENGINEERING / DIAGNOSTIC TOOLS ====================
3264
+ // Parallel surface to the memoryjs CLI engineering commands (`memory diag`,
3265
+ // `memory check`, `memory reindex`, etc.). Useful when the MCP server is up
3266
+ // but the graph state is suspect.
3267
+ {
3268
+ name: 'diag',
3269
+ description: 'v12.5.0 — Runtime + storage diagnostic snapshot: node version, platform, storage path/type/size, entity + relation counts, ISO timestamp. Good first call when something feels off.',
3270
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
3271
+ },
3272
+ {
3273
+ name: 'health',
3274
+ description: 'v12.5.0 — Fast integrity checks: storage:loadGraph, entities:distinct-names, relations:no-orphans, hierarchy:no-cycles-no-missing-parents. Returns per-check duration; ok=false when any check fails.',
3275
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
3276
+ },
3277
+ {
3278
+ name: 'check_graph',
3279
+ description: 'v12.5.0 — Detect orphan relations (from/to references a missing entity), missing parents (entity.parentId references a missing entity), and hierarchy cycles. Reports findings. With apply=true, deletes orphan relations and clears missing parentIds; cycles are always reported but never auto-repaired (no safe default for which edge to break).',
3280
+ inputSchema: {
3281
+ type: 'object',
3282
+ properties: {
3283
+ apply: { type: 'boolean', description: 'When true, repair orphan relations + missing parentIds. Default false (dry-run).' },
3284
+ },
3285
+ additionalProperties: false,
3286
+ },
3287
+ },
3288
+ {
3289
+ name: 'reindex',
3290
+ description: 'v12.5.0 — Rebuild search-side indexes that may have drifted (TF-IDF/BM25 ranked + spell-checker vocabulary). Pass ranked=false or spell=false to scope. Returns per-target ok flag + durationMs.',
3291
+ inputSchema: {
3292
+ type: 'object',
3293
+ properties: {
3294
+ ranked: { type: 'boolean', description: 'Rebuild the ranked-search (TF-IDF/BM25) index (default true)' },
3295
+ spell: { type: 'boolean', description: 'Rebuild the spell-checker vocabulary (default true)' },
3296
+ },
3297
+ additionalProperties: false,
3298
+ },
3299
+ },
3300
+ {
3301
+ name: 'cache_stats',
3302
+ description: 'v12.5.0 — Per-tier snapshot of the global search caches (basic / ranked / boolean / fuzzy) showing hits / misses / size / hitRate. Process-local — every fresh server process starts at zero.',
3303
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
3304
+ },
3305
+ {
3306
+ name: 'cache_clear',
3307
+ description: 'v12.5.0 — Bust all four global search caches. Idempotent; safe after manual graph edits to drop stale results.',
3308
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
3309
+ },
3310
+ {
3311
+ name: 'graph_size',
3312
+ description: 'v12.5.0 — Graph + storage footprint: entity / relation / observation counts, distinct tag count, avg observations per entity, on-disk byte size + JSONL line count.',
3313
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
3314
+ },
3315
+ {
3316
+ name: 'inspect_entity',
3317
+ description: 'v12.5.0 — Verbose snapshot of one entity: observations (resolved via ObservationManager so the column-store sidecar is consulted), outgoing + incoming relations, tags, importance, timestamps, parentId, immediate children, full ancestors. Errors when entity not found.',
3318
+ inputSchema: {
3319
+ type: 'object',
3320
+ properties: {
3321
+ name: { type: 'string', description: 'Entity name to inspect' },
3322
+ },
3323
+ required: ['name'],
3324
+ additionalProperties: false,
3325
+ },
3326
+ },
3327
+ {
3328
+ name: 'hierarchy_tree',
3329
+ description: 'v12.5.0 — Hierarchy tree as nested JSON. With an explicit root, returns just that subtree; without, returns all root entities. Useful for visualising parent/child structure.',
3330
+ inputSchema: {
3331
+ type: 'object',
3332
+ properties: {
3333
+ root: { type: 'string', description: 'Root entity name. Omit to return all root entities.' },
3334
+ },
3335
+ additionalProperties: false,
3336
+ },
3337
+ },
3338
+ {
3339
+ name: 'entity_neighbors',
3340
+ description: 'v12.5.0 — Incoming + outgoing relations for one entity, plus in/out degree counts. Lighter than inspect_entity when you only need the graph-topology view.',
3341
+ inputSchema: {
3342
+ type: 'object',
3343
+ properties: {
3344
+ name: { type: 'string', description: 'Entity name' },
3345
+ },
3346
+ required: ['name'],
3347
+ additionalProperties: false,
3348
+ },
3349
+ },
2608
3350
  ];
2609
3351
  // Tool categories are documented in CLAUDE.md for reference:
2610
3352
  // - Entity Operations: create_entities, delete_entities, read_graph, open_nodes