claude-evolve 1.3.15 → 1.3.18
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 +2 -1
- package/bin/claude-evolve-analyze +20 -13
- package/bin/claude-evolve-ideate +50 -25
- package/bin/claude-evolve-run +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Think of it like **genetic algorithms for code** - it handles the mutations and
|
|
|
12
12
|
|
|
13
13
|
The system operates with specialized phases working together:
|
|
14
14
|
|
|
15
|
-
- 🧠 **Ideation Phase**: Generates creative algorithm variations using Claude Opus
|
|
15
|
+
- 🧠 **Ideation Phase**: Generates creative algorithm variations using codex o3-pro (if available) or Claude Opus
|
|
16
16
|
- 🔬 **Development Phase**: Implements mutations using Claude Sonnet (with periodic Opus "megathinking")
|
|
17
17
|
- 📊 **Evaluation Phase**: Tests performance against your custom evaluator
|
|
18
18
|
- 📈 **Analysis Phase**: Tracks evolution progress and identifies top performers
|
|
@@ -180,6 +180,7 @@ Evolution experiments can fail for various reasons. The system tracks these fail
|
|
|
180
180
|
- [Claude CLI](https://docs.anthropic.com/en/docs/claude-code) (`claude` command)
|
|
181
181
|
|
|
182
182
|
### Optional (but recommended)
|
|
183
|
+
- [Codex CLI](https://github.com/aboutgaurav/codex) (`codex` command) - Uses o3-pro model for superior ideation when available
|
|
183
184
|
- Scientific Python libraries (numpy, scipy, etc.) depending on your algorithms
|
|
184
185
|
- Plotting libraries (matplotlib, plotly) for analyzing results
|
|
185
186
|
|
|
@@ -292,16 +292,18 @@ if command -v gnuplot >/dev/null 2>&1 && [[ $valid_performance_count -gt 0 ]]; t
|
|
|
292
292
|
echo "# Row ID Performance Generation" >"$data_file"
|
|
293
293
|
echo "# Generation AvgPerformance Color" >"$gen_avg_file"
|
|
294
294
|
|
|
295
|
-
# Get color by generation number (rotates through
|
|
295
|
+
# Get color by generation number (rotates through 7 colors)
|
|
296
296
|
get_gen_color() {
|
|
297
297
|
local gen_num="$1"
|
|
298
|
-
local color_index=$(( gen_num %
|
|
298
|
+
local color_index=$(( gen_num % 7 ))
|
|
299
299
|
case $color_index in
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
300
|
+
0) echo "#1f77b4" ;; # blue
|
|
301
|
+
1) echo "#ff7f0e" ;; # orange
|
|
302
|
+
2) echo "#2ca02c" ;; # green
|
|
303
|
+
3) echo "#d62728" ;; # red
|
|
304
|
+
4) echo "#9467bd" ;; # purple
|
|
305
|
+
5) echo "#8c564b" ;; # brown
|
|
306
|
+
6) echo "#e377c2" ;; # pink
|
|
305
307
|
esac
|
|
306
308
|
}
|
|
307
309
|
|
|
@@ -426,7 +428,7 @@ print(f'max_id=\"{max_id}\"')
|
|
|
426
428
|
max_gen_num=$gen_num
|
|
427
429
|
fi
|
|
428
430
|
color=$(get_gen_color "$gen_num")
|
|
429
|
-
echo "$gen_index \"$
|
|
431
|
+
echo "$gen_index \"Gen$gen_num\" $avg \"$color\"" >>"$gen_avg_file"
|
|
430
432
|
((gen_index++))
|
|
431
433
|
fi
|
|
432
434
|
fi
|
|
@@ -482,13 +484,18 @@ print(f'max_id=\"{max_id}\"')
|
|
|
482
484
|
fi
|
|
483
485
|
fi
|
|
484
486
|
|
|
485
|
-
# Build x-axis labels for generation chart
|
|
487
|
+
# Build x-axis labels for generation chart (include all generations from data)
|
|
486
488
|
xtics_labels=""
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
489
|
+
label_index=1
|
|
490
|
+
for gen in $(cut -d' ' -f1 "$gen_data_temp" | sort -u); do
|
|
491
|
+
if [[ -n $gen ]]; then
|
|
492
|
+
gen_display=$(echo "$gen" | sed 's/gen0*//')
|
|
493
|
+
if [[ -n $xtics_labels ]]; then
|
|
494
|
+
xtics_labels="$xtics_labels, "
|
|
495
|
+
fi
|
|
496
|
+
xtics_labels="${xtics_labels}\"Gen$gen_display\" $label_index"
|
|
497
|
+
((label_index++))
|
|
490
498
|
fi
|
|
491
|
-
xtics_labels="${xtics_labels}\"Gen$i\" $i"
|
|
492
499
|
done
|
|
493
500
|
|
|
494
501
|
gnuplot <<EOF
|
package/bin/claude-evolve-ideate
CHANGED
|
@@ -14,14 +14,34 @@ else
|
|
|
14
14
|
load_config
|
|
15
15
|
fi
|
|
16
16
|
|
|
17
|
-
# Helper function to call
|
|
18
|
-
|
|
17
|
+
# Helper function to call AI model (codex o3-pro if available, else Claude)
|
|
18
|
+
call_ai_with_limit_check() {
|
|
19
19
|
local prompt="$1"
|
|
20
|
-
local
|
|
20
|
+
local fallback_model="${2:-opus}"
|
|
21
|
+
|
|
22
|
+
# Check if codex is available
|
|
23
|
+
if command -v codex >/dev/null 2>&1; then
|
|
24
|
+
echo "[INFO] Using codex o3-pro for ideation (smartest available model)" >&2
|
|
25
|
+
|
|
26
|
+
# Call codex with o3-pro model using -q flag and --full-auto
|
|
27
|
+
local ai_output
|
|
28
|
+
ai_output=$(codex -m o3-pro --full-auto -q "$prompt" 2>&1)
|
|
29
|
+
local ai_exit_code=$?
|
|
30
|
+
|
|
31
|
+
if [[ $ai_exit_code -eq 0 ]]; then
|
|
32
|
+
echo "$ai_output"
|
|
33
|
+
return 0
|
|
34
|
+
else
|
|
35
|
+
echo "[WARN] Codex failed, falling back to Claude" >&2
|
|
36
|
+
fi
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Fall back to Claude
|
|
40
|
+
echo "[INFO] Using Claude $fallback_model for ideation" >&2
|
|
21
41
|
|
|
22
42
|
# Call Claude and capture output
|
|
23
43
|
local claude_output
|
|
24
|
-
claude_output=$(echo "$prompt" | claude --dangerously-skip-permissions --model "$
|
|
44
|
+
claude_output=$(echo "$prompt" | claude --dangerously-skip-permissions --model "$fallback_model" -p 2>&1)
|
|
25
45
|
local claude_exit_code=$?
|
|
26
46
|
|
|
27
47
|
# Check for usage limit
|
|
@@ -51,6 +71,11 @@ call_claude_with_limit_check() {
|
|
|
51
71
|
return $claude_exit_code
|
|
52
72
|
}
|
|
53
73
|
|
|
74
|
+
# Backward compatibility alias
|
|
75
|
+
call_claude_with_limit_check() {
|
|
76
|
+
call_ai_with_limit_check "$@"
|
|
77
|
+
}
|
|
78
|
+
|
|
54
79
|
# Parse arguments
|
|
55
80
|
use_strategies=true
|
|
56
81
|
no_ai=false
|
|
@@ -253,9 +278,9 @@ ideate_manual() {
|
|
|
253
278
|
|
|
254
279
|
# Generate ideas using AI with multi-strategy approach
|
|
255
280
|
ideate_ai_strategies() {
|
|
256
|
-
# Check for
|
|
257
|
-
if ! command -v claude >/dev/null 2>&1; then
|
|
258
|
-
echo "[WARN]
|
|
281
|
+
# Check for AI CLI (codex or claude)
|
|
282
|
+
if ! command -v codex >/dev/null 2>&1 && ! command -v claude >/dev/null 2>&1; then
|
|
283
|
+
echo "[WARN] No AI CLI found (codex or claude). Falling back to manual entry."
|
|
259
284
|
return 1
|
|
260
285
|
fi
|
|
261
286
|
|
|
@@ -329,9 +354,9 @@ Example descriptions:
|
|
|
329
354
|
|
|
330
355
|
Add exactly $count rows to the CSV file now."
|
|
331
356
|
|
|
332
|
-
echo "[INFO]
|
|
333
|
-
if !
|
|
334
|
-
echo "[WARN]
|
|
357
|
+
echo "[INFO] Generating $count novel exploration ideas..."
|
|
358
|
+
if ! call_ai_with_limit_check "$prompt" "opus"; then
|
|
359
|
+
echo "[WARN] AI failed to generate novel ideas" >&2
|
|
335
360
|
return 1
|
|
336
361
|
fi
|
|
337
362
|
echo "[INFO] Novel exploration ideas generated"
|
|
@@ -382,9 +407,9 @@ Example descriptions:
|
|
|
382
407
|
|
|
383
408
|
Add exactly $count parameter tuning rows to the CSV file now."
|
|
384
409
|
|
|
385
|
-
echo "[INFO]
|
|
386
|
-
if !
|
|
387
|
-
echo "[WARN]
|
|
410
|
+
echo "[INFO] Generating $count hill climbing ideas..."
|
|
411
|
+
if ! call_ai_with_limit_check "$prompt" "opus"; then
|
|
412
|
+
echo "[WARN] AI failed to generate hill climbing ideas" >&2
|
|
388
413
|
return 1
|
|
389
414
|
fi
|
|
390
415
|
echo "[INFO] Hill climbing ideas generated"
|
|
@@ -435,9 +460,9 @@ Example descriptions:
|
|
|
435
460
|
|
|
436
461
|
Add exactly $count structural modification rows to the CSV file now."
|
|
437
462
|
|
|
438
|
-
echo "[INFO]
|
|
439
|
-
if !
|
|
440
|
-
echo "[WARN]
|
|
463
|
+
echo "[INFO] Generating $count structural mutation ideas..."
|
|
464
|
+
if ! call_ai_with_limit_check "$prompt" "opus"; then
|
|
465
|
+
echo "[WARN] AI failed to generate structural mutation ideas" >&2
|
|
441
466
|
return 1
|
|
442
467
|
fi
|
|
443
468
|
echo "[INFO] Structural mutation ideas generated"
|
|
@@ -488,9 +513,9 @@ Example descriptions:
|
|
|
488
513
|
|
|
489
514
|
Add exactly $count hybrid combination rows to the CSV file now."
|
|
490
515
|
|
|
491
|
-
echo "[INFO]
|
|
492
|
-
if !
|
|
493
|
-
echo "[WARN]
|
|
516
|
+
echo "[INFO] Generating $count crossover hybrid ideas..."
|
|
517
|
+
if ! call_ai_with_limit_check "$prompt" "opus"; then
|
|
518
|
+
echo "[WARN] AI failed to generate crossover ideas" >&2
|
|
494
519
|
return 1
|
|
495
520
|
fi
|
|
496
521
|
echo "[INFO] Crossover hybrid ideas generated"
|
|
@@ -498,9 +523,9 @@ Add exactly $count hybrid combination rows to the CSV file now."
|
|
|
498
523
|
|
|
499
524
|
# Legacy AI generation mode (for backward compatibility)
|
|
500
525
|
ideate_ai_legacy() {
|
|
501
|
-
# Check for
|
|
502
|
-
if ! command -v claude >/dev/null 2>&1; then
|
|
503
|
-
echo "[WARN]
|
|
526
|
+
# Check for AI CLI (codex or claude)
|
|
527
|
+
if ! command -v codex >/dev/null 2>&1 && ! command -v claude >/dev/null 2>&1; then
|
|
528
|
+
echo "[WARN] No AI CLI found (codex or claude). Falling back to manual entry."
|
|
504
529
|
return 1
|
|
505
530
|
fi
|
|
506
531
|
|
|
@@ -553,9 +578,9 @@ Requirements for new CSV rows:
|
|
|
553
578
|
|
|
554
579
|
Add exactly $TOTAL_IDEAS algorithm variation rows to the CSV file now."
|
|
555
580
|
|
|
556
|
-
echo "[INFO]
|
|
557
|
-
if !
|
|
558
|
-
echo "[WARN]
|
|
581
|
+
echo "[INFO] Generating $TOTAL_IDEAS ideas (legacy mode)..."
|
|
582
|
+
if ! call_ai_with_limit_check "$prompt" "opus"; then
|
|
583
|
+
echo "[WARN] AI failed to generate ideas" >&2
|
|
559
584
|
return 1
|
|
560
585
|
fi
|
|
561
586
|
echo "[INFO] Legacy ideas generated"
|
package/bin/claude-evolve-run
CHANGED
|
@@ -340,6 +340,11 @@ echo "[INFO] Using Claude Sonnet for development"
|
|
|
340
340
|
# Create mutation prompt - Claude will edit the file directly
|
|
341
341
|
prompt="Edit the file $output_file to implement this specific change: $description
|
|
342
342
|
|
|
343
|
+
IMPORTANT: Before starting the task, you MUST read and understand:
|
|
344
|
+
1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
|
|
345
|
+
2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
|
|
346
|
+
3. Ensure all your work follows the architectural and development guidelines from both files
|
|
347
|
+
|
|
343
348
|
Requirements:
|
|
344
349
|
- Edit the file directly (don't just provide comments or suggestions)
|
|
345
350
|
- Maintain the same function signatures and interfaces
|
|
@@ -347,7 +352,7 @@ Requirements:
|
|
|
347
352
|
- Ensure the code runs without syntax errors
|
|
348
353
|
- Add proper error handling if needed
|
|
349
354
|
|
|
350
|
-
The file currently contains the parent algorithm. Modify it according to the description above."
|
|
355
|
+
The file currently contains the parent algorithm. Modify it according to the description above while adhering to all guidelines from the CLAUDE.md files."
|
|
351
356
|
|
|
352
357
|
# Generate mutation (skip for baseline)
|
|
353
358
|
if [[ $id == "000" || $id == "0" ]]; then
|