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.
- package/.claude/commands/CFN_LOOP_TASK_MODE.md +1 -1
- package/.claude/commands/cfn-loop-cli.md +491 -456
- package/.claude/commands/switch-api.md +1 -1
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
- package/.claude/skills/cfn-loop-validation/config.json +2 -2
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +220 -220
- package/claude-assets/agents/README-AGENT_LIFECYCLE.md +37 -10
- package/claude-assets/agents/README-VALIDATION.md +0 -8
- package/claude-assets/agents/cfn-dev-team/README.md +0 -8
- package/claude-assets/agents/cfn-dev-team/coordinators/README.md +1 -9
- package/claude-assets/agents/cfn-dev-team/developers/README.md +1 -9
- package/claude-assets/agents/cfn-dev-team/documentation/README-VALIDATION.md +0 -8
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +0 -10
- package/claude-assets/agents/cfn-dev-team/reviewers/README.md +1 -9
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +0 -10
- package/claude-assets/agents/cfn-dev-team/test-agent.md +0 -10
- package/claude-assets/agents/cfn-dev-team/testers/README.md +1 -9
- package/claude-assets/agents/csuite/cto-agent.md +0 -10
- package/claude-assets/agents/custom/cfn-system-expert.md +1 -128
- package/claude-assets/agents/custom/claude-code-expert.md +151 -2
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +39 -3
- package/claude-assets/agents/docker-team/csuite/c-suite-template.md +1 -5
- package/claude-assets/agents/docker-team/infrastructure/team-coordinator-template.md +1 -5
- package/claude-assets/agents/marketing_hybrid/cost_tracker.md +0 -10
- package/claude-assets/agents/marketing_hybrid/docker_deployer.md +0 -10
- package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +0 -10
- package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +1 -1
- package/claude-assets/commands/cfn-loop-cli.md +491 -456
- package/claude-assets/commands/switch-api.md +1 -1
- package/claude-assets/skills/cfn-error-logging/SKILL.md +339 -0
- package/claude-assets/skills/cfn-error-logging/cleanup-error-logs.sh +334 -0
- package/claude-assets/skills/cfn-error-logging/integrate-cli.sh +232 -0
- package/claude-assets/skills/cfn-error-logging/integrate-docker.sh +294 -0
- package/claude-assets/skills/cfn-error-logging/invoke-error-logging.sh +839 -0
- package/claude-assets/skills/cfn-error-logging/test-error-logging.sh +475 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
- package/claude-assets/skills/cfn-loop-validation/config.json +2 -2
- package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +326 -322
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +220 -220
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +2 -2
- package/claude-assets/skills/cfn-task-mode-sanitize/task-mode-env-sanitizer.sh +224 -181
- package/claude-assets/skills/cfn-validation-runner-instrumentation/wrapped-executor.sh +235 -271
- package/dist/agents/agent-loader.js +467 -133
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/config-manager.js +109 -91
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/hello.js +27 -3
- package/dist/hello.js.map +1 -1
- package/dist/server.js +194 -0
- package/dist/server.js.map +1 -0
- package/dist/server.test.js +207 -0
- package/dist/server.test.js.map +1 -0
- package/package.json +2 -1
- package/scripts/docker-build-mcp.sh +155 -0
- package/scripts/docker-test-mcp.sh +260 -0
- package/scripts/mcp-health-check.sh +123 -0
|
@@ -15,7 +15,7 @@ Switch Main Chat and Task() tool API provider between Z.ai (cost-optimized) and
|
|
|
15
15
|
**Arguments:**
|
|
16
16
|
- `status` - Show current routing configuration (default)
|
|
17
17
|
- `zai` - Route Main Chat + Task tool to Z.ai for cost savings
|
|
18
|
-
- `max` - Route Main Chat + Task tool to Anthropic for quality
|
|
18
|
+
- `max` or `claude` - Route Main Chat + Task tool to Anthropic for quality
|
|
19
19
|
|
|
20
20
|
**What This Does:**
|
|
21
21
|
|
|
@@ -23,7 +23,8 @@ set -euo pipefail
|
|
|
23
23
|
|
|
24
24
|
# Determine PROJECT_ROOT first before any other operations
|
|
25
25
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
|
-
|
|
26
|
+
# Fixed path resolution - go up 4 levels from cfn-loop-orchestration to project root (.claude/skills/cfn-loop-orchestration -> .claude/skills -> .claude -> project root)
|
|
27
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
27
28
|
|
|
28
29
|
# ⚠️ ANTI-023 MEMORY LEAK PROTECTION:
|
|
29
30
|
# Task Mode validation moved to after argument parsing at line 276
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"security-specialist",
|
|
56
56
|
"tester",
|
|
57
57
|
"analyst",
|
|
58
|
-
"
|
|
58
|
+
"architect"
|
|
59
59
|
],
|
|
60
60
|
"productOwnerStructure": "team",
|
|
61
61
|
"planningConsensus": {
|
|
62
62
|
"enabled": true,
|
|
63
|
-
"architectTypes": ["system-architect", "security-specialist"],
|
|
63
|
+
"architectTypes": ["architect", "system-architect", "security-specialist"],
|
|
64
64
|
"threshold": 0.85
|
|
65
65
|
},
|
|
66
66
|
"productOwnerTeam": {
|
|
@@ -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
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: readme-agent-lifecycle
|
|
3
|
-
description: Documentation file for agent lifecycle management and CFN loop protocols
|
|
4
|
-
tools: []
|
|
5
|
-
model: haiku
|
|
6
|
-
type: documentation
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Agent Lifecycle Documentation
|
|
10
2
|
|
|
11
3
|
**Version:** 2.0 (Post-Waiting Mode Removal)
|
|
@@ -60,6 +52,15 @@ This document clarifies the complete lifecycle of agents in the CFN Loop system,
|
|
|
60
52
|
2. **Report confidence:**
|
|
61
53
|
```bash
|
|
62
54
|
./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
|
|
55
|
+
|
|
56
|
+
**After reporting, exit cleanly. Do NOT enter waiting mode.**
|
|
57
|
+
|
|
58
|
+
**Why This Matters:**
|
|
59
|
+
- Orchestrator collects confidence/consensus scores from Redis
|
|
60
|
+
- Enables adaptive agent specialization for next iteration
|
|
61
|
+
- Prevents orchestrator blocking on wait $PID
|
|
62
|
+
- Coordinator spawns appropriate specialist based on feedback type
|
|
63
|
+
|
|
63
64
|
--task-id "$TASK_ID" \
|
|
64
65
|
--agent-id "$AGENT_ID" \
|
|
65
66
|
--confidence [0.0-1.0] \
|
|
@@ -105,6 +106,15 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
|
|
|
105
106
|
### Step 3: Report Confidence Score
|
|
106
107
|
```bash
|
|
107
108
|
./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
|
|
109
|
+
|
|
110
|
+
**After reporting, exit cleanly. Do NOT enter waiting mode.**
|
|
111
|
+
|
|
112
|
+
**Why This Matters:**
|
|
113
|
+
- Orchestrator collects confidence/consensus scores from Redis
|
|
114
|
+
- Enables adaptive agent specialization for next iteration
|
|
115
|
+
- Prevents orchestrator blocking on wait $PID
|
|
116
|
+
- Coordinator spawns appropriate specialist based on feedback type
|
|
117
|
+
|
|
108
118
|
--task-id "$TASK_ID" \
|
|
109
119
|
--agent-id "$AGENT_ID" \
|
|
110
120
|
--confidence [0.0-1.0] \
|
|
@@ -155,6 +165,15 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
|
|
|
155
165
|
### Step 5: Report Consensus Score
|
|
156
166
|
```bash
|
|
157
167
|
./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
|
|
168
|
+
|
|
169
|
+
**After reporting, exit cleanly. Do NOT enter waiting mode.**
|
|
170
|
+
|
|
171
|
+
**Why This Matters:**
|
|
172
|
+
- Orchestrator collects confidence/consensus scores from Redis
|
|
173
|
+
- Enables adaptive agent specialization for next iteration
|
|
174
|
+
- Prevents orchestrator blocking on wait $PID
|
|
175
|
+
- Coordinator spawns appropriate specialist based on feedback type
|
|
176
|
+
|
|
158
177
|
--task-id "$TASK_ID" \
|
|
159
178
|
--agent-id "$AGENT_ID" \
|
|
160
179
|
--confidence [0.0-1.0] \
|
|
@@ -280,7 +299,6 @@ CONFIDENCE=$(redis-cli get "swarm:${TASK_ID}:${AGENT_ID}:confidence")
|
|
|
280
299
|
### ❌ Anti-Pattern 1: Waiting Mode
|
|
281
300
|
```bash
|
|
282
301
|
# WRONG - DO NOT USE:
|
|
283
|
-
./.claude/skills/redis-coordination/invoke-waiting-mode.sh wait \
|
|
284
302
|
--task-id "$TASK_ID" \
|
|
285
303
|
--agent-id "$AGENT_ID"
|
|
286
304
|
```
|
|
@@ -328,6 +346,15 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
|
|
|
328
346
|
|
|
329
347
|
# Step 2: Report confidence
|
|
330
348
|
./.claude/skills/redis-coordination/invoke-waiting-mode.sh report \
|
|
349
|
+
|
|
350
|
+
**After reporting, exit cleanly. Do NOT enter waiting mode.**
|
|
351
|
+
|
|
352
|
+
**Why This Matters:**
|
|
353
|
+
- Orchestrator collects confidence/consensus scores from Redis
|
|
354
|
+
- Enables adaptive agent specialization for next iteration
|
|
355
|
+
- Prevents orchestrator blocking on wait $PID
|
|
356
|
+
- Coordinator spawns appropriate specialist based on feedback type
|
|
357
|
+
|
|
331
358
|
--task-id "$TASK_ID" \
|
|
332
359
|
--agent-id "$AGENT_ID" \
|
|
333
360
|
--confidence 0.95 \
|
|
@@ -492,4 +519,4 @@ swarm:{TASK_ID}:metrics:iteration_start → List of timestamps
|
|
|
492
519
|
|
|
493
520
|
**Version History:**
|
|
494
521
|
- v1.0: Original with waiting mode
|
|
495
|
-
- v2.0 (2025-10-21): Waiting mode removed, PATTERN-022 compliant
|
|
522
|
+
- v2.0 (2025-10-21): Waiting mode removed, PATTERN-022 compliant
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: readme-validation-main
|
|
3
|
-
description: Documentation file for agent profile validation tool and standards compliance
|
|
4
|
-
tools: []
|
|
5
|
-
model: haiku
|
|
6
|
-
type: documentation
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Agent Profile Validation Tool
|
|
10
2
|
|
|
11
3
|
A comprehensive validation script that checks agent profiles against CLAUDE.md standards and provides actionable feedback.
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: coordinators-readme
|
|
3
|
-
description: Documentation file for CFN dev team coordinators overview and usage patterns
|
|
4
|
-
tools: []
|
|
5
|
-
model: haiku
|
|
6
|
-
type: documentation
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Coordinators
|
|
10
2
|
|
|
11
3
|
Agent profiles for coordination and orchestration of multi-agent workflows.
|
|
@@ -47,4 +39,4 @@ Coordinator handles all agent spawning internally via orchestration scripts.
|
|
|
47
39
|
## Related Skills
|
|
48
40
|
- `.claude/skills/cfn-redis-coordination/` - Multi-agent coordination patterns
|
|
49
41
|
- `.claude/skills/cfn-loop-validation/` - CFN Loop mechanics
|
|
50
|
-
- `.claude/skills/cfn-agent-spawning/` - CLI spawning patterns
|
|
42
|
+
- `.claude/skills/cfn-agent-spawning/` - CLI spawning patterns
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: developers-readme
|
|
3
|
-
description: Documentation file for CFN dev team developers overview and implementation standards
|
|
4
|
-
tools: []
|
|
5
|
-
model: haiku
|
|
6
|
-
type: documentation
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Developers
|
|
10
2
|
|
|
11
3
|
Implementation agents focused on building features and components.
|
|
@@ -74,4 +66,4 @@ Developers MUST run after every file edit:
|
|
|
74
66
|
./.claude/hooks/cfn-invoke-post-edit.sh "$EDITED_FILE" --agent-id "$AGENT_ID"
|
|
75
67
|
```
|
|
76
68
|
|
|
77
|
-
This ensures code quality, test coverage, and security validation.
|
|
69
|
+
This ensures code quality, test coverage, and security validation.
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: readme-validation
|
|
3
|
-
description: Documentation file for agent profile validation tool usage and standards
|
|
4
|
-
tools: []
|
|
5
|
-
model: haiku
|
|
6
|
-
type: documentation
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Agent Profile Validation Tool
|
|
10
2
|
|
|
11
3
|
A comprehensive validation script that checks agent profiles against CLAUDE.md standards and provides actionable feedback.
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agent-type-guidelines
|
|
3
|
-
description: MUST BE USED when creating agent type guidelines and documentation. Use PROACTIVELY for agent architecture, type definitions, development standards. Keywords - agent, guidelines, types, architecture, development
|
|
4
|
-
tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
|
|
5
|
-
model: sonnet
|
|
6
|
-
type: specialist
|
|
7
|
-
acl_level: 2
|
|
8
|
-
capabilities: [agent-documentation, type-guidelines, architecture-standards]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
1
|
# Agent Type Guidelines
|
|
12
2
|
|
|
13
3
|
**Version:** 2.0.0
|