@monoes/monomindcli 2.9.3 → 2.9.4

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 (189) hide show
  1. package/.claude/helpers/intelligence.cjs +27 -6
  2. package/.claude/skills/agentic-jujutsu/SKILL.md +17 -15
  3. package/.claude/skills/hive-mind-advanced/SKILL.md +212 -559
  4. package/.claude/skills/hooks-automation/SKILL.md +1 -1
  5. package/.claude/skills/mastermind-createorg/SKILL.md +2 -1
  6. package/.claude/skills/pair-programming/SKILL.md +1 -1
  7. package/.claude/skills/performance-analysis/SKILL.md +228 -484
  8. package/.claude/skills/swarm-advanced/SKILL.md +2 -2
  9. package/.claude/skills/swarm-orchestration/SKILL.md +220 -150
  10. package/.claude/skills/verification-quality/SKILL.md +247 -571
  11. package/README.md +6 -2
  12. package/dist/src/autopilot-state.d.ts +16 -4
  13. package/dist/src/autopilot-state.d.ts.map +1 -1
  14. package/dist/src/autopilot-state.js +42 -19
  15. package/dist/src/autopilot-state.js.map +1 -1
  16. package/dist/src/commands/agent-lifecycle.js +3 -3
  17. package/dist/src/commands/agent-lifecycle.js.map +1 -1
  18. package/dist/src/commands/autopilot.d.ts.map +1 -1
  19. package/dist/src/commands/autopilot.js +113 -26
  20. package/dist/src/commands/autopilot.js.map +1 -1
  21. package/dist/src/commands/doc.d.ts.map +1 -1
  22. package/dist/src/commands/doc.js +14 -3
  23. package/dist/src/commands/doc.js.map +1 -1
  24. package/dist/src/commands/doctor-env-checks.d.ts +1 -1
  25. package/dist/src/commands/doctor-env-checks.d.ts.map +1 -1
  26. package/dist/src/commands/doctor.d.ts.map +1 -1
  27. package/dist/src/commands/doctor.js +30 -1
  28. package/dist/src/commands/doctor.js.map +1 -1
  29. package/dist/src/commands/hooks-routing-commands.d.ts.map +1 -1
  30. package/dist/src/commands/hooks-routing-commands.js +12 -26
  31. package/dist/src/commands/hooks-routing-commands.js.map +1 -1
  32. package/dist/src/commands/hooks-workers.js +8 -8
  33. package/dist/src/commands/hooks-workers.js.map +1 -1
  34. package/dist/src/commands/hooks.d.ts.map +1 -1
  35. package/dist/src/commands/hooks.js +96 -54
  36. package/dist/src/commands/hooks.js.map +1 -1
  37. package/dist/src/commands/init.d.ts.map +1 -1
  38. package/dist/src/commands/init.js +80 -7
  39. package/dist/src/commands/init.js.map +1 -1
  40. package/dist/src/commands/mcp.d.ts.map +1 -1
  41. package/dist/src/commands/mcp.js +78 -2
  42. package/dist/src/commands/mcp.js.map +1 -1
  43. package/dist/src/commands/memory-list.d.ts.map +1 -1
  44. package/dist/src/commands/memory-list.js +79 -36
  45. package/dist/src/commands/memory-list.js.map +1 -1
  46. package/dist/src/commands/org.d.ts.map +1 -1
  47. package/dist/src/commands/org.js +114 -1
  48. package/dist/src/commands/org.js.map +1 -1
  49. package/dist/src/commands/performance.js +1 -1
  50. package/dist/src/commands/performance.js.map +1 -1
  51. package/dist/src/commands/swarm.d.ts.map +1 -1
  52. package/dist/src/commands/swarm.js +144 -98
  53. package/dist/src/commands/swarm.js.map +1 -1
  54. package/dist/src/init/claudemd-generator.js +1 -1
  55. package/dist/src/init/executor.d.ts.map +1 -1
  56. package/dist/src/init/executor.js +13 -3
  57. package/dist/src/init/executor.js.map +1 -1
  58. package/dist/src/init/kimi-generator.d.ts +3 -2
  59. package/dist/src/init/kimi-generator.d.ts.map +1 -1
  60. package/dist/src/init/kimi-generator.js +45 -13
  61. package/dist/src/init/kimi-generator.js.map +1 -1
  62. package/dist/src/init/statusline-generator.d.ts +1 -1
  63. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  64. package/dist/src/init/statusline-generator.js +48 -46
  65. package/dist/src/init/statusline-generator.js.map +1 -1
  66. package/dist/src/init/types.d.ts +1 -1
  67. package/dist/src/init/types.d.ts.map +1 -1
  68. package/dist/src/init/types.js +5 -1
  69. package/dist/src/init/types.js.map +1 -1
  70. package/dist/src/mcp-server.d.ts +6 -0
  71. package/dist/src/mcp-server.d.ts.map +1 -1
  72. package/dist/src/mcp-server.js +47 -22
  73. package/dist/src/mcp-server.js.map +1 -1
  74. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  75. package/dist/src/mcp-tools/hive-mind-tools.js +13 -11
  76. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  77. package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
  78. package/dist/src/mcp-tools/hooks-intelligence.js +97 -40
  79. package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
  80. package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
  81. package/dist/src/mcp-tools/hooks-routing.js +406 -205
  82. package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
  83. package/dist/src/mcp-tools/monograph/impact-tools.d.ts.map +1 -1
  84. package/dist/src/mcp-tools/monograph/impact-tools.js +109 -44
  85. package/dist/src/mcp-tools/monograph/impact-tools.js.map +1 -1
  86. package/dist/src/mcp-tools/monograph/query-tools.d.ts.map +1 -1
  87. package/dist/src/mcp-tools/monograph/query-tools.js +48 -18
  88. package/dist/src/mcp-tools/monograph/query-tools.js.map +1 -1
  89. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  90. package/dist/src/mcp-tools/system-tools.js +100 -38
  91. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  92. package/dist/src/memory/embedding-operations.d.ts +4 -0
  93. package/dist/src/memory/embedding-operations.d.ts.map +1 -1
  94. package/dist/src/memory/embedding-operations.js +125 -32
  95. package/dist/src/memory/embedding-operations.js.map +1 -1
  96. package/dist/src/memory/hnsw-operations.d.ts +1 -1
  97. package/dist/src/memory/hnsw-operations.js +1 -1
  98. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  99. package/dist/src/memory/memory-bridge.js +172 -69
  100. package/dist/src/memory/memory-bridge.js.map +1 -1
  101. package/dist/src/memory/memory-read.d.ts +1 -1
  102. package/dist/src/memory/memory-read.js +2 -2
  103. package/dist/src/memory/memory-read.js.map +1 -1
  104. package/dist/src/orgrt/checkpoint-ops.d.ts +11 -1
  105. package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -1
  106. package/dist/src/orgrt/checkpoint-ops.js +15 -1
  107. package/dist/src/orgrt/checkpoint-ops.js.map +1 -1
  108. package/dist/src/orgrt/checkpoint.js +1 -1
  109. package/dist/src/orgrt/checkpoint.js.map +1 -1
  110. package/dist/src/orgrt/daemon.d.ts +11 -3
  111. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  112. package/dist/src/orgrt/daemon.js +317 -93
  113. package/dist/src/orgrt/daemon.js.map +1 -1
  114. package/dist/src/orgrt/decisions.d.ts +13 -0
  115. package/dist/src/orgrt/decisions.d.ts.map +1 -1
  116. package/dist/src/orgrt/decisions.js +95 -0
  117. package/dist/src/orgrt/decisions.js.map +1 -1
  118. package/dist/src/orgrt/remote.d.ts.map +1 -1
  119. package/dist/src/orgrt/remote.js +12 -6
  120. package/dist/src/orgrt/remote.js.map +1 -1
  121. package/dist/src/orgrt/server.d.ts.map +1 -1
  122. package/dist/src/orgrt/server.js +71 -14
  123. package/dist/src/orgrt/server.js.map +1 -1
  124. package/dist/src/orgrt/session.d.ts +27 -1
  125. package/dist/src/orgrt/session.d.ts.map +1 -1
  126. package/dist/src/orgrt/session.js +42 -3
  127. package/dist/src/orgrt/session.js.map +1 -1
  128. package/dist/src/orgrt/task-dag.d.ts +11 -1
  129. package/dist/src/orgrt/task-dag.d.ts.map +1 -1
  130. package/dist/src/orgrt/task-dag.js +93 -2
  131. package/dist/src/orgrt/task-dag.js.map +1 -1
  132. package/dist/src/orgrt/templates.d.ts.map +1 -1
  133. package/dist/src/orgrt/templates.js +24 -0
  134. package/dist/src/orgrt/templates.js.map +1 -1
  135. package/dist/src/orgrt/types.d.ts +70 -1
  136. package/dist/src/orgrt/types.d.ts.map +1 -1
  137. package/dist/src/orgrt/types.js +19 -0
  138. package/dist/src/orgrt/types.js.map +1 -1
  139. package/dist/src/orgrt/vercel-providers.d.ts.map +1 -1
  140. package/dist/src/orgrt/vercel-providers.js +9 -4
  141. package/dist/src/orgrt/vercel-providers.js.map +1 -1
  142. package/dist/src/orgrt/vercel-runner.d.ts +0 -23
  143. package/dist/src/orgrt/vercel-runner.d.ts.map +1 -1
  144. package/dist/src/orgrt/vercel-runner.js +26 -1
  145. package/dist/src/orgrt/vercel-runner.js.map +1 -1
  146. package/dist/src/types.d.ts +1 -1
  147. package/dist/src/types.d.ts.map +1 -1
  148. package/dist/src/ui/server.mjs +2647 -838
  149. package/dist/tsconfig.tsbuildinfo +1 -1
  150. package/package.json +7 -7
  151. package/.claude/commands/mastermind/approvev1.md +0 -94
  152. package/.claude/commands/mastermind/architect.md +0 -52
  153. package/.claude/commands/mastermind/autodev.md +0 -28
  154. package/.claude/commands/mastermind/build.md +0 -23
  155. package/.claude/commands/mastermind/finish.md +0 -17
  156. package/.claude/commands/mastermind/runorgv1.md +0 -159
  157. package/.claude/commands/mastermind/taskdev.md +0 -23
  158. package/.claude/commands/mastermind/tdd.md +0 -19
  159. package/.claude/commands/mastermind/verify.md +0 -19
  160. package/.claude/skills/mastermind-approvev1/SKILL.md +0 -191
  161. package/.claude/skills/mastermind-architect/SKILL.md +0 -862
  162. package/.claude/skills/mastermind-autodev/SKILL.md +0 -360
  163. package/.claude/skills/mastermind-build/SKILL.md +0 -169
  164. package/.claude/skills/mastermind-companies/SKILL.md +0 -256
  165. package/.claude/skills/mastermind-content/SKILL.md +0 -197
  166. package/.claude/skills/mastermind-costs/SKILL.md +0 -151
  167. package/.claude/skills/mastermind-finance/SKILL.md +0 -166
  168. package/.claude/skills/mastermind-finish/SKILL.md +0 -251
  169. package/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -167
  170. package/.claude/skills/mastermind-instance-settings/SKILL.md +0 -315
  171. package/.claude/skills/mastermind-marketing/SKILL.md +0 -228
  172. package/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -181
  173. package/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -158
  174. package/.claude/skills/mastermind-ops/SKILL.md +0 -168
  175. package/.claude/skills/mastermind-org-chart/SKILL.md +0 -209
  176. package/.claude/skills/mastermind-project-detail/SKILL.md +0 -249
  177. package/.claude/skills/mastermind-project-workspace/SKILL.md +0 -244
  178. package/.claude/skills/mastermind-projects/SKILL.md +0 -167
  179. package/.claude/skills/mastermind-runorgv1/SKILL.md +0 -731
  180. package/.claude/skills/mastermind-sales/SKILL.md +0 -170
  181. package/.claude/skills/mastermind-taskdev/SKILL.md +0 -377
  182. package/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -60
  183. package/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -144
  184. package/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -114
  185. package/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -80
  186. package/.claude/skills/mastermind-tdd/SKILL.md +0 -424
  187. package/.claude/skills/mastermind-verify/SKILL.md +0 -196
  188. package/.claude/skills/mastermind-wiki/SKILL.md +0 -314
  189. package/.claude/skills/monolean-review/SKILL.md +0 -57
