claude-flow-novice 2.14.35 → 2.14.37

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 (56) hide show
  1. package/.claude/commands/CFN_LOOP_TASK_MODE.md +1 -1
  2. package/.claude/commands/cfn-loop-cli.md +491 -456
  3. package/.claude/commands/switch-api.md +1 -1
  4. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
  5. package/.claude/skills/cfn-loop-validation/config.json +2 -2
  6. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +220 -220
  7. package/claude-assets/agents/README-AGENT_LIFECYCLE.md +37 -10
  8. package/claude-assets/agents/README-VALIDATION.md +0 -8
  9. package/claude-assets/agents/cfn-dev-team/README.md +0 -8
  10. package/claude-assets/agents/cfn-dev-team/coordinators/README.md +1 -9
  11. package/claude-assets/agents/cfn-dev-team/developers/README.md +1 -9
  12. package/claude-assets/agents/cfn-dev-team/documentation/README-VALIDATION.md +0 -8
  13. package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +0 -10
  14. package/claude-assets/agents/cfn-dev-team/reviewers/README.md +1 -9
  15. package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +0 -10
  16. package/claude-assets/agents/cfn-dev-team/test-agent.md +0 -10
  17. package/claude-assets/agents/cfn-dev-team/testers/README.md +1 -9
  18. package/claude-assets/agents/csuite/cto-agent.md +0 -10
  19. package/claude-assets/agents/custom/cfn-system-expert.md +1 -128
  20. package/claude-assets/agents/custom/claude-code-expert.md +151 -2
  21. package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +39 -3
  22. package/claude-assets/agents/docker-team/csuite/c-suite-template.md +1 -5
  23. package/claude-assets/agents/docker-team/infrastructure/team-coordinator-template.md +1 -5
  24. package/claude-assets/agents/marketing_hybrid/cost_tracker.md +0 -10
  25. package/claude-assets/agents/marketing_hybrid/docker_deployer.md +0 -10
  26. package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +0 -10
  27. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +1 -1
  28. package/claude-assets/commands/cfn-loop-cli.md +491 -456
  29. package/claude-assets/commands/switch-api.md +1 -1
  30. package/claude-assets/skills/cfn-error-logging/SKILL.md +339 -0
  31. package/claude-assets/skills/cfn-error-logging/cleanup-error-logs.sh +334 -0
  32. package/claude-assets/skills/cfn-error-logging/integrate-cli.sh +232 -0
  33. package/claude-assets/skills/cfn-error-logging/integrate-docker.sh +294 -0
  34. package/claude-assets/skills/cfn-error-logging/invoke-error-logging.sh +839 -0
  35. package/claude-assets/skills/cfn-error-logging/test-error-logging.sh +475 -0
  36. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
  37. package/claude-assets/skills/cfn-loop-validation/config.json +2 -2
  38. package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +326 -322
  39. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +220 -220
  40. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +2 -2
  41. package/claude-assets/skills/cfn-task-mode-sanitize/task-mode-env-sanitizer.sh +224 -181
  42. package/claude-assets/skills/cfn-validation-runner-instrumentation/wrapped-executor.sh +235 -271
  43. package/dist/agents/agent-loader.js +467 -133
  44. package/dist/agents/agent-loader.js.map +1 -1
  45. package/dist/cli/config-manager.js +109 -91
  46. package/dist/cli/config-manager.js.map +1 -1
  47. package/dist/hello.js +27 -3
  48. package/dist/hello.js.map +1 -1
  49. package/dist/server.js +194 -0
  50. package/dist/server.js.map +1 -0
  51. package/dist/server.test.js +207 -0
  52. package/dist/server.test.js.map +1 -0
  53. package/package.json +2 -1
  54. package/scripts/docker-build-mcp.sh +155 -0
  55. package/scripts/docker-test-mcp.sh +260 -0
  56. package/scripts/mcp-health-check.sh +123 -0
