claude-flow-novice 2.15.1 → 2.15.3

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 (107) hide show
  1. package/.claude/cfn-extras/agents/google-sheets-specialist.md +614 -0
  2. package/.claude/commands/cfn/create-handoff.md +224 -0
  3. package/.claude/hooks/cfn-BACKUP_USAGE.md +243 -243
  4. package/.claude/hooks/cfn-invoke-security-validation.sh +69 -69
  5. package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +78 -78
  6. package/.claude/hooks/cfn-post-edit.config.json +44 -44
  7. package/.claude/skills/agent-lifecycle/SKILL.md +60 -0
  8. package/.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh +573 -0
  9. package/.claude/skills/agent-lifecycle/simple-audit.sh +31 -0
  10. package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
  11. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
  12. package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
  13. package/.claude/skills/cfn-redis-coordination/get-context.sh +112 -112
  14. package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
  15. package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
  16. package/.claude/skills/cfn-transparency-middleware/test-integration.sh +161 -161
  17. package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
  18. package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +92 -92
  19. package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
  20. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +662 -0
  21. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +29 -0
  22. package/claude-assets/cfn-extras/agents/google-sheets-specialist.md +614 -0
  23. package/claude-assets/commands/cfn/create-handoff.md +224 -0
  24. package/claude-assets/hooks/cfn-BACKUP_USAGE.md +243 -243
  25. package/claude-assets/hooks/cfn-invoke-security-validation.sh +69 -69
  26. package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +78 -78
  27. package/claude-assets/hooks/cfn-post-edit.config.json +44 -44
  28. package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +19 -19
  29. package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +19 -19
  30. package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +572 -572
  31. package/claude-assets/skills/agent-lifecycle/simple-audit.sh +30 -30
  32. package/claude-assets/skills/cfn-automatic-memory-persistence/persist-agent-output.sh +48 -48
  33. package/claude-assets/skills/cfn-automatic-memory-persistence/query-agent-history.sh +34 -34
  34. package/claude-assets/skills/cfn-deliverable-validation/confidence-calculator.sh +261 -261
  35. package/claude-assets/skills/cfn-expert-update/update-expert.sh +345 -345
  36. package/claude-assets/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
  37. package/claude-assets/skills/cfn-intervention-detector/detect-intervention.sh +110 -110
  38. package/claude-assets/skills/cfn-intervention-orchestrator/execute-intervention.sh +58 -58
  39. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
  40. package/claude-assets/skills/cfn-loop2-output-processing/process-validator-output.sh +275 -275
  41. package/claude-assets/skills/cfn-memory-management/check-memory.sh +159 -159
  42. package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +196 -196
  43. package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +325 -325
  44. package/claude-assets/skills/cfn-playbook-auto-update/auto-update-playbook.sh +85 -85
  45. package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
  46. package/claude-assets/skills/cfn-redis-coordination/get-context.sh +112 -112
  47. package/claude-assets/skills/cfn-scope-simplifier/simplify-scope.sh +67 -67
  48. package/claude-assets/skills/cfn-specialist-injection/recommend-specialist.sh +56 -56
  49. package/claude-assets/skills/cfn-standardized-error-handling/capture-agent-error.sh +86 -86
  50. package/claude-assets/skills/cfn-standardized-error-handling/test-error-handling.sh +165 -165
  51. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -264
  52. package/claude-assets/skills/cfn-task-decomposition/task-decomposer.sh +278 -278
  53. package/claude-assets/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
  54. package/claude-assets/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
  55. package/claude-assets/skills/cfn-transparency-middleware/test-integration.sh +161 -161
  56. package/claude-assets/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
  57. package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +92 -92
  58. package/claude-assets/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
  59. package/claude-assets/skills/docker-build/SKILL.md +96 -203
  60. package/claude-assets/skills/docker-build/build.sh +73 -73
  61. package/claude-assets/skills/integration/agent-handoff.sh +494 -0
  62. package/claude-assets/skills/integration/file-operations.sh +414 -0
  63. package/claude-assets/skills/workflow-codification/APPROVAL_WORKFLOW.md +806 -0
  64. package/claude-assets/skills/workflow-codification/COST_TRACKING.md +637 -0
  65. package/claude-assets/skills/workflow-codification/EDGE_CASE_TRACKING.md +404 -0
  66. package/claude-assets/skills/workflow-codification/README_PHASE4.md +457 -0
  67. package/claude-assets/skills/workflow-codification/SKILL.md +110 -0
  68. package/claude-assets/skills/workflow-codification/analyze-patterns.sh +899 -0
  69. package/claude-assets/skills/workflow-codification/approval-workflow.sh +514 -0
  70. package/claude-assets/skills/workflow-codification/generate-skill-update.sh +525 -0
  71. package/claude-assets/skills/workflow-codification/review-skill.sh +643 -0
  72. package/claude-assets/skills/workflow-codification/templates/email-notification.txt +114 -0
  73. package/claude-assets/skills/workflow-codification/templates/slack-notification.md +85 -0
  74. package/claude-assets/skills/workflow-codification/test-integration.sh +281 -0
  75. package/claude-assets/skills/workflow-codification/track-cost-savings.sh +445 -0
  76. package/claude-assets/skills/workflow-codification/track-edge-case.sh +323 -0
  77. package/dist/agents/agent-loader.js +165 -146
  78. package/dist/agents/agent-loader.js.map +1 -1
  79. package/dist/cli/config-manager.js +91 -109
  80. package/dist/cli/config-manager.js.map +1 -1
  81. package/dist/integration/DatabaseHandoff.js +507 -0
  82. package/dist/integration/DatabaseHandoff.js.map +1 -0
  83. package/dist/integration/StandardAdapter.js +291 -0
  84. package/dist/integration/StandardAdapter.js.map +1 -0
  85. package/dist/lib/agent-output-parser.js +518 -0
  86. package/dist/lib/agent-output-parser.js.map +1 -0
  87. package/dist/lib/agent-output-validator.js +950 -0
  88. package/dist/lib/agent-output-validator.js.map +1 -0
  89. package/dist/lib/artifact-registry.js +443 -0
  90. package/dist/lib/artifact-registry.js.map +1 -0
  91. package/dist/lib/config-validator.js +687 -0
  92. package/dist/lib/config-validator.js.map +1 -0
  93. package/dist/types/agent-output.js +44 -0
  94. package/dist/types/agent-output.js.map +1 -0
  95. package/dist/types/config.js +28 -0
  96. package/dist/types/config.js.map +1 -0
  97. package/package.json +2 -1
  98. package/scripts/artifact-cleanup.sh +392 -0
  99. package/scripts/build-linux.sh +78 -0
  100. package/scripts/deploy-production.sh +355 -355
  101. package/scripts/docker-playwright-fix.sh +311 -311
  102. package/scripts/docker-rebuild-all-agents.sh +127 -127
  103. package/scripts/memory-leak-prevention.sh +305 -305
  104. package/scripts/migrate-artifacts.sh +563 -0
  105. package/scripts/migrate-yaml-to-json.sh +465 -0
  106. package/scripts/run-marketing-tests.sh +42 -42
  107. package/scripts/update_paths.sh +46 -46