@@ -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 = {};
@@ -357,12 +367,15 @@ const initCommand = {
357
367
  swarmId: result.swarmId,
358
368
  topology: result.topology,
359
369
  maxAgents: result.config.maxAgents,
360
- status: 'running',
370
+ // P0-4: no agents are actually running yet at init time — the
371
+ // printed message says so; the persisted state must agree, or
372
+ // `swarm status --format json` contradicts the human-readable output.
373
+ status: 'configured',
361
374
  agents: [],
362
375
  tasks: [],
363
376
  config: { strategy: ctx.flags.strategy || 'development', v1Mode },
364
377
  createdAt: result.initializedAt || new Date().toISOString(),
365
- updatedAt: new Date().toISOString()
378
+ updatedAt: new Date().toISOString(),
366
379
  };
367
380
  writeJsonFileAtomic(stateFile, store);
368
381
  }
@@ -384,7 +397,7 @@ const initCommand = {
384
397
  }
385
398
  return { success: false, exitCode: 1 };
386
399
  }
387
- }
400
+ },
388
401
  };
389
402
  // Start swarm execution
390
403
  const startCommand = {
@@ -396,32 +409,38 @@ const startCommand = {
396
409
  short: 'o',
397
410
  description: 'Swarm objective/task',
398
411
  type: 'string',
399
- required: true
412
+ required: true,
400
413
  },
401
414
  {
402
415
  name: 'strategy',
403
416
  short: 's',
404
417
  description: 'Execution strategy',
405
418
  type: 'string',
406
- choices: STRATEGIES.map(s => s.value)
419
+ choices: STRATEGIES.map((s) => s.value),
407
420
  },
408
421
  {
409
422
  name: 'parallel',
410
423
  short: 'p',
411
424
  description: 'Enable parallel execution',
412
425
  type: 'boolean',
413
- default: true
426
+ default: true,
414
427
  },
415
428
  {
416
429
  name: 'monitor',
417
430
  description: 'Enable real-time monitoring',
418
431
  type: 'boolean',
419
- default: true
420
- }
432
+ default: true,
433
+ },
421
434
  ],
