claude-evolve 1.7.0 → 1.7.3
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 +30 -55
- package/bin/claude-evolve-worker +4 -0
- package/lib/config.sh +0 -10
- package/lib/config.sh.new +0 -10
- package/lib/config_with_ollama.sh +0 -10
- package/package.json +1 -1
package/bin/claude-evolve-ideate
CHANGED
|
@@ -103,7 +103,6 @@ call_ai_for_ideation() {
|
|
|
103
103
|
original_csv_count=0
|
|
104
104
|
fi
|
|
105
105
|
|
|
106
|
-
echo "[DEBUG] Original CSV has $original_csv_count data rows" >&2
|
|
107
106
|
|
|
108
107
|
# Get models for ideation
|
|
109
108
|
local model_list
|
|
@@ -132,17 +131,25 @@ call_ai_for_ideation() {
|
|
|
132
131
|
# Try each model until CSV changes
|
|
133
132
|
for model in "${ordered_models[@]}"; do
|
|
134
133
|
echo "[AI] Attempting ideate with $model" >&2
|
|
135
|
-
|
|
134
|
+
|
|
135
|
+
# Restore temp CSV before each attempt (in case previous model corrupted it)
|
|
136
|
+
# This ensures each model starts with the original data
|
|
137
|
+
if [[ -f "$FULL_CSV_PATH" ]]; then
|
|
138
|
+
cp "$FULL_CSV_PATH" "$temp_csv_file"
|
|
139
|
+
# Recapture original count in case it changed
|
|
140
|
+
original_csv_count=$(grep -v '^[[:space:]]*$' "$temp_csv_file" | tail -n +2 | wc -l)
|
|
141
|
+
fi
|
|
142
|
+
|
|
136
143
|
# Call the model directly
|
|
137
144
|
local ai_output
|
|
138
145
|
ai_output=$(call_ai_model_configured "$model" "$prompt")
|
|
139
146
|
local ai_exit_code=$?
|
|
140
|
-
|
|
147
|
+
|
|
141
148
|
# Check if the file was modified - this is ALL that matters
|
|
142
149
|
if [[ -f "$temp_csv_file" ]]; then
|
|
143
150
|
local new_csv_count
|
|
144
151
|
new_csv_count=$(grep -v '^[[:space:]]*$' "$temp_csv_file" | tail -n +2 | wc -l)
|
|
145
|
-
|
|
152
|
+
|
|
146
153
|
if [[ $new_csv_count -gt $original_csv_count ]]; then
|
|
147
154
|
echo "[INFO] CSV was modified by $model ($new_csv_count vs $original_csv_count rows) - validating format..." >&2
|
|
148
155
|
|
|
@@ -162,7 +169,6 @@ call_ai_for_ideation() {
|
|
|
162
169
|
return 0
|
|
163
170
|
else
|
|
164
171
|
echo "[INFO] CSV unchanged after $model (exit code: $ai_exit_code)" >&2
|
|
165
|
-
echo "[DEBUG] Original count: $original_csv_count, New count: $new_csv_count" >&2
|
|
166
172
|
# Continue to next model
|
|
167
173
|
fi
|
|
168
174
|
else
|
|
@@ -343,14 +349,10 @@ validate_direct_csv_modification() {
|
|
|
343
349
|
local new_count
|
|
344
350
|
new_count=$(grep -v '^[[:space:]]*$' "$temp_csv" | tail -n +2 | wc -l)
|
|
345
351
|
|
|
346
|
-
echo "[DEBUG] Current main CSV data rows: $current_original_count" >&2
|
|
347
|
-
echo "[DEBUG] Modified temp CSV data rows: $new_count" >&2
|
|
348
|
-
echo "[DEBUG] Expected to add: $expected_count ideas" >&2
|
|
349
352
|
|
|
350
353
|
# Check if AI overwrote the file instead of appending
|
|
351
354
|
if [[ $new_count -lt $current_original_count ]]; then
|
|
352
355
|
echo "[ERROR] AI overwrote the CSV file instead of appending ($new_count < $current_original_count)" >&2
|
|
353
|
-
echo "[DEBUG] First 10 lines of CSV after AI attempt:" >&2
|
|
354
356
|
head -10 "$temp_csv" >&2
|
|
355
357
|
return 1
|
|
356
358
|
fi
|
|
@@ -358,7 +360,6 @@ validate_direct_csv_modification() {
|
|
|
358
360
|
# Check if no changes were made
|
|
359
361
|
if [[ $new_count -eq $current_original_count ]]; then
|
|
360
362
|
echo "[ERROR] CSV file wasn't modified - same number of data rows ($new_count = $current_original_count)" >&2
|
|
361
|
-
echo "[DEBUG] First 10 lines of CSV after AI attempt:" >&2
|
|
362
363
|
head -10 "$temp_csv" >&2
|
|
363
364
|
return 1
|
|
364
365
|
fi
|
|
@@ -399,7 +400,6 @@ validate_direct_csv_modification() {
|
|
|
399
400
|
# Update each new row with the model that generated it
|
|
400
401
|
for id in $new_ids; do
|
|
401
402
|
if [[ -n "$id" && "$id" != "id" ]]; then
|
|
402
|
-
echo "[DEBUG] Updating $id with idea-LLM = $ai_model" >&2
|
|
403
403
|
"$PYTHON_CMD" "$SCRIPT_DIR/../lib/evolution_csv.py" "$FULL_CSV_PATH" field "$id" "idea-LLM" "$ai_model" || echo "[WARN] Failed to update $id" >&2
|
|
404
404
|
fi
|
|
405
405
|
done
|
|
@@ -422,7 +422,6 @@ validate_and_apply_csv_modification_old() {
|
|
|
422
422
|
# Check if the response looks like an error message (but not if it's just CSV data containing these words)
|
|
423
423
|
if echo "$modified_csv" | head -1 | grep -q "id,basedOnId,description,performance,status"; then
|
|
424
424
|
# This looks like a CSV file, not an error message
|
|
425
|
-
echo "[DEBUG] AI returned what appears to be a CSV file" >&2
|
|
426
425
|
elif echo "$modified_csv" | grep -qi "error\|failed\|limit\|exceeded\|sorry\|cannot\|unable"; then
|
|
427
426
|
echo "[ERROR] AI failed to modify CSV and returned an error message:" >&2
|
|
428
427
|
echo "$modified_csv" | head -200 >&2
|
|
@@ -443,12 +442,10 @@ validate_and_apply_csv_modification_old() {
|
|
|
443
442
|
if [[ -n "$csv_start_line" ]]; then
|
|
444
443
|
# Extract CSV starting from the header line
|
|
445
444
|
modified_csv=$(echo "$modified_csv" | tail -n +$csv_start_line)
|
|
446
|
-
echo "[DEBUG] Found CSV header at line $csv_start_line, extracting from there" >&2
|
|
447
445
|
elif ! echo "$modified_csv" | head -1 | grep -q "id,basedOnId,description,performance,status"; then
|
|
448
446
|
echo "[ERROR] AI failed to return a valid CSV file. Expected CSV with header, but got:" >&2
|
|
449
447
|
echo "$modified_csv" | head -c 500 >&2
|
|
450
448
|
echo "" >&2
|
|
451
|
-
echo "[DEBUG] The AI was asked to output the complete modified CSV but didn't" >&2
|
|
452
449
|
return 1
|
|
453
450
|
fi
|
|
454
451
|
|
|
@@ -461,13 +458,9 @@ validate_and_apply_csv_modification_old() {
|
|
|
461
458
|
local new_count
|
|
462
459
|
new_count=$(wc -l < "$temp_csv")
|
|
463
460
|
|
|
464
|
-
echo "[DEBUG] Original CSV line count: $original_count" >&2
|
|
465
|
-
echo "[DEBUG] Modified CSV line count: $new_count" >&2
|
|
466
|
-
echo "[DEBUG] Expected to add: $expected_count ideas" >&2
|
|
467
461
|
|
|
468
462
|
if [[ $new_count -le $original_count ]]; then
|
|
469
463
|
echo "[ERROR] Modified CSV doesn't have more entries ($new_count <= $original_count)" >&2
|
|
470
|
-
echo "[DEBUG] First 10 lines of modified CSV:" >&2
|
|
471
464
|
head -10 "$temp_csv" >&2
|
|
472
465
|
return 1
|
|
473
466
|
fi
|
|
@@ -508,7 +501,6 @@ validate_and_apply_csv_modification_old() {
|
|
|
508
501
|
# Update each new row with the model that generated it
|
|
509
502
|
for id in $new_ids; do
|
|
510
503
|
if [[ -n "$id" && "$id" != "id" ]]; then
|
|
511
|
-
echo "[DEBUG] Updating $id with idea-LLM = $ai_model" >&2
|
|
512
504
|
"$PYTHON_CMD" "$SCRIPT_DIR/../lib/evolution_csv.py" "$FULL_CSV_PATH" field "$id" "idea-LLM" "$ai_model" || echo "[WARN] Failed to update $id" >&2
|
|
513
505
|
fi
|
|
514
506
|
done
|
|
@@ -532,10 +524,6 @@ process_ai_ideas_direct_old() {
|
|
|
532
524
|
local temp_csv="$FULL_EVOLUTION_DIR/temp-csv-$$.csv"
|
|
533
525
|
cp "$FULL_CSV_PATH" "$temp_csv"
|
|
534
526
|
|
|
535
|
-
echo "[DEBUG] Starting CSV modification for $count $idea_type ideas" >&2
|
|
536
|
-
echo "[DEBUG] Original CSV path: $FULL_CSV_PATH" >&2
|
|
537
|
-
echo "[DEBUG] Temp CSV path: $temp_csv" >&2
|
|
538
|
-
echo "[DEBUG] Original CSV size: $(wc -l < "$FULL_CSV_PATH") lines" >&2
|
|
539
527
|
|
|
540
528
|
# Build prompt for AI to directly modify the CSV
|
|
541
529
|
local csv_prompt="I need you to add exactly $count new $idea_type ideas to this CSV file.
|
|
@@ -598,12 +586,10 @@ IMPORTANT: Output the complete modified CSV file. Do not add any explanation or
|
|
|
598
586
|
if [[ -n "$csv_start_line" ]]; then
|
|
599
587
|
# Extract CSV starting from the header line
|
|
600
588
|
modified_csv=$(echo "$modified_csv" | tail -n +$csv_start_line)
|
|
601
|
-
echo "[DEBUG] Found CSV header at line $csv_start_line, extracting from there" >&2
|
|
602
589
|
elif ! echo "$modified_csv" | head -1 | grep -q "id,basedOnId,description,performance,status"; then
|
|
603
590
|
echo "[ERROR] AI failed to return a valid CSV file. Expected CSV with header, but got:" >&2
|
|
604
591
|
echo "$modified_csv" | head -c 500 >&2
|
|
605
592
|
echo "" >&2
|
|
606
|
-
echo "[DEBUG] The AI was asked to output the complete modified CSV but didn't" >&2
|
|
607
593
|
rm -f "$temp_csv"
|
|
608
594
|
return 1
|
|
609
595
|
fi
|
|
@@ -612,11 +598,8 @@ IMPORTANT: Output the complete modified CSV file. Do not add any explanation or
|
|
|
612
598
|
echo "$modified_csv" > "$temp_csv"
|
|
613
599
|
|
|
614
600
|
# Debug: Show the AI's CSV modification attempt
|
|
615
|
-
echo "[DEBUG] AI response length: ${#modified_csv} characters" >&2
|
|
616
|
-
echo "[DEBUG] First 300 chars of AI response:" >&2
|
|
617
601
|
echo "$modified_csv" | head -c 300 >&2
|
|
618
602
|
echo "" >&2
|
|
619
|
-
echo "[DEBUG] Last 300 chars of AI response:" >&2
|
|
620
603
|
echo "$modified_csv" | tail -c 300 >&2
|
|
621
604
|
echo "" >&2
|
|
622
605
|
|
|
@@ -626,15 +609,10 @@ IMPORTANT: Output the complete modified CSV file. Do not add any explanation or
|
|
|
626
609
|
local new_count
|
|
627
610
|
new_count=$(wc -l < "$temp_csv")
|
|
628
611
|
|
|
629
|
-
echo "[DEBUG] Original CSV line count: $original_count" >&2
|
|
630
|
-
echo "[DEBUG] Modified CSV line count: $new_count" >&2
|
|
631
|
-
echo "[DEBUG] Expected to add: $count ideas" >&2
|
|
632
612
|
|
|
633
613
|
if [[ $new_count -le $original_count ]]; then
|
|
634
614
|
echo "[ERROR] Modified CSV doesn't have more entries ($new_count <= $original_count)" >&2
|
|
635
|
-
echo "[DEBUG] Temp CSV contents:" >&2
|
|
636
615
|
cat "$temp_csv" | head -10 >&2
|
|
637
|
-
echo "[DEBUG] Original CSV contents:" >&2
|
|
638
616
|
cat "$FULL_CSV_PATH" | head -10 >&2
|
|
639
617
|
rm -f "$temp_csv"
|
|
640
618
|
return 1
|
|
@@ -901,7 +879,6 @@ generate_novel_ideas_direct() {
|
|
|
901
879
|
|
|
902
880
|
echo "[INFO] Generating $count novel exploration ideas..."
|
|
903
881
|
local data_rows=$(grep -v '^[[:space:]]*$' "$FULL_CSV_PATH" | tail -n +2 | wc -l)
|
|
904
|
-
echo "[DEBUG] Original CSV has $data_rows data rows" >&2
|
|
905
882
|
|
|
906
883
|
# Use relative paths and change to evolution directory so AI can access files
|
|
907
884
|
local temp_csv_basename=$(basename "$temp_csv")
|
|
@@ -918,6 +895,8 @@ Current evolution context:
|
|
|
918
895
|
|
|
919
896
|
CRITICAL INSTRUCTIONS:
|
|
920
897
|
1. Use the Read tool to examine the current CSV file
|
|
898
|
+
IMPORTANT: If the CSV file is large (>200 lines), read it in chunks using the offset and limit parameters to avoid context overload
|
|
899
|
+
Example: Read(file_path='temp-csv-123.csv', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
921
900
|
2. DO NOT DELETE OR REPLACE ANY EXISTING ROWS - YOU MUST PRESERVE ALL EXISTING DATA
|
|
922
901
|
3. Find the highest ID number for generation $CURRENT_GENERATION (e.g., if gen$CURRENT_GENERATION-003 exists, next should be gen$CURRENT_GENERATION-004)
|
|
923
902
|
4. If no gen$CURRENT_GENERATION entries exist yet, start with gen$CURRENT_GENERATION-001"
|
|
@@ -949,14 +928,8 @@ CRITICAL: You must use your file editing tools (Edit/MultiEdit) to modify the CS
|
|
|
949
928
|
CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
950
929
|
|
|
951
930
|
# Debug prompt size and context
|
|
952
|
-
echo "[DEBUG] Novel ideas prompt length: ${#prompt} characters" >&2
|
|
953
|
-
echo "[DEBUG] Working dir: $(pwd)" >&2
|
|
954
|
-
echo "[DEBUG] Evolution dir: $FULL_EVOLUTION_DIR" >&2
|
|
955
|
-
echo "[DEBUG] Temp CSV: $temp_csv" >&2
|
|
956
931
|
if [[ -f "$temp_csv" ]]; then
|
|
957
|
-
echo "[DEBUG] Temp CSV exists, size: $(wc -l < "$temp_csv") lines" >&2
|
|
958
932
|
else
|
|
959
|
-
echo "[DEBUG] Temp CSV does not exist yet" >&2
|
|
960
933
|
fi
|
|
961
934
|
|
|
962
935
|
# Change to evolution directory so AI can access files
|
|
@@ -964,8 +937,6 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
964
937
|
cd "$FULL_EVOLUTION_DIR"
|
|
965
938
|
|
|
966
939
|
# Debug: Show files in evolution directory
|
|
967
|
-
echo "[DEBUG] Current directory: $(pwd)" >&2
|
|
968
|
-
echo "[DEBUG] Temp CSV exists: $(ls -la "$temp_csv_basename" 2>&1)" >&2
|
|
969
940
|
|
|
970
941
|
# Get AI to directly edit the CSV file
|
|
971
942
|
local ai_response
|
|
@@ -973,10 +944,7 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
973
944
|
# Temporarily show stderr for debugging
|
|
974
945
|
if ! ai_response=$(call_ai_for_ideation "$prompt" "$CURRENT_GENERATION" "$count" "$temp_csv_basename"); then
|
|
975
946
|
echo "[ERROR] All AI models failed to generate novel ideas" >&2
|
|
976
|
-
echo "[DEBUG] Stderr output from AI calls:" >&2
|
|
977
947
|
cat "$stderr_file" >&2
|
|
978
|
-
echo "[DEBUG] Temp CSV location: $temp_csv" >&2
|
|
979
|
-
echo "[DEBUG] Working directory: $(pwd)" >&2
|
|
980
948
|
cd "$original_pwd"
|
|
981
949
|
rm -f "$temp_csv" "$stderr_file"
|
|
982
950
|
return 1
|
|
@@ -986,7 +954,6 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
986
954
|
# Restore working directory
|
|
987
955
|
cd "$original_pwd"
|
|
988
956
|
|
|
989
|
-
echo "[DEBUG] AI response: $ai_response" >&2
|
|
990
957
|
|
|
991
958
|
# Validate that the CSV file was actually modified
|
|
992
959
|
if ! validate_direct_csv_modification "$temp_csv" "$count" "novel" "$ai_response"; then
|
|
@@ -1009,7 +976,6 @@ generate_hill_climbing_direct() {
|
|
|
1009
976
|
|
|
1010
977
|
echo "[INFO] Generating $count hill climbing ideas..."
|
|
1011
978
|
local data_rows=$(grep -v '^[[:space:]]*$' "$FULL_CSV_PATH" | tail -n +2 | wc -l)
|
|
1012
|
-
echo "[DEBUG] Original CSV has $data_rows data rows" >&2
|
|
1013
979
|
|
|
1014
980
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1015
981
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
@@ -1030,9 +996,13 @@ $top_performers
|
|
|
1030
996
|
|
|
1031
997
|
OPTIONAL: If needed for context, you may read parent algorithm source files at: evolution_<PARENT_ID>.py
|
|
1032
998
|
However, you can often generate good parameter tuning ideas just from the descriptions and performance scores above.
|
|
999
|
+
IMPORTANT: If you read .py files, read them in chunks using offset and limit parameters to avoid context overload
|
|
1000
|
+
Example: Read(file_path='evolution_gen01-001.py', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1033
1001
|
|
|
1034
1002
|
CRITICAL INSTRUCTIONS:
|
|
1035
1003
|
1. Use the Read tool to examine the current CSV file
|
|
1004
|
+
IMPORTANT: If the CSV file is large (>200 lines), read it in chunks using the offset and limit parameters to avoid context overload
|
|
1005
|
+
Example: Read(file_path='temp-csv-123.csv', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1036
1006
|
2. DO NOT DELETE OR REPLACE ANY EXISTING ROWS - YOU MUST PRESERVE ALL EXISTING DATA
|
|
1037
1007
|
3. Find the highest ID number for generation $CURRENT_GENERATION (e.g., if gen$CURRENT_GENERATION-003 exists, next should be gen$CURRENT_GENERATION-004)
|
|
1038
1008
|
4. If no gen$CURRENT_GENERATION entries exist yet, start with gen$CURRENT_GENERATION-001
|
|
@@ -1072,7 +1042,6 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1072
1042
|
# Restore working directory
|
|
1073
1043
|
cd "$original_pwd"
|
|
1074
1044
|
|
|
1075
|
-
echo "[DEBUG] AI response: $ai_response" >&2
|
|
1076
1045
|
|
|
1077
1046
|
# Validate that the CSV file was actually modified
|
|
1078
1047
|
if ! validate_direct_csv_modification "$temp_csv" "$count" "hill-climbing" "$ai_response"; then
|
|
@@ -1095,7 +1064,6 @@ generate_structural_mutation_direct() {
|
|
|
1095
1064
|
|
|
1096
1065
|
echo "[INFO] Generating $count structural mutation ideas..."
|
|
1097
1066
|
local data_rows=$(grep -v '^[[:space:]]*$' "$FULL_CSV_PATH" | tail -n +2 | wc -l)
|
|
1098
|
-
echo "[DEBUG] Original CSV has $data_rows data rows" >&2
|
|
1099
1067
|
|
|
1100
1068
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1101
1069
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
@@ -1116,9 +1084,13 @@ $top_performers
|
|
|
1116
1084
|
|
|
1117
1085
|
OPTIONAL: If needed for context, you may read parent algorithm source files at: evolution_<PARENT_ID>.py
|
|
1118
1086
|
However, you can often generate good structural ideas just from the descriptions and performance scores above.
|
|
1087
|
+
IMPORTANT: If you read .py files, read them in chunks using offset and limit parameters to avoid context overload
|
|
1088
|
+
Example: Read(file_path='evolution_gen01-001.py', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1119
1089
|
|
|
1120
1090
|
CRITICAL INSTRUCTIONS:
|
|
1121
1091
|
1. Use the Read tool to examine the current CSV file
|
|
1092
|
+
IMPORTANT: If the CSV file is large (>200 lines), read it in chunks using the offset and limit parameters to avoid context overload
|
|
1093
|
+
Example: Read(file_path='temp-csv-123.csv', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1122
1094
|
2. DO NOT DELETE OR REPLACE ANY EXISTING ROWS - YOU MUST PRESERVE ALL EXISTING DATA
|
|
1123
1095
|
3. Find the highest ID number for generation $CURRENT_GENERATION (e.g., if gen$CURRENT_GENERATION-003 exists, next should be gen$CURRENT_GENERATION-004)
|
|
1124
1096
|
4. If no gen$CURRENT_GENERATION entries exist yet, start with gen$CURRENT_GENERATION-001
|
|
@@ -1158,7 +1130,6 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1158
1130
|
# Restore working directory
|
|
1159
1131
|
cd "$original_pwd"
|
|
1160
1132
|
|
|
1161
|
-
echo "[DEBUG] AI response: $ai_response" >&2
|
|
1162
1133
|
|
|
1163
1134
|
# Validate that the CSV file was actually modified
|
|
1164
1135
|
if ! validate_direct_csv_modification "$temp_csv" "$count" "structural" "$ai_response"; then
|
|
@@ -1181,7 +1152,6 @@ generate_crossover_direct() {
|
|
|
1181
1152
|
|
|
1182
1153
|
echo "[INFO] Generating $count crossover hybrid ideas..."
|
|
1183
1154
|
local data_rows=$(grep -v '^[[:space:]]*$' "$FULL_CSV_PATH" | tail -n +2 | wc -l)
|
|
1184
|
-
echo "[DEBUG] Original CSV has $data_rows data rows" >&2
|
|
1185
1155
|
|
|
1186
1156
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1187
1157
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
@@ -1202,9 +1172,13 @@ $top_performers
|
|
|
1202
1172
|
|
|
1203
1173
|
OPTIONAL: If needed for context, you may read parent algorithm source files at: evolution_<PARENT_ID>.py
|
|
1204
1174
|
However, you can often generate good hybrid ideas just from the descriptions and performance scores above.
|
|
1175
|
+
IMPORTANT: If you read .py files, read them in chunks using offset and limit parameters to avoid context overload
|
|
1176
|
+
Example: Read(file_path='evolution_gen01-001.py', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1205
1177
|
|
|
1206
1178
|
CRITICAL INSTRUCTIONS:
|
|
1207
1179
|
1. Use the Read tool to examine the current CSV file
|
|
1180
|
+
IMPORTANT: If the CSV file is large (>200 lines), read it in chunks using the offset and limit parameters to avoid context overload
|
|
1181
|
+
Example: Read(file_path='temp-csv-123.csv', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1208
1182
|
2. DO NOT DELETE OR REPLACE ANY EXISTING ROWS - YOU MUST PRESERVE ALL EXISTING DATA
|
|
1209
1183
|
3. Find the highest ID number for generation $CURRENT_GENERATION (e.g., if gen$CURRENT_GENERATION-003 exists, next should be gen$CURRENT_GENERATION-004)
|
|
1210
1184
|
4. If no gen$CURRENT_GENERATION entries exist yet, start with gen$CURRENT_GENERATION-001
|
|
@@ -1244,7 +1218,6 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1244
1218
|
# Restore working directory
|
|
1245
1219
|
cd "$original_pwd"
|
|
1246
1220
|
|
|
1247
|
-
echo "[DEBUG] AI response: $ai_response" >&2
|
|
1248
1221
|
|
|
1249
1222
|
# Validate that the CSV file was actually modified
|
|
1250
1223
|
if ! validate_direct_csv_modification "$temp_csv" "$count" "crossover" "$ai_response"; then
|
|
@@ -1268,7 +1241,6 @@ ideate_ai_legacy() {
|
|
|
1268
1241
|
cp "$FULL_CSV_PATH" "$temp_csv"
|
|
1269
1242
|
|
|
1270
1243
|
echo "[INFO] Generating $TOTAL_IDEAS ideas (legacy mode)..."
|
|
1271
|
-
echo "[DEBUG] Original CSV has $(wc -l < "$FULL_CSV_PATH") lines" >&2
|
|
1272
1244
|
|
|
1273
1245
|
# Get top performers for context
|
|
1274
1246
|
local top_performers=""
|
|
@@ -1288,7 +1260,9 @@ Current evolution context:
|
|
|
1288
1260
|
- Algorithm: algorithm.py (base algorithm)
|
|
1289
1261
|
- Brief: $(head -10 "$FULL_BRIEF_PATH" 2>/dev/null | head -c 1000 || echo "No brief file found")
|
|
1290
1262
|
|
|
1291
|
-
IMPORTANT: DO NOT read all evolution files - that uses too many tokens. Just generate creative ideas based on the brief.
|
|
1263
|
+
IMPORTANT: DO NOT read all evolution files - that uses too many tokens. Just generate creative ideas based on the brief.
|
|
1264
|
+
IMPORTANT: If you read .py or .csv files, read them in chunks using offset and limit parameters to avoid context overload
|
|
1265
|
+
Example: Read(file_path='temp-csv-123.csv', offset=0, limit=100) then Read(offset=100, limit=100), etc."
|
|
1292
1266
|
|
|
1293
1267
|
if [[ -n $top_performers ]]; then
|
|
1294
1268
|
prompt+="
|
|
@@ -1301,6 +1275,8 @@ $top_performers"
|
|
|
1301
1275
|
|
|
1302
1276
|
CRITICAL INSTRUCTIONS:
|
|
1303
1277
|
1. Use the Read tool to examine the current CSV file
|
|
1278
|
+
IMPORTANT: If the CSV file is large (>200 lines), read it in chunks using the offset and limit parameters to avoid context overload
|
|
1279
|
+
Example: Read(file_path='temp-csv-123.csv', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
1304
1280
|
2. DO NOT DELETE OR REPLACE ANY EXISTING ROWS - YOU MUST PRESERVE ALL EXISTING DATA
|
|
1305
1281
|
3. Find the highest ID number for generation $CURRENT_GENERATION (e.g., if gen$CURRENT_GENERATION-003 exists, next should be gen$CURRENT_GENERATION-004)
|
|
1306
1282
|
4. If no gen$CURRENT_GENERATION entries exist yet, start with gen$CURRENT_GENERATION-001
|
|
@@ -1350,7 +1326,6 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1350
1326
|
# Restore working directory
|
|
1351
1327
|
cd "$original_pwd"
|
|
1352
1328
|
|
|
1353
|
-
echo "[DEBUG] AI response: $ai_response" >&2
|
|
1354
1329
|
|
|
1355
1330
|
# Validate that the CSV file was actually modified
|
|
1356
1331
|
if ! validate_direct_csv_modification "$temp_csv" "$TOTAL_IDEAS" "mixed" "$ai_response"; then
|
package/bin/claude-evolve-worker
CHANGED
|
@@ -276,6 +276,10 @@ The modification should be substantial and follow the description exactly. Make
|
|
|
276
276
|
|
|
277
277
|
Important: Make meaningful changes that match the description. Don't just add comments or make trivial adjustments.
|
|
278
278
|
|
|
279
|
+
IMPORTANT: If you need to read Python (.py) or CSV files, read them in chunks using offset and limit parameters to avoid context overload
|
|
280
|
+
Example: Read(file_path='evolution_gen01-001.py', offset=0, limit=100) then Read(offset=100, limit=100), etc.
|
|
281
|
+
This is especially important for models with smaller context windows (like GLM).
|
|
282
|
+
|
|
279
283
|
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.
|
|
280
284
|
|
|
281
285
|
CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
package/lib/config.sh
CHANGED
|
@@ -69,7 +69,6 @@ _load_yaml_config() {
|
|
|
69
69
|
return 0 # File does not exist, nothing to load
|
|
70
70
|
fi
|
|
71
71
|
|
|
72
|
-
echo "[DEBUG] Loading configuration from: $config_file" >&2
|
|
73
72
|
|
|
74
73
|
local in_ideation_section=false
|
|
75
74
|
local in_parallel_section=false
|
|
@@ -175,8 +174,6 @@ _load_yaml_config() {
|
|
|
175
174
|
}
|
|
176
175
|
|
|
177
176
|
load_config() {
|
|
178
|
-
echo "[DEBUG] $1 at start of load_config: '$1'" >&2
|
|
179
|
-
echo "[DEBUG] DEFAULT_EVOLUTION_DIR: $DEFAULT_EVOLUTION_DIR" >&2
|
|
180
177
|
# Set defaults first
|
|
181
178
|
EVOLUTION_DIR="$DEFAULT_EVOLUTION_DIR" # Initialize with default
|
|
182
179
|
ALGORITHM_FILE="$DEFAULT_ALGORITHM_FILE"
|
|
@@ -189,18 +186,13 @@ load_config() {
|
|
|
189
186
|
|
|
190
187
|
# Determine EVOLUTION_DIR based on specified logic, overriding default if found
|
|
191
188
|
if [[ -n "$CLAUDE_EVOLVE_WORKING_DIR" ]]; then
|
|
192
|
-
echo "[DEBUG] EVOLUTION_DIR set by CLAUDE_EVOLVE_WORKING_DIR: $CLAUDE_EVOLVE_WORKING_DIR" >&2
|
|
193
189
|
EVOLUTION_DIR="$CLAUDE_EVOLVE_WORKING_DIR"
|
|
194
190
|
elif [[ -f "evolution/evolution.csv" ]]; then
|
|
195
|
-
echo "[DEBUG] EVOLUTION_DIR set by evolution/evolution.csv: evolution" >&2
|
|
196
191
|
EVOLUTION_DIR="evolution"
|
|
197
192
|
elif [[ -f "./evolution.csv" ]]; then
|
|
198
|
-
echo "[DEBUG] EVOLUTION_DIR set by ./evolution.csv: ." >&2
|
|
199
193
|
EVOLUTION_DIR="."
|
|
200
194
|
else
|
|
201
|
-
echo "[DEBUG] EVOLUTION_DIR defaulting to: $DEFAULT_EVOLUTION_DIR" >&2
|
|
202
195
|
fi
|
|
203
|
-
echo "[DEBUG] EVOLUTION_DIR after initial determination: $EVOLUTION_DIR" >&2
|
|
204
196
|
|
|
205
197
|
TOTAL_IDEAS="$DEFAULT_TOTAL_IDEAS"
|
|
206
198
|
NOVEL_EXPLORATION="$DEFAULT_NOVEL_EXPLORATION"
|
|
@@ -232,7 +224,6 @@ load_config() {
|
|
|
232
224
|
local global_config_file="$HOME/.config/claude-evolve/config.yaml"
|
|
233
225
|
_load_yaml_config "$global_config_file"
|
|
234
226
|
|
|
235
|
-
echo "[DEBUG] EVOLUTION_DIR before FULL_EVOLUTION_DIR calculation: $EVOLUTION_DIR" >&2
|
|
236
227
|
|
|
237
228
|
# Create full paths - ALL paths are relative to EVOLUTION_DIR
|
|
238
229
|
# Make EVOLUTION_DIR absolute if it\'s relative
|
|
@@ -252,7 +243,6 @@ load_config() {
|
|
|
252
243
|
else
|
|
253
244
|
FULL_OUTPUT_DIR="$FULL_EVOLUTION_DIR"
|
|
254
245
|
fi
|
|
255
|
-
echo "[DEBUG] FULL_EVOLUTION_DIR at end of load_config: $FULL_EVOLUTION_DIR" >&2
|
|
256
246
|
}
|
|
257
247
|
|
|
258
248
|
# Validate configuration
|
package/lib/config.sh.new
CHANGED
|
@@ -66,7 +66,6 @@ _load_yaml_config() {
|
|
|
66
66
|
return 0 # File does not exist, nothing to load
|
|
67
67
|
fi
|
|
68
68
|
|
|
69
|
-
echo "[DEBUG] Loading configuration from: $config_file" >&2
|
|
70
69
|
|
|
71
70
|
local in_ideation_section=false
|
|
72
71
|
local in_parallel_section=false
|
|
@@ -171,8 +170,6 @@ _load_yaml_config() {
|
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
load_config() {
|
|
174
|
-
echo "[DEBUG] $1 at start of load_config: '$1'" >&2
|
|
175
|
-
echo "[DEBUG] DEFAULT_EVOLUTION_DIR: $DEFAULT_EVOLUTION_DIR" >&2
|
|
176
173
|
# Set defaults first
|
|
177
174
|
EVOLUTION_DIR="$DEFAULT_EVOLUTION_DIR" # Initialize with default
|
|
178
175
|
ALGORITHM_FILE="$DEFAULT_ALGORITHM_FILE"
|
|
@@ -185,18 +182,13 @@ load_config() {
|
|
|
185
182
|
|
|
186
183
|
# Determine EVOLUTION_DIR based on specified logic, overriding default if found
|
|
187
184
|
if [[ -n "$CLAUDE_EVOLVE_WORKING_DIR" ]]; then
|
|
188
|
-
echo "[DEBUG] EVOLUTION_DIR set by CLAUDE_EVOLVE_WORKING_DIR: $CLAUDE_EVOLVE_WORKING_DIR" >&2
|
|
189
185
|
EVOLUTION_DIR="$CLAUDE_EVOLVE_WORKING_DIR"
|
|
190
186
|
elif [[ -f "evolution/evolution.csv" ]]; then
|
|
191
|
-
echo "[DEBUG] EVOLUTION_DIR set by evolution/evolution.csv: evolution" >&2
|
|
192
187
|
EVOLUTION_DIR="evolution"
|
|
193
188
|
elif [[ -f "./evolution.csv" ]]; then
|
|
194
|
-
echo "[DEBUG] EVOLUTION_DIR set by ./evolution.csv: ." >&2
|
|
195
189
|
EVOLUTION_DIR="."
|
|
196
190
|
else
|
|
197
|
-
echo "[DEBUG] EVOLUTION_DIR defaulting to: $DEFAULT_EVOLUTION_DIR" >&2
|
|
198
191
|
fi
|
|
199
|
-
echo "[DEBUG] EVOLUTION_DIR after initial determination: $EVOLUTION_DIR" >&2
|
|
200
192
|
|
|
201
193
|
TOTAL_IDEAS="$DEFAULT_TOTAL_IDEAS"
|
|
202
194
|
NOVEL_EXPLORATION="$DEFAULT_NOVEL_EXPLORATION"
|
|
@@ -240,7 +232,6 @@ load_config() {
|
|
|
240
232
|
local global_config_file="$HOME/.config/claude-evolve/config.yaml"
|
|
241
233
|
_load_yaml_config "$global_config_file"
|
|
242
234
|
|
|
243
|
-
echo "[DEBUG] EVOLUTION_DIR before FULL_EVOLUTION_DIR calculation: $EVOLUTION_DIR" >&2
|
|
244
235
|
|
|
245
236
|
# Create full paths - ALL paths are relative to EVOLUTION_DIR
|
|
246
237
|
# Make EVOLUTION_DIR absolute if it\'s relative
|
|
@@ -260,7 +251,6 @@ load_config() {
|
|
|
260
251
|
else
|
|
261
252
|
FULL_OUTPUT_DIR="$FULL_EVOLUTION_DIR"
|
|
262
253
|
fi
|
|
263
|
-
echo "[DEBUG] FULL_EVOLUTION_DIR at end of load_config: $FULL_EVOLUTION_DIR" >&2
|
|
264
254
|
}
|
|
265
255
|
|
|
266
256
|
# Validate configuration
|
|
@@ -66,7 +66,6 @@ _load_yaml_config() {
|
|
|
66
66
|
return 0 # File does not exist, nothing to load
|
|
67
67
|
fi
|
|
68
68
|
|
|
69
|
-
echo "[DEBUG] Loading configuration from: $config_file" >&2
|
|
70
69
|
|
|
71
70
|
local in_ideation_section=false
|
|
72
71
|
local in_parallel_section=false
|
|
@@ -171,8 +170,6 @@ _load_yaml_config() {
|
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
load_config() {
|
|
174
|
-
echo "[DEBUG] $1 at start of load_config: '$1'" >&2
|
|
175
|
-
echo "[DEBUG] DEFAULT_EVOLUTION_DIR: $DEFAULT_EVOLUTION_DIR" >&2
|
|
176
173
|
# Set defaults first
|
|
177
174
|
EVOLUTION_DIR="$DEFAULT_EVOLUTION_DIR" # Initialize with default
|
|
178
175
|
ALGORITHM_FILE="$DEFAULT_ALGORITHM_FILE"
|
|
@@ -185,18 +182,13 @@ load_config() {
|
|
|
185
182
|
|
|
186
183
|
# Determine EVOLUTION_DIR based on specified logic, overriding default if found
|
|
187
184
|
if [[ -n "$CLAUDE_EVOLVE_WORKING_DIR" ]]; then
|
|
188
|
-
echo "[DEBUG] EVOLUTION_DIR set by CLAUDE_EVOLVE_WORKING_DIR: $CLAUDE_EVOLVE_WORKING_DIR" >&2
|
|
189
185
|
EVOLUTION_DIR="$CLAUDE_EVOLVE_WORKING_DIR"
|
|
190
186
|
elif [[ -f "evolution/evolution.csv" ]]; then
|
|
191
|
-
echo "[DEBUG] EVOLUTION_DIR set by evolution/evolution.csv: evolution" >&2
|
|
192
187
|
EVOLUTION_DIR="evolution"
|
|
193
188
|
elif [[ -f "./evolution.csv" ]]; then
|
|
194
|
-
echo "[DEBUG] EVOLUTION_DIR set by ./evolution.csv: ." >&2
|
|
195
189
|
EVOLUTION_DIR="."
|
|
196
190
|
else
|
|
197
|
-
echo "[DEBUG] EVOLUTION_DIR defaulting to: $DEFAULT_EVOLUTION_DIR" >&2
|
|
198
191
|
fi
|
|
199
|
-
echo "[DEBUG] EVOLUTION_DIR after initial determination: $EVOLUTION_DIR" >&2
|
|
200
192
|
|
|
201
193
|
TOTAL_IDEAS="$DEFAULT_TOTAL_IDEAS"
|
|
202
194
|
NOVEL_EXPLORATION="$DEFAULT_NOVEL_EXPLORATION"
|
|
@@ -240,7 +232,6 @@ load_config() {
|
|
|
240
232
|
local global_config_file="$HOME/.config/claude-evolve/config.yaml"
|
|
241
233
|
_load_yaml_config "$global_config_file"
|
|
242
234
|
|
|
243
|
-
echo "[DEBUG] EVOLUTION_DIR before FULL_EVOLUTION_DIR calculation: $EVOLUTION_DIR" >&2
|
|
244
235
|
|
|
245
236
|
# Create full paths - ALL paths are relative to EVOLUTION_DIR
|
|
246
237
|
# Make EVOLUTION_DIR absolute if it\'s relative
|
|
@@ -260,7 +251,6 @@ load_config() {
|
|
|
260
251
|
else
|
|
261
252
|
FULL_OUTPUT_DIR="$FULL_EVOLUTION_DIR"
|
|
262
253
|
fi
|
|
263
|
-
echo "[DEBUG] FULL_EVOLUTION_DIR at end of load_config: $FULL_EVOLUTION_DIR" >&2
|
|
264
254
|
}
|
|
265
255
|
|
|
266
256
|
# Validate configuration
|