@@ -1,79 +1,79 @@
1
- #!/bin/bash
2
-
3
- # Performance Benchmarking for Transparency Middleware
4
- # Version: 1.0.0
5
- # Measures message throughput, overhead, and memory usage
6
-
7
- set -euo pipefail
8
-
9
- # Source configuration
10
- source .claude/skills/cfn-transparency-middleware/middleware-config.sh
11
-
12
- # Benchmarking results file
13
- BENCHMARK_RESULTS="/tmp/transparency_benchmark_$(date +%Y%m%d_%H%M%S).json"
14
-
15
- # Performance Test Parameters
16
- TOTAL_MESSAGES=10000
17
- CONCURRENCY_LEVELS=(1 10 100)
18
-
19
- measure_performance() {
20
- local concurrency="$1"
21
- local start_time=$(date +%s.%N)
22
- local peak_memory=0
23
- local total_cpu_usage=0
24
-
25
- # Simulate message processing
26
- for ((i=0; i<TOTAL_MESSAGES; i++)); do
27
- ./invoke-transparency-middleware.sh process \
28
- --concurrency "$concurrency" \
29
- --message-id "$i" &
30
- done
31
-
32
- wait
33
-
34
- local end_time=$(date +%s.%N)
35
- local duration=$(echo "$end_time - $start_time" | bc)
36
- local messages_per_second=$(echo "$TOTAL_MESSAGES / $duration" | bc)
37
-
38
- # Record performance metrics
39
- jq -n \
40
- --arg concurrency "$concurrency" \
41
- --arg messages_total "$TOTAL_MESSAGES" \
42
- --arg duration "$duration" \
43
- --arg messages_per_second "$messages_per_second" \
44
- '{
45
- "concurrency": $concurrency,
46
- "total_messages": $messages_total,
47
- "duration_seconds": $duration,
48
- "messages_per_second": $messages_per_second
49
- }' > "$BENCHMARK_RESULTS"
50
-
51
- # Validate performance
52
- validate_performance "$messages_per_second"
53
- }
54
-
55
- validate_performance() {
56
- local messages_per_second="$1"
57
- local max_threshold=5000 # Adjust based on your system capabilities
58
-
59
- if (( $(echo "$messages_per_second < $max_threshold" | bc -l) )); then
60
- echo "Performance Test PASSED"
61
- redis-cli publish "swarm:sprint-1.2:performance" "benchmark_passed:1.0"
62
- else
63
- echo "Performance Test FAILED"
64
- redis-cli publish "swarm:sprint-1.2:performance" "benchmark_failed:0.0"
65
- exit 1
66
- fi
67
- }
68
-
69
- main() {
70
- echo "Starting Transparency Middleware Performance Benchmarks"
71
-
72
- for concurrency in "${CONCURRENCY_LEVELS[@]}"; do
73
- measure_performance "$concurrency"
74
- done
75
-
76
- cat "$BENCHMARK_RESULTS"
77
- }
78
-
1
+ #!/bin/bash
2
+
3
+ # Performance Benchmarking for Transparency Middleware
4
+ # Version: 1.0.0
5
+ # Measures message throughput, overhead, and memory usage
6
+
7
+ set -euo pipefail
8
+
9
+ # Source configuration
10
+ source .claude/skills/cfn-transparency-middleware/middleware-config.sh
11
+
12
+ # Benchmarking results file
13
+ BENCHMARK_RESULTS="/tmp/transparency_benchmark_$(date +%Y%m%d_%H%M%S).json"
14
+
15
+ # Performance Test Parameters
16
+ TOTAL_MESSAGES=10000
17
+ CONCURRENCY_LEVELS=(1 10 100)
18
+
19
+ measure_performance() {
20
+ local concurrency="$1"
21
+ local start_time=$(date +%s.%N)
22
+ local peak_memory=0
23
+ local total_cpu_usage=0
24
+
25
+ # Simulate message processing
26
+ for ((i=0; i<TOTAL_MESSAGES; i++)); do
27
+ ./invoke-transparency-middleware.sh process \
28
+ --concurrency "$concurrency" \
29
+ --message-id "$i" &
30
+ done
31
+
32
+ wait
33
+
34
+ local end_time=$(date +%s.%N)
35
+ local duration=$(echo "$end_time - $start_time" | bc)
36
+ local messages_per_second=$(echo "$TOTAL_MESSAGES / $duration" | bc)
37
+
38
+ # Record performance metrics
39
+ jq -n \
40
+ --arg concurrency "$concurrency" \
41
+ --arg messages_total "$TOTAL_MESSAGES" \
42
+ --arg duration "$duration" \
43
+ --arg messages_per_second "$messages_per_second" \
44
+ '{
45
+ "concurrency": $concurrency,
46
+ "total_messages": $messages_total,
47
+ "duration_seconds": $duration,
48
+ "messages_per_second": $messages_per_second
49
+ }' > "$BENCHMARK_RESULTS"
50
+
51
+ # Validate performance
52
+ validate_performance "$messages_per_second"
53
+ }
54
+
55
+ validate_performance() {
56
+ local messages_per_second="$1"
57
+ local max_threshold=5000 # Adjust based on your system capabilities
58
+
59
+ if (( $(echo "$messages_per_second < $max_threshold" | bc -l) )); then
60
+ echo "Performance Test PASSED"
61
+ redis-cli publish "swarm:sprint-1.2:performance" "benchmark_passed:1.0"
62
+ else
63
+ echo "Performance Test FAILED"
64
+ redis-cli publish "swarm:sprint-1.2:performance" "benchmark_failed:0.0"
65
+ exit 1
66
+ fi
67
+ }
68
+
69
+ main() {
70
+ echo "Starting Transparency Middleware Performance Benchmarks"
71
+
72
+ for concurrency in "${CONCURRENCY_LEVELS[@]}"; do
73
+ measure_performance "$concurrency"
74
+ done
75
+
76
+ cat "$BENCHMARK_RESULTS"
77
+ }
78
+
79
79
  main
