@monoes/monomindcli 2.9.3 → 2.9.5

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 (99) hide show
  1. package/.claude/skills/mastermind-createorg/SKILL.md +2 -1
  2. package/README.md +9 -5
  3. package/dist/src/autopilot-state.d.ts +16 -4
  4. package/dist/src/autopilot-state.d.ts.map +1 -1
  5. package/dist/src/autopilot-state.js +42 -19
  6. package/dist/src/autopilot-state.js.map +1 -1
  7. package/dist/src/commands/agent-lifecycle.js +4 -4
  8. package/dist/src/commands/agent-lifecycle.js.map +1 -1
  9. package/dist/src/commands/autopilot.d.ts.map +1 -1
  10. package/dist/src/commands/autopilot.js +106 -25
  11. package/dist/src/commands/autopilot.js.map +1 -1
  12. package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
  13. package/dist/src/commands/doctor-project-checks.js +20 -3
  14. package/dist/src/commands/doctor-project-checks.js.map +1 -1
  15. package/dist/src/commands/hooks-coverage-commands.d.ts.map +1 -1
  16. package/dist/src/commands/hooks-coverage-commands.js +67 -75
  17. package/dist/src/commands/hooks-coverage-commands.js.map +1 -1
  18. package/dist/src/commands/hooks-routing-commands.d.ts.map +1 -1
  19. package/dist/src/commands/hooks-routing-commands.js +12 -26
  20. package/dist/src/commands/hooks-routing-commands.js.map +1 -1
  21. package/dist/src/commands/hooks-workers.d.ts.map +1 -1
  22. package/dist/src/commands/hooks-workers.js +16 -47
  23. package/dist/src/commands/hooks-workers.js.map +1 -1
  24. package/dist/src/commands/hooks.d.ts.map +1 -1
  25. package/dist/src/commands/hooks.js +96 -54
  26. package/dist/src/commands/hooks.js.map +1 -1
  27. package/dist/src/commands/memory-list.d.ts.map +1 -1
  28. package/dist/src/commands/memory-list.js +79 -36
  29. package/dist/src/commands/memory-list.js.map +1 -1
  30. package/dist/src/commands/org.js +2 -2
  31. package/dist/src/commands/org.js.map +1 -1
  32. package/dist/src/commands/security-cve.d.ts.map +1 -1
  33. package/dist/src/commands/security-cve.js +11 -1
  34. package/dist/src/commands/security-cve.js.map +1 -1
  35. package/dist/src/commands/security-misc.d.ts +9 -0
  36. package/dist/src/commands/security-misc.d.ts.map +1 -1
  37. package/dist/src/commands/security-misc.js +54 -33
  38. package/dist/src/commands/security-misc.js.map +1 -1
  39. package/dist/src/commands/security-scan.d.ts.map +1 -1
  40. package/dist/src/commands/security-scan.js +11 -3
  41. package/dist/src/commands/security-scan.js.map +1 -1
  42. package/dist/src/commands/swarm.d.ts.map +1 -1
  43. package/dist/src/commands/swarm.js +137 -96
  44. package/dist/src/commands/swarm.js.map +1 -1
  45. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  46. package/dist/src/init/statusline-generator.js +47 -45
  47. package/dist/src/init/statusline-generator.js.map +1 -1
  48. package/dist/src/init/types.d.ts +1 -1
  49. package/dist/src/init/types.d.ts.map +1 -1
  50. package/dist/src/init/types.js +5 -1
  51. package/dist/src/init/types.js.map +1 -1
  52. package/dist/src/mcp-server.d.ts +6 -0
  53. package/dist/src/mcp-server.d.ts.map +1 -1
  54. package/dist/src/mcp-server.js +47 -22
  55. package/dist/src/mcp-server.js.map +1 -1
  56. package/dist/src/mcp-tools/embeddings-tools.js +2 -2
  57. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  58. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  59. package/dist/src/mcp-tools/hive-mind-tools.js +13 -11
  60. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  61. package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
  62. package/dist/src/mcp-tools/hooks-intelligence.js +99 -68
  63. package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
  64. package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
  65. package/dist/src/mcp-tools/hooks-routing.js +403 -215
  66. package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
  67. package/dist/src/mcp-tools/monograph/impact-tools.d.ts.map +1 -1
  68. package/dist/src/mcp-tools/monograph/impact-tools.js +109 -44
  69. package/dist/src/mcp-tools/monograph/impact-tools.js.map +1 -1
  70. package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
  71. package/dist/src/mcp-tools/performance-tools.js +10 -15
  72. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  73. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  74. package/dist/src/mcp-tools/system-tools.js +100 -38
  75. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  76. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  77. package/dist/src/memory/memory-bridge.js +172 -69
  78. package/dist/src/memory/memory-bridge.js.map +1 -1
  79. package/dist/src/monovector/diff-classifier.js +3 -3
  80. package/dist/src/monovector/diff-classifier.js.map +1 -1
  81. package/dist/src/orgrt/daemon.d.ts +5 -3
  82. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  83. package/dist/src/orgrt/daemon.js +291 -93
  84. package/dist/src/orgrt/daemon.js.map +1 -1
  85. package/dist/src/orgrt/kimicode-runner.js +1 -1
  86. package/dist/src/orgrt/kimicode-runner.js.map +1 -1
  87. package/dist/src/orgrt/opencode-runner.js +1 -1
  88. package/dist/src/orgrt/opencode-runner.js.map +1 -1
  89. package/dist/src/orgrt/remote.d.ts.map +1 -1
  90. package/dist/src/orgrt/remote.js +12 -6
  91. package/dist/src/orgrt/remote.js.map +1 -1
  92. package/dist/src/orgrt/server.d.ts.map +1 -1
  93. package/dist/src/orgrt/server.js +71 -14
  94. package/dist/src/orgrt/server.js.map +1 -1
  95. package/dist/src/types.d.ts +1 -1
  96. package/dist/src/types.d.ts.map +1 -1
  97. package/dist/src/ui/server.mjs +2647 -838
  98. package/dist/tsconfig.tsbuildinfo +1 -1
  99. package/package.json +7 -7
