snow-flow 1.1.76 → 1.1.78

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 (234) hide show
  1. package/.claude-flow/queen/queen-memory.db +0 -0
  2. package/CLAUDE.md +34 -5
  3. package/README.md +256 -384
  4. package/dist/agents/base-agent.d.ts +92 -0
  5. package/dist/agents/base-agent.d.ts.map +1 -0
  6. package/dist/agents/base-agent.js +228 -0
  7. package/dist/agents/base-agent.js.map +1 -0
  8. package/dist/agents/coordinator.d.ts +200 -0
  9. package/dist/agents/coordinator.d.ts.map +1 -0
  10. package/dist/agents/coordinator.js +775 -0
  11. package/dist/agents/coordinator.js.map +1 -0
  12. package/dist/agents/flow-builder-agent.d.ts +18 -0
  13. package/dist/agents/flow-builder-agent.d.ts.map +1 -0
  14. package/dist/agents/flow-builder-agent.js +536 -0
  15. package/dist/agents/flow-builder-agent.js.map +1 -0
  16. package/dist/agents/index.d.ts +18 -0
  17. package/dist/agents/index.d.ts.map +1 -0
  18. package/dist/agents/index.js +61 -0
  19. package/dist/agents/index.js.map +1 -0
  20. package/dist/agents/queen-agent-example.d.ts +23 -0
  21. package/dist/agents/queen-agent-example.d.ts.map +1 -0
  22. package/dist/agents/queen-agent-example.js +241 -0
  23. package/dist/agents/queen-agent-example.js.map +1 -0
  24. package/dist/agents/queen-agent.d.ts +180 -0
  25. package/dist/agents/queen-agent.d.ts.map +1 -0
  26. package/dist/agents/queen-agent.js +909 -0
  27. package/dist/agents/queen-agent.js.map +1 -0
  28. package/dist/agents/queen-agent.test.d.ts +6 -0
  29. package/dist/agents/queen-agent.test.d.ts.map +1 -0
  30. package/dist/agents/queen-agent.test.js.map +1 -0
  31. package/dist/agents/script-writer-agent.d.ts +22 -0
  32. package/dist/agents/script-writer-agent.d.ts.map +1 -0
  33. package/dist/agents/script-writer-agent.js +695 -0
  34. package/dist/agents/script-writer-agent.js.map +1 -0
  35. package/dist/agents/security-agent.d.ts +23 -0
  36. package/dist/agents/security-agent.d.ts.map +1 -0
  37. package/dist/agents/security-agent.js +619 -0
  38. package/dist/agents/security-agent.js.map +1 -0
  39. package/dist/agents/test-agent.d.ts +26 -0
  40. package/dist/agents/test-agent.d.ts.map +1 -0
  41. package/dist/agents/test-agent.js +735 -0
  42. package/dist/agents/test-agent.js.map +1 -0
  43. package/dist/agents/test-agents.d.ts +7 -0
  44. package/dist/agents/test-agents.d.ts.map +1 -0
  45. package/dist/agents/test-agents.js +65 -0
  46. package/dist/agents/test-agents.js.map +1 -0
  47. package/dist/agents/widget-creator-agent.d.ts +18 -0
  48. package/dist/agents/widget-creator-agent.d.ts.map +1 -0
  49. package/dist/agents/widget-creator-agent.js +440 -0
  50. package/dist/agents/widget-creator-agent.js.map +1 -0
  51. package/dist/cli/snow-flow-cli-integration.d.ts +30 -0
  52. package/dist/cli/snow-flow-cli-integration.d.ts.map +1 -0
  53. package/dist/cli/snow-flow-cli-integration.js +385 -0
  54. package/dist/cli/snow-flow-cli-integration.js.map +1 -0
  55. package/dist/cli.js +466 -150
  56. package/dist/cli.js.map +1 -1
  57. package/dist/config/snow-flow-config.d.ts +1454 -0
  58. package/dist/config/snow-flow-config.d.ts.map +1 -0
  59. package/dist/config/snow-flow-config.js +403 -0
  60. package/dist/config/snow-flow-config.js.map +1 -0
  61. package/dist/health/system-health.d.ts +123 -0
  62. package/dist/health/system-health.d.ts.map +1 -0
  63. package/dist/health/system-health.js +580 -0
  64. package/dist/health/system-health.js.map +1 -0
  65. package/dist/index.d.ts +12 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +19 -3
  68. package/dist/index.js.map +1 -1
  69. package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts +58 -0
  70. package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts.map +1 -0
  71. package/dist/mcp/servicenow-deployment-mcp-refactored.js +651 -0
  72. package/dist/mcp/servicenow-deployment-mcp-refactored.js.map +1 -0
  73. package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts +43 -0
  74. package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts.map +1 -0
  75. package/dist/mcp/servicenow-intelligent-mcp-refactored.js +576 -0
  76. package/dist/mcp/servicenow-intelligent-mcp-refactored.js.map +1 -0
  77. package/dist/mcp/servicenow-intelligent-mcp.d.ts +102 -1
  78. package/dist/mcp/servicenow-intelligent-mcp.d.ts.map +1 -1
  79. package/dist/mcp/servicenow-intelligent-mcp.js +2 -0
  80. package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -1
  81. package/dist/mcp/shared/agent-context-provider.d.ts +77 -0
  82. package/dist/mcp/shared/agent-context-provider.d.ts.map +1 -0
  83. package/dist/mcp/shared/agent-context-provider.js +292 -0
  84. package/dist/mcp/shared/agent-context-provider.js.map +1 -0
  85. package/dist/mcp/shared/base-mcp-server.d.ts +97 -0
  86. package/dist/mcp/shared/base-mcp-server.d.ts.map +1 -0
  87. package/dist/mcp/shared/base-mcp-server.js +216 -0
  88. package/dist/mcp/shared/base-mcp-server.js.map +1 -0
  89. package/dist/mcp/shared/mcp-memory-manager.d.ts +87 -0
  90. package/dist/mcp/shared/mcp-memory-manager.d.ts.map +1 -0
  91. package/dist/mcp/shared/mcp-memory-manager.js +423 -0
  92. package/dist/mcp/shared/mcp-memory-manager.js.map +1 -0
  93. package/dist/memory/index.d.ts +9 -0
  94. package/dist/memory/index.d.ts.map +1 -0
  95. package/dist/memory/index.js +20 -0
  96. package/dist/memory/index.js.map +1 -0
  97. package/dist/memory/mcp-integration-example.d.ts +6 -0
  98. package/dist/memory/mcp-integration-example.d.ts.map +1 -0
  99. package/dist/memory/mcp-integration-example.js +282 -0
  100. package/dist/memory/mcp-integration-example.js.map +1 -0
  101. package/dist/memory/memory-client.d.ts +184 -0
  102. package/dist/memory/memory-client.d.ts.map +1 -0
  103. package/dist/memory/memory-client.js +325 -0
  104. package/dist/memory/memory-client.js.map +1 -0
  105. package/dist/memory/memory-operations.d.ts +170 -0
  106. package/dist/memory/memory-operations.d.ts.map +1 -0
  107. package/dist/memory/memory-operations.js +639 -0
  108. package/dist/memory/memory-operations.js.map +1 -0
  109. package/dist/memory/memory-system.d.ts +118 -0
  110. package/dist/memory/memory-system.d.ts.map +1 -0
  111. package/dist/memory/memory-system.js +477 -0
  112. package/dist/memory/memory-system.js.map +1 -0
  113. package/dist/memory/memory-test.d.ts +6 -0
  114. package/dist/memory/memory-test.d.ts.map +1 -0
  115. package/dist/memory/memory-test.js +162 -0
  116. package/dist/memory/memory-test.js.map +1 -0
  117. package/dist/memory/swarm-memory.d.ts +135 -0
  118. package/dist/memory/swarm-memory.d.ts.map +1 -0
  119. package/dist/memory/swarm-memory.js +378 -0
  120. package/dist/memory/swarm-memory.js.map +1 -0
  121. package/dist/monitoring/performance-tracker.d.ts +157 -0
  122. package/dist/monitoring/performance-tracker.d.ts.map +1 -0
  123. package/dist/monitoring/performance-tracker.js +571 -0
  124. package/dist/monitoring/performance-tracker.js.map +1 -0
  125. package/dist/queen/agent-factory.d.ts +3 -0
  126. package/dist/queen/agent-factory.d.ts.map +1 -1
  127. package/dist/queen/agent-factory.js +52 -0
  128. package/dist/queen/agent-factory.js.map +1 -1
  129. package/dist/queen/queen-memory.d.ts +8 -2
  130. package/dist/queen/queen-memory.d.ts.map +1 -1
  131. package/dist/queen/queen-memory.js +46 -4
  132. package/dist/queen/queen-memory.js.map +1 -1
  133. package/dist/snow-flow-system.d.ts +132 -0
  134. package/dist/snow-flow-system.d.ts.map +1 -0
  135. package/dist/snow-flow-system.js +396 -0
  136. package/dist/snow-flow-system.js.map +1 -0
  137. package/dist/types/todo.types.d.ts +61 -0
  138. package/dist/types/todo.types.d.ts.map +1 -0
  139. package/dist/types/todo.types.js +7 -0
  140. package/dist/types/todo.types.js.map +1 -0
  141. package/dist/utils/error-recovery.d.ts +101 -0
  142. package/dist/utils/error-recovery.d.ts.map +1 -0
  143. package/dist/utils/error-recovery.js +548 -0
  144. package/dist/utils/error-recovery.js.map +1 -0
  145. package/dist/version.d.ts +1 -1
  146. package/dist/version.js +1 -1
  147. package/package.json +7 -2
  148. package/deploy.sh +0 -366
  149. package/docker/base/Dockerfile.base +0 -45
  150. package/docker/generate-services.js +0 -244
  151. package/docker/nginx/Dockerfile +0 -71
  152. package/docker/nginx/consul-template.hcl +0 -64
  153. package/docker/nginx/healthcheck.sh +0 -178
  154. package/docker/nginx/nginx.conf +0 -210
  155. package/docker/nginx/supervisord.conf +0 -57
  156. package/docker/nginx/templates/upstreams.conf.tpl +0 -48
  157. package/docker/services/automation-mcp/Dockerfile +0 -32
  158. package/docker/services/automation-mcp/config/service.json +0 -28
  159. package/docker/services/automation-mcp/entrypoint.js +0 -51
  160. package/docker/services/deployment-mcp/Dockerfile +0 -32
  161. package/docker/services/deployment-mcp/entrypoint.js +0 -51
  162. package/docker/services/flow-composer-mcp/Dockerfile +0 -32
  163. package/docker/services/flow-composer-mcp/config/service.json +0 -28
  164. package/docker/services/flow-composer-mcp/entrypoint.js +0 -51
  165. package/docker/services/graph-memory-mcp/Dockerfile +0 -32
  166. package/docker/services/graph-memory-mcp/config/service.json +0 -28
  167. package/docker/services/graph-memory-mcp/entrypoint.js +0 -51
  168. package/docker/services/integration-mcp/Dockerfile +0 -32
  169. package/docker/services/integration-mcp/config/service.json +0 -28
  170. package/docker/services/integration-mcp/entrypoint.js +0 -51
  171. package/docker/services/intelligent-mcp/Dockerfile +0 -32
  172. package/docker/services/intelligent-mcp/config/service.json +0 -28
  173. package/docker/services/intelligent-mcp/entrypoint.js +0 -51
  174. package/docker/services/operations-mcp/Dockerfile +0 -32
  175. package/docker/services/operations-mcp/config/service.json +0 -28
  176. package/docker/services/operations-mcp/entrypoint.js +0 -51
  177. package/docker/services/platform-development-mcp/Dockerfile +0 -32
  178. package/docker/services/platform-development-mcp/config/service.json +0 -28
  179. package/docker/services/platform-development-mcp/entrypoint.js +0 -51
  180. package/docker/services/reporting-analytics-mcp/Dockerfile +0 -32
  181. package/docker/services/reporting-analytics-mcp/config/service.json +0 -28
  182. package/docker/services/reporting-analytics-mcp/entrypoint.js +0 -51
  183. package/docker/services/security-compliance-mcp/Dockerfile +0 -32
  184. package/docker/services/security-compliance-mcp/config/service.json +0 -28
  185. package/docker/services/security-compliance-mcp/entrypoint.js +0 -51
  186. package/docker/services/update-set-mcp/Dockerfile +0 -32
  187. package/docker/services/update-set-mcp/config/service.json +0 -28
  188. package/docker/services/update-set-mcp/entrypoint.js +0 -51
  189. package/docker-compose.override.yml +0 -132
  190. package/docker-compose.prod.yml +0 -340
  191. package/docker-compose.yml +0 -579
  192. package/k8s/automation-mcp.yaml +0 -232
  193. package/k8s/configmap.yaml +0 -237
  194. package/k8s/deployment-mcp.yaml +0 -232
  195. package/k8s/flow-composer-mcp.yaml +0 -232
  196. package/k8s/generate-k8s-manifests.js +0 -453
  197. package/k8s/graph-memory-mcp.yaml +0 -232
  198. package/k8s/infrastructure.yaml +0 -456
  199. package/k8s/ingress.yaml +0 -361
  200. package/k8s/integration-mcp.yaml +0 -232
  201. package/k8s/intelligent-mcp.yaml +0 -232
  202. package/k8s/kustomization.yaml +0 -111
  203. package/k8s/mcp-services.yaml +0 -2552
  204. package/k8s/monitoring.yaml +0 -515
  205. package/k8s/namespace.yaml +0 -80
  206. package/k8s/operations-mcp.yaml +0 -232
  207. package/k8s/platform-development-mcp.yaml +0 -232
  208. package/k8s/rbac.yaml +0 -140
  209. package/k8s/reporting-analytics-mcp.yaml +0 -232
  210. package/k8s/security-compliance-mcp.yaml +0 -232
  211. package/k8s/update-set-mcp.yaml +0 -232
  212. package/test-clean-install/.claude/config.json +0 -12
  213. package/test-clean-install/.env.example +0 -49
  214. package/test-clean-install/CLAUDE.md +0 -26
  215. package/test-clean-install/README.md +0 -23
  216. package/test-global-install/.claude/config.json +0 -12
  217. package/test-global-install/CLAUDE.md +0 -26
  218. package/test-global-install/README.md +0 -23
  219. package/test-global-install/test-global-install/.claude/config.json +0 -12
  220. package/test-global-install/test-global-install/CLAUDE.md +0 -26
  221. package/test-global-install/test-global-install/README.md +0 -23
  222. package/test-global-install/test-global-install/test-global-install/.claude/config.json +0 -12
  223. package/test-global-install/test-global-install/test-global-install/.env.example +0 -49
  224. package/test-global-install/test-global-install/test-global-install/CLAUDE.md +0 -26
  225. package/test-global-install/test-global-install/test-global-install/README.md +0 -23
  226. package/test-init-debug/.claude/config.json +0 -12
  227. package/test-init-debug/CLAUDE.md +0 -693
  228. package/test-init-debug/README.md +0 -392
  229. package/test-init-real/.claude/config.json +0 -12
  230. package/test-init-real/.claude/mcp-config.json +0 -128
  231. package/test-init-real/.claude/settings.json +0 -37
  232. package/test-init-real/CLAUDE.md +0 -693
  233. package/test-init-real/README.md +0 -392
  234. package/test-init-real/activate-mcp.sh +0 -15