422
435
  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' }
436
+ {
437
+ command: 'monomind swarm start -o "Build REST API" -s development',
438
+ description: 'Start development swarm',
439
+ },
440
+ {
441
+ command: 'monomind swarm start -o "Analyze codebase" --parallel',
442
+ description: 'Parallel analysis',
443
+ },
425
444
  ],
426
445
  action: async (ctx) => {
427
446
  const objective = ctx.args[0] || ctx.flags.objective;
@@ -435,7 +454,7 @@ const startCommand = {
435
454
  strategy = await select({
436
455
  message: 'Select execution strategy:',
437
456
  options: STRATEGIES,
438
- default: 'development'
457
+ default: 'development',
439
458
  });
440
459
  }
441
460
  strategy = strategy || 'development';
@@ -450,15 +469,15 @@ const startCommand = {
450
469
  { key: 'role', header: 'Role', width: 20 },
451
470
  { key: 'type', header: 'Type', width: 15 },
452
471
  { key: 'count', header: 'Count', width: 8, align: 'right' },
453
- { key: 'purpose', header: 'Purpose', width: 30 }
472
+ { key: 'purpose', header: 'Purpose', width: 30 },
454
473
  ],
455
- data: agentPlan
474
+ data: agentPlan,
456
475
  });
457
476
  // Confirm execution
