snow-flow 4.5.52 → 4.5.53

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 (3) hide show
  1. package/CLAUDE.md +17 -5
  2. package/dist/cli.js +76 -12
  3. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -6,14 +6,26 @@
6
6
 
7
7
  **❌ INFINITE LOOP (PROHIBITED):**
8
8
  ```
9
- Task("Create configurable workspace")
10
- Task("Create configurable workspace")
11
- Task("Create configurable workspace") // CAUSES INFINITE LOOP!
9
+ Task("UI Builder Tools Tester", "Test UI Builder tools");
10
+ Task("UI Builder Tools Tester", "Test UI Builder tools"); // ← DUPLICATE AGENT TYPE!
11
+ Task("Workspace Tools Tester", "Test workspace tools");
12
+ Task("Workspace Tools Tester", "Test workspace tools"); // ← CAUSES INFINITE LOOP!
13
+
14
+ // This pattern causes MCP server spam:
15
+ // • Task(UI Builder Tools Tester) → snow_validate_uib_page_structure (repeated 100x)
16
+ // • Task(Workspace Tools Tester) → snow_execute_script_with_output (repeated 100x)
12
17
  ```
13
18
 
14
19
  **✅ CORRECT (Single Agent):**
15
- ```
16
- Task("workspace-specialist", "Create ONE Configurable Agent Workspace named 'IT Support Hub' using snow_create_workspace with UX App architecture. Verify creation and store sys_id in Memory.")
20
+ ```
21
+ // UNIQUE agent names prevent loops:
22
+ Task("workspace-architect", "Create ONE UX workspace for IT support using snow_create_complete_workspace. Store all sys_ids in Memory.");
23
+ Task("ui-specialist", "Design UI components AFTER workspace-architect completes. Use Memory to get workspace sys_ids.");
24
+ Task("testing-validator", "Test workspace functionality AFTER ui-specialist completes. No duplicate testing!");
25
+
26
+ // NEVER use generic names like:
27
+ // Task("Tester", ...) - TOO GENERIC, CAUSES LOOPS!
28
+ // Task("UI Builder Tools Tester", ...) - EXACTLY what caused the infinite loop!
17
29
  ```
18
30
 
19
31
  **🎯 Anti-Loop Rules:**
package/dist/cli.js CHANGED
@@ -643,6 +643,31 @@ function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated
643
643
  options.sharedMemory || options.progressMonitoring;
644
644
  const prompt = `# 👑 Snow-Flow Queen Agent Orchestration
645
645
 
