claude-flow-novice 2.13.0 → 2.14.1

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 (88) hide show
  1. package/.claude/commands/cfn/README.md +177 -129
  2. package/.claude/commands/cfn/cfn-loop-cli.md +279 -0
  3. package/.claude/commands/cfn/cfn-loop-document.md +20 -1
  4. package/.claude/commands/cfn/cfn-loop-frontend.md +17 -2
  5. package/.claude/commands/cfn/cfn-loop-task.md +460 -0
  6. package/.claude/commands/cfn/context-curate.md +27 -38
  7. package/.claude/commands/cfn/context-inject.md +14 -25
  8. package/.claude/commands/cfn/context-query.md +40 -45
  9. package/.claude/commands/cfn/context-reflect.md +40 -38
  10. package/.claude/commands/cfn/context-stats.md +13 -38
  11. package/.claude/commands/cfn/launch-web-dashboard.md +0 -295
  12. package/.claude/commands/cfn/list-agents-rebuild.md +18 -18
  13. package/.claude/commands/cfn/write-plan.md +246 -75
  14. package/.claude/root-claude-distribute/CFN-CLAUDE.md +126 -233
  15. package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  16. package/.claude/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  17. package/.claude/skills/cfn-changelog-management/bulk-import.sh +268 -0
  18. package/.claude/skills/cfn-changelog-management/lib/README.md +212 -0
  19. package/.claude/skills/cfn-changelog-management/lib/validation.sh +72 -0
  20. package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  21. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +259 -0
  22. package/claude-assets/agents/cfn-dev-team/reviewers/reviewer.md +45 -6
  23. package/claude-assets/agents/cfn-dev-team/testers/tester.md +59 -0
  24. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +4 -4
  25. package/claude-assets/commands/cfn/auto-compact.md +80 -0
  26. package/claude-assets/commands/cfn/cfn-loop-cli.md +13 -2
  27. package/claude-assets/commands/cfn/cfn-loop-epic.md +478 -0
  28. package/claude-assets/commands/cfn/cfn-loop-single.md +256 -0
  29. package/claude-assets/commands/cfn/cfn-loop-sprints.md +396 -0
  30. package/claude-assets/commands/cfn/cfn-loop-task.md +27 -9
  31. package/claude-assets/commands/cfn/cfn-loop.md +518 -0
  32. package/claude-assets/commands/cfn/claude-md.md +64 -0
  33. package/claude-assets/commands/cfn/claude-soul.md +22 -0
  34. package/claude-assets/commands/cfn/cost-savings-off.md +35 -0
  35. package/claude-assets/commands/cfn/cost-savings-on.md +35 -0
  36. package/claude-assets/commands/cfn/cost-savings-status.md +34 -0
  37. package/claude-assets/commands/cfn/custom-routing-activate.md +55 -0
  38. package/claude-assets/commands/cfn/custom-routing-deactivate.md +46 -0
  39. package/claude-assets/commands/cfn/dependency-recommendations.md +171 -0
  40. package/claude-assets/commands/cfn/fullstack.md +179 -0
  41. package/claude-assets/commands/cfn/github.md +221 -0
  42. package/claude-assets/commands/cfn/hooks.md +38 -0
  43. package/claude-assets/commands/cfn/metrics-summary.md +58 -0
  44. package/claude-assets/commands/cfn/neural.md +39 -0
  45. package/claude-assets/commands/cfn/parse-epic.md +357 -0
  46. package/claude-assets/commands/cfn/performance.md +41 -0
  47. package/claude-assets/commands/cfn/sparc.md +46 -0
  48. package/claude-assets/commands/cfn/suggest-improvements.md +95 -0
  49. package/claude-assets/commands/cfn/suggest-templates.md +147 -0
  50. package/claude-assets/commands/cfn/swarm.md +24 -0
  51. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +126 -233
  52. package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
  53. package/claude-assets/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
  54. package/claude-assets/skills/cfn-changelog-management/bulk-import.sh +268 -0
  55. package/claude-assets/skills/cfn-changelog-management/lib/README.md +212 -0
  56. package/claude-assets/skills/cfn-changelog-management/lib/validation.sh +72 -0
  57. package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
  58. package/claude-assets/skills/cfn-task-config-init/SKILL.md +204 -0
  59. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -0
  60. package/dist/agents/agent-loader.js +165 -146
  61. package/dist/agents/agent-loader.js.map +1 -1
  62. package/package.json +2 -2
  63. package/.claude/commands/README.md +0 -205
  64. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  65. package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  66. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  67. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  68. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  69. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  70. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  71. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  72. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  73. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  74. package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  75. package/.claude/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
  76. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
  77. package/claude-assets/skills/cfn-loop2-output-processing/execute-and-extract.sh.backup +0 -36
  78. package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
  79. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
  80. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
  81. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
  82. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
  83. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
  84. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
  85. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
  86. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
  87. package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
  88. package/claude-assets/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: cfn-task-config-init