@@ -8,7 +8,7 @@ import { callMCPTool, MCPClientError } from '../mcp-client.js';
8
8
  import * as fs from 'fs';
9
9
  import * as path from 'path';
10
10
  import { writeJsonFileAtomic } from '../utils/json-file.js';
11
- import { getMonomindDataRoot, getProjectCwd, migrateLegacyStoreFile } from '../mcp-tools/types.js';
11
+ import { getMonomindDataRoot, getProjectCwd, migrateLegacyStoreFile } from '../utils/paths.js';
12
12
  // Canonical paths — resolved through getMonomindDataRoot() so the CLI and the MCP
13
13
  // tools (agent-tools.ts / swarm-tools.ts / task-tools.ts) read and write the SAME
14
14
  // physical files. These used to be `path.join(process.cwd(), '.monomind/...')`,
@@ -106,7 +106,7 @@ function getSwarmStatus(swarmId) {
106
106
  let sessionCount = 0;
107
107
  if (fs.existsSync(sessionDir)) {
108
108
  try {
109
- sessionCount = fs.readdirSync(sessionDir).filter(f => f.endsWith('.json')).length;
109
+ sessionCount = fs.readdirSync(sessionDir).filter((f) => f.endsWith('.json')).length;
110
110
  }
111
111
  catch {
112
112
  // Ignore
@@ -132,7 +132,7 @@ function getSwarmStatus(swarmId) {
132
132
  const tasksDir = path.join(getSwarmDir(), 'tasks');
133
133
  if (fs.existsSync(tasksDir)) {
134
134
  try {
135
- const taskFiles = fs.readdirSync(tasksDir).filter(f => f.endsWith('.json'));
135
+ const taskFiles = fs.readdirSync(tasksDir).filter((f) => f.endsWith('.json'));
136
136
  for (const file of taskFiles) {
137
137
  try {
138
138
  const taskFilePath = path.join(tasksDir, file);
@@ -182,7 +182,10 @@ function getSwarmStatus(swarmId) {
182
182
  status = 'ready';
183
183
  }
184
184
  return {
185
- id: swarmId || swarmState?.swarmId || swarmState?.id || 'no-active-swarm',
185
+ id: swarmId ||
186
+ swarmState?.swarmId ||
187
+ swarmState?.id ||
188
+ 'no-active-swarm',
186
189
  topology: swarmState?.topology || 'none',
187
190
  status,
188
191
  objective: swarmState?.objective || 'No active objective',
@@ -191,37 +194,45 @@ function getSwarmStatus(swarmId) {
191
194
  total: totalAgents,
192
195
  active: activeAgents,
193
196
  idle: Math.max(0, totalAgents - activeAgents),
194
- completed: 0
197
+ completed: 0,
195
198
  },
196
199
  progress,
197
200
  tasks: {
198
201
  total: totalTasks,
199
202
  completed: completedTasks,
200
203
  inProgress: inProgressTasks,
201
- pending: pendingTasks
204
+ pending: pendingTasks,
202
205
  },
203
206
  metrics: {
204
207
  tokensUsed: 0,
205
208
  avgResponseTime: '--',
206
209
  successRate: totalTasks > 0 ? `${Math.round((completedTasks / totalTasks) * 100)}%` : '--',
207
- elapsedTime: '--'
210
+ elapsedTime: '--',
208
211
  },
209
212
  coordination: {
210
213
  consensusRounds: 0,
211
214
  messagesSent: 0,
212
- conflictsResolved: 0
215
+ conflictsResolved: 0,
213
216
  },
214
- hasActiveSwarm: !!swarmState || totalAgents > 0
217
+ hasActiveSwarm: !!swarmState || totalAgents > 0,
215
218
  };
216
219
  }
217
220
  // Swarm topologies
218
221
  const TOPOLOGIES = [
219
- { value: 'hierarchical', label: 'Hierarchical', hint: 'Queen-led coordination with worker agents' },
222
+ {
223
+ value: 'hierarchical',
224
+ label: 'Hierarchical',
225
+ hint: 'Queen-led coordination with worker agents',
226
+ },
220
227
  { value: 'mesh', label: 'Mesh', hint: 'Fully connected peer-to-peer network' },
221
228
  { value: 'ring', label: 'Ring', hint: 'Circular communication pattern' },
222
229
  { value: 'star', label: 'Star', hint: 'Central coordinator with spoke agents' },
223
230
  { value: 'hybrid', label: 'Hybrid', hint: 'Hierarchical mesh for maximum flexibility' },
224
- { value: 'hierarchical-mesh', label: 'Hierarchical Mesh', hint: 'v1 15-agent queen + peer communication (recommended)' }
231
+ {
232
+ value: 'hierarchical-mesh',
233
+ label: 'Hierarchical Mesh',
234
+ hint: 'v1 15-agent queen + peer communication (recommended)',
235
+ },
225
236
  ];
226
237
  // Swarm strategies
227
238
  const STRATEGIES = [
@@ -233,7 +244,7 @@ const STRATEGIES = [
233
244
  { value: 'testing', label: 'Testing', hint: 'Comprehensive test coverage' },
234
245
  { value: 'optimization', label: 'Optimization', hint: 'Performance optimization' },
235
246
  { value: 'maintenance', label: 'Maintenance', hint: 'Codebase maintenance and refactoring' },
236
- { value: 'analysis', label: 'Analysis', hint: 'Code analysis and documentation' }
247
+ { value: 'analysis', label: 'Analysis', hint: 'Code analysis and documentation' },
237
248
  ];
238
249
  // Initialize swarm
239
250
  const initCommand = {
@@ -245,35 +256,35 @@ const initCommand = {
245
256
  short: 't',
246
257
  description: 'Swarm topology',
247
258
  type: 'string',
248
- choices: TOPOLOGIES.map(t => t.value),
249
- default: 'hierarchical'
259
+ choices: TOPOLOGIES.map((t) => t.value),
260
+ default: 'hierarchical',
250
261
  },
251
262
  {
252
263
  name: 'max-agents',
253
264
  short: 'm',
254
265
  description: 'Maximum number of agents',
255
266
  type: 'number',
256
- default: 15
267
+ default: 15,
257
268
  },
258
269
  {
259
270
  name: 'auto-scale',
260
271
  description: 'Enable automatic scaling',
261
272
  type: 'boolean',
262
- default: true
273
+ default: true,
263
274
  },
264
275
  {
265
276
  name: 'strategy',
266
277
  short: 's',
267
278
  description: 'Coordination strategy',
268
279
  type: 'string',
269
- choices: STRATEGIES.map(s => s.value)
280
+ choices: STRATEGIES.map((s) => s.value),
270
281
  },
271
282
  {
272
283
  name: 'v1-mode',
273
284
  description: 'Enable v1 15-agent hierarchical mesh mode',
274
285
  type: 'boolean',
275
- default: false
276
- }
286
+ default: false,
287
+ },
277
288
  ],
278
289
  action: async (ctx) => {
279
290
  let topology = ctx.flags.topology;
@@ -289,7 +300,7 @@ const initCommand = {
289
300
  topology = await select({
290
301
  message: 'Select swarm topology:',
291
302
  options: TOPOLOGIES,
292
- default: 'hierarchical'
303
+ default: 'hierarchical',
293
304
  });
294
305
  }
295
306
  output.writeln();
@@ -312,18 +323,15 @@ const initCommand = {
312
323
  },
313
324
  });
314
325
  // Display initialization progress
315
- output.writeln(output.dim(' Creating coordination topology...'));
316
- output.writeln(output.dim(' Initializing memory namespace...'));
317
- output.writeln(output.dim(' Setting up communication channels...'));
326
+ output.writeln(output.dim(` Wrote swarm config: ${result.swarmId}`));
318
327
  if (v1Mode) {
319
- output.writeln(output.dim(' Configuring SQLite-backed vector search (ANN)....'));
320
- output.writeln(output.dim(' Initializing keyword routing + outcome measurement...'));
328
+ output.writeln(output.dim(' (v1-mode: topology renamed to hierarchical-mesh; no ANN or keyword routing is performed during init)'));
321
329
  }
322
330
  output.writeln();
323
331
  output.printTable({
324
332
  columns: [
325
333
  { key: 'property', header: 'Property', width: 20 },
326
- { key: 'value', header: 'Value', width: 35 }
334
+ { key: 'value', header: 'Value', width: 35 },
327
335
  ],
328
336
  data: [
329
337
  { property: 'Swarm ID', value: result.swarmId },
@@ -331,8 +339,8 @@ const initCommand = {
331
339
  { property: 'Max Agents', value: result.config.maxAgents },
332
340
  { property: 'Auto Scale', value: result.config.autoScaling ? 'Enabled' : 'Disabled' },
333
341
  { property: 'Protocol', value: result.config.communicationProtocol || 'N/A' },
334
- { property: 'v1 Mode', value: v1Mode ? 'Enabled' : 'Disabled' }
335
- ]
342
+ { property: 'v1 Mode', value: v1Mode ? 'Enabled' : 'Disabled' },
343
+ ],
336
344
  });
337
345
  output.writeln();
338
346
  output.printSuccess('Swarm initialized successfully');
@@ -349,7 +357,9 @@ const initCommand = {
349
357
  try {
350
358
  store = JSON.parse(fs.readFileSync(stateFile, 'utf-8'));
351
359
  }
352
- catch { /* use default */ }
360
+ catch {
361
+ /* use default */
362
+ }
353
363
  }
354
364
  if (!store.swarms || typeof store.swarms !== 'object')
355
365
  store.swarms = {};
@@ -362,7 +372,7 @@ const initCommand = {
362
372
  tasks: [],
363
373
  config: { strategy: ctx.flags.strategy || 'development', v1Mode },
364
374
  createdAt: result.initializedAt || new Date().toISOString(),
365
- updatedAt: new Date().toISOString()
375
+ updatedAt: new Date().toISOString(),
366
376
  };
367
377
  writeJsonFileAtomic(stateFile, store);
368
378
  }
@@ -384,7 +394,7 @@ const initCommand = {
384
394
  }
385
395
  return { success: false, exitCode: 1 };
386
396
  }
387
- }
397
+ },
388
398
  };
389
399
  // Start swarm execution
390
400
  const startCommand = {
@@ -396,32 +406,38 @@ const startCommand = {
396
406
  short: 'o',
397
407
  description: 'Swarm objective/task',
398
408
  type: 'string',
399
- required: true
409
+ required: true,
400
410
  },
401
411
  {
402
412
  name: 'strategy',
403
413
  short: 's',
404
414
  description: 'Execution strategy',
405
415
  type: 'string',
406
- choices: STRATEGIES.map(s => s.value)
416
+ choices: STRATEGIES.map((s) => s.value),
407
417
  },
408
418
  {
409
419
  name: 'parallel',
410
420
  short: 'p',
411
421
  description: 'Enable parallel execution',
412
422
  type: 'boolean',
413
- default: true
423
+ default: true,
414
424
  },
415
425
  {
416
426
  name: 'monitor',
417
427
  description: 'Enable real-time monitoring',
418
428
  type: 'boolean',
419
- default: true
420
- }
429
+ default: true,
430
+ },
421
431
  ],
