@agentmemory/agentmemory 0.7.2 → 0.7.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 (217) hide show
  1. package/AGENTS.md +2 -2
  2. package/README.md +41 -68
  3. package/dist/cli.mjs +3 -3
  4. package/dist/index.mjs +3 -2
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/{src-1fTKFEtN.mjs → src-sYZDDbiA.mjs} +4 -3
  7. package/dist/src-sYZDDbiA.mjs.map +1 -0
  8. package/dist/standalone.mjs +1 -1
  9. package/dist/standalone.mjs.map +1 -1
  10. package/package.json +10 -1
  11. package/plugin/.claude-plugin/plugin.json +1 -1
  12. package/plugin/scripts/notification.d.mts +1 -0
  13. package/plugin/scripts/notification.mjs.map +1 -0
  14. package/plugin/scripts/post-tool-failure.d.mts +1 -0
  15. package/plugin/scripts/post-tool-failure.mjs.map +1 -0
  16. package/plugin/scripts/post-tool-use.d.mts +1 -0
  17. package/plugin/scripts/post-tool-use.mjs.map +1 -0
  18. package/plugin/scripts/pre-compact.d.mts +1 -0
  19. package/plugin/scripts/pre-compact.mjs.map +1 -0
  20. package/plugin/scripts/pre-tool-use.d.mts +1 -0
  21. package/plugin/scripts/pre-tool-use.mjs.map +1 -0
  22. package/plugin/scripts/prompt-submit.d.mts +1 -0
  23. package/plugin/scripts/prompt-submit.mjs.map +1 -0
  24. package/plugin/scripts/session-end.d.mts +1 -0
  25. package/plugin/scripts/session-end.mjs.map +1 -0
  26. package/plugin/scripts/session-start.d.mts +1 -0
  27. package/plugin/scripts/session-start.mjs.map +1 -0
  28. package/plugin/scripts/stop.d.mts +1 -0
  29. package/plugin/scripts/stop.mjs.map +1 -0
  30. package/plugin/scripts/subagent-start.d.mts +1 -0
  31. package/plugin/scripts/subagent-start.mjs.map +1 -0
  32. package/plugin/scripts/subagent-stop.d.mts +1 -0
  33. package/plugin/scripts/subagent-stop.mjs.map +1 -0
  34. package/plugin/scripts/task-completed.d.mts +1 -0
  35. package/plugin/scripts/task-completed.mjs.map +1 -0
  36. package/.claude-plugin/marketplace.json +0 -14
  37. package/.github/workflows/ci.yml +0 -22
  38. package/.github/workflows/publish.yml +0 -28
  39. package/assets/banner.png +0 -0
  40. package/assets/demo.gif +0 -0
  41. package/assets/demo.mp4 +0 -0
  42. package/benchmark/QUALITY.md +0 -73
  43. package/benchmark/REAL-EMBEDDINGS.md +0 -67
  44. package/benchmark/SCALE.md +0 -110
  45. package/benchmark/dataset.ts +0 -293
  46. package/benchmark/quality-eval.ts +0 -643
  47. package/benchmark/real-embeddings-eval.ts +0 -405
  48. package/benchmark/scale-eval.ts +0 -398
  49. package/dist/src-1fTKFEtN.mjs.map +0 -1
  50. package/src/auth.ts +0 -12
  51. package/src/cli.ts +0 -251
  52. package/src/config.ts +0 -221
  53. package/src/eval/metrics-store.ts +0 -65
  54. package/src/eval/quality.ts +0 -51
  55. package/src/eval/schemas.ts +0 -124
  56. package/src/eval/self-correct.ts +0 -28
  57. package/src/eval/validator.ts +0 -31
  58. package/src/functions/actions.ts +0 -288
  59. package/src/functions/audit.ts +0 -61
  60. package/src/functions/auto-forget.ts +0 -169
  61. package/src/functions/branch-aware.ts +0 -169
  62. package/src/functions/cascade.ts +0 -80
  63. package/src/functions/checkpoints.ts +0 -209
  64. package/src/functions/claude-bridge.ts +0 -161
  65. package/src/functions/compress.ts +0 -194
  66. package/src/functions/consolidate.ts +0 -212
  67. package/src/functions/consolidation-pipeline.ts +0 -258
  68. package/src/functions/context.ts +0 -169
  69. package/src/functions/crystallize.ts +0 -293
  70. package/src/functions/dedup.ts +0 -57
  71. package/src/functions/diagnostics.ts +0 -785
  72. package/src/functions/enrich.ts +0 -132
  73. package/src/functions/evict.ts +0 -163
  74. package/src/functions/export-import.ts +0 -508
  75. package/src/functions/facets.ts +0 -248
  76. package/src/functions/file-index.ts +0 -106
  77. package/src/functions/flow-compress.ts +0 -214
  78. package/src/functions/frontier.ts +0 -196
  79. package/src/functions/governance.ts +0 -131
  80. package/src/functions/graph-retrieval.ts +0 -277
  81. package/src/functions/graph.ts +0 -275
  82. package/src/functions/leases.ts +0 -216
  83. package/src/functions/lessons.ts +0 -253
  84. package/src/functions/mesh.ts +0 -434
  85. package/src/functions/migrate.ts +0 -165
  86. package/src/functions/observe.ts +0 -144
  87. package/src/functions/obsidian-export.ts +0 -310
  88. package/src/functions/patterns.ts +0 -138
  89. package/src/functions/privacy.ts +0 -39
  90. package/src/functions/profile.ts +0 -155
  91. package/src/functions/query-expansion.ts +0 -186
  92. package/src/functions/relations.ts +0 -237
  93. package/src/functions/remember.ts +0 -162
  94. package/src/functions/retention.ts +0 -235
  95. package/src/functions/routines.ts +0 -289
  96. package/src/functions/search.ts +0 -80
  97. package/src/functions/sentinels.ts +0 -417
  98. package/src/functions/signals.ts +0 -186
  99. package/src/functions/sketches.ts +0 -274
  100. package/src/functions/sliding-window.ts +0 -257
  101. package/src/functions/smart-search.ts +0 -115
  102. package/src/functions/snapshot.ts +0 -219
  103. package/src/functions/summarize.ts +0 -155
  104. package/src/functions/team.ts +0 -147
  105. package/src/functions/temporal-graph.ts +0 -476
  106. package/src/functions/timeline.ts +0 -138
  107. package/src/functions/verify.ts +0 -117
  108. package/src/health/monitor.ts +0 -110
  109. package/src/health/thresholds.ts +0 -73
  110. package/src/hooks/notification.ts +0 -52
  111. package/src/hooks/post-tool-failure.ts +0 -58
  112. package/src/hooks/post-tool-use.ts +0 -62
  113. package/src/hooks/pre-compact.ts +0 -60
  114. package/src/hooks/pre-tool-use.ts +0 -72
  115. package/src/hooks/prompt-submit.ts +0 -46
  116. package/src/hooks/session-end.ts +0 -71
  117. package/src/hooks/session-start.ts +0 -48
  118. package/src/hooks/stop.ts +0 -39
  119. package/src/hooks/subagent-start.ts +0 -49
  120. package/src/hooks/subagent-stop.ts +0 -54
  121. package/src/hooks/task-completed.ts +0 -54
  122. package/src/index.ts +0 -342
  123. package/src/mcp/in-memory-kv.ts +0 -61
  124. package/src/mcp/server.ts +0 -1455
  125. package/src/mcp/standalone.ts +0 -177
  126. package/src/mcp/tools-registry.ts +0 -769
  127. package/src/mcp/transport.ts +0 -91
  128. package/src/prompts/compression.ts +0 -67
  129. package/src/prompts/consolidation.ts +0 -48
  130. package/src/prompts/graph-extraction.ts +0 -35
  131. package/src/prompts/summary.ts +0 -38
  132. package/src/prompts/xml.ts +0 -26
  133. package/src/providers/agent-sdk.ts +0 -34
  134. package/src/providers/anthropic.ts +0 -35
  135. package/src/providers/circuit-breaker.ts +0 -82
  136. package/src/providers/embedding/cohere.ts +0 -46
  137. package/src/providers/embedding/gemini.ts +0 -54
  138. package/src/providers/embedding/index.ts +0 -39
  139. package/src/providers/embedding/local.ts +0 -52
  140. package/src/providers/embedding/openai.ts +0 -45
  141. package/src/providers/embedding/openrouter.ts +0 -51
  142. package/src/providers/embedding/voyage.ts +0 -46
  143. package/src/providers/fallback-chain.ts +0 -31
  144. package/src/providers/index.ts +0 -84
  145. package/src/providers/openrouter.ts +0 -71
  146. package/src/providers/resilient.ts +0 -37
  147. package/src/state/hybrid-search.ts +0 -295
  148. package/src/state/index-persistence.ts +0 -63
  149. package/src/state/keyed-mutex.ts +0 -18
  150. package/src/state/kv.ts +0 -33
  151. package/src/state/schema.ts +0 -71
  152. package/src/state/search-index.ts +0 -245
  153. package/src/state/stemmer.ts +0 -104
  154. package/src/state/synonyms.ts +0 -63
  155. package/src/state/vector-index.ts +0 -130
  156. package/src/telemetry/setup.ts +0 -116
  157. package/src/triggers/api.ts +0 -1904
  158. package/src/triggers/events.ts +0 -71
  159. package/src/types.ts +0 -769
  160. package/src/version.ts +0 -1
  161. package/src/viewer/index.html +0 -2556
  162. package/src/viewer/server.ts +0 -207
  163. package/src/xenova.d.ts +0 -3
  164. package/test/actions.test.ts +0 -490
  165. package/test/audit.test.ts +0 -108
  166. package/test/auto-forget.test.ts +0 -188
  167. package/test/cascade.test.ts +0 -277
  168. package/test/checkpoints.test.ts +0 -493
  169. package/test/circuit-breaker.test.ts +0 -107
  170. package/test/claude-bridge.test.ts +0 -178
  171. package/test/confidence.test.ts +0 -247
  172. package/test/consistency.test.ts +0 -61
  173. package/test/consolidation-pipeline.test.ts +0 -251
  174. package/test/crystallize.test.ts +0 -521
  175. package/test/diagnostics.test.ts +0 -638
  176. package/test/embedding-provider.test.ts +0 -49
  177. package/test/enrich.test.ts +0 -209
  178. package/test/eval.test.ts +0 -300
  179. package/test/export-import.test.ts +0 -251
  180. package/test/facets.test.ts +0 -448
  181. package/test/fallback-chain.test.ts +0 -93
  182. package/test/frontier.test.ts +0 -485
  183. package/test/governance.test.ts +0 -147
  184. package/test/graph-retrieval.test.ts +0 -186
  185. package/test/graph.test.ts +0 -160
  186. package/test/helpers/mocks.ts +0 -40
  187. package/test/hybrid-search.test.ts +0 -145
  188. package/test/index-persistence.test.ts +0 -124
  189. package/test/integration.test.ts +0 -265
  190. package/test/leases.test.ts +0 -399
  191. package/test/mcp-prompts.test.ts +0 -218
  192. package/test/mcp-resources.test.ts +0 -286
  193. package/test/mcp-standalone.test.ts +0 -113
  194. package/test/mesh.test.ts +0 -700
  195. package/test/privacy.test.ts +0 -87
  196. package/test/profile.test.ts +0 -161
  197. package/test/query-expansion.test.ts +0 -154
  198. package/test/relations.test.ts +0 -198
  199. package/test/retention.test.ts +0 -245
  200. package/test/routines.test.ts +0 -497
  201. package/test/schema-fingerprint.test.ts +0 -81
  202. package/test/schema.test.ts +0 -42
  203. package/test/search-index.test.ts +0 -128
  204. package/test/sentinels.test.ts +0 -626
  205. package/test/signals.test.ts +0 -410
  206. package/test/sketches.test.ts +0 -549
  207. package/test/sliding-window.test.ts +0 -199
  208. package/test/smart-search.test.ts +0 -169
  209. package/test/snapshot.test.ts +0 -165
  210. package/test/team.test.ts +0 -156
  211. package/test/temporal-graph.test.ts +0 -378
  212. package/test/timeline.test.ts +0 -148
  213. package/test/vector-index.test.ts +0 -79
  214. package/test/verify.test.ts +0 -209
  215. package/test/xml.test.ts +0 -65
  216. package/tsconfig.json +0 -22
  217. package/tsdown.config.ts +0 -62
