π 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
π Checkpoint: Edit /workspaces/claude-code-flow/claude/commands/hive-mind/status.js
rUvfe532bcaf1e7
diff --git a/.claude/checkpoints/1755183526.json b/.claude/checkpoints/1755183526.jsonnew file mode 100644index 0000000000..6c2cd0a287--- /dev/null+++ b/.claude/checkpoints/1755183526.json@@ -0,0 +1 @@+{"branch": "checkpoint/pre-edit-20250814-145846", "file": "/workspaces/claude-code-flow/claude/commands/hive-mind/spawn.js", "timestamp": "2025-08-14T14:58:46Z", "type": "pre-edit", "original_branch": "alpha90"}diff --git a/.claude/checkpoints/1755183528.json b/.claude/checkpoints/1755183528.jsonnew file mode 100644index 0000000000..7f72800a2e--- /dev/null+++ b/.claude/checkpoints/1755183528.json@@ -0,0 +1 @@+{"tag": "checkpoint-20250814-145848", "file": "/workspaces/claude-code-flow/claude/commands/hive-mind/spawn.js", "timestamp": "2025-08-14T14:58:48Z", "type": "post-edit", "branch": "alpha90", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 96 ++++++++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1755183523.json | 1 + .claude/checkpoints/1755183524.json | 1 + claude-flow-wiki | 0 claude/commands/hive-mind/spawn.js | 374 +++++++++++++++++++++++++++++++ 7 files changed, 476 insertions(+), 4 deletions(-) "}diff --git a/claude/commands/hive-mind/status.js b/claude/commands/hive-mind/status.jsnew file mode 100644index 0000000000..f8c49eff78--- /dev/null+++ b/claude/commands/hive-mind/status.js@@ -0,0 +1,367 @@+#!/usr/bin/env node+/**+ * Hive Mind Status Command Template+ *+ * Display comprehensive status of hive mind systems including+ * agents, tasks, memory usage, and performance metrics.+ */++import { Command } from 'commander';+import chalk from 'chalk';+import Table from 'cli-table3';++export const hiveMindStatusCommand = new Command('status')+ .description('Show comprehensive hive mind system status')+ .option('-h, --hive-id <id>', 'Specific hive mind ID to check')+ .option('-a, --all', 'Show all hive mind systems', false)+ .option('-d, --detailed', 'Show detailed agent information', false)+ .option('-t, --tasks', 'Show task queue and assignments', false)+ .option('-m, --memory', 'Show memory usage statistics', false)+ .option('-p, --performance', 'Show performance metrics', false)+ .option('-w, --watch', 'Watch status in real-time', false)+ .option('-j, --json', 'Output in JSON format', false)+ .option('--queen-type <type>', 'Filter by queen coordination type')+ .option('--max-workers <number>', 'Filter by maximum worker count')+ .option('--consensus <threshold>', 'Filter by consensus threshold')+ .option('--memory-size <mb>', 'Filter by memory allocation')+ .option('--auto-scale', 'Show only auto-scaling enabled systems', false)+ .option('--encryption', 'Show only encrypted systems', false)+ .option('--monitor', 'Show monitoring status', false)+ .option('--verbose', 'Enable verbose output', false)+ .option('--claude', 'Show Claude integration status', false)+ .option('--spawn', 'Show spawn information', false)+ .option('--auto-spawn', 'Show auto-spawn configuration', false)+ .option('--execute', 'Show execution status', false)+ .action(async (options) => {+ try {+ // Get hive mind systems+ const hiveminds = await getHiveMinds(options);++ if (hiveminds.length === 0) {+ console.log(chalk.yellow('β οΈ No hive mind systems found'));+ console.log(chalk.gray('Initialize a hive mind with: claude-flow hive-mind init'));+ return;+ }++ // JSON output+ if (options.json) {+ console.log(JSON.stringify(hiveminds, null, 2));+ return;+ }++ // Display status for each hive mind+ for (const hive of hiveminds) {+ await displayHiveMindStatus(hive, options);++ if (hiveminds.length > 1) {+ console.log('\n' + chalk.gray('β'.repeat(80)) + '\n');+ }+ }++ // Watch mode+ if (options.watch) {+ console.log('\n' + chalk.gray('π Watching status... (Press Ctrl+C to exit)'));++ setInterval(async () => {+ console.clear();++ const updatedHives = await getHiveMinds(options);+ for (const hive of updatedHives) {+ await displayHiveMindStatus(hive, options);+ }++ console.log(chalk.gray(`\nπ Updated: ${new Date().toLocaleTimeString()}`));+ }, 3000);+ }++ } catch (error) {+ console.error(chalk.red('β Failed to get hive mind status'));+ console.error(chalk.red('Error:'), error.message);++ if (options.verbose) {+ console.error(chalk.gray('Stack trace:'), error.stack);+ }++ process.exit(1);+ }+ });++/**+ * Get hive mind systems based on filters+ */+async function getHiveMinds(options) {+ // Mock implementation - would query actual systems+ let hiveminds = [+ {+ id: 'hive-1',+ name: 'Development Swarm',+ queenType: 'hierarchical',+ status: 'active',+ uptime: 14400000, // 4 hours+ maxWorkers: 12,+ currentAgents: 8,+ consensusThreshold: 0.66,+ memorySize: 256,+ autoScale: true,+ encryption: true,+ monitor: true,+ claudeIntegration: true,+ createdAt: new Date(Date.now() - 14400000),+ agents: [+ { id: 'agent-1', name: 'researcher-001', type: 'researcher', status: 'busy', task: 'Market Analysis' },+ { id: 'agent-2', name: 'coder-001', type: 'coder', status: 'active', task: 'API Development' },+ { id: 'agent-3', name: 'analyzer-001', type: 'analyzer', status: 'idle', task: null },+ { id: 'agent-4', name: 'coordinator-001', type: 'coordinator', status: 'busy', task: 'Task Coordination' }+ ],+ tasks: [+ { id: 'task-1', description: 'Market Analysis', status: 'in_progress', agent: 'researcher-001', progress: 75 },+ { id: 'task-2', description: 'API Development', status: 'in_progress', agent: 'coder-001', progress: 50 },+ { id: 'task-3', description: 'Data Processing', status: 'queued', agent: null, progress: 0 }+ ],+ memory: {+ used: 180,+ total: 256,+ fragmentation: 0.15,+ hitRate: 0.85+ },+ performance: {+ tasksCompleted: 45,+ avgCompletionTime: 1800000, // 30 minutes+ throughput: 2.5, // tasks per hour+ consensusSuccess: 0.92,+ uptime: 0.98+ }+ },+ {+ id: 'hive-2',+ name: 'Research Collective',+ queenType: 'distributed',+ status: 'active',+ uptime: 7200000, // 2 hours+ maxWorkers: 8,+ currentAgents: 6,+ consensusThreshold: 0.75,+ memorySize: 128,+ autoScale: false,+ encryption: false,+ monitor: false,+ claudeIntegration: false,+ createdAt: new Date(Date.now() - 7200000),+ agents: [+ { id: 'agent-5', name: 'researcher-002', type: 'researcher', status: 'active', task: null },+ { id: 'agent-6', name: 'analyzer-002', type: 'analyzer', status: 'busy', task: 'Pattern Analysis' }+ ],+ tasks: [+ { id: 'task-4', description: 'Pattern Analysis', status: 'in_progress', agent: 'analyzer-002', progress: 30 }+ ],+ memory: {+ used: 64,+ total: 128,+ fragmentation: 0.05,+ hitRate: 0.78+ },+ performance: {+ tasksCompleted: 12,+ avgCompletionTime: 2400000, // 40 minutes+ throughput: 6.0, // tasks per hour+ consensusSuccess: 0.88,+ uptime: 0.95+ }+ }+ ];++ // Apply filters+ if (options.hiveId) {+ hiveminds = hiveminds.filter(h => h.id === options.hiveId);+ }++ if (options.queenType) {+ hiveminds = hiveminds.filter(h => h.queenType === options.queenType);+ }++ if (options.autoScale) {+ hiveminds = hiveminds.filter(h => h.autoScale);+ }++ if (options.encryption) {+ hiveminds = hiveminds.filter(h => h.encryption);+ }++ if (options.claude) {+ hiveminds = hiveminds.filter(h => h.claudeIntegration);+ }++ return hiveminds;+}++/**+ * Display status for a single hive mind+ */+async function displayHiveMindStatus(hive, options) {+ // Header+ console.log(chalk.bold.cyan(`π ${hive.name}`));+ console.log(chalk.gray(`ID: ${hive.id}`));+ console.log(chalk.gray('β'.repeat(60)));++ // Basic status+ const statusColor = getStatusColor(hive.status);+ const uptimeStr = formatUptime(hive.uptime);++ console.log(chalk.white('Status:'), statusColor(hive.status.toUpperCase()));+ console.log(chalk.white('Queen Type:'), chalk.yellow(hive.queenType));+ console.log(chalk.white('Uptime:'), chalk.cyan(uptimeStr));+ console.log(chalk.white('Agents:'), chalk.cyan(`${hive.currentAgents}/${hive.maxWorkers}`));+ console.log(chalk.white('Memory:'), chalk.cyan(`${hive.memory.used}MB/${hive.memory.total}MB (${Math.round(hive.memory.used/hive.memory.total*100)}%)`));++ // Features+ const features = [];+ if (hive.autoScale) features.push(chalk.green('Auto-Scale'));+ if (hive.encryption) features.push(chalk.green('Encryption'));+ if (hive.monitor) features.push(chalk.green('Monitoring'));+ if (hive.claudeIntegration) features.push(chalk.green('Claude'));++ if (features.length > 0) {+ console.log(chalk.white('Features:'), features.join(' '));+ }++ // Agents table+ if (options.detailed && hive.agents.length > 0) {+ console.log('\n' + chalk.bold('π€ Agents:'));++ const agentTable = new Table({+ head: ['Name', 'Type', 'Status', 'Current Task'],+ style: { head: ['cyan'] }+ });++ hive.agents.forEach(agent => {+ agentTable.push([+ agent.name,+ agent.type,+ getAgentStatusBadge(agent.status),+ agent.task || chalk.gray('None')+ ]);+ });++ console.log(agentTable.toString());+ }++ // Tasks table+ if ((options.tasks || hive.tasks.length > 0) && hive.tasks.length > 0) {+ console.log('\n' + chalk.bold('π Tasks:'));++ const taskTable = new Table({+ head: ['ID', 'Description', 'Status', 'Agent', 'Progress'],+ style: { head: ['cyan'] }+ });++ hive.tasks.forEach(task => {+ taskTable.push([+ task.id.substring(0, 8),+ task.description.length > 30 ? task.description.substring(0, 30) + '...' : task.description,+ getTaskStatusBadge(task.status),+ task.agent || chalk.gray('Unassigned'),+ `${task.progress}%`+ ]);+ });++ console.log(taskTable.toString());+ }++ // Memory statistics+ if (options.memory) {+ console.log('\n' + chalk.bold('πΎ Memory Statistics:'));+ console.log(chalk.white(' Used:'), chalk.cyan(`${hive.memory.used}MB`));+ console.log(chalk.white(' Total:'), chalk.cyan(`${hive.memory.total}MB`));+ console.log(chalk.white(' Fragmentation:'), chalk.yellow(`${Math.round(hive.memory.fragmentation * 100)}%`));+ console.log(chalk.white(' Hit Rate:'), chalk.green(`${Math.round(hive.memory.hitRate * 100)}%`));+ }++ // Performance metrics+ if (options.performance) {+ console.log('\n' + chalk.bold('π Performance Metrics:'));+ console.log(chalk.white(' Tasks Completed:'), chalk.cyan(hive.performance.tasksCompleted));+ console.log(chalk.white(' Avg Completion Time:'), chalk.cyan(formatDuration(hive.performance.avgCompletionTime)));+ console.log(chalk.white(' Throughput:'), chalk.cyan(`${hive.performance.throughput} tasks/hour`));+ console.log(chalk.white(' Consensus Success:'), chalk.green(`${Math.round(hive.performance.consensusSuccess * 100)}%`));+ console.log(chalk.white(' System Uptime:'), chalk.green(`${Math.round(hive.performance.uptime * 100)}%`));+ }++ // Summary stats+ if (!options.detailed && !options.tasks && !options.memory && !options.performance) {+ const activeAgents = hive.agents.filter(a => a.status === 'active' || a.status === 'busy').length;+ const inProgressTasks = hive.tasks.filter(t => t.status === 'in_progress').length;++ console.log('\n' + chalk.bold('π Quick Stats:'));+ console.log(chalk.white(' Active Agents:'), chalk.green(activeAgents));+ console.log(chalk.white(' Tasks in Progress:'), chalk.blue(inProgressTasks));+ console.log(chalk.white(' Memory Usage:'), chalk.yellow(`${Math.round(hive.memory.used/hive.memory.total*100)}%`));+ console.log(chalk.white(' Consensus Threshold:'), chalk.cyan(`${Math.round(hive.consensusThreshold * 100)}%`));+ }+}++/**+ * Get status color+ */+function getStatusColor(status) {+ const colors = {+ active: chalk.green,+ inactive: chalk.red,+ paused: chalk.yellow,+ error: chalk.red+ };+ return colors[status] || chalk.gray;+}++/**+ * Get agent status badge+ */+function getAgentStatusBadge(status) {+ const badges = {+ active: chalk.green('β Active'),+ busy: chalk.blue('β Busy'),+ idle: chalk.yellow('β Idle'),+ error: chalk.red('β Error')+ };+ return badges[status] || chalk.gray('β Unknown');+}++/**+ * Get task status badge+ */+function getTaskStatusBadge(status) {+ const badges = {+ queued: chalk.gray('βΈ Queued'),+ in_progress: chalk.blue('βΆοΈ In Progress'),+ completed: chalk.green('β Completed'),+ failed: chalk.red('β Failed')+ };+ return badges[status] || chalk.gray('β Unknown');+}++/**+ * Format uptime duration+ */+function formatUptime(ms) {+ const seconds = Math.floor(ms / 1000);+ const minutes = Math.floor(seconds / 60);+ const hours = Math.floor(minutes / 60);+ const days = Math.floor(hours / 24);++ if (days > 0) return `${days}d ${hours % 24}h ${minutes % 60}m`;+ if (hours > 0) return `${hours}h ${minutes % 60}m`;+ if (minutes > 0) return `${minutes}m ${seconds % 60}s`;+ return `${seconds}s`;+}++/**+ * Format duration+ */+function formatDuration(ms) {+ const minutes = Math.floor(ms / 60000);+ const seconds = Math.floor((ms % 60000) / 1000);++ if (minutes > 0) return `${minutes}m ${seconds}s`;+ return `${seconds}s`;+}++export default hiveMindStatusCommand;\ No newline at end of file