@yamo/memory-mesh 3.0.1 → 3.0.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.
- package/README.md +1 -1
- package/bin/memory_mesh.js +95 -8
- package/package.json +2 -1
package/README.md
CHANGED
package/bin/memory_mesh.js
CHANGED
|
@@ -1,14 +1,101 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* MemoryMesh CLI
|
|
5
|
-
*
|
|
4
|
+
* YAMO MemoryMesh CLI - Protocol-Native Edition (v3.1.0)
|
|
5
|
+
*
|
|
6
|
+
* Enforces the "Zero JSON" mandate by using standard CLI flags.
|
|
7
|
+
* Machines don't parse YAMO; they execute commands.
|
|
6
8
|
*/
|
|
7
9
|
|
|
8
|
-
import {
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
import { MemoryMesh } from '../lib/memory/index.js';
|
|
12
|
+
import { createLogger } from '../lib/utils/logger.js';
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const logger = createLogger('memory-mesh-cli');
|
|
15
|
+
const program = new Command();
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.name('memory-mesh')
|
|
19
|
+
.description('Portable semantic memory subconscious for YAMO agents')
|
|
20
|
+
.version('3.1.0');
|
|
21
|
+
|
|
22
|
+
// 1. Store/Ingest Command
|
|
23
|
+
program
|
|
24
|
+
.command('store')
|
|
25
|
+
.alias('ingest')
|
|
26
|
+
.description('Persist a semantic memory')
|
|
27
|
+
.requiredOption('-c, --content <text>', 'The memory content')
|
|
28
|
+
.option('-t, --type <type>', 'Memory type (e.g., insight, decision, error)', 'event')
|
|
29
|
+
.option('-r, --rationale <text>', 'The constitutional rationale for this memory')
|
|
30
|
+
.option('-h, --hypothesis <text>', 'The associated hypothesis')
|
|
31
|
+
.option('--metadata <json>', 'Additional metadata (as flat flags or optional JSON)', '{}')
|
|
32
|
+
.action(async (options) => {
|
|
33
|
+
const mesh = new MemoryMesh();
|
|
34
|
+
try {
|
|
35
|
+
let metadata = {};
|
|
36
|
+
try {
|
|
37
|
+
metadata = JSON.parse(options.metadata);
|
|
38
|
+
} catch (_e) {
|
|
39
|
+
// Fallback to empty if invalid JSON
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (options.type) metadata.type = options.type;
|
|
43
|
+
if (options.rationale) metadata.rationale = options.rationale;
|
|
44
|
+
if (options.hypothesis) metadata.hypothesis = options.hypothesis;
|
|
45
|
+
|
|
46
|
+
const record = await mesh.add(options.content, metadata);
|
|
47
|
+
process.stdout.write(`[MemoryMesh] Ingested record ${record.id}\n`);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
console.error(`❌ Error: ${err.message}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
} finally {
|
|
52
|
+
await mesh.close();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 2. Search Command
|
|
57
|
+
program
|
|
58
|
+
.command('search')
|
|
59
|
+
.description('Perform semantic recall')
|
|
60
|
+
.argument('<query>', 'The semantic search query')
|
|
61
|
+
.option('-l, --limit <number>', 'Number of results', '10')
|
|
62
|
+
.option('-f, --filter <string>', 'LanceDB SQL-style filter')
|
|
63
|
+
.action(async (query, options) => {
|
|
64
|
+
const mesh = new MemoryMesh();
|
|
65
|
+
try {
|
|
66
|
+
const results = await mesh.search(query, {
|
|
67
|
+
limit: parseInt(options.limit),
|
|
68
|
+
filter: options.filter || null
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
process.stdout.write(`[MemoryMesh] Found ${results.length} matches.\n`);
|
|
72
|
+
process.stdout.write(mesh.formatResults(results));
|
|
73
|
+
process.stdout.write('\n');
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error(`❌ Error: ${err.message}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
} finally {
|
|
78
|
+
await mesh.close();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// 3. Stats Command
|
|
83
|
+
program
|
|
84
|
+
.command('stats')
|
|
85
|
+
.description('Get database health and statistics')
|
|
86
|
+
.action(async () => {
|
|
87
|
+
const mesh = new MemoryMesh();
|
|
88
|
+
try {
|
|
89
|
+
const stats = await mesh.stats();
|
|
90
|
+
process.stdout.write(`[MemoryMesh] Total Memories: ${stats.count}\n`);
|
|
91
|
+
process.stdout.write(`[MemoryMesh] DB Path: ${stats.uri}\n`);
|
|
92
|
+
process.stdout.write(`[MemoryMesh] Status: ${stats.isConnected ? 'Connected' : 'Disconnected'}\n`);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.error(`❌ Error: ${err.message}`);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
} finally {
|
|
97
|
+
await mesh.close();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamo/memory-mesh",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Portable semantic memory system with Layer 0 Scrubber for YAMO agents (v3 Singularity Edition)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/memory/index.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@lancedb/lancedb": "^0.23.0",
|
|
27
27
|
"@xenova/transformers": "^2.17.0",
|
|
28
28
|
"apache-arrow": "^17.0.0",
|
|
29
|
+
"commander": "^14.0.3",
|
|
29
30
|
"onnxruntime-node": "^1.18.0",
|
|
30
31
|
"pino": "^10.3.1",
|
|
31
32
|
"pino-pretty": "^13.1.3"
|