@@ -1,162 +1,162 @@
1
- #!/usr/bin/env bash
2
- # Integration test: Transparency middleware with CFN Loop orchestrator
3
- # Validates middleware initialization, agent wrapping, and memory capture
4
-
5
- set -euo pipefail
6
-
7
- # Enhanced logging function with security audit trail
8
- log() {
9
- local level="$1"
10
- local message="$2"
11
- local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
12
- local caller_info=$(caller)
13
-
14
- # Log to syslog for security tracking
15
- logger -p local0.notice -t "interaction-tester" \
16
- "SECURITY_AUDIT: level=${level}, caller=${caller_info}, message=${message}"
17
-
18
- echo "[${timestamp}] [${level}] [${caller_info}] ${message}"
19
- }
20
-
21
- # Strict input validation
22
- validate_input() {
23
- local input="$1"
24
- local input_type="$2"
25
-
26
- case "$input_type" in
27
- "task_id")
28
- if [[ ! "$input" =~ ^[a-zA-Z0-9_-]+$ ]]; then
29
- log "SECURITY_ERROR" "Invalid task_id format: ${input}"
30
- exit 1
31
- fi
32
- ;;
33
- "agent_id")
34
- if [[ ! "$input" =~ ^[a-zA-Z0-9_-]+$ ]]; then
35
- log "SECURITY_ERROR" "Invalid agent_id format: ${input}"
36
- exit 1
37
- fi
38
- ;;
39
- *)
40
- log "SECURITY_ERROR" "Unknown input type: ${input_type}"
41
- exit 1
42
- ;;
43
- esac
44
- }
45
-
46
- # Error handling wrapper with extensive logging
47
- safe_execute() {
48
- local command="$1"
49
- local error_message="${2:-Execution failed}"
50
- local log_file="/tmp/interaction_tester_$(date +%s).log"
51
-
52
- # Redirect command output to log file for detailed tracing
53
- set +e
54
- eval "$command" > >(tee -a "$log_file") 2> >(tee -a "$log_file" >&2)
55
- local exit_code=$?
56
- set -e
57
-
58
- if [ $exit_code -ne 0 ]; then
59
- log "ERROR" "$error_message (Exit code: $exit_code)"
60
- log "ERROR" "Detailed logs in: $log_file"
61
-
62
- # Signal failure to Redis coordination with log reference
63
- redis-cli lpush "swarm:sprint-1.3-testing:interaction-tester:error" \
64
- "integration_test_failure:${log_file}" >/dev/null
65
-
66
- exit 1
67
- fi
68
-
69
- # Cleanup log file after successful execution
70
- rm -f "$log_file"
71
- }
72
-
73
- # Dependency check
74
- check_dependencies() {
75
- local dependencies=("node" "sqlite3" "redis-cli" "jq")
76
- for dep in "${dependencies[@]}"; do
77
- if ! command -v "$dep" &> /dev/null; then
78
- log "ERROR" "Dependency not found: $dep"
79
- exit 1
80
- fi
81
- done
82
- }
83
-
84
- main() {
85
- log "INFO" "=== Transparency Middleware Integration Test ==="
86
-
87
- # Check dependencies
88
- check_dependencies
89
-
90
- # 1. Initialize middleware
91
- log "INFO" "Initializing Transparency Middleware"
92
- safe_execute "node -e \"
93
- import TransparencyMiddleware from './src/middleware/transparency-middleware.js';
94
- const config = TransparencyMiddleware.loadConfig('./.claude/skills/cfn-transparency-middleware/config.json');
95
- const middleware = new TransparencyMiddleware(config);
96
- await middleware.initialize();
97
- console.log('Middleware initialized successfully');
98
- \"" "Middleware initialization failed"
99
-
100
- # 2. Spawn test agent with middleware wrapper
101
- log "INFO" "Spawning test agent"
102
- safe_execute "./.claude/skills/cfn-transparency-middleware/wrap-agent.sh \
103
- \"backend-dev\" \
104
- \"test-agent-1\" \
105
- \"integration-test-task\" \
106
- \"echo 'Test execution'\"" "Agent wrapping failed"
107
-
108
- # 3. Verify memory was captured
109
- log "INFO" "Verifying memory capture"
110
-
111
- # Validate task_id using strict input validation
112
- TASK_ID="integration-test-task"
113
- validate_input "$TASK_ID" "task_id"
114
-
115
- # Prepared statement with parameterized query
116
- MEMORY_COUNT=$(safe_execute "sqlite3 -csv .claude/swarm-memory.db \
117
- 'SELECT COUNT(*) FROM agent_memory WHERE task_id = ?;' '$TASK_ID'" "SQLite query failed")
118
-
119
- if [ "$MEMORY_COUNT" -eq 0 ]; then
120
- log "ERROR" "No memory captured for task: $TASK_ID"
121
-
122
- # Log additional diagnostic information
123
- redis-cli lpush "swarm:sprint-1.3-testing:interaction-tester:memory_check" \
124
- "task_id_length:${#TASK_ID},task_id_check:$TASK_ID" >/dev/null
125
-
126
- exit 1
127
- fi
128
-
129
- log "INFO" "Memory captured: $MEMORY_COUNT events"
130
-
131
- # 4. Verify Redis events emitted
132
- log "INFO" "Checking Redis events"
133
- REDIS_EVENTS=$(safe_execute "redis-cli llen \"agent:transparency\"" "Redis event count failed")
134
- log "INFO" "Redis events: $REDIS_EVENTS"
135
-
136
- # 5. Test query script
137
- log "INFO" "Testing memory query script"
138
- safe_execute "./.claude/skills/cfn-transparency-middleware/query-memory.sh \
139
- \"integration-test-task\" \
140
- \"*\" \
141
- 10 | jq '.' >/dev/null" "Memory query failed"
142
-
143
- # CFN Protocol: Signal task completion
144
- redis-cli lpush "swarm:sprint-1.3-testing:interaction-tester:done" "complete" >/dev/null
145
-
146
- # Report confidence and enter waiting mode
147
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
148
- --task-id "sprint-1.3-testing" \
149
- --agent-id "interaction-tester" \
150
- --confidence 0.95 \
151
- --iteration 1
152
-
153
- ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
154
- --task-id "sprint-1.3-testing" \
155
- --agent-id "interaction-tester" \
156
- --context "iteration-1-complete"
157
-
158
- log "INFO" "✅ Integration test complete"
159
- }
160
-
161
- # Run the main function
1
+ #!/usr/bin/env bash
2
+ # Integration test: Transparency middleware with CFN Loop orchestrator
3
+ # Validates middleware initialization, agent wrapping, and memory capture
4
+
5
+ set -euo pipefail
6
+
7
+ # Enhanced logging function with security audit trail
8
+ log() {
9
+ local level="$1"
10
+ local message="$2"
11
+ local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
12
+ local caller_info=$(caller)
13
+
14
+ # Log to syslog for security tracking
15
+ logger -p local0.notice -t "interaction-tester" \
16
+ "SECURITY_AUDIT: level=${level}, caller=${caller_info}, message=${message}"
17
+
18
+ echo "[${timestamp}] [${level}] [${caller_info}] ${message}"
19
+ }
20
+
21
+ # Strict input validation
22
+ validate_input() {
23
+ local input="$1"
24
+ local input_type="$2"
25
+
26
+ case "$input_type" in
27
+ "task_id")
28
+ if [[ ! "$input" =~ ^[a-zA-Z0-9_-]+$ ]]; then
29
+ log "SECURITY_ERROR" "Invalid task_id format: ${input}"
30
+ exit 1
31
+ fi
32
+ ;;
33
+ "agent_id")
34
+ if [[ ! "$input" =~ ^[a-zA-Z0-9_-]+$ ]]; then
35
+ log "SECURITY_ERROR" "Invalid agent_id format: ${input}"
36
+ exit 1
37
+ fi
38
+ ;;
39
+ *)
40
+ log "SECURITY_ERROR" "Unknown input type: ${input_type}"
41
+ exit 1
42
+ ;;
43
+ esac
44
+ }
45
+
46
+ # Error handling wrapper with extensive logging
47
+ safe_execute() {
48
+ local command="$1"
49
+ local error_message="${2:-Execution failed}"
50
+ local log_file="/tmp/interaction_tester_$(date +%s).log"
51
+
52
+ # Redirect command output to log file for detailed tracing
53
+ set +e
54
+ eval "$command" > >(tee -a "$log_file") 2> >(tee -a "$log_file" >&2)
55
+ local exit_code=$?
56
+ set -e
57
+
58
+ if [ $exit_code -ne 0 ]; then
59
+ log "ERROR" "$error_message (Exit code: $exit_code)"
60
+ log "ERROR" "Detailed logs in: $log_file"
61
+
62
+ # Signal failure to Redis coordination with log reference
63
+ redis-cli lpush "swarm:sprint-1.3-testing:interaction-tester:error" \
64
+ "integration_test_failure:${log_file}" >/dev/null
65
+
66
+ exit 1
67
+ fi
68
+
69
+ # Cleanup log file after successful execution
70
+ rm -f "$log_file"
71
+ }
72
+
73
+ # Dependency check
74
+ check_dependencies() {
75
+ local dependencies=("node" "sqlite3" "redis-cli" "jq")
76
+ for dep in "${dependencies[@]}"; do
77
+ if ! command -v "$dep" &> /dev/null; then
78
+ log "ERROR" "Dependency not found: $dep"
79
+ exit 1
80
+ fi
81
+ done
82
+ }
83
+
84
+ main() {
85
+ log "INFO" "=== Transparency Middleware Integration Test ==="
86
+
87
+ # Check dependencies
88
+ check_dependencies
89
+
90
+ # 1. Initialize middleware
91
+ log "INFO" "Initializing Transparency Middleware"
92
+ safe_execute "node -e \"
93
+ import TransparencyMiddleware from './src/middleware/transparency-middleware.js';
94
+ const config = TransparencyMiddleware.loadConfig('./.claude/skills/cfn-transparency-middleware/config.json');
95
+ const middleware = new TransparencyMiddleware(config);
96
+ await middleware.initialize();
97
+ console.log('Middleware initialized successfully');
98
+ \"" "Middleware initialization failed"
99
+
100
+ # 2. Spawn test agent with middleware wrapper
101
+ log "INFO" "Spawning test agent"
102
+ safe_execute "./.claude/skills/cfn-transparency-middleware/wrap-agent.sh \
103
+ \"backend-dev\" \
104
+ \"test-agent-1\" \
105
+ \"integration-test-task\" \
106
+ \"echo 'Test execution'\"" "Agent wrapping failed"
107
+
108
+ # 3. Verify memory was captured
109
+ log "INFO" "Verifying memory capture"
110
+
111
+ # Validate task_id using strict input validation
112
+ TASK_ID="integration-test-task"
113
+ validate_input "$TASK_ID" "task_id"
114
+
115
+ # Prepared statement with parameterized query
116
+ MEMORY_COUNT=$(safe_execute "sqlite3 -csv .claude/swarm-memory.db \
117
+ 'SELECT COUNT(*) FROM agent_memory WHERE task_id = ?;' '$TASK_ID'" "SQLite query failed")
118
+
119
+ if [ "$MEMORY_COUNT" -eq 0 ]; then
120
+ log "ERROR" "No memory captured for task: $TASK_ID"
121
+
122
+ # Log additional diagnostic information
123
+ redis-cli lpush "swarm:sprint-1.3-testing:interaction-tester:memory_check" \
124
+ "task_id_length:${#TASK_ID},task_id_check:$TASK_ID" >/dev/null
125
+
126
+ exit 1
127
+ fi
128
+
129
+ log "INFO" "Memory captured: $MEMORY_COUNT events"
130
+
131
+ # 4. Verify Redis events emitted
132
+ log "INFO" "Checking Redis events"
133
+ REDIS_EVENTS=$(safe_execute "redis-cli llen \"agent:transparency\"" "Redis event count failed")
134
+ log "INFO" "Redis events: $REDIS_EVENTS"
135
+
136
+ # 5. Test query script
137
+ log "INFO" "Testing memory query script"
138
+ safe_execute "./.claude/skills/cfn-transparency-middleware/query-memory.sh \
139
+ \"integration-test-task\" \
140
+ \"*\" \
141
+ 10 | jq '.' >/dev/null" "Memory query failed"
142
+
143
+ # CFN Protocol: Signal task completion
144
+ redis-cli lpush "swarm:sprint-1.3-testing:interaction-tester:done" "complete" >/dev/null
145
+
146
+ # Report confidence and enter waiting mode
147
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
148
+ --task-id "sprint-1.3-testing" \
149
+ --agent-id "interaction-tester" \
150
+ --confidence 0.95 \
151
+ --iteration 1
152
+
153
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
154
+ --task-id "sprint-1.3-testing" \
155
+ --agent-id "interaction-tester" \
156
+ --context "iteration-1-complete"
157
+
158
+ log "INFO" "✅ Integration test complete"
159
+ }
160
+
161
+ # Run the main function
162
162
  main