422
432
  examples: [
423
- { command: 'monomind swarm start -o "Build REST API" -s development', description: 'Start development swarm' },
424
- { command: 'monomind swarm start -o "Analyze codebase" --parallel', description: 'Parallel analysis' }
433
+ {
434
+ command: 'monomind swarm start -o "Build REST API" -s development',
435
+ description: 'Start development swarm',
436
+ },
437
+ {
438
+ command: 'monomind swarm start -o "Analyze codebase" --parallel',
439
+ description: 'Parallel analysis',
440
+ },
425
441
  ],
426
442
  action: async (ctx) => {
427
443
  const objective = ctx.args[0] || ctx.flags.objective;
@@ -435,7 +451,7 @@ const startCommand = {
435
451
  strategy = await select({
436
452
  message: 'Select execution strategy:',
437
453
  options: STRATEGIES,
438
- default: 'development'
454
+ default: 'development',
439
455
  });
440
456
  }
441
457
  strategy = strategy || 'development';
@@ -450,15 +466,15 @@ const startCommand = {
450
466
  { key: 'role', header: 'Role', width: 20 },
451
467
  { key: 'type', header: 'Type', width: 15 },
452
468
  { key: 'count', header: 'Count', width: 8, align: 'right' },
453
- { key: 'purpose', header: 'Purpose', width: 30 }
469
+ { key: 'purpose', header: 'Purpose', width: 30 },
454
470
  ],
455
- data: agentPlan
471
+ data: agentPlan,
456
472
  });
