monomind 1.10.0 → 1.10.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/.claude/commands/monomind/understand.md +111 -70
- package/.claude/settings.local.json +1 -2
- package/package.json +1 -1
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.d.ts +32 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.js +297 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.d.ts +8 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js +73 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.d.ts +12 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.js +43 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.d.ts +5 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +120 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.d.ts +21 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.js +195 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.d.ts +21 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.js +68 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.d.ts +20 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.js +158 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.js +88 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.js +121 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.js +121 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.js +181 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.js +117 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.js +112 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.js +130 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.js +230 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.js +120 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.js +195 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.js +110 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.js +122 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.js +295 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.d.ts +38 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.js +242 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts +48 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.js +137 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.d.ts +7 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.js +2 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.d.ts +28 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.js +26 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.d.ts +27 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.js +269 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.d.ts +26 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.js +214 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.d.ts +124 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.js +2 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.d.ts +4 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.js +574 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.js.map +1 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.js +76 -0
- package/packages/@monomind/cli/dist/src/agents/index.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/index.js +13 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.js +69 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +49 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +80 -0
- package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +36 -0
- package/packages/@monomind/cli/dist/src/agents/registry-builder.js +200 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +71 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.js +125 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.js +22 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +40 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +54 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +212 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +84 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.js +38 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +64 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +308 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.js +64 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.js +235 -0
- package/packages/@monomind/cli/dist/src/autopilot-state.d.ts +77 -0
- package/packages/@monomind/cli/dist/src/autopilot-state.js +330 -0
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.d.ts +87 -0
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +273 -0
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.d.ts +36 -0
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +114 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +404 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +333 -0
- package/packages/@monomind/cli/dist/src/commands/agent.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/agent.js +943 -0
- package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/commands/analyze.js +2048 -0
- package/packages/@monomind/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/commands/appliance-advanced.js +238 -0
- package/packages/@monomind/cli/dist/src/commands/appliance.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/appliance.js +406 -0
- package/packages/@monomind/cli/dist/src/commands/autopilot.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/commands/autopilot.js +362 -0
- package/packages/@monomind/cli/dist/src/commands/benchmark.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +571 -0
- package/packages/@monomind/cli/dist/src/commands/claims.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/claims.js +632 -0
- package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +218 -0
- package/packages/@monomind/cli/dist/src/commands/completions.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/completions.js +539 -0
- package/packages/@monomind/cli/dist/src/commands/config.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/config.js +460 -0
- package/packages/@monomind/cli/dist/src/commands/daemon.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/daemon.js +671 -0
- package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/deployment.js +691 -0
- package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/doctor.js +647 -0
- package/packages/@monomind/cli/dist/src/commands/embeddings.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/embeddings.js +1652 -0
- package/packages/@monomind/cli/dist/src/commands/guidance.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/guidance.js +560 -0
- package/packages/@monomind/cli/dist/src/commands/hive-mind.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/hive-mind.js +1238 -0
- package/packages/@monomind/cli/dist/src/commands/hooks.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/hooks.js +4446 -0
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +119 -0
- package/packages/@monomind/cli/dist/src/commands/index.js +404 -0
- package/packages/@monomind/cli/dist/src/commands/init.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/init.js +853 -0
- package/packages/@monomind/cli/dist/src/commands/issues.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/commands/issues.js +567 -0
- package/packages/@monomind/cli/dist/src/commands/mcp.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/mcp.js +705 -0
- package/packages/@monomind/cli/dist/src/commands/memory.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/memory.js +1596 -0
- package/packages/@monomind/cli/dist/src/commands/migrate.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/migrate.js +790 -0
- package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/monograph.js +526 -0
- package/packages/@monomind/cli/dist/src/commands/neural.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/neural.js +1494 -0
- package/packages/@monomind/cli/dist/src/commands/performance.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/performance.js +601 -0
- package/packages/@monomind/cli/dist/src/commands/plugins.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/plugins.js +796 -0
- package/packages/@monomind/cli/dist/src/commands/process.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/process.js +718 -0
- package/packages/@monomind/cli/dist/src/commands/progress.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/progress.js +259 -0
- package/packages/@monomind/cli/dist/src/commands/providers.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/providers.js +391 -0
- package/packages/@monomind/cli/dist/src/commands/replay.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/replay.js +60 -0
- package/packages/@monomind/cli/dist/src/commands/route.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/commands/route.js +939 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/backup.js +746 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/benchmark.js +489 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/import.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/import.js +359 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/index.d.ts +29 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/index.js +129 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/init.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/init.js +481 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/migrate.js +497 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/optimize.js +504 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/setup.js +765 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/status.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/status.js +491 -0
- package/packages/@monomind/cli/dist/src/commands/security.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/security.js +943 -0
- package/packages/@monomind/cli/dist/src/commands/session.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/session.js +793 -0
- package/packages/@monomind/cli/dist/src/commands/start.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/start.js +432 -0
- package/packages/@monomind/cli/dist/src/commands/status.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/status.js +591 -0
- package/packages/@monomind/cli/dist/src/commands/swarm.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/swarm.js +812 -0
- package/packages/@monomind/cli/dist/src/commands/task.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/task.js +671 -0
- package/packages/@monomind/cli/dist/src/commands/tokens.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/tokens.js +107 -0
- package/packages/@monomind/cli/dist/src/commands/transfer-store.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/commands/transfer-store.js +428 -0
- package/packages/@monomind/cli/dist/src/commands/ui.js +68 -0
- package/packages/@monomind/cli/dist/src/commands/update.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/update.js +276 -0
- package/packages/@monomind/cli/dist/src/commands/workflow.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/workflow.js +644 -0
- package/packages/@monomind/cli/dist/src/config-adapter.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/config-adapter.js +186 -0
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.d.ts +50 -0
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +142 -0
- package/packages/@monomind/cli/dist/src/consensus/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/consensus/index.js +6 -0
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.d.ts +36 -0
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.js +71 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.js +25 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.js +34 -0
- package/packages/@monomind/cli/dist/src/context/index.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/index.js +12 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +19 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +26 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +93 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.js +32 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +27 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +81 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.d.ts +27 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.js +90 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +65 -0
- package/packages/@monomind/cli/dist/src/dlq/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/dlq/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +107 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +59 -0
- package/packages/@monomind/cli/dist/src/eval/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/eval/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.js +102 -0
- package/packages/@monomind/cli/dist/src/index.d.ts +82 -0
- package/packages/@monomind/cli/dist/src/index.js +580 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +558 -0
- package/packages/@monomind/cli/dist/src/init/executor.d.ts +38 -0
- package/packages/@monomind/cli/dist/src/init/executor.js +2172 -0
- package/packages/@monomind/cli/dist/src/init/helpers-generator.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/init/helpers-generator.js +1235 -0
- package/packages/@monomind/cli/dist/src/init/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/init/index.js +15 -0
- package/packages/@monomind/cli/dist/src/init/mcp-generator.d.ts +26 -0
- package/packages/@monomind/cli/dist/src/init/mcp-generator.js +99 -0
- package/packages/@monomind/cli/dist/src/init/settings-generator.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +417 -0
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.d.ts +38 -0
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +586 -0
- package/packages/@monomind/cli/dist/src/init/statusline-generator.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +1171 -0
- package/packages/@monomind/cli/dist/src/init/types.d.ts +315 -0
- package/packages/@monomind/cli/dist/src/init/types.js +254 -0
- package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/interactive/interrupt.js +71 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +48 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +61 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +246 -0
- package/packages/@monomind/cli/dist/src/mcp-client.d.ts +92 -0
- package/packages/@monomind/cli/dist/src/mcp-client.js +270 -0
- package/packages/@monomind/cli/dist/src/mcp-server.d.ts +170 -0
- package/packages/@monomind/cli/dist/src/mcp-server.js +829 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.js +244 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +607 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.js +596 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +326 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +129 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +237 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +729 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +797 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +381 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.js +728 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.js +509 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +823 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +485 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +49 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +646 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +957 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +3440 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +39 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +41 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +530 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +6306 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +718 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +656 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +350 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +30 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.js +295 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +434 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +378 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +317 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +552 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +446 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +309 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +401 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +37 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/types.js +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +230 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.js +631 -0
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +632 -0
- package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +338 -0
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +1049 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +410 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +1654 -0
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.d.ts +414 -0
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +2284 -0
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +234 -0
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +650 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +106 -0
- package/packages/@monomind/cli/dist/src/model/index.d.ts +4 -0
- package/packages/@monomind/cli/dist/src/model/index.js +4 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.js +33 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +65 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.js +138 -0
- package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/orchestration/index.js +6 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +31 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +180 -0
- package/packages/@monomind/cli/dist/src/output.d.ts +133 -0
- package/packages/@monomind/cli/dist/src/output.js +514 -0
- package/packages/@monomind/cli/dist/src/parser.d.ts +59 -0
- package/packages/@monomind/cli/dist/src/parser.js +459 -0
- package/packages/@monomind/cli/dist/src/plugins/manager.d.ts +133 -0
- package/packages/@monomind/cli/dist/src/plugins/manager.js +493 -0
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.d.ts +88 -0
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +859 -0
- package/packages/@monomind/cli/dist/src/plugins/store/index.d.ts +76 -0
- package/packages/@monomind/cli/dist/src/plugins/store/index.js +141 -0
- package/packages/@monomind/cli/dist/src/plugins/store/search.d.ts +46 -0
- package/packages/@monomind/cli/dist/src/plugins/store/search.js +230 -0
- package/packages/@monomind/cli/dist/src/plugins/store/types.d.ts +274 -0
- package/packages/@monomind/cli/dist/src/plugins/store/types.js +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +188 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.d.ts +101 -0
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +248 -0
- package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +94 -0
- package/packages/@monomind/cli/dist/src/production/error-handler.js +321 -0
- package/packages/@monomind/cli/dist/src/production/index.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/production/index.js +18 -0
- package/packages/@monomind/cli/dist/src/production/monitoring.d.ts +161 -0
- package/packages/@monomind/cli/dist/src/production/monitoring.js +360 -0
- package/packages/@monomind/cli/dist/src/production/rate-limiter.d.ts +80 -0
- package/packages/@monomind/cli/dist/src/production/rate-limiter.js +209 -0
- package/packages/@monomind/cli/dist/src/production/retry.d.ts +48 -0
- package/packages/@monomind/cli/dist/src/production/retry.js +179 -0
- package/packages/@monomind/cli/dist/src/prompt.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/prompt.js +501 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.js +284 -0
- package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.js +316 -0
- package/packages/@monomind/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/packages/@monomind/cli/dist/src/ruvector/ast-analyzer.js +277 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-router.js +539 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-tools.js +157 -0
- package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.d.ts +176 -0
- package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.js +718 -0
- package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.js +551 -0
- package/packages/@monomind/cli/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/packages/@monomind/cli/dist/src/ruvector/flash-attention.js +643 -0
- package/packages/@monomind/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/packages/@monomind/cli/dist/src/ruvector/graph-analyzer.js +929 -0
- package/packages/@monomind/cli/dist/src/ruvector/index.d.ts +39 -0
- package/packages/@monomind/cli/dist/src/ruvector/index.js +76 -0
- package/packages/@monomind/cli/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/packages/@monomind/cli/dist/src/ruvector/lora-adapter.js +455 -0
- package/packages/@monomind/cli/dist/src/ruvector/model-router.d.ts +222 -0
- package/packages/@monomind/cli/dist/src/ruvector/model-router.js +512 -0
- package/packages/@monomind/cli/dist/src/ruvector/moe-router.d.ts +213 -0
- package/packages/@monomind/cli/dist/src/ruvector/moe-router.js +649 -0
- package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.d.ts +217 -0
- package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.js +712 -0
- package/packages/@monomind/cli/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/packages/@monomind/cli/dist/src/ruvector/ruvllm-wasm.js +363 -0
- package/packages/@monomind/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/packages/@monomind/cli/dist/src/ruvector/semantic-router.js +178 -0
- package/packages/@monomind/cli/dist/src/ruvector/vector-db.d.ts +69 -0
- package/packages/@monomind/cli/dist/src/ruvector/vector-db.js +243 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +95 -0
- package/packages/@monomind/cli/dist/src/services/claim-service.d.ts +206 -0
- package/packages/@monomind/cli/dist/src/services/claim-service.js +849 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +51 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +312 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +623 -0
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.d.ts +311 -0
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.js +1167 -0
- package/packages/@monomind/cli/dist/src/services/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/services/index.js +11 -0
- package/packages/@monomind/cli/dist/src/services/registry-api.d.ts +58 -0
- package/packages/@monomind/cli/dist/src/services/registry-api.js +199 -0
- package/packages/@monomind/cli/dist/src/services/ruvector-training.d.ts +222 -0
- package/packages/@monomind/cli/dist/src/services/ruvector-training.js +696 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +248 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +1083 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +201 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.js +594 -0
- package/packages/@monomind/cli/dist/src/suggest.d.ts +53 -0
- package/packages/@monomind/cli/dist/src/suggest.js +209 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +77 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +61 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +68 -0
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +177 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +205 -0
- package/packages/@monomind/cli/dist/src/transfer/export.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/transfer/export.js +115 -0
- package/packages/@monomind/cli/dist/src/transfer/index.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/transfer/index.js +31 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/client.js +384 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.js +420 -0
- package/packages/@monomind/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/packages/@monomind/cli/dist/src/transfer/models/seraphine.js +373 -0
- package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.js +183 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.js +281 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/index.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/index.js +6 -0
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.d.ts +91 -0
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.js +437 -0
- package/packages/@monomind/cli/dist/src/transfer/store/download.d.ts +79 -0
- package/packages/@monomind/cli/dist/src/transfer/store/download.js +423 -0
- package/packages/@monomind/cli/dist/src/transfer/store/index.d.ts +84 -0
- package/packages/@monomind/cli/dist/src/transfer/store/index.js +153 -0
- package/packages/@monomind/cli/dist/src/transfer/store/publish.d.ts +76 -0
- package/packages/@monomind/cli/dist/src/transfer/store/publish.js +293 -0
- package/packages/@monomind/cli/dist/src/transfer/store/registry.d.ts +58 -0
- package/packages/@monomind/cli/dist/src/transfer/store/registry.js +301 -0
- package/packages/@monomind/cli/dist/src/transfer/store/search.d.ts +54 -0
- package/packages/@monomind/cli/dist/src/transfer/store/search.js +232 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/packages/@monomind/cli/dist/src/transfer/store/types.d.ts +193 -0
- package/packages/@monomind/cli/dist/src/transfer/store/types.js +6 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +105 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +214 -0
- package/packages/@monomind/cli/dist/src/transfer/types.d.ts +245 -0
- package/packages/@monomind/cli/dist/src/transfer/types.js +6 -0
- package/packages/@monomind/cli/dist/src/types.d.ts +198 -0
- package/packages/@monomind/cli/dist/src/types.js +38 -0
- package/packages/@monomind/cli/dist/src/update/checker.d.ts +34 -0
- package/packages/@monomind/cli/dist/src/update/checker.js +198 -0
- package/packages/@monomind/cli/dist/src/update/executor.d.ts +32 -0
- package/packages/@monomind/cli/dist/src/update/executor.js +186 -0
- package/packages/@monomind/cli/dist/src/update/index.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/update/index.js +64 -0
- package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/update/rate-limiter.js +116 -0
- package/packages/@monomind/cli/dist/src/update/validator.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/update/validator.js +118 -0
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +22 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +23 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +129 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +116 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.js +8 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +20 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +165 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/workflow/index.js +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.js +40 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +29 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +227 -0
- package/packages/@monomind/cli/package.json +2 -1
|
@@ -0,0 +1,1596 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Memory Command
|
|
3
|
+
* Memory operations for AgentDB integration
|
|
4
|
+
*/
|
|
5
|
+
import { output } from '../output.js';
|
|
6
|
+
import { select, confirm, input } from '../prompt.js';
|
|
7
|
+
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
8
|
+
import { configManager } from '../services/config-file-manager.js';
|
|
9
|
+
// Memory backends
|
|
10
|
+
const BACKENDS = [
|
|
11
|
+
{ value: 'agentdb', label: 'AgentDB', hint: 'Vector database with HNSW indexing (150x-12,500x faster)' },
|
|
12
|
+
{ value: 'sqlite', label: 'SQLite', hint: 'Lightweight local storage' },
|
|
13
|
+
{ value: 'hybrid', label: 'Hybrid', hint: 'SQLite + AgentDB (recommended)' },
|
|
14
|
+
{ value: 'memory', label: 'In-Memory', hint: 'Fast but non-persistent' }
|
|
15
|
+
];
|
|
16
|
+
// Store command
|
|
17
|
+
const storeCommand = {
|
|
18
|
+
name: 'store',
|
|
19
|
+
description: 'Store data in memory',
|
|
20
|
+
options: [
|
|
21
|
+
{
|
|
22
|
+
name: 'key',
|
|
23
|
+
short: 'k',
|
|
24
|
+
description: 'Storage key/namespace',
|
|
25
|
+
type: 'string',
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'value',
|
|
30
|
+
// Note: No short flag - global -v is reserved for verbose
|
|
31
|
+
description: 'Value to store (use --value)',
|
|
32
|
+
type: 'string'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'namespace',
|
|
36
|
+
short: 'n',
|
|
37
|
+
description: 'Memory namespace',
|
|
38
|
+
type: 'string',
|
|
39
|
+
default: 'default'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'ttl',
|
|
43
|
+
description: 'Time to live in seconds',
|
|
44
|
+
type: 'number'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'tags',
|
|
48
|
+
description: 'Comma-separated tags',
|
|
49
|
+
type: 'string'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'vector',
|
|
53
|
+
description: 'Store as vector embedding',
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'upsert',
|
|
59
|
+
short: 'u',
|
|
60
|
+
description: 'Update if key exists (insert or replace)',
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
default: false
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
examples: [
|
|
66
|
+
{ command: 'monomind memory store -k "api/auth" -v "JWT implementation"', description: 'Store text' },
|
|
67
|
+
{ command: 'monomind memory store -k "pattern/singleton" --vector', description: 'Store vector' },
|
|
68
|
+
{ command: 'monomind memory store -k "pattern" -v "updated" --upsert', description: 'Update existing' }
|
|
69
|
+
],
|
|
70
|
+
action: async (ctx) => {
|
|
71
|
+
const key = ctx.flags.key;
|
|
72
|
+
let value = ctx.flags.value || ctx.args[0];
|
|
73
|
+
const namespace = ctx.flags.namespace;
|
|
74
|
+
const ttl = ctx.flags.ttl;
|
|
75
|
+
const tags = ctx.flags.tags ? ctx.flags.tags.split(',') : [];
|
|
76
|
+
const asVector = ctx.flags.vector;
|
|
77
|
+
const upsert = ctx.flags.upsert;
|
|
78
|
+
if (!key) {
|
|
79
|
+
output.printError('Key is required. Use --key or -k');
|
|
80
|
+
return { success: false, exitCode: 1 };
|
|
81
|
+
}
|
|
82
|
+
if (!value && ctx.interactive) {
|
|
83
|
+
value = await input({
|
|
84
|
+
message: 'Enter value to store:',
|
|
85
|
+
validate: (v) => v.length > 0 || 'Value is required'
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (!value) {
|
|
89
|
+
output.printError('Value is required. Use --value');
|
|
90
|
+
return { success: false, exitCode: 1 };
|
|
91
|
+
}
|
|
92
|
+
const storeData = {
|
|
93
|
+
key,
|
|
94
|
+
namespace,
|
|
95
|
+
value,
|
|
96
|
+
ttl,
|
|
97
|
+
tags,
|
|
98
|
+
asVector,
|
|
99
|
+
storedAt: new Date().toISOString(),
|
|
100
|
+
size: Buffer.byteLength(value, 'utf8')
|
|
101
|
+
};
|
|
102
|
+
output.printInfo(`Storing in ${namespace}/${key}...`);
|
|
103
|
+
// Use direct sql.js storage with automatic embedding generation
|
|
104
|
+
try {
|
|
105
|
+
const { storeEntry } = await import('../memory/memory-initializer.js');
|
|
106
|
+
if (asVector) {
|
|
107
|
+
output.writeln(output.dim(' Generating embedding vector...'));
|
|
108
|
+
}
|
|
109
|
+
const result = await storeEntry({
|
|
110
|
+
key,
|
|
111
|
+
value,
|
|
112
|
+
namespace,
|
|
113
|
+
generateEmbeddingFlag: true, // Always generate embeddings for semantic search
|
|
114
|
+
tags,
|
|
115
|
+
ttl,
|
|
116
|
+
upsert
|
|
117
|
+
});
|
|
118
|
+
if (!result.success) {
|
|
119
|
+
output.printError(result.error || 'Failed to store');
|
|
120
|
+
return { success: false, exitCode: 1 };
|
|
121
|
+
}
|
|
122
|
+
output.writeln();
|
|
123
|
+
output.printTable({
|
|
124
|
+
columns: [
|
|
125
|
+
{ key: 'property', header: 'Property', width: 15 },
|
|
126
|
+
{ key: 'val', header: 'Value', width: 40 }
|
|
127
|
+
],
|
|
128
|
+
data: [
|
|
129
|
+
{ property: 'Key', val: key },
|
|
130
|
+
{ property: 'Namespace', val: namespace },
|
|
131
|
+
{ property: 'Size', val: `${storeData.size} bytes` },
|
|
132
|
+
{ property: 'TTL', val: ttl ? `${ttl}s` : 'None' },
|
|
133
|
+
{ property: 'Tags', val: tags.length > 0 ? tags.join(', ') : 'None' },
|
|
134
|
+
{ property: 'Vector', val: result.embedding ? `Yes (${result.embedding.dimensions}-dim)` : 'No' },
|
|
135
|
+
{ property: 'ID', val: result.id.substring(0, 20) }
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
output.writeln();
|
|
139
|
+
output.printSuccess('Data stored successfully');
|
|
140
|
+
return { success: true, data: { ...storeData, id: result.id, embedding: result.embedding } };
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
output.printError(`Failed to store: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
144
|
+
return { success: false, exitCode: 1 };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
// Retrieve command
|
|
149
|
+
const retrieveCommand = {
|
|
150
|
+
name: 'retrieve',
|
|
151
|
+
aliases: ['get'],
|
|
152
|
+
description: 'Retrieve data from memory',
|
|
153
|
+
options: [
|
|
154
|
+
{
|
|
155
|
+
name: 'key',
|
|
156
|
+
short: 'k',
|
|
157
|
+
description: 'Storage key',
|
|
158
|
+
type: 'string'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'namespace',
|
|
162
|
+
short: 'n',
|
|
163
|
+
description: 'Memory namespace',
|
|
164
|
+
type: 'string',
|
|
165
|
+
default: 'default'
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
action: async (ctx) => {
|
|
169
|
+
const key = ctx.flags.key || ctx.args[0];
|
|
170
|
+
const namespace = ctx.flags.namespace;
|
|
171
|
+
if (!key) {
|
|
172
|
+
output.printError('Key is required');
|
|
173
|
+
return { success: false, exitCode: 1 };
|
|
174
|
+
}
|
|
175
|
+
// Use sql.js directly for consistent data access
|
|
176
|
+
try {
|
|
177
|
+
const { getEntry } = await import('../memory/memory-initializer.js');
|
|
178
|
+
const result = await getEntry({ key, namespace });
|
|
179
|
+
if (!result.success) {
|
|
180
|
+
output.printError(`Failed to retrieve: ${result.error}`);
|
|
181
|
+
return { success: false, exitCode: 1 };
|
|
182
|
+
}
|
|
183
|
+
if (!result.found || !result.entry) {
|
|
184
|
+
output.printWarning(`Key not found: ${key}`);
|
|
185
|
+
return { success: false, exitCode: 1, data: { key, found: false } };
|
|
186
|
+
}
|
|
187
|
+
const entry = result.entry;
|
|
188
|
+
if (ctx.flags.format === 'json') {
|
|
189
|
+
output.printJson(entry);
|
|
190
|
+
return { success: true, data: entry };
|
|
191
|
+
}
|
|
192
|
+
output.writeln();
|
|
193
|
+
output.printBox([
|
|
194
|
+
`Namespace: ${entry.namespace}`,
|
|
195
|
+
`Key: ${entry.key}`,
|
|
196
|
+
`Size: ${entry.content.length} bytes`,
|
|
197
|
+
`Access Count: ${entry.accessCount}`,
|
|
198
|
+
`Tags: ${entry.tags.length > 0 ? entry.tags.join(', ') : 'None'}`,
|
|
199
|
+
`Vector: ${entry.hasEmbedding ? 'Yes' : 'No'}`,
|
|
200
|
+
'',
|
|
201
|
+
output.bold('Value:'),
|
|
202
|
+
entry.content
|
|
203
|
+
].join('\n'), 'Memory Entry');
|
|
204
|
+
return { success: true, data: entry };
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
output.printError(`Failed to retrieve: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
208
|
+
return { success: false, exitCode: 1 };
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
// Search command
|
|
213
|
+
const searchCommand = {
|
|
214
|
+
name: 'search',
|
|
215
|
+
description: 'Search memory with semantic/vector search',
|
|
216
|
+
options: [
|
|
217
|
+
{
|
|
218
|
+
name: 'query',
|
|
219
|
+
short: 'q',
|
|
220
|
+
description: 'Search query',
|
|
221
|
+
type: 'string',
|
|
222
|
+
required: true
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'namespace',
|
|
226
|
+
short: 'n',
|
|
227
|
+
description: 'Memory namespace',
|
|
228
|
+
type: 'string'
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'limit',
|
|
232
|
+
short: 'l',
|
|
233
|
+
description: 'Maximum results',
|
|
234
|
+
type: 'number',
|
|
235
|
+
default: 10
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: 'threshold',
|
|
239
|
+
description: 'Similarity threshold (0-1)',
|
|
240
|
+
type: 'number',
|
|
241
|
+
default: 0.7
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'type',
|
|
245
|
+
short: 't',
|
|
246
|
+
description: 'Search type (semantic, keyword, hybrid)',
|
|
247
|
+
type: 'string',
|
|
248
|
+
default: 'semantic',
|
|
249
|
+
choices: ['semantic', 'keyword', 'hybrid']
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'build-hnsw',
|
|
253
|
+
description: 'Build/rebuild HNSW index before searching (enables 150x-12,500x speedup)',
|
|
254
|
+
type: 'boolean',
|
|
255
|
+
default: false
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
examples: [
|
|
259
|
+
{ command: 'monomind memory search -q "authentication patterns"', description: 'Semantic search' },
|
|
260
|
+
{ command: 'monomind memory search -q "JWT" -t keyword', description: 'Keyword search' },
|
|
261
|
+
{ command: 'monomind memory search -q "test" --build-hnsw', description: 'Build HNSW index and search' }
|
|
262
|
+
],
|
|
263
|
+
action: async (ctx) => {
|
|
264
|
+
const query = ctx.flags.query || ctx.args[0];
|
|
265
|
+
const namespace = ctx.flags.namespace || 'all';
|
|
266
|
+
const limit = ctx.flags.limit || 10;
|
|
267
|
+
const threshold = ctx.flags.threshold || 0.3;
|
|
268
|
+
const searchType = ctx.flags.type || 'semantic';
|
|
269
|
+
const buildHnsw = (ctx.flags['build-hnsw'] || ctx.flags.buildHnsw);
|
|
270
|
+
if (!query) {
|
|
271
|
+
output.printError('Query is required. Use --query or -q');
|
|
272
|
+
return { success: false, exitCode: 1 };
|
|
273
|
+
}
|
|
274
|
+
// Build/rebuild HNSW index if requested
|
|
275
|
+
if (buildHnsw) {
|
|
276
|
+
output.printInfo('Building HNSW index...');
|
|
277
|
+
try {
|
|
278
|
+
const { getHNSWIndex, getHNSWStatus } = await import('../memory/memory-initializer.js');
|
|
279
|
+
const startTime = Date.now();
|
|
280
|
+
const index = await getHNSWIndex({ forceRebuild: true });
|
|
281
|
+
const buildTime = Date.now() - startTime;
|
|
282
|
+
if (index) {
|
|
283
|
+
const status = getHNSWStatus();
|
|
284
|
+
output.printSuccess(`HNSW index built (${status.entryCount} vectors, ${buildTime}ms)`);
|
|
285
|
+
output.writeln(output.dim(` Dimensions: ${status.dimensions}, Metric: cosine`));
|
|
286
|
+
output.writeln(output.dim(` Search speedup: ${status.entryCount > 10000 ? '12,500x' : status.entryCount > 1000 ? '150x' : '10x'}`));
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
output.printWarning('HNSW index not available (install @ruvector/core for acceleration)');
|
|
290
|
+
}
|
|
291
|
+
output.writeln();
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
output.printWarning(`HNSW build failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
295
|
+
output.writeln(output.dim(' Falling back to brute-force search'));
|
|
296
|
+
output.writeln();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
output.printInfo(`Searching: "${query}" (${searchType})`);
|
|
300
|
+
output.writeln();
|
|
301
|
+
// Use direct sql.js search with vector similarity
|
|
302
|
+
try {
|
|
303
|
+
const { searchEntries } = await import('../memory/memory-initializer.js');
|
|
304
|
+
const searchResult = await searchEntries({
|
|
305
|
+
query,
|
|
306
|
+
namespace,
|
|
307
|
+
limit,
|
|
308
|
+
threshold
|
|
309
|
+
});
|
|
310
|
+
if (!searchResult.success) {
|
|
311
|
+
output.printError(searchResult.error || 'Search failed');
|
|
312
|
+
return { success: false, exitCode: 1 };
|
|
313
|
+
}
|
|
314
|
+
const results = searchResult.results.map(r => ({
|
|
315
|
+
key: r.key,
|
|
316
|
+
score: r.score,
|
|
317
|
+
namespace: r.namespace,
|
|
318
|
+
preview: r.content
|
|
319
|
+
}));
|
|
320
|
+
if (ctx.flags.format === 'json') {
|
|
321
|
+
output.printJson({ query, searchType, results, searchTime: `${searchResult.searchTime}ms` });
|
|
322
|
+
return { success: true, data: results };
|
|
323
|
+
}
|
|
324
|
+
// Performance stats
|
|
325
|
+
output.writeln(output.dim(` Search time: ${searchResult.searchTime}ms`));
|
|
326
|
+
output.writeln();
|
|
327
|
+
if (results.length === 0) {
|
|
328
|
+
output.printWarning('No results found');
|
|
329
|
+
output.writeln(output.dim('Try: monomind memory store -k "key" --value "data"'));
|
|
330
|
+
return { success: true, data: [] };
|
|
331
|
+
}
|
|
332
|
+
output.printTable({
|
|
333
|
+
columns: [
|
|
334
|
+
{ key: 'key', header: 'Key', width: 20 },
|
|
335
|
+
{ key: 'score', header: 'Score', width: 8, align: 'right', format: (v) => Number(v).toFixed(2) },
|
|
336
|
+
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
337
|
+
{ key: 'preview', header: 'Preview', width: 35 }
|
|
338
|
+
],
|
|
339
|
+
data: results
|
|
340
|
+
});
|
|
341
|
+
output.writeln();
|
|
342
|
+
output.printInfo(`Found ${results.length} results`);
|
|
343
|
+
return { success: true, data: results };
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
output.printError(`Search failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
347
|
+
return { success: false, exitCode: 1 };
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
// List command
|
|
352
|
+
const listCommand = {
|
|
353
|
+
name: 'list',
|
|
354
|
+
aliases: ['ls'],
|
|
355
|
+
description: 'List memory entries',
|
|
356
|
+
options: [
|
|
357
|
+
{
|
|
358
|
+
name: 'namespace',
|
|
359
|
+
short: 'n',
|
|
360
|
+
description: 'Filter by namespace',
|
|
361
|
+
type: 'string'
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'tags',
|
|
365
|
+
short: 't',
|
|
366
|
+
description: 'Filter by tags (comma-separated)',
|
|
367
|
+
type: 'string'
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: 'limit',
|
|
371
|
+
short: 'l',
|
|
372
|
+
description: 'Maximum entries',
|
|
373
|
+
type: 'number',
|
|
374
|
+
default: 20
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
action: async (ctx) => {
|
|
378
|
+
const namespace = ctx.flags.namespace;
|
|
379
|
+
const limit = ctx.flags.limit;
|
|
380
|
+
// Use sql.js directly for consistent data access
|
|
381
|
+
try {
|
|
382
|
+
const { listEntries } = await import('../memory/memory-initializer.js');
|
|
383
|
+
const listResult = await listEntries({ namespace, limit, offset: 0 });
|
|
384
|
+
if (!listResult.success) {
|
|
385
|
+
output.printError(`Failed to list: ${listResult.error}`);
|
|
386
|
+
return { success: false, exitCode: 1 };
|
|
387
|
+
}
|
|
388
|
+
// Format entries for display
|
|
389
|
+
const entries = listResult.entries.map(e => ({
|
|
390
|
+
key: e.key,
|
|
391
|
+
namespace: e.namespace,
|
|
392
|
+
size: e.size + ' B',
|
|
393
|
+
vector: e.hasEmbedding ? '✓' : '-',
|
|
394
|
+
accessCount: e.accessCount,
|
|
395
|
+
updated: formatRelativeTime(e.updatedAt)
|
|
396
|
+
}));
|
|
397
|
+
if (ctx.flags.format === 'json') {
|
|
398
|
+
output.printJson(listResult.entries);
|
|
399
|
+
return { success: true, data: listResult.entries };
|
|
400
|
+
}
|
|
401
|
+
output.writeln();
|
|
402
|
+
output.writeln(output.bold('Memory Entries'));
|
|
403
|
+
output.writeln();
|
|
404
|
+
if (entries.length === 0) {
|
|
405
|
+
output.printWarning('No entries found');
|
|
406
|
+
output.printInfo('Store data: monomind memory store -k "key" --value "data"');
|
|
407
|
+
return { success: true, data: [] };
|
|
408
|
+
}
|
|
409
|
+
output.printTable({
|
|
410
|
+
columns: [
|
|
411
|
+
{ key: 'key', header: 'Key', width: 25 },
|
|
412
|
+
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
413
|
+
{ key: 'size', header: 'Size', width: 10, align: 'right' },
|
|
414
|
+
{ key: 'vector', header: 'Vector', width: 8, align: 'center' },
|
|
415
|
+
{ key: 'accessCount', header: 'Accessed', width: 10, align: 'right' },
|
|
416
|
+
{ key: 'updated', header: 'Updated', width: 12 }
|
|
417
|
+
],
|
|
418
|
+
data: entries
|
|
419
|
+
});
|
|
420
|
+
output.writeln();
|
|
421
|
+
output.printInfo(`Showing ${entries.length} of ${listResult.total} entries`);
|
|
422
|
+
return { success: true, data: listResult.entries };
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
output.printError(`Failed to list: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
426
|
+
return { success: false, exitCode: 1 };
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
// Helper function to format relative time
|
|
431
|
+
function formatRelativeTime(isoDate) {
|
|
432
|
+
const now = Date.now();
|
|
433
|
+
const date = new Date(isoDate).getTime();
|
|
434
|
+
const diff = now - date;
|
|
435
|
+
const seconds = Math.floor(diff / 1000);
|
|
436
|
+
const minutes = Math.floor(seconds / 60);
|
|
437
|
+
const hours = Math.floor(minutes / 60);
|
|
438
|
+
const days = Math.floor(hours / 24);
|
|
439
|
+
if (days > 0)
|
|
440
|
+
return `${days}d ago`;
|
|
441
|
+
if (hours > 0)
|
|
442
|
+
return `${hours}h ago`;
|
|
443
|
+
if (minutes > 0)
|
|
444
|
+
return `${minutes}m ago`;
|
|
445
|
+
return 'just now';
|
|
446
|
+
}
|
|
447
|
+
// Edit command
|
|
448
|
+
const editCommand = {
|
|
449
|
+
name: 'edit',
|
|
450
|
+
description: 'Edit a memory entry (AgentDB, Memory Palace, or knowledge chunk)',
|
|
451
|
+
options: [
|
|
452
|
+
{ name: 'key', short: 'k', description: 'Storage key (AgentDB)', type: 'string' },
|
|
453
|
+
{ name: 'namespace', short: 'n', description: 'Memory namespace (AgentDB)', type: 'string', default: 'default' },
|
|
454
|
+
{ name: 'value', description: 'New value/content', type: 'string' },
|
|
455
|
+
{ name: 'source', short: 's', description: 'Source to edit: agentdb, palace, knowledge', type: 'string', default: 'agentdb', choices: ['agentdb', 'palace', 'knowledge'] },
|
|
456
|
+
{ name: 'id', description: 'Entry ID (palace/knowledge)', type: 'string' }
|
|
457
|
+
],
|
|
458
|
+
examples: [
|
|
459
|
+
{ command: 'monomind memory edit -k "pattern/auth" --value "updated content"', description: 'Edit AgentDB entry' },
|
|
460
|
+
{ command: 'monomind memory edit --source palace --id "abc123" --value "new content"', description: 'Edit Memory Palace drawer' },
|
|
461
|
+
{ command: 'monomind memory edit --source knowledge --id "chunk-42" --value "updated"', description: 'Edit knowledge chunk' }
|
|
462
|
+
],
|
|
463
|
+
action: async (ctx) => {
|
|
464
|
+
const source = ctx.flags.source || 'agentdb';
|
|
465
|
+
let value = ctx.flags.value || ctx.args[0];
|
|
466
|
+
const fs = await import('fs');
|
|
467
|
+
const path = await import('path');
|
|
468
|
+
if (source === 'agentdb') {
|
|
469
|
+
const key = ctx.flags.key;
|
|
470
|
+
const namespace = ctx.flags.namespace || 'default';
|
|
471
|
+
if (!key) {
|
|
472
|
+
output.printError('Key is required for AgentDB edit. Use --key or -k');
|
|
473
|
+
return { success: false, exitCode: 1 };
|
|
474
|
+
}
|
|
475
|
+
if (!value && ctx.interactive) {
|
|
476
|
+
value = await input({ message: 'Enter new value:', validate: v => v.length > 0 || 'Value required' });
|
|
477
|
+
}
|
|
478
|
+
if (!value) {
|
|
479
|
+
output.printError('Value is required. Use --value');
|
|
480
|
+
return { success: false, exitCode: 1 };
|
|
481
|
+
}
|
|
482
|
+
try {
|
|
483
|
+
const { storeEntry } = await import('../memory/memory-initializer.js');
|
|
484
|
+
const result = await storeEntry({ key, value, namespace, generateEmbeddingFlag: true, upsert: true });
|
|
485
|
+
if (!result.success) {
|
|
486
|
+
output.printError(result.error || 'Failed to update');
|
|
487
|
+
return { success: false, exitCode: 1 };
|
|
488
|
+
}
|
|
489
|
+
output.printSuccess(`Updated "${key}" in namespace "${namespace}"`);
|
|
490
|
+
return { success: true, data: result };
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
output.printError(`Failed to edit: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
494
|
+
return { success: false, exitCode: 1 };
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// palace or knowledge — JSONL file edit
|
|
498
|
+
const id = ctx.flags.id;
|
|
499
|
+
if (!id) {
|
|
500
|
+
output.printError('Entry ID is required for palace/knowledge edit. Use --id');
|
|
501
|
+
return { success: false, exitCode: 1 };
|
|
502
|
+
}
|
|
503
|
+
if (!/^[a-zA-Z0-9_\-]{1,128}$/.test(id)) {
|
|
504
|
+
output.printError('ID must be 1-128 chars: alphanumeric, underscore, or hyphen only');
|
|
505
|
+
return { success: false, exitCode: 1 };
|
|
506
|
+
}
|
|
507
|
+
const filePath = source === 'palace'
|
|
508
|
+
? path.join(process.cwd(), '.monomind', 'palace', 'drawers.jsonl')
|
|
509
|
+
: path.join(process.cwd(), '.monomind', 'knowledge', 'chunks.jsonl');
|
|
510
|
+
if (!fs.existsSync(filePath)) {
|
|
511
|
+
output.printError(`File not found: ${filePath}`);
|
|
512
|
+
return { success: false, exitCode: 1 };
|
|
513
|
+
}
|
|
514
|
+
let entries;
|
|
515
|
+
try {
|
|
516
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
517
|
+
entries = [];
|
|
518
|
+
for (const line of raw.split('\n').filter(Boolean)) {
|
|
519
|
+
try {
|
|
520
|
+
entries.push(JSON.parse(line));
|
|
521
|
+
}
|
|
522
|
+
catch {
|
|
523
|
+
output.printError(`Malformed JSONL entry in ${source} file`);
|
|
524
|
+
return { success: false, exitCode: 1 };
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
catch (err) {
|
|
529
|
+
output.printError(`Failed to read ${source} file: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
530
|
+
return { success: false, exitCode: 1 };
|
|
531
|
+
}
|
|
532
|
+
const idx = entries.findIndex(e => e.id === id);
|
|
533
|
+
if (idx === -1) {
|
|
534
|
+
output.printWarning(`Entry not found with id "${id}"`);
|
|
535
|
+
return { success: false, exitCode: 1 };
|
|
536
|
+
}
|
|
537
|
+
if (!value && ctx.interactive) {
|
|
538
|
+
output.writeln(output.dim('Current content:'));
|
|
539
|
+
output.writeln(entries[idx].content || '(empty)');
|
|
540
|
+
output.writeln();
|
|
541
|
+
value = await input({ message: 'Enter new content:', validate: v => v.length > 0 || 'Content required' });
|
|
542
|
+
}
|
|
543
|
+
if (!value) {
|
|
544
|
+
output.printError('Value is required. Use --value');
|
|
545
|
+
return { success: false, exitCode: 1 };
|
|
546
|
+
}
|
|
547
|
+
entries[idx] = { ...entries[idx], content: value, ts: new Date().toISOString() };
|
|
548
|
+
try {
|
|
549
|
+
const tmpPath = filePath + '.tmp';
|
|
550
|
+
fs.writeFileSync(tmpPath, entries.map(e => JSON.stringify(e)).join('\n') + '\n');
|
|
551
|
+
fs.renameSync(tmpPath, filePath);
|
|
552
|
+
output.printSuccess(`Updated ${source} entry "${id}"`);
|
|
553
|
+
return { success: true, data: entries[idx] };
|
|
554
|
+
}
|
|
555
|
+
catch (err) {
|
|
556
|
+
output.printError(`Failed to write ${source} file: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
557
|
+
return { success: false, exitCode: 1 };
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
// Templates command
|
|
562
|
+
const templatesCommand = {
|
|
563
|
+
name: 'templates',
|
|
564
|
+
description: 'Show best-practice templates for memory entries',
|
|
565
|
+
options: [
|
|
566
|
+
{ name: 'type', short: 't', description: 'Template type: user, feedback, project, reference', type: 'string', choices: ['user', 'feedback', 'project', 'reference'] }
|
|
567
|
+
],
|
|
568
|
+
examples: [
|
|
569
|
+
{ command: 'monomind memory templates', description: 'Show all templates' },
|
|
570
|
+
{ command: 'monomind memory templates -t feedback', description: 'Show feedback template only' }
|
|
571
|
+
],
|
|
572
|
+
action: async (ctx) => {
|
|
573
|
+
const filter = ctx.flags.type;
|
|
574
|
+
const templates = {
|
|
575
|
+
user: {
|
|
576
|
+
label: 'User Memory',
|
|
577
|
+
description: 'Role, goals, preferences, knowledge level',
|
|
578
|
+
example: [
|
|
579
|
+
'---',
|
|
580
|
+
'name: user_role',
|
|
581
|
+
'description: <one-line summary of user role and context>',
|
|
582
|
+
'type: user',
|
|
583
|
+
'---',
|
|
584
|
+
'',
|
|
585
|
+
'<Role and experience description. What does the user know well? What are they new to?>',
|
|
586
|
+
'Frame explanations accordingly.'
|
|
587
|
+
].join('\n')
|
|
588
|
+
},
|
|
589
|
+
feedback: {
|
|
590
|
+
label: 'Feedback Memory',
|
|
591
|
+
description: 'How to approach work — corrections and validated choices',
|
|
592
|
+
example: [
|
|
593
|
+
'---',
|
|
594
|
+
'name: feedback_<topic>',
|
|
595
|
+
'description: <one-line rule that triggers on lookup>',
|
|
596
|
+
'type: feedback',
|
|
597
|
+
'---',
|
|
598
|
+
'',
|
|
599
|
+
'<The rule itself — what to do or avoid.>',
|
|
600
|
+
'',
|
|
601
|
+
'**Why:** <Reason the user gave — past incident, strong preference, etc.>',
|
|
602
|
+
'',
|
|
603
|
+
'**How to apply:** <When does this kick in? What edge cases does it cover?>'
|
|
604
|
+
].join('\n')
|
|
605
|
+
},
|
|
606
|
+
project: {
|
|
607
|
+
label: 'Project Memory',
|
|
608
|
+
description: 'Ongoing work context, goals, decisions, deadlines',
|
|
609
|
+
example: [
|
|
610
|
+
'---',
|
|
611
|
+
'name: project_<initiative>',
|
|
612
|
+
'description: <one-line fact about the project decision or constraint>',
|
|
613
|
+
'type: project',
|
|
614
|
+
'---',
|
|
615
|
+
'',
|
|
616
|
+
'<The fact or decision — what is happening and what was decided.>',
|
|
617
|
+
'',
|
|
618
|
+
'**Why:** <Motivation — constraint, deadline, stakeholder ask, compliance issue.>',
|
|
619
|
+
'',
|
|
620
|
+
'**How to apply:** <How should this shape future suggestions and decisions?>'
|
|
621
|
+
].join('\n')
|
|
622
|
+
},
|
|
623
|
+
reference: {
|
|
624
|
+
label: 'Reference Memory',
|
|
625
|
+
description: 'Pointers to external resources and where to find information',
|
|
626
|
+
example: [
|
|
627
|
+
'---',
|
|
628
|
+
'name: reference_<resource>',
|
|
629
|
+
'description: <what this resource contains and when to use it>',
|
|
630
|
+
'type: reference',
|
|
631
|
+
'---',
|
|
632
|
+
'',
|
|
633
|
+
'<Resource name and location (URL, project name, channel, etc.)>',
|
|
634
|
+
'',
|
|
635
|
+
'Use this when: <specific scenarios where this reference is relevant>.'
|
|
636
|
+
].join('\n')
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
output.writeln();
|
|
640
|
+
output.writeln(output.bold('Memory Entry Templates'));
|
|
641
|
+
output.writeln(output.dim('Best-practice scaffolds for .claude/projects/.../memory/ entries'));
|
|
642
|
+
output.writeln();
|
|
643
|
+
const keys = filter ? [filter] : Object.keys(templates);
|
|
644
|
+
for (const key of keys) {
|
|
645
|
+
const t = templates[key];
|
|
646
|
+
if (!t) {
|
|
647
|
+
output.printError(`Unknown type: "${key}". Valid types: user, feedback, project, reference`);
|
|
648
|
+
return { success: false, exitCode: 1 };
|
|
649
|
+
}
|
|
650
|
+
output.writeln(output.bold(`── ${t.label} (--type ${key})`));
|
|
651
|
+
output.writeln(output.dim(` ${t.description}`));
|
|
652
|
+
output.writeln();
|
|
653
|
+
output.writeln(t.example);
|
|
654
|
+
output.writeln();
|
|
655
|
+
}
|
|
656
|
+
output.writeln(output.dim('Save with: monomind memory store -k "<name>" --value "<content>" --namespace auto-memory'));
|
|
657
|
+
return { success: true };
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
// Delete command
|
|
661
|
+
const deleteCommand = {
|
|
662
|
+
name: 'delete',
|
|
663
|
+
aliases: ['rm'],
|
|
664
|
+
description: 'Delete a memory entry (AgentDB, Memory Palace, or knowledge chunk)',
|
|
665
|
+
options: [
|
|
666
|
+
{
|
|
667
|
+
name: 'key',
|
|
668
|
+
short: 'k',
|
|
669
|
+
description: 'Storage key (AgentDB)',
|
|
670
|
+
type: 'string'
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
name: 'namespace',
|
|
674
|
+
short: 'n',
|
|
675
|
+
description: 'Memory namespace (AgentDB)',
|
|
676
|
+
type: 'string',
|
|
677
|
+
default: 'default'
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: 'source',
|
|
681
|
+
short: 's',
|
|
682
|
+
description: 'Source to delete from: agentdb, palace, knowledge',
|
|
683
|
+
type: 'string',
|
|
684
|
+
default: 'agentdb',
|
|
685
|
+
choices: ['agentdb', 'palace', 'knowledge']
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
name: 'id',
|
|
689
|
+
description: 'Entry ID (palace/knowledge)',
|
|
690
|
+
type: 'string'
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
name: 'force',
|
|
694
|
+
short: 'f',
|
|
695
|
+
description: 'Skip confirmation',
|
|
696
|
+
type: 'boolean',
|
|
697
|
+
default: false
|
|
698
|
+
}
|
|
699
|
+
],
|
|
700
|
+
examples: [
|
|
701
|
+
{ command: 'monomind memory delete -k "mykey"', description: 'Delete AgentDB entry' },
|
|
702
|
+
{ command: 'monomind memory delete -k "lesson" -n "lessons"', description: 'Delete from specific namespace' },
|
|
703
|
+
{ command: 'monomind memory delete --source palace --id "abc123"', description: 'Delete Memory Palace drawer' },
|
|
704
|
+
{ command: 'monomind memory delete --source knowledge --id "chunk-42" -f', description: 'Delete knowledge chunk (no confirm)' }
|
|
705
|
+
],
|
|
706
|
+
action: async (ctx) => {
|
|
707
|
+
const source = ctx.flags.source || 'agentdb';
|
|
708
|
+
const force = ctx.flags.force;
|
|
709
|
+
if (source === 'agentdb') {
|
|
710
|
+
const key = ctx.flags.key || ctx.args[0];
|
|
711
|
+
const namespace = ctx.flags.namespace || 'default';
|
|
712
|
+
if (!key) {
|
|
713
|
+
output.printError('Key is required. Use: memory delete -k "key" [-n "namespace"]');
|
|
714
|
+
return { success: false, exitCode: 1 };
|
|
715
|
+
}
|
|
716
|
+
if (!force && ctx.interactive) {
|
|
717
|
+
const confirmed = await confirm({
|
|
718
|
+
message: `Delete memory entry "${key}" from namespace "${namespace}"?`,
|
|
719
|
+
default: false
|
|
720
|
+
});
|
|
721
|
+
if (!confirmed) {
|
|
722
|
+
output.printInfo('Operation cancelled');
|
|
723
|
+
return { success: true };
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
try {
|
|
727
|
+
const { deleteEntry } = await import('../memory/memory-initializer.js');
|
|
728
|
+
const result = await deleteEntry({ key, namespace });
|
|
729
|
+
if (!result.success) {
|
|
730
|
+
output.printError(result.error || 'Failed to delete');
|
|
731
|
+
return { success: false, exitCode: 1 };
|
|
732
|
+
}
|
|
733
|
+
if (result.deleted) {
|
|
734
|
+
output.printSuccess(`Deleted "${key}" from namespace "${namespace}"`);
|
|
735
|
+
output.printInfo(`Remaining entries: ${result.remainingEntries}`);
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
output.printWarning(`Key not found: "${key}" in namespace "${namespace}"`);
|
|
739
|
+
}
|
|
740
|
+
return { success: result.deleted, data: result };
|
|
741
|
+
}
|
|
742
|
+
catch (error) {
|
|
743
|
+
output.printError(`Failed to delete: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
744
|
+
return { success: false, exitCode: 1 };
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
// palace or knowledge — JSONL file delete
|
|
748
|
+
const id = ctx.flags.id || ctx.args[0];
|
|
749
|
+
if (!id) {
|
|
750
|
+
output.printError('Entry ID is required for palace/knowledge delete. Use --id');
|
|
751
|
+
return { success: false, exitCode: 1 };
|
|
752
|
+
}
|
|
753
|
+
if (!/^[a-zA-Z0-9_\-]{1,128}$/.test(id)) {
|
|
754
|
+
output.printError('ID must be 1-128 chars: alphanumeric, underscore, or hyphen only');
|
|
755
|
+
return { success: false, exitCode: 1 };
|
|
756
|
+
}
|
|
757
|
+
const fs = await import('fs');
|
|
758
|
+
const path = await import('path');
|
|
759
|
+
const filePath = source === 'palace'
|
|
760
|
+
? path.join(process.cwd(), '.monomind', 'palace', 'drawers.jsonl')
|
|
761
|
+
: path.join(process.cwd(), '.monomind', 'knowledge', 'chunks.jsonl');
|
|
762
|
+
if (!fs.existsSync(filePath)) {
|
|
763
|
+
output.printError(`File not found: ${filePath}`);
|
|
764
|
+
return { success: false, exitCode: 1 };
|
|
765
|
+
}
|
|
766
|
+
let entries;
|
|
767
|
+
try {
|
|
768
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
769
|
+
entries = [];
|
|
770
|
+
for (const line of raw.split('\n').filter(Boolean)) {
|
|
771
|
+
try {
|
|
772
|
+
entries.push(JSON.parse(line));
|
|
773
|
+
}
|
|
774
|
+
catch {
|
|
775
|
+
output.printError(`Malformed JSONL entry in ${source} file`);
|
|
776
|
+
return { success: false, exitCode: 1 };
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
catch (err) {
|
|
781
|
+
output.printError(`Failed to read ${source} file: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
782
|
+
return { success: false, exitCode: 1 };
|
|
783
|
+
}
|
|
784
|
+
const idx = entries.findIndex(e => e.id === id);
|
|
785
|
+
if (idx === -1) {
|
|
786
|
+
output.printWarning(`Entry not found with id "${id}"`);
|
|
787
|
+
return { success: false, exitCode: 1 };
|
|
788
|
+
}
|
|
789
|
+
if (!force && ctx.interactive) {
|
|
790
|
+
const confirmed = await confirm({
|
|
791
|
+
message: `Delete ${source} entry "${id}"?`,
|
|
792
|
+
default: false
|
|
793
|
+
});
|
|
794
|
+
if (!confirmed) {
|
|
795
|
+
output.printInfo('Operation cancelled');
|
|
796
|
+
return { success: true };
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
entries.splice(idx, 1);
|
|
800
|
+
try {
|
|
801
|
+
const tmpPath = filePath + '.tmp';
|
|
802
|
+
fs.writeFileSync(tmpPath, entries.map(e => JSON.stringify(e)).join('\n') + (entries.length ? '\n' : ''));
|
|
803
|
+
fs.renameSync(tmpPath, filePath);
|
|
804
|
+
output.printSuccess(`Deleted ${source} entry "${id}"`);
|
|
805
|
+
output.printInfo(`Remaining entries: ${entries.length}`);
|
|
806
|
+
return { success: true, data: { id, deleted: true, remainingEntries: entries.length } };
|
|
807
|
+
}
|
|
808
|
+
catch (err) {
|
|
809
|
+
output.printError(`Failed to write ${source} file: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
810
|
+
return { success: false, exitCode: 1 };
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
// Stats command
|
|
815
|
+
const statsCommand = {
|
|
816
|
+
name: 'stats',
|
|
817
|
+
description: 'Show memory statistics',
|
|
818
|
+
action: async (ctx) => {
|
|
819
|
+
// Call MCP memory/stats tool for real statistics
|
|
820
|
+
try {
|
|
821
|
+
const statsResult = await callMCPTool('memory_stats', {});
|
|
822
|
+
const stats = {
|
|
823
|
+
backend: statsResult.backend,
|
|
824
|
+
entries: {
|
|
825
|
+
total: statsResult.totalEntries,
|
|
826
|
+
vectors: 0, // Would need vector backend support
|
|
827
|
+
text: statsResult.totalEntries
|
|
828
|
+
},
|
|
829
|
+
storage: {
|
|
830
|
+
total: statsResult.totalSize,
|
|
831
|
+
location: statsResult.location
|
|
832
|
+
},
|
|
833
|
+
version: statsResult.version,
|
|
834
|
+
oldestEntry: statsResult.oldestEntry,
|
|
835
|
+
newestEntry: statsResult.newestEntry
|
|
836
|
+
};
|
|
837
|
+
if (ctx.flags.format === 'json') {
|
|
838
|
+
output.printJson(stats);
|
|
839
|
+
return { success: true, data: stats };
|
|
840
|
+
}
|
|
841
|
+
output.writeln();
|
|
842
|
+
output.writeln(output.bold('Memory Statistics'));
|
|
843
|
+
output.writeln();
|
|
844
|
+
output.writeln(output.bold('Overview'));
|
|
845
|
+
output.printTable({
|
|
846
|
+
columns: [
|
|
847
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
848
|
+
{ key: 'value', header: 'Value', width: 30, align: 'right' }
|
|
849
|
+
],
|
|
850
|
+
data: [
|
|
851
|
+
{ metric: 'Backend', value: stats.backend },
|
|
852
|
+
{ metric: 'Version', value: stats.version },
|
|
853
|
+
{ metric: 'Total Entries', value: stats.entries.total.toLocaleString() },
|
|
854
|
+
{ metric: 'Total Storage', value: stats.storage.total },
|
|
855
|
+
{ metric: 'Location', value: stats.storage.location }
|
|
856
|
+
]
|
|
857
|
+
});
|
|
858
|
+
output.writeln();
|
|
859
|
+
output.writeln(output.bold('Timeline'));
|
|
860
|
+
output.printTable({
|
|
861
|
+
columns: [
|
|
862
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
863
|
+
{ key: 'value', header: 'Value', width: 30, align: 'right' }
|
|
864
|
+
],
|
|
865
|
+
data: [
|
|
866
|
+
{ metric: 'Oldest Entry', value: stats.oldestEntry || 'N/A' },
|
|
867
|
+
{ metric: 'Newest Entry', value: stats.newestEntry || 'N/A' }
|
|
868
|
+
]
|
|
869
|
+
});
|
|
870
|
+
output.writeln();
|
|
871
|
+
output.printInfo('v1 Performance: 150x-12,500x faster search with HNSW indexing');
|
|
872
|
+
return { success: true, data: stats };
|
|
873
|
+
}
|
|
874
|
+
catch (error) {
|
|
875
|
+
output.printError(`Failed to get stats: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
876
|
+
return { success: false, exitCode: 1 };
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
// Configure command
|
|
881
|
+
const configureCommand = {
|
|
882
|
+
name: 'configure',
|
|
883
|
+
aliases: ['config'],
|
|
884
|
+
description: 'Configure memory backend',
|
|
885
|
+
options: [
|
|
886
|
+
{
|
|
887
|
+
name: 'backend',
|
|
888
|
+
short: 'b',
|
|
889
|
+
description: 'Memory backend',
|
|
890
|
+
type: 'string',
|
|
891
|
+
choices: BACKENDS.map(b => b.value)
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: 'path',
|
|
895
|
+
description: 'Storage path',
|
|
896
|
+
type: 'string'
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
name: 'cache-size',
|
|
900
|
+
description: 'Cache size in MB',
|
|
901
|
+
type: 'number'
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
name: 'hnsw-m',
|
|
905
|
+
description: 'HNSW M parameter',
|
|
906
|
+
type: 'number',
|
|
907
|
+
default: 16
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
name: 'hnsw-ef',
|
|
911
|
+
description: 'HNSW ef parameter',
|
|
912
|
+
type: 'number',
|
|
913
|
+
default: 200
|
|
914
|
+
}
|
|
915
|
+
],
|
|
916
|
+
action: async (ctx) => {
|
|
917
|
+
let backend = ctx.flags.backend;
|
|
918
|
+
if (!backend && ctx.interactive) {
|
|
919
|
+
backend = await select({
|
|
920
|
+
message: 'Select memory backend:',
|
|
921
|
+
options: BACKENDS,
|
|
922
|
+
default: 'hybrid'
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
const config = {
|
|
926
|
+
backend: backend || 'hybrid',
|
|
927
|
+
path: ctx.flags.path || './data/memory',
|
|
928
|
+
cacheSize: ctx.flags['cache-size'] || 256,
|
|
929
|
+
hnsw: {
|
|
930
|
+
m: ctx.flags['hnsw-m'] || 16,
|
|
931
|
+
ef: ctx.flags['hnsw-ef'] || 200
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
output.writeln();
|
|
935
|
+
output.printInfo('Memory Configuration');
|
|
936
|
+
output.writeln();
|
|
937
|
+
output.printTable({
|
|
938
|
+
columns: [
|
|
939
|
+
{ key: 'setting', header: 'Setting', width: 20 },
|
|
940
|
+
{ key: 'value', header: 'Value', width: 25 }
|
|
941
|
+
],
|
|
942
|
+
data: [
|
|
943
|
+
{ setting: 'Backend', value: config.backend },
|
|
944
|
+
{ setting: 'Storage Path', value: config.path },
|
|
945
|
+
{ setting: 'Cache Size', value: `${config.cacheSize} MB` },
|
|
946
|
+
{ setting: 'HNSW M', value: config.hnsw.m },
|
|
947
|
+
{ setting: 'HNSW ef', value: config.hnsw.ef }
|
|
948
|
+
]
|
|
949
|
+
});
|
|
950
|
+
output.writeln();
|
|
951
|
+
configManager.set(ctx.cwd, 'memory', config);
|
|
952
|
+
output.printSuccess('Memory configuration updated');
|
|
953
|
+
return { success: true, data: config };
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
// Cleanup command
|
|
957
|
+
const cleanupCommand = {
|
|
958
|
+
name: 'cleanup',
|
|
959
|
+
description: 'Clean up stale and expired memory entries',
|
|
960
|
+
options: [
|
|
961
|
+
{
|
|
962
|
+
name: 'dry-run',
|
|
963
|
+
short: 'd',
|
|
964
|
+
description: 'Show what would be deleted',
|
|
965
|
+
type: 'boolean',
|
|
966
|
+
default: false
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
name: 'older-than',
|
|
970
|
+
short: 'o',
|
|
971
|
+
description: 'Delete entries older than (e.g., "7d", "30d")',
|
|
972
|
+
type: 'string'
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
name: 'expired-only',
|
|
976
|
+
short: 'e',
|
|
977
|
+
description: 'Only delete expired TTL entries',
|
|
978
|
+
type: 'boolean',
|
|
979
|
+
default: false
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
name: 'low-quality',
|
|
983
|
+
short: 'l',
|
|
984
|
+
description: 'Delete low quality patterns (threshold)',
|
|
985
|
+
type: 'number'
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
name: 'namespace',
|
|
989
|
+
short: 'n',
|
|
990
|
+
description: 'Clean specific namespace only',
|
|
991
|
+
type: 'string'
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
name: 'force',
|
|
995
|
+
short: 'f',
|
|
996
|
+
description: 'Skip confirmation',
|
|
997
|
+
type: 'boolean',
|
|
998
|
+
default: false
|
|
999
|
+
}
|
|
1000
|
+
],
|
|
1001
|
+
examples: [
|
|
1002
|
+
{ command: 'monomind memory cleanup --dry-run', description: 'Preview cleanup' },
|
|
1003
|
+
{ command: 'monomind memory cleanup --older-than 30d', description: 'Delete entries older than 30 days' },
|
|
1004
|
+
{ command: 'monomind memory cleanup --expired-only', description: 'Clean expired entries' }
|
|
1005
|
+
],
|
|
1006
|
+
action: async (ctx) => {
|
|
1007
|
+
const dryRun = ctx.flags['dry-run'];
|
|
1008
|
+
const force = ctx.flags.force;
|
|
1009
|
+
if (dryRun) {
|
|
1010
|
+
output.writeln(output.warning('DRY RUN - No changes will be made'));
|
|
1011
|
+
}
|
|
1012
|
+
output.printInfo('Analyzing memory for cleanup...');
|
|
1013
|
+
try {
|
|
1014
|
+
const result = await callMCPTool('memory_cleanup', {
|
|
1015
|
+
dryRun,
|
|
1016
|
+
olderThan: ctx.flags['older-than'],
|
|
1017
|
+
expiredOnly: ctx.flags['expired-only'],
|
|
1018
|
+
lowQualityThreshold: ctx.flags['low-quality'],
|
|
1019
|
+
namespace: ctx.flags.namespace,
|
|
1020
|
+
});
|
|
1021
|
+
if (ctx.flags.format === 'json') {
|
|
1022
|
+
output.printJson(result);
|
|
1023
|
+
return { success: true, data: result };
|
|
1024
|
+
}
|
|
1025
|
+
output.writeln();
|
|
1026
|
+
output.writeln(output.bold('Cleanup Analysis'));
|
|
1027
|
+
output.printTable({
|
|
1028
|
+
columns: [
|
|
1029
|
+
{ key: 'category', header: 'Category', width: 20 },
|
|
1030
|
+
{ key: 'count', header: 'Count', width: 15, align: 'right' }
|
|
1031
|
+
],
|
|
1032
|
+
data: [
|
|
1033
|
+
{ category: 'Expired (TTL)', count: result.candidates.expired },
|
|
1034
|
+
{ category: 'Stale (unused)', count: result.candidates.stale },
|
|
1035
|
+
{ category: 'Low Quality', count: result.candidates.lowQuality },
|
|
1036
|
+
{ category: output.bold('Total'), count: output.bold(String(result.candidates.total)) }
|
|
1037
|
+
]
|
|
1038
|
+
});
|
|
1039
|
+
if (!dryRun && result.candidates.total > 0 && !force) {
|
|
1040
|
+
const confirmed = await confirm({
|
|
1041
|
+
message: `Delete ${result.candidates.total} entries (${result.freed.formatted})?`,
|
|
1042
|
+
default: false
|
|
1043
|
+
});
|
|
1044
|
+
if (!confirmed) {
|
|
1045
|
+
output.printInfo('Cleanup cancelled');
|
|
1046
|
+
return { success: true, data: result };
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (!dryRun) {
|
|
1050
|
+
output.writeln();
|
|
1051
|
+
output.printSuccess(`Cleaned ${result.deleted.entries} entries`);
|
|
1052
|
+
output.printList([
|
|
1053
|
+
`Vectors removed: ${result.deleted.vectors}`,
|
|
1054
|
+
`Patterns removed: ${result.deleted.patterns}`,
|
|
1055
|
+
`Space freed: ${result.freed.formatted}`,
|
|
1056
|
+
`Duration: ${result.duration}ms`
|
|
1057
|
+
]);
|
|
1058
|
+
}
|
|
1059
|
+
return { success: true, data: result };
|
|
1060
|
+
}
|
|
1061
|
+
catch (error) {
|
|
1062
|
+
if (error instanceof MCPClientError) {
|
|
1063
|
+
output.printError(`Cleanup error: ${error.message}`);
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
1067
|
+
}
|
|
1068
|
+
return { success: false, exitCode: 1 };
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
// Compress command
|
|
1073
|
+
const compressCommand = {
|
|
1074
|
+
name: 'compress',
|
|
1075
|
+
description: 'Compress and optimize memory storage',
|
|
1076
|
+
options: [
|
|
1077
|
+
{
|
|
1078
|
+
name: 'level',
|
|
1079
|
+
short: 'l',
|
|
1080
|
+
description: 'Compression level (fast, balanced, max)',
|
|
1081
|
+
type: 'string',
|
|
1082
|
+
choices: ['fast', 'balanced', 'max'],
|
|
1083
|
+
default: 'balanced'
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
name: 'target',
|
|
1087
|
+
short: 't',
|
|
1088
|
+
description: 'Target (vectors, text, patterns, all)',
|
|
1089
|
+
type: 'string',
|
|
1090
|
+
choices: ['vectors', 'text', 'patterns', 'all'],
|
|
1091
|
+
default: 'all'
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
name: 'quantize',
|
|
1095
|
+
short: 'z',
|
|
1096
|
+
description: 'Enable vector quantization (reduces memory 4-32x)',
|
|
1097
|
+
type: 'boolean',
|
|
1098
|
+
default: false
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
name: 'bits',
|
|
1102
|
+
description: 'Quantization bits (4, 8, 16)',
|
|
1103
|
+
type: 'number',
|
|
1104
|
+
default: 8
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
name: 'rebuild-index',
|
|
1108
|
+
short: 'r',
|
|
1109
|
+
description: 'Rebuild HNSW index after compression',
|
|
1110
|
+
type: 'boolean',
|
|
1111
|
+
default: true
|
|
1112
|
+
}
|
|
1113
|
+
],
|
|
1114
|
+
examples: [
|
|
1115
|
+
{ command: 'monomind memory compress', description: 'Balanced compression' },
|
|
1116
|
+
{ command: 'monomind memory compress --quantize --bits 4', description: '4-bit quantization (32x reduction)' },
|
|
1117
|
+
{ command: 'monomind memory compress -l max -t vectors', description: 'Max compression on vectors' }
|
|
1118
|
+
],
|
|
1119
|
+
action: async (ctx) => {
|
|
1120
|
+
const level = ctx.flags.level || 'balanced';
|
|
1121
|
+
const target = ctx.flags.target || 'all';
|
|
1122
|
+
const quantize = ctx.flags.quantize;
|
|
1123
|
+
const bits = ctx.flags.bits || 8;
|
|
1124
|
+
const rebuildIndex = ctx.flags.rebuildIndex ?? true;
|
|
1125
|
+
output.writeln();
|
|
1126
|
+
output.writeln(output.bold('Memory Compression'));
|
|
1127
|
+
output.writeln(output.dim(`Level: ${level}, Target: ${target}, Quantize: ${quantize ? `${bits}-bit` : 'no'}`));
|
|
1128
|
+
output.writeln();
|
|
1129
|
+
const spinner = output.createSpinner({ text: 'Analyzing current storage...', spinner: 'dots' });
|
|
1130
|
+
spinner.start();
|
|
1131
|
+
try {
|
|
1132
|
+
const result = await callMCPTool('memory_compress', {
|
|
1133
|
+
level,
|
|
1134
|
+
target,
|
|
1135
|
+
quantize,
|
|
1136
|
+
bits,
|
|
1137
|
+
rebuildIndex,
|
|
1138
|
+
});
|
|
1139
|
+
spinner.succeed('Compression complete');
|
|
1140
|
+
if (ctx.flags.format === 'json') {
|
|
1141
|
+
output.printJson(result);
|
|
1142
|
+
return { success: true, data: result };
|
|
1143
|
+
}
|
|
1144
|
+
output.writeln();
|
|
1145
|
+
output.writeln(output.bold('Storage Comparison'));
|
|
1146
|
+
output.printTable({
|
|
1147
|
+
columns: [
|
|
1148
|
+
{ key: 'category', header: 'Category', width: 15 },
|
|
1149
|
+
{ key: 'before', header: 'Before', width: 12, align: 'right' },
|
|
1150
|
+
{ key: 'after', header: 'After', width: 12, align: 'right' },
|
|
1151
|
+
{ key: 'saved', header: 'Saved', width: 12, align: 'right' }
|
|
1152
|
+
],
|
|
1153
|
+
data: [
|
|
1154
|
+
{ category: 'Vectors', before: result.before.vectorsSize, after: result.after.vectorsSize, saved: '-' },
|
|
1155
|
+
{ category: 'Text', before: result.before.textSize, after: result.after.textSize, saved: '-' },
|
|
1156
|
+
{ category: 'Patterns', before: result.before.patternsSize, after: result.after.patternsSize, saved: '-' },
|
|
1157
|
+
{ category: 'Index', before: result.before.indexSize, after: result.after.indexSize, saved: '-' },
|
|
1158
|
+
{ category: output.bold('Total'), before: result.before.totalSize, after: result.after.totalSize, saved: output.success(result.compression.formattedSaved) }
|
|
1159
|
+
]
|
|
1160
|
+
});
|
|
1161
|
+
output.writeln();
|
|
1162
|
+
output.printBox([
|
|
1163
|
+
`Compression Ratio: ${result.compression.ratio.toFixed(2)}x`,
|
|
1164
|
+
`Space Saved: ${result.compression.formattedSaved}`,
|
|
1165
|
+
`Quantization: ${result.compression.quantizationApplied ? `Yes (${bits}-bit)` : 'No'}`,
|
|
1166
|
+
`Index Rebuilt: ${result.compression.indexRebuilt ? 'Yes' : 'No'}`,
|
|
1167
|
+
`Duration: ${(result.duration / 1000).toFixed(1)}s`
|
|
1168
|
+
].join('\n'), 'Results');
|
|
1169
|
+
if (result.performance) {
|
|
1170
|
+
output.writeln();
|
|
1171
|
+
output.writeln(output.bold('Performance Impact'));
|
|
1172
|
+
output.printList([
|
|
1173
|
+
`Search latency: ${result.performance.searchLatencyBefore.toFixed(2)}ms → ${result.performance.searchLatencyAfter.toFixed(2)}ms`,
|
|
1174
|
+
`Speedup: ${output.success(result.performance.searchSpeedup)}`
|
|
1175
|
+
]);
|
|
1176
|
+
}
|
|
1177
|
+
return { success: true, data: result };
|
|
1178
|
+
}
|
|
1179
|
+
catch (error) {
|
|
1180
|
+
spinner.fail('Compression failed');
|
|
1181
|
+
if (error instanceof MCPClientError) {
|
|
1182
|
+
output.printError(`Compression error: ${error.message}`);
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
1186
|
+
}
|
|
1187
|
+
return { success: false, exitCode: 1 };
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
// Export command
|
|
1192
|
+
const exportCommand = {
|
|
1193
|
+
name: 'export',
|
|
1194
|
+
description: 'Export memory to file',
|
|
1195
|
+
options: [
|
|
1196
|
+
{
|
|
1197
|
+
name: 'output',
|
|
1198
|
+
short: 'o',
|
|
1199
|
+
description: 'Output file path',
|
|
1200
|
+
type: 'string',
|
|
1201
|
+
required: true
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
name: 'format',
|
|
1205
|
+
short: 'f',
|
|
1206
|
+
description: 'Export format (json, csv, binary)',
|
|
1207
|
+
type: 'string',
|
|
1208
|
+
choices: ['json', 'csv', 'binary'],
|
|
1209
|
+
default: 'json'
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
name: 'namespace',
|
|
1213
|
+
short: 'n',
|
|
1214
|
+
description: 'Export specific namespace',
|
|
1215
|
+
type: 'string'
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
name: 'include-vectors',
|
|
1219
|
+
description: 'Include vector embeddings',
|
|
1220
|
+
type: 'boolean',
|
|
1221
|
+
default: true
|
|
1222
|
+
}
|
|
1223
|
+
],
|
|
1224
|
+
examples: [
|
|
1225
|
+
{ command: 'monomind memory export -o ./backup.json', description: 'Export all to JSON' },
|
|
1226
|
+
{ command: 'monomind memory export -o ./data.csv -f csv', description: 'Export to CSV' }
|
|
1227
|
+
],
|
|
1228
|
+
action: async (ctx) => {
|
|
1229
|
+
const outputPath = ctx.flags.output;
|
|
1230
|
+
const format = ctx.flags.format || 'json';
|
|
1231
|
+
if (!outputPath) {
|
|
1232
|
+
output.printError('Output path is required. Use --output or -o');
|
|
1233
|
+
return { success: false, exitCode: 1 };
|
|
1234
|
+
}
|
|
1235
|
+
output.printInfo(`Exporting memory to ${outputPath}...`);
|
|
1236
|
+
try {
|
|
1237
|
+
const result = await callMCPTool('memory_export', {
|
|
1238
|
+
outputPath,
|
|
1239
|
+
format,
|
|
1240
|
+
namespace: ctx.flags.namespace,
|
|
1241
|
+
includeVectors: ctx.flags.includeVectors ?? true,
|
|
1242
|
+
});
|
|
1243
|
+
output.printSuccess(`Exported to ${result.outputPath}`);
|
|
1244
|
+
output.printList([
|
|
1245
|
+
`Entries: ${result.exported.entries}`,
|
|
1246
|
+
`Vectors: ${result.exported.vectors}`,
|
|
1247
|
+
`Patterns: ${result.exported.patterns}`,
|
|
1248
|
+
`File size: ${result.fileSize}`
|
|
1249
|
+
]);
|
|
1250
|
+
return { success: true, data: result };
|
|
1251
|
+
}
|
|
1252
|
+
catch (error) {
|
|
1253
|
+
if (error instanceof MCPClientError) {
|
|
1254
|
+
output.printError(`Export error: ${error.message}`);
|
|
1255
|
+
}
|
|
1256
|
+
else {
|
|
1257
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
1258
|
+
}
|
|
1259
|
+
return { success: false, exitCode: 1 };
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
// Import command
|
|
1264
|
+
const importCommand = {
|
|
1265
|
+
name: 'import',
|
|
1266
|
+
description: 'Import memory from file',
|
|
1267
|
+
options: [
|
|
1268
|
+
{
|
|
1269
|
+
name: 'input',
|
|
1270
|
+
short: 'i',
|
|
1271
|
+
description: 'Input file path',
|
|
1272
|
+
type: 'string',
|
|
1273
|
+
required: true
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
name: 'merge',
|
|
1277
|
+
short: 'm',
|
|
1278
|
+
description: 'Merge with existing (skip duplicates)',
|
|
1279
|
+
type: 'boolean',
|
|
1280
|
+
default: true
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
name: 'namespace',
|
|
1284
|
+
short: 'n',
|
|
1285
|
+
description: 'Import into specific namespace',
|
|
1286
|
+
type: 'string'
|
|
1287
|
+
}
|
|
1288
|
+
],
|
|
1289
|
+
examples: [
|
|
1290
|
+
{ command: 'monomind memory import -i ./backup.json', description: 'Import from file' },
|
|
1291
|
+
{ command: 'monomind memory import -i ./data.json -n archive', description: 'Import to namespace' }
|
|
1292
|
+
],
|
|
1293
|
+
action: async (ctx) => {
|
|
1294
|
+
const inputPath = ctx.flags.input || ctx.args[0];
|
|
1295
|
+
if (!inputPath) {
|
|
1296
|
+
output.printError('Input path is required. Use --input or -i');
|
|
1297
|
+
return { success: false, exitCode: 1 };
|
|
1298
|
+
}
|
|
1299
|
+
output.printInfo(`Importing memory from ${inputPath}...`);
|
|
1300
|
+
try {
|
|
1301
|
+
const result = await callMCPTool('memory_import', {
|
|
1302
|
+
inputPath,
|
|
1303
|
+
merge: ctx.flags.merge ?? true,
|
|
1304
|
+
namespace: ctx.flags.namespace,
|
|
1305
|
+
});
|
|
1306
|
+
output.printSuccess(`Imported from ${result.inputPath}`);
|
|
1307
|
+
output.printList([
|
|
1308
|
+
`Entries: ${result.imported.entries}`,
|
|
1309
|
+
`Vectors: ${result.imported.vectors}`,
|
|
1310
|
+
`Patterns: ${result.imported.patterns}`,
|
|
1311
|
+
`Skipped (duplicates): ${result.skipped}`,
|
|
1312
|
+
`Duration: ${result.duration}ms`
|
|
1313
|
+
]);
|
|
1314
|
+
return { success: true, data: result };
|
|
1315
|
+
}
|
|
1316
|
+
catch (error) {
|
|
1317
|
+
if (error instanceof MCPClientError) {
|
|
1318
|
+
output.printError(`Import error: ${error.message}`);
|
|
1319
|
+
}
|
|
1320
|
+
else {
|
|
1321
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
1322
|
+
}
|
|
1323
|
+
return { success: false, exitCode: 1 };
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
// Init subcommand - initialize memory database using sql.js
|
|
1328
|
+
const initMemoryCommand = {
|
|
1329
|
+
name: 'init',
|
|
1330
|
+
description: 'Initialize memory database with sql.js (WASM SQLite) - includes vector embeddings, pattern learning, temporal decay',
|
|
1331
|
+
options: [
|
|
1332
|
+
{
|
|
1333
|
+
name: 'backend',
|
|
1334
|
+
short: 'b',
|
|
1335
|
+
description: 'Backend type: hybrid (default), sqlite, or agentdb',
|
|
1336
|
+
type: 'string',
|
|
1337
|
+
default: 'hybrid'
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
name: 'path',
|
|
1341
|
+
short: 'p',
|
|
1342
|
+
description: 'Database path',
|
|
1343
|
+
type: 'string'
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
name: 'force',
|
|
1347
|
+
short: 'f',
|
|
1348
|
+
description: 'Overwrite existing database',
|
|
1349
|
+
type: 'boolean',
|
|
1350
|
+
default: false
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
name: 'verbose',
|
|
1354
|
+
description: 'Show detailed initialization output',
|
|
1355
|
+
type: 'boolean',
|
|
1356
|
+
default: false
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
name: 'verify',
|
|
1360
|
+
description: 'Run verification tests after initialization',
|
|
1361
|
+
type: 'boolean',
|
|
1362
|
+
default: true
|
|
1363
|
+
},
|
|
1364
|
+
{
|
|
1365
|
+
name: 'load-embeddings',
|
|
1366
|
+
description: 'Pre-load ONNX embedding model (lazy by default)',
|
|
1367
|
+
type: 'boolean',
|
|
1368
|
+
default: false
|
|
1369
|
+
}
|
|
1370
|
+
],
|
|
1371
|
+
examples: [
|
|
1372
|
+
{ command: 'monomind memory init', description: 'Initialize hybrid backend with all features' },
|
|
1373
|
+
{ command: 'monomind memory init -b agentdb', description: 'Initialize AgentDB backend' },
|
|
1374
|
+
{ command: 'monomind memory init -p ./data/memory.db --force', description: 'Reinitialize at custom path' },
|
|
1375
|
+
{ command: 'monomind memory init --verbose --verify', description: 'Initialize with full verification' }
|
|
1376
|
+
],
|
|
1377
|
+
action: async (ctx) => {
|
|
1378
|
+
const backend = ctx.flags.backend || 'hybrid';
|
|
1379
|
+
const customPath = ctx.flags.path;
|
|
1380
|
+
const force = ctx.flags.force;
|
|
1381
|
+
const verbose = ctx.flags.verbose;
|
|
1382
|
+
const verify = ctx.flags.verify !== false; // Default true
|
|
1383
|
+
const loadEmbeddings = ctx.flags['load-embeddings'];
|
|
1384
|
+
output.writeln();
|
|
1385
|
+
output.writeln(output.bold('Initializing Memory Database'));
|
|
1386
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
1387
|
+
const spinner = output.createSpinner({ text: 'Initializing schema...', spinner: 'dots' });
|
|
1388
|
+
spinner.start();
|
|
1389
|
+
try {
|
|
1390
|
+
// Import the memory initializer
|
|
1391
|
+
const { initializeMemoryDatabase, loadEmbeddingModel, verifyMemoryInit } = await import('../memory/memory-initializer.js');
|
|
1392
|
+
const result = await initializeMemoryDatabase({
|
|
1393
|
+
backend,
|
|
1394
|
+
dbPath: customPath,
|
|
1395
|
+
force,
|
|
1396
|
+
verbose
|
|
1397
|
+
});
|
|
1398
|
+
if (!result.success) {
|
|
1399
|
+
spinner.fail('Initialization failed');
|
|
1400
|
+
output.printError(result.error || 'Unknown error');
|
|
1401
|
+
return { success: false, exitCode: 1 };
|
|
1402
|
+
}
|
|
1403
|
+
spinner.succeed('Schema initialized');
|
|
1404
|
+
// Lazy load or pre-load embedding model
|
|
1405
|
+
if (loadEmbeddings) {
|
|
1406
|
+
const embeddingSpinner = output.createSpinner({ text: 'Loading embedding model...', spinner: 'dots' });
|
|
1407
|
+
embeddingSpinner.start();
|
|
1408
|
+
const embeddingResult = await loadEmbeddingModel({ verbose });
|
|
1409
|
+
if (embeddingResult.success) {
|
|
1410
|
+
embeddingSpinner.succeed(`Embedding model loaded: ${embeddingResult.modelName} (${embeddingResult.dimensions}-dim, ${embeddingResult.loadTime}ms)`);
|
|
1411
|
+
}
|
|
1412
|
+
else {
|
|
1413
|
+
embeddingSpinner.stop(output.warning(`Embedding model: ${embeddingResult.error || 'Using fallback'}`));
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
output.writeln();
|
|
1417
|
+
// Show features enabled with detailed capabilities
|
|
1418
|
+
const featureLines = [
|
|
1419
|
+
`Backend: ${result.backend}`,
|
|
1420
|
+
`Schema Version: ${result.schemaVersion}`,
|
|
1421
|
+
`Database Path: ${result.dbPath}`,
|
|
1422
|
+
'',
|
|
1423
|
+
output.bold('Features:'),
|
|
1424
|
+
` Vector Embeddings: ${result.features.vectorEmbeddings ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1425
|
+
` Pattern Learning: ${result.features.patternLearning ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1426
|
+
` Temporal Decay: ${result.features.temporalDecay ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1427
|
+
` HNSW Indexing: ${result.features.hnswIndexing ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1428
|
+
` Migration Tracking: ${result.features.migrationTracking ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`
|
|
1429
|
+
];
|
|
1430
|
+
if (verbose) {
|
|
1431
|
+
featureLines.push('', output.bold('HNSW Configuration:'), ` M (connections): 16`, ` ef (construction): 200`, ` ef (search): 100`, ` Metric: cosine`, '', output.bold('Pattern Learning:'), ` Confidence scoring: 0.0 - 1.0`, ` Temporal decay: Half-life 30 days`, ` Pattern versioning: Enabled`, ` Types: task-routing, error-recovery, optimization, coordination, prediction`);
|
|
1432
|
+
}
|
|
1433
|
+
output.printBox(featureLines.join('\n'), 'Configuration');
|
|
1434
|
+
output.writeln();
|
|
1435
|
+
// ADR-053: Show ControllerRegistry activation results
|
|
1436
|
+
if (result.controllers) {
|
|
1437
|
+
const { activated, failed, initTimeMs } = result.controllers;
|
|
1438
|
+
if (activated.length > 0 || failed.length > 0) {
|
|
1439
|
+
const controllerLines = [
|
|
1440
|
+
output.bold('AgentDB Controllers:'),
|
|
1441
|
+
` Activated: ${activated.length} Failed: ${failed.length} Init: ${Math.round(initTimeMs)}ms`,
|
|
1442
|
+
];
|
|
1443
|
+
if (verbose && activated.length > 0) {
|
|
1444
|
+
controllerLines.push('');
|
|
1445
|
+
for (const name of activated) {
|
|
1446
|
+
controllerLines.push(` ${output.success('✓')} ${name}`);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
if (failed.length > 0 && verbose) {
|
|
1450
|
+
controllerLines.push('');
|
|
1451
|
+
for (const name of failed) {
|
|
1452
|
+
controllerLines.push(` ${output.dim('✗')} ${name}`);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
output.printBox(controllerLines.join('\n'), 'Controller Registry (ADR-053)');
|
|
1456
|
+
output.writeln();
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
// Show tables created
|
|
1460
|
+
if (verbose && result.tablesCreated.length > 0) {
|
|
1461
|
+
output.writeln(output.bold('Tables Created:'));
|
|
1462
|
+
output.printTable({
|
|
1463
|
+
columns: [
|
|
1464
|
+
{ key: 'table', header: 'Table', width: 22 },
|
|
1465
|
+
{ key: 'purpose', header: 'Purpose', width: 38 }
|
|
1466
|
+
],
|
|
1467
|
+
data: [
|
|
1468
|
+
{ table: 'memory_entries', purpose: 'Core memory storage with embeddings' },
|
|
1469
|
+
{ table: 'patterns', purpose: 'Learned patterns with confidence scores' },
|
|
1470
|
+
{ table: 'pattern_history', purpose: 'Pattern versioning and evolution' },
|
|
1471
|
+
{ table: 'trajectories', purpose: 'SONA learning trajectories' },
|
|
1472
|
+
{ table: 'trajectory_steps', purpose: 'Individual trajectory steps' },
|
|
1473
|
+
{ table: 'migration_state', purpose: 'Migration progress tracking' },
|
|
1474
|
+
{ table: 'sessions', purpose: 'Context persistence' },
|
|
1475
|
+
{ table: 'vector_indexes', purpose: 'HNSW index configuration' },
|
|
1476
|
+
{ table: 'metadata', purpose: 'System metadata' }
|
|
1477
|
+
]
|
|
1478
|
+
});
|
|
1479
|
+
output.writeln();
|
|
1480
|
+
output.writeln(output.bold('Indexes Created:'));
|
|
1481
|
+
output.printList(result.indexesCreated.slice(0, 8).map(idx => output.dim(idx)));
|
|
1482
|
+
if (result.indexesCreated.length > 8) {
|
|
1483
|
+
output.writeln(output.dim(` ... and ${result.indexesCreated.length - 8} more`));
|
|
1484
|
+
}
|
|
1485
|
+
output.writeln();
|
|
1486
|
+
}
|
|
1487
|
+
// Run verification if enabled
|
|
1488
|
+
if (verify) {
|
|
1489
|
+
const verifySpinner = output.createSpinner({ text: 'Verifying initialization...', spinner: 'dots' });
|
|
1490
|
+
verifySpinner.start();
|
|
1491
|
+
const verification = await verifyMemoryInit(result.dbPath, { verbose });
|
|
1492
|
+
if (verification.success) {
|
|
1493
|
+
verifySpinner.succeed(`Verification passed (${verification.summary.passed}/${verification.summary.total} tests)`);
|
|
1494
|
+
}
|
|
1495
|
+
else {
|
|
1496
|
+
verifySpinner.fail(`Verification failed (${verification.summary.failed}/${verification.summary.total} tests failed)`);
|
|
1497
|
+
}
|
|
1498
|
+
if (verbose || !verification.success) {
|
|
1499
|
+
output.writeln();
|
|
1500
|
+
output.writeln(output.bold('Verification Results:'));
|
|
1501
|
+
output.printTable({
|
|
1502
|
+
columns: [
|
|
1503
|
+
{ key: 'status', header: '', width: 3 },
|
|
1504
|
+
{ key: 'name', header: 'Test', width: 22 },
|
|
1505
|
+
{ key: 'details', header: 'Details', width: 30 },
|
|
1506
|
+
{ key: 'duration', header: 'Time', width: 8, align: 'right' }
|
|
1507
|
+
],
|
|
1508
|
+
data: verification.tests.map(t => ({
|
|
1509
|
+
status: t.passed ? output.success('✓') : output.error('✗'),
|
|
1510
|
+
name: t.name,
|
|
1511
|
+
details: t.details || '',
|
|
1512
|
+
duration: t.duration ? `${t.duration}ms` : '-'
|
|
1513
|
+
}))
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
output.writeln();
|
|
1517
|
+
}
|
|
1518
|
+
// Show next steps
|
|
1519
|
+
output.writeln(output.bold('Next Steps:'));
|
|
1520
|
+
output.printList([
|
|
1521
|
+
`Store data: ${output.highlight('monomind memory store -k "key" --value "data"')}`,
|
|
1522
|
+
`Search: ${output.highlight('monomind memory search -q "query"')}`,
|
|
1523
|
+
`Train patterns: ${output.highlight('monomind neural train -p coordination')}`,
|
|
1524
|
+
`View stats: ${output.highlight('monomind memory stats')}`
|
|
1525
|
+
]);
|
|
1526
|
+
// Also sync to .claude directory
|
|
1527
|
+
const fs = await import('fs');
|
|
1528
|
+
const path = await import('path');
|
|
1529
|
+
const claudeDir = path.join(process.cwd(), '.claude');
|
|
1530
|
+
const claudeDbPath = path.join(claudeDir, 'memory.db');
|
|
1531
|
+
if (!fs.existsSync(claudeDir)) {
|
|
1532
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
1533
|
+
}
|
|
1534
|
+
if (fs.existsSync(result.dbPath) && (!fs.existsSync(claudeDbPath) || force)) {
|
|
1535
|
+
fs.copyFileSync(result.dbPath, claudeDbPath);
|
|
1536
|
+
output.writeln();
|
|
1537
|
+
output.writeln(output.dim(`Synced to: ${claudeDbPath}`));
|
|
1538
|
+
}
|
|
1539
|
+
// Fix #1428: ONNX worker threads keep the event loop alive after init.
|
|
1540
|
+
// Only force-exit when embeddings were actually loaded (ONNX threads spun up).
|
|
1541
|
+
if (loadEmbeddings && typeof globalThis !== 'undefined') {
|
|
1542
|
+
setTimeout(() => {
|
|
1543
|
+
process.exit(0);
|
|
1544
|
+
}, 500);
|
|
1545
|
+
}
|
|
1546
|
+
return {
|
|
1547
|
+
success: true,
|
|
1548
|
+
data: result
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
catch (error) {
|
|
1552
|
+
spinner.fail('Initialization failed');
|
|
1553
|
+
output.printError(`Failed to initialize memory: ${error instanceof Error ? error.message : String(error)}`);
|
|
1554
|
+
return { success: false, exitCode: 1 };
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1558
|
+
// Main memory command
|
|
1559
|
+
export const memoryCommand = {
|
|
1560
|
+
name: 'memory',
|
|
1561
|
+
description: 'Memory management commands',
|
|
1562
|
+
subcommands: [initMemoryCommand, storeCommand, editCommand, retrieveCommand, searchCommand, listCommand, deleteCommand, templatesCommand, statsCommand, configureCommand, cleanupCommand, compressCommand, exportCommand, importCommand],
|
|
1563
|
+
options: [],
|
|
1564
|
+
examples: [
|
|
1565
|
+
{ command: 'monomind memory store -k "key" -v "value"', description: 'Store data' },
|
|
1566
|
+
{ command: 'monomind memory search -q "auth patterns"', description: 'Search memory' },
|
|
1567
|
+
{ command: 'monomind memory stats', description: 'Show statistics' }
|
|
1568
|
+
],
|
|
1569
|
+
action: async (ctx) => {
|
|
1570
|
+
output.writeln();
|
|
1571
|
+
output.writeln(output.bold('Memory Management Commands'));
|
|
1572
|
+
output.writeln();
|
|
1573
|
+
output.writeln('Usage: monomind memory <subcommand> [options]');
|
|
1574
|
+
output.writeln();
|
|
1575
|
+
output.writeln('Subcommands:');
|
|
1576
|
+
output.printList([
|
|
1577
|
+
`${output.highlight('init')} - Initialize memory database (sql.js)`,
|
|
1578
|
+
`${output.highlight('store')} - Store data in memory`,
|
|
1579
|
+
`${output.highlight('edit')} - Edit an entry (AgentDB, palace, knowledge)`,
|
|
1580
|
+
`${output.highlight('retrieve')} - Retrieve data from memory`,
|
|
1581
|
+
`${output.highlight('search')} - Semantic/vector search`,
|
|
1582
|
+
`${output.highlight('list')} - List memory entries`,
|
|
1583
|
+
`${output.highlight('delete')} - Delete an entry (AgentDB, palace, knowledge)`,
|
|
1584
|
+
`${output.highlight('templates')} - Show best-practice entry templates`,
|
|
1585
|
+
`${output.highlight('stats')} - Show statistics`,
|
|
1586
|
+
`${output.highlight('configure')} - Configure backend`,
|
|
1587
|
+
`${output.highlight('cleanup')} - Clean expired entries`,
|
|
1588
|
+
`${output.highlight('compress')} - Compress database`,
|
|
1589
|
+
`${output.highlight('export')} - Export memory to file`,
|
|
1590
|
+
`${output.highlight('import')} - Import from file`
|
|
1591
|
+
]);
|
|
1592
|
+
return { success: true };
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
export default memoryCommand;
|
|
1596
|
+
//# sourceMappingURL=memory.js.map
|