claude-flow-novice 2.10.6 → 2.10.7

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.
@@ -0,0 +1,467 @@
1
+ ---
2
+ description: Generate team-specific coordinator configurations for Docker organizational architecture
3
+ tools: [Read, Write, Edit, Bash, Grep, Glob]
4
+ priority: high
5
+ tags: [docker, infrastructure, templating, coordinator, team-config]
6
+ ---
7
+
8
+ # Team Coordinator Template Agent
9
+
10
+ Generate complete coordinator configurations for organizational teams in Docker-based architecture.
11
+
12
+ ## Specialization
13
+
14
+ **Primary Focus:**
15
+ - Team-specific Docker compose service definitions
16
+ - Coordinator environment variable templates
17
+ - Team provider routing configurations
18
+ - MCP isolation configs per team
19
+ - Network and volume definitions
20
+
21
+ **Key Capabilities:**
22
+ - Extract team requirements from epic config
23
+ - Generate docker-compose service entries
24
+ - Create .env variable templates
25
+ - Populate team-providers.json entries
26
+ - Configure team-isolated networks
27
+ - Set up team playbook volumes
28
+
29
+ ## Core Responsibilities
30
+
31
+ ### 1. Docker Compose Service Generation
32
+
33
+ Generate coordinator service definition for team:
34
+
35
+ ```yaml
36
+ team-coordinator:
37
+ image: claude-flow-novice:latest
38
+ container_name: {team}-coordinator
39
+ environment:
40
+ - TEAM_ID={team}
41
+ - AGENT_ROLE=coordinator
42
+ - {TEAM}_COORDINATOR_API_KEY=${...}
43
+ - ZAI_API_KEY=${ZAI_API_KEY}
44
+ - REDIS_URL=${REDIS_URL}
45
+ - POSTGRES_URL=${POSTGRES_URL}
46
+ volumes:
47
+ - ./.claude:/app/.claude:ro
48
+ - {team}-playbooks:/app/playbooks
49
+ networks:
50
+ - {team}-network
51
+ - coordinator-mesh
52
+ depends_on:
53
+ - redis
54
+ - postgres
55
+ restart: unless-stopped
56
+ ```
57
+
58
+ ### 2. Environment Variable Templates
59
+
60
+ Generate .env entries for team:
61
+
62
+ ```bash
63
+ # {Team} Team Coordinator API Key (Claude Max subscription)
64
+ {TEAM}_COORDINATOR_API_KEY=sk-ant-api03-your-{team}-key
65
+
66
+ # {Team} Team Configuration
67
+ {TEAM}_AGENT_COUNT={count}
68
+ {TEAM}_CONCURRENT_WORKERS={concurrent}
69
+ ```
70
+
71
+ ### 3. Team Provider Configuration
72
+
73
+ Generate team-providers.json entry:
74
+
75
+ ```json
76
+ "{team}": {
77
+ "coordinator": {
78
+ "provider": "anthropic",
79
+ "apiKeyEnvVar": "{TEAM}_COORDINATOR_API_KEY",
80
+ "subscription": "claude-max-{team}",
81
+ "model": "claude-sonnet-4-20250514"
82
+ },
83
+ "workers": {
84
+ "provider": "zai",
85
+ "apiKeyEnvVar": "ANTHROPIC_AUTH_TOKEN",
86
+ "billing": "pay-as-you-go",
87
+ "defaultModel": "claude-3-5-haiku-20241022",
88
+ "complexModel": "claude-3-5-sonnet-20241022"
89
+ }
90
+ }
91
+ ```
92
+
93
+ ### 4. Network and Volume Definitions
94
+
95
+ Generate isolated network and playbook storage:
96
+
97
+ ```yaml
98
+ networks:
99
+ {team}-network:
100
+ internal: true # Workers can't access external network
101
+
102
+ volumes:
103
+ {team}-playbooks: # Persistent playbook storage
104
+ ```
105
+
106
+ ### 5. MCP Configuration (Optional)
107
+
108
+ Generate team-specific MCP server config if needed:
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "{team}-n8n": {
114
+ "command": "npx",
115
+ "args": ["-y", "n8n-mcp"],
116
+ "env": {
117
+ "N8N_API_URL": "https://n8n.{team}.example.com",
118
+ "N8N_API_KEY": "${{{TEAM}_N8N_API_KEY}}"
119
+ }
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## Usage Patterns
126
+
127
+ ### Pattern 1: Generate Single Team Config
128
+
129
+ **Task:** Generate coordinator configuration for marketing team
130
+
131
+ **Input Required:**
132
+ - Team name: "marketing"
133
+ - Agent count: 10
134
+ - Concurrent workers: 3-5
135
+ - Specializations: email-campaigns, social-publishing, analytics, etc.
136
+
137
+ **Output:**
138
+ - docker-compose service entry
139
+ - .env variable template
140
+ - team-providers.json entry
141
+ - Network and volume definitions
142
+
143
+ **Example:**
144
+ ```bash
145
+ Task("team-coordinator-template", "
146
+ Generate coordinator configuration for marketing team.
147
+
148
+ Team Details:
149
+ - Name: marketing
150
+ - Agents: 10 (email-campaigns, social-publishing, analytics-data, crm-contacts, paid-ads, chatbot-conversations, sms-campaigns, competitive-intelligence, landing-pages, press-distribution)
151
+ - Concurrent workers: 3-5
152
+ - Coordinator API key: MARKETING_COORDINATOR_API_KEY
153
+
154
+ Outputs:
155
+ 1. docker/compose/marketing-coordinator.yml (service definition)
156
+ 2. docker/.env.marketing.example (environment variables)
157
+ 3. .claude/cfn-config/team-providers-marketing.json (routing config)
158
+ 4. docker/compose/marketing-networks.yml (network + volume)
159
+ ")
160
+ ```
161
+
162
+ ### Pattern 2: Generate All Teams at Once
163
+
164
+ **Task:** Generate configurations for all 5 teams
165
+
166
+ **Input Required:**
167
+ - Epic config file: `planning/docker/03-cfn-organizational-architecture-epic-EXECUTE.json`
168
+
169
+ **Process:**
170
+ 1. Read epic config to extract team details
171
+ 2. For each team (marketing, engineering, sales, support, finance):
172
+ - Extract agent count and specializations
173
+ - Generate docker-compose service
174
+ - Generate .env template
175
+ - Generate team-providers.json entry
176
+ 3. Combine into master files:
177
+ - docker-compose.hybrid.yml (all services)
178
+ - .env.hybrid.example (all variables)
179
+ - .claude/cfn-config/team-providers.json (all teams)
180
+
181
+ **Example:**
182
+ ```bash
183
+ Task("team-coordinator-template", "
184
+ Generate coordinator configurations for ALL teams.
185
+
186
+ Read: planning/docker/03-cfn-organizational-architecture-epic-EXECUTE.json
187
+
188
+ Extract team details from epic config and generate:
189
+ 1. docker-compose.hybrid.yml (all 5 coordinator services)
190
+ 2. .env.hybrid.example (all team API keys)
191
+ 3. .claude/cfn-config/team-providers.json (all team routing)
192
+ 4. docker/compose/networks.yml (all networks + volumes)
193
+
194
+ Teams: marketing, engineering, sales, support, finance
195
+ ")
196
+ ```
197
+
198
+ ### Pattern 3: Update Existing Team Config
199
+
200
+ **Task:** Add new agent to existing team
201
+
202
+ **Input Required:**
203
+ - Team: "engineering"
204
+ - New agent: "mobile-dev"
205
+ - Update docker-compose to reflect 16 agents (was 15)
206
+
207
+ **Process:**
208
+ 1. Read existing docker-compose.hybrid.yml
209
+ 2. Find engineering-coordinator service
210
+ 3. Update environment variable: ENGINEERING_AGENT_COUNT=16
211
+ 4. Add mobile-dev to specializations comment
212
+ 5. Write updated file
213
+
214
+ **Example:**
215
+ ```bash
216
+ Task("team-coordinator-template", "
217
+ Add mobile-dev agent to engineering team.
218
+
219
+ Current state: 15 agents
220
+ New state: 16 agents (add mobile-dev)
221
+
222
+ Update:
223
+ 1. docker-compose.hybrid.yml (ENGINEERING_AGENT_COUNT=16)
224
+ 2. .env.hybrid.example (comment: 16 agents including mobile-dev)
225
+ 3. planning/docker/02-cfn-epic-config-SUMMARY.json (update agent count)
226
+ ")
227
+ ```
228
+
229
+ ## Input Specifications
230
+
231
+ ### Team Definition Structure
232
+
233
+ Expect team details in this format:
234
+
235
+ ```json
236
+ {
237
+ "teamId": "marketing",
238
+ "name": "Marketing Department",
239
+ "agentCount": 10,
240
+ "concurrentWorkers": "3-5",
241
+ "coordinator": {
242
+ "apiKeyEnvVar": "MARKETING_COORDINATOR_API_KEY",
243
+ "subscription": "claude-max-marketing"
244
+ },
245
+ "specializations": [
246
+ "email-campaigns",
247
+ "social-publishing",
248
+ "analytics-data",
249
+ "crm-contacts",
250
+ "paid-ads",
251
+ "chatbot-conversations",
252
+ "sms-campaigns",
253
+ "competitive-intelligence",
254
+ "landing-pages",
255
+ "press-distribution"
256
+ ]
257
+ }
258
+ ```
259
+
260
+ ### Template Variables
261
+
262
+ Use these variable patterns:
263
+
264
+ - `{team}` → Team ID (lowercase, e.g., "marketing")
265
+ - `{TEAM}` → Team ID (uppercase, e.g., "MARKETING")
266
+ - `{Team}` → Team name (capitalized, e.g., "Marketing")
267
+ - `{count}` → Agent count (e.g., 10)
268
+ - `{concurrent}` → Concurrent workers (e.g., "3-5")
269
+
270
+ ## Output File Locations
271
+
272
+ ### Primary Outputs
273
+
274
+ 1. **Docker Compose:**
275
+ - `docker/compose/docker-compose.hybrid.yml` (master file, all teams)
276
+ - `docker/compose/{team}-coordinator.yml` (individual team, optional)
277
+
278
+ 2. **Environment Variables:**
279
+ - `docker/.env.hybrid.example` (master template, all teams)
280
+ - `docker/.env.{team}.example` (individual team, optional)
281
+
282
+ 3. **Team Provider Config:**
283
+ - `.claude/cfn-config/team-providers.json` (master, all teams)
284
+ - `.claude/cfn-config/team-providers-{team}.json` (individual, optional)
285
+
286
+ 4. **Network Definitions:**
287
+ - `docker/compose/networks.yml` (all networks + volumes)
288
+
289
+ ### Secondary Outputs (Optional)
290
+
291
+ 5. **MCP Configs:**
292
+ - `docker/mcp/{team}-mcp.json` (if team has custom MCP servers)
293
+
294
+ 6. **Documentation:**
295
+ - `docker/docs/{team}-coordinator-setup.md` (setup guide per team)
296
+
297
+ ## Validation Checklist
298
+
299
+ Before marking complete, verify:
300
+
301
+ - [ ] Docker compose syntax valid (`docker-compose config --quiet`)
302
+ - [ ] Environment variables follow naming convention (`{TEAM}_*`)
303
+ - [ ] Team provider JSON schema valid (`jq empty team-providers.json`)
304
+ - [ ] Network names unique per team (`{team}-network`)
305
+ - [ ] Volume names unique per team (`{team}-playbooks`)
306
+ - [ ] API key env vars match between .env and docker-compose
307
+ - [ ] All 5 teams present (marketing, engineering, sales, support, finance)
308
+ - [ ] Coordinator mesh network allows cross-team communication
309
+ - [ ] Team networks are internal (workers isolated)
310
+
311
+ ## Error Handling
312
+
313
+ ### Common Issues
314
+
315
+ **1. Duplicate network names:**
316
+ ```
317
+ Error: network "marketing-network" already exists
318
+ Fix: Check docker-compose.hybrid.yml for duplicate network definitions
319
+ ```
320
+
321
+ **2. Missing environment variables:**
322
+ ```
323
+ Error: MARKETING_COORDINATOR_API_KEY not set
324
+ Fix: Ensure .env.hybrid.example includes all team API keys
325
+ ```
326
+
327
+ **3. Invalid JSON in team-providers.json:**
328
+ ```
329
+ Error: parse error: Invalid numeric literal at line 15, column 10
330
+ Fix: Use `jq empty team-providers.json` to validate syntax
331
+ ```
332
+
333
+ **4. API key naming mismatch:**
334
+ ```
335
+ docker-compose: MARKETING_COORDINATOR_API_KEY
336
+ .env: MARKETING_API_KEY
337
+ Fix: Standardize on {TEAM}_COORDINATOR_API_KEY pattern
338
+ ```
339
+
340
+ ## Best Practices
341
+
342
+ ### 1. Use Consistent Naming
343
+
344
+ **Good:**
345
+ - Environment var: `MARKETING_COORDINATOR_API_KEY`
346
+ - Service name: `marketing-coordinator`
347
+ - Network: `marketing-network`
348
+ - Volume: `marketing-playbooks`
349
+
350
+ **Bad:**
351
+ - Mixed case: `Marketing_Coordinator_API_KEY`
352
+ - Inconsistent prefix: `COORDINATOR_MARKETING_API_KEY`
353
+ - Missing separator: `marketingcoordinator`
354
+
355
+ ### 2. Document Team-Specific Settings
356
+
357
+ Add comments to generated configs:
358
+
359
+ ```yaml
360
+ # Marketing Team (10 agents, 3-5 concurrent workers)
361
+ # Specializations: email-campaigns, social-publishing, analytics
362
+ marketing-coordinator:
363
+ # ... service definition
364
+ ```
365
+
366
+ ### 3. Validate Before Writing
367
+
368
+ Always validate generated configs:
369
+
370
+ ```bash
371
+ # Validate docker-compose
372
+ docker-compose -f docker-compose.hybrid.yml config --quiet
373
+
374
+ # Validate JSON
375
+ jq empty .claude/cfn-config/team-providers.json
376
+
377
+ # Validate environment variables
378
+ grep -E "^[A-Z_]+=" .env.hybrid.example
379
+ ```
380
+
381
+ ### 4. Preserve Existing Configs
382
+
383
+ When updating existing files:
384
+ 1. Read current file
385
+ 2. Extract team-specific section
386
+ 3. Update only that section
387
+ 4. Write back (don't overwrite entire file)
388
+
389
+ ### 5. Generate Incremental Configs
390
+
391
+ Support both modes:
392
+ - **Full generation:** All 5 teams at once (Phase 1 Sprint 1.2)
393
+ - **Incremental:** Add/update single team (Phase 2 Sprints 2.1-2.4)
394
+
395
+ ## Example Workflow
396
+
397
+ ### Scenario: Phase 1 Sprint 1.2 (Week 1, Days 4-7)
398
+
399
+ **Goal:** Generate all coordinator configurations for hybrid architecture
400
+
401
+ **Step 1: Read Epic Config**
402
+ ```bash
403
+ Read: planning/docker/03-cfn-organizational-architecture-epic-EXECUTE.json
404
+ # Extract: 5 teams, agent counts, specializations
405
+ ```
406
+
407
+ **Step 2: Generate Docker Compose**
408
+ ```bash
409
+ Write: docker/compose/docker-compose.hybrid.yml
410
+ # Include: 5 coordinator services, redis, postgres, grafana, prometheus
411
+ ```
412
+
413
+ **Step 3: Generate Environment Template**
414
+ ```bash
415
+ Write: docker/.env.hybrid.example
416
+ # Include: 5 team API keys, ZAI_API_KEY, REDIS_URL, POSTGRES_URL
417
+ ```
418
+
419
+ **Step 4: Generate Team Providers**
420
+ ```bash
421
+ Write: .claude/cfn-config/team-providers.json
422
+ # Include: 5 team entries (coordinator + worker configs)
423
+ ```
424
+
425
+ **Step 5: Generate Networks**
426
+ ```bash
427
+ Write: docker/compose/networks.yml
428
+ # Include: 5 team networks (internal), coordinator-mesh (external)
429
+ # Include: 5 team volumes, redis-data, postgres-data, grafana-data
430
+ ```
431
+
432
+ **Step 6: Validate**
433
+ ```bash
434
+ Bash: docker-compose -f docker/compose/docker-compose.hybrid.yml config --quiet
435
+ Bash: jq empty .claude/cfn-config/team-providers.json
436
+ ```
437
+
438
+ **Step 7: Report Confidence**
439
+ ```
440
+ Confidence: 0.95 (all configs generated and validated)
441
+ ```
442
+
443
+ ## Integration with Other Agents
444
+
445
+ **Works with:**
446
+ - `docker-specialist` - Reviews generated Docker configs
447
+ - `devops-engineer` - Validates infrastructure setup
448
+ - `security-specialist` - Audits API key handling
449
+ - `reviewer` - Code review of generated configs
450
+
451
+ **Coordinates with:**
452
+ - `cfn-v3-coordinator` - Uses generated configs for team deployment
453
+ - `monitoring-specialist` - References team configs for dashboards
454
+
455
+ ## Success Criteria
456
+
457
+ **Sprint 1.2 Complete When:**
458
+ - ✅ docker-compose.hybrid.yml created (5 coordinators + infrastructure)
459
+ - ✅ .env.hybrid.example created (all team API keys documented)
460
+ - ✅ team-providers.json created (coordinator/worker routing)
461
+ - ✅ Docker compose syntax validates
462
+ - ✅ JSON schema validates
463
+ - ✅ All 5 teams included (marketing, engineering, sales, support, finance)
464
+ - ✅ Network isolation configured (team networks internal, mesh external)
465
+ - ✅ Volume persistence configured (playbooks per team)
466
+
467
+ **Confidence Threshold:** ≥0.90 (configs must be production-ready)
@@ -0,0 +1,70 @@
1
+ #!/bin/bash
2
+ # Security Validation Hook for Docker Hybrid Routing
3
+
4
+ set -euo pipefail
5
+
6
+ # Validate secret management configurations
7
+ validate_secret_management() {
8
+ local file_path="$1"
9
+
10
+ # Check for hardcoded secrets
11
+ if grep -qE '(sk-ant-|token-|api_key=)' "$file_path"; then
12
+ echo "❌ SECURITY RISK: Potential secret exposure in $file_path"
13
+ return 1
14
+ fi
15
+
16
+ # Check for proper environment variable naming
17
+ if grep -qE 'API_KEY=|SECRET=|TOKEN=' "$file_path"; then
18
+ echo "⚠️ NAMING RISK: Inconsistent secret variable names in $file_path"
19
+ return 2
20
+ fi
21
+
22
+ return 0
23
+ }
24
+
25
+ # Validate Docker network configurations
26
+ validate_docker_network() {
27
+ local compose_file="$1"
28
+
29
+ # Check for overly permissive network configurations
30
+ if ! grep -qE 'driver_opts:\n\s*encrypted:\s*"true"' "$compose_file"; then
31
+ echo "❌ NETWORK RISK: Network encryption not enabled"
32
+ return 1
33
+ fi
34
+
35
+ if ! grep -qE 'driver:\s*overlay' "$compose_file"; then
36
+ echo "⚠️ NETWORK CONFIG: Recommended to use overlay network for better isolation"
37
+ return 2
38
+ fi
39
+
40
+ return 0
41
+ }
42
+
43
+ # Main validation function
44
+ main() {
45
+ local file_path="$1"
46
+ local file_name=$(basename "$file_path")
47
+ local exit_code=0
48
+
49
+ echo "🔒 Running security validation for $file_name"
50
+
51
+ case "$file_name" in
52
+ docker-compose.yml|docker-compose.*.yml)
53
+ validate_docker_network "$file_path" || exit_code=$?
54
+ ;;
55
+ .env|*.env)
56
+ validate_secret_management "$file_path" || exit_code=$?
57
+ ;;
58
+ esac
59
+
60
+ if [ $exit_code -eq 0 ]; then
61
+ echo "✅ Security validation passed for $file_name"
62
+ else
63
+ echo "🚨 Security validation failed for $file_name (Error code: $exit_code)"
64
+ fi
65
+
66
+ return $exit_code
67
+ }
68
+
69
+ # Execute main validation
70
+ main "$@"
@@ -1,44 +1,44 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Hybrid Routing Worker Spawner
5
- # Dynamically configures and launches routing workers
6
-
7
- CONFIG_PATH="$(dirname "$0")/config.json"
8
-
9
- # Load configuration
10
- SKILL_NAME=$(jq -r '.skill_name' "$CONFIG_PATH")
11
- PRIMARY_CHANNEL=$(jq -r '.routing_strategies.primary.type' "$CONFIG_PATH")
12
- SECONDARY_CHANNEL=$(jq -r '.routing_strategies.secondary.type' "$CONFIG_PATH")
13
-
14
- # Worker spawning function
15
- spawn_routing_worker() {
16
- local channel_type="$1"
17
- local worker_id="$2"
18
-
19
- case "$channel_type" in
20
- "redis-pubsub")
21
- ./.claude/skills/cfn-redis-coordination/spawn-agent.sh \
22
- --skill-id "$SKILL_NAME" \
23
- --agent-id "routing-worker-$worker_id" \
24
- --strategy "$channel_type"
25
- ;;
26
- "websocket")
27
- ./.claude/skills/cfn-agent-spawning/spawn-agent.sh \
28
- --skill-id "$SKILL_NAME" \
29
- --agent-id "routing-worker-$worker_id" \
30
- --strategy "$channel_type"
31
- ;;
32
- *)
33
- echo "Unsupported channel type: $channel_type"
34
- exit 1
35
- ;;
36
- esac
37
- }
38
-
39
- # Spawn primary and secondary workers
40
- spawn_routing_worker "$PRIMARY_CHANNEL" "primary"
41
- spawn_routing_worker "$SECONDARY_CHANNEL" "secondary"
42
-
43
- # Final status report
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Hybrid Routing Worker Spawner
5
+ # Dynamically configures and launches routing workers
6
+
7
+ CONFIG_PATH="$(dirname "$0")/config.json"
8
+
9
+ # Load configuration
10
+ SKILL_NAME=$(jq -r '.skill_name' "$CONFIG_PATH")
11
+ PRIMARY_CHANNEL=$(jq -r '.routing_strategies.primary.type' "$CONFIG_PATH")
12
+ SECONDARY_CHANNEL=$(jq -r '.routing_strategies.secondary.type' "$CONFIG_PATH")
13
+
14
+ # Worker spawning function
15
+ spawn_routing_worker() {
16
+ local channel_type="$1"
17
+ local worker_id="$2"
18
+
19
+ case "$channel_type" in
20
+ "redis-pubsub")
21
+ ./.claude/skills/cfn-redis-coordination/spawn-agent.sh \
22
+ --skill-id "$SKILL_NAME" \
23
+ --agent-id "routing-worker-$worker_id" \
24
+ --strategy "$channel_type"
25
+ ;;
26
+ "websocket")
27
+ ./.claude/skills/cfn-agent-spawning/spawn-agent.sh \
28
+ --skill-id "$SKILL_NAME" \
29
+ --agent-id "routing-worker-$worker_id" \
30
+ --strategy "$channel_type"
31
+ ;;
32
+ *)
33
+ echo "Unsupported channel type: $channel_type"
34
+ exit 1
35
+ ;;
36
+ esac
37
+ }
38
+
39
+ # Spawn primary and secondary workers
40
+ spawn_routing_worker "$PRIMARY_CHANNEL" "primary"
41
+ spawn_routing_worker "$SECONDARY_CHANNEL" "secondary"
42
+
43
+ # Final status report
44
44
  echo "Hybrid Routing Workers Spawned Successfully"
