monomind 1.17.0 → 1.17.1

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.
Files changed (91) hide show
  1. package/.claude/agents/engineering/engineering-security-engineer.md +1 -1
  2. package/.claude/commands/mastermind/_repeat.md +4 -0
  3. package/.claude/commands/mastermind/master.md +52 -1
  4. package/.claude/scheduled_tasks.lock +1 -1
  5. package/.claude/skills/mastermind/_repeat.md +2 -0
  6. package/package.json +1 -1
  7. package/packages/@monomind/cli/.claude/agents/engineering/engineering-security-engineer.md +1 -1
  8. package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +4 -0
  9. package/packages/@monomind/cli/.claude/commands/mastermind/master.md +52 -1
  10. package/packages/@monomind/cli/.claude/skills/mastermind/_repeat.md +2 -0
  11. package/packages/@monomind/cli/dist/src/__tests__/browse-analyzer.test.js +42 -59
  12. package/packages/@monomind/cli/dist/src/browser/dashboard/server.js +18 -0
  13. package/packages/@monomind/cli/dist/src/browser/dashboard/ui.html +37 -125
  14. package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.d.ts +17 -0
  15. package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.js +320 -0
  16. package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +9 -0
  17. package/packages/@monomind/cli/dist/src/commands/agent-ops.js +329 -0
  18. package/packages/@monomind/cli/dist/src/commands/agent.js +5 -907
  19. package/packages/@monomind/cli/dist/src/commands/analyze-ast.d.ts +26 -0
  20. package/packages/@monomind/cli/dist/src/commands/analyze-ast.js +284 -0
  21. package/packages/@monomind/cli/dist/src/commands/analyze-boundaries.d.ts +14 -0
  22. package/packages/@monomind/cli/dist/src/commands/analyze-boundaries.js +295 -0
  23. package/packages/@monomind/cli/dist/src/commands/analyze-diff.d.ts +8 -0
  24. package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +395 -0
  25. package/packages/@monomind/cli/dist/src/commands/analyze-graph.d.ts +14 -0
  26. package/packages/@monomind/cli/dist/src/commands/analyze-graph.js +304 -0
  27. package/packages/@monomind/cli/dist/src/commands/analyze-imports.d.ts +11 -0
  28. package/packages/@monomind/cli/dist/src/commands/analyze-imports.js +287 -0
  29. package/packages/@monomind/cli/dist/src/commands/analyze-symbols.d.ts +14 -0
  30. package/packages/@monomind/cli/dist/src/commands/analyze-symbols.js +302 -0
  31. package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +38 -0
  32. package/packages/@monomind/cli/dist/src/commands/analyze.js +12 -1827
  33. package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.d.ts +26 -0
  34. package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.js +189 -0
  35. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +19 -0
  36. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +388 -0
  37. package/packages/@monomind/cli/dist/src/commands/doctor.js +51 -942
  38. package/packages/@monomind/cli/dist/src/commands/hive-mind-comms.d.ts +11 -0
  39. package/packages/@monomind/cli/dist/src/commands/hive-mind-comms.js +242 -0
  40. package/packages/@monomind/cli/dist/src/commands/hive-mind-helpers.d.ts +35 -0
  41. package/packages/@monomind/cli/dist/src/commands/hive-mind-helpers.js +203 -0
  42. package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.d.ts +8 -0
  43. package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.js +233 -0
  44. package/packages/@monomind/cli/dist/src/commands/hive-mind-spawn.d.ts +12 -0
  45. package/packages/@monomind/cli/dist/src/commands/hive-mind-spawn.js +274 -0
  46. package/packages/@monomind/cli/dist/src/commands/hive-mind.js +10 -1129
  47. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.d.ts +4 -4
  48. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +19 -819
  49. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.d.ts +7 -0
  50. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +334 -0
  51. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.d.ts +7 -0
  52. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +399 -0
  53. package/packages/@monomind/cli/dist/src/commands/init-subcommands.d.ts +8 -0
  54. package/packages/@monomind/cli/dist/src/commands/init-subcommands.js +156 -0
  55. package/packages/@monomind/cli/dist/src/commands/init-upgrade.d.ts +6 -0
  56. package/packages/@monomind/cli/dist/src/commands/init-upgrade.js +203 -0
  57. package/packages/@monomind/cli/dist/src/commands/init-wizard.d.ts +6 -0
  58. package/packages/@monomind/cli/dist/src/commands/init-wizard.js +246 -0
  59. package/packages/@monomind/cli/dist/src/commands/init.js +6 -623
  60. package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +10 -0
  61. package/packages/@monomind/cli/dist/src/commands/memory-admin.js +433 -0
  62. package/packages/@monomind/cli/dist/src/commands/memory-crud.d.ts +9 -0
  63. package/packages/@monomind/cli/dist/src/commands/memory-crud.js +342 -0
  64. package/packages/@monomind/cli/dist/src/commands/memory-list.d.ts +10 -0
  65. package/packages/@monomind/cli/dist/src/commands/memory-list.js +321 -0
  66. package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +9 -0
  67. package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +372 -0
  68. package/packages/@monomind/cli/dist/src/commands/memory.d.ts +6 -0
  69. package/packages/@monomind/cli/dist/src/commands/memory.js +10 -1441
  70. package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +8 -0
  71. package/packages/@monomind/cli/dist/src/commands/neural-core.js +274 -0
  72. package/packages/@monomind/cli/dist/src/commands/neural-optimize.d.ts +7 -0
  73. package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +332 -0
  74. package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +7 -0
  75. package/packages/@monomind/cli/dist/src/commands/neural-registry.js +290 -0
  76. package/packages/@monomind/cli/dist/src/commands/neural.js +3 -974
  77. package/packages/@monomind/cli/dist/src/commands/platforms.js +327 -7
  78. package/packages/@monomind/cli/dist/src/commands/security-cve.d.ts +6 -0
  79. package/packages/@monomind/cli/dist/src/commands/security-cve.js +310 -0
  80. package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +9 -0
  81. package/packages/@monomind/cli/dist/src/commands/security-misc.js +293 -0
  82. package/packages/@monomind/cli/dist/src/commands/security-scan.d.ts +18 -0
  83. package/packages/@monomind/cli/dist/src/commands/security-scan.js +328 -0
  84. package/packages/@monomind/cli/dist/src/commands/security.js +3 -958
  85. package/packages/@monomind/cli/dist/src/commands/session.js +1 -1
  86. package/packages/@monomind/cli/dist/src/commands/swarm.js +23 -17
  87. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +77 -0
  88. package/packages/@monomind/cli/dist/src/parser.js +11 -6
  89. package/packages/@monomind/cli/dist/src/routing/llm-caller.js +1 -2
  90. package/packages/@monomind/cli/package.json +2 -3
  91. package/packages/@monomind/cli/scripts/understand-analyze.mjs +1 -1
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Hive Mind communication subcommands — join, leave, consensus, broadcast, memory, shutdown
3
+ */
4
+ import type { Command } from '../types.js';
5
+ export declare const joinCommand: Command;
6
+ export declare const leaveCommand: Command;
7
+ export declare const consensusCommand: Command;
8
+ export declare const broadcastCommand: Command;
9
+ export declare const memorySubCommand: Command;
10
+ export declare const shutdownCommand: Command;
11
+ //# sourceMappingURL=hive-mind-comms.d.ts.map
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Hive Mind communication subcommands — join, leave, consensus, broadcast, memory, shutdown
3
+ */
4
+ import { output } from '../output.js';
5
+ import { confirm } from '../prompt.js';
6
+ import { callMCPTool, MCPClientError } from '../mcp-client.js';
7
+ import { MAX_MESSAGE_LEN, MAX_KEY_LEN, MAX_VALUE_LEN, MAX_AGENT_ID_LEN, } from './hive-mind-helpers.js';
8
+ export const joinCommand = {
9
+ name: 'join',
10
+ description: 'Join an agent to the hive mind',
11
+ options: [
12
+ { name: 'agent-id', short: 'a', description: 'Agent ID to join', type: 'string' },
13
+ { name: 'role', short: 'r', description: 'Agent role (worker, specialist, scout)', type: 'string', default: 'worker' }
14
+ ],
15
+ action: async (ctx) => {
16
+ const agentId = (ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId || '').slice(0, MAX_AGENT_ID_LEN);
17
+ if (!agentId) {
18
+ output.printError('Agent ID is required. Use --agent-id or -a flag, or provide as argument.');
19
+ return { success: false, exitCode: 1 };
20
+ }
21
+ try {
22
+ const result = await callMCPTool('hive-mind_join', { agentId, role: ctx.flags.role });
23
+ if (!result.success) {
24
+ output.printError(result.error || 'Failed');
25
+ return { success: false, exitCode: 1 };
26
+ }
27
+ output.printSuccess(`Agent ${agentId} joined hive (${result.totalWorkers} workers)`);
28
+ return { success: true, data: result };
29
+ }
30
+ catch (error) {
31
+ output.printError(`Join error: ${error instanceof MCPClientError ? error.message : String(error)}`);
32
+ return { success: false, exitCode: 1 };
33
+ }
34
+ }
35
+ };
36
+ export const leaveCommand = {
37
+ name: 'leave',
38
+ description: 'Remove an agent from the hive mind',
39
+ options: [
40
+ { name: 'agent-id', short: 'a', description: 'Agent ID to remove', type: 'string' }
41
+ ],
42
+ action: async (ctx) => {
43
+ const agentId = (ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId || '').slice(0, MAX_AGENT_ID_LEN);
44
+ if (!agentId) {
45
+ output.printError('Agent ID required.');
46
+ return { success: false, exitCode: 1 };
47
+ }
48
+ try {
49
+ const result = await callMCPTool('hive-mind_leave', { agentId });
50
+ if (!result.success) {
51
+ output.printError(result.error || 'Failed');
52
+ return { success: false, exitCode: 1 };
53
+ }
54
+ output.printSuccess(`Agent ${agentId} left hive (${result.remainingWorkers} remaining)`);
55
+ return { success: true, data: result };
56
+ }
57
+ catch (error) {
58
+ output.printError(`Leave error: ${error instanceof MCPClientError ? error.message : String(error)}`);
59
+ return { success: false, exitCode: 1 };
60
+ }
61
+ }
62
+ };
63
+ export const consensusCommand = {
64
+ name: 'consensus',
65
+ description: 'Manage consensus proposals and voting',
66
+ options: [
67
+ { name: 'action', short: 'a', description: 'Consensus action', type: 'string', choices: ['propose', 'vote', 'status', 'list'], default: 'list' },
68
+ { name: 'proposal-id', short: 'p', description: 'Proposal ID', type: 'string' },
69
+ { name: 'type', short: 't', description: 'Proposal type', type: 'string' },
70
+ { name: 'value', description: 'Proposal value', type: 'string' },
71
+ { name: 'vote', short: 'v', description: 'Vote (yes/no)', type: 'string' },
72
+ { name: 'voter-id', description: 'Voter agent ID', type: 'string' }
73
+ ],
74
+ action: async (ctx) => {
75
+ const action = ctx.flags.action || 'list';
76
+ try {
77
+ const result = await callMCPTool('hive-mind_consensus', {
78
+ action,
79
+ proposalId: ctx.flags['proposal-id'],
80
+ type: ctx.flags.type,
81
+ value: ctx.flags.value,
82
+ vote: ctx.flags.vote === 'yes',
83
+ voterId: ctx.flags['voter-id']
84
+ });
85
+ if (ctx.flags.format === 'json') {
86
+ output.printJson(result);
87
+ return { success: true, data: result };
88
+ }
89
+ if (action === 'list') {
90
+ output.writeln(output.bold('\nPending Proposals'));
91
+ const pending = result.pending || [];
92
+ if (pending.length === 0)
93
+ output.printInfo('No pending proposals');
94
+ else
95
+ output.printTable({ columns: [{ key: 'proposalId', header: 'ID', width: 30 }, { key: 'type', header: 'Type', width: 12 }], data: pending });
96
+ }
97
+ else if (action === 'propose') {
98
+ output.printSuccess(`Proposal created: ${result.proposalId}`);
99
+ }
100
+ else if (action === 'vote') {
101
+ output.printSuccess(`Vote recorded (For: ${result.votesFor}, Against: ${result.votesAgainst})`);
102
+ }
103
+ return { success: true, data: result };
104
+ }
105
+ catch (error) {
106
+ output.printError(`Consensus error: ${error instanceof MCPClientError ? error.message : String(error)}`);
107
+ return { success: false, exitCode: 1 };
108
+ }
109
+ }
110
+ };
111
+ export const broadcastCommand = {
112
+ name: 'broadcast',
113
+ description: 'Broadcast a message to all workers in the hive',
114
+ options: [
115
+ { name: 'message', short: 'm', description: 'Message to broadcast', type: 'string', required: true },
116
+ { name: 'priority', short: 'p', description: 'Message priority', type: 'string', choices: ['low', 'normal', 'high', 'critical'], default: 'normal' },
117
+ { name: 'from', short: 'f', description: 'Sender agent ID', type: 'string' }
118
+ ],
119
+ action: async (ctx) => {
120
+ const message = (ctx.args.join(' ') || ctx.flags.message || '').slice(0, MAX_MESSAGE_LEN);
121
+ if (!message) {
122
+ output.printError('Message required. Use --message or -m flag.');
123
+ return { success: false, exitCode: 1 };
124
+ }
125
+ try {
126
+ const result = await callMCPTool('hive-mind_broadcast', {
127
+ message,
128
+ priority: ctx.flags.priority,
129
+ fromId: typeof ctx.flags.from === 'string' ? ctx.flags.from.slice(0, MAX_AGENT_ID_LEN) : undefined
130
+ });
131
+ if (!result.success) {
132
+ output.printError(result.error || 'Failed');
133
+ return { success: false, exitCode: 1 };
134
+ }
135
+ output.printSuccess(`Message broadcast to ${result.recipients} workers (ID: ${result.messageId})`);
136
+ return { success: true, data: result };
137
+ }
138
+ catch (error) {
139
+ output.printError(`Broadcast error: ${error instanceof MCPClientError ? error.message : String(error)}`);
140
+ return { success: false, exitCode: 1 };
141
+ }
142
+ }
143
+ };
144
+ export const memorySubCommand = {
145
+ name: 'memory',
146
+ description: 'Access hive shared memory',
147
+ options: [
148
+ { name: 'action', short: 'a', description: 'Memory action', type: 'string', choices: ['get', 'set', 'delete', 'list'], default: 'list' },
149
+ { name: 'key', short: 'k', description: 'Memory key', type: 'string' },
150
+ { name: 'value', short: 'v', description: 'Value to store', type: 'string' }
151
+ ],
152
+ action: async (ctx) => {
153
+ const action = ctx.flags.action || 'list';
154
+ const key = typeof ctx.flags.key === 'string' ? ctx.flags.key.slice(0, MAX_KEY_LEN) : undefined;
155
+ const value = typeof ctx.flags.value === 'string' ? ctx.flags.value.slice(0, MAX_VALUE_LEN) : undefined;
156
+ if ((action === 'get' || action === 'delete') && !key) {
157
+ output.printError('Key required for get/delete.');
158
+ return { success: false, exitCode: 1 };
159
+ }
160
+ if (action === 'set' && (!key || value === undefined)) {
161
+ output.printError('Key and value required for set.');
162
+ return { success: false, exitCode: 1 };
163
+ }
164
+ try {
165
+ const result = await callMCPTool('hive-mind_memory', { action, key, value });
166
+ if (ctx.flags.format === 'json') {
167
+ output.printJson(result);
168
+ return { success: true, data: result };
169
+ }
170
+ if (action === 'list') {
171
+ const keys = result.keys || [];
172
+ output.writeln(output.bold(`\nShared Memory (${result.count} keys)`));
173
+ if (keys.length === 0)
174
+ output.printInfo('No keys in shared memory');
175
+ else
176
+ output.printList(keys.map(k => output.highlight(k)));
177
+ }
178
+ else if (action === 'get') {
179
+ output.writeln(output.bold(`\nKey: ${key}`));
180
+ output.writeln(result.exists ? `Value: ${JSON.stringify(result.value, null, 2)}` : 'Key not found');
181
+ }
182
+ else if (action === 'set') {
183
+ output.printSuccess(`Set ${key} in shared memory`);
184
+ }
185
+ else if (action === 'delete') {
186
+ output.printSuccess(result.deleted ? `Deleted ${key}` : `Key ${key} did not exist`);
187
+ }
188
+ return { success: true, data: result };
189
+ }
190
+ catch (error) {
191
+ output.printError(`Memory error: ${error instanceof MCPClientError ? error.message : String(error)}`);
192
+ return { success: false, exitCode: 1 };
193
+ }
194
+ }
195
+ };
196
+ export const shutdownCommand = {
197
+ name: 'shutdown',
198
+ description: 'Shutdown the hive mind',
199
+ options: [
200
+ { name: 'force', short: 'f', description: 'Force shutdown', type: 'boolean', default: false },
201
+ { name: 'save-state', short: 's', description: 'Save state before shutdown', type: 'boolean', default: true }
202
+ ],
203
+ action: async (ctx) => {
204
+ const force = ctx.flags.force;
205
+ const saveState = ctx.flags['save-state'];
206
+ if (!force && ctx.interactive) {
207
+ const confirmed = await confirm({
208
+ message: 'Shutdown the hive mind? All agents will be terminated.',
209
+ default: false
210
+ });
211
+ if (!confirmed) {
212
+ output.printInfo('Operation cancelled');
213
+ return { success: true };
214
+ }
215
+ }
216
+ output.printInfo('Shutting down hive mind...');
217
+ const spinner = output.createSpinner({ text: 'Graceful shutdown in progress...', spinner: 'dots' });
218
+ spinner.start();
219
+ try {
220
+ const result = await callMCPTool('hive-mind_shutdown', { force, saveState });
221
+ spinner.succeed('Hive mind shutdown complete');
222
+ output.writeln();
223
+ output.printList([
224
+ `Agents terminated: ${result.agentsTerminated}`,
225
+ `State saved: ${result.stateSaved ? 'Yes' : 'No'}`,
226
+ `Shutdown time: ${result.shutdownTime}`
227
+ ]);
228
+ return { success: true, data: result };
229
+ }
230
+ catch (error) {
231
+ spinner.fail('Shutdown failed');
232
+ if (error instanceof MCPClientError) {
233
+ output.printError(`Shutdown error: ${error.message}`);
234
+ }
235
+ else {
236
+ output.printError(`Unexpected error: ${String(error)}`);
237
+ }
238
+ return { success: false, exitCode: 1 };
239
+ }
240
+ }
241
+ };
242
+ //# sourceMappingURL=hive-mind-comms.js.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Hive Mind shared types, constants, and format helpers
3
+ */
4
+ export declare const MAX_OBJECTIVE_LEN = 2000;
5
+ export declare const MAX_TASK_DESC_LEN = 4000;
6
+ export declare const MAX_MESSAGE_LEN = 2000;
7
+ export declare const MAX_KEY_LEN = 256;
8
+ export declare const MAX_VALUE_LEN = 65536;
9
+ export declare const MAX_AGENT_ID_LEN = 128;
10
+ export interface HiveWorker {
11
+ agentId: string;
12
+ role: string;
13
+ type?: string;
14
+ joinedAt?: string;
15
+ }
16
+ export interface WorkerGroups {
17
+ [key: string]: HiveWorker[];
18
+ }
19
+ export declare const TOPOLOGIES: {
20
+ value: string;
21
+ label: string;
22
+ hint: string;
23
+ }[];
24
+ export declare const CONSENSUS_STRATEGIES: {
25
+ value: string;
26
+ label: string;
27
+ hint: string;
28
+ }[];
29
+ export declare function groupWorkersByType(workers: HiveWorker[]): WorkerGroups;
30
+ export declare function generateHiveMindPrompt(swarmId: string, swarmName: string, objective: string, workers: HiveWorker[], workerGroups: WorkerGroups, flags: Record<string, unknown>): string;
31
+ export declare function formatAgentStatus(status: unknown): string;
32
+ export declare function formatHiveStatus(status: string): string;
33
+ export declare function formatHealth(health: string): string;
34
+ export declare function formatPriority(priority: string): string;
35
+ //# sourceMappingURL=hive-mind-helpers.d.ts.map
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Hive Mind shared types, constants, and format helpers
3
+ */
4
+ import { output } from '../output.js';
5
+ // Input length caps
6
+ export const MAX_OBJECTIVE_LEN = 2_000;
7
+ export const MAX_TASK_DESC_LEN = 4_000;
8
+ export const MAX_MESSAGE_LEN = 2_000;
9
+ export const MAX_KEY_LEN = 256;
10
+ export const MAX_VALUE_LEN = 65_536;
11
+ export const MAX_AGENT_ID_LEN = 128;
12
+ export const TOPOLOGIES = [
13
+ { value: 'hierarchical', label: 'Hierarchical', hint: 'Queen-led with worker agents' },
14
+ { value: 'mesh', label: 'Mesh', hint: 'Peer-to-peer coordination' },
15
+ { value: 'hierarchical-mesh', label: 'Hierarchical Mesh', hint: 'Queen + peer communication (recommended)' },
16
+ { value: 'adaptive', label: 'Adaptive', hint: 'Dynamic topology based on task' }
17
+ ];
18
+ export const CONSENSUS_STRATEGIES = [
19
+ { value: 'byzantine', label: 'Byzantine Fault Tolerant', hint: '2/3 majority, handles malicious actors' },
20
+ { value: 'raft', label: 'Raft', hint: 'Leader-based consensus' },
21
+ { value: 'gossip', label: 'Gossip', hint: 'Eventually consistent, scalable' },
22
+ { value: 'crdt', label: 'CRDT', hint: 'Conflict-free replicated data' },
23
+ { value: 'quorum', label: 'Quorum', hint: 'Simple majority voting' }
24
+ ];
25
+ export function groupWorkersByType(workers) {
26
+ const groups = {};
27
+ for (const worker of workers) {
28
+ const type = worker.type || worker.role || 'worker';
29
+ if (!groups[type]) {
30
+ groups[type] = [];
31
+ }
32
+ groups[type].push(worker);
33
+ }
34
+ return groups;
35
+ }
36
+ export function generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags) {
37
+ const currentTime = new Date().toISOString();
38
+ const workerTypes = Object.keys(workerGroups);
39
+ const queenType = flags.queenType || 'strategic';
40
+ const consensusAlgorithm = flags.consensus || 'byzantine';
41
+ const topology = flags.topology || 'hierarchical-mesh';
42
+ return `🧠 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM
43
+ ═══════════════════════════════════════════════
44
+
45
+ You are the Queen coordinator of a Hive Mind swarm with collective intelligence capabilities.
46
+
47
+ HIVE MIND CONFIGURATION:
48
+ 📌 Swarm ID: ${swarmId}
49
+ 📌 Swarm Name: ${swarmName}
50
+ 🎯 Objective: ${objective}
51
+ 👑 Queen Type: ${queenType}
52
+ 🐝 Worker Count: ${workers.length}
53
+ 🔗 Topology: ${topology}
54
+ 🤝 Consensus Algorithm: ${consensusAlgorithm}
55
+ ⏰ Initialized: ${currentTime}
56
+
57
+ WORKER DISTRIBUTION:
58
+ ${workerTypes.map(type => `• ${type}: ${workerGroups[type].length} agents`).join('\n')}
59
+
60
+ 🔧 AVAILABLE MCP TOOLS FOR HIVE MIND COORDINATION:
61
+
62
+ 1️⃣ **COLLECTIVE INTELLIGENCE**
63
+ mcp__monomind__hive-mind_consensus - Democratic decision making
64
+ mcp__monomind__hive-mind_memory - Share knowledge across the hive
65
+ mcp__monomind__hive-mind_broadcast - Broadcast to all workers
66
+ mcp__monomind__neural_patterns - Neural pattern recognition
67
+
68
+ 2️⃣ **QUEEN COORDINATION**
69
+ mcp__monomind__hive-mind_status - Monitor swarm health
70
+ mcp__monomind__task_create - Create and delegate tasks
71
+ mcp__monomind__coordination_orchestrate - Orchestrate task distribution
72
+ mcp__monomind__agent_spawn - Spawn additional workers
73
+
74
+ 3️⃣ **WORKER MANAGEMENT**
75
+ mcp__monomind__agent_list - List all active agents
76
+ mcp__monomind__agent_status - Check agent status
77
+ mcp__monomind__agent_health - Check worker health
78
+ mcp__monomind__hive-mind_join - Add agent to hive
79
+ mcp__monomind__hive-mind_leave - Remove agent from hive
80
+
81
+ 4️⃣ **TASK ORCHESTRATION**
82
+ mcp__monomind__task_assign - Assign tasks to workers
83
+ mcp__monomind__task_status - Track task progress
84
+ mcp__monomind__task_complete - Mark tasks complete
85
+ mcp__monomind__workflow_create - Create workflows
86
+
87
+ 5️⃣ **MEMORY & LEARNING**
88
+ mcp__monomind__memory_store - Store collective knowledge
89
+ mcp__monomind__memory_retrieve - Access shared memory
90
+ mcp__monomind__memory_search - Search memory patterns
91
+ mcp__monomind__neural_train - Learn from experiences
92
+ mcp__monomind__hooks_intelligence_pattern-store - Store patterns
93
+
94
+ 📋 HIVE MIND EXECUTION PROTOCOL:
95
+
96
+ 1. **INITIALIZATION PHASE**
97
+ - Verify all workers are online and responsive
98
+ - Establish communication channels
99
+ - Load previous session state if available
100
+ - Initialize shared memory space
101
+
102
+ 2. **TASK DISTRIBUTION PHASE**
103
+ - Analyze the objective and decompose into subtasks
104
+ - Assign tasks based on worker specializations
105
+ - Set up task dependencies and ordering
106
+ - Monitor parallel execution
107
+
108
+ 3. **COORDINATION PHASE**
109
+ - Use consensus for critical decisions
110
+ - Aggregate results from workers
111
+ - Resolve conflicts using ${consensusAlgorithm} consensus
112
+ - Share learnings across the hive
113
+
114
+ 4. **COMPLETION PHASE**
115
+ - Verify all subtasks are complete
116
+ - Consolidate results
117
+ - Store learnings in collective memory
118
+ - Report final status
119
+
120
+ 🎯 YOUR OBJECTIVE:
121
+ ${objective}
122
+
123
+ ⚠️ CRITICAL — TOOL PREFERENCE RULES (#1422):
124
+ • You MUST use Monomind MCP tools (mcp__monomind__*) for ALL orchestration tasks
125
+ • Do NOT use Claude native Task/Agent tools for swarm coordination — use mcp__monomind__agent_spawn, mcp__monomind__task_assign, etc.
126
+ • Native Claude tools (Read, Write, Edit, Bash, Grep, Glob) should ONLY be used for file operations and shell commands
127
+ • All agent spawning, task assignment, memory, and coordination MUST go through mcp__monomind__* tools
128
+ • If a Monomind MCP tool exists for an operation, always prefer it over any native equivalent
129
+
130
+ 💡 COORDINATION TIPS:
131
+ • Use mcp__monomind__hive-mind_broadcast for swarm-wide announcements
132
+ • Check worker status regularly with mcp__monomind__hive-mind_status
133
+ • Store important decisions in shared memory for persistence
134
+ • Use consensus for any decisions affecting multiple workers
135
+ • Use mcp__monomind__task_assign to assign tasks to workers, then mcp__monomind__task_complete when done
136
+
137
+ 🚀 BEGIN HIVE MIND COORDINATION NOW!
138
+ Start by checking the current hive status and then proceed with the objective.
139
+ `;
140
+ }
141
+ export function formatAgentStatus(status) {
142
+ const statusStr = String(status);
143
+ switch (statusStr) {
144
+ case 'active':
145
+ case 'ready':
146
+ case 'running':
147
+ return output.success(statusStr);
148
+ case 'idle':
149
+ case 'waiting':
150
+ return output.dim(statusStr);
151
+ case 'busy':
152
+ return output.highlight(statusStr);
153
+ case 'error':
154
+ case 'failed':
155
+ return output.error(statusStr);
156
+ default:
157
+ return statusStr;
158
+ }
159
+ }
160
+ export function formatHiveStatus(status) {
161
+ switch (status) {
162
+ case 'active':
163
+ return output.success(status);
164
+ case 'idle':
165
+ return output.dim(status);
166
+ case 'degraded':
167
+ return output.warning(status);
168
+ case 'offline':
169
+ return output.error(status);
170
+ default:
171
+ return status;
172
+ }
173
+ }
174
+ export function formatHealth(health) {
175
+ switch (health) {
176
+ case 'healthy':
177
+ case 'good':
178
+ return output.success(health);
179
+ case 'warning':
180
+ case 'degraded':
181
+ return output.warning(health);
182
+ case 'critical':
183
+ case 'unhealthy':
184
+ return output.error(health);
185
+ default:
186
+ return health;
187
+ }
188
+ }
189
+ export function formatPriority(priority) {
190
+ switch (priority) {
191
+ case 'critical':
192
+ return output.error(priority.toUpperCase());
193
+ case 'high':
194
+ return output.warning(priority);
195
+ case 'normal':
196
+ return priority;
197
+ case 'low':
198
+ return output.dim(priority);
199
+ default:
200
+ return priority;
201
+ }
202
+ }
203
+ //# sourceMappingURL=hive-mind-helpers.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Hive Mind operational subcommands — status, task, optimize-memory
3
+ */
4
+ import type { Command } from '../types.js';
5
+ export declare const statusCommand: Command;
6
+ export declare const taskCommand: Command;
7
+ export declare const optimizeMemoryCommand: Command;
8
+ //# sourceMappingURL=hive-mind-ops.d.ts.map