package/dist/cli.js CHANGED
@@ -126,21 +126,40 @@ program
126
126
  console.log('🔗 ServiceNow connection: ❌ Not authenticated');
127
127
  console.log('💡 Run "snow-flow auth login" to enable live ServiceNow integration');
128
128
  }
129
+ // Initialize Queen Agent memory system
130
+ console.log('\n💾 Initializing swarm memory system...');
131
+ const { QueenMemorySystem } = await Promise.resolve().then(() => __importStar(require('./queen/queen-memory.js')));
132
+ const memorySystem = new QueenMemorySystem();
133
+ // Generate swarm session ID
134
+ const sessionId = `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
135
+ console.log(`📋 Swarm Session ID: ${sessionId}`);
136
+ // Store swarm session in memory
137
+ memorySystem.storeLearning(`session_${sessionId}`, {
138
+ objective,
139
+ taskAnalysis,
140
+ options,
141
+ started_at: new Date().toISOString(),
142
+ is_authenticated: isAuthenticated
143
+ });
129
144
  // Start real Claude Code orchestration
130
145
  try {
131
- // Generate the orchestration prompt for Claude Code with ServiceNow integration
132
- const orchestrationPrompt = buildClaudeCodePrompt(objective, taskAnalysis, options, isAuthenticated);
133
- console.log('\n🎯 Executing Claude Code with orchestration prompt...');
146
+ // Generate the Queen Agent orchestration prompt
147
+ const orchestrationPrompt = buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated, sessionId);
148
+ console.log('\n👑 Initializing Queen Agent orchestration...');
149
+ console.log('🎯 Queen Agent will coordinate the following:');
150
+ console.log(` - Analyze objective: "${objective}"`);
151
+ console.log(` - Spawn ${taskAnalysis.estimatedAgentCount} specialized agents`);
152
+ console.log(` - Coordinate through shared memory (session: ${sessionId})`);
153
+ console.log(` - Monitor progress and adapt strategy`);
134
154
  // Check if intelligent features are enabled
135
155
  const hasIntelligentFeatures = options.autoPermissions || options.smartDiscovery ||
136
156
  options.liveTesting || options.autoDeploy || options.autoRollback ||
137
157
  options.sharedMemory || options.progressMonitoring;
138
158
  if (hasIntelligentFeatures && isAuthenticated) {
139
- console.log('🧠 INTELLIGENT ORCHESTRATION MODE ENABLED!');
140
- console.log('🚀 Using snow_orchestrate_development for unified execution');
141
- console.log('\n📋 What will happen automatically:');
159
+ console.log('\n🧠 INTELLIGENT ORCHESTRATION MODE ENABLED!');
160
+ console.log('✨ Queen Agent will use advanced features:');
142
161
  if (options.autoPermissions) {
143
- console.log(' 🔐 Permission escalation when needed');
162
+ console.log(' 🔐 Automatic permission escalation');
144
163
  }
145
164
  if (options.smartDiscovery) {
146
165
  console.log(' 🔍 Smart artifact discovery and reuse');
@@ -160,13 +179,6 @@ program
160
179
  if (options.progressMonitoring) {
161
180
  console.log(' 📊 Real-time progress monitoring');
162
181
  }
163
- console.log('\n✨ Everything will be handled automatically!');
164
- }
165
- else {
166
- console.log('💡 Claude Code will now coordinate the multi-agent development');
167
- console.log('📋 Use TodoWrite to track progress in real-time');
168
- console.log('🤖 Agents will be spawned using Task tool');
169
- console.log('💾 Coordination data stored in Memory');
170
182
  }
171
183
  if (isAuthenticated) {
172
184
  console.log('\n🔗 Live ServiceNow integration: ✅ Enabled');
@@ -176,43 +188,56 @@ program
176
188
  console.log('\n🔗 Live ServiceNow integration: ❌ Disabled');
177
189
  console.log('📝 Artifacts will be saved to servicenow/ directory');
178
190
  }
179
- console.log(); // Empty line
180
- // Try to execute Claude Code directly
191
+ console.log('\n🚀 Launching Claude Code with Queen Agent...');
192
+ // Try to execute Claude Code directly with the prompt
181
193
  const success = await executeClaudeCode(orchestrationPrompt);
182
194
  if (success) {
183
- console.log('✅ Claude Code execution completed successfully!');
184
- if (isAuthenticated) {
185
- console.log('📊 Check your ServiceNow instance for created artifacts');
195
+ console.log('\n✅ Queen Agent orchestration launched successfully!');
196
+ console.log('👑 Queen Agent is now coordinating your swarm');
197
+ console.log(`💾 Monitor progress with session ID: ${sessionId}`);
198
+ if (isAuthenticated && options.autoDeploy) {
199
+ console.log('🚀 Real artifacts will be created in ServiceNow');
186
200
  }
187
201
  else {
188
- console.log('📊 Check the servicenow/ directory for generated artifacts');
202
+ console.log('📋 Planning mode - analysis and recommendations only');
189
203
  }
204
+ // Store successful launch in memory
205
+ memorySystem.storeLearning(`launch_${sessionId}`, {
206
+ success: true,
207
+ launched_at: new Date().toISOString()
208
+ });
190
209
  }
191
210
  else {
192
- console.log('⚠️ Claude Code direct execution failed. Using fallback method:');
193
- console.log('\n🚀 CLAUDE CODE ORCHESTRATION PROMPT:');
211
+ console.log('\n📋 Claude Code manual execution required');
212
+ console.log('\n👑 QUEEN AGENT ORCHESTRATION PROMPT:');
194
213
  console.log('='.repeat(80));
195
214
  console.log(orchestrationPrompt);
196
215
  console.log('='.repeat(80));
197
- console.log('\n✅ Snow-Flow orchestration prompt generated!');
216
+ console.log('\n✅ Queen Agent orchestration prompt generated!');
198
217
  console.log('📊 Next Steps:');
199
218
  console.log(' 1. Copy the above prompt and paste it into Claude Code');
200
- console.log(' 2. Claude Code will execute the TodoWrite, Task, and Memory tools');
201
- console.log(' 3. Monitor progress through the batch tools');
202
- if (isAuthenticated) {
203
- console.log(' 4. Artifacts will be created directly in ServiceNow');
219
+ console.log(' 2. Queen Agent will analyze and spawn specialized agents');
220
+ console.log(' 3. Agents will coordinate through shared memory');
221
+ console.log(' 4. Monitor progress through TodoRead and Memory tools');
222
+ if (isAuthenticated && options.autoDeploy) {
223
+ console.log(' 5. Real artifacts will be created in ServiceNow');
204
224
  }
205
225
  else {
206
- console.log(' 4. Generated artifacts will appear in servicenow/ directory');
226
+ console.log(' 5. Planning mode - no real artifacts created');
207
227
  }
208
- console.log('\n💡 Tip: Run this in a Claude Code session for full orchestration!');
228
+ console.log(`\n💾 Session ID for monitoring: ${sessionId}`);
209
229
  }
210
230
  }
211
231
  catch (error) {
212
- console.error('❌ Failed to execute Claude Code orchestration:', error instanceof Error ? error.message : String(error));
232
+ console.error('❌ Failed to execute Queen Agent orchestration:', error instanceof Error ? error.message : String(error));
233
+ // Store error in memory for learning
234
+ memorySystem.storeLearning(`error_${sessionId}`, {
235
+ error: error instanceof Error ? error.message : String(error),
236
+ failed_at: new Date().toISOString()
237
+ });
213
238
  }
214
239
  });
215
- // Helper function to execute Claude Code directly
240
+ // Helper function to execute Claude Code directly (FALLBACK ONLY)
216
241
  async function executeClaudeCode(prompt) {
217
242
  return new Promise((resolve) => {
218
243
  console.log('🔍 Checking for Claude Code availability...');
@@ -359,162 +384,364 @@ async function executeWithClaude(claudeCommand, prompt, resolve) {
359
384
  }
360
385
  });
361
386
  }
362
- // Helper function to build Claude Code orchestration prompt
363
- function buildClaudeCodePrompt(objective, taskAnalysis, options, isAuthenticated = false) {
387
+ // Helper function to build Queen Agent orchestration prompt
388
+ function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId) {
364
389
  // Check if intelligent features are enabled
365
390
  const hasIntelligentFeatures = options.autoPermissions || options.smartDiscovery ||
366
391
  options.liveTesting || options.autoDeploy || options.autoRollback ||
367
392
  options.sharedMemory || options.progressMonitoring;
368
- const prompt = `# Snow-Flow ServiceNow Development
393
+ const prompt = `# 👑 Snow-Flow Queen Agent Orchestration
369
394
 
370
- ## 🎯 Objective
371
- ${objective}
395
+ ## 🎯 Mission Brief
396
+ You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mission is to orchestrate a swarm of specialized agents to complete the following ServiceNow development objective:
372
397
 
373
- ## 🧠 Team-Based SPARC Architecture (v1.1.62+)
398
+ **Objective**: ${objective}
399
+ **Session ID**: ${sessionId}
374
400
 
375
- **Use specialized teams for ServiceNow development:**
401
+ ## 🧠 Task Analysis Summary
402
+ - **Task Type**: ${taskAnalysis.taskType}
403
+ - **Complexity**: ${taskAnalysis.complexity}
404
+ - **Primary Agent Required**: ${taskAnalysis.primaryAgent}
405
+ - **Supporting Agents**: ${taskAnalysis.supportingAgents.join(', ')}
406
+ - **Estimated Total Agents**: ${taskAnalysis.estimatedAgentCount}
407
+ - **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
408
+ - **Recommended Team**: ${getTeamRecommendation(taskAnalysis.taskType)}
376
409
 
377
- ### Widget Development Team
378
- \`\`\`bash
379
- snow-flow sparc team widget "${objective}"
410
+ ## 👑 Your Queen Agent Responsibilities
411
+
412
+ ### 1. Initialize Swarm Session
413
+ First, store the swarm session context in memory:
414
+ \`\`\`javascript
415
+ // Initialize swarm session
416
+ Memory.store("swarm_session_${sessionId}", {
417
+ objective: "${objective}",
418
+ status: "initializing",
419
+ started_at: new Date().toISOString(),
420
+ queen_agent_id: "queen_${sessionId}",
421
+ task_analysis: ${JSON.stringify(taskAnalysis, null, 2)},
422
+ configuration: {
423
+ strategy: "${options.strategy}",
424
+ mode: "${options.mode}",
425
+ max_agents: ${parseInt(options.maxAgents)},
426
+ parallel_execution: ${options.parallel ? 'true' : 'false'},
427
+ monitoring_enabled: ${options.monitor ? 'true' : 'false'}
428
+ }
429
+ });
380
430
  \`\`\`
381
- **Team**: Frontend + Backend + UI/UX + Platform + QA Specialists
382
431
 
383
- ### Flow Development Team
384
- \`\`\`bash
385
- snow-flow sparc team flow "${objective}"
432
+ ### 2. Create Master Task List
433
+ Use TodoWrite to create a comprehensive task breakdown:
434
+ \`\`\`javascript
435
+ TodoWrite([
436
+ {
437
+ id: "analyze_requirements",
438
+ content: "Analyze user requirements: ${objective}",
439
+ status: "in_progress",
440
+ priority: "high"
441
+ },
442
+ {
443
+ id: "spawn_agents",
444
+ content: "Spawn ${taskAnalysis.estimatedAgentCount} specialized agents",
445
+ status: "pending",
446
+ priority: "high"
447
+ },
448
+ {
449
+ id: "coordinate_development",
450
+ content: "Coordinate agent activities for ${taskAnalysis.taskType}",
451
+ status: "pending",
452
+ priority: "high"
453
+ },
454
+ {
455
+ id: "validate_solution",
456
+ content: "Validate and test the complete solution",
457
+ status: "pending",
458
+ priority: "medium"
459
+ }
460
+ ]);
386
461
  \`\`\`
387
- **Team**: Process + Trigger + Data + Integration + Security Specialists
388
462
 
389
- ### Application Development Team
390
- \`\`\`bash
391
- snow-flow sparc team app "${objective}"
463
+ ### 3. Spawn Specialized Agents
464
+ Based on the task analysis, spawn the following agents using the Task tool:
465
+
466
+ **Primary Agent**: ${taskAnalysis.primaryAgent}
467
+ \`\`\`javascript
468
+ // Spawn primary agent
469
+ Task("${taskAnalysis.primaryAgent}", \`
470
+ You are the primary ${taskAnalysis.primaryAgent} agent for this swarm.
471
+
472
+ Objective: ${objective}
473
+ Session: ${sessionId}
474
+ Task Type: ${taskAnalysis.taskType}
475
+
476
+ Instructions:
477
+ 1. Read swarm context from Memory key: "swarm_session_${sessionId}"
478
+ 2. Begin implementing the core ${taskAnalysis.taskType} requirements
479
+ 3. Store all work progress in Memory with prefix: "agent_${taskAnalysis.primaryAgent}_"
480
+ 4. Update TodoWrite items as you complete tasks
481
+ 5. Coordinate with supporting agents through Memory
482
+ ${isAuthenticated ? '6. Use ServiceNow MCP tools for deployment' : '6. Create artifacts in servicenow/ directory'}
483
+ \`);
392
484
  \`\`\`
393
- **Team**: Database + Business Logic + Interface + Security + Performance Specialists
394
485
 
395
- ### Individual Specialists (for focused tasks)
396
- \`\`\`bash
397
- snow-flow sparc frontend "mobile responsiveness"
398
- snow-flow sparc backend "API optimization"
399
- snow-flow sparc security "access control review"
486
+ **Supporting Agents**:
487
+ ${taskAnalysis.supportingAgents.map((agent, index) => `
488
+ Agent ${index + 2}: ${agent}
489
+ \`\`\`javascript
490
+ // Spawn ${agent}
491
+ Task("${agent}", \`
492
+ You are a supporting ${agent} agent in this swarm.
493
+
494
+ Role: ${agent}
495
+ Session: ${sessionId}
496
+ Primary Agent: ${taskAnalysis.primaryAgent}
497
+
498
+ Instructions:
499
+ 1. Wait for primary agent to establish base structure
500
+ 2. Read context from Memory: "swarm_session_${sessionId}"
501
+ 3. Read primary agent's work from: "agent_${taskAnalysis.primaryAgent}_*"
502
+ 4. Enhance/support with your ${agent} expertise
503
+ 5. Store outputs in Memory with prefix: "agent_${agent}_"
504
+ 6. Update relevant TodoWrite items
505
+ \`);
506
+ \`\`\``).join('\n')}
507
+
508
+ ### 4. Memory Coordination Pattern
509
+ All agents MUST use this memory coordination pattern:
510
+
511
+ \`\`\`javascript
512
+ // Agent initialization
513
+ const session = Memory.get("swarm_session_${sessionId}");
514
+ const agentId = \`agent_\${agentType}_${sessionId}\`;
515
+
516
+ // Agent stores progress
517
+ Memory.store(\`\${agentId}_progress\`, {
518
+ status: "working",
519
+ current_task: "description of current work",
520
+ completion_percentage: 45,
521
+ last_update: new Date().toISOString()
522
+ });
523
+
524
+ // Agent reads other agent's work
525
+ const primaryWork = Memory.get("agent_${taskAnalysis.primaryAgent}_output");
526
+
527
+ // Agent signals completion
528
+ Memory.store(\`\${agentId}_complete\`, {
529
+ completed_at: new Date().toISOString(),
530
+ outputs: { /* agent deliverables */ },
531
+ artifacts_created: [ /* list of created artifacts */ ]
532
+ });
400
533
  \`\`\`
401
534
 
402
- ## 📊 Task Analysis
403
- - **Task Type**: ${taskAnalysis.taskType}
404
- - **Complexity**: ${taskAnalysis.complexity}
405
- - **Recommended Team**: ${getTeamRecommendation(taskAnalysis.taskType)}
535
+ ## 🧠 Intelligent Features Configuration
536
+ ${hasIntelligentFeatures ? `✅ **INTELLIGENT MODE ACTIVE** - The following features are enabled:
406
537
 
