@akashabot/openclaw-mem 0.4.0 → 0.5.0

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 (3) hide show
  1. package/dist/cli.js +28 -1
  2. package/package.json +2 -2
  3. package/src/cli.ts +35 -0
package/dist/cli.js CHANGED
@@ -7,7 +7,9 @@ const { addItem, hybridSearch, hybridSearchFiltered, initSchema, openDb, runMigr
7
7
  // Phase 2: Facts
8
8
  insertFact, getFactsBySubject, getFactsByPredicate, searchFacts, getAllFacts, listSubjects, listPredicates, deleteFact, extractFactsSimple,
9
9
  // Phase 3: Knowledge Graph
10
- getEntityGraph, getRelatedEntities, findPaths, getGraphStats, exportGraphJson, searchEntities, } = core;
10
+ getEntityGraph, getRelatedEntities, findPaths, getGraphStats, exportGraphJson, searchEntities,
11
+ // Phase 3: Embedding Optimizations
12
+ getEmbeddingStats, quantizeF32ToF16, dequantizeF16ToF32, cosineSimilarity, benchmarkCosineSimilarity, runEmbeddingBenchmark, } = core;
11
13
  const program = new Command();
12
14
  program
13
15
  .name('openclaw-mem')
@@ -405,4 +407,29 @@ program
405
407
  console.log(JSON.stringify({ ok: true, pattern, count: entities.length, entities }));
406
408
  });
407
409
  });
410
+ // ============================================================================
411
+ // Phase 3: Embedding Optimization commands
412
+ // ============================================================================
413
+ program
414
+ .command('embedding-stats')
415
+ .description('Get statistics about stored embeddings')
416
+ .action(() => {
417
+ withDb((dbPath) => {
418
+ const db = openDb(dbPath);
419
+ initSchema(db);
420
+ const stats = getEmbeddingStats(db);
421
+ const sizeMB = Math.round((stats.totalSizeBytes / (1024 * 1024)) * 100) / 100;
422
+ console.log(JSON.stringify({ ok: true, ...stats, sizeMB }, null, 2));
423
+ });
424
+ });
425
+ program
426
+ .command('benchmark')
427
+ .description('Run embedding operation benchmarks')
428
+ .option('--dims <n>', 'Vector dimensions (default 1024)', '1024')
429
+ .option('--iterations <n>', 'Iterations (default 5000)', '5000')
430
+ .action((cmdOpts) => {
431
+ console.log('Running embedding benchmarks...\n');
432
+ const results = runEmbeddingBenchmark();
433
+ console.log(JSON.stringify({ ok: true, benchmark: results }, null, 2));
434
+ });
408
435
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akashabot/openclaw-mem",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "CLI for OpenClaw Offline Memory (SQLite FTS + optional embeddings)",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "commander": "^12.1.0",
19
19
  "uuid": "^10.0.0",
20
- "@akashabot/openclaw-memory-offline-core": "^0.4.0"
20
+ "@akashabot/openclaw-memory-offline-core": "^0.5.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/uuid": "^10.0.0"
package/src/cli.ts CHANGED
@@ -34,6 +34,13 @@ const {
34
34
  getGraphStats,
35
35
  exportGraphJson,
36
36
  searchEntities,
37
+ // Phase 3: Embedding Optimizations
38
+ getEmbeddingStats,
39
+ quantizeF32ToF16,
40
+ dequantizeF16ToF32,
41
+ cosineSimilarity,
42
+ benchmarkCosineSimilarity,
43
+ runEmbeddingBenchmark,
37
44
  } = core;
38
45
 
39
46
  const program = new Command();
@@ -484,4 +491,32 @@ program
484
491
  });
485
492
  });
486
493
 
494
+ // ============================================================================
495
+ // Phase 3: Embedding Optimization commands
496
+ // ============================================================================
497
+
498
+ program
499
+ .command('embedding-stats')
500
+ .description('Get statistics about stored embeddings')
501
+ .action(() => {
502
+ withDb((dbPath) => {
503
+ const db = openDb(dbPath);
504
+ initSchema(db);
505
+ const stats = getEmbeddingStats(db);
506
+ const sizeMB = Math.round((stats.totalSizeBytes / (1024 * 1024)) * 100) / 100;
507
+ console.log(JSON.stringify({ ok: true, ...stats, sizeMB }, null, 2));
508
+ });
509
+ });
510
+
511
+ program
512
+ .command('benchmark')
513
+ .description('Run embedding operation benchmarks')
514
+ .option('--dims <n>', 'Vector dimensions (default 1024)', '1024')
515
+ .option('--iterations <n>', 'Iterations (default 5000)', '5000')
516
+ .action((cmdOpts) => {
517
+ console.log('Running embedding benchmarks...\n');
518
+ const results = runEmbeddingBenchmark();
519
+ console.log(JSON.stringify({ ok: true, benchmark: results }, null, 2));
520
+ });
521
+
487
522
  program.parse();