3
+ description: Initialize structured task configuration for CFN Task Mode with scope boundaries and deliverables
4
+ dependencies: []
5
+ ---
6
+
7
+ # CFN Task Config Initialization
8
+
9
+ Generates structured task configuration file for CFN Task Mode to ensure product owner has complete scope context.
10
+
11
+ ## Purpose
12
+
13
+ Without explicit scope configuration:
14
+ - Product owner cannot distinguish sprint vs epic completion
15
+ - No clear in-scope / out-of-scope boundaries
16
+ - Missing deliverables list for validation
17
+ - No acceptance criteria for quality gates
18
+
19
+ ## Config Structure
20
+
21
+ ```json
22
+ {
23
+ "taskId": "cfn-phase-[timestamp]",
24
+ "taskDescription": "User's original task description",
25
+ "mode": "mvp|standard|enterprise",
26
+ "spawnMode": "task",
27
+ "scope": {
28
+ "epicGoal": "1-2 sentence high-level objective",
29
+ "inScope": ["Specific achievable objectives"],
30
+ "outOfScope": ["Clear boundaries"],
31
+ "deliverables": ["Exact file paths"],
32
+ "directory": "Target creation path",
33
+ "acceptanceCriteria": ["Measurable requirements"]
34
+ },
35
+ "agents": {
36
+ "loop3": ["implementer-agents"],
37
+ "loop2": ["validator-agents"]
38
+ },
39
+ "thresholds": {
40
+ "gate": 0.75,
41
+ "consensus": 0.90,
42
+ "maxIterations": 10
43
+ },
44
+ "createdAt": "ISO-8601 timestamp"
45
+ }
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ```bash
51
+ ./.claude/skills/cfn-task-config-init/initialize-config.sh \
52
+ --task-description "Implement JWT authentication" \
53
+ --mode "standard" \
54
+ --task-id "cfn-phase-1730545678"
55
+ ```
56
+
57
+ **Returns:** Path to created config file
58
+
59
+ ## Config Storage
60
+
61
+ **Location:** `.cfn/task-configs/task-[task-id].json`
62
+
63
+ **Lifecycle:**
64
+ - Created: At CFN Loop Task Mode start
65
+ - Read by: Main Chat coordinator, Product Owner (both modes)
66
+ - Updated: Never (immutable scope contract)
67
+ - Cleaned: After 7 days (configurable TTL)
68
+
69
+ ## Scope Extraction
70
+
71
+ The script analyzes task description to extract:
72
+
73
+ **Epic Goal:**
74
+ - Summary of high-level objective (1-2 sentences)
75
+ - Derived from imperative verbs: "Implement", "Build", "Create"
76
+
77
+ **In-Scope:**
78
+ - Explicit requirements from task description
79
+ - Concrete deliverables mentioned
80
+ - Technology stack specified
81
+
82
+ **Out-of-Scope:**
83
+ - Common scope creep patterns (analytics, admin UI, monitoring)
84
+ - Advanced features not mentioned
85
+ - Enterprise/scaling concerns (unless mode=enterprise)
86
+
87
+ **Deliverables:**
88
+ - File paths inferred from task type
89
+ - Standard patterns (src/, tests/, docs/)
90
+ - Technology-specific conventions (*.ts for TypeScript, *.rs for Rust)
91
+
92
+ **Acceptance Criteria:**
93
+ - Test coverage thresholds
94
+ - Security requirements
95
+ - Documentation completeness
96
+ - Performance benchmarks (if applicable)
97
+
98
+ ## Agent Selection
99
+
100
+ Based on task analysis:
101
+
102
+ **Keywords → Implementers:**
103
+ - "API", "backend", "server" → backend-dev
104
+ - "React", "Vue", "frontend" → react-frontend-engineer
105
+ - "mobile", "iOS", "Android" → mobile-dev
106
+ - "infrastructure", "deploy" → devops-engineer
107
+ - "package", "npm", "library" → npm-package-specialist
108
+
109
+ **Complexity → Validators:**
110
+ - Simple (1-2 files): reviewer, tester
111
+ - Standard (3-5 files): +architect, +security-specialist
112
+ - Complex (>5 files): +code-analyzer, +performance-benchmarker
113
+
114
+ ## Integration
115
+
116
+ **In `/cfn-loop` command:**
117
+ ```bash
118
+ # Step 1: Initialize config (Task Mode only)
119
+ if [[ "$SPAWN_MODE" == "task" ]]; then
120
+ CONFIG_PATH=$(./claude/skills/cfn-task-config-init/initialize-config.sh \
121
+ --task-description "$ARGUMENTS" \
122
+ --mode "$MODE" \
123
+ --task-id "$TASK_ID")
124
+ fi
125
+ ```
126
+
127
+ **In Main Chat (Task Mode):**
128
+ ```javascript
129
+ // Read config before spawning agents
130
+ const config = JSON.parse(Read(configPath));
131
+
132
+ // Pass scope to all agents
133
+ const loop3Context = `
134
+ Task: ${config.taskDescription}
135
+
136
+ Scope:
137
+ - Epic Goal: ${config.scope.epicGoal}
138
+ - In-Scope: ${config.scope.inScope.join(', ')}
139
+ - Out-of-Scope: ${config.scope.outOfScope.join(', ')}
140
+ - Deliverables: ${config.scope.deliverables.join(', ')}
141
+ - Directory: ${config.scope.directory}
142
+ - Acceptance Criteria:
143
+ ${config.scope.acceptanceCriteria.map(c => ` - ${c}`).join('\n')}
144
+ `;
145
+ ```
146
+
147
+ **In Product Owner:**
148
+ ```javascript
149
+ // Extract context from config
150
+ const config = JSON.parse(Read(configPath));
151
+
152
+ // Make informed decision
153
+ if (decision === "PROCEED") {
154
+ // Check if sprint complete vs epic complete
155
+ if (config.scope.sprints && currentSprint < totalSprints) {
156
+ nextAction = `Proceed to Sprint ${currentSprint + 1}`;
157
+ } else {
158
+ nextAction = "Epic complete, all deliverables met";
159
+ }
160
+ }
161
+ ```
162
+
163
+ ## Benefits
164
+
165
+ **Scope Clarity:**
166
+ - Product owner knows exact boundaries
167
+ - Prevents "consensus on vapor" (approving plans without code)
168
+ - Clear deliverable verification
169
+
170
+ **Consistent Context:**
171
+ - All agents receive same scope information
172
+ - No context drift between iterations
173
+ - Product owner has complete decision context
174
+
175
+ **Sprint Management:**
176
+ - Distinguishes sprint completion from epic completion
177
+ - Tracks progress across multi-sprint epics
178
+ - Enables autonomous sprint transitions
179
+
180
+ ## Dependencies
181
+
182
+ - `jq` for JSON manipulation
183
+ - `.cfn/task-configs/` directory (auto-created)
184
+ - Task Mode only (CLI mode uses Redis context storage)
185
+
186
+ ## Error Handling
187
+
188
+ **Missing task description:** Exit with error
189
+ **Invalid mode:** Default to "standard"
190
+ **Config file exists:** Overwrite with warning
191
+ **JSON validation fails:** Retry with escaped strings
192
+
193
+ ## Output
194
+
195
+ **Success:**
196
+ ```
197
+ ✅ Config initialized: .cfn/task-configs/task-cfn-phase-1730545678.json
198
+ ```
199
+
200
+ **Error:**
201
+ ```
202
+ ❌ Failed to initialize config: [error details]
203
+ Exit code: 1
204
+ ```
@@ -0,0 +1,264 @@
1
+ #!/bin/bash
2
+ # CFN Task Config Initialization Script
3
+ # Generates structured task configuration for Task Mode
4
+
5
+ set -euo pipefail
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
9
+
10
+ # Parse arguments
11
+ TASK_DESCRIPTION=""
12
+ MODE="standard"
13
+ TASK_ID=""
14
+
15
+ while [[ $# -gt 0 ]]; do
16
+ case $1 in
17
+ --task-description)
18
+ TASK_DESCRIPTION="$2"
19
+ shift 2
20
+ ;;
21
+ --mode)
22
+ MODE="$2"
23
+ shift 2
24
+ ;;
25
+ --task-id)
26
+ TASK_ID="$2"
27
+ shift 2
28
+ ;;
29
+ *)
30
+ echo "Unknown option: $1" >&2
31
+ exit 1
32
+ ;;
33
+ esac
34
+ done
35
+
36
+ # Validate required parameters
37
+ if [ -z "$TASK_DESCRIPTION" ] || [ -z "$TASK_ID" ]; then
38
+ echo "ERROR: Missing required parameters" >&2
39
+ echo "Usage: $0 --task-description <desc> --task-id <id> [--mode <mode>]" >&2
40
+ exit 1
41
+ fi
42
+
43
+ # Validate mode
44
+ case "$MODE" in
45
+ mvp|standard|enterprise) ;;
46
+ *)
47
+ echo "WARNING: Invalid mode '$MODE', defaulting to 'standard'" >&2
48
+ MODE="standard"
49
+ ;;
50
+ esac
51
+
52
+ # Create config directory
53
+ CONFIG_DIR="$PROJECT_ROOT/.cfn/task-configs"
54
+ mkdir -p "$CONFIG_DIR"
55
+
56
+ CONFIG_FILE="$CONFIG_DIR/task-${TASK_ID}.json"
57
+
58
+ # Extract epic goal (first sentence or summary)
59
+ EPIC_GOAL=$(echo "$TASK_DESCRIPTION" | head -1 | sed 's/[[:space:]]*$//')
60
+
61
+ # Infer scope from task description
62
+ extract_scope() {
63
+ local description="$1"
64
+ local in_scope=()
65
+ local out_scope=()
66
+ local deliverables=()
67
+ local directory="."
68
+ local acceptance=()
69
+
70
+ # Technology detection
71
+ if echo "$description" | grep -iq "jwt\|auth\|oauth"; then
72
+ in_scope+=("JWT token generation and validation")
73
+ in_scope+=("Authentication middleware")
74
+ deliverables+=("src/auth/jwt.ts" "src/auth/middleware.ts" "tests/auth.test.ts")
75
+ directory="src/auth"
76
+ acceptance+=("JWT tokens expire correctly")
77
+ acceptance+=("Authentication tests pass with >80% coverage")
78
+ out_scope+=("Multi-factor authentication")
79
+ out_scope+=("Biometric login")
80
+ fi
81
+
82
+ if echo "$description" | grep -iq "api\|backend\|server"; then
83
+ in_scope+=("REST API implementation")
84
+ in_scope+=("Request validation")
85
+ deliverables+=("src/api/routes.ts" "src/api/controllers.ts")
86
+ acceptance+=("API endpoints return correct status codes")
87
+ acceptance+=("Request validation handles edge cases")
88
+ out_scope+=("GraphQL support")
89
+ out_scope+=("WebSocket real-time features")
90
+ fi
91
+
92
+ if echo "$description" | grep -iq "database\|schema\|migration"; then
93
+ in_scope+=("Database schema design")
94
+ in_scope+=("Migration scripts")
95
+ deliverables+=("src/db/schema.sql" "src/db/migrations/")
96
+ acceptance+=("Migrations run without errors")
97
+ acceptance+=("Database constraints enforced")
98
+ out_scope+=("Database sharding")
99
+ out_scope+=("Multi-region replication")
100
+ fi
101
+
102
+ if echo "$description" | grep -iq "test\|testing"; then
103
+ in_scope+=("Unit tests")
104
+ in_scope+=("Integration tests")
105
+ deliverables+=("tests/unit/" "tests/integration/")
106
+ acceptance+=("Test coverage >80%")
107
+ acceptance+=("All tests pass")
108
+ out_scope+=("End-to-end tests")
109
+ out_scope+=("Performance benchmarks")
110
+ fi
111
+
112
+ # Default scope if nothing matched
113
+ if [ ${#in_scope[@]} -eq 0 ]; then
114
+ in_scope+=("Core functionality implementation")
115
+ in_scope+=("Basic error handling")
116
+ deliverables+=("src/main.ts" "tests/main.test.ts")
117
+ acceptance+=("Core features work as specified")
118
+ acceptance+=("Basic tests pass")
119
+ out_scope+=("Advanced features")
120
+ out_scope+=("Performance optimization")
121
+ fi
122
+
123
+ # Always add common out-of-scope items
124
+ out_scope+=("User analytics and tracking")
125
+ out_scope+=("Admin dashboard UI")
126
+ out_scope+=("Monitoring and alerting")
127
+
128
+ # Build JSON arrays
129
+ local in_scope_json=$(printf '%s\n' "${in_scope[@]}" | jq -R . | jq -s .)
130
+ local out_scope_json=$(printf '%s\n' "${out_scope[@]}" | jq -R . | jq -s .)
131
+ local deliverables_json=$(printf '%s\n' "${deliverables[@]}" | jq -R . | jq -s .)
132
+ local acceptance_json=$(printf '%s\n' "${acceptance[@]}" | jq -R . | jq -s .)
133
+
134
+ # Return as JSON object
135
+ jq -n \
136
+ --arg goal "$EPIC_GOAL" \
137
+ --argjson in_scope "$in_scope_json" \
138
+ --argjson out_scope "$out_scope_json" \
139
+ --argjson deliverables "$deliverables_json" \
140
+ --arg directory "$directory" \
141
+ --argjson acceptance "$acceptance_json" \
142
+ '{
143
+ epicGoal: $goal,
144
+ inScope: $in_scope,
145
+ outOfScope: $out_scope,
146
+ deliverables: $deliverables,
147
+ directory: $directory,
148
+ acceptanceCriteria: $acceptance
149
+ }'
150
+ }
151
+
152
+ # Select agents based on task description
153
+ select_agents() {
154
+ local description="$1"
155
+ local loop3=()
156
+ local loop2=("reviewer" "tester")
157
+
158
+ # Loop 3 implementers
159
+ if echo "$description" | grep -iq "api\|backend\|server"; then
160
+ loop3+=("backend-dev")
161
+ fi
162
+
163
+ if echo "$description" | grep -iq "frontend\|react\|vue\|ui"; then
164
+ loop3+=("react-frontend-engineer")
165
+ fi
166
+
167
+ if echo "$description" | grep -iq "mobile\|ios\|android"; then
168
+ loop3+=("mobile-dev")
169
+ fi
170
+
171
+ if echo "$description" | grep -iq "infrastructure\|deploy\|devops\|docker\|k8s"; then
172
+ loop3+=("devops-engineer")
173
+ fi
174
+
175
+ if echo "$description" | grep -iq "npm\|package\|library"; then
176
+ loop3+=("npm-package-specialist")
177
+ fi
178
+
179
+ if echo "$description" | grep -iq "research\|analyze\|investigate"; then
180
+ loop3+=("researcher")
181
+ fi
182
+
183
+ # Default implementer
184
+ if [ ${#loop3[@]} -eq 0 ]; then
185
+ loop3+=("backend-dev" "researcher")
186
+ fi
187
+
188
+ # Loop 2 validators (adaptive scaling)
189
+ # Standard: 3-5 files → add architect, security
190
+ loop2+=("architect" "security-specialist")
191
+
192
+ # Complex/Enterprise: >5 files → add code-analyzer
193
+ if echo "$description" | grep -iq "large\|complex\|enterprise"; then
194
+ loop2+=("code-analyzer")
195
+ fi
196
+
197
+ # Build JSON arrays
198
+ local loop3_json=$(printf '%s\n' "${loop3[@]}" | jq -R . | jq -s .)
199
+ local loop2_json=$(printf '%s\n' "${loop2[@]}" | jq -R . | jq -s .)
200
+
201
+ jq -n \
202
+ --argjson loop3 "$loop3_json" \
203
+ --argjson loop2 "$loop2_json" \
204
+ '{
205
+ loop3: $loop3,
206
+ loop2: $loop2
207
+ }'
208
+ }
209
+
210
+ # Get thresholds based on mode
211
+ get_thresholds() {
212
+ local mode="$1"
213
+
214
+ case "$mode" in
215
+ mvp)
216
+ echo '{"gate": 0.70, "consensus": 0.80, "maxIterations": 5}'
217
+ ;;
218
+ enterprise)
219
+ echo '{"gate": 0.85, "consensus": 0.95, "maxIterations": 15}'
220
+ ;;
221
+ *)
222
+ echo '{"gate": 0.75, "consensus": 0.90, "maxIterations": 10}'
223
+ ;;
224
+ esac
225
+ }
226
+
227
+ # Generate config
228
+ SCOPE_JSON=$(extract_scope "$TASK_DESCRIPTION")
229
+ AGENTS_JSON=$(select_agents "$TASK_DESCRIPTION")
230
+ THRESHOLDS_JSON=$(get_thresholds "$MODE")
231
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
232
+
233
+ CONFIG_JSON=$(jq -n \
234
+ --arg task_id "$TASK_ID" \
235
+ --arg description "$TASK_DESCRIPTION" \
236
+ --arg mode "$MODE" \
237
+ --argjson scope "$SCOPE_JSON" \
238
+ --argjson agents "$AGENTS_JSON" \
239
+ --argjson thresholds "$THRESHOLDS_JSON" \
240
+ --arg created "$TIMESTAMP" \
241
+ '{
242
+ taskId: $task_id,
243
+ taskDescription: $description,
244
+ mode: $mode,
245
+ spawnMode: "task",
246
+ scope: $scope,
247
+ agents: $agents,
248
+ thresholds: $thresholds,
249
+ createdAt: $created
250
+ }')
251
+
252
+ # Write config file
253
+ echo "$CONFIG_JSON" | jq . > "$CONFIG_FILE"
254
+
255
+ # Validate JSON
256
+ if ! jq empty "$CONFIG_FILE" 2>/dev/null; then
257
+ echo "❌ Failed to create valid JSON config" >&2
258
+ rm -f "$CONFIG_FILE"
259
+ exit 1
260
+ fi
261
+
262
+ # Success
263
+ echo "✅ Config initialized: $CONFIG_FILE" >&2
264
+ echo "$CONFIG_FILE"