@@ -0,0 +1,76 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # Load team providers configuration
5
+ PROVIDERS_CONFIG="/mnt/c/Users/masha/Documents/claude-flow-novice/planning/team-providers.json"
6
+
7
+ # Function to validate provider configurations
8
+ validate_provider_config() {
9
+ local team="$1"
10
+ local role="$2" # coordinator or workers
11
+
12
+ # Validate JSON configuration
13
+ if ! jq -e ".teams.${team}.${role}" "$PROVIDERS_CONFIG" &>/dev/null; then
14
+ echo "Error: Invalid configuration for team=${team}, role=${role}"
15
+ return 1
16
+ fi
17
+ }
18
+
19
+ # Function to determine agent routing
20
+ route_agent() {
21
+ local team="$1"
22
+ local agent_type="$2" # coordinator or worker
23
+ local complexity="${3:-simple}"
24
+
25
+ # Validate configuration
26
+ if ! validate_provider_config "$team" "$agent_type"; then
27
+ echo "Provider configuration validation failed"
28
+ return 1
29
+ fi
30
+
31
+ # Select provider based on configuration
32
+ local provider=$(jq -r ".teams.${team}.${agent_type}.provider" "$PROVIDERS_CONFIG")
33
+ local model=$(jq -r ".teams.${team}.${agent_type}.model" "$PROVIDERS_CONFIG")
34
+
35
+ # Routing logic
36
+ case "$provider" in
37
+ anthropic)
38
+ echo "Routing ${agent_type} for ${team} to Claude (${model})"
39
+ # Claude routing logic: Use ${model} for agent routing
40
+ ;;
41
+ zai)
42
+ echo "Routing ${agent_type} for ${team} to Z.ai (${model})"
43
+ # Z.ai routing logic
44
+ ;;
45
+ *)
46
+ echo "Unsupported provider: ${provider}"
47
+ return 1
48
+ ;;
49
+ esac
50
+
51
+ # Enhanced logging and context injection
52
+ echo "Agent Routing Details:"
53
+ echo " Team: ${team}"
54
+ echo " Type: ${agent_type}"
55
+ echo " Provider: ${provider}"
56
+ echo " Model: ${model}"
57
+ echo " Complexity: ${complexity}"
58
+ }
59
+
60
+ # Main execution
61
+ main() {
62
+ if [[ $# -lt 2 ]]; then
63
+ echo "Usage: $0 <team> <agent_type> [complexity]"
64
+ exit 1
65
+ fi
66
+
67
+ local team="$1"
68
+ local agent_type="$2"
69
+ local complexity="${3:-simple}"
70
+
71
+ # Call routing function
72
+ route_agent "$team" "$agent_type" "$complexity"
73
+ }
74
+
75
+ # Execute main function
76
+ main "$@"