claude-evolve 1.3.4 → 1.3.6

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/README.md CHANGED
@@ -196,6 +196,27 @@ your-project/
196
196
  └── (your main project files)
197
197
  ```
198
198
 
199
+ ## Environment Variables for Evaluators
200
+
201
+ When your evaluator.py runs, it has access to the `EXPERIMENT_ID` environment variable containing the current experiment's ID (e.g., `gen07-001`). This allows evaluators to:
202
+
203
+ - Save experiment-specific output files
204
+ - Log metrics with experiment identifiers
205
+ - Implement experiment-aware logic
206
+ - Track which algorithm variant is being evaluated
207
+
208
+ Example usage in evaluator.py:
209
+ ```python
210
+ import os
211
+
212
+ # Get the current experiment ID
213
+ experiment_id = os.environ.get('EXPERIMENT_ID', 'unknown')
214
+
215
+ # Use it for logging or file naming
216
+ output_file = f"results_{experiment_id}.json"
217
+ print(f"Evaluating experiment: {experiment_id}")
218
+ ```
219
+
199
220
  ## Configuration
200
221
 
201
222
  Edit `evolution/config.yaml` to customize:
@@ -6,7 +6,13 @@ set -e
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
  # shellcheck source=../lib/config.sh
8
8
  source "$SCRIPT_DIR/../lib/config.sh"
9
- load_config
9
+
10
+ # Use CLAUDE_EVOLVE_CONFIG if set, otherwise default
11
+ if [[ -n ${CLAUDE_EVOLVE_CONFIG:-} ]]; then
12
+ load_config "$CLAUDE_EVOLVE_CONFIG"
13
+ else
14
+ load_config
15
+ fi
10
16
 
11
17
  # Parse arguments
12
18
  open_chart=false
@@ -61,7 +61,12 @@ while [[ $# -gt 0 ]]; do
61
61
  done
62
62
 
63
63
  # Load current config
64
- load_config
64
+ # Use CLAUDE_EVOLVE_CONFIG if set, otherwise default
65
+ if [[ -n ${CLAUDE_EVOLVE_CONFIG:-} ]]; then
66
+ load_config "$CLAUDE_EVOLVE_CONFIG"
67
+ else
68
+ load_config
69
+ fi
65
70
 
66
71
  case $action in
67
72
  show)
@@ -6,7 +6,13 @@ set -e
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
  # shellcheck source=../lib/config.sh
8
8
  source "$SCRIPT_DIR/../lib/config.sh"
9
- load_config
9
+
10
+ # Use CLAUDE_EVOLVE_CONFIG if set, otherwise default
11
+ if [[ -n ${CLAUDE_EVOLVE_CONFIG:-} ]]; then
12
+ load_config "$CLAUDE_EVOLVE_CONFIG"
13
+ else
14
+ load_config
15
+ fi
10
16
 
11
17
  # Helper function to call Claude with usage limit detection
12
18
  call_claude_with_limit_check() {
@@ -47,7 +47,7 @@ show_help() {
47
47
  claude-evolve - AI-powered algorithm evolution tool
48
48
 
49
49
  USAGE:
50
- claude-evolve [COMMAND] [OPTIONS]
50
+ claude-evolve [--config=PATH] [COMMAND] [OPTIONS]
51
51
 
52
52
  COMMANDS:
53
53
  setup Initialize evolution workspace
@@ -56,7 +56,8 @@ COMMANDS:
56
56
  analyze Analyze evolution results
57
57
  help Show this help message
58
58
 
59
- OPTIONS:
59
+ GLOBAL OPTIONS:
60
+ --config=PATH Use alternate config file (default: evolution/config.yaml)
60
61
  -h, --help Show help message
61
62
  -v, --version Show version
62
63
 
@@ -65,6 +66,7 @@ EXAMPLES:
65
66
  claude-evolve ideate 5
66
67
  claude-evolve run --timeout 300
67
68
  claude-evolve analyze --open
69
+ claude-evolve --config=evolution-abc/config.yaml run
68
70
 
69
71
  For more information, visit: https://github.com/anthropics/claude-evolve
70
72
  EOF
@@ -94,6 +96,33 @@ show_menu() {
94
96
  echo
95
97
  }
96
98
 
99
+ # Parse global options
100
+ CONFIG_FILE=""
101
+ while [[ $# -gt 0 ]] && [[ "$1" =~ ^-- ]]; do
102
+ case "$1" in
103
+ --config)
104
+ if [[ -z ${2:-} ]]; then
105
+ echo -e "${RED}[ERROR] --config requires a file path${NC}" >&2
106
+ exit 1
107
+ fi
108
+ CONFIG_FILE="$2"
109
+ shift 2
110
+ ;;
111
+ --config=*)
112
+ CONFIG_FILE="${1#*=}"
113
+ shift
114
+ ;;
115
+ *)
116
+ break
117
+ ;;
118
+ esac
119
+ done
120
+
121
+ # Export CONFIG_FILE for subcommands
122
+ if [[ -n $CONFIG_FILE ]]; then
123
+ export CLAUDE_EVOLVE_CONFIG="$CONFIG_FILE"
124
+ fi
125
+
97
126
  # Check for updates (quick, non-blocking)
98
127
  check_for_updates
99
128
 
@@ -6,7 +6,13 @@ set -e
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
  # shellcheck source=../lib/config.sh
8
8
  source "$SCRIPT_DIR/../lib/config.sh"
9
- load_config
9
+
10
+ # Use CLAUDE_EVOLVE_CONFIG if set, otherwise default
11
+ if [[ -n ${CLAUDE_EVOLVE_CONFIG:-} ]]; then
12
+ load_config "$CLAUDE_EVOLVE_CONFIG"
13
+ else
14
+ load_config
15
+ fi
10
16
 
11
17
  # Parse arguments
12
18
  timeout_seconds=""
@@ -434,13 +440,13 @@ echo "[INFO] Algorithm ready at: $output_file"
434
440
 
435
441
  # Run evaluator
436
442
  echo "[INFO] Running evaluation..."
437
- echo "[INFO] Executing: $PYTHON_CMD $FULL_EVALUATOR_PATH $output_file"
443
+ echo "[INFO] Executing: EXPERIMENT_ID=$id $PYTHON_CMD $FULL_EVALUATOR_PATH $output_file"
438
444
  eval_output=""
439
445
  eval_exit_code=0
440
446
 
441
447
  if [[ -n $timeout_seconds ]]; then
442
448
  echo "[INFO] Evaluation timeout: ${timeout_seconds}s"
443
- if eval_output=$(timeout "$timeout_seconds" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
449
+ if eval_output=$(EXPERIMENT_ID="$id" timeout "$timeout_seconds" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
444
450
  eval_exit_code=0
445
451
  else
446
452
  eval_exit_code=$?
@@ -455,7 +461,7 @@ if [[ -n $timeout_seconds ]]; then
455
461
  fi
456
462
  fi
457
463
  else
458
- if eval_output=$("$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
464
+ if eval_output=$(EXPERIMENT_ID="$id" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
459
465
  eval_exit_code=0
460
466
  else
461
467
  eval_exit_code=$?
@@ -473,7 +479,7 @@ echo "----------------------------------------"
473
479
  echo "=== EVALUATOR EXECUTION ==="
474
480
  echo "ID: $id"
475
481
  echo "Algorithm: $output_file"
476
- echo "Command: $PYTHON_CMD $FULL_EVALUATOR_PATH $output_file"
482
+ echo "Command: EXPERIMENT_ID=$id $PYTHON_CMD $FULL_EVALUATOR_PATH $output_file"
477
483
  echo "Exit code: $eval_exit_code"
478
484
  echo "Timestamp: $(date)"
479
485
  echo
@@ -554,7 +560,7 @@ else
554
560
  recovery_attempted=true
555
561
  # Retry the evaluation
556
562
  echo "[INFO] Retrying evaluation after recovery attempt..."
557
- if eval_output=$("$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
563
+ if eval_output=$(EXPERIMENT_ID="$id" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
558
564
  # Re-process the successful result
559
565
  if score=$(echo "$eval_output" | grep -o '"score"[[:space:]]*:[[:space:]]*[0-9.]*' | cut -d: -f2 | tr -d ' '); then
560
566
  if [[ -n $score ]]; then
@@ -9,7 +9,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
9
  source "$SCRIPT_DIR/../lib/config.sh"
10
10
  # shellcheck source=../lib/csv-lock.sh
11
11
  source "$SCRIPT_DIR/../lib/csv-lock.sh"
12
- load_config
12
+
13
+ # Use CLAUDE_EVOLVE_CONFIG if set, otherwise default
14
+ if [[ -n ${CLAUDE_EVOLVE_CONFIG:-} ]]; then
15
+ load_config "$CLAUDE_EVOLVE_CONFIG"
16
+ else
17
+ load_config
18
+ fi
13
19
 
14
20
  # Parse arguments
15
21
  timeout_seconds=""
@@ -10,7 +10,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
10
  source "$SCRIPT_DIR/../lib/config.sh"
11
11
  # shellcheck source=../lib/csv-lock.sh
12
12
  source "$SCRIPT_DIR/../lib/csv-lock.sh"
13
- load_config
13
+
14
+ # Use CLAUDE_EVOLVE_CONFIG if set, otherwise default
15
+ if [[ -n ${CLAUDE_EVOLVE_CONFIG:-} ]]; then
16
+ load_config "$CLAUDE_EVOLVE_CONFIG"
17
+ else
18
+ load_config
19
+ fi
14
20
 
15
21
  # Parse arguments
16
22
  timeout_seconds=""
@@ -188,7 +194,7 @@ eval_exit_code=0
188
194
  if [[ -n $timeout_seconds ]]; then
189
195
  echo "[WORKER-$$] Evaluation timeout: ${timeout_seconds}s"
190
196
  # For Modal compatibility, don't capture stderr
191
- if eval_output=$(timeout "$timeout_seconds" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file"); then
197
+ if eval_output=$(EXPERIMENT_ID="$id" timeout "$timeout_seconds" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file"); then
192
198
  eval_exit_code=0
193
199
  else
194
200
  eval_exit_code=$?
@@ -200,7 +206,7 @@ if [[ -n $timeout_seconds ]]; then
200
206
  fi
201
207
  else
202
208
  # For Modal compatibility, don't capture stderr
203
- if eval_output=$("$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file"); then
209
+ if eval_output=$(EXPERIMENT_ID="$id" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file"); then
204
210
  eval_exit_code=0
205
211
  else
206
212
  eval_exit_code=$?
package/lib/config.sh CHANGED
@@ -26,6 +26,9 @@ DEFAULT_LOCK_TIMEOUT=30
26
26
 
27
27
  # Load configuration from config file
28
28
  load_config() {
29
+ # Accept config file path as parameter
30
+ local config_file="${1:-evolution/config.yaml}"
31
+
29
32
  # Set defaults first
30
33
  EVOLUTION_DIR="$DEFAULT_EVOLUTION_DIR"
31
34
  ALGORITHM_FILE="$DEFAULT_ALGORITHM_FILE"
@@ -48,9 +51,6 @@ load_config() {
48
51
  PARALLEL_ENABLED="$DEFAULT_PARALLEL_ENABLED"
49
52
  MAX_WORKERS="$DEFAULT_MAX_WORKERS"
50
53
  LOCK_TIMEOUT="$DEFAULT_LOCK_TIMEOUT"
51
-
52
- # Single config file location: evolution/config.yaml
53
- local config_file="evolution/config.yaml"
54
54
 
55
55
  # Load config if found
56
56
  if [[ -f "$config_file" ]]; then
@@ -132,6 +132,16 @@ load_config() {
132
132
  done < "$config_file"
133
133
  fi
134
134
 
135
+ # If config file is in a different directory, use that as the evolution dir
136
+ if [[ "$config_file" != "evolution/config.yaml" ]]; then
137
+ # Extract directory from config file path
138
+ local config_dir=$(dirname "$config_file")
139
+ if [[ "$config_dir" != "." && "$config_dir" != "" ]]; then
140
+ EVOLUTION_DIR="$config_dir"
141
+ echo "[INFO] Using evolution directory from config path: $EVOLUTION_DIR"
142
+ fi
143
+ fi
144
+
135
145
  # Create full paths - ALL paths are relative to evolution_dir
136
146
  FULL_EVOLUTION_DIR="$EVOLUTION_DIR"
137
147
  FULL_ALGORITHM_PATH="$EVOLUTION_DIR/$ALGORITHM_FILE"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",