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.
- package/.claude-flow/queen/queen-memory.db +0 -0
- package/CLAUDE.md +34 -5
- package/README.md +256 -384
- package/dist/agents/base-agent.d.ts +92 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +228 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/coordinator.d.ts +200 -0
- package/dist/agents/coordinator.d.ts.map +1 -0
- package/dist/agents/coordinator.js +775 -0
- package/dist/agents/coordinator.js.map +1 -0
- package/dist/agents/flow-builder-agent.d.ts +18 -0
- package/dist/agents/flow-builder-agent.d.ts.map +1 -0
- package/dist/agents/flow-builder-agent.js +536 -0
- package/dist/agents/flow-builder-agent.js.map +1 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +61 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/queen-agent-example.d.ts +23 -0
- package/dist/agents/queen-agent-example.d.ts.map +1 -0
- package/dist/agents/queen-agent-example.js +241 -0
- package/dist/agents/queen-agent-example.js.map +1 -0
- package/dist/agents/queen-agent.d.ts +180 -0
- package/dist/agents/queen-agent.d.ts.map +1 -0
- package/dist/agents/queen-agent.js +909 -0
- package/dist/agents/queen-agent.js.map +1 -0
- package/dist/agents/queen-agent.test.d.ts +6 -0
- package/dist/agents/queen-agent.test.d.ts.map +1 -0
- package/dist/agents/queen-agent.test.js.map +1 -0
- package/dist/agents/script-writer-agent.d.ts +22 -0
- package/dist/agents/script-writer-agent.d.ts.map +1 -0
- package/dist/agents/script-writer-agent.js +695 -0
- package/dist/agents/script-writer-agent.js.map +1 -0
- package/dist/agents/security-agent.d.ts +23 -0
- package/dist/agents/security-agent.d.ts.map +1 -0
- package/dist/agents/security-agent.js +619 -0
- package/dist/agents/security-agent.js.map +1 -0
- package/dist/agents/test-agent.d.ts +26 -0
- package/dist/agents/test-agent.d.ts.map +1 -0
- package/dist/agents/test-agent.js +735 -0
- package/dist/agents/test-agent.js.map +1 -0
- package/dist/agents/test-agents.d.ts +7 -0
- package/dist/agents/test-agents.d.ts.map +1 -0
- package/dist/agents/test-agents.js +65 -0
- package/dist/agents/test-agents.js.map +1 -0
- package/dist/agents/widget-creator-agent.d.ts +18 -0
- package/dist/agents/widget-creator-agent.d.ts.map +1 -0
- package/dist/agents/widget-creator-agent.js +440 -0
- package/dist/agents/widget-creator-agent.js.map +1 -0
- package/dist/cli/snow-flow-cli-integration.d.ts +30 -0
- package/dist/cli/snow-flow-cli-integration.d.ts.map +1 -0
- package/dist/cli/snow-flow-cli-integration.js +385 -0
- package/dist/cli/snow-flow-cli-integration.js.map +1 -0
- package/dist/cli.js +466 -150
- package/dist/cli.js.map +1 -1
- package/dist/config/snow-flow-config.d.ts +1454 -0
- package/dist/config/snow-flow-config.d.ts.map +1 -0
- package/dist/config/snow-flow-config.js +403 -0
- package/dist/config/snow-flow-config.js.map +1 -0
- package/dist/health/system-health.d.ts +123 -0
- package/dist/health/system-health.d.ts.map +1 -0
- package/dist/health/system-health.js +580 -0
- package/dist/health/system-health.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts +58 -0
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts.map +1 -0
- package/dist/mcp/servicenow-deployment-mcp-refactored.js +651 -0
- package/dist/mcp/servicenow-deployment-mcp-refactored.js.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts +43 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.js +576 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.js.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +102 -1
- package/dist/mcp/servicenow-intelligent-mcp.d.ts.map +1 -1
- package/dist/mcp/servicenow-intelligent-mcp.js +2 -0
- package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -1
- package/dist/mcp/shared/agent-context-provider.d.ts +77 -0
- package/dist/mcp/shared/agent-context-provider.d.ts.map +1 -0
- package/dist/mcp/shared/agent-context-provider.js +292 -0
- package/dist/mcp/shared/agent-context-provider.js.map +1 -0
- package/dist/mcp/shared/base-mcp-server.d.ts +97 -0
- package/dist/mcp/shared/base-mcp-server.d.ts.map +1 -0
- package/dist/mcp/shared/base-mcp-server.js +216 -0
- package/dist/mcp/shared/base-mcp-server.js.map +1 -0
- package/dist/mcp/shared/mcp-memory-manager.d.ts +87 -0
- package/dist/mcp/shared/mcp-memory-manager.d.ts.map +1 -0
- package/dist/mcp/shared/mcp-memory-manager.js +423 -0
- package/dist/mcp/shared/mcp-memory-manager.js.map +1 -0
- package/dist/memory/index.d.ts +9 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +20 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/mcp-integration-example.d.ts +6 -0
- package/dist/memory/mcp-integration-example.d.ts.map +1 -0
- package/dist/memory/mcp-integration-example.js +282 -0
- package/dist/memory/mcp-integration-example.js.map +1 -0
- package/dist/memory/memory-client.d.ts +184 -0
- package/dist/memory/memory-client.d.ts.map +1 -0
- package/dist/memory/memory-client.js +325 -0
- package/dist/memory/memory-client.js.map +1 -0
- package/dist/memory/memory-operations.d.ts +170 -0
- package/dist/memory/memory-operations.d.ts.map +1 -0
- package/dist/memory/memory-operations.js +639 -0
- package/dist/memory/memory-operations.js.map +1 -0
- package/dist/memory/memory-system.d.ts +118 -0
- package/dist/memory/memory-system.d.ts.map +1 -0
- package/dist/memory/memory-system.js +477 -0
- package/dist/memory/memory-system.js.map +1 -0
- package/dist/memory/memory-test.d.ts +6 -0
- package/dist/memory/memory-test.d.ts.map +1 -0
- package/dist/memory/memory-test.js +162 -0
- package/dist/memory/memory-test.js.map +1 -0
- package/dist/memory/swarm-memory.d.ts +135 -0
- package/dist/memory/swarm-memory.d.ts.map +1 -0
- package/dist/memory/swarm-memory.js +378 -0
- package/dist/memory/swarm-memory.js.map +1 -0
- package/dist/monitoring/performance-tracker.d.ts +157 -0
- package/dist/monitoring/performance-tracker.d.ts.map +1 -0
- package/dist/monitoring/performance-tracker.js +571 -0
- package/dist/monitoring/performance-tracker.js.map +1 -0
- package/dist/queen/agent-factory.d.ts +3 -0
- package/dist/queen/agent-factory.d.ts.map +1 -1
- package/dist/queen/agent-factory.js +52 -0
- package/dist/queen/agent-factory.js.map +1 -1
- package/dist/queen/queen-memory.d.ts +8 -2
- package/dist/queen/queen-memory.d.ts.map +1 -1
- package/dist/queen/queen-memory.js +46 -4
- package/dist/queen/queen-memory.js.map +1 -1
- package/dist/snow-flow-system.d.ts +132 -0
- package/dist/snow-flow-system.d.ts.map +1 -0
- package/dist/snow-flow-system.js +396 -0
- package/dist/snow-flow-system.js.map +1 -0
- package/dist/types/todo.types.d.ts +61 -0
- package/dist/types/todo.types.d.ts.map +1 -0
- package/dist/types/todo.types.js +7 -0
- package/dist/types/todo.types.js.map +1 -0
- package/dist/utils/error-recovery.d.ts +101 -0
- package/dist/utils/error-recovery.d.ts.map +1 -0
- package/dist/utils/error-recovery.js +548 -0
- package/dist/utils/error-recovery.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
- package/deploy.sh +0 -366
- package/docker/base/Dockerfile.base +0 -45
- package/docker/generate-services.js +0 -244
- package/docker/nginx/Dockerfile +0 -71
- package/docker/nginx/consul-template.hcl +0 -64
- package/docker/nginx/healthcheck.sh +0 -178
- package/docker/nginx/nginx.conf +0 -210
- package/docker/nginx/supervisord.conf +0 -57
- package/docker/nginx/templates/upstreams.conf.tpl +0 -48
- package/docker/services/automation-mcp/Dockerfile +0 -32
- package/docker/services/automation-mcp/config/service.json +0 -28
- package/docker/services/automation-mcp/entrypoint.js +0 -51
- package/docker/services/deployment-mcp/Dockerfile +0 -32
- package/docker/services/deployment-mcp/entrypoint.js +0 -51
- package/docker/services/flow-composer-mcp/Dockerfile +0 -32
- package/docker/services/flow-composer-mcp/config/service.json +0 -28
- package/docker/services/flow-composer-mcp/entrypoint.js +0 -51
- package/docker/services/graph-memory-mcp/Dockerfile +0 -32
- package/docker/services/graph-memory-mcp/config/service.json +0 -28
- package/docker/services/graph-memory-mcp/entrypoint.js +0 -51
- package/docker/services/integration-mcp/Dockerfile +0 -32
- package/docker/services/integration-mcp/config/service.json +0 -28
- package/docker/services/integration-mcp/entrypoint.js +0 -51
- package/docker/services/intelligent-mcp/Dockerfile +0 -32
- package/docker/services/intelligent-mcp/config/service.json +0 -28
- package/docker/services/intelligent-mcp/entrypoint.js +0 -51
- package/docker/services/operations-mcp/Dockerfile +0 -32
- package/docker/services/operations-mcp/config/service.json +0 -28
- package/docker/services/operations-mcp/entrypoint.js +0 -51
- package/docker/services/platform-development-mcp/Dockerfile +0 -32
- package/docker/services/platform-development-mcp/config/service.json +0 -28
- package/docker/services/platform-development-mcp/entrypoint.js +0 -51
- package/docker/services/reporting-analytics-mcp/Dockerfile +0 -32
- package/docker/services/reporting-analytics-mcp/config/service.json +0 -28
- package/docker/services/reporting-analytics-mcp/entrypoint.js +0 -51
- package/docker/services/security-compliance-mcp/Dockerfile +0 -32
- package/docker/services/security-compliance-mcp/config/service.json +0 -28
- package/docker/services/security-compliance-mcp/entrypoint.js +0 -51
- package/docker/services/update-set-mcp/Dockerfile +0 -32
- package/docker/services/update-set-mcp/config/service.json +0 -28
- package/docker/services/update-set-mcp/entrypoint.js +0 -51
- package/docker-compose.override.yml +0 -132
- package/docker-compose.prod.yml +0 -340
- package/docker-compose.yml +0 -579
- package/k8s/automation-mcp.yaml +0 -232
- package/k8s/configmap.yaml +0 -237
- package/k8s/deployment-mcp.yaml +0 -232
- package/k8s/flow-composer-mcp.yaml +0 -232
- package/k8s/generate-k8s-manifests.js +0 -453
- package/k8s/graph-memory-mcp.yaml +0 -232
- package/k8s/infrastructure.yaml +0 -456
- package/k8s/ingress.yaml +0 -361
- package/k8s/integration-mcp.yaml +0 -232
- package/k8s/intelligent-mcp.yaml +0 -232
- package/k8s/kustomization.yaml +0 -111
- package/k8s/mcp-services.yaml +0 -2552
- package/k8s/monitoring.yaml +0 -515
- package/k8s/namespace.yaml +0 -80
- package/k8s/operations-mcp.yaml +0 -232
- package/k8s/platform-development-mcp.yaml +0 -232
- package/k8s/rbac.yaml +0 -140
- package/k8s/reporting-analytics-mcp.yaml +0 -232
- package/k8s/security-compliance-mcp.yaml +0 -232
- package/k8s/update-set-mcp.yaml +0 -232
- package/test-clean-install/.claude/config.json +0 -12
- package/test-clean-install/.env.example +0 -49
- package/test-clean-install/CLAUDE.md +0 -26
- package/test-clean-install/README.md +0 -23
- package/test-global-install/.claude/config.json +0 -12
- package/test-global-install/CLAUDE.md +0 -26
- package/test-global-install/README.md +0 -23
- package/test-global-install/test-global-install/.claude/config.json +0 -12
- package/test-global-install/test-global-install/CLAUDE.md +0 -26
- package/test-global-install/test-global-install/README.md +0 -23
- package/test-global-install/test-global-install/test-global-install/.claude/config.json +0 -12
- package/test-global-install/test-global-install/test-global-install/.env.example +0 -49
- package/test-global-install/test-global-install/test-global-install/CLAUDE.md +0 -26
- package/test-global-install/test-global-install/test-global-install/README.md +0 -23
- package/test-init-debug/.claude/config.json +0 -12
- package/test-init-debug/CLAUDE.md +0 -693
- package/test-init-debug/README.md +0 -392
- package/test-init-real/.claude/config.json +0 -12
- package/test-init-real/.claude/mcp-config.json +0 -128
- package/test-init-real/.claude/settings.json +0 -37
- package/test-init-real/CLAUDE.md +0 -693
- package/test-init-real/README.md +0 -392
- 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
|
|
132
|
-
const orchestrationPrompt =
|
|
133
|
-
console.log('\n
|
|
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('
|
|
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(' 🔐
|
|
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(
|
|
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('✅
|
|
184
|
-
|
|
185
|
-
|
|
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('
|
|
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('
|
|
193
|
-
console.log('\n
|
|
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✅
|
|
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.
|
|
201
|
-
console.log(' 3.
|
|
202
|
-
|
|
203
|
-
|
|
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('
|
|
226
|
+
console.log(' 5. Planning mode - no real artifacts created');
|
|
207
227
|
}
|
|
208
|
-
console.log(
|
|
228
|
+
console.log(`\n💾 Session ID for monitoring: ${sessionId}`);
|
|
209
229
|
}
|
|
210
230
|
}
|
|
211
231
|
catch (error) {
|
|
212
|
-
console.error('❌ Failed to execute
|
|
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
|
|
363
|
-
function
|
|
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
|
|
393
|
+
const prompt = `# 👑 Snow-Flow Queen Agent Orchestration
|
|
369
394
|
|
|
370
|
-
## 🎯
|
|
371
|
-
|
|
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
|
-
|
|
398
|
+
**Objective**: ${objective}
|
|
399
|
+
**Session ID**: ${sessionId}
|
|
374
400
|
|
|
375
|
-
|
|
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
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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
|
-
###
|
|
384
|
-
|
|
385
|
-
|
|
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
|
-
###
|
|
390
|
-
|
|
391
|
-
|
|
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
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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
|
-
##
|
|
403
|
-
|
|
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
|
-
|
|
408
|
-
-
|
|
409
|
-
-
|
|
410
|
-
-
|
|
411
|
-
-
|
|
412
|
-
-
|
|
413
|
-
-
|
|
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
|
-
|
|
442
|
-
## ⚠️ DEPLOYMENT MODE WARNING ⚠️
|
|
546
|
+
## 🎯 ServiceNow Execution Strategy
|
|
443
547
|
|
|
444
|
-
|
|
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
|
-
|
|
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
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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
|
-
##
|
|
458
|
-
${isAuthenticated ? '✅ **Live ServiceNow Access: ENABLED**' : '❌ **ServiceNow Access: DISABLED** - Run \`snow-flow auth login\` to enable'}
|
|
613
|
+
## 👑 Queen Agent Coordination Instructions
|
|
459
614
|
|
|
460
|
-
|
|
461
|
-
|
|
615
|
+
### 5. Monitor Agent Progress
|
|
616
|
+
As Queen Agent, continuously monitor swarm progress:
|
|
462
617
|
|
|
463
|
-
|
|
464
|
-
|
|
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
|
-
|
|
467
|
-
|
|
468
|
-
|
|
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
|
-
|
|
471
|
-
|
|
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
|
-
|
|
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
|
-
|
|
659
|
+
### 7. Final Validation and Completion
|
|
660
|
+
Once all agents complete their work:
|
|
480
661
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
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
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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
|
-
|
|
502
|
-
|
|
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
|
-
##
|
|
505
|
-
${getExpectedDeliverables(taskAnalysis.taskType, isAuthenticated)}
|
|
724
|
+
## 💡 Queen Agent Best Practices
|
|
506
725
|
|
|
507
|
-
|
|
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
|
-
|
|
733
|
+
## 🚀 Begin Orchestration
|
|
510
734
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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
|
-
|
|
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) {
|