646
+ ## 🚨 CRITICAL: PREVENT INFINITE LOOPS - READ FIRST!
647
+
648
+ **NEVER SPAWN DUPLICATE AGENTS!** This causes infinite loops that spam MCP servers and crash Codespaces!
649
+
650
+ **❌ INFINITE LOOP PATTERN (PROHIBITED):**
651
+ \`\`\`
652
+ Task(\"UI Builder Tools Tester\", \"Test UI Builder tools\");
653
+ Task(\"UI Builder Tools Tester\", \"Test UI Builder tools\"); // ← DUPLICATE AGENT TYPE!
654
+ Task(\"Workspace Tools Tester\", \"Test workspace tools\");
655
+ Task(\"Workspace Tools Tester\", \"Test workspace tools\"); // ← INFINITE LOOP!
656
+ \`\`\`
657
+
658
+ **✅ CORRECT PATTERN (REQUIRED):**
659
+ \`\`\`
660
+ Task(\"workspace-architect\", \"Create ONE UX workspace using snow_create_complete_workspace\");
661
+ Task(\"ui-designer\", \"Design UI components AFTER workspace is created\");
662
+ Task(\"validator\", \"Test AFTER both previous agents complete\");
663
+ \`\`\`
664
+
665
+ **GOLDEN RULES:**
666
+ 1. **ONE agent per task type maximum**
667
+ 2. **UNIQUE agent names** (not generic \"Tester\")
668
+ 3. **SEQUENTIAL spawning** - wait for completion
669
+ 4. **CHECK Memory** for existing agents first
670
+
646
671
  ## 🎯 Mission Brief
647
672
  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:
648
673
 
@@ -838,29 +863,68 @@ TodoWrite([
838
863
  ]);
839
864
  \`\`\`
840
865
 
841
- ### 4. Agent Spawning Strategy
842
- Based on the task analysis, spawn ${taskAnalysis.estimatedAgentCount} agents in smart batches:
866
+ ### 4. Agent Spawning Strategy - 🚨 ANTI-LOOP PROTECTION 🚨
867
+
868
+ **CRITICAL: NO DUPLICATE AGENTS! ONLY SPAWN EACH AGENT TYPE ONCE!**
843
869
 
844
- **Dynamic Agent Discovery & Spawning (Use Snow-Flow MCP Tools):**
845
- 1. **Initialize Swarm**: \`swarm_init({ topology: 'hierarchical', maxAgents: ${parseInt(options.maxAgents)} })\`
846
- 2. **Discover Agents Dynamically**: \`agent_discover({ task_analysis: ${JSON.stringify(taskAnalysis)}, required_capabilities: [], context: { max_agents: ${parseInt(options.maxAgents)}, include_new_types: true } })\`
847
- 3. **Spawn Discovered Agents**: Use \`agent_spawn({ type: 'agent_type_from_discovery', name: 'Agent Name', capabilities: ['discovered_capabilities'] })\` for each discovered agent
848
- 4. **Coordination**: \`task_orchestrate({ task: '${objective}', strategy: 'adaptive' })\`
870
+ **✅ CORRECT (Single Agents Only):**
871
+ 1. **Initialize Swarm ONCE**: \`swarm_init({ topology: 'hierarchical', maxAgents: ${parseInt(options.maxAgents)} })\`
872
+ 2. **Spawn ${taskAnalysis.estimatedAgentCount} DIFFERENT agents**:
873
+ Spawn ONE agent of each required type based on the objective:
849
874
 
850
- **IMPORTANT**: Do NOT use hardcoded agent types like 'widget-creator', 'specialist' etc. Let \`agent_discover\` determine the optimal agent types for this specific task!
875
+ **${taskAnalysis.taskType} requires these UNIQUE agents:**
876
+ - **ONE researcher**: \`Task(\"researcher\", \"Research ServiceNow requirements for: ${objective}\")\`
877
+ - **ONE ${taskAnalysis.primaryAgent}**: \`Task(\"${taskAnalysis.primaryAgent}\", \"Implement main solution for: ${objective}\")\`
878
+ - **ONE tester**: \`Task(\"tester\", \"Test and validate solution for: ${objective}\")\`
851
879
 
852
- ### 5. Memory Coordination Pattern
853
- All agents MUST use this simple memory coordination:
880
+ **🚨 CRITICAL ANTI-LOOP RULES:**
881
+ - **NEVER spawn multiple agents of the same type**
882
+ - **NEVER spawn \"UI Builder Tools Tester\" multiple times**
883
+ - **NEVER spawn \"Workspace Tools Tester\" multiple times**
884
+ - **WAIT for agent completion** before spawning related agents
885
+ - **CHECK Memory** for existing agents before spawning new ones
886
+
887
+ **❌ PROHIBITED PATTERNS:**
888
+ \`\`\`
889
+ // DON'T DO THIS - CAUSES INFINITE LOOPS:
890
+ Task(\"UI Builder Tools Tester\", \"Test UI Builder tools\");
891
+ Task(\"UI Builder Tools Tester\", \"Test UI Builder tools\"); // ← DUPLICATE!
892
+ Task(\"UI Builder Tools Tester\", \"Test UI Builder tools\"); // ← INFINITE LOOP!
893
+ \`\`\`
894
+
895
+ **✅ CORRECT PATTERNS:**
896
+ \`\`\`
897
+ // DO THIS - SINGLE AGENTS WITH SPECIFIC TASKS:
898
+ Task(\"ui-builder-specialist\", \"Create specific UI Builder page for incident management\");
899
+ Task(\"workspace-architect\", \"Design UX workspace structure for IT support team\");
900
+ Task(\"testing-specialist\", \"Validate workspace functionality and report results\");
901
+ \`\`\`
902
+
903
+ ### 5. Memory Coordination Pattern with Loop Detection
904
+ All agents MUST use this memory coordination WITH loop prevention:
854
905
 
855
906
  \`\`\`javascript
856
- // Agent initialization
907
+ // STEP 1: Check if agent type already exists (PREVENT LOOPS!)
908
+ const existingAgents = Memory.get('active_agents') || [];
909
+ const agentType = 'ui-builder-specialist';
910
+
911
+ if (existingAgents.includes(agentType)) {
912
+ console.log('Agent type already active - SKIPPING to prevent infinite loop');
913
+ return; // DON'T spawn duplicate agents!
914
+ }
915
+
916
+ // STEP 2: Register agent as active
857
917
  const agentId = \`agent_\${agentType}_\${sessionId}\`;
918
+ existingAgents.push(agentType);
919
+ Memory.store('active_agents', JSON.stringify(existingAgents));
858
920
 
859
- // Agent stores progress
921
+ // STEP 3: Agent stores progress
860
922
  Memory.store(\`\${agentId}_progress\`, JSON.stringify({
923
+ agent_type: agentType,
861
924
  status: "working",
862
925
  current_task: "description of current work",
863
926
  completion_percentage: 45,
927
+ spawned_at: new Date().toISOString(),
864
928
  last_update: new Date().toISOString()
865
929
  }));
866
930
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.5.52",
3
+ "version": "4.5.53",
4
4
  "description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 245+ ServiceNow tools including complete UX + Agent Workspace creation with official APIs.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",