457
473
  // Confirm execution
458
474
  if (ctx.interactive) {
459
475
  const confirmed = await confirm({
460
476
  message: `Deploy ${agentPlan.reduce((sum, a) => sum + a.count, 0)} agents?`,
461
- default: true
477
+ default: true,
462
478
  });
463
479
  if (!confirmed) {
464
480
  output.printInfo('Swarm execution cancelled');
@@ -469,7 +485,10 @@ const startCommand = {
469
485
  const swarmId = `swarm-${Date.now().toString(36)}`;
470
486
  const totalAgents = agentPlan.reduce((sum, a) => sum + a.count, 0);
471
487
  output.writeln();
472
- const spinner = output.createSpinner({ text: 'Initializing swarm via MCP...', spinner: 'dots' });
488
+ const spinner = output.createSpinner({
489
+ text: 'Initializing swarm via MCP...',
490
+ spinner: 'dots',
491
+ });
473
492
  spinner.start();
474
493
  let resolvedSwarmId = swarmId;
475
494
  try {
@@ -503,7 +522,9 @@ const startCommand = {
503
522
  try {
504
523
  startStore = JSON.parse(fs.readFileSync(stateFile2, 'utf-8'));
505
524
  }
506
- catch { /* use default */ }
525
+ catch {
526
+ /* use default */
527
+ }
507
528
  }
508
529
  if (!startStore.swarms || typeof startStore.swarms !== 'object')
509
530
  startStore.swarms = {};
@@ -516,16 +537,17 @@ const startCommand = {
516
537
  tasks: [],
517
538
  config: { strategy, objective, agentPlan, parallel: ctx.flags.parallel ?? true },
518
539
  createdAt: new Date().toISOString(),
519
- updatedAt: new Date().toISOString()
540
+ updatedAt: new Date().toISOString(),
520
541
  };
521
542
  writeJsonFileAtomic(stateFile2, startStore);
522
543
  output.writeln();
523
- output.printSuccess(`Swarm ${resolvedSwarmId} initialized with ${totalAgents} agent slots`);
524
- output.writeln(output.dim(' Note: Agents are registered but actual task execution requires'));
525
- output.writeln(output.dim(' Claude Code Task tool or hive-mind spawn --claude to drive work.'));
544
+ output.printSuccess(`Swarm ${resolvedSwarmId} config written (${totalAgents} agent slots reserved). No agents are running — use 'agent spawn' or hive-mind spawn --claude to dispatch Task-tool agents.`);
526
545
  output.writeln(output.dim(` Monitor: monomind swarm status ${resolvedSwarmId}`));
527
- return { success: true, data: { swarmId: resolvedSwarmId, objective, strategy, agents: totalAgents } };
528
- }
546
+ return {
547
+ success: true,
548
+ data: { swarmId: resolvedSwarmId, objective, strategy, agents: totalAgents },
549
+ };
550
+ },
529
551
  };
530
552
  // Swarm status
531
553
  const statusCommand = {
@@ -560,14 +582,14 @@ const statusCommand = {
560
582
  output.printTable({
561
583
  columns: [
562
584
  { key: 'status', header: 'Status', width: 12 },
563
- { key: 'count', header: 'Count', width: 10, align: 'right' }
585
+ { key: 'count', header: 'Count', width: 10, align: 'right' },
564
586
  ],
565
587
  data: [
566
588
  { status: output.success('Active'), count: status.agents.active },
567
589
  { status: output.warning('Idle'), count: status.agents.idle },
568
590
  { status: output.dim('Completed'), count: status.agents.completed },
569
- { status: 'Total', count: status.agents.total }
570
- ]
591
+ { status: 'Total', count: status.agents.total },
592
+ ],
571
593
  });
572
594
  output.writeln();
573
595
  // Task status
@@ -575,14 +597,14 @@ const statusCommand = {
575
597
  output.printTable({
576
598
  columns: [
577
599
  { key: 'status', header: 'Status', width: 12 },
578
- { key: 'count', header: 'Count', width: 10, align: 'right' }
600
+ { key: 'count', header: 'Count', width: 10, align: 'right' },
579
601
  ],
580
602
  data: [
581
603
  { status: output.success('Completed'), count: status.tasks.completed },
582
604
  { status: output.info('In Progress'), count: status.tasks.inProgress },
583
605
  { status: output.dim('Pending'), count: status.tasks.pending },
584
- { status: 'Total', count: status.tasks.total }
585
- ]
606
+ { status: 'Total', count: status.tasks.total },
607
+ ],
586
608
  });
587
609
  output.writeln();
588
610
  // Metrics
@@ -591,7 +613,7 @@ const statusCommand = {
591
613
  `Tokens Used: ${status.metrics.tokensUsed.toLocaleString()}`,
592
614
  `Avg Response Time: ${status.metrics.avgResponseTime}`,
593
615
  `Success Rate: ${status.metrics.successRate}`,
594
- `Elapsed Time: ${status.metrics.elapsedTime}`
616
+ `Elapsed Time: ${status.metrics.elapsedTime}`,
595
617
  ]);
596
618
  output.writeln();
597
619
  // Coordination stats
@@ -599,10 +621,10 @@ const statusCommand = {
599
621
  output.printList([
600
622
  `Consensus Rounds: ${status.coordination.consensusRounds}`,
601
623
  `Messages Sent: ${status.coordination.messagesSent}`,
602
- `Conflicts Resolved: ${status.coordination.conflictsResolved}`
624
+ `Conflicts Resolved: ${status.coordination.conflictsResolved}`,
603
625
  ]);
604
626
  return { success: true, data: status };
605
- }
627
+ },
606
628
  };
