claude-flow-novice 2.14.3 → 2.14.5

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 (194) hide show
  1. package/.claude/commands/CFN_LOOP_TASK_MODE.md +4 -47
  2. package/.claude/commands/seo/SEO_TASK_MODE.md +892 -0
  3. package/.claude/commands/seo/seo-blog.md +428 -0
  4. package/.claude/commands/seo/seo-landing.md +91 -0
  5. package/.claude/commands/seo/seo-product.md +104 -0
  6. package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -276
  7. package/claude-assets/agents/cfn-dev-team/coordinators/epic-creator.md +120 -0
  8. package/claude-assets/agents/cfn-seo-team/AGENT_CREATION_REPORT.md +481 -0
  9. package/claude-assets/agents/cfn-seo-team/DELEGATION_MATRIX.md +371 -0
  10. package/claude-assets/agents/cfn-seo-team/HUMANIZER_PROMPTS.md +536 -0
  11. package/claude-assets/agents/cfn-seo-team/INTEGRATION_REQUIREMENTS.md +642 -0
  12. package/claude-assets/agents/cfn-seo-team/cfn-seo-coordinator.md +414 -0
  13. package/claude-assets/agents/cfn-seo-team/competitive-seo-analyst.md +423 -0
  14. package/claude-assets/agents/cfn-seo-team/content-atomization-specialist.md +580 -0
  15. package/claude-assets/agents/cfn-seo-team/content-seo-strategist.md +245 -0
  16. package/claude-assets/agents/cfn-seo-team/eeat-content-auditor.md +389 -0
  17. package/claude-assets/agents/cfn-seo-team/geo-optimization-expert.md +269 -0
  18. package/claude-assets/agents/cfn-seo-team/link-building-specialist.md +291 -0
  19. package/claude-assets/agents/cfn-seo-team/local-seo-optimizer.md +333 -0
  20. package/claude-assets/agents/cfn-seo-team/programmatic-seo-engineer.md +244 -0
  21. package/claude-assets/agents/cfn-seo-team/schema-markup-engineer.md +430 -0
  22. package/claude-assets/agents/cfn-seo-team/seo-analytics-specialist.md +376 -0
  23. package/claude-assets/agents/cfn-seo-team/seo-validators/accessibility-validator.md +565 -0
  24. package/claude-assets/agents/cfn-seo-team/seo-validators/audience-validator.md +484 -0
  25. package/claude-assets/agents/cfn-seo-team/seo-validators/branding-validator.md +452 -0
  26. package/claude-assets/agents/cfn-seo-team/seo-validators/humanizer-validator.md +333 -0
  27. package/claude-assets/agents/cfn-seo-team/technical-seo-specialist.md +228 -0
  28. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +4 -47
  29. package/claude-assets/commands/seo/SEO_TASK_MODE.md +892 -0
  30. package/claude-assets/commands/seo/seo-blog.md +428 -0
  31. package/claude-assets/commands/seo/seo-landing.md +91 -0
  32. package/claude-assets/commands/seo/seo-product.md +104 -0
  33. package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -276
  34. package/claude-assets/skills/seo-orchestration/SKILL.md +292 -0
  35. package/claude-assets/skills/seo-orchestration/orchestrate-seo.sh +566 -0
  36. package/claude-assets/skills/seo-orchestration/orchestrate-seo.sh.backup +755 -0
  37. package/claude-assets/skills/seo-orchestration/validate-consensus.sh +270 -0
  38. package/dist/agents/agent-loader.js +165 -146
  39. package/dist/agents/agent-loader.js.map +1 -1
  40. package/dist/cli/agent-prompt-builder.js +25 -0
  41. package/dist/cli/agent-prompt-builder.js.map +1 -1
  42. package/package.json +1 -1
  43. package/.claude/skills/cfn-redis-coordination/HEARTBEAT.md +0 -57
  44. package/.claude/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +0 -267
  45. package/.claude/skills/cfn-redis-coordination/LOGGING.md +0 -260
  46. package/.claude/skills/cfn-redis-coordination/README.md +0 -65
  47. package/.claude/skills/cfn-redis-coordination/SECURITY_REVIEW.md +0 -25
  48. package/.claude/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +0 -164
  49. package/.claude/skills/cfn-redis-coordination/SKILL.md +0 -720
  50. package/.claude/skills/cfn-redis-coordination/demos/test-dlq.sh +0 -129
  51. package/.claude/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +0 -320
  52. package/.claude/skills/cfn-redis-coordination/demos/test-orchestrator.sh +0 -249
  53. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +0 -148
  54. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +0 -163
  55. package/.claude/skills/cfn-redis-coordination/demos/test-priority-wake.sh +0 -138
  56. package/.claude/skills/cfn-redis-coordination/demos/test-quick-fix.sh +0 -81
  57. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +0 -45
  58. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +0 -68
  59. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +0 -56
  60. package/.claude/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +0 -81
  61. package/.claude/skills/cfn-redis-coordination/demos/test-quorum.sh +0 -57
  62. package/.claude/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +0 -187
  63. package/.claude/skills/cfn-redis-coordination/demos/test-shutdown.sh +0 -160
  64. package/.claude/skills/cfn-redis-coordination/demos/test-utils-unix.sh +0 -97
  65. package/.claude/skills/cfn-redis-coordination/demos/test-utils.sh +0 -97
  66. package/.claude/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +0 -59
  67. package/.claude/skills/cfn-redis-coordination/examples/README.md +0 -73
  68. package/.claude/skills/cfn-redis-coordination/examples/grafana-dashboard.json +0 -352
  69. package/.claude/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +0 -127
  70. package/.claude/skills/cfn-redis-coordination/examples/mesh-pattern.sh +0 -171
  71. package/.claude/skills/cfn-redis-coordination/examples/timeout-handling.sh +0 -227
  72. package/.claude/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +0 -239
  73. package/.claude/skills/cfn-redis-coordination/execute-product-owner-decision.sh +0 -258
  74. package/.claude/skills/cfn-redis-coordination/get-agent-timeout.sh +0 -177
  75. package/.claude/skills/cfn-redis-coordination/heartbeat-functions.sh +0 -137
  76. package/.claude/skills/cfn-redis-coordination/heartbeat-protocol.md +0 -106
  77. package/.claude/skills/cfn-redis-coordination/heartbeat.sh +0 -126
  78. package/.claude/skills/cfn-redis-coordination/init-swarm.sh +0 -148
  79. package/.claude/skills/cfn-redis-coordination/invoke-redis-pattern.sh +0 -220
  80. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +0 -283
  81. package/.claude/skills/cfn-redis-coordination/list-active-swarms.sh +0 -147
  82. package/.claude/skills/cfn-redis-coordination/log-event.sh +0 -109
  83. package/.claude/skills/cfn-redis-coordination/metrics-export.sh +0 -674
  84. package/.claude/skills/cfn-redis-coordination/metrics-schema.json +0 -66
  85. package/.claude/skills/cfn-redis-coordination/metrics-storage.md +0 -31
  86. package/.claude/skills/cfn-redis-coordination/monitor-cfn-violations.sh +0 -391
  87. package/.claude/skills/cfn-redis-coordination/monitor-heartbeats.sh +0 -101
  88. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +0 -141
  89. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +0 -31
  90. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  91. package/.claude/skills/cfn-redis-coordination/priority-wake-mechanism.md +0 -75
  92. package/.claude/skills/cfn-redis-coordination/priority_wake.py +0 -134
  93. package/.claude/skills/cfn-redis-coordination/query-dlq.sh +0 -162
  94. package/.claude/skills/cfn-redis-coordination/query-logs.sh +0 -103
  95. package/.claude/skills/cfn-redis-coordination/redis-pattern.sh +0 -619
  96. package/.claude/skills/cfn-redis-coordination/retrieve-context.sh +0 -58
  97. package/.claude/skills/cfn-redis-coordination/select-specialist-agent.sh +0 -371
  98. package/.claude/skills/cfn-redis-coordination/semantic-match-tfidf.py +0 -252
  99. package/.claude/skills/cfn-redis-coordination/send-heartbeat.sh +0 -165
  100. package/.claude/skills/cfn-redis-coordination/signal.sh +0 -38
  101. package/.claude/skills/cfn-redis-coordination/store-context.sh +0 -86
  102. package/.claude/skills/cfn-redis-coordination/store-epic-context.sh +0 -123
  103. package/.claude/skills/cfn-redis-coordination/test-context-injection.sh +0 -354
  104. package/.claude/skills/cfn-redis-coordination/test-timeout-enforcement.sh +0 -513
  105. package/.claude/skills/cfn-redis-coordination/tests/convert-line-endings.sh +0 -15
  106. package/.claude/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +0 -102
  107. package/.claude/skills/cfn-redis-coordination/tests/edge-cases-test.sh +0 -99
  108. package/.claude/skills/cfn-redis-coordination/tests/integration-test.sh +0 -170
  109. package/.claude/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +0 -82
  110. package/.claude/skills/cfn-redis-coordination/tests/run-test-suite.sh +0 -92
  111. package/.claude/skills/cfn-redis-coordination/tests/run-tests.sh +0 -4
  112. package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +0 -418
  113. package/.claude/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +0 -124
  114. package/.claude/skills/cfn-redis-coordination/tests/test-primitives.sh +0 -166
  115. package/.claude/skills/cfn-redis-coordination/tests/test-utils.sh +0 -54
  116. package/.claude/skills/cfn-redis-coordination/tests/test_utils.sh +0 -49
  117. package/.claude/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +0 -76
  118. package/.claude/skills/cfn-redis-coordination/validate-parameters.sh +0 -492
  119. package/claude-assets/skills/cfn-redis-coordination/HEARTBEAT.md +0 -57
  120. package/claude-assets/skills/cfn-redis-coordination/HEARTBEAT_MONITORING.md +0 -267
  121. package/claude-assets/skills/cfn-redis-coordination/LOGGING.md +0 -260
  122. package/claude-assets/skills/cfn-redis-coordination/README.md +0 -65
  123. package/claude-assets/skills/cfn-redis-coordination/SECURITY_REVIEW.md +0 -25
  124. package/claude-assets/skills/cfn-redis-coordination/SHUTDOWN_HANDLING.md +0 -164
  125. package/claude-assets/skills/cfn-redis-coordination/SKILL.md +0 -720
  126. package/claude-assets/skills/cfn-redis-coordination/demos/test-dlq.sh +0 -129
  127. package/claude-assets/skills/cfn-redis-coordination/demos/test-iteration-feedback.sh +0 -320
  128. package/claude-assets/skills/cfn-redis-coordination/demos/test-orchestrator.sh +0 -249
  129. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake-phase4-unix.sh +0 -148
  130. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake-phase4.sh +0 -163
  131. package/claude-assets/skills/cfn-redis-coordination/demos/test-priority-wake.sh +0 -138
  132. package/claude-assets/skills/cfn-redis-coordination/demos/test-quick-fix.sh +0 -81
  133. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-absolute.sh +0 -45
  134. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-fallback.sh +0 -68
  135. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-percentage.sh +0 -56
  136. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum-with-retry.sh +0 -81
  137. package/claude-assets/skills/cfn-redis-coordination/demos/test-quorum.sh +0 -57
  138. package/claude-assets/skills/cfn-redis-coordination/demos/test-shutdown-handling.sh +0 -187
  139. package/claude-assets/skills/cfn-redis-coordination/demos/test-shutdown.sh +0 -160
  140. package/claude-assets/skills/cfn-redis-coordination/demos/test-utils-unix.sh +0 -97
  141. package/claude-assets/skills/cfn-redis-coordination/demos/test-utils.sh +0 -97
  142. package/claude-assets/skills/cfn-redis-coordination/demos/test-waiting-mode.sh +0 -59
  143. package/claude-assets/skills/cfn-redis-coordination/examples/README.md +0 -73
  144. package/claude-assets/skills/cfn-redis-coordination/examples/grafana-dashboard.json +0 -352
  145. package/claude-assets/skills/cfn-redis-coordination/examples/hierarchical-pattern.sh +0 -127
  146. package/claude-assets/skills/cfn-redis-coordination/examples/mesh-pattern.sh +0 -171
  147. package/claude-assets/skills/cfn-redis-coordination/examples/timeout-handling.sh +0 -227
  148. package/claude-assets/skills/cfn-redis-coordination/examples/waiting-mode-pattern.sh +0 -239
  149. package/claude-assets/skills/cfn-redis-coordination/execute-product-owner-decision.sh +0 -258
  150. package/claude-assets/skills/cfn-redis-coordination/get-agent-timeout.sh +0 -177
  151. package/claude-assets/skills/cfn-redis-coordination/heartbeat-functions.sh +0 -137
  152. package/claude-assets/skills/cfn-redis-coordination/heartbeat-protocol.md +0 -106
  153. package/claude-assets/skills/cfn-redis-coordination/heartbeat.sh +0 -126
  154. package/claude-assets/skills/cfn-redis-coordination/init-swarm.sh +0 -148
  155. package/claude-assets/skills/cfn-redis-coordination/invoke-redis-pattern.sh +0 -220
  156. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +0 -283
  157. package/claude-assets/skills/cfn-redis-coordination/list-active-swarms.sh +0 -147
  158. package/claude-assets/skills/cfn-redis-coordination/log-event.sh +0 -109
  159. package/claude-assets/skills/cfn-redis-coordination/metrics-export.sh +0 -674
  160. package/claude-assets/skills/cfn-redis-coordination/metrics-schema.json +0 -66
  161. package/claude-assets/skills/cfn-redis-coordination/metrics-storage.md +0 -31
  162. package/claude-assets/skills/cfn-redis-coordination/monitor-cfn-violations.sh +0 -391
  163. package/claude-assets/skills/cfn-redis-coordination/monitor-heartbeats.sh +0 -101
  164. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop-v3.sh +0 -141
  165. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh +0 -31
  166. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  167. package/claude-assets/skills/cfn-redis-coordination/priority-wake-mechanism.md +0 -75
  168. package/claude-assets/skills/cfn-redis-coordination/priority_wake.py +0 -134
  169. package/claude-assets/skills/cfn-redis-coordination/query-dlq.sh +0 -162
  170. package/claude-assets/skills/cfn-redis-coordination/query-logs.sh +0 -103
  171. package/claude-assets/skills/cfn-redis-coordination/redis-pattern.sh +0 -619
  172. package/claude-assets/skills/cfn-redis-coordination/retrieve-context.sh +0 -58
  173. package/claude-assets/skills/cfn-redis-coordination/select-specialist-agent.sh +0 -371
  174. package/claude-assets/skills/cfn-redis-coordination/semantic-match-tfidf.py +0 -252
  175. package/claude-assets/skills/cfn-redis-coordination/send-heartbeat.sh +0 -165
  176. package/claude-assets/skills/cfn-redis-coordination/signal.sh +0 -38
  177. package/claude-assets/skills/cfn-redis-coordination/store-context.sh +0 -86
  178. package/claude-assets/skills/cfn-redis-coordination/store-epic-context.sh +0 -123
  179. package/claude-assets/skills/cfn-redis-coordination/test-context-injection.sh +0 -354
  180. package/claude-assets/skills/cfn-redis-coordination/test-timeout-enforcement.sh +0 -513
  181. package/claude-assets/skills/cfn-redis-coordination/tests/convert-line-endings.sh +0 -15
  182. package/claude-assets/skills/cfn-redis-coordination/tests/dlq-functionality-test.sh +0 -102
  183. package/claude-assets/skills/cfn-redis-coordination/tests/edge-cases-test.sh +0 -99
  184. package/claude-assets/skills/cfn-redis-coordination/tests/integration-test.sh +0 -170
  185. package/claude-assets/skills/cfn-redis-coordination/tests/retry-mechanism-test.sh +0 -82
  186. package/claude-assets/skills/cfn-redis-coordination/tests/run-test-suite.sh +0 -92
  187. package/claude-assets/skills/cfn-redis-coordination/tests/run-tests.sh +0 -4
  188. package/claude-assets/skills/cfn-redis-coordination/tests/test-heartbeat-monitoring.sh +0 -418
  189. package/claude-assets/skills/cfn-redis-coordination/tests/test-heartbeat-simple.sh +0 -124
  190. package/claude-assets/skills/cfn-redis-coordination/tests/test-primitives.sh +0 -166
  191. package/claude-assets/skills/cfn-redis-coordination/tests/test-utils.sh +0 -54
  192. package/claude-assets/skills/cfn-redis-coordination/tests/test_utils.sh +0 -49
  193. package/claude-assets/skills/cfn-redis-coordination/v2_modularization/core_orchestration.sh +0 -76
  194. package/claude-assets/skills/cfn-redis-coordination/validate-parameters.sh +0 -492