@@ -1,769 +0,0 @@
1
- export type McpToolDef = {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: Record<string, { type: string; description: string }>;
7
- required?: string[];
8
- };
9
- };
10
-
11
- export const CORE_TOOLS: McpToolDef[] = [
12
- {
13
- name: "memory_recall",
14
- description:
15
- "Search past session observations for relevant context. Use when you need to recall what happened in previous sessions, find past decisions, or look up how a file was modified before.",
16
- inputSchema: {
17
- type: "object",
18
- properties: {
19
- query: {
20
- type: "string",
21
- description: "Search query (keywords, file names, concepts)",
22
- },
23
- limit: {
24
- type: "number",
25
- description: "Max results to return (default 10)",
26
- },
27
- },
28
- required: ["query"],
29
- },
30
- },
31
- {
32
- name: "memory_save",
33
- description:
34
- "Explicitly save an important insight, decision, or pattern to long-term memory.",
35
- inputSchema: {
36
- type: "object",
37
- properties: {
38
- content: {
39
- type: "string",
40
- description: "The insight or decision to remember",
41
- },
42
- type: {
43
- type: "string",
44
- description:
45
- "Memory type: pattern, preference, architecture, bug, workflow, or fact",
46
- },
47
- concepts: {
48
- type: "string",
49
- description: "Comma-separated key concepts",
50
- },
51
- files: {
52
- type: "string",
53
- description: "Comma-separated relevant file paths",
54
- },
55
- },
56
- required: ["content"],
57
- },
58
- },
59
- {
60
- name: "memory_file_history",
61
- description: "Get past observations about specific files.",
62
- inputSchema: {
63
- type: "object",
64
- properties: {
65
- files: { type: "string", description: "Comma-separated file paths" },
66
- sessionId: {
67
- type: "string",
68
- description: "Current session ID to exclude",
69
- },
70
- },
71
- required: ["files"],
72
- },
73
- },
74
- {
75
- name: "memory_patterns",
76
- description: "Detect recurring patterns across sessions.",
77
- inputSchema: {
78
- type: "object",
79
- properties: {
80
- project: { type: "string", description: "Project path to analyze" },
81
- },
82
- },
83
- },
84
- {
85
- name: "memory_sessions",
86
- description:
87
- "List recent sessions with their status and observation counts.",
88
- inputSchema: { type: "object", properties: {} },
89
- },
90
- {
91
- name: "memory_smart_search",
92
- description: "Hybrid semantic+keyword search with progressive disclosure.",
93
- inputSchema: {
94
- type: "object",
95
- properties: {
96
- query: { type: "string", description: "Search query" },
97
- expandIds: {
98
- type: "string",
99
- description: "Comma-separated observation IDs to expand",
100
- },
101
- limit: { type: "number", description: "Max results (default 10)" },
102
- },
103
- required: ["query"],
104
- },
105
- },
106
- {
107
- name: "memory_timeline",
108
- description: "Chronological observations around an anchor point.",
109
- inputSchema: {
110
- type: "object",
111
- properties: {
112
- anchor: {
113
- type: "string",
114
- description: "Anchor point: ISO date or keyword",
115
- },
116
- project: { type: "string", description: "Filter by project path" },
117
- before: {
118
- type: "number",
119
- description: "Observations before anchor (default 5)",
120
- },
121
- after: {
122
- type: "number",
123
- description: "Observations after anchor (default 5)",
124
- },
125
- },
126
- required: ["anchor"],
127
- },
128
- },
129
- {
130
- name: "memory_profile",
131
- description: "User/project profile with top concepts and file patterns.",
132
- inputSchema: {
133
- type: "object",
134
- properties: {
135
- project: { type: "string", description: "Project path" },
136
- refresh: {
137
- type: "string",
138
- description: "Set to 'true' to force rebuild",
139
- },
140
- },
141
- required: ["project"],
142
- },
143
- },
144
- {
145
- name: "memory_export",
146
- description: "Export all memory data as JSON.",
147
- inputSchema: { type: "object", properties: {} },
148
- },
149
- {
150
- name: "memory_relations",
151
- description: "Query the memory relationship graph.",
152
- inputSchema: {
153
- type: "object",
154
- properties: {
155
- memoryId: {
156
- type: "string",
157
- description: "Memory ID to find relations for",
158
- },
159
- maxHops: {
160
- type: "number",
161
- description: "Max traversal depth (default 2)",
162
- },
163
- minConfidence: {
164
- type: "number",
165
- description: "Min confidence (0-1, default 0)",
166
- },
167
- },
168
- required: ["memoryId"],
169
- },
170
- },
171
- ];
172
-
173
- export const V040_TOOLS: McpToolDef[] = [
174
- {
175
- name: "memory_claude_bridge_sync",
176
- description:
177
- "Sync memory state to/from Claude Code's native MEMORY.md file.",
178
- inputSchema: {
179
- type: "object",
180
- properties: {
181
- direction: {
182
- type: "string",
183
- description:
184
- "'read' to import from MEMORY.md, 'write' to export to MEMORY.md",
185
- },
186
- },
187
- required: ["direction"],
188
- },
189
- },
190
- {
191
- name: "memory_graph_query",
192
- description: "Query the knowledge graph for entities and relationships.",
193
- inputSchema: {
194
- type: "object",
195
- properties: {
196
- startNodeId: {
197
- type: "string",
198
- description: "Starting node ID for traversal",
199
- },
200
- nodeType: { type: "string", description: "Filter by node type" },
201
- maxDepth: {
202
- type: "number",
203
- description: "Max BFS depth (default 3, max 5)",
204
- },
205
- query: { type: "string", description: "Search nodes by name" },
206
- },
207
- },
208
- },
209
- {
210
- name: "memory_consolidate",
211
- description:
212
- "Run the 4-tier memory consolidation pipeline (working -> episodic -> semantic -> procedural).",
213
- inputSchema: {
214
- type: "object",
215
- properties: {
216
- tier: {
217
- type: "string",
218
- description: "Target tier: episodic, semantic, or procedural",
219
- },
220
- },
221
- },
222
- },
223
- {
224
- name: "memory_team_share",
225
- description: "Share a memory or observation with team members.",
226
- inputSchema: {
227
- type: "object",
228
- properties: {
229
- itemId: {
230
- type: "string",
231
- description: "ID of memory or observation to share",
232
- },
233
- itemType: {
234
- type: "string",
235
- description: "Type: observation, memory, or pattern",
236
- },
237
- },
238
- required: ["itemId", "itemType"],
239
- },
240
- },
241
- {
242
- name: "memory_team_feed",
243
- description: "Get recent shared items from all team members.",
244
- inputSchema: {
245
- type: "object",
246
- properties: {
247
- limit: { type: "number", description: "Max items (default 20)" },
248
- },
249
- },
250
- },
251
- {
252
- name: "memory_audit",
253
- description: "View the audit trail of memory operations.",
254
- inputSchema: {
255
- type: "object",
256
- properties: {
257
- operation: { type: "string", description: "Filter by operation type" },
258
- limit: { type: "number", description: "Max entries (default 50)" },
259
- },
260
- },
261
- },
262
- {
263
- name: "memory_governance_delete",
264
- description: "Delete specific memories with audit trail.",
265
- inputSchema: {
266
- type: "object",
267
- properties: {
268
- memoryIds: {
269
- type: "string",
270
- description: "Comma-separated memory IDs to delete",
271
- },
272
- reason: { type: "string", description: "Reason for deletion" },
273
- },
274
- required: ["memoryIds"],
275
- },
276
- },
277
- {
278
- name: "memory_snapshot_create",
279
- description: "Create a git-versioned snapshot of current memory state.",
280
- inputSchema: {
281
- type: "object",
282
- properties: {
283
- message: { type: "string", description: "Snapshot description" },
284
- },
285
- },
286
- },
287
- ];
288
-
289
- export const V050_TOOLS: McpToolDef[] = [
290
- {
291
- name: "memory_action_create",
292
- description:
293
- "Create an actionable work item with typed dependencies. Actions track what agents need to do and how work items relate to each other.",
294
- inputSchema: {
295
- type: "object",
296
- properties: {
297
- title: { type: "string", description: "Action title" },
298
- description: {
299
- type: "string",
300
- description: "Detailed description of the work",
301
- },
302
- priority: {
303
- type: "number",
304
- description: "Priority 1-10 (10 highest)",
305
- },
306
- project: { type: "string", description: "Project path" },
307
- tags: {
308
- type: "string",
309
- description: "Comma-separated tags",
310
- },
311
- parentId: {
312
- type: "string",
313
- description: "Parent action ID for hierarchical actions",
314
- },
315
- requires: {
316
- type: "string",
317
- description:
318
- "Comma-separated action IDs that must complete before this",
319
- },
320
- },
321
- required: ["title"],
322
- },
323
- },
324
- {
325
- name: "memory_action_update",
326
- description:
327
- "Update an action's status, priority, or details. Set status to 'done' to complete it and unblock dependent actions.",
328
- inputSchema: {
329
- type: "object",
330
- properties: {
331
- actionId: { type: "string", description: "Action ID to update" },
332
- status: {
333
- type: "string",
334
- description: "New status: pending, active, done, blocked, cancelled",
335
- },
336
- result: {
337
- type: "string",
338
- description: "Outcome description (when completing)",
339
- },
340
- priority: { type: "number", description: "New priority 1-10" },
341
- },
342
- required: ["actionId"],
343
- },
344
- },
345
- {
346
- name: "memory_frontier",
347
- description:
348
- "Get all unblocked actions ranked by priority and urgency. Returns the frontier of actionable work with no unsatisfied dependencies.",
349
- inputSchema: {
350
- type: "object",
351
- properties: {
352
- project: { type: "string", description: "Filter by project" },
353
- agentId: {
354
- type: "string",
355
- description: "Agent ID to check lease conflicts",
356
- },
357
- limit: { type: "number", description: "Max results (default 20)" },
358
- },
359
- },
360
- },
361
- {
362
- name: "memory_next",
363
- description:
364
- "Get the single most important next action to work on. Combines dependency resolution, priority, and recency into a score.",
365
- inputSchema: {
366
- type: "object",
367
- properties: {
368
- project: { type: "string", description: "Filter by project" },
369
- agentId: { type: "string", description: "Current agent ID" },
370
- },
371
- },
372
- },
373
- {
374
- name: "memory_lease",
375
- description:
376
- "Acquire, release, or renew an exclusive lease on an action. Prevents multiple agents from working on the same thing.",
377
- inputSchema: {
378
- type: "object",
379
- properties: {
380
- actionId: { type: "string", description: "Action ID" },
381
- agentId: { type: "string", description: "Agent claiming the action" },
382
- operation: {
383
- type: "string",
384
- description: "acquire, release, or renew",
385
- },
386
- result: {
387
- type: "string",
388
- description: "Result when releasing (marks action done)",
389
- },
390
- ttlMs: {
391
- type: "number",
392
- description: "Lease duration in ms (default 10min, max 1hr)",
393
- },
394
- },
395
- required: ["actionId", "agentId", "operation"],
396
- },
397
- },
398
- {
399
- name: "memory_routine_run",
400
- description:
401
- "Instantiate a frozen workflow routine, creating actions for each step with proper dependencies.",
402
- inputSchema: {
403
- type: "object",
404
- properties: {
405
- routineId: { type: "string", description: "Routine template ID" },
406
- project: { type: "string", description: "Project context" },
407
- initiatedBy: { type: "string", description: "Agent starting the run" },
408
- },
409
- required: ["routineId"],
410
- },
411
- },
412
- {
413
- name: "memory_signal_send",
414
- description:
415
- "Send a message to another agent or broadcast. Supports threading, typed messages, and TTL expiration.",
416
- inputSchema: {
417
- type: "object",
418
- properties: {
419
- from: { type: "string", description: "Sender agent ID" },
420
- to: {
421
- type: "string",
422
- description: "Recipient agent ID (omit for broadcast)",
423
- },
424
- content: { type: "string", description: "Message content" },
425
- type: {
426
- type: "string",
427
- description: "Message type: info, request, response, alert, handoff",
428
- },
429
- replyTo: {
430
- type: "string",
431
- description: "Signal ID to reply to (auto-threads)",
432
- },
433
- },
434
- required: ["from", "content"],
435
- },
436
- },
437
- {
438
- name: "memory_signal_read",
439
- description:
440
- "Read messages for an agent. Marks delivered messages as read.",
441
- inputSchema: {
442
- type: "object",
443
- properties: {
444
- agentId: { type: "string", description: "Agent to read messages for" },
445
- unreadOnly: {
446
- type: "string",
447
- description: "Set to 'true' for unread only",
448
- },
449
- threadId: {
450
- type: "string",
451
- description: "Filter by conversation thread",
452
- },
453
- limit: { type: "number", description: "Max messages (default 50)" },
454
- },
455
- required: ["agentId"],
456
- },
457
- },
458
- {
459
- name: "memory_checkpoint",
460
- description:
461
- "Create or resolve an external checkpoint (CI result, approval, deploy status) that gates action progress.",
462
- inputSchema: {
463
- type: "object",
464
- properties: {
465
- operation: {
466
- type: "string",
467
- description: "create, resolve, or list",
468
- },
469
- name: { type: "string", description: "Checkpoint name (for create)" },
470
- checkpointId: {
471
- type: "string",
472
- description: "Checkpoint ID (for resolve)",
473
- },
474
- status: {
475
- type: "string",
476
- description: "passed or failed (for resolve)",
477
- },
478
- type: {
479
- type: "string",
480
- description: "Checkpoint type: ci, approval, deploy, external, timer",
481
- },
482
- linkedActionIds: {
483
- type: "string",
484
- description:
485
- "Comma-separated action IDs this checkpoint gates (for create)",
486
- },
487
- },
488
- required: ["operation"],
489
- },
490
- },
491
- {
492
- name: "memory_mesh_sync",
493
- description:
494
- "Sync memories and actions with peer agentmemory instances for multi-agent collaboration.",
495
- inputSchema: {
496
- type: "object",
497
- properties: {
498
- peerId: {
499
- type: "string",
500
- description: "Specific peer ID (omit for all)",
501
- },
502
- direction: {
503
- type: "string",
504
- description: "push, pull, or both (default both)",
505
- },
506
- },
507
- },
508
- },
509
- ];
510
-
511
- export const V051_TOOLS: McpToolDef[] = [
512
- {
513
- name: "memory_sentinel_create",
514
- description:
515
- "Create an event-driven sentinel that watches for conditions (webhook, timer, threshold, pattern, approval) and auto-unblocks gated actions when triggered.",
516
- inputSchema: {
517
- type: "object",
518
- properties: {
519
- name: { type: "string", description: "Sentinel name" },
520
- type: {
521
- type: "string",
522
- description: "Type: webhook, timer, threshold, pattern, approval, custom",
523
- },
524
- config: {
525
- type: "string",
526
- description: "JSON config (timer: {durationMs}, threshold: {metric,operator,value}, pattern: {pattern}, webhook: {path})",
527
- },
528
- linkedActionIds: {
529
- type: "string",
530
- description: "Comma-separated action IDs to gate",
531
- },
532
- expiresInMs: { type: "number", description: "Auto-expire after ms" },
533
- },
534
- required: ["name", "type"],
535
- },
536
- },
537
- {
538
- name: "memory_sentinel_trigger",
539
- description:
540
- "Externally fire a sentinel, providing an optional result payload. Unblocks any gated actions.",
541
- inputSchema: {
542
- type: "object",
543
- properties: {
544
- sentinelId: { type: "string", description: "Sentinel ID to trigger" },
545
- result: { type: "string", description: "JSON result payload" },
546
- },
547
- required: ["sentinelId"],
548
- },
549
- },
550
- {
551
- name: "memory_sketch_create",
552
- description:
553
- "Create an ephemeral action graph for exploratory work. Auto-expires after TTL. Can be promoted to permanent actions or discarded.",
554
- inputSchema: {
555
- type: "object",
556
- properties: {
557
- title: { type: "string", description: "Sketch title" },
558
- description: { type: "string", description: "What this sketch explores" },
559
- expiresInMs: { type: "number", description: "TTL in ms (default 1 hour)" },
560
- project: { type: "string", description: "Project context" },
561
- },
562
- required: ["title"],
563
- },
564
- },
565
- {
566
- name: "memory_sketch_promote",
567
- description:
568
- "Promote a sketch's ephemeral actions to permanent actions. Makes the exploratory work official.",
569
- inputSchema: {
570
- type: "object",
571
- properties: {
572
- sketchId: { type: "string", description: "Sketch ID to promote" },
573
- project: { type: "string", description: "Override project for promoted actions" },
574
- },
575
- required: ["sketchId"],
576
- },
577
- },
578
- {
579
- name: "memory_crystallize",
580
- description:
581
- "Compress completed action chains into compact crystal digests using LLM summarization. Extracts narrative, key outcomes, files affected, and lessons.",
582
- inputSchema: {
583
- type: "object",
584
- properties: {
585
- actionIds: {
586
- type: "string",
587
- description: "Comma-separated completed action IDs to crystallize",
588
- },
589
- project: { type: "string", description: "Project context" },
590
- sessionId: { type: "string", description: "Session context" },
591
- },
592
- required: ["actionIds"],
593
- },
594
- },
595
- {
596
- name: "memory_diagnose",
597
- description:
598
- "Run health checks across all subsystems (actions, leases, sentinels, sketches, signals, sessions, memories, mesh). Identifies stuck, orphaned, and inconsistent state.",
599
- inputSchema: {
600
- type: "object",
601
- properties: {
602
- categories: {
603
- type: "string",
604
- description: "Comma-separated categories to check (default all)",
605
- },
606
- },
607
- },
608
- },
609
- {
610
- name: "memory_heal",
611
- description:
612
- "Auto-fix all fixable issues found by diagnostics. Unblocks stuck actions, expires stale leases, cleans up orphaned data.",
613
- inputSchema: {
614
- type: "object",
615
- properties: {
616
- categories: {
617
- type: "string",
618
- description: "Comma-separated categories to heal (default all)",
619
- },
620
- dryRun: {
621
- type: "string",
622
- description: "Set to 'true' for dry run (report but don't fix)",
623
- },
624
- },
625
- },
626
- },
627
- {
628
- name: "memory_facet_tag",
629
- description:
630
- "Attach a structured tag (dimension:value) to an action, memory, or observation for multi-dimensional categorization.",
631
- inputSchema: {
632
- type: "object",
633
- properties: {
634
- targetId: { type: "string", description: "ID of the target to tag" },
635
- targetType: {
636
- type: "string",
637
- description: "Type: action, memory, or observation",
638
- },
639
- dimension: { type: "string", description: "Tag dimension (e.g., priority, team, status)" },
640
- value: { type: "string", description: "Tag value (e.g., urgent, backend, reviewed)" },
641
- },
642
- required: ["targetId", "targetType", "dimension", "value"],
643
- },
644
- },
645
- {
646
- name: "memory_facet_query",
647
- description:
648
- "Query targets by facet tags with AND/OR logic. Find all actions tagged priority:urgent AND team:backend.",
649
- inputSchema: {
650
- type: "object",
651
- properties: {
652
- matchAll: {
653
- type: "string",
654
- description: "Comma-separated dimension:value pairs (AND logic)",
655
- },
656
- matchAny: {
657
- type: "string",
658
- description: "Comma-separated dimension:value pairs (OR logic)",
659
- },
660
- targetType: {
661
- type: "string",
662
- description: "Filter by type: action, memory, or observation",
663
- },
664
- },
665
- },
666
- },
667
- ];
668
-
669
- export const V061_TOOLS: McpToolDef[] = [
670
- {
671
- name: "memory_verify",
672
- description:
673
- "Verify a memory or observation by tracing its citation chain back to source observations and session context. Returns provenance information including confidence scores.",
674
- inputSchema: {
675
- type: "object",
676
- properties: {
677
- id: {
678
- type: "string",
679
- description: "Memory ID or observation ID to verify",
680
- },
681
- },
682
- required: ["id"],
683
- },
684
- },
685
- ];
686
-
687
- export const V070_TOOLS: McpToolDef[] = [
688
- {
689
- name: "memory_lesson_save",
690
- description:
691
- "Save a lesson learned from this session. Lessons have confidence scores that strengthen when reinforced and decay when not used. Duplicate content auto-strengthens the existing lesson.",
692
- inputSchema: {
693
- type: "object",
694
- properties: {
695
- content: {
696
- type: "string",
697
- description: "The lesson learned (what worked, what to avoid, when to use X approach)",
698
- },
699
- context: {
700
- type: "string",
701
- description: "When/where this lesson applies",
702
- },
703
- confidence: {
704
- type: "number",
705
- description: "Initial confidence 0.0-1.0 (default 0.5)",
706
- },
707
- project: { type: "string", description: "Project this lesson is about" },
708
- tags: { type: "string", description: "Comma-separated tags" },
709
- },
710
- required: ["content"],
711
- },
712
- },
713
- {
714
- name: "memory_lesson_recall",
715
- description:
716
- "Search lessons by query. Returns lessons sorted by confidence and recency. Use to check what the agent has learned before making decisions.",
717
- inputSchema: {
718
- type: "object",
719
- properties: {
720
- query: { type: "string", description: "Search query" },
721
- project: { type: "string", description: "Filter by project" },
722
- minConfidence: {
723
- type: "number",
724
- description: "Minimum confidence threshold (default 0.1)",
725
- },
726
- limit: { type: "number", description: "Max results (default 10)" },
727
- },
728
- required: ["query"],
729
- },
730
- },
731
- {
732
- name: "memory_obsidian_export",
733
- description:
734
- "Export memories, lessons, and crystals as Obsidian-compatible Markdown files with YAML frontmatter and wikilinks for graph view.",
735
- inputSchema: {
736
- type: "object",
737
- properties: {
738
- vaultDir: {
739
- type: "string",
740
- description: "Output directory (default ~/.agentmemory/vault/)",
741
- },
742
- types: {
743
- type: "string",
744
- description: "Comma-separated types to export: memories,lessons,crystals,sessions (default all)",
745
- },
746
- },
747
- },
748
- },
749
- ];
750
-
751
- const ESSENTIAL_TOOLS = new Set([
752
- "memory_save",
753
- "memory_recall",
754
- "memory_consolidate",
755
- "memory_smart_search",
756
- "memory_sessions",
757
- "memory_diagnose",
758
- "memory_lesson_save",
759
- ]);
760
-
761
- export function getAllTools(): McpToolDef[] {
762
- return [...CORE_TOOLS, ...V040_TOOLS, ...V050_TOOLS, ...V051_TOOLS, ...V061_TOOLS, ...V070_TOOLS];
763
- }
764
-
765
- export function getVisibleTools(): McpToolDef[] {
766
- const mode = process.env["AGENTMEMORY_TOOLS"] || "core";
767
- if (mode === "all") return getAllTools();
768
- return getAllTools().filter((t) => ESSENTIAL_TOOLS.has(t.name));
769
- }