@prometheus-ai/memory 0.5.4 → 0.5.8
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.
- package/CHANGELOG.md +15 -0
- package/README.md +4 -4
- package/dist/types/config.d.ts +13 -2
- package/dist/types/core/beam/store.d.ts +20 -0
- package/dist/types/core/embeddings.d.ts +2 -1
- package/dist/types/core/extraction/client.d.ts +11 -7
- package/dist/types/core/extraction.d.ts +2 -1
- package/dist/types/core/fastembed-runtime.d.ts +4 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/llm-backends.d.ts +2 -0
- package/dist/types/core/local-llm.d.ts +8 -3
- package/dist/types/core/memory.d.ts +12 -3
- package/dist/types/core/query-cache.d.ts +1 -2
- package/dist/types/core/runtime-options.d.ts +10 -5
- package/dist/types/core/shmr.d.ts +11 -5
- package/dist/types/core/vector-index.d.ts +16 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +30 -7
- package/src/cli.ts +19 -19
- package/src/config.ts +98 -68
- package/src/core/banks.ts +2 -2
- package/src/core/beam/consolidate.ts +34 -5
- package/src/core/beam/helpers.ts +21 -28
- package/src/core/beam/index.ts +2 -2
- package/src/core/beam/recall.ts +98 -25
- package/src/core/beam/store.ts +96 -4
- package/src/core/binary-vectors.ts +1 -1
- package/src/core/content-sanitizer.ts +3 -3
- package/src/core/cost-log.ts +1 -1
- package/src/core/embeddings.ts +75 -50
- package/src/core/extraction/client.ts +44 -20
- package/src/core/extraction.ts +10 -9
- package/src/core/fastembed-runtime.ts +89 -0
- package/src/core/index.ts +1 -0
- package/src/core/llm-backends.ts +3 -0
- package/src/core/local-llm.ts +81 -43
- package/src/core/memory.ts +25 -5
- package/src/core/plugins.ts +1 -1
- package/src/core/polyphonic-recall.ts +4 -4
- package/src/core/query-cache.ts +2 -3
- package/src/core/runtime-options.ts +13 -5
- package/src/core/shmr.ts +141 -39
- package/src/core/streaming.ts +1 -1
- package/src/core/triples.ts +3 -3
- package/src/core/vector-index.ts +84 -0
- package/src/diagnose.ts +2 -2
- package/src/dr/recovery.ts +5 -5
- package/src/index.ts +1 -1
- package/src/mcp-server.ts +2 -2
- package/src/mcp-tools.ts +61 -61
package/src/mcp-tools.ts
CHANGED
|
@@ -282,113 +282,113 @@ export const GRAPH_LINK_SCHEMA = {
|
|
|
282
282
|
|
|
283
283
|
export const TOOLS: readonly ToolDefinition[] = [
|
|
284
284
|
{
|
|
285
|
-
name: "
|
|
286
|
-
description: "Store a durable memory in
|
|
285
|
+
name: "mnemopi_remember",
|
|
286
|
+
description: "Store a durable memory in Mnemopi.",
|
|
287
287
|
inputSchema: REMEMBER_SCHEMA,
|
|
288
288
|
},
|
|
289
289
|
{
|
|
290
|
-
name: "
|
|
290
|
+
name: "mnemopi_recall",
|
|
291
291
|
description: "Search memories with hybrid scoring.",
|
|
292
292
|
inputSchema: RECALL_SCHEMA,
|
|
293
293
|
},
|
|
294
294
|
{
|
|
295
|
-
name: "
|
|
295
|
+
name: "mnemopi_shared_remember",
|
|
296
296
|
description: "Store compact cross-agent surface memory.",
|
|
297
297
|
inputSchema: SHARED_REMEMBER_SCHEMA,
|
|
298
298
|
},
|
|
299
299
|
{
|
|
300
|
-
name: "
|
|
301
|
-
description: "Search only the shared
|
|
300
|
+
name: "mnemopi_shared_recall",
|
|
301
|
+
description: "Search only the shared Mnemopi surface DB.",
|
|
302
302
|
inputSchema: SHARED_RECALL_SCHEMA,
|
|
303
303
|
},
|
|
304
304
|
{
|
|
305
|
-
name: "
|
|
305
|
+
name: "mnemopi_shared_forget",
|
|
306
306
|
description: "Delete one shared-surface memory by ID.",
|
|
307
307
|
inputSchema: SHARED_FORGET_SCHEMA,
|
|
308
308
|
},
|
|
309
309
|
{
|
|
310
|
-
name: "
|
|
310
|
+
name: "mnemopi_shared_stats",
|
|
311
311
|
description: "Return shared surface DB path and counts.",
|
|
312
312
|
inputSchema: EMPTY_SCHEMA,
|
|
313
313
|
},
|
|
314
314
|
{
|
|
315
|
-
name: "
|
|
315
|
+
name: "mnemopi_sleep",
|
|
316
316
|
description: "Run the consolidation sleep cycle.",
|
|
317
317
|
inputSchema: SLEEP_SCHEMA,
|
|
318
318
|
},
|
|
319
319
|
{
|
|
320
|
-
name: "
|
|
321
|
-
description: "Return
|
|
320
|
+
name: "mnemopi_stats",
|
|
321
|
+
description: "Return Mnemopi memory statistics.",
|
|
322
322
|
inputSchema: EMPTY_SCHEMA,
|
|
323
323
|
},
|
|
324
324
|
{
|
|
325
|
-
name: "
|
|
325
|
+
name: "mnemopi_invalidate",
|
|
326
326
|
description: "Mark a memory as expired or superseded.",
|
|
327
327
|
inputSchema: INVALIDATE_SCHEMA,
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
|
-
name: "
|
|
330
|
+
name: "mnemopi_validate",
|
|
331
331
|
description: "Attest, update, invalidate, or delete a memory.",
|
|
332
332
|
inputSchema: VALIDATE_SCHEMA,
|
|
333
333
|
},
|
|
334
|
-
{ name: "
|
|
334
|
+
{ name: "mnemopi_get", description: "Retrieve one memory by ID.", inputSchema: GET_SCHEMA },
|
|
335
335
|
{
|
|
336
|
-
name: "
|
|
336
|
+
name: "mnemopi_triple_add",
|
|
337
337
|
description: "Add a temporal fact triple.",
|
|
338
338
|
inputSchema: TRIPLE_ADD_SCHEMA,
|
|
339
339
|
},
|
|
340
340
|
{
|
|
341
|
-
name: "
|
|
341
|
+
name: "mnemopi_triple_query",
|
|
342
342
|
description: "Query temporal fact triples.",
|
|
343
343
|
inputSchema: TRIPLE_QUERY_SCHEMA,
|
|
344
344
|
},
|
|
345
345
|
{
|
|
346
|
-
name: "
|
|
346
|
+
name: "mnemopi_scratchpad_write",
|
|
347
347
|
description: "Write a temporary scratchpad note.",
|
|
348
348
|
inputSchema: SCRATCHPAD_WRITE_SCHEMA,
|
|
349
349
|
},
|
|
350
350
|
{
|
|
351
|
-
name: "
|
|
351
|
+
name: "mnemopi_scratchpad_read",
|
|
352
352
|
description: "Read scratchpad entries.",
|
|
353
353
|
inputSchema: SCRATCHPAD_READ_SCHEMA,
|
|
354
354
|
},
|
|
355
355
|
{
|
|
356
|
-
name: "
|
|
356
|
+
name: "mnemopi_scratchpad_clear",
|
|
357
357
|
description: "Clear scratchpad entries.",
|
|
358
358
|
inputSchema: SCRATCHPAD_CLEAR_SCHEMA,
|
|
359
359
|
},
|
|
360
360
|
{
|
|
361
|
-
name: "
|
|
362
|
-
description: "Export
|
|
361
|
+
name: "mnemopi_export",
|
|
362
|
+
description: "Export Mnemopi memories to a JSON file.",
|
|
363
363
|
inputSchema: EXPORT_SCHEMA,
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
|
-
name: "
|
|
366
|
+
name: "mnemopi_update",
|
|
367
367
|
description: "Update the content or importance of an existing memory.",
|
|
368
368
|
inputSchema: UPDATE_SCHEMA,
|
|
369
369
|
},
|
|
370
370
|
{
|
|
371
|
-
name: "
|
|
371
|
+
name: "mnemopi_forget",
|
|
372
372
|
description: "Permanently delete a memory by ID.",
|
|
373
373
|
inputSchema: FORGET_SCHEMA,
|
|
374
374
|
},
|
|
375
375
|
{
|
|
376
|
-
name: "
|
|
377
|
-
description: "Import
|
|
376
|
+
name: "mnemopi_import",
|
|
377
|
+
description: "Import Mnemopi memories from a JSON file.",
|
|
378
378
|
inputSchema: IMPORT_SCHEMA,
|
|
379
379
|
},
|
|
380
380
|
{
|
|
381
|
-
name: "
|
|
382
|
-
description: "Run PII-safe diagnostics on the active
|
|
381
|
+
name: "mnemopi_diagnose",
|
|
382
|
+
description: "Run PII-safe diagnostics on the active Mnemopi database.",
|
|
383
383
|
inputSchema: EMPTY_SCHEMA,
|
|
384
384
|
},
|
|
385
385
|
{
|
|
386
|
-
name: "
|
|
386
|
+
name: "mnemopi_graph_query",
|
|
387
387
|
description: "Traverse the memory graph from a seed memory.",
|
|
388
388
|
inputSchema: GRAPH_QUERY_SCHEMA,
|
|
389
389
|
},
|
|
390
390
|
{
|
|
391
|
-
name: "
|
|
391
|
+
name: "mnemopi_graph_link",
|
|
392
392
|
description: "Declare a semantic edge between two memories.",
|
|
393
393
|
inputSchema: GRAPH_LINK_SCHEMA,
|
|
394
394
|
},
|
|
@@ -423,7 +423,7 @@ function metadataArg(args: ToolArguments): Record<string, JsonValue> | null {
|
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
function resolveBank(args: ToolArguments): string {
|
|
426
|
-
return stringArg(args, "bank") || process.env.
|
|
426
|
+
return stringArg(args, "bank") || process.env.MNEMOPROMETHEUS_MCP_BANK || "default";
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
function bankDbPath(bank: string): string {
|
|
@@ -431,18 +431,18 @@ function bankDbPath(bank: string): string {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
function createBeam(args: ToolArguments, bank = resolveBank(args)): BeamMemory {
|
|
434
|
-
const sessionId = process.env.
|
|
434
|
+
const sessionId = process.env.MNEMOPROMETHEUS_SESSION_ID || `mcp_${bank}`;
|
|
435
435
|
return new BeamMemory({
|
|
436
436
|
sessionId,
|
|
437
437
|
dbPath: bankDbPath(bank),
|
|
438
|
-
authorId: optionalStringArg(args, "author_id") ?? process.env.
|
|
439
|
-
authorType: optionalStringArg(args, "author_type") ?? process.env.
|
|
440
|
-
channelId: optionalStringArg(args, "channel_id") ?? process.env.
|
|
438
|
+
authorId: optionalStringArg(args, "author_id") ?? process.env.MNEMOPROMETHEUS_AUTHOR_ID ?? null,
|
|
439
|
+
authorType: optionalStringArg(args, "author_type") ?? process.env.MNEMOPROMETHEUS_AUTHOR_TYPE ?? null,
|
|
440
|
+
channelId: optionalStringArg(args, "channel_id") ?? process.env.MNEMOPROMETHEUS_CHANNEL_ID ?? sessionId,
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
function sharedBeam(): BeamMemory {
|
|
445
|
-
const configured = process.env.
|
|
445
|
+
const configured = process.env.MNEMOPROMETHEUS_SHARED_SURFACE_DB;
|
|
446
446
|
const dbPath = configured && configured.length > 0 ? configured : join(dataDir(), "shared", DEFAULT_DB_FILENAME);
|
|
447
447
|
return new BeamMemory({ sessionId: "mcp_shared_surface", dbPath });
|
|
448
448
|
}
|
|
@@ -564,7 +564,7 @@ async function handleSleep(args: ToolArguments): Promise<ToolResult> {
|
|
|
564
564
|
async function handleStats(args: ToolArguments): Promise<ToolResult> {
|
|
565
565
|
return withBeam(args, (beam, bank) => ({
|
|
566
566
|
status: "ok",
|
|
567
|
-
provider: "
|
|
567
|
+
provider: "mnemopi",
|
|
568
568
|
bank,
|
|
569
569
|
working: serialize(beam.getWorkingStats()),
|
|
570
570
|
episodic: serialize(beam.getEpisodicStats()),
|
|
@@ -796,7 +796,7 @@ async function handleSharedForget(args: ToolArguments): Promise<ToolResult> {
|
|
|
796
796
|
|
|
797
797
|
async function handleSharedStats(): Promise<ToolResult> {
|
|
798
798
|
return withSharedBeam(beam => ({
|
|
799
|
-
provider: "
|
|
799
|
+
provider: "mnemopi_shared",
|
|
800
800
|
working: serialize(beam.getWorkingStats()),
|
|
801
801
|
episodic: serialize(beam.getEpisodicStats()),
|
|
802
802
|
}));
|
|
@@ -934,30 +934,30 @@ async function handleGraphLink(args: ToolArguments): Promise<ToolResult> {
|
|
|
934
934
|
type Handler = (args: ToolArguments) => ToolResult | Promise<ToolResult>;
|
|
935
935
|
|
|
936
936
|
const TOOL_HANDLERS: Record<string, Handler> = {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
937
|
+
mnemopi_remember: handleRemember,
|
|
938
|
+
mnemopi_recall: handleRecall,
|
|
939
|
+
mnemopi_shared_remember: handleSharedRemember,
|
|
940
|
+
mnemopi_shared_recall: handleSharedRecall,
|
|
941
|
+
mnemopi_shared_forget: handleSharedForget,
|
|
942
|
+
mnemopi_shared_stats: () => handleSharedStats(),
|
|
943
|
+
mnemopi_sleep: handleSleep,
|
|
944
|
+
mnemopi_stats: handleStats,
|
|
945
|
+
mnemopi_get_stats: handleStats,
|
|
946
|
+
mnemopi_invalidate: handleInvalidate,
|
|
947
|
+
mnemopi_validate: handleValidate,
|
|
948
|
+
mnemopi_get: handleGet,
|
|
949
|
+
mnemopi_triple_add: handleTripleAdd,
|
|
950
|
+
mnemopi_triple_query: handleTripleQuery,
|
|
951
|
+
mnemopi_scratchpad_write: handleScratchpadWrite,
|
|
952
|
+
mnemopi_scratchpad_read: handleScratchpadRead,
|
|
953
|
+
mnemopi_scratchpad_clear: handleScratchpadClear,
|
|
954
|
+
mnemopi_export: handleExport,
|
|
955
|
+
mnemopi_update: handleUpdate,
|
|
956
|
+
mnemopi_forget: handleForget,
|
|
957
|
+
mnemopi_import: handleImport,
|
|
958
|
+
mnemopi_diagnose: handleDiagnose,
|
|
959
|
+
mnemopi_graph_query: handleGraphQuery,
|
|
960
|
+
mnemopi_graph_link: handleGraphLink,
|
|
961
961
|
};
|
|
962
962
|
|
|
963
963
|
export async function handleToolCall(name: string, args: ToolArguments = {}): Promise<ToolResult> {
|