607
629
  // Stop swarm
608
630
  const stopCommand = {
@@ -614,14 +636,14 @@ const stopCommand = {
614
636
  short: 'f',
615
637
  description: 'Force immediate stop',
616
638
  type: 'boolean',
617
- default: false
639
+ default: false,
618
640
  },
619
641
  {
620
642
  name: 'save-state',
621
643
  description: 'Save current state for resume',
622
644
  type: 'boolean',
623
- default: true
624
- }
645
+ default: true,
646
+ },
625
647
  ],
626
648
  action: async (ctx) => {
627
649
  const swarmId = ctx.args[0];
@@ -633,7 +655,7 @@ const stopCommand = {
633
655
  if (ctx.interactive && !force) {
634
656
  const confirmed = await confirm({
635
657
  message: `Stop swarm ${swarmId}? Progress will be saved.`,
636
- default: false
658
+ default: false,
637
659
  });
638
660
  if (!confirmed) {
639
661
  output.printInfo('Operation cancelled');
@@ -681,7 +703,7 @@ const stopCommand = {
681
703
  }
682
704
  output.printSuccess(`Swarm ${swarmId} stopped`);
683
705
  return { success: true, data: { swarmId, stopped: true, force } };
684
- }
706
+ },
685
707
  };
686
708
  // Scale swarm
687
709
  const scaleCommand = {
@@ -693,14 +715,14 @@ const scaleCommand = {
693
715
  short: 'a',
694
716
  description: 'Target number of agents',
695
717
  type: 'number',
696
- required: true
718
+ required: true,
697
719
  },
698
720
  {
699
721
  name: 'type',
700
722
  short: 't',
701
723
  description: 'Agent type to scale',
702
- type: 'string'
703
- }
724
+ type: 'string',
725
+ },
704
726
  ],