@@ -1,221 +1,221 @@
1
- #!/bin/bash
2
- #
3
- # Invoke Waiting Mode - Agent Coordination for CFN Loop
4
- # Purpose: Handle coordination between agents using waiting mode and collection
5
- # Usage: invoke-waiting-mode.sh <collect|wait|signal> [task-id] [agent-id] [timeout]
6
- #
7
-
8
- set -euo pipefail
9
-
10
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
- REDIS_COORD_SKILL="$SCRIPT_DIR"
12
-
13
- # Parse arguments
14
- COMMAND=${1:-"collect"}
15
- TASK_ID=${2:-""}
16
- AGENT_ID=${3:-""}
17
- TIMEOUT=${4:-120}
18
-
19
- # Redis configuration
20
- REDIS_HOST=${REDIS_HOST:-"localhost"}
21
- REDIS_PORT=${REDIS_PORT:-6379}
22
- REDIS_DB=${REDIS_DB:-0}
23
-
24
- # Debug output
25
- DEBUG=${DEBUG:-false}
26
- if [[ "$DEBUG" == "true" ]]; then
27
- echo "DEBUG: invoke-waiting-mode called with: $*" >&2
28
- echo "DEBUG: REDIS_HOST=$REDIS_HOST, REDIS_PORT=$REDIS_PORT, REDIS_DB=$REDIS_DB" >&2
29
- fi
30
-
31
- # Function to connect to Redis with error handling
32
- redis_cmd() {
33
- local cmd="$1"
34
- shift
35
-
36
- if command -v redis-cli >/dev/null 2>&1; then
37
- redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_DB" "$cmd" "$@" 2>/dev/null
38
- else
39
- echo "Warning: redis-cli not available, using mock mode" >&2
40
- return 0
41
- fi
42
- }
43
-
44
- # Function to collect agent signals
45
- collect_signals() {
46
- local task_id="$1"
47
- local agent_type="$2"
48
- local timeout="${3:-120}"
49
-
50
- echo "📡 Collecting ${agent_type} signals for task: $task_id (timeout: ${timeout}s)" >&2
51
-
52
- local signals_key="swarm:${task_id}:signals:${agent_type}"
53
- local start_time=$(date +%s)
54
- local signals_collected=()
55
-
56
- while true; do
57
- # Get all available signals
58
- local signals=($(redis_cmd SMEMBERS "$signals_key" 2>/dev/null || echo ""))
59
-
60
- if [[ ${#signals[@]} -gt 0 ]]; then
61
- for signal in "${signals[@]}"; do
62
- if [[ ! " ${signals_collected[@]} " =~ " ${signal} " ]]; then
63
- signals_collected+=("$signal")
64
- echo " ✓ Signal collected: $signal" >&2
65
-
66
- # Get detailed signal data
67
- local signal_key="swarm:${task_id}:agent:${signal}:data"
68
- local signal_data=$(redis_cmd HGETALL "$signal_key" 2>/dev/null || echo "")
69
-
70
- if [[ -n "$signal_data" ]]; then
71
- echo " Data: $signal_data" >&2
72
- fi
73
- fi
74
- done
75
- fi
76
-
77
- # Check if we have all expected signals (this would be based on agent count)
78
- local expected_signals=${EXPECTED_AGENTS:-1}
79
- if [[ ${#signals_collected[@]} -ge $expected_signals ]]; then
80
- echo "✅ All signals collected" >&2
81
- break
82
- fi
83
-
84
- # Check timeout
85
- local current_time=$(date +%s)
86
- if [[ $((current_time - start_time)) -ge $timeout ]]; then
87
- echo "⚠️ Timeout reached, proceeding with collected signals" >&2
88
- break
89
- fi
90
-
91
- sleep 2
92
- done
93
-
94
- # Return collected signals as JSON
95
- local json_output="{"
96
- json_output+="\"task_id\":\"$task_id\","
97
- json_output+="\"agent_type\":\"$agent_type\","
98
- json_output+="\"signals\":["
99
-
100
- for i in "${!signals_collected[@]}"; do
101
- if [[ $i -gt 0 ]]; then
102
- json_output+=","
103
- fi
104
- json_output+='"'"${signals_collected[$i]}"'"'
105
- done
106
-
107
- json_output+="],"
108
- json_output+="\"count\":${#signals_collected[@]},"
109
- json_output+="\"timeout\":$timeout"
110
- json_output+="}"
111
-
112
- echo "$json_output"
113
- }
114
-
115
- # Function to wait for specific condition
116
- wait_for_signal() {
117
- local task_id="$1"
118
- local condition="$2"
119
- local timeout="${3:-120}"
120
-
121
- echo "⏳ Waiting for signal: $condition (timeout: ${timeout}s)" >&2
122
-
123
- local start_time=$(date +%s)
124
- local condition_key="swarm:${task_id}:condition:${condition}"
125
-
126
- while true; do
127
- local condition_met=$(redis_cmd GET "$condition_key" 2>/dev/null || echo "")
128
-
129
- if [[ "$condition_met" == "true" ]]; then
130
- echo "✅ Condition met: $condition" >&2
131
- redis_cmd DEL "$condition_key" 2>/dev/null
132
- echo "true"
133
- return 0
134
- fi
135
-
136
- # Check timeout
137
- local current_time=$(date +%s)
138
- if [[ $((current_time - start_time)) -ge $timeout ]]; then
139
- echo "⚠️ Timeout waiting for: $condition" >&2
140
- echo "false"
141
- return 1
142
- fi
143
-
144
- sleep 2
145
- done
146
- }
147
-
148
- # Function to signal completion
149
- signal_completion() {
150
- local task_id="$1"
151
- local agent_id="$2"
152
- local status="${3:-complete}"
153
-
154
- echo "📤 Signaling completion: $agent_id -> $status" >&2
155
-
156
- # Add to completed set
157
- redis_cmd SADD "swarm:${task_id}:completed" "$agent_id" 2>/dev/null || true
158
-
159
- # Set completion status
160
- redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "status" "$status" 2>/dev/null || true
161
- redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "completed_at" "$(date +%s)" 2>/dev/null || true
162
-
163
- # Broadcast completion signal
164
- redis_cmd PUBLISH "swarm:${task_id}:signals" "agent:$agent_id:status:$status" 2>/dev/null || true
165
-
166
- echo "✅ Signal sent: $agent_id completed"
167
- }
168
-
169
- # Main command routing
170
- case "$COMMAND" in
171
- "collect")
172
- if [[ -z "$TASK_ID" ]]; then
173
- echo "Error: collect command requires task-id" >&2
174
- echo "Usage: $0 collect <task-id> <agent-type> [timeout]" >&2
175
- exit 1
176
- fi
177
- collect_signals "$TASK_ID" "${AGENT_ID:-"loop3"}" "$TIMEOUT"
178
- ;;
179
- "wait")
180
- if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
181
- echo "Error: wait command requires task-id and condition" >&2
182
- echo "Usage: $0 wait <task-id> <condition> [timeout]" >&2
183
- exit 1
184
- fi
185
- wait_for_signal "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
186
- ;;
187
- "signal")
188
- if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
189
- echo "Error: signal command requires task-id and agent-id" >&2
190
- echo "Usage: $0 signal <task-id> <agent-id> [status]" >&2
191
- exit 1
192
- fi
193
- signal_completion "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
194
- ;;
195
- "help"|"-h"|"--help")
196
- cat <<EOF
197
- Usage: $0 <command> [arguments]
198
-
199
- Commands:
200
- collect <task-id> <agent-type> [timeout] Collect signals from agents
201
- wait <task-id> <condition> [timeout] Wait for condition to be met
202
- signal <task-id> <agent-id> [status] Signal agent completion
203
-
204
- Examples:
205
- $0 collect cfn-cli-12345 loop3 300
206
- $0 wait cfn-cli-12345 gate-passed 60
207
- $0 signal cfn-cli-12345 backend-developer-1 complete
208
-
209
- Environment Variables:
210
- REDIS_HOST Redis host (default: localhost)
211
- REDIS_PORT Redis port (default: 6379)
212
- REDIS_DB Redis database (default: 0)
213
- DEBUG Enable debug output (true/false)
214
- EOF
215
- ;;
216
- *)
217
- echo "Error: Unknown command '$COMMAND'" >&2
218
- echo "Use '$0 help' for usage information" >&2
219
- exit 1
220
- ;;
1
+ #!/bin/bash
2
+ #
3
+ # Invoke Waiting Mode - Agent Coordination for CFN Loop
4
+ # Purpose: Handle coordination between agents using waiting mode and collection
5
+ # Usage: invoke-waiting-mode.sh <collect|wait|signal> [task-id] [agent-id] [timeout]
6
+ #
7
+
8
+ set -euo pipefail
9
+
10
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
+ REDIS_COORD_SKILL="$SCRIPT_DIR"
12
+
13
+ # Parse arguments
14
+ COMMAND=${1:-"collect"}
15
+ TASK_ID=${2:-""}
16
+ AGENT_ID=${3:-""}
17
+ TIMEOUT=${4:-120}
18
+
19
+ # Redis configuration
20
+ REDIS_HOST=${REDIS_HOST:-"localhost"}
21
+ REDIS_PORT=${REDIS_PORT:-6379}
22
+ REDIS_DB=${REDIS_DB:-0}
23
+
24
+ # Debug output
25
+ DEBUG=${DEBUG:-false}
26
+ if [[ "$DEBUG" == "true" ]]; then
27
+ echo "DEBUG: invoke-waiting-mode called with: $*" >&2
28
+ echo "DEBUG: REDIS_HOST=$REDIS_HOST, REDIS_PORT=$REDIS_PORT, REDIS_DB=$REDIS_DB" >&2
29
+ fi
30
+
31
+ # Function to connect to Redis with error handling
32
+ redis_cmd() {
33
+ local cmd="$1"
34
+ shift
35
+
36
+ if command -v redis-cli >/dev/null 2>&1; then
37
+ redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_DB" "$cmd" "$@" 2>/dev/null
38
+ else
39
+ echo "Warning: redis-cli not available, using mock mode" >&2
40
+ return 0
41
+ fi
42
+ }
43
+
44
+ # Function to collect agent signals
45
+ collect_signals() {
46
+ local task_id="$1"
47
+ local agent_type="$2"
48
+ local timeout="${3:-120}"
49
+
50
+ echo "📡 Collecting ${agent_type} signals for task: $task_id (timeout: ${timeout}s)" >&2
51
+
52
+ local signals_key="swarm:${task_id}:signals:${agent_type}"
53
+ local start_time=$(date +%s)
54
+ local signals_collected=()
55
+
56
+ while true; do
57
+ # Get all available signals
58
+ local signals=($(redis_cmd SMEMBERS "$signals_key" 2>/dev/null || echo ""))
59
+
60
+ if [[ ${#signals[@]} -gt 0 ]]; then
61
+ for signal in "${signals[@]}"; do
62
+ if [[ ! " ${signals_collected[@]} " =~ " ${signal} " ]]; then
63
+ signals_collected+=("$signal")
64
+ echo " ✓ Signal collected: $signal" >&2
65
+
66
+ # Get detailed signal data
67
+ local signal_key="swarm:${task_id}:agent:${signal}:data"
68
+ local signal_data=$(redis_cmd HGETALL "$signal_key" 2>/dev/null || echo "")
69
+
70
+ if [[ -n "$signal_data" ]]; then
71
+ echo " Data: $signal_data" >&2
72
+ fi
73
+ fi
74
+ done
75
+ fi
76
+
77
+ # Check if we have all expected signals (this would be based on agent count)
78
+ local expected_signals=${EXPECTED_AGENTS:-1}
79
+ if [[ ${#signals_collected[@]} -ge $expected_signals ]]; then
80
+ echo "✅ All signals collected" >&2
81
+ break
82
+ fi
83
+
84
+ # Check timeout
85
+ local current_time=$(date +%s)
86
+ if [[ $((current_time - start_time)) -ge $timeout ]]; then
87
+ echo "⚠️ Timeout reached, proceeding with collected signals" >&2
88
+ break
89
+ fi
90
+
91
+ sleep 2
92
+ done
93
+
94
+ # Return collected signals as JSON
95
+ local json_output="{"
96
+ json_output+="\"task_id\":\"$task_id\","
97
+ json_output+="\"agent_type\":\"$agent_type\","
98
+ json_output+="\"signals\":["
99
+
100
+ for i in "${!signals_collected[@]}"; do
101
+ if [[ $i -gt 0 ]]; then
102
+ json_output+=","
103
+ fi
104
+ json_output+='"'"${signals_collected[$i]}"'"'
105
+ done
106
+
107
+ json_output+="],"
108
+ json_output+="\"count\":${#signals_collected[@]},"
109
+ json_output+="\"timeout\":$timeout"
110
+ json_output+="}"
111
+
112
+ echo "$json_output"
113
+ }
114
+
115
+ # Function to wait for specific condition
116
+ wait_for_signal() {
117
+ local task_id="$1"
118
+ local condition="$2"
119
+ local timeout="${3:-120}"
120
+
121
+ echo "⏳ Waiting for signal: $condition (timeout: ${timeout}s)" >&2
122
+
123
+ local start_time=$(date +%s)
124
+ local condition_key="swarm:${task_id}:condition:${condition}"
125
+
126
+ while true; do
127
+ local condition_met=$(redis_cmd GET "$condition_key" 2>/dev/null || echo "")
128
+
129
+ if [[ "$condition_met" == "true" ]]; then
130
+ echo "✅ Condition met: $condition" >&2
131
+ redis_cmd DEL "$condition_key" 2>/dev/null
132
+ echo "true"
133
+ return 0
134
+ fi
135
+
136
+ # Check timeout
137
+ local current_time=$(date +%s)
138
+ if [[ $((current_time - start_time)) -ge $timeout ]]; then
139
+ echo "⚠️ Timeout waiting for: $condition" >&2
140
+ echo "false"
141
+ return 1
142
+ fi
143
+
144
+ sleep 2
145
+ done
146
+ }
147
+
148
+ # Function to signal completion
149
+ signal_completion() {
150
+ local task_id="$1"
151
+ local agent_id="$2"
152
+ local status="${3:-complete}"
153
+
154
+ echo "📤 Signaling completion: $agent_id -> $status" >&2
155
+
156
+ # Add to completed set
157
+ redis_cmd SADD "swarm:${task_id}:completed" "$agent_id" 2>/dev/null || true
158
+
159
+ # Set completion status
160
+ redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "status" "$status" 2>/dev/null || true
161
+ redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "completed_at" "$(date +%s)" 2>/dev/null || true
162
+
163
+ # Broadcast completion signal
164
+ redis_cmd PUBLISH "swarm:${task_id}:signals" "agent:$agent_id:status:$status" 2>/dev/null || true
165
+
166
+ echo "✅ Signal sent: $agent_id completed"
167
+ }
168
+
169
+ # Main command routing
170
+ case "$COMMAND" in
171
+ "collect")
172
+ if [[ -z "$TASK_ID" ]]; then
173
+ echo "Error: collect command requires task-id" >&2
174
+ echo "Usage: $0 collect <task-id> <agent-type> [timeout]" >&2
175
+ exit 1
176
+ fi
177
+ collect_signals "$TASK_ID" "${AGENT_ID:-"loop3"}" "$TIMEOUT"
178
+ ;;
179
+ "wait")
180
+ if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
181
+ echo "Error: wait command requires task-id and condition" >&2
182
+ echo "Usage: $0 wait <task-id> <condition> [timeout]" >&2
183
+ exit 1
184
+ fi
185
+ wait_for_signal "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
186
+ ;;
187
+ "signal")
188
+ if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
189
+ echo "Error: signal command requires task-id and agent-id" >&2
190
+ echo "Usage: $0 signal <task-id> <agent-id> [status]" >&2
191
+ exit 1
192
+ fi
193
+ signal_completion "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
194
+ ;;
195
+ "help"|"-h"|"--help")
196
+ cat <<EOF
197
+ Usage: $0 <command> [arguments]
198
+
199
+ Commands:
200
+ collect <task-id> <agent-type> [timeout] Collect signals from agents
201
+ wait <task-id> <condition> [timeout] Wait for condition to be met
202
+ signal <task-id> <agent-id> [status] Signal agent completion
203
+
204
+ Examples:
205
+ $0 collect cfn-cli-12345 loop3 300
206
+ $0 wait cfn-cli-12345 gate-passed 60
207
+ $0 signal cfn-cli-12345 backend-developer-1 complete
208
+
209
+ Environment Variables:
210
+ REDIS_HOST Redis host (default: localhost)
211
+ REDIS_PORT Redis port (default: 6379)
212
+ REDIS_DB Redis database (default: 0)
213
+ DEBUG Enable debug output (true/false)
214
+ EOF
215
+ ;;
216
+ *)
217
+ echo "Error: Unknown command '$COMMAND'" >&2
218
+ echo "Use '$0 help' for usage information" >&2
219
+ exit 1
220
+ ;;
221
221
  esac
@@ -186,8 +186,8 @@ select_agents() {
186
186
  fi
187
187
 
188
188
  # Loop 2 validators (adaptive scaling)
189
- # Standard: 3-5 files → add system-architect, security
190
- loop2+=("system-architect" "security-specialist")
189
+ # Standard: 3-5 files → add architect, security
190
+ loop2+=("architect" "security-specialist")
191
191
 
192
192
  # Complex/Enterprise: >5 files → add code-analyzer
193
193
  if echo "$description" | grep -iq "large\|complex\|enterprise"; then