claude-flow-novice 2.10.7 → 2.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/cfn/CFN_LOOP_TASK_MODE.md +94 -0
- package/.claude/commands/cfn/cfn-loop.md +4 -3
- package/.claude/hooks/cfn-invoke-pre-edit.sh +88 -0
- package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +176 -0
- package/claude-assets/agents/csuite/cto-agent.md +371 -0
- package/claude-assets/agents/marketing_hybrid/cost_tracker.md +13 -0
- package/claude-assets/agents/marketing_hybrid/docker_deployer.md +13 -0
- package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +13 -0
- package/claude-assets/commands/cfn/CFN_LOOP_TASK_MODE.md +94 -0
- package/claude-assets/commands/cfn/cfn-loop.md +4 -3
- package/claude-assets/hooks/cfn-invoke-pre-edit.sh +88 -0
- package/claude-assets/hooks/post-edit.config.json +19 -8
- package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +176 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh +130 -0
- package/claude-assets/skills/pre-edit-backup/cleanup.sh +155 -0
- package/claude-assets/skills/pre-edit-backup/restore.sh +128 -0
- package/claude-assets/skills/pre-edit-backup/revert-file.sh +168 -0
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/package.json +1 -1
- package/scripts/marketing_hybrid_deployment.sh +45 -0
- package/scripts/redis-prometheus-exporter.sh +33 -0
- package/scripts/track-zai-costs.sh +19 -0
- package/claude-assets/skills/team-provider-routing/spawn-worker.sh +0 -91
|
@@ -15,6 +15,23 @@ Task Mode: Main Chat spawns coordinator and agents via Task() tool with full con
|
|
|
15
15
|
| **Provider** | All Anthropic | CLI uses Z.ai routing |
|
|
16
16
|
| **Cost** | ~$0.150/iteration | ~$0.054/iteration (64% savings) |
|
|
17
17
|
| **Use Case** | Debugging, prototyping, learning | Production, cost optimization |
|
|
18
|
+
| **ACE Reflection** | Optional via `--ace-reflect` flag | Always enabled |
|
|
19
|
+
|
|
20
|
+
### ACE Reflection Flag
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Enable ACE reflection after each sprint (captures lessons learned)
|
|
24
|
+
/cfn-loop "Task description" --spawn-mode=task --ace-reflect
|
|
25
|
+
|
|
26
|
+
# Without ACE reflection (default for backwards compatibility)
|
|
27
|
+
/cfn-loop "Task description" --spawn-mode=task
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**When to use `--ace-reflect`:**
|
|
31
|
+
- Long-running epics (3+ sprints) where learning accumulates
|
|
32
|
+
- Complex tasks with multiple iterations
|
|
33
|
+
- Teams building organizational knowledge
|
|
34
|
+
- Post-mortem analysis and continuous improvement
|
|
18
35
|
|
|
19
36
|
---
|
|
20
37
|
|
|
@@ -144,9 +161,30 @@ Iterations: Loop 3: ${L3}, Loop 2: ${L2} | Decision: PROCEED
|
|
|
144
161
|
EOF
|
|
145
162
|
```
|
|
146
163
|
|
|
164
|
+
### 5. ACE Reflection (Optional - If `--ace-reflect` flag enabled)
|
|
165
|
+
```bash
|
|
166
|
+
# Only run if --ace-reflect flag was passed to /cfn-loop command
|
|
167
|
+
if [[ "$ACE_REFLECT_ENABLED" == "true" ]]; then
|
|
168
|
+
echo "📊 Capturing ACE reflection..."
|
|
169
|
+
./.claude/skills/cfn-ace-system/invoke-context-reflect.sh \
|
|
170
|
+
--task-id "${TASK_ID}" \
|
|
171
|
+
--sprint-id "${SPRINT_NUM}" \
|
|
172
|
+
--consensus "${CONSENSUS}" \
|
|
173
|
+
--iterations-loop3 "${L3}" \
|
|
174
|
+
--iterations-loop2 "${L2}" \
|
|
175
|
+
--deliverables "$(git diff HEAD~1 --name-only | tr '\n' ',')"
|
|
176
|
+
|
|
177
|
+
# Output: Stores reflection in SQLite with tags, confidence, priority
|
|
178
|
+
# Categories: PATTERN, STRAT, ANTI, EDGE
|
|
179
|
+
# Automatic tag extraction and deduplication
|
|
180
|
+
echo "✅ ACE reflection captured: $(sqlite3 .claude/cfn-data/cfn-loop.db 'SELECT COUNT(*) FROM context_reflections WHERE task_id = \"'${TASK_ID}'\"') bullets"
|
|
181
|
+
fi
|
|
182
|
+
```
|
|
183
|
+
|
|
147
184
|
**Checklist:**
|
|
148
185
|
- [ ] Consensus ≥ threshold | [ ] Product Owner approved | [ ] Deliverables verified
|
|
149
186
|
- [ ] Tests passing | [ ] Git committed | [ ] Git pushed | [ ] Summary generated
|
|
187
|
+
- [ ] ACE reflection captured (if `--ace-reflect` enabled)
|
|
150
188
|
|
|
151
189
|
---
|
|
152
190
|
|
|
@@ -341,12 +379,68 @@ Complex/Enterprise (>5 files, >500 LOC): +code-analyzer
|
|
|
341
379
|
|
|
342
380
|
---
|
|
343
381
|
|
|
382
|
+
## ACE System Integration
|
|
383
|
+
|
|
384
|
+
### Reflection After Sprint
|
|
385
|
+
After each sprint completion, Task Mode should capture lessons learned:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Automatic reflection capture (called after git push)
|
|
389
|
+
./.claude/skills/cfn-ace-system/invoke-context-reflect.sh \
|
|
390
|
+
--task-id "${TASK_ID}" \
|
|
391
|
+
--sprint-id "${SPRINT_NUM}" \
|
|
392
|
+
--consensus "${CONSENSUS}" \
|
|
393
|
+
--iterations-loop3 "${L3}" \
|
|
394
|
+
--iterations-loop2 "${L2}" \
|
|
395
|
+
--deliverables "$(git diff HEAD~1 --name-only | tr '\n' ',')"
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**What Gets Captured:**
|
|
399
|
+
- Patterns that worked well (consensus ≥0.90, low iterations)
|
|
400
|
+
- Anti-patterns that caused issues (high iterations, deliverable failures)
|
|
401
|
+
- Strategy patterns (agent selection, validator scaling effectiveness)
|
|
402
|
+
- Edge cases (timeout scenarios, race conditions, blocking issues)
|
|
403
|
+
|
|
404
|
+
**Storage:**
|
|
405
|
+
- SQLite database: `.claude/cfn-data/cfn-loop.db`
|
|
406
|
+
- Table: `context_reflections`
|
|
407
|
+
- Automatic tagging, deduplication, confidence scoring
|
|
408
|
+
|
|
409
|
+
**Benefits:**
|
|
410
|
+
- Future sprints learn from past mistakes
|
|
411
|
+
- Adaptive validator scaling improves over time
|
|
412
|
+
- Pattern recognition across projects
|
|
413
|
+
- Knowledge accumulation (not lost between sessions)
|
|
414
|
+
|
|
415
|
+
### Optional: Context Injection (Future Enhancement)
|
|
416
|
+
Before spawning agents, inject relevant lessons:
|
|
417
|
+
```bash
|
|
418
|
+
# Not yet implemented in Task Mode, but available:
|
|
419
|
+
./.claude/skills/cfn-ace-system/invoke-context-inject.sh \
|
|
420
|
+
--task "${TASK_DESCRIPTION}" \
|
|
421
|
+
--phase "${PHASE_NAME}" \
|
|
422
|
+
--tags "validation,consensus,deliverables"
|
|
423
|
+
# Returns: Top N relevant bullets from past reflections
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Optional: Context Curation (Periodic Maintenance)
|
|
427
|
+
Merge and deduplicate reflection data:
|
|
428
|
+
```bash
|
|
429
|
+
# Run monthly or after major epics:
|
|
430
|
+
./.claude/skills/cfn-ace-system/invoke-context-curate.sh \
|
|
431
|
+
--confidence-threshold 0.85 \
|
|
432
|
+
--merge-similar-patterns
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
344
437
|
## Related Documentation
|
|
345
438
|
|
|
346
439
|
- **CFN Coordinator Parameters**: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
|
|
347
440
|
- **Redis Coordination**: `.claude/skills/cfn-redis-coordination/SKILL.md`
|
|
348
441
|
- **Product Owner Decision**: `.claude/skills/cfn-product-owner-decision/SKILL.md`
|
|
349
442
|
- **Agent Output Standards**: `docs/AGENT_OUTPUT_STANDARDS.md`
|
|
443
|
+
- **ACE System**: `.claude/skills/cfn-ace-system/SKILL.md`
|
|
350
444
|
|
|
351
445
|
---
|
|
352
446
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Execute autonomous 3-loop self-correcting CFN workflow with automatic retry and consensus validation"
|
|
3
|
-
argument-hint: "<task description> [--phase=name] [--mode=mvp|standard|enterprise] [--spawn-mode=cli|task] [--max-loop2=10] [--max-loop3=10]"
|
|
3
|
+
argument-hint: "<task description> [--phase=name] [--mode=mvp|standard|enterprise] [--spawn-mode=cli|task] [--max-loop2=10] [--max-loop3=10] [--ace-reflect]"
|
|
4
4
|
allowed-tools: ["Task", "TodoWrite", "Read", "Write", "Edit", "Bash", "Glob", "Grep"]
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -38,10 +38,11 @@ LOOP 3: Primary Swarm Execution with subtask iterations
|
|
|
38
38
|
- `--phase=<name>`: Optional phase name for tracking
|
|
39
39
|
- `--mode=<mvp|standard|enterprise>`: Coordinator mode (default: standard)
|
|
40
40
|
- `--spawn-mode=<cli|task>`: Agent spawning method (default: cli)
|
|
41
|
-
- **cli**: Cost-optimized (95-98% savings), background execution, Redis monitoring
|
|
42
|
-
- **task**: Full visibility in Main Chat, direct spawning, debugging
|
|
41
|
+
- **cli**: Cost-optimized (95-98% savings), background execution, Redis monitoring, ACE always enabled
|
|
42
|
+
- **task**: Full visibility in Main Chat, direct spawning, debugging, ACE optional via flag
|
|
43
43
|
- `--max-loop2=<n>`: Max consensus iterations (default: 10)
|
|
44
44
|
- `--max-loop3=<n>`: Max primary swarm iterations (default: 10)
|
|
45
|
+
- `--ace-reflect`: Enable ACE reflection after each sprint (Task mode only, captures lessons learned)
|
|
45
46
|
|
|
46
47
|
## Coordinator Modes
|
|
47
48
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Pre-Edit Backup Hook Wrapper
|
|
4
|
+
# Creates backup before file modifications in agent workflows
|
|
5
|
+
#
|
|
6
|
+
# Usage: .claude/hooks/cfn-invoke-pre-edit.sh FILE_PATH --agent-id AGENT_ID
|
|
7
|
+
#
|
|
8
|
+
# Arguments:
|
|
9
|
+
# FILE_PATH - Absolute path to file about to be edited
|
|
10
|
+
# --agent-id - Unique identifier for the agent performing the edit
|
|
11
|
+
#
|
|
12
|
+
# Returns:
|
|
13
|
+
# Backup directory path on success
|
|
14
|
+
# Exit code 1 on failure
|
|
15
|
+
#
|
|
16
|
+
# Example:
|
|
17
|
+
# BACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh "/path/to/file.txt" --agent-id "backend-dev-1")
|
|
18
|
+
|
|
19
|
+
set -euo pipefail
|
|
20
|
+
|
|
21
|
+
# === Parse Arguments ===
|
|
22
|
+
|
|
23
|
+
FILE_PATH=""
|
|
24
|
+
AGENT_ID=""
|
|
25
|
+
|
|
26
|
+
# First positional argument is file path
|
|
27
|
+
if [[ -n "${1:-}" ]] && [[ "$1" != --* ]]; then
|
|
28
|
+
FILE_PATH="$1"
|
|
29
|
+
shift
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Parse remaining named arguments
|
|
33
|
+
while [[ "$#" -gt 0 ]]; do
|
|
34
|
+
case $1 in
|
|
35
|
+
--agent-id)
|
|
36
|
+
if [[ -z "${2:-}" ]]; then
|
|
37
|
+
echo "Error: --agent-id requires a value" >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
AGENT_ID="$2"
|
|
41
|
+
shift 2
|
|
42
|
+
;;
|
|
43
|
+
*)
|
|
44
|
+
echo "Error: Unknown argument: $1" >&2
|
|
45
|
+
echo "Usage: cfn-invoke-pre-edit.sh FILE_PATH --agent-id AGENT_ID" >&2
|
|
46
|
+
exit 1
|
|
47
|
+
;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
# === Validate Inputs ===
|
|
52
|
+
|
|
53
|
+
if [[ -z "$FILE_PATH" ]]; then
|
|
54
|
+
echo "Error: No file path provided" >&2
|
|
55
|
+
echo "Usage: cfn-invoke-pre-edit.sh FILE_PATH --agent-id AGENT_ID" >&2
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
if [[ -z "$AGENT_ID" ]]; then
|
|
60
|
+
echo "Error: No agent ID provided" >&2
|
|
61
|
+
echo "Usage: cfn-invoke-pre-edit.sh FILE_PATH --agent-id AGENT_ID" >&2
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
if [[ ! -f "$FILE_PATH" ]]; then
|
|
66
|
+
echo "Error: File does not exist: $FILE_PATH" >&2
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# === Execute Pre-Edit Backup ===
|
|
71
|
+
|
|
72
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
73
|
+
BACKUP_SCRIPT="${SCRIPT_DIR}/../skills/pre-edit-backup/backup.sh"
|
|
74
|
+
|
|
75
|
+
if [[ ! -f "$BACKUP_SCRIPT" ]]; then
|
|
76
|
+
echo "Error: Backup script not found: $BACKUP_SCRIPT" >&2
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# Execute backup and capture output
|
|
81
|
+
if ! BACKUP_DIR=$("$BACKUP_SCRIPT" "$FILE_PATH" "$AGENT_ID" 2>&1); then
|
|
82
|
+
echo "Error: Backup failed: $BACKUP_DIR" >&2
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# Return backup directory path
|
|
87
|
+
echo "$BACKUP_DIR"
|
|
88
|
+
exit 0
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# Get the project root directory
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
7
|
+
|
|
8
|
+
# Load team providers configuration
|
|
9
|
+
PROVIDERS_CONFIG="${PROJECT_ROOT}/.claude/cfn-config/team-providers.json"
|
|
10
|
+
|
|
11
|
+
# Validate configuration file exists
|
|
12
|
+
if [[ ! -f "$PROVIDERS_CONFIG" ]]; then
|
|
13
|
+
echo "Error: Team providers configuration not found at $PROVIDERS_CONFIG"
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Function to validate provider configuration
|
|
18
|
+
validate_provider_config() {
|
|
19
|
+
local team="$1"
|
|
20
|
+
local role="$2" # coordinator or workers
|
|
21
|
+
|
|
22
|
+
# Use jq to validate JSON structure and extract provider details
|
|
23
|
+
if ! jq -e ".teams.${team}.${role}" "$PROVIDERS_CONFIG" &>/dev/null; then
|
|
24
|
+
echo "Error: Invalid or missing provider configuration for team=${team}, role=${role}"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Function to select appropriate model based on complexity
|
|
30
|
+
select_model() {
|
|
31
|
+
local team="$1"
|
|
32
|
+
local complexity="$2" # simple or complex
|
|
33
|
+
|
|
34
|
+
# Retrieve model based on complexity and team configuration
|
|
35
|
+
local model=$(jq -r ".teams.${team}.workers.models.${complexity}" "$PROVIDERS_CONFIG")
|
|
36
|
+
|
|
37
|
+
if [[ "$model" == "null" ]]; then
|
|
38
|
+
# Fallback to default complexity from global config
|
|
39
|
+
local default_complexity=$(jq -r ".global_config.default_complexity // \"simple\"" "$PROVIDERS_CONFIG")
|
|
40
|
+
model=$(jq -r ".teams.${team}.workers.models.${default_complexity}" "$PROVIDERS_CONFIG")
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
echo "$model"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Function to get API key from environment
|
|
47
|
+
get_api_key() {
|
|
48
|
+
local team="$1"
|
|
49
|
+
local role="$2" # coordinator or workers
|
|
50
|
+
|
|
51
|
+
# Extract apiKeyEnvVar from config
|
|
52
|
+
local api_key_env_var=$(jq -r ".teams.${team}.${role}.apiKeyEnvVar" "$PROVIDERS_CONFIG")
|
|
53
|
+
|
|
54
|
+
if [[ "$api_key_env_var" == "null" ]]; then
|
|
55
|
+
echo "Error: apiKeyEnvVar not found for team=${team}, role=${role}"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Get actual API key value from environment
|
|
60
|
+
local api_key_value="${!api_key_env_var:-}"
|
|
61
|
+
|
|
62
|
+
if [[ -z "$api_key_value" ]]; then
|
|
63
|
+
echo "Error: API key not found in environment variable: $api_key_env_var"
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
echo "$api_key_value"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Main worker spawning logic
|
|
71
|
+
spawn_worker() {
|
|
72
|
+
local team="$1"
|
|
73
|
+
local complexity="${2:-simple}"
|
|
74
|
+
local provider_mode="${3:-auto}"
|
|
75
|
+
local agent_type="${4:-}"
|
|
76
|
+
local task_context="${5:-}"
|
|
77
|
+
|
|
78
|
+
# Validate input parameters
|
|
79
|
+
validate_provider_config "$team" "workers"
|
|
80
|
+
|
|
81
|
+
# Retrieve provider details from config
|
|
82
|
+
local provider=$(jq -r ".teams.${team}.workers.provider" "$PROVIDERS_CONFIG")
|
|
83
|
+
local api_key_env_var=$(jq -r ".teams.${team}.workers.apiKeyEnvVar" "$PROVIDERS_CONFIG")
|
|
84
|
+
local base_url=$(jq -r ".teams.${team}.workers.baseUrl" "$PROVIDERS_CONFIG")
|
|
85
|
+
|
|
86
|
+
# Select model dynamically based on complexity
|
|
87
|
+
local model=$(select_model "$team" "$complexity")
|
|
88
|
+
|
|
89
|
+
# Get API key from environment
|
|
90
|
+
local api_key=$(get_api_key "$team" "workers")
|
|
91
|
+
|
|
92
|
+
# Provider routing logic
|
|
93
|
+
case "$provider_mode" in
|
|
94
|
+
auto)
|
|
95
|
+
# Use provider routing rules from config
|
|
96
|
+
case "$provider" in
|
|
97
|
+
zai)
|
|
98
|
+
echo "Spawning Z.ai worker for team ${team} (Model: ${model}, Complexity: ${complexity})"
|
|
99
|
+
|
|
100
|
+
# Set environment variables for Z.ai spawning
|
|
101
|
+
export ZAI_API_KEY="$api_key"
|
|
102
|
+
export ZAI_BASE_URL="$base_url"
|
|
103
|
+
export ZAI_MODEL="$model"
|
|
104
|
+
|
|
105
|
+
# Call actual spawning logic (to be implemented)
|
|
106
|
+
# npx claude-flow-novice spawn "$agent_type" \
|
|
107
|
+
# --provider zai \
|
|
108
|
+
# --model "$model" \
|
|
109
|
+
# --context "$task_context"
|
|
110
|
+
;;
|
|
111
|
+
anthropic)
|
|
112
|
+
echo "Spawning Anthropic worker for team ${team} (Model: ${model}, Complexity: ${complexity})"
|
|
113
|
+
|
|
114
|
+
# Set environment variables for Anthropic spawning
|
|
115
|
+
export ANTHROPIC_API_KEY="$api_key"
|
|
116
|
+
export ANTHROPIC_BASE_URL="$base_url"
|
|
117
|
+
export ANTHROPIC_MODEL="$model"
|
|
118
|
+
|
|
119
|
+
# Call actual spawning logic (to be implemented)
|
|
120
|
+
# npx claude-flow-novice spawn "$agent_type" \
|
|
121
|
+
# --provider anthropic \
|
|
122
|
+
# --model "$model" \
|
|
123
|
+
# --context "$task_context"
|
|
124
|
+
;;
|
|
125
|
+
*)
|
|
126
|
+
echo "Error: Unsupported provider: ${provider}"
|
|
127
|
+
exit 1
|
|
128
|
+
;;
|
|
129
|
+
esac
|
|
130
|
+
;;
|
|
131
|
+
zai)
|
|
132
|
+
echo "Force spawning Z.ai worker for team ${team} (Model: ${model})"
|
|
133
|
+
local api_key=$(get_api_key "$team" "workers")
|
|
134
|
+
export ZAI_API_KEY="$api_key"
|
|
135
|
+
export ZAI_BASE_URL="$base_url"
|
|
136
|
+
export ZAI_MODEL="$model"
|
|
137
|
+
;;
|
|
138
|
+
anthropic)
|
|
139
|
+
echo "Force spawning Anthropic worker for team ${team} (Model: ${model})"
|
|
140
|
+
local api_key=$(get_api_key "$team" "workers")
|
|
141
|
+
export ANTHROPIC_API_KEY="$api_key"
|
|
142
|
+
export ANTHROPIC_BASE_URL="$base_url"
|
|
143
|
+
export ANTHROPIC_MODEL="$model"
|
|
144
|
+
;;
|
|
145
|
+
*)
|
|
146
|
+
echo "Error: Invalid provider mode: ${provider_mode}"
|
|
147
|
+
exit 1
|
|
148
|
+
;;
|
|
149
|
+
esac
|
|
150
|
+
|
|
151
|
+
# Log successful configuration
|
|
152
|
+
echo "Worker configuration complete:"
|
|
153
|
+
echo " Team: $team"
|
|
154
|
+
echo " Provider: $provider"
|
|
155
|
+
echo " Model: $model"
|
|
156
|
+
echo " Base URL: $base_url"
|
|
157
|
+
echo " Complexity: $complexity"
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# Allow script to be used as a function or executed directly
|
|
161
|
+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
162
|
+
# Script is being run directly
|
|
163
|
+
if [[ $# -lt 1 ]]; then
|
|
164
|
+
echo "Usage: $0 <team> [complexity] [provider_mode] [agent_type] [task_context]"
|
|
165
|
+
echo ""
|
|
166
|
+
echo "Arguments:"
|
|
167
|
+
echo " team - Team name (marketing, engineering, sales, support, finance)"
|
|
168
|
+
echo " complexity - simple|complex (default: simple)"
|
|
169
|
+
echo " provider_mode - auto|zai|anthropic (default: auto)"
|
|
170
|
+
echo " agent_type - Agent type to spawn (optional)"
|
|
171
|
+
echo " task_context - Task context for agent (optional)"
|
|
172
|
+
exit 1
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
spawn_worker "$@"
|
|
176
|
+
fi
|