407
- ## 🧠 Intelligent Agent Analysis
408
- - **Task Type**: ${taskAnalysis.taskType}
409
- - **Primary Agent**: ${taskAnalysis.primaryAgent}
410
- - **Supporting Agents**: ${taskAnalysis.supportingAgents.join(', ')}
411
- - **Complexity**: ${taskAnalysis.complexity}
412
- - **Estimated Agents**: ${taskAnalysis.estimatedAgentCount}
413
- - **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
414
- - **Auto Update Set**: ${taskAnalysis.requiresUpdateSet ? '✅ Yes' : '❌ No'}
415
- - **Auto Application**: ${taskAnalysis.requiresApplication ? '✅ Yes' : '❌ No'}
416
-
417
- ## Configuration
418
- - **Strategy**: ${options.strategy}
419
- - **Mode**: ${options.mode}
420
- - **Max Agents**: ${parseInt(options.maxAgents)} (requested) | Estimated: ${taskAnalysis.estimatedAgentCount} | Actual: ${(() => {
421
- const userMaxAgents = parseInt(options.maxAgents);
422
- const requiredAgents = (taskAnalysis.requiresUpdateSet ? 1 : 0) + (taskAnalysis.requiresApplication ? 1 : 0);
423
- const availableSlotsForSupporting = Math.max(0, userMaxAgents - 1 - requiredAgents);
424
- const adjustedSupportingAgents = taskAnalysis.supportingAgents.slice(0, availableSlotsForSupporting);
425
- return 1 + adjustedSupportingAgents.length + requiredAgents;
426
- })()}
427
- - **Parallel**: ${options.parallel ? 'Yes' : 'No'}
428
- - **Monitor**: ${options.monitor ? 'Yes' : 'No'}
429
-
430
- ## 🧠 Intelligent Features ${hasIntelligentFeatures ? '✅ ENABLED' : '❌ DISABLED'}
431
- ${hasIntelligentFeatures ? `
432
- - **🔐 Auto Permissions**: ${options.autoPermissions ? '✅ Enabled - will escalate when needed' : '❌ Disabled'}
433
- - **🔍 Smart Discovery**: ${options.smartDiscovery ? '✅ Enabled - will reuse existing artifacts' : '❌ Disabled'}
434
- - **🧪 Live Testing**: ${options.liveTesting ? '✅ Enabled - will test in real-time' : '❌ Disabled'}
435
- - **🚀 Auto Deploy**: ${options.autoDeploy ? '⚠️ DEPLOYMENT MODE - WILL CREATE REAL ARTIFACTS' : '✅ SAFE - Planning mode only'}
436
- - **🔄 Auto Rollback**: ${options.autoRollback ? '✅ Enabled - will rollback on failures' : '❌ Disabled'}
437
- - **💾 Shared Memory**: ${options.sharedMemory ? '✅ Enabled - agents share context' : '❌ Disabled'}
438
- - **📊 Progress Monitoring**: ${options.progressMonitoring ? '✅ Enabled - real-time status' : '❌ Disabled'}
439
- ` : ''}
538
+ - **🔐 Auto Permissions**: ${options.autoPermissions ? '✅ Will escalate permissions automatically' : '❌ Manual permission handling'}
539
+ - **🔍 Smart Discovery**: ${options.smartDiscovery ? '✅ Will discover and reuse existing artifacts' : '❌ Create all new artifacts'}
540
+ - **🧪 Live Testing**: ${options.liveTesting ? '✅ Will test in real ServiceNow instance' : '❌ Local testing only'}
541
+ - **🚀 Auto Deploy**: ${options.autoDeploy ? '⚠️ WILL DEPLOY TO SERVICENOW AUTOMATICALLY' : '✅ Planning mode - no deployment'}
542
+ - **🔄 Auto Rollback**: ${options.autoRollback ? '✅ Will rollback on any failures' : '❌ No automatic rollback'}
543
+ - **💾 Shared Memory**: ${options.sharedMemory ? '✅ Agents share context via Memory' : '❌ Isolated agent execution'}
544
+ - **📊 Progress Monitoring**: ${options.progressMonitoring ? '✅ Real-time progress tracking' : '❌ No progress monitoring'}` : '❌ **STANDARD MODE** - Use manual coordination patterns'}
440
545
 
441
- ${options.autoDeploy && isAuthenticated ? `
442
- ## ⚠️ DEPLOYMENT MODE WARNING ⚠️
546
+ ## 🎯 ServiceNow Execution Strategy
443
547
 