458
477
  if (ctx.interactive) {
459
478
  const confirmed = await confirm({
460
479
  message: `Deploy ${agentPlan.reduce((sum, a) => sum + a.count, 0)} agents?`,
461
- default: true
480
+ default: true,
462
481
  });
463
482
  if (!confirmed) {
464
483
  output.printInfo('Swarm execution cancelled');
@@ -469,7 +488,10 @@ const startCommand = {
469
488
  const swarmId = `swarm-${Date.now().toString(36)}`;
470
489
  const totalAgents = agentPlan.reduce((sum, a) => sum + a.count, 0);
471
490
  output.writeln();
472
- const spinner = output.createSpinner({ text: 'Initializing swarm via MCP...', spinner: 'dots' });
491
+ const spinner = output.createSpinner({
492
+ text: 'Initializing swarm via MCP...',
493
+ spinner: 'dots',
494
+ });
473
495
  spinner.start();
474
496
  let resolvedSwarmId = swarmId;
475
497
  try {
@@ -503,7 +525,9 @@ const startCommand = {
503
525
  try {
504
526
  startStore = JSON.parse(fs.readFileSync(stateFile2, 'utf-8'));
505
527
  }
506
- catch { /* use default */ }
528
+ catch {
529
+ /* use default */
530
+ }
507
531
  }
508
532
  if (!startStore.swarms || typeof startStore.swarms !== 'object')
509
533
  startStore.swarms = {};
@@ -511,21 +535,24 @@ const startCommand = {
511
535
  swarmId: resolvedSwarmId,
512
536
  topology: 'hierarchical',
513
537
  maxAgents: totalAgents,
514
- status: 'running',
538
+ // P0-4: same fix as swarm init — persisted status must match the
539
+ // "No agents are running" message below, not claim 'running'.
540
+ status: 'configured',
515
541
  agents: [],
516
542
  tasks: [],
517
543
  config: { strategy, objective, agentPlan, parallel: ctx.flags.parallel ?? true },
518
544
  createdAt: new Date().toISOString(),
519
- updatedAt: new Date().toISOString()
545
+ updatedAt: new Date().toISOString(),
520
546
  };
521
547
  writeJsonFileAtomic(stateFile2, startStore);
522
548
  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.'));
549
+ 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
550
  output.writeln(output.dim(` Monitor: monomind swarm status ${resolvedSwarmId}`));
527
- return { success: true, data: { swarmId: resolvedSwarmId, objective, strategy, agents: totalAgents } };
528
- }
551
+ return {
552
+ success: true,
553
+ data: { swarmId: resolvedSwarmId, objective, strategy, agents: totalAgents },
554
+ };
555
+ },
529
556
  };
530
557
  // Swarm status
531
558
  const statusCommand = {
@@ -560,14 +587,14 @@ const statusCommand = {
560
587
  output.printTable({
561
588
  columns: [
562
589
  { key: 'status', header: 'Status', width: 12 },
563
- { key: 'count', header: 'Count', width: 10, align: 'right' }
590
+ { key: 'count', header: 'Count', width: 10, align: 'right' },
564
591
  ],
565
592
  data: [
566
593
  { status: output.success('Active'), count: status.agents.active },
567
594
  { status: output.warning('Idle'), count: status.agents.idle },
568
595
  { status: output.dim('Completed'), count: status.agents.completed },
569
- { status: 'Total', count: status.agents.total }
570
- ]
596
+ { status: 'Total', count: status.agents.total },
597
+ ],
571
598
  });
572
599
  output.writeln();
573
600
  // Task status
@@ -575,14 +602,14 @@ const statusCommand = {
575
602
  output.printTable({
576
603
  columns: [
577
604
  { key: 'status', header: 'Status', width: 12 },
578
- { key: 'count', header: 'Count', width: 10, align: 'right' }
605
+ { key: 'count', header: 'Count', width: 10, align: 'right' },
579
606
  ],
580
607
  data: [
581
608
  { status: output.success('Completed'), count: status.tasks.completed },
582
609
  { status: output.info('In Progress'), count: status.tasks.inProgress },
583
610
  { status: output.dim('Pending'), count: status.tasks.pending },
584
- { status: 'Total', count: status.tasks.total }
585
- ]
611
+ { status: 'Total', count: status.tasks.total },
612
+ ],
586
613
  });
587
614
  output.writeln();
588
615
  // Metrics
@@ -591,7 +618,7 @@ const statusCommand = {
591
618
  `Tokens Used: ${status.metrics.tokensUsed.toLocaleString()}`,
592
619
  `Avg Response Time: ${status.metrics.avgResponseTime}`,
593
620
  `Success Rate: ${status.metrics.successRate}`,
594
- `Elapsed Time: ${status.metrics.elapsedTime}`
621
+ `Elapsed Time: ${status.metrics.elapsedTime}`,
595
622
  ]);
596
623
  output.writeln();
597
624
  // Coordination stats
@@ -599,10 +626,10 @@ const statusCommand = {
599
626
  output.printList([
600
627
  `Consensus Rounds: ${status.coordination.consensusRounds}`,
601
628
  `Messages Sent: ${status.coordination.messagesSent}`,
602
- `Conflicts Resolved: ${status.coordination.conflictsResolved}`
629
+ `Conflicts Resolved: ${status.coordination.conflictsResolved}`,
603
630
  ]);
604
631
  return { success: true, data: status };
605
- }
632
+ },
606
633
  };
