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/init/index.js

rUv1d0abf8ee303
diff --git a/.claude/checkpoints/1755183448.json b/.claude/checkpoints/1755183448.json
new file mode 100644
index 0000000000..3f902fc812
--- /dev/null
+++ b/.claude/checkpoints/1755183448.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250814-145728", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/init/hive-mind-init.js", "timestamp": "2025-08-14T14:57:28Z", "type": "pre-edit", "original_branch": "alpha90"}
diff --git a/.claude/checkpoints/1755183449.json b/.claude/checkpoints/1755183449.json
new file mode 100644
index 0000000000..232780988b
--- /dev/null
+++ b/.claude/checkpoints/1755183449.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250814-145729", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/init/hive-mind-init.js", "timestamp": "2025-08-14T14:57:29Z", "type": "post-edit", "branch": "alpha90", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 60 ++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/task-1755183276.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/init/hive-mind-init.js | 756 +++++++++++++++++++++++++ 6 files changed, 821 insertions(+), 4 deletions(-) "}
diff --git a/src/cli/simple-commands/init/index.js b/src/cli/simple-commands/init/index.js
index 0452f8333b..bcf1b3936d 100644
--- a/src/cli/simple-commands/init/index.js
+++ b/src/cli/simple-commands/init/index.js
@@ -75,6 +75,11 @@ import {
createMinimalCoordinationMd,
} from './templates/coordination-md.js';
import { createAgentsReadme, createSessionsReadme } from './templates/readme-files.js';
+import {
+ initializeHiveMind,
+ getHiveMindStatus,
+ rollbackHiveMindInit
+} from './hive-mind-init.js';
/**
* Check if Claude Code CLI is installed
@@ -1322,80 +1327,34 @@ ${commands.map((cmd) => `- [${cmd}](./${cmd}.md)`).join('\n')}
console.log(' Memory will be initialized on first use');
}
- // Initialize hive-mind configuration
+ // Initialize comprehensive hive-mind system
+ console.log('\n🧠 Initializing Hive Mind System...');
try {
- const hiveMindConfig = {
- version: '2.0.0',
- initialized: new Date().toISOString(),
- defaults: {
- queenType: 'strategic',
- maxWorkers: 8,
- consensusAlgorithm: 'majority',
- memorySize: 100,
- autoScale: true,
- encryption: false,
- },
- mcpTools: {
- enabled: true,
- parallel: true,
- timeout: 60000,
- },
+ const hiveMindOptions = {
+ config: {
+ integration: {
+ claudeCode: { enabled: isClaudeCodeInstalled() },
+ mcpTools: { enabled: true }
+ },
+ monitoring: { enabled: flags.monitoring || false }
+ }
};
-
- await fs.writeFile(
- `${workingDir}/.hive-mind/config.json`, JSON.stringify(hiveMindConfig, null, 2, 'utf8'),
- );
- // Initialize hive.db
- try {
- const Database = (await import('better-sqlite3')).default;
- const hivePath = `${workingDir}/.hive-mind/hive.db`;
- const hiveDb = new Database(hivePath);
-
- // Create initial tables
- hiveDb.exec(`
- CREATE TABLE IF NOT EXISTS swarms (
- id TEXT PRIMARY KEY,
- name TEXT NOT NULL,
- objective TEXT,
- status TEXT DEFAULT 'active',
- queen_type TEXT DEFAULT 'strategic',
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
- updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
- );
-
- CREATE TABLE IF NOT EXISTS agents (
- id TEXT PRIMARY KEY,
- swarm_id TEXT,
- name TEXT NOT NULL,
- type TEXT NOT NULL,
- role TEXT,
- capabilities TEXT,
- status TEXT DEFAULT 'active',
- performance_score REAL DEFAULT 0.5,
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
- FOREIGN KEY (swarm_id) REFERENCES swarms (id)
- );
-
- CREATE TABLE IF NOT EXISTS messages (
- id TEXT PRIMARY KEY,
- swarm_id TEXT,
- agent_id TEXT,
- content TEXT NOT NULL,
- type TEXT DEFAULT 'task',
- timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
- FOREIGN KEY (swarm_id) REFERENCES swarms (id),
- FOREIGN KEY (agent_id) REFERENCES agents (id)
- );
- `);
+ const hiveMindResult = await initializeHiveMind(workingDir, hiveMindOptions, dryRun);
+
+ if (hiveMindResult.success) {
+ printSuccess(`✓ Hive Mind System initialized with ${hiveMindResult.features.length} features`);
- hiveDb.close();
- printSuccess('✓ Initialized hive-mind database (.hive-mind/hive.db)');
- } catch (dbErr) {
- console.log(` ⚠️ Could not initialize hive-mind database: ${dbErr.message}`);
+ // Log individual features
+ hiveMindResult.features.forEach(feature => {
+ console.log(` • ${feature}`);
+ });
+ } else {
+ console.log(` ⚠️ Hive Mind initialization failed: ${hiveMindResult.error}`);
+ if (hiveMindResult.rollbackRequired) {
+ console.log(' 🔄 Automatic rollback may be required');
+ }
}
-
- printSuccess('✓ Initialized hive-mind system');
} catch (err) {
console.log(` ⚠️ Could not initialize hive-mind system: ${err.message}`);
}