705
727
  action: async (ctx) => {
706
728
  const swarmId = ctx.args[0];
@@ -740,7 +762,7 @@ const scaleCommand = {
740
762
  output.printError(`Scale error: ${error instanceof MCPClientError ? error.message : String(error)}`);
741
763
  return { success: false, exitCode: 1 };
742
764
  }
743
- }
765
+ },
744
766
  };
745
767
  // Coordinate command (v1 specific)
746
768
  const coordinateCommand = {
@@ -751,13 +773,13 @@ const coordinateCommand = {
751
773
  name: 'agents',
752
774
  description: 'Number of agents',
753
775
  type: 'number',
754
- default: 15
776
+ default: 15,
755
777
  },
756
778
  {
757
779
  name: 'domains',
758
780
  description: 'Domains to activate',
759
- type: 'array'
760
- }
781
+ type: 'array',
782
+ },
761
783
  ],
762
784
  action: async (ctx) => {
763
785
  const agentCount = ctx.flags.agents || 15;
@@ -780,22 +802,27 @@ const coordinateCommand = {
780
802
  { id: 12, role: 'MCP Specialist', domain: 'Integration', status: 'active' },
781
803
  { id: 13, role: 'Project Coordinator', domain: 'Management', status: 'active' },
782
804
  { id: 14, role: 'Documentation Lead', domain: 'Management', status: 'standby' },
783
- { id: 15, role: 'DevOps Engineer', domain: 'Management', status: 'standby' }
805
+ { id: 15, role: 'DevOps Engineer', domain: 'Management', status: 'standby' },
784
806
  ].slice(0, agentCount);
785
807
  output.printTable({
786
808
  columns: [
787
809
  { key: 'id', header: '#', width: 3, align: 'right' },
788
810
  { key: 'role', header: 'Role', width: 22 },
789
811
  { key: 'domain', header: 'Domain', width: 15 },
790
- { key: 'status', header: 'Status', width: 10, format: (v) => {
812
+ {
813
+ key: 'status',
814
+ header: 'Status',
815
+ width: 10,
816
+ format: (v) => {
791
817
  if (v === 'primary')
792
818
  return output.highlight(String(v));
793
819
  if (v === 'active')
794
820
  return output.success(String(v));
795
821
  return output.dim(String(v));
796
- } }
822
+ },
823
+ },
797
824
  ],
798
- data: v1Agents
825
+ data: v1Agents,
799
826
  });
800
827
  // Actually initialize via MCP instead of just displaying (#1423)
801
828
  output.writeln();
@@ -805,27 +832,36 @@ const coordinateCommand = {
805
832
  maxAgents: agentCount,
806
833
  strategy: 'specialized',
807
834
  });