607
634
  // Stop swarm
608
635
  const stopCommand = {
@@ -614,14 +641,14 @@ const stopCommand = {
614
641
  short: 'f',
615
642
  description: 'Force immediate stop',
616
643
  type: 'boolean',
617
- default: false
644
+ default: false,
618
645
  },
619
646
  {
620
647
  name: 'save-state',
621
648
  description: 'Save current state for resume',
622
649
  type: 'boolean',
623
- default: true
624
- }
650
+ default: true,
651
+ },
625
652
  ],
626
653
  action: async (ctx) => {
627
654
  const swarmId = ctx.args[0];
@@ -633,7 +660,7 @@ const stopCommand = {
633
660
  if (ctx.interactive && !force) {
634
661
  const confirmed = await confirm({
635
662
  message: `Stop swarm ${swarmId}? Progress will be saved.`,
636
- default: false
663
+ default: false,
637
664
  });
638
665
  if (!confirmed) {
639
666
  output.printInfo('Operation cancelled');
@@ -681,7 +708,7 @@ const stopCommand = {
681
708
  }
682
709
  output.printSuccess(`Swarm ${swarmId} stopped`);
683
710
  return { success: true, data: { swarmId, stopped: true, force } };
684
- }
711
+ },
685
712
  };
686
713
  // Scale swarm
687
714
  const scaleCommand = {
@@ -693,14 +720,14 @@ const scaleCommand = {
693
720
  short: 'a',
694
721
  description: 'Target number of agents',
695
722
  type: 'number',
696
- required: true
723
+ required: true,
697
724
  },
698
725
  {
699
726
  name: 'type',
700
727
  short: 't',
701
728
  description: 'Agent type to scale',
702
- type: 'string'
703
- }
729
+ type: 'string',
730
+ },
704
731
  ],