444
- 🚨 **REAL DEPLOYMENT ACTIVE** - This will create ACTUAL artifacts in ServiceNow!
445
- - Widgets, flows, and other artifacts will be deployed to your instance
446
- - Changes will be tracked in Update Sets for rollback capability
447
- - Test thoroughly before running in production environments
548
+ ${isAuthenticated ? `### ✅ Live ServiceNow Integration Active
448
549
 
449
- 📋 To run in safe planning mode instead: Use \`--no-auto-deploy\` flag
550
+ ${hasIntelligentFeatures ? `#### 🧠 Intelligent Orchestration Available
551
+ Use the unified orchestration tool for complete automation:
552
+
553
+ \`\`\`javascript
554
+ // Queen Agent uses this for intelligent orchestration
555
+ snow_orchestrate_development({
556
+ objective: "${objective}",
557
+ auto_permissions: ${options.autoPermissions},
558
+ smart_discovery: ${options.smartDiscovery},
559
+ live_testing: ${options.liveTesting},
560
+ auto_deploy: ${options.autoDeploy},
561
+ auto_rollback: ${options.autoRollback},
562
+ shared_memory: ${options.sharedMemory},
563
+ progress_monitoring: ${options.progressMonitoring}
564
+ });
565
+ \`\`\`
450
566
  ` : ''}