808
- output.printSuccess(`Swarm coordination initialized with ${agentCount} agent slots via MCP`);
835
+ output.printSuccess(`Swarm coordination config written (${agentCount} agent slots reserved) via MCP. No agents are running.`);
809
836
  }
810
837
  catch {
811
- output.printWarning('MCP unavailable — showing agent plan only (no active coordination)');
838
+ output.printWarning('MCP unavailable — showing agent plan only (no swarm state written)');
812
839
  }
813
840
  output.writeln();
814
- output.writeln(output.dim('Note: Use Claude Code Task tool or hive-mind spawn --claude to'));
815
- output.writeln(output.dim('drive actual agent execution. This command sets up the topology.'));
841
+ output.writeln(output.dim('Use Claude Code Task tool or hive-mind spawn --claude to drive actual agent execution.'));
816
842
  return { success: true, data: { agents: v1Agents, count: agentCount } };
817
- }
843
+ },
818
844
  };
819
845
  // Main swarm command
820
846
  export const swarmCommand = {
821
847
  name: 'swarm',
822
848
  description: 'Swarm coordination commands',
823
- subcommands: [initCommand, startCommand, statusCommand, stopCommand, scaleCommand, coordinateCommand],
849
+ subcommands: [
850
+ initCommand,
851
+ startCommand,
852
+ statusCommand,
853
+ stopCommand,
854
+ scaleCommand,
855
+ coordinateCommand,
856
+ ],
824
857
  options: [],
825
858
  examples: [
826
859
  { command: 'monomind swarm init --v1-mode', description: 'Initialize swarm' },
827
- { command: 'monomind swarm start -o "Build API" -s development', description: 'Start development swarm' },
828
- { command: 'monomind swarm coordinate --agents 15', description: 'v1 coordination' }
860
+ {
861
+ command: 'monomind swarm start -o "Build API" -s development',
862
+ description: 'Start development swarm',
863
+ },
864
+ { command: 'monomind swarm coordinate --agents 15', description: 'v1 coordination' },
829
865
  ],
830
866
  action: async (ctx) => {
831
867
  output.writeln();
@@ -840,65 +876,70 @@ export const swarmCommand = {
840
876
  `${output.highlight('status')} - Show swarm status`,
841
877
  `${output.highlight('stop')} - Stop swarm execution`,
842
878
  `${output.highlight('scale')} - Scale swarm agent count`,
843
- `${output.highlight('coordinate')} - 15-agent coordination`
879
+ `${output.highlight('coordinate')} - 15-agent coordination`,
844
880
  ]);
845
881
  return { success: true };
846
- }
882
+ },
847
883
  };