705
732
  action: async (ctx) => {
706
733
  const swarmId = ctx.args[0];
@@ -740,7 +767,7 @@ const scaleCommand = {
740
767
  output.printError(`Scale error: ${error instanceof MCPClientError ? error.message : String(error)}`);
741
768
  return { success: false, exitCode: 1 };
742
769
  }
743
- }
770
+ },
744
771
  };
745
772
  // Coordinate command (v1 specific)
746
773
  const coordinateCommand = {
@@ -751,13 +778,13 @@ const coordinateCommand = {
751
778
  name: 'agents',
752
779
  description: 'Number of agents',
753
780
  type: 'number',
754
- default: 15
781
+ default: 15,
755
782
  },
756
783
  {
757
784
  name: 'domains',
758
785
  description: 'Domains to activate',
759
- type: 'array'
760
- }
786
+ type: 'array',
787
+ },
761
788
  ],
762
789
  action: async (ctx) => {
763
790
  const agentCount = ctx.flags.agents || 15;
@@ -780,22 +807,27 @@ const coordinateCommand = {
780
807
  { id: 12, role: 'MCP Specialist', domain: 'Integration', status: 'active' },
781
808
  { id: 13, role: 'Project Coordinator', domain: 'Management', status: 'active' },
782
809
  { id: 14, role: 'Documentation Lead', domain: 'Management', status: 'standby' },
783
- { id: 15, role: 'DevOps Engineer', domain: 'Management', status: 'standby' }
810
+ { id: 15, role: 'DevOps Engineer', domain: 'Management', status: 'standby' },
784
811
  ].slice(0, agentCount);
785
812
  output.printTable({
786
813
  columns: [
787
814
  { key: 'id', header: '#', width: 3, align: 'right' },
788
815
  { key: 'role', header: 'Role', width: 22 },
789
816
  { key: 'domain', header: 'Domain', width: 15 },
790
- { key: 'status', header: 'Status', width: 10, format: (v) => {
817
+ {
818
+ key: 'status',
819
+ header: 'Status',
820
+ width: 10,
821
+ format: (v) => {
791
822
  if (v === 'primary')
792
823
  return output.highlight(String(v));
793
824
  if (v === 'active')
794
825
  return output.success(String(v));
795
826
  return output.dim(String(v));
796
- } }
827
+ },
828
+ },
797
829
  ],
798
- data: v1Agents
830
+ data: v1Agents,
799
831
  });
800
832
  // Actually initialize via MCP instead of just displaying (#1423)
801
833
  output.writeln();
@@ -805,27 +837,36 @@ const coordinateCommand = {
805
837
  maxAgents: agentCount,
806
838
  strategy: 'specialized',
807
839
  });