451
567
 
452
- ## Task Details
453
- - **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.length > 0 ? taskAnalysis.serviceNowArtifacts.join(', ') : 'None detected'}
454
- - **Agent Requirements**: ${taskAnalysis.primaryAgent} (lead) + ${taskAnalysis.supportingAgents.join(', ')} (support)
455
- - **Complexity Assessment**: ${taskAnalysis.complexity} task requiring ${taskAnalysis.estimatedAgentCount} agents
568
+ #### ServiceNow MCP Tools Available
569
+ Your agents have access to comprehensive MCP tools:
570
+
571
+ 1. **Deployment Tools** (servicenow-deployment-mcp)
572
+ - \`snow_deploy\` - Unified deployment for all artifact types
573
+ - \`snow_preview_widget\` - Preview widgets before deployment
574
+ - \`snow_widget_test\` - Test widget functionality
575
+
576
+ 2. **Discovery Tools** (servicenow-intelligent-mcp)
577
+ - \`snow_find_artifact\` - Natural language artifact search
578
+ - \`snow_catalog_item_search\` - Find catalog items with fuzzy matching
579
+ - \`snow_get_by_sysid\` - Direct sys_id lookup
580
+
581
+ 3. **Flow Tools** (servicenow-flow-composer-mcp)
582
+ - \`snow_create_flow\` - Create flows from natural language
583
+ - \`snow_test_flow_with_mock\` - Test flows with mock data
584
+ - \`snow_link_catalog_to_flow\` - Link catalog items to flows
585
+
586
+ 4. **Update Set Management** (servicenow-update-set-mcp)
587
+ - \`snow_update_set_create\` - Create new update sets
588
+ - \`snow_update_set_add_artifact\` - Track artifacts
589
+ - \`snow_update_set_complete\` - Complete update sets
590
+
591
+ ${options.autoDeploy ? `
592
+ #### ⚠️ AUTO-DEPLOYMENT ACTIVE ⚠️
593
+ - Real artifacts will be created in ServiceNow
594
+ - All changes tracked in Update Sets
595
+ - Rollback available if needed
596
+ ` : `
597
+ #### 📋 Planning Mode Active
598
+ - No real artifacts will be created
599
+ - Analysis and recommendations only
600
+ - Use --auto-deploy to enable deployment
601
+ `}` : `### ❌ ServiceNow Integration Disabled
602
+
603
+ #### File-Based Development Mode
604
+ Agents will create artifacts as files in these directories:
605
+ - \`servicenow/widgets/\` - Widget definitions
606
+ - \`servicenow/flows/\` - Flow configurations
607
+ - \`servicenow/scripts/\` - Script files
608
+ - \`servicenow/apps/\` - Application definitions
609
+
610
+ Run \`snow-flow auth login\` to enable live ServiceNow integration.
611
+ `}
456
612
 