848
884
  // Helper function
849
885
  function getAgentPlan(strategy) {
850
886
  const plans = {
851
887
  specialized: [
852
- { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Central orchestration (anti-drift)' },
888
+ {
889
+ role: 'Coordinator',
890
+ type: 'coordinator',
891
+ count: 1,
892
+ purpose: 'Central orchestration (anti-drift)',
893
+ },
853
894
  { role: 'Researcher', type: 'researcher', count: 1, purpose: 'Requirements analysis' },
854
895
  { role: 'Architect', type: 'architect', count: 1, purpose: 'System design' },
855
896
  { role: 'Coder', type: 'coder', count: 2, purpose: 'Implementation' },
856
897
  { role: 'Tester', type: 'tester', count: 1, purpose: 'Quality assurance' },
857
- { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' }
898
+ { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' },
858
899
  ],
859
900
  balanced: [
860
901
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Orchestrate workflow' },
861
902
  { role: 'Worker', type: 'coder', count: 4, purpose: 'General implementation' },
862
- { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' }
903
+ { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' },
863
904
  ],
864
905
  adaptive: [
865
906
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Dynamic orchestration' },
866
907
  { role: 'Scout', type: 'researcher', count: 1, purpose: 'Task analysis' },
867
- { role: 'Worker', type: 'coder', count: 3, purpose: 'Adaptive execution' }
908
+ { role: 'Worker', type: 'coder', count: 3, purpose: 'Adaptive execution' },
868
909
  ],
869
910
  development: [
870
911
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Orchestrate workflow' },
871
912
  { role: 'Architect', type: 'architect', count: 1, purpose: 'System design' },
872
913
  { role: 'Coder', type: 'coder', count: 3, purpose: 'Implementation' },
873
914
  { role: 'Tester', type: 'tester', count: 2, purpose: 'Quality assurance' },
874
- { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' }
915
+ { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' },
875
916
  ],
876
917
  research: [
877
918
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Research coordination' },
878
919
  { role: 'Researcher', type: 'researcher', count: 4, purpose: 'Data gathering' },
879
- { role: 'Analyst', type: 'analyst', count: 2, purpose: 'Analysis and synthesis' }
920
+ { role: 'Analyst', type: 'analyst', count: 2, purpose: 'Analysis and synthesis' },
880
921
  ],
881
922
  testing: [
882
923
  { role: 'Test Lead', type: 'tester', count: 1, purpose: 'Test strategy' },
883
924
  { role: 'Unit Tester', type: 'tester', count: 2, purpose: 'Unit tests' },
884
925
  { role: 'Integration Tester', type: 'tester', count: 2, purpose: 'Integration tests' },
885
- { role: 'QA Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' }
926
+ { role: 'QA Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' },
886
927
  ],
887
928
  optimization: [
888
929
  { role: 'Performance Lead', type: 'optimizer', count: 1, purpose: 'Performance strategy' },
889
930
  { role: 'Profiler', type: 'analyst', count: 2, purpose: 'Profiling' },
890
- { role: 'Optimizer', type: 'coder', count: 2, purpose: 'Optimization' }
931
+ { role: 'Optimizer', type: 'coder', count: 2, purpose: 'Optimization' },
891
932
  ],
892
933
  maintenance: [
893
934
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Maintenance planning' },
894
935
  { role: 'Refactorer', type: 'coder', count: 2, purpose: 'Code cleanup' },
895
- { role: 'Documenter', type: 'researcher', count: 1, purpose: 'Documentation' }
936
+ { role: 'Documenter', type: 'researcher', count: 1, purpose: 'Documentation' },
896
937
  ],
897
938
  analysis: [
898
939
  { role: 'Analyst Lead', type: 'analyst', count: 1, purpose: 'Analysis coordination' },
899
940
  { role: 'Code Analyst', type: 'analyst', count: 2, purpose: 'Code analysis' },
900
- { role: 'Security Analyst', type: 'reviewer', count: 1, purpose: 'Security review' }
901
- ]
941
+ { role: 'Security Analyst', type: 'reviewer', count: 1, purpose: 'Security review' },
942
+ ],
902
943
  };
903
944
  return plans[strategy] || plans.development;
904
945
  }