Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUvf482becb3f33
diff --git a/v3/@claude-flow/cli/src/commands/memory.ts b/v3/@claude-flow/cli/src/commands/memory.ts
index 6056601364..742ab152dc 100644
--- a/v3/@claude-flow/cli/src/commands/memory.ts
+++ b/v3/@claude-flow/cli/src/commands/memory.ts
@@ -1156,29 +1156,44 @@ const initMemoryCommand: Command = {
description: 'Show detailed initialization output',
type: 'boolean',
default: false
+ },
+ {
+ name: 'verify',
+ description: 'Run verification tests after initialization',
+ type: 'boolean',
+ default: true
+ },
+ {
+ name: 'load-embeddings',
+ description: 'Pre-load ONNX embedding model (lazy by default)',
+ type: 'boolean',
+ default: false
}
],
examples: [
{ command: 'claude-flow memory init', description: 'Initialize hybrid backend with all features' },
{ command: 'claude-flow memory init -b agentdb', description: 'Initialize AgentDB backend' },
- { command: 'claude-flow memory init -p ./data/memory.db --force', description: 'Reinitialize at custom path' }
+ { command: 'claude-flow memory init -p ./data/memory.db --force', description: 'Reinitialize at custom path' },
+ { command: 'claude-flow memory init --verbose --verify', description: 'Initialize with full verification' }
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
const backend = (ctx.flags.backend as string) || 'hybrid';
const customPath = ctx.flags.path as string;
const force = ctx.flags.force as boolean;
const verbose = ctx.flags.verbose as boolean;
+ const verify = ctx.flags.verify !== false; // Default true
+ const loadEmbeddings = ctx.flags.loadEmbeddings as boolean;
output.writeln();
output.writeln(output.bold('Initializing Memory Database'));
- output.writeln(output.dim('─'.repeat(45)));
+ output.writeln(output.dim('─'.repeat(50)));
- const spinner = output.createSpinner({ text: 'Initializing...', spinner: 'dots' });
+ const spinner = output.createSpinner({ text: 'Initializing schema...', spinner: 'dots' });
spinner.start();
try {
// Import the memory initializer
- const { initializeMemoryDatabase } = await import('../memory/memory-initializer.js');
+ const { initializeMemoryDatabase, loadEmbeddingModel, verifyMemoryInit } = await import('../memory/memory-initializer.js');
const result = await initializeMemoryDatabase({
backend,
@@ -1193,30 +1208,65 @@ const initMemoryCommand: Command = {
return { success: false, exitCode: 1 };
}
- spinner.succeed('Memory database initialized');
+ spinner.succeed('Schema initialized');
+
+ // Lazy load or pre-load embedding model
+ if (loadEmbeddings) {
+ const embeddingSpinner = output.createSpinner({ text: 'Loading embedding model...', spinner: 'dots' });
+ embeddingSpinner.start();
+
+ const embeddingResult = await loadEmbeddingModel({ verbose });
+
+ if (embeddingResult.success) {
+ embeddingSpinner.succeed(`Embedding model loaded: ${embeddingResult.modelName} (${embeddingResult.dimensions}-dim, ${embeddingResult.loadTime}ms)`);
+ } else {
+ embeddingSpinner.warn(`Embedding model: ${embeddingResult.error || 'Using fallback'}`);
+ }
+ }
+
output.writeln();
- // Show features enabled
- output.printBox([
+ // Show features enabled with detailed capabilities
+ const featureLines = [
`Backend: ${result.backend}`,
`Schema Version: ${result.schemaVersion}`,
`Database Path: ${result.dbPath}`,
'',
- `Vector Embeddings: ${result.features.vectorEmbeddings ? output.success('Enabled') : output.dim('Disabled')}`,
- `Pattern Learning: ${result.features.patternLearning ? output.success('Enabled') : output.dim('Disabled')}`,
- `Temporal Decay: ${result.features.temporalDecay ? output.success('Enabled') : output.dim('Disabled')}`,
- `HNSW Indexing: ${result.features.hnswIndexing ? output.success('Enabled') : output.dim('Disabled')}`,
- `Migration Tracking: ${result.features.migrationTracking ? output.success('Enabled') : output.dim('Disabled')}`
- ].join('\n'), 'Configuration');
+ output.bold('Features:'),
+ ` Vector Embeddings: ${result.features.vectorEmbeddings ? output.success('βœ“ Enabled') : output.dim('βœ— Disabled')}`,
+ ` Pattern Learning: ${result.features.patternLearning ? output.success('βœ“ Enabled') : output.dim('βœ— Disabled')}`,
+ ` Temporal Decay: ${result.features.temporalDecay ? output.success('βœ“ Enabled') : output.dim('βœ— Disabled')}`,
+ ` HNSW Indexing: ${result.features.hnswIndexing ? output.success('βœ“ Enabled') : output.dim('βœ— Disabled')}`,
+ ` Migration Tracking: ${result.features.migrationTracking ? output.success('βœ“ Enabled') : output.dim('βœ— Disabled')}`
+ ];
+
+ if (verbose) {
+ 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`
+ );
+ }
+ output.printBox(featureLines.join('\n'), 'Configuration');
output.writeln();
// Show tables created
if (verbose && result.tablesCreated.length > 0) {
+ output.writeln(output.bold('Tables Created:'));
output.printTable({
columns: [
- { key: 'table', header: 'Table', width: 25 },
- { key: 'purpose', header: 'Purpose', width: 35 }
+ { key: 'table', header: 'Table', width: 22 },
+ { key: 'purpose', header: 'Purpose', width: 38 }
],
data: [
{ table: 'memory_entries', purpose: 'Core memory storage with embeddings' },
@@ -1231,6 +1281,48 @@ const initMemoryCommand: Command = {
]
});
output.writeln();
+
+ output.writeln(output.bold('Indexes Created:'));
+ output.printList(result.indexesCreated.slice(0, 8).map(idx => output.dim(idx)));
+ if (result.indexesCreated.length > 8) {
+ output.writeln(output.dim(` ... and ${result.indexesCreated.length - 8} more`));
+ }
+ output.writeln();
+ }
+
+ // Run verification if enabled
+ if (verify) {
+ const verifySpinner = output.createSpinner({ text: 'Verifying initialization...', spinner: 'dots' });
+ verifySpinner.start();
+
+ const verification = await verifyMemoryInit(result.dbPath, { verbose });
+
+ if (verification.success) {
+ verifySpinner.succeed(`Verification passed (${verification.summary.passed}/${verification.summary.total} tests)`);
+ } else {
+ verifySpinner.fail(`Verification failed (${verification.summary.failed}/${verification.summary.total} tests failed)`);
+ }
+
+ if (verbose || !verification.success) {
+ output.writeln();
+ output.writeln(output.bold('Verification Results:'));
+ output.printTable({
+ columns: [
+ { key: 'status', header: '', width: 3 },
+ { key: 'name', header: 'Test', width: 22 },
+ { key: 'details', header: 'Details', width: 30 },
+ { key: 'duration', header: 'Time', width: 8, align: 'right' }
+ ],
+ data: verification.tests.map(t => ({
+ status: t.passed ? output.success('βœ“') : output.error('βœ—'),
+ name: t.name,
+ details: t.details || '',
+ duration: t.duration ? `${t.duration}ms` : '-'
+ }))
+ });
+ }
+
+ output.writeln();
}
// Show next steps