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: Edit /workspaces/claude-code-flow/src/cli/simple-commands/hive-mind.js

rUv69a8d4613907
diff --git a/.claude/checkpoints/1754227128.json b/.claude/checkpoints/1754227128.json
new file mode 100644
index 0000000000..74c50de8f7
--- /dev/null
+++ b/.claude/checkpoints/1754227128.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250803-131848", "file": "/workspaces/claude-code-flow/test-hive-db.js", "timestamp": "2025-08-03T13:18:48Z", "type": "pre-edit", "original_branch": "alpha-84b"}
diff --git a/.claude/checkpoints/1754227130.json b/.claude/checkpoints/1754227130.json
new file mode 100644
index 0000000000..36f8325bd7
--- /dev/null
+++ b/.claude/checkpoints/1754227130.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250803-131850", "file": "/workspaces/claude-code-flow/test-hive-db.js", "timestamp": "2025-08-03T13:18:50Z", "type": "post-edit", "branch": "alpha-84b", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 36 ++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 ++-- .claude/checkpoints/task-1754227038.json | 1 + claude-flow-wiki | 0 test-hive-db.js | 58 ++++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 4 deletions(-) "}
diff --git a/src/cli/simple-commands/hive-mind.js b/src/cli/simple-commands/hive-mind.js
index 8880cc2a48..a920747b8b 100644
--- a/src/cli/simple-commands/hive-mind.js
+++ b/src/cli/simple-commands/hive-mind.js
@@ -1540,19 +1540,23 @@ async function listMemories() {
try {
console.log(chalk.blue('\n📋 Collective Memory Store\n'));
- // Use MCP wrapper to search for all memories (empty pattern matches all)
- const mcpWrapper = await getMcpWrapper();
- const searchResult = await mcpWrapper.searchMemory('hive-mind', '');
+ // Read directly from hive.db collective_memory table
+ const dbPath = path.join(cwd(), '.hive-mind', 'hive.db');
+ const db = new Database(dbPath);
- // Handle different possible response structures
- let memories = [];
- if (searchResult && Array.isArray(searchResult.results)) {
- memories = searchResult.results;
- } else if (searchResult && Array.isArray(searchResult)) {
- memories = searchResult;
- } else if (searchResult && searchResult.data && Array.isArray(searchResult.data)) {
- memories = searchResult.data;
- }
+ const memories = db
+ .prepare(
+ `
+ SELECT cm.*, s.name as swarm_name
+ FROM collective_memory cm
+ LEFT JOIN swarms s ON cm.swarm_id = s.id
+ ORDER BY cm.created_at DESC
+ LIMIT 50
+ `,
+ )
+ .all();
+
+ db.close();
if (!memories || memories.length === 0) {
console.log(chalk.yellow('No memories found in the collective store.'));
@@ -1562,15 +1566,34 @@ async function listMemories() {
return;
}
+ console.log(chalk.gray(`Found ${memories.length} memories in the collective store:\n`));
+
memories.forEach((memory, index) => {
- console.log(chalk.cyan(`${index + 1}. ${memory.key || `memory-${index}`}`));
- console.log(` Category: ${memory.type || 'general'}`);
- console.log(` Created: ${new Date(memory.timestamp || Date.now()).toLocaleString()}`);
- if (memory.value && typeof memory.value === 'object') {
- console.log(` Preview: ${JSON.stringify(memory.value).substring(0, 100)}...`);
+ console.log(chalk.cyan(`${index + 1}. ${memory.key}`));
+ console.log(` Swarm: ${memory.swarm_name || memory.swarm_id}`);
+ console.log(` Type: ${memory.type || 'knowledge'}`);
+ console.log(` Created: ${new Date(memory.created_at).toLocaleString()}`);
+ console.log(` Created by: ${memory.created_by || 'system'}`);
+
+ // Parse and display value
+ let displayValue = memory.value;
+ try {
+ const parsed = JSON.parse(memory.value);
+ displayValue = JSON.stringify(parsed);
+ } catch {
+ // Keep as string
+ }
+
+ if (displayValue.length > 100) {
+ console.log(` Value: ${displayValue.substring(0, 100)}...`);
} else {
- console.log(` Value: ${String(memory.value || memory).substring(0, 100)}...`);
+ console.log(` Value: ${displayValue}`);
}
+
+ if (memory.confidence !== null && memory.confidence !== 1) {
+ console.log(` Confidence: ${(memory.confidence * 100).toFixed(1)}%`);
+ }
+
console.log('');
});
} catch (error) {