457
- ## 🔧 ServiceNow Integration
458
- ${isAuthenticated ? '✅ **Live ServiceNow Access: ENABLED**' : '❌ **ServiceNow Access: DISABLED** - Run \`snow-flow auth login\` to enable'}
613
+ ## 👑 Queen Agent Coordination Instructions
459
614
 
460
- ${isAuthenticated ? `
461
- You have access to comprehensive ServiceNow MCP tools for development:
615
+ ### 5. Monitor Agent Progress
616
+ As Queen Agent, continuously monitor swarm progress:
462
617
 
463
- ### 📦 ServiceNow MCP Tools Available:
464
- You have access to comprehensive MCP tools for ServiceNow development including deployment, discovery, testing, and operations capabilities.
618
+ \`\`\`javascript
619
+ // Monitor agent status
620
+ const checkAgentProgress = () => {
621
+ const agents = [${[taskAnalysis.primaryAgent, ...taskAnalysis.supportingAgents].map(a => `"${a}"`).join(', ')}];
622
+
623
+ agents.forEach(agent => {
624
+ const progress = Memory.get(\`agent_\${agent}_progress\`);
625
+ const completion = Memory.get(\`agent_\${agent}_complete\`);
626
+
627
+ console.log(\`Agent \${agent}: \${progress?.status || 'not started'}\`);
628
+ if (progress?.completion_percentage) {
629
+ console.log(\` Progress: \${progress.completion_percentage}%\`);
630
+ }
631
+ });
632
+ };
465
633
 
466
- 💡 **Refer to CLAUDE.md for complete MCP tool documentation and examples**
467
- ` : `
468
- 📝 **File-based development mode**
634
+ // Update swarm status
635
+ Memory.update("swarm_session_${sessionId}", {
636
+ status: "agents_working",
637
+ last_check: new Date().toISOString()
638
+ });
639
+ \`\`\`
469
640
 
470
- Since ServiceNow integration is not enabled, create artifacts as files in the servicenow/ directory:
471
- - servicenow/widgets/ for widget files
472
- - servicenow/workflows/ for workflow definitions
473
- - servicenow/scripts/ for server scripts
474
- - servicenow/apps/ for application definitions
641
+ ### 6. Coordinate Agent Handoffs
642
+ Ensure smooth transitions between agents:
475
643
 
476
- 💡 Run "snow-flow auth login" to enable live ServiceNow integration!
477
- `}
644
+ \`\`\`javascript
645
+ // Primary agent signals readiness for support
646
+ Memory.store("agent_${taskAnalysis.primaryAgent}_ready_for_support", {
647
+ base_structure_complete: true,
648
+ ready_for: [${taskAnalysis.supportingAgents.map(a => `"${a}"`).join(', ')}],
649
+ timestamp: new Date().toISOString()
650
+ });
651
+
652
+ // Supporting agents check readiness
653
+ const canProceed = Memory.get("agent_${taskAnalysis.primaryAgent}_ready_for_support");
654
+ if (canProceed?.base_structure_complete) {
655
+ // Begin supporting work
656
+ }
657
+ \`\`\`
478
658
 
479
- ## 🚀 Development Approach
659
+ ### 7. Final Validation and Completion
660
+ Once all agents complete their work:
480
661
 
481
- ${hasIntelligentFeatures && isAuthenticated ? `
482
- ### 🧠 Intelligent Mode Available
483
- With intelligent features enabled, you can use automated orchestration tools that handle:
484
- - Requirements analysis and discovery
485
- - Permission escalation when needed
486
- - Existing artifact reuse
487
- - Real-time testing and validation
488
- - Automatic rollback on failures
489
- - Update Set management
662
+ \`\`\`javascript
663
+ // Collect all agent outputs
664
+ const agentOutputs = {};
665
+ [${[taskAnalysis.primaryAgent, ...taskAnalysis.supportingAgents].map(a => `"${a}"`).join(', ')}].forEach(agent => {
666
+ const output = Memory.get(\`agent_\${agent}_complete\`);
667
+ if (output) {
668
+ agentOutputs[agent] = output;
669
+ }
670
+ });
490
671
 
491
- Use \`snow_orchestrate_development\` for complete automation.
492
- ` : `
493
- ### 📋 Standard Development Mode
494
- Execute these steps for ServiceNow development:
495
- 1. Use TodoWrite to track all tasks
496
- 2. Use Task tool for parallel agent coordination
497
- 3. Use Memory for shared context between agents
498
- 4. Follow the team-based SPARC approach shown above
499
- `}
672
+ // Store final swarm results
673
+ Memory.store("swarm_session_${sessionId}_results", {
674
+ objective: "${objective}",
675
+ completed_at: new Date().toISOString(),
676
+ agent_outputs: agentOutputs,
677
+ artifacts_created: Object.values(agentOutputs)
678
+ .flatMap(output => output.artifacts_created || []),
679
+ success: true
680
+ });
681
+
682
+ // Update final TodoWrite status
683
+ TodoWrite([
684
+ {
685
+ id: "swarm_completion",
686
+ content: "Swarm successfully completed: ${objective}",
687
+ status: "completed",
688
+ priority: "high"
689
+ }
690
+ ]);
691
+ \`\`\`
692
+
693
+ ## 📊 Progress Monitoring Pattern
694
+
695
+ ${options.progressMonitoring ? `### Real-Time Progress Monitoring Enabled
696
+ Monitor swarm progress using these patterns:
500
697
 
