@yamo/memory-mesh 3.0.1 → 3.0.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.
package/README.md CHANGED
@@ -27,10 +27,10 @@ npm install @yamo/memory-mesh
27
27
 
28
28
  ```bash
29
29
  # Store a memory (automatically scrubbed & embedded)
30
- memory-mesh store "My important memory" '{"tag":"test"}'
30
+ memory-mesh store --content "My important memory" --type "insight" --rationale "Documentation upgrade"
31
31
 
32
32
  # Search memories
33
- memory-mesh search "query" 5
33
+ memory-mesh search "query" --limit 5
34
34
  ```
35
35
 
36
36
  ### Node.js API
@@ -245,7 +245,7 @@ LANCEDB_URI=./data/lancedb
245
245
 
246
246
  # Embeddings (local default)
247
247
  EMBEDDING_MODEL_TYPE=local
248
- EMBEDDING_MODEL_NAME=Xenova/all-MiniLM-L6-v2
248
+ EMBEDDING_MODEL_NAME=hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf
249
249
  ```
250
250
 
251
251
 
@@ -1,14 +1,101 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * MemoryMesh CLI Entry Point
5
- * Delegates to the core CLI handler in lib/memory/memory-mesh.js
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 { run } from '@yamo/memory-mesh';
10
+ import { Command } from 'commander';
11
+ import { MemoryMesh } from '../lib/memory/index.js';
12
+ import { createLogger } from '../lib/utils/logger.js';
9
13
 
10
- // Execute the main CLI handler
11
- run().catch(err => {
12
- console.error(`❌ Fatal Error: ${err.message}`);
13
- process.exit(1);
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();
@@ -105,6 +105,18 @@ export declare class MemoryMesh {
105
105
  metadata: {};
106
106
  created_at: string;
107
107
  }>;
108
+ /**
109
+ * Semantic alias for add().
110
+ * @param content - The text content to store
111
+ * @param metadata - Optional metadata
112
+ * @returns Promise with memory record
113
+ */
114
+ ingest(content: any, metadata?: {}): Promise<{
115
+ id: any;
116
+ content: string;
117
+ metadata: {};
118
+ created_at: string;
119
+ }>;
108
120
  /**
109
121
  * Reflect on recent memories
110
122
  */
@@ -437,6 +437,15 @@ export class MemoryMesh {
437
437
  throw error instanceof Error ? error : new Error(String(error));
438
438
  }
439
439
  }
440
+ /**
441
+ * Semantic alias for add().
442
+ * @param content - The text content to store
443
+ * @param metadata - Optional metadata
444
+ * @returns Promise with memory record
445
+ */
446
+ async ingest(content, metadata = {}) {
447
+ return this.add(content, metadata);
448
+ }
440
449
  /**
441
450
  * Reflect on recent memories
442
451
  */
@@ -437,6 +437,15 @@ export class MemoryMesh {
437
437
  throw error instanceof Error ? error : new Error(String(error));
438
438
  }
439
439
  }
440
+ /**
441
+ * Semantic alias for add().
442
+ * @param content - The text content to store
443
+ * @param metadata - Optional metadata
444
+ * @returns Promise with memory record
445
+ */
446
+ async ingest(content, metadata = {}) {
447
+ return this.add(content, metadata);
448
+ }
440
449
  /**
441
450
  * Reflect on recent memories
442
451
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamo/memory-mesh",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
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"