@@ -0,0 +1,270 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # SEO Consensus Validation Script
5
+ # Version: 1.0.0
6
+ #
7
+ # Validates SEO consensus scores against thresholds and quorum requirements.
8
+ # Used to determine if SEO optimizations meet quality standards.
9
+ ##############################################################################
10
+
11
+ set -euo pipefail
12
+
13
+ # Configuration
14
+ TASK_ID=""
15
+ AGENTS=""
16
+ THRESHOLD="0.80"
17
+ MIN_QUORUM="0.66"
18
+
19
+ # Script directory
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../" && pwd)"
22
+
23
+ # Logging
24
+ log() {
25
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] SEO-VALIDATE-CONSENSUS: $*" >&2
26
+ }
27
+
28
+ error() {
29
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] SEO-VALIDATE-CONSENSUS ERROR: $*" >&2
30
+ exit 1
31
+ }
32
+
33
+ # Display usage
34
+ usage() {
35
+ cat << EOF
36
+ SEO Consensus Validation
37
+
38
+ Usage: $0 [OPTIONS]
39
+
40
+ Required Options:
41
+ --task-id <id> Unique identifier for SEO task
42
+ --agents <agents> Comma-separated list of SEO agent IDs
43
+ --threshold <value> Minimum confidence threshold (0.0-1.0)
44
+ --min-quorum <value> Minimum quorum (n, n%, or 0.n format)
45
+
46
+ Optional Options:
47
+ --help Show this help message
48
+
49
+ Examples:
50
+ $0 --task-id seo-001 --agents seo-analyst,content-writer --threshold 0.75 --min-quorum 0.66
51
+
52
+ EOF
53
+ }
54
+
55
+ # Parse command line arguments
56
+ parse_args() {
57
+ while [[ $# -gt 0 ]]; do
58
+ case $1 in
59
+ --task-id)
60
+ TASK_ID="$2"
61
+ shift 2
62
+ ;;
63
+ --agents)
64
+ AGENTS="$2"
65
+ shift 2
66
+ ;;
67
+ --threshold)
68
+ THRESHOLD="$2"
69
+ shift 2
70
+ ;;
71
+ --min-quorum)
72
+ MIN_QUORUM="$2"
73
+ shift 2
74
+ ;;
75
+ --help)
76
+ usage
77
+ exit 0
78
+ ;;
79
+ *)
80
+ error "Unknown option: $1. Use --help for usage information."
81
+ ;;
82
+ esac
83
+ done
84
+ }
85
+
86
+ # Validate inputs
87
+ validate_inputs() {
88
+ [[ -z "$TASK_ID" ]] && error "Task ID is required"
89
+ [[ -z "$AGENTS" ]] && error "Agents list is required"
90
+ [[ -z "$THRESHOLD" ]] && error "Threshold is required"
91
+ [[ -z "$MIN_QUORUM" ]] && error "Min quorum is required"
92
+
93
+ # Validate threshold
94
+ if ! [[ "$THRESHOLD" =~ ^[0-9]*\.?[0-9]+$ ]]; then
95
+ error "Threshold must be a numeric value between 0.0 and 1.0"
96
+ fi
97
+
98
+ local threshold_float
99
+ threshold_float=$(echo "$THRESHOLD" | bc -l 2>/dev/null || echo "0")
100
+ if [[ $(echo "$threshold_float < 0 || $threshold_float > 1" | bc -l) -eq 1 ]]; then
101
+ error "Threshold must be between 0.0 and 1.0"
102
+ fi
103
+
104
+ # Check Redis connectivity
105
+ if ! command -v redis-cli &> /dev/null; then
106
+ error "redis-cli is required but not installed"
107
+ fi
108
+
109
+ if ! redis-cli ping &> /dev/null; then
110
+ error "Cannot connect to Redis server"
111
+ fi
112
+ }
113
+
114
+ # Calculate quorum requirement
115
+ calculate_quorum_requirement() {
116
+ local total_agents=$1
117
+ local min_quorum_spec="$2"
118
+
119
+ # Parse quorum specification
120
+ if [[ "$min_quorum_spec" =~ ^[0-9]+$ ]]; then
121
+ # Absolute number
122
+ echo "$min_quorum_spec"
123
+ elif [[ "$min_quorum_spec" =~ ^([0-9]+)%$ ]]; then
124
+ # Percentage
125
+ local percentage="${BASH_REMATCH[1]}"
126
+ local required
127
+ required=$(echo "scale=0; ($total_agents * $percentage) / 100" | bc -l)
128
+ echo "$required"
129
+ elif [[ "$min_quorum_spec" =~ ^0\.[0-9]+$ ]]; then
130
+ # Fraction
131
+ local required
132
+ required=$(echo "scale=0; $total_agents * $min_quorum_spec" | bc -l)
133
+ echo "$required"
134
+ else
135
+ error "Invalid quorum specification: $min_quorum_spec"
136
+ fi
137
+ }
138
+
139
+ # Collect agent confidence scores
140
+ collect_agent_scores() {
141
+ local agents_array
142
+ IFS=',' read -ra agents_array <<< "$AGENTS"
143
+
144
+ local scores=()
145
+ local completed_agents=()
146
+
147
+ log "Collecting confidence scores from agents"
148
+
149
+ for agent_id in "${agents_array[@]}"; do
150
+ agent_id=$(echo "$agent_id" | xargs) # trim whitespace
151
+
152
+ # Get confidence score from Redis
153
+ local confidence_key="swarm:${TASK_ID}:${agent_id}:confidence"
154
+ local confidence_score
155
+ confidence_score=$(redis-cli get "$confidence_key" 2>/dev/null || echo "")
156
+
157
+ if [[ -n "$confidence_score" ]] && [[ "$confidence_score" =~ ^[0-9]*\.?[0-9]+$ ]]; then
158
+ scores+=("$confidence_score")
159
+ completed_agents+=("$agent_id")
160
+ log "Agent $agent_id confidence: $confidence_score"
161
+ else
162
+ log "Warning: No confidence score found for agent $agent_id"
163
+ fi
164
+ done
165
+
166
+ # Store results in Redis for debugging
167
+ printf '%s\n' "${completed_agents[@]}" | redis-cli -x set "swarm:${TASK_ID}:validated-agents" > /dev/null 2>&1 || true
168
+ printf '%s\n' "${scores[@]}" | redis-cli -x set "swarm:${TASK_ID}:confidence-scores" > /dev/null 2>&1 || true
169
+
170
+ # Return scores array
171
+ printf '%s\n' "${scores[@]}"
172
+ }
173
+
174
+ # Validate consensus
175
+ validate_consensus() {
176
+ local scores=("$@")
177
+
178
+ if [[ ${#scores[@]} -eq 0 ]]; then
179
+ error "No confidence scores available for validation"
180
+ fi
181
+
182
+ # Calculate required quorum
183
+ local total_agents
184
+ total_agents=$(echo "$AGENTS" | tr ',' '\n' | wc -l)
185
+ local required_quorum
186
+ required_quorum=$(calculate_quorum_requirement "$total_agents" "$MIN_QUORUM")
187
+
188
+ log "Total agents: $total_agents, Required quorum: $required_quorum"
189
+ log "Available scores: ${#scores[@]}"
190
+
191
+ # Check quorum requirement
192
+ if [[ ${#scores[@]} -lt $required_quorum ]]; then
193
+ log "Consensus validation failed: Insufficient agent responses (${#scores[@]} < $required_quorum)"
194
+ return 1
195
+ fi
196
+
197
+ # Calculate average confidence
198
+ local sum=0.0
199
+ local count=0
200
+
201
+ for score in "${scores[@]}"; do
202
+ sum=$(echo "$sum + $score" | bc -l)
203
+ ((count++))
204
+ done
205
+
206
+ local average_confidence
207
+ average_confidence=$(echo "scale=3; $sum / $count" | bc -l)
208
+
209
+ log "Average confidence: $average_confidence, Threshold: $THRESHOLD"
210
+
211
+ # Compare against threshold
212
+ local comparison
213
+ comparison=$(echo "$average_confidence >= $THRESHOLD" | bc -l 2>/dev/null || echo "0")
214
+
215
+ # Store validation results
216
+ local validation_result
217
+ validation_result=$(cat << EOF
218
+ {
219
+ "task_id": "$TASK_ID",
220
+ "timestamp": "$(date -Iseconds)",
221
+ "total_agents": $total_agents,
222
+ "completed_agents": $count,
223
+ "required_quorum": $required_quorum,
224
+ "quorum_met": $([[ $count -ge $required_quorum ]] && echo "true" || echo "false"),
225
+ "confidence_scores": [$(IFS=','; echo "${scores[*]}")],
226
+ "average_confidence": $average_confidence,
227
+ "threshold": $THRESHOLD,
228
+ "threshold_met": $([[ $comparison -eq 1 ]] && echo "true" || echo "false"),
229
+ "consensus_validated": $([[ $comparison -eq 1 ]] && echo "true" || echo "false")
230
+ }
231
+ EOF
232
+ )
233
+
234
+ echo "$validation_result" | redis-cli -x set "swarm:${TASK_ID}:consensus-validation" > /dev/null
235
+ log "Validation result stored: $validation_result"
236
+
237
+ if [[ $comparison -eq 1 ]]; then
238
+ log "SEO consensus validation PASSED (average: $average_confidence >= threshold: $THRESHOLD)"
239
+ return 0
240
+ else
241
+ log "SEO consensus validation FAILED (average: $average_confidence < threshold: $THRESHOLD)"
242
+ return 1
243
+ fi
244
+ }
245
+
246
+ # Main function
247
+ main() {
248
+ parse_args "$@"
249
+ validate_inputs
250
+
251
+ log "Starting SEO consensus validation for task: $TASK_ID"
252
+
253
+ # Collect agent scores
254
+ local scores_array
255
+ readarray -t scores_array < <(collect_agent_scores)
256
+
257
+ # Validate consensus
258
+ if validate_consensus "${scores_array[@]}"; then
259
+ log "SEO consensus validation completed successfully"
260
+ exit 0
261
+ else
262
+ log "SEO consensus validation failed"
263
+ exit 1
264
+ fi
265
+ }
266
+
267
+ # Script entry point
268
+ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
269
+ main "$@"
270
+ fi
@@ -1,12 +1,145 @@
1
+ "use strict";
1
2
  /**
2
3
  * Dynamic Agent Loader - Reads agent definitions from .claude/agents/ directory
3
4
  * Single source of truth for agent types in the system
4
- */ import { readFileSync, existsSync } from 'node:fs';
5
- import { glob } from 'glob';
6
- import { resolve, dirname } from 'node:path';
7
- import { parse as parseYaml } from 'yaml';
5
+ */ var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
6
+ function adopt(value) {
7
+ return value instanceof P ? value : new P(function(resolve) {
8
+ resolve(value);
9
+ });
10
+ }
11
+ return new (P || (P = Promise))(function(resolve, reject) {
12
+ function fulfilled(value) {
13
+ try {
14
+ step(generator.next(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+ function step(result) {
27
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
28
+ }
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+ var __generator = this && this.__generator || function(thisArg, body) {
33
+ var _ = {
34
+ label: 0,
35
+ sent: function() {
36
+ if (t[0] & 1) throw t[1];
37
+ return t[1];
38
+ },
39
+ trys: [],
40
+ ops: []
41
+ }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
42
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
43
+ return this;
44
+ }), g;
45
+ function verb(n) {
46
+ return function(v) {
47
+ return step([
48
+ n,
49
+ v
50
+ ]);
51
+ };
52
+ }
53
+ function step(op) {
54
+ if (f) throw new TypeError("Generator is already executing.");
55
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
56
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
+ if (y = 0, t) op = [
58
+ op[0] & 2,
59
+ t.value
60
+ ];
61
+ switch(op[0]){
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [
76
+ 0
77
+ ];
78
+ continue;
79
+ case 7:
80
+ op = _.ops.pop();
81
+ _.trys.pop();
82
+ continue;
83
+ default:
84
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
85
+ _ = 0;
86
+ continue;
87
+ }
88
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
89
+ _.label = op[1];
90
+ break;
91
+ }
92
+ if (op[0] === 6 && _.label < t[1]) {
93
+ _.label = t[1];
94
+ t = op;
95
+ break;
96
+ }
97
+ if (t && _.label < t[2]) {
98
+ _.label = t[2];
99
+ _.ops.push(op);
100
+ break;
101
+ }
102
+ if (t[2]) _.ops.pop();
103
+ _.trys.pop();
104
+ continue;
105
+ }
106
+ op = body.call(thisArg, _);
107
+ } catch (e) {
108
+ op = [
109
+ 6,
110
+ e
111
+ ];
112
+ y = 0;
113
+ } finally{
114
+ f = t = 0;
115
+ }
116
+ if (op[0] & 5) throw op[1];
117
+ return {
118
+ value: op[0] ? op[1] : void 0,
119
+ done: true
120
+ };
121
+ }
122
+ };
123
+ var __spreadArray = this && this.__spreadArray || function(to, from, pack) {
124
+ if (pack || arguments.length === 2) for(var i = 0, l = from.length, ar; i < l; i++){
125
+ if (ar || !(i in from)) {
126
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
127
+ ar[i] = from[i];
128
+ }
129
+ }
130
+ return to.concat(ar || Array.prototype.slice.call(from));
131
+ };
132
+ Object.defineProperty(exports, "__esModule", {
133
+ value: true
134
+ });
135
+ exports.refreshAgents = exports.getAgentsByCategory = exports.isValidAgentType = exports.searchAgents = exports.getAgentCategories = exports.getAllAgents = exports.getAgent = exports.getAvailableAgentTypes = exports.agentLoader = exports.AgentLoader = void 0;
136
+ exports.resolveLegacyAgentType = resolveLegacyAgentType;
137
+ var node_fs_1 = require("node:fs");
138
+ var glob_1 = require("glob");
139
+ var node_path_1 = require("node:path");
140
+ var yaml_1 = require("yaml");
8
141
  // Legacy agent type mapping for backward compatibility
9
- const LEGACY_AGENT_MAPPING = {
142
+ var LEGACY_AGENT_MAPPING = {
10
143
  analyst: 'code-analyzer',
11
144
  coordinator: 'hierarchical-coordinator',
12
145
  optimizer: 'perf-analyzer',
@@ -17,38 +150,40 @@ const LEGACY_AGENT_MAPPING = {
17
150
  };
18
151
  /**
19
152
  * Resolve legacy agent types to current equivalents
20
- */ export function resolveLegacyAgentType(legacyType) {
153
+ */ function resolveLegacyAgentType(legacyType) {
21
154
  return LEGACY_AGENT_MAPPING[legacyType] || legacyType;
22
155
  }
23
- export class AgentLoader {
24
- agentCache = new Map();
25
- categoriesCache = [];
26
- lastLoadTime = 0;
27
- CACHE_EXPIRY = 60_000;
28
- getAgentsDirectory() {
29
- let currentDir = process.cwd();
156
+ var AgentLoader = /** @class */ function() {
157
+ function AgentLoader() {
158
+ this.agentCache = new Map();
159
+ this.categoriesCache = [];
160
+ this.lastLoadTime = 0;
161
+ this.CACHE_EXPIRY = 60000; // 1 minute cache
162
+ }
163
+ AgentLoader.prototype.getAgentsDirectory = function() {
164
+ var currentDir = process.cwd();
30
165
  while(currentDir !== '/'){
31
- const claudeAgentsPath = resolve(currentDir, '.claude', 'agents');
32
- if (existsSync(claudeAgentsPath)) {
166
+ var claudeAgentsPath = (0, node_path_1.resolve)(currentDir, '.claude', 'agents');
167
+ if ((0, node_fs_1.existsSync)(claudeAgentsPath)) {
33
168
  return claudeAgentsPath;
34
169
  }
35
- currentDir = dirname(currentDir);
170
+ currentDir = (0, node_path_1.dirname)(currentDir);
36
171
  }
37
- return resolve(process.cwd(), '.claude', 'agents');
38
- }
39
- parseAgentFile(filePath) {
172
+ return (0, node_path_1.resolve)(process.cwd(), '.claude', 'agents');
173
+ };
174
+ AgentLoader.prototype.parseAgentFile = function(filePath) {
40
175
  try {
41
- const content = readFileSync(filePath, 'utf-8');
42
- const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
176
+ var content = (0, node_fs_1.readFileSync)(filePath, 'utf-8');
177
+ var frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
43
178
  if (!frontmatterMatch) {
44
- console.warn(`No frontmatter found in ${filePath}`);
179
+ console.warn("No frontmatter found in ".concat(filePath));
45
180
  return null;
46
181
  }
47
- const [, yamlContent, markdownContent] = frontmatterMatch;
48
- const frontmatter = parseYaml(yamlContent);
49
- const description = frontmatter.description;
182
+ var yamlContent = frontmatterMatch[1], markdownContent = frontmatterMatch[2];
183
+ var frontmatter = (0, yaml_1.parse)(yamlContent);
184
+ var description = frontmatter.description;
50
185
  if (!frontmatter.name || !description) {
51
- console.warn(`Missing required fields (name, description) in ${filePath}`);
186
+ console.warn("Missing required fields (name, description) in ".concat(filePath));
52
187
  return null;
53
188
  }
54
189
  return {
@@ -69,129 +204,13 @@ export class AgentLoader {
69
204
  content: markdownContent.trim()
70
205
  };
71
206
  } catch (error) {
72
- console.error(`Error parsing agent file ${filePath}:`, error);
207
+ console.error("Error parsing agent file ".concat(filePath, ":"), error);
73
208
  return null;
74
209
  }
75
- }
76
- parseTools(frontmatter) {
77
- const extractTools = (input)=>{
210
+ };
211
+ AgentLoader.prototype.parseTools = function(frontmatter) {
212
+ var extractTools = function(input) {
78
213
  if (Array.isArray(input)) return input.map(String);
79
- if (typeof input === 'string') {
80
- return input.split(/[,\s]+/).map((t)=>t.trim()).filter((t)=>t.length > 0);
81
- }
82
- return [];
83
- };
84
- // Safely handle tools and capabilities.tools
85
- const toolsFromFrontmatter = frontmatter.tools ? extractTools(frontmatter.tools) : [];
86
- const toolsFromCapabilities = frontmatter.capabilities && typeof frontmatter.capabilities === 'object' ? extractTools(Object(frontmatter.capabilities).tools) : [];
87
- return [
88
- ...toolsFromFrontmatter,
89
- ...toolsFromCapabilities
90
- ];
91
- }
92
- async loadAgents() {
93
- const agentsDir = this.getAgentsDirectory();
94
- if (!existsSync(agentsDir)) {
95
- console.warn(`Agents directory not found: ${agentsDir}`);
96
- return;
97
- }
98
- const agentFiles = await new Promise((resolve, reject)=>{
99
- glob('**/*.md', {
100
- cwd: agentsDir,
101
- ignore: [
102
- '**/README.md',
103
- '**/MIGRATION_SUMMARY.md'
104
- ],
105
- absolute: true
106
- }, (err, matches)=>{
107
- if (err) reject(err);
108
- else resolve(matches);
109
- });
110
- });
111
- this.agentCache.clear();
112
- this.categoriesCache = [];
113
- const categoryMap = new Map();
114
- for (const filePath of agentFiles){
115
- const agent = this.parseAgentFile(filePath);
116
- if (agent) {
117
- this.agentCache.set(agent.name, agent);
118
- const relativePath = filePath.replace(agentsDir, '');
119
- const pathParts = relativePath.split('/');
120
- const category = pathParts[1] || 'uncategorized';
121
- if (!categoryMap.has(category)) {
122
- categoryMap.set(category, []);
123
- }
124
- categoryMap.get(category).push(agent);
125
- }
126
- }
127
- this.categoriesCache = Array.from(categoryMap.entries()).map(([name, agents])=>({
128
- name,
129
- agents: agents.sort((a, b)=>a.name.localeCompare(b.name))
130
- }));
131
- this.lastLoadTime = Date.now();
132
- }
133
- // Rest of the methods remain similar to the original implementation
134
- needsRefresh() {
135
- return Date.now() - this.lastLoadTime > this.CACHE_EXPIRY;
136
- }
137
- async ensureLoaded() {
138
- if (this.agentCache.size === 0 || this.needsRefresh()) {
139
- await this.loadAgents();
140
- }
141
- }
142
- async getAvailableAgentTypes() {
143
- await this.ensureLoaded();
144
- const currentTypes = Array.from(this.agentCache.keys());
145
- const legacyTypes = Object.keys(LEGACY_AGENT_MAPPING);
146
- return Array.from(new Set([
147
- ...currentTypes,
148
- ...legacyTypes
149
- ])).sort();
150
- }
151
- async getAgent(name) {
152
- await this.ensureLoaded();
153
- return this.agentCache.get(name) || this.agentCache.get(resolveLegacyAgentType(name)) || null;
154
- }
155
- async getAllAgents() {
156
- await this.ensureLoaded();
157
- return Array.from(this.agentCache.values()).sort((a, b)=>a.name.localeCompare(b.name));
158
- }
159
- async getAgentCategories() {
160
- await this.ensureLoaded();
161
- return this.categoriesCache;
162
- }
163
- async searchAgents(query) {
164
- await this.ensureLoaded();
165
- const lowerQuery = query.toLowerCase();
166
- return Array.from(this.agentCache.values()).filter((agent)=>agent.name.toLowerCase().includes(lowerQuery) || agent.description.toLowerCase().includes(lowerQuery) || agent.capabilities?.some((cap)=>cap.toLowerCase().includes(lowerQuery)));
167
- }
168
- async isValidAgentType(name) {
169
- await this.ensureLoaded();
170
- return this.agentCache.has(name) || this.agentCache.has(resolveLegacyAgentType(name));
171
- }
172
- async getAgentsByCategory(category) {
173
- const categories = await this.getAgentCategories();
174
- const found = categories.find((cat)=>cat.name === category);
175
- return found?.agents || [];
176
- }
177
- async refresh() {
178
- this.lastLoadTime = 0;
179
- await this.loadAgents();
180
- }
181
- }
182
- // Singleton instance
183
- export const agentLoader = new AgentLoader();
184
- // Convenience exports for use in other modules
185
- export const getAvailableAgentTypes = ()=>agentLoader.getAvailableAgentTypes();
186
- export const getAgent = (name)=>agentLoader.getAgent(name);
187
- export const getAllAgents = ()=>agentLoader.getAllAgents();
188
- export const getAgentCategories = ()=>agentLoader.getAgentCategories();
189
- export const searchAgents = (query)=>agentLoader.searchAgents(query);
190
- export const isValidAgentType = (name)=>agentLoader.isValidAgentType(name);
191
- export const getAgentsByCategory = (category)=>agentLoader.getAgentsByCategory(category);
192
- export const refreshAgents = ()=>agentLoader.refresh();
193
-
194
- //# sourceMappingURL=agent-loader.js.map.isArray(input)) return input.map(String);
195
214
  if (typeof input === 'string') {
196
215
  return input.split(/[,\s]+/).map(function(t) {
197
216
  return t.trim();