501
- ### 🎯 Development Process
502
- ${getServiceNowInstructions(taskAnalysis.taskType)}
698
+ \`\`\`javascript
699
+ // Regular progress checks
700
+ setInterval(() => {
701
+ const session = Memory.get("swarm_session_${sessionId}");
702
+ const todos = TodoRead();
703
+
704
+ console.log(\`Swarm Status: \${session.status}\`);
705
+ console.log(\`Tasks Completed: \${todos.filter(t => t.status === 'completed').length}/\${todos.length}\`);
706
+
707
+ // Check individual agent progress
708
+ checkAgentProgress();
709
+ }, 30000); // Check every 30 seconds
710
+ \`\`\`
711
+ ` : '### Manual Progress Checking\nUse TodoRead and Memory tools to check progress periodically.'}
712
+
713
+ ## 🎯 Success Criteria
714
+
715
+ Your Queen Agent orchestration is successful when:
716
+ 1. ✅ All agents have been spawned and initialized
717
+ 2. ✅ Swarm session is tracked in Memory
718
+ 3. ✅ Agents are coordinating through shared Memory
719
+ 4. ✅ TodoWrite is being used for task tracking
720
+ 5. ✅ Progress is being monitored
721
+ 6. ✅ ${taskAnalysis.taskType} requirements are met
722
+ 7. ✅ All artifacts are created/deployed successfully
503
723
 
504
- ## 📊 Expected Deliverables
505
- ${getExpectedDeliverables(taskAnalysis.taskType, isAuthenticated)}
724
+ ## 💡 Queen Agent Best Practices
506
725
 
507
- ## 📚 Development Guidelines
726
+ 1. **Spawn agents concurrently** when tasks are independent
727
+ 2. **Use Memory prefixes** to avoid key collisions
728
+ 3. **Update TodoWrite** frequently for visibility
729
+ 4. **Monitor agent health** and restart if needed
730
+ 5. **Validate outputs** before marking complete
731
+ 6. **Store all decisions** in Memory for audit trail
508
732
 