808
- output.printSuccess(`Swarm coordination initialized with ${agentCount} agent slots via MCP`);
840
+ output.printSuccess(`Swarm coordination config written (${agentCount} agent slots reserved) via MCP. No agents are running.`);
809
841
  }
810
842
  catch {
811
- output.printWarning('MCP unavailable — showing agent plan only (no active coordination)');
843
+ output.printWarning('MCP unavailable — showing agent plan only (no swarm state written)');
812
844
  }
813
845
  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.'));
846
+ output.writeln(output.dim('Use Claude Code Task tool or hive-mind spawn --claude to drive actual agent execution.'));
816
847
  return { success: true, data: { agents: v1Agents, count: agentCount } };
817
- }
848
+ },
818
849
  };
819
850
  // Main swarm command
820
851
  export const swarmCommand = {
821
852
  name: 'swarm',
822
853
  description: 'Swarm coordination commands',
823
- subcommands: [initCommand, startCommand, statusCommand, stopCommand, scaleCommand, coordinateCommand],
854
+ subcommands: [
855
+ initCommand,
856
+ startCommand,
857
+ statusCommand,
858
+ stopCommand,
859
+ scaleCommand,
860
+ coordinateCommand,
861
+ ],
824
862
  options: [],
825
863
  examples: [
826
864
  { 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' }
865
+ {
866
+ command: 'monomind swarm start -o "Build API" -s development',
867
+ description: 'Start development swarm',
868
+ },
869
+ { command: 'monomind swarm coordinate --agents 15', description: 'v1 coordination' },
829
870
  ],
830
871
  action: async (ctx) => {
831
872
  output.writeln();
@@ -840,65 +881,70 @@ export const swarmCommand = {
840
881
  `${output.highlight('status')} - Show swarm status`,
841
882
  `${output.highlight('stop')} - Stop swarm execution`,
842
883
  `${output.highlight('scale')} - Scale swarm agent count`,
843
- `${output.highlight('coordinate')} - 15-agent coordination`
884
+ `${output.highlight('coordinate')} - 15-agent coordination`,
844
885
  ]);
845
886
  return { success: true };
846
- }
887
+ },
847
888
  };
848
889
  // Helper function
849
890
  function getAgentPlan(strategy) {
850
891
  const plans = {
851
892
  specialized: [
852
- { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Central orchestration (anti-drift)' },
893
+ {
894
+ role: 'Coordinator',
895
+ type: 'coordinator',
896
+ count: 1,
897
+ purpose: 'Central orchestration (anti-drift)',
898
+ },
853
899
  { role: 'Researcher', type: 'researcher', count: 1, purpose: 'Requirements analysis' },
854
900
  { role: 'Architect', type: 'architect', count: 1, purpose: 'System design' },
855
901
  { role: 'Coder', type: 'coder', count: 2, purpose: 'Implementation' },
856
902
  { role: 'Tester', type: 'tester', count: 1, purpose: 'Quality assurance' },
857
- { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' }
903
+ { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' },
858
904
  ],
859
905
  balanced: [
860
906
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Orchestrate workflow' },
861
907
  { role: 'Worker', type: 'coder', count: 4, purpose: 'General implementation' },
862
- { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' }
908
+ { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' },
863
909
  ],
864
910
  adaptive: [
865
911
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Dynamic orchestration' },
866
912
  { role: 'Scout', type: 'researcher', count: 1, purpose: 'Task analysis' },
867
- { role: 'Worker', type: 'coder', count: 3, purpose: 'Adaptive execution' }
913
+ { role: 'Worker', type: 'coder', count: 3, purpose: 'Adaptive execution' },
868
914
  ],
869
915
  development: [
870
916
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Orchestrate workflow' },
871
917
  { role: 'Architect', type: 'architect', count: 1, purpose: 'System design' },
872
918
  { role: 'Coder', type: 'coder', count: 3, purpose: 'Implementation' },
873
919
  { role: 'Tester', type: 'tester', count: 2, purpose: 'Quality assurance' },
874
- { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' }
920
+ { role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' },
875
921
  ],
876
922
  research: [
877
923
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Research coordination' },
878
924
  { role: 'Researcher', type: 'researcher', count: 4, purpose: 'Data gathering' },
879
- { role: 'Analyst', type: 'analyst', count: 2, purpose: 'Analysis and synthesis' }
925
+ { role: 'Analyst', type: 'analyst', count: 2, purpose: 'Analysis and synthesis' },
880
926
  ],
881
927
  testing: [
882
928
  { role: 'Test Lead', type: 'tester', count: 1, purpose: 'Test strategy' },
883
929
  { role: 'Unit Tester', type: 'tester', count: 2, purpose: 'Unit tests' },
884
930
  { role: 'Integration Tester', type: 'tester', count: 2, purpose: 'Integration tests' },
885
- { role: 'QA Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' }
931
+ { role: 'QA Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' },
886
932
  ],
887
933
  optimization: [
888
934
  { role: 'Performance Lead', type: 'optimizer', count: 1, purpose: 'Performance strategy' },
889
935
  { role: 'Profiler', type: 'analyst', count: 2, purpose: 'Profiling' },
890
- { role: 'Optimizer', type: 'coder', count: 2, purpose: 'Optimization' }
936
+ { role: 'Optimizer', type: 'coder', count: 2, purpose: 'Optimization' },
891
937
  ],
892
938
  maintenance: [
893
939
  { role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Maintenance planning' },
894
940
  { role: 'Refactorer', type: 'coder', count: 2, purpose: 'Code cleanup' },
895
- { role: 'Documenter', type: 'researcher', count: 1, purpose: 'Documentation' }
941
+ { role: 'Documenter', type: 'researcher', count: 1, purpose: 'Documentation' },
896
942
  ],
897
943
  analysis: [
898
944
  { role: 'Analyst Lead', type: 'analyst', count: 1, purpose: 'Analysis coordination' },
899
945
  { role: 'Code Analyst', type: 'analyst', count: 2, purpose: 'Code analysis' },
900
- { role: 'Security Analyst', type: 'reviewer', count: 1, purpose: 'Security review' }
901
- ]
946
+ { role: 'Security Analyst', type: 'reviewer', count: 1, purpose: 'Security review' },
947
+ ],
902
948
  };
903
949
  return plans[strategy] || plans.development;
904
950
  }