claude-evolve 1.8.23 → 1.8.24
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/bin/claude-evolve-ideate +24 -19
- package/bin/claude-evolve-worker +4 -4
- package/lib/ai-cli.sh +36 -0
- package/package.json +1 -1
package/bin/claude-evolve-ideate
CHANGED
|
@@ -1064,7 +1064,9 @@ generate_novel_ideas_direct() {
|
|
|
1064
1064
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1065
1065
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
1066
1066
|
|
|
1067
|
-
local prompt="
|
|
1067
|
+
local prompt="$(get_git_protection_warning)
|
|
1068
|
+
|
|
1069
|
+
I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1068
1070
|
|
|
1069
1071
|
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
1070
1072
|
|
|
@@ -1117,8 +1119,7 @@ CRITICAL INSTRUCTIONS:
|
|
|
1117
1119
|
11. Consider machine learning, new indicators, regime detection, risk management, etc.
|
|
1118
1120
|
|
|
1119
1121
|
IMPORTANT: You must APPEND new rows to the existing CSV file. DO NOT replace the file contents. All existing rows must remain unchanged.
|
|
1120
|
-
CRITICAL: You must use your file editing tools (Edit/MultiEdit) to modify the CSV file. DO NOT return CSV text - use your tools to edit the file directly.
|
|
1121
|
-
CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1122
|
+
CRITICAL: You must use your file editing tools (Edit/MultiEdit) to modify the CSV file. DO NOT return CSV text - use your tools to edit the file directly."
|
|
1122
1123
|
|
|
1123
1124
|
# Debug prompt size and context (removed - no longer needed)
|
|
1124
1125
|
|
|
@@ -1219,7 +1220,9 @@ generate_hill_climbing_direct() {
|
|
|
1219
1220
|
|
|
1220
1221
|
# Build prompt using cat with heredoc to avoid variable expansion issues
|
|
1221
1222
|
local prompt
|
|
1222
|
-
prompt
|
|
1223
|
+
prompt="$(get_git_protection_warning)
|
|
1224
|
+
|
|
1225
|
+
$(cat <<EOF
|
|
1223
1226
|
I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1224
1227
|
|
|
1225
1228
|
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
@@ -1231,7 +1234,7 @@ $top_performers
|
|
|
1231
1234
|
|
|
1232
1235
|
IMPORTANT: Generate parameter tuning ideas based primarily on the descriptions and scores above.
|
|
1233
1236
|
EOF
|
|
1234
|
-
)
|
|
1237
|
+
)"
|
|
1235
1238
|
|
|
1236
1239
|
prompt+="
|
|
1237
1240
|
|
|
@@ -1273,8 +1276,7 @@ CRITICAL INSTRUCTIONS:
|
|
|
1273
1276
|
6. You may change the parent_id field if needed to reference a different top performer
|
|
1274
1277
|
7. Each description should focus on adjusting specific parameters - include current and new values
|
|
1275
1278
|
Example: \"Lower rsi_entry from 21 to 18\" or \"Increase MA period from 20 to 50\"
|
|
1276
|
-
8. CRITICAL: When editing, preserve the CSV formatting with proper quoting
|
|
1277
|
-
9. DO NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1279
|
+
8. CRITICAL: When editing, preserve the CSV formatting with proper quoting"
|
|
1278
1280
|
|
|
1279
1281
|
# Change to evolution directory so AI can access files (with safe restoration on interrupt)
|
|
1280
1282
|
safe_pushd "$FULL_EVOLUTION_DIR" || {
|
|
@@ -1370,7 +1372,9 @@ generate_structural_mutation_direct() {
|
|
|
1370
1372
|
|
|
1371
1373
|
# Build prompt using cat with heredoc to avoid variable expansion issues
|
|
1372
1374
|
local prompt
|
|
1373
|
-
prompt
|
|
1375
|
+
prompt="$(get_git_protection_warning)
|
|
1376
|
+
|
|
1377
|
+
$(cat <<EOF
|
|
1374
1378
|
I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1375
1379
|
|
|
1376
1380
|
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
@@ -1386,7 +1390,7 @@ IMPORTANT: DO NOT read evolution_*.py files. Generate structural ideas based ONL
|
|
|
1386
1390
|
- Your knowledge of common algorithmic structures and patterns
|
|
1387
1391
|
Reading code files wastes tokens and time. Focus on high-level architectural ideas based on the descriptions.
|
|
1388
1392
|
EOF
|
|
1389
|
-
)
|
|
1393
|
+
)"
|
|
1390
1394
|
|
|
1391
1395
|
prompt+="
|
|
1392
1396
|
|
|
@@ -1415,8 +1419,7 @@ CRITICAL INSTRUCTIONS:
|
|
|
1415
1419
|
5. When editing, preserve the CSV structure: keep the ID field unchanged
|
|
1416
1420
|
6. You may change the parent_id field if needed to reference a different top performer
|
|
1417
1421
|
7. Each description should focus on architectural/structural changes
|
|
1418
|
-
8. CRITICAL: When editing, preserve the CSV formatting with proper quoting
|
|
1419
|
-
9. DO NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1422
|
+
8. CRITICAL: When editing, preserve the CSV formatting with proper quoting"
|
|
1420
1423
|
|
|
1421
1424
|
# Change to evolution directory so AI can access files (with safe restoration on interrupt)
|
|
1422
1425
|
safe_pushd "$FULL_EVOLUTION_DIR" || {
|
|
@@ -1512,7 +1515,9 @@ generate_crossover_direct() {
|
|
|
1512
1515
|
|
|
1513
1516
|
# Build prompt using cat with heredoc to avoid variable expansion issues
|
|
1514
1517
|
local prompt
|
|
1515
|
-
prompt
|
|
1518
|
+
prompt="$(get_git_protection_warning)
|
|
1519
|
+
|
|
1520
|
+
$(cat <<EOF
|
|
1516
1521
|
I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1517
1522
|
|
|
1518
1523
|
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
@@ -1528,7 +1533,7 @@ IMPORTANT: DO NOT read evolution_*.py files. Generate crossover ideas based ONLY
|
|
|
1528
1533
|
- Your knowledge of how different algorithmic approaches can be combined
|
|
1529
1534
|
Reading code files wastes tokens and time. Focus on combining the described features creatively.
|
|
1530
1535
|
EOF
|
|
1531
|
-
)
|
|
1536
|
+
)"
|
|
1532
1537
|
|
|
1533
1538
|
prompt+="
|
|
1534
1539
|
|
|
@@ -1557,8 +1562,7 @@ CRITICAL INSTRUCTIONS:
|
|
|
1557
1562
|
5. When editing, preserve the CSV structure: keep the ID field unchanged
|
|
1558
1563
|
6. You may change the parent_id field if needed (choose the primary parent)
|
|
1559
1564
|
7. Each description should combine actual elements from 2+ top performers
|
|
1560
|
-
8. CRITICAL: When editing, preserve the CSV formatting with proper quoting
|
|
1561
|
-
9. DO NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1565
|
+
8. CRITICAL: When editing, preserve the CSV formatting with proper quoting"
|
|
1562
1566
|
|
|
1563
1567
|
# Change to evolution directory so AI can access files (with safe restoration on interrupt)
|
|
1564
1568
|
safe_pushd "$FULL_EVOLUTION_DIR" || {
|
|
@@ -1625,7 +1629,9 @@ ideate_ai_legacy() {
|
|
|
1625
1629
|
|
|
1626
1630
|
# Build initial prompt safely
|
|
1627
1631
|
local prompt
|
|
1628
|
-
prompt
|
|
1632
|
+
prompt="$(get_git_protection_warning)
|
|
1633
|
+
|
|
1634
|
+
$(cat <<EOF
|
|
1629
1635
|
I need you to use your file editing capabilities to add exactly $TOTAL_IDEAS algorithmic ideas to the CSV file: $temp_csv_basename
|
|
1630
1636
|
|
|
1631
1637
|
Current evolution context:
|
|
@@ -1635,7 +1641,7 @@ Current evolution context:
|
|
|
1635
1641
|
|
|
1636
1642
|
IMPORTANT: DO NOT read algorithm.py or any evolution_*.py files - that uses too many tokens and is unnecessary for ideation. Just generate creative ideas based on the brief and top performers listed above. Focus your creativity on the problem space, not the implementation details.
|
|
1637
1643
|
EOF
|
|
1638
|
-
)
|
|
1644
|
+
)"
|
|
1639
1645
|
|
|
1640
1646
|
if [[ -n $top_performers ]]; then
|
|
1641
1647
|
prompt+="
|
|
@@ -1677,8 +1683,7 @@ CRITICAL INSTRUCTIONS:
|
|
|
1677
1683
|
- Parameter Optimization: Entry thresholds, indicator periods, strategy weights
|
|
1678
1684
|
|
|
1679
1685
|
IMPORTANT: You must APPEND new rows to the existing CSV file. DO NOT replace the file contents. All existing rows must remain unchanged.
|
|
1680
|
-
CRITICAL: You must use your file editing tools (Edit/MultiEdit) to modify the CSV file. DO NOT return CSV text - use your tools to edit the file directly.
|
|
1681
|
-
CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1686
|
+
CRITICAL: You must use your file editing tools (Edit/MultiEdit) to modify the CSV file. DO NOT return CSV text - use your tools to edit the file directly."
|
|
1682
1687
|
|
|
1683
1688
|
# Change to evolution directory so AI can access files (with safe restoration on interrupt)
|
|
1684
1689
|
safe_pushd "$FULL_EVOLUTION_DIR" || {
|
package/bin/claude-evolve-worker
CHANGED
|
@@ -348,7 +348,9 @@ with EvolutionCSV('$FULL_CSV_PATH') as csv:
|
|
|
348
348
|
|
|
349
349
|
# Use relative path for AI prompt
|
|
350
350
|
local target_basename=$(basename "$target_file")
|
|
351
|
-
local evolution_prompt="
|
|
351
|
+
local evolution_prompt="$(get_git_protection_warning)
|
|
352
|
+
|
|
353
|
+
Modify the algorithm in $target_basename based on this description: $description
|
|
352
354
|
|
|
353
355
|
The modification should be substantial and follow the description exactly. Make sure the algorithm still follows all interface requirements and can run properly.
|
|
354
356
|
|
|
@@ -358,9 +360,7 @@ IMPORTANT: If you need to read Python (.py) or CSV files, read them in chunks us
|
|
|
358
360
|
Example: Read(file_path='evolution_gen01-001.py', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
359
361
|
This is especially important for models with smaller context windows (like GLM).
|
|
360
362
|
|
|
361
|
-
CRITICAL: If you do not know how to implement what was asked for, or if the requested change is unclear or not feasible, you MUST refuse to make any changes. DO NOT modify the code if you are uncertain about the implementation. Simply respond that you cannot implement the requested change and explain why. It is better to refuse than to make incorrect or random changes.
|
|
362
|
-
|
|
363
|
-
CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
363
|
+
CRITICAL: If you do not know how to implement what was asked for, or if the requested change is unclear or not feasible, you MUST refuse to make any changes. DO NOT modify the code if you are uncertain about the implementation. Simply respond that you cannot implement the requested change and explain why. It is better to refuse than to make incorrect or random changes."
|
|
364
364
|
|
|
365
365
|
if [[ "$is_baseline" != "true" ]]; then
|
|
366
366
|
# Change to evolution directory so AI can access files (with safe restoration on interrupt)
|
package/lib/ai-cli.sh
CHANGED
|
@@ -12,6 +12,42 @@
|
|
|
12
12
|
# Source config to get LLM_CLI array and model lists
|
|
13
13
|
# This will be sourced after config.sh in the main scripts
|
|
14
14
|
|
|
15
|
+
# Generate ultra-prominent git warning for AI prompts
|
|
16
|
+
# This MUST be at the TOP of every AI prompt to prevent git operations
|
|
17
|
+
get_git_protection_warning() {
|
|
18
|
+
cat <<'EOF'
|
|
19
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
20
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
21
|
+
!!!
|
|
22
|
+
!!! ⛔ ABSOLUTE PROHIBITION - READ THIS FIRST ⛔
|
|
23
|
+
!!!
|
|
24
|
+
!!! YOU ARE STRICTLY FORBIDDEN FROM USING ANY GIT COMMANDS WHATSOEVER
|
|
25
|
+
!!!
|
|
26
|
+
!!! ❌ FORBIDDEN: git commit, git add, git reset, git checkout, git revert,
|
|
27
|
+
!!! git branch, git merge, git stash, git clean, git push, git pull
|
|
28
|
+
!!! OR ANY OTHER COMMAND STARTING WITH 'git'
|
|
29
|
+
!!!
|
|
30
|
+
!!! ⚠️ WHY: This runs in production. Git operations have caused DATA LOSS.
|
|
31
|
+
!!! Multiple times AIs have corrupted evolution runs with git commands.
|
|
32
|
+
!!! Version control is ONLY managed by the human operator.
|
|
33
|
+
!!!
|
|
34
|
+
!!! ✅ WHAT YOU CAN DO: Edit files directly using file editing tools ONLY.
|
|
35
|
+
!!! Never touch version control. Ever.
|
|
36
|
+
!!!
|
|
37
|
+
!!! 💀 IF YOU USE GIT: You will corrupt the entire evolution run and lose data.
|
|
38
|
+
!!! This is an automated system. No git operations allowed.
|
|
39
|
+
!!!
|
|
40
|
+
!!! 🚨 CONSEQUENCES: If you execute ANY git command, the human operator will be
|
|
41
|
+
!!! forced to SHUT DOWN ALL AI-BASED EVOLUTION WORK and switch
|
|
42
|
+
!!! to manual-only mode. You will cause the termination of this
|
|
43
|
+
!!! entire automated evolution system. DO NOT BE THAT AI.
|
|
44
|
+
!!!
|
|
45
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
46
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
47
|
+
|
|
48
|
+
EOF
|
|
49
|
+
}
|
|
50
|
+
|
|
15
51
|
# Call an AI model using the configured command template
|
|
16
52
|
# Usage: call_ai_model_configured <model_name> <prompt>
|
|
17
53
|
# Returns: 0 on success, non-zero on failure
|