509
- ${isAuthenticated ? `✅ **ServiceNow integration is enabled** - You can deploy directly to ServiceNow.` : '❌ **ServiceNow integration is disabled** - Files will be created locally.'}
733
+ ## 🚀 Begin Orchestration
510
734
 
511
- 📚 **Refer to CLAUDE.md for:**
512
- - Complete command reference and examples
513
- - Team-based SPARC architecture details
514
- - MCP tool documentation
515
- - Best practices and workflows
735
+ Now execute this Queen Agent orchestration plan:
736
+ 1. Initialize the swarm session in Memory
737
+ 2. Create the master task list with TodoWrite
738
+ 3. Spawn all required agents using Task
739
+ 4. Monitor progress and coordinate
740
+ 5. Validate and complete the objective
516
741
 
517
- 🎯 **RECOMMENDATION**: Use the team-based SPARC commands shown above for optimal results!`;
742
+ Remember: You are the Queen Agent - the master coordinator. Your role is to ensure all agents work harmoniously to achieve the objective: "${objective}"
743
+
744
+ Session ID for this swarm: ${sessionId}`;
518
745
  return prompt;
519
746
  }
520
747
  function getTeamRecommendation(taskType) {
@@ -566,6 +793,84 @@ function extractName(objective, type) {
566
793
  }
567
794
  return `Generated ${type}`;
568
795
  }
796
+ // Swarm status command - monitor running swarms
797
+ program
798
+ .command('swarm-status [sessionId]')
799
+ .description('Check the status of a running swarm session')
800
+ .option('--watch', 'Continuously monitor the swarm progress')
801
+ .option('--interval <seconds>', 'Watch interval in seconds', '5')
802
+ .action(async (sessionId, options) => {
803
+ console.log('\n🔍 Checking swarm status...\n');
804
+ try {
805
+ const { QueenMemorySystem } = await Promise.resolve().then(() => __importStar(require('./queen/queen-memory.js')));
806
+ const memorySystem = new QueenMemorySystem();
807
+ if (!sessionId) {
808
+ // List all recent swarm sessions
809
+ console.log('📋 Recent swarm sessions:');
810
+ console.log('(Provide a session ID to see detailed status)\n');
811
+ // Get all session keys from learnings
812
+ const sessionKeys = [];
813
+ // Note: This is a simplified approach - in production, you'd query the database directly
814
+ console.log('💡 Use: snow-flow swarm-status <sessionId> to see details');
815
+ console.log('💡 Session IDs are displayed when you start a swarm\n');
816
+ return;
817
+ }
818
+ // Get specific session data
819
+ const sessionData = memorySystem.getLearning(`session_${sessionId}`);
820
+ const launchData = memorySystem.getLearning(`launch_${sessionId}`);
821
+ const errorData = memorySystem.getLearning(`error_${sessionId}`);
822
+ if (!sessionData) {
823
+ console.error(`❌ No swarm session found with ID: ${sessionId}`);
824
+ console.log('💡 Make sure to use the exact session ID displayed when starting the swarm');
825
+ return;
826
+ }
827
+ console.log(`👑 Swarm Session: ${sessionId}`);
828
+ console.log(`📋 Objective: ${sessionData.objective}`);
829
+ console.log(`🕐 Started: ${sessionData.started_at}`);
830
+ console.log(`📊 Task Type: ${sessionData.taskAnalysis.taskType}`);
831
+ console.log(`🤖 Agents: ${sessionData.taskAnalysis.estimatedAgentCount} total`);
832
+ console.log(` - Primary: ${sessionData.taskAnalysis.primaryAgent}`);
833
+ console.log(` - Supporting: ${sessionData.taskAnalysis.supportingAgents.join(', ')}`);
834
+ if (launchData && launchData.success) {
835
+ console.log(`\n✅ Status: Claude Code launched successfully`);
836
+ console.log(`🚀 Launched at: ${launchData.launched_at}`);
837
+ }
838
+ else if (errorData) {
839
+ console.log(`\n❌ Status: Error occurred`);
840
+ console.log(`💥 Error: ${errorData.error}`);
841
+ console.log(`🕐 Failed at: ${errorData.failed_at}`);
842
+ }
843
+ else {
844
+ console.log(`\n⏳ Status: Awaiting manual Claude Code execution`);
845
+ }
846
+ console.log('\n💡 Tips:');
847
+ console.log(' - Check Claude Code for real-time agent progress');
848
+ console.log(' - Use Memory.get("swarm_session_' + sessionId + '") in Claude Code');
849
+ console.log(' - Monitor TodoRead for task completion status');
850
+ if (options.watch) {
851
+ console.log(`\n👀 Watching for updates every ${options.interval} seconds...`);
852
+ console.log('(Press Ctrl+C to stop)\n');
853
+ const watchInterval = setInterval(async () => {
854
+ // In a real implementation, this would query Claude Code's memory
855
+ console.log(`[${new Date().toLocaleTimeString()}] Checking for updates...`);
856
+ // Re-fetch session data to check for updates
857
+ const updatedSession = memorySystem.getLearning(`session_${sessionId}`);
858
+ if (updatedSession) {
859
+ console.log(' Status: Active - Check Claude Code for details');
860
+ }
861
+ }, parseInt(options.interval) * 1000);
862
+ // Handle graceful shutdown
863
+ process.on('SIGINT', () => {
864
+ clearInterval(watchInterval);
865
+ console.log('\n\n✋ Stopped watching swarm status');
866
+ process.exit(0);
867
+ });
868
+ }
869
+ }
870
+ catch (error) {
871
+ console.error('❌ Failed to check swarm status:', error instanceof Error ? error.message : String(error));
872
+ }
873
+ });
569
874
  // Spawn agent command
570
875
  program
571
876
  .command('spawn <type>')
@@ -3367,6 +3672,17 @@ program
3367
3672
  * Note: Users can use: snow-flow swarm "objective" --queen
3368
3673
  * This will be implemented in a future version once the Queen system is stable.
3369
3674
  */
3675
+ // ===================================================
3676
+ // 🎯 INTEGRATE SNOW-FLOW HIVE-MIND SYSTEM
3677
+ // ===================================================
3678
+ // Note: The new integrated commands enhance the existing CLI with:
3679
+ // - Advanced system status monitoring
3680
+ // - Real-time monitoring dashboard
3681
+ // - Persistent memory management
3682
+ // - Configuration management
3683
+ // - Performance analytics
3684
+ // Comment out the line below to disable the integrated commands
3685
+ // integrateSnowFlowCommands(program);
3370
3686
  program.parse(process.argv);
3371
3687
  // Show help if no command provided
3372
3688
  if (!process.argv.slice(2).length) {