claude-evolve 1.7.15 → 1.7.17
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 +197 -116
- package/package.json +1 -1
package/bin/claude-evolve-ideate
CHANGED
|
@@ -339,38 +339,39 @@ validate_direct_csv_modification() {
|
|
|
339
339
|
local expected_count="$2"
|
|
340
340
|
local idea_type="$3"
|
|
341
341
|
local ai_model="${4:-}" # AI model that generated the ideas
|
|
342
|
-
|
|
342
|
+
local expected_ids="${5:-}" # Optional: comma or space separated list of expected IDs
|
|
343
|
+
|
|
343
344
|
# Check if the file was actually modified
|
|
344
345
|
if [[ ! -f "$temp_csv" ]]; then
|
|
345
346
|
echo "[ERROR] CSV file was not found after AI modification" >&2
|
|
346
347
|
return 1
|
|
347
348
|
fi
|
|
348
|
-
|
|
349
|
+
|
|
349
350
|
# Get the count before modification from the temp CSV (which was copied from original before AI ran)
|
|
350
351
|
# We need to track this before the AI runs by reading from the beginning state
|
|
351
352
|
# First, get a fresh count from the current main CSV (which reflects any previous operations in this session)
|
|
352
353
|
local current_original_count
|
|
353
354
|
current_original_count=$(grep -v '^[[:space:]]*$' "$FULL_CSV_PATH" | tail -n +2 | wc -l)
|
|
354
|
-
|
|
355
|
+
|
|
355
356
|
# Count data rows in the modified temp CSV
|
|
356
357
|
local new_count
|
|
357
358
|
new_count=$(grep -v '^[[:space:]]*$' "$temp_csv" | tail -n +2 | wc -l)
|
|
358
|
-
|
|
359
|
-
|
|
359
|
+
|
|
360
|
+
|
|
360
361
|
# Check if AI overwrote the file instead of appending
|
|
361
362
|
if [[ $new_count -lt $current_original_count ]]; then
|
|
362
363
|
echo "[ERROR] AI overwrote the CSV file instead of appending ($new_count < $current_original_count)" >&2
|
|
363
364
|
head -10 "$temp_csv" >&2
|
|
364
365
|
return 1
|
|
365
366
|
fi
|
|
366
|
-
|
|
367
|
+
|
|
367
368
|
# Check if no changes were made
|
|
368
369
|
if [[ $new_count -eq $current_original_count ]]; then
|
|
369
370
|
echo "[ERROR] CSV file wasn't modified - same number of data rows ($new_count = $current_original_count)" >&2
|
|
370
371
|
head -10 "$temp_csv" >&2
|
|
371
372
|
return 1
|
|
372
373
|
fi
|
|
373
|
-
|
|
374
|
+
|
|
374
375
|
local added_count=$((new_count - current_original_count))
|
|
375
376
|
if [[ $added_count -ne $expected_count ]]; then
|
|
376
377
|
echo "[ERROR] Expected to add $expected_count ideas but only added $added_count" >&2
|
|
@@ -379,6 +380,29 @@ validate_direct_csv_modification() {
|
|
|
379
380
|
return 1
|
|
380
381
|
fi
|
|
381
382
|
|
|
383
|
+
# If expected IDs were provided, validate that the AI used exactly those IDs
|
|
384
|
+
if [[ -n "$expected_ids" ]]; then
|
|
385
|
+
# Get the IDs that were actually added (last N rows of temp CSV)
|
|
386
|
+
local actual_ids
|
|
387
|
+
actual_ids=$(tail -n $added_count "$temp_csv" | cut -d',' -f1 | tr -d '"' | tr '\n' ' ' | xargs)
|
|
388
|
+
|
|
389
|
+
# Normalize expected_ids (convert commas to spaces, trim)
|
|
390
|
+
local expected_ids_normalized
|
|
391
|
+
expected_ids_normalized=$(echo "$expected_ids" | tr ',' ' ' | xargs)
|
|
392
|
+
|
|
393
|
+
# Compare
|
|
394
|
+
if [[ "$actual_ids" != "$expected_ids_normalized" ]]; then
|
|
395
|
+
echo "[ERROR] AI used wrong IDs!" >&2
|
|
396
|
+
echo "[ERROR] Expected: $expected_ids_normalized" >&2
|
|
397
|
+
echo "[ERROR] Actually used: $actual_ids" >&2
|
|
398
|
+
echo "[ERROR] Rejecting this attempt - AI must use the exact IDs specified" >&2
|
|
399
|
+
rm -f "$temp_csv"
|
|
400
|
+
return 1
|
|
401
|
+
fi
|
|
402
|
+
|
|
403
|
+
echo "[INFO] ✓ AI correctly used the specified IDs: $actual_ids" >&2
|
|
404
|
+
fi
|
|
405
|
+
|
|
382
406
|
# Use proper locking to safely update the CSV
|
|
383
407
|
echo "[INFO] Acquiring CSV lock to apply changes..."
|
|
384
408
|
|
|
@@ -946,8 +970,22 @@ generate_novel_ideas_direct() {
|
|
|
946
970
|
local temp_csv="$FULL_EVOLUTION_DIR/temp-csv-$$.csv"
|
|
947
971
|
cp "$FULL_CSV_PATH" "$temp_csv"
|
|
948
972
|
|
|
973
|
+
# Pre-populate the CSV with stub rows containing the correct IDs
|
|
974
|
+
# This ensures the AI can't possibly use wrong IDs - it just fills in descriptions
|
|
975
|
+
echo "[INFO] Pre-populating CSV with stub rows: $required_ids_str"
|
|
976
|
+
for id in "${required_ids[@]}"; do
|
|
977
|
+
echo "$id,,\"[PLACEHOLDER: Replace this with your algorithmic idea]\",,pending" >> "$temp_csv"
|
|
978
|
+
done
|
|
979
|
+
|
|
949
980
|
echo "[INFO] Generating $count novel exploration ideas with IDs: $required_ids_str"
|
|
950
|
-
|
|
981
|
+
|
|
982
|
+
# Count total lines in temp CSV (including header)
|
|
983
|
+
local total_lines
|
|
984
|
+
total_lines=$(wc -l < "$temp_csv")
|
|
985
|
+
local read_offset=$((total_lines - 25))
|
|
986
|
+
if [[ $read_offset -lt 1 ]]; then
|
|
987
|
+
read_offset=1
|
|
988
|
+
fi
|
|
951
989
|
|
|
952
990
|
# Use relative paths and change to evolution directory so AI can access files
|
|
953
991
|
local temp_csv_basename=$(basename "$temp_csv")
|
|
@@ -955,7 +993,9 @@ generate_novel_ideas_direct() {
|
|
|
955
993
|
# Get existing Python files for this generation to avoid ID collisions
|
|
956
994
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
957
995
|
|
|
958
|
-
local prompt="I need you to use your file editing capabilities to
|
|
996
|
+
local prompt="I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
997
|
+
|
|
998
|
+
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
959
999
|
|
|
960
1000
|
Current evolution context:
|
|
961
1001
|
- Generation: $CURRENT_GENERATION
|
|
@@ -964,18 +1004,24 @@ Current evolution context:
|
|
|
964
1004
|
|
|
965
1005
|
IMPORTANT: DO NOT read algorithm.py or any evolution_*.py files. Focus on creative ideation based on the brief and CSV context only. Reading code files wastes tokens and time.
|
|
966
1006
|
|
|
967
|
-
CRITICAL
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1007
|
+
CRITICAL TASK:
|
|
1008
|
+
The CSV file already contains $count stub rows with these IDs: $required_ids_str
|
|
1009
|
+
Each stub row has a PLACEHOLDER description like: \"[PLACEHOLDER: Replace this with your algorithmic idea]\"
|
|
1010
|
+
Your job is to REPLACE each PLACEHOLDER with a real algorithmic idea description.
|
|
1011
|
+
|
|
1012
|
+
⚠️ CRITICAL FILE READING INSTRUCTIONS ⚠️
|
|
1013
|
+
THE CSV FILE IS VERY LARGE (OVER 100,000 TOKENS). YOU WILL RUN OUT OF CONTEXT IF YOU READ IT ALL!
|
|
1014
|
+
- DO NOT read the entire file or you will exceed context limits and CRASH
|
|
1015
|
+
- Use: Read(file_path='$temp_csv_basename', offset=$read_offset, limit=25)
|
|
1016
|
+
- This will read ONLY the last 25 lines where the placeholders are
|
|
1017
|
+
- DO NOT READ FROM OFFSET 0 - that will load the entire huge file and fail!
|
|
971
1018
|
|
|
972
1019
|
CRITICAL INSTRUCTIONS:
|
|
973
|
-
1.
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
4. DO NOT calculate or infer IDs - use the exact IDs provided"
|
|
1020
|
+
1. Read ONLY the last 20-30 lines of the CSV to see the placeholder rows
|
|
1021
|
+
2. DO NOT ADD OR DELETE ANY ROWS - only EDIT the placeholder descriptions
|
|
1022
|
+
3. DO NOT CHANGE THE IDs - they are already correct
|
|
1023
|
+
4. Use the Edit tool to replace each PLACEHOLDER description with a real idea
|
|
1024
|
+
5. Each replacement should be one clear sentence describing a novel algorithmic approach"
|
|
979
1025
|
|
|
980
1026
|
if [[ -n "$existing_py_files" ]]; then
|
|
981
1027
|
prompt+="
|
|
@@ -1024,13 +1070,13 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1024
1070
|
# Restore working directory
|
|
1025
1071
|
cd "$original_pwd"
|
|
1026
1072
|
|
|
1027
|
-
|
|
1028
|
-
# Validate that the CSV file was actually modified
|
|
1029
|
-
if ! validate_direct_csv_modification "$temp_csv" "$count" "novel" "$ai_response"; then
|
|
1073
|
+
|
|
1074
|
+
# Validate that the CSV file was actually modified with correct IDs
|
|
1075
|
+
if ! validate_direct_csv_modification "$temp_csv" "$count" "novel" "$ai_response" "$required_ids_str"; then
|
|
1030
1076
|
rm -f "$temp_csv"
|
|
1031
1077
|
return 1
|
|
1032
1078
|
fi
|
|
1033
|
-
|
|
1079
|
+
|
|
1034
1080
|
echo "[INFO] Novel exploration ideas generated successfully"
|
|
1035
1081
|
return 0
|
|
1036
1082
|
}
|
|
@@ -1058,8 +1104,24 @@ generate_hill_climbing_direct() {
|
|
|
1058
1104
|
local temp_csv="$FULL_EVOLUTION_DIR/temp-csv-$$.csv"
|
|
1059
1105
|
cp "$FULL_CSV_PATH" "$temp_csv"
|
|
1060
1106
|
|
|
1107
|
+
# Pre-populate the CSV with stub rows containing the correct IDs and parent IDs
|
|
1108
|
+
echo "[INFO] Pre-populating CSV with stub rows: $required_ids_str"
|
|
1109
|
+
# Use first parent as default for stubs (AI will adjust if needed)
|
|
1110
|
+
local first_parent_id
|
|
1111
|
+
first_parent_id=$(echo "$valid_parent_ids" | cut -d',' -f1)
|
|
1112
|
+
for id in "${required_ids[@]}"; do
|
|
1113
|
+
echo "$id,$first_parent_id,\"[PLACEHOLDER: Replace with parameter tuning idea]\",,pending" >> "$temp_csv"
|
|
1114
|
+
done
|
|
1115
|
+
|
|
1061
1116
|
echo "[INFO] Generating $count hill climbing ideas with IDs: $required_ids_str"
|
|
1062
|
-
|
|
1117
|
+
|
|
1118
|
+
# Count total lines in temp CSV (including header)
|
|
1119
|
+
local total_lines
|
|
1120
|
+
total_lines=$(wc -l < "$temp_csv")
|
|
1121
|
+
local read_offset=$((total_lines - 25))
|
|
1122
|
+
if [[ $read_offset -lt 1 ]]; then
|
|
1123
|
+
read_offset=1
|
|
1124
|
+
fi
|
|
1063
1125
|
|
|
1064
1126
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1065
1127
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
@@ -1071,7 +1133,9 @@ generate_hill_climbing_direct() {
|
|
|
1071
1133
|
# Use relative paths and change to evolution directory so AI can access files
|
|
1072
1134
|
local temp_csv_basename=$(basename "$temp_csv")
|
|
1073
1135
|
|
|
1074
|
-
local prompt="I need you to use your file editing capabilities to
|
|
1136
|
+
local prompt="I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1137
|
+
|
|
1138
|
+
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
1075
1139
|
|
|
1076
1140
|
IMPORTANT: You MUST use one of these exact parent IDs: $valid_parent_ids
|
|
1077
1141
|
|
|
@@ -1092,33 +1156,28 @@ If you must read source files:
|
|
|
1092
1156
|
|
|
1093
1157
|
Most of the time, you can infer parameters from descriptions like "RSI with threshold 30" or "MA period 20".
|
|
1094
1158
|
|
|
1095
|
-
CRITICAL
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1159
|
+
CRITICAL TASK:
|
|
1160
|
+
The CSV file already contains $count stub rows with these IDs: $required_ids_str
|
|
1161
|
+
Each stub row has a PLACEHOLDER description like: \"[PLACEHOLDER: Replace with parameter tuning idea]\"
|
|
1162
|
+
Your job is to REPLACE each PLACEHOLDER with a real parameter tuning idea.
|
|
1099
1163
|
|
|
1100
|
-
CRITICAL INSTRUCTIONS
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
4. DO NOT calculate or infer IDs - use the exact IDs provided
|
|
1107
|
-
5. Use the Edit or MultiEdit tool to APPEND exactly $count new rows AT THE END of the CSV file
|
|
1108
|
-
6. For each idea, create a row with: id,parent_id,description,,pending
|
|
1109
|
-
7. Each parent_id MUST be one of: $valid_parent_ids
|
|
1110
|
-
8. CRITICAL CSV FORMATTING RULES:
|
|
1111
|
-
- ALWAYS wrap the description field in double quotes
|
|
1112
|
-
- If the description contains quotes, escape them by doubling them (\" becomes \"\")
|
|
1113
|
-
- Example: gen01-001,gen00-000,\"Lower rsi_entry from 21 to 18\",,pending
|
|
1114
|
-
- BAD: gen01-001,gen00-000,Lower rsi_entry from 21 to 18,,pending
|
|
1115
|
-
- NEVER omit quotes around descriptions - this causes CSV parsing errors
|
|
1116
|
-
9. Each description should focus on adjusting specific parameters that exist in the parent's source code
|
|
1117
|
-
10. Include current and new parameter values - for example: \"Lower rsi_entry from 21 to 18\"
|
|
1164
|
+
⚠️ CRITICAL FILE READING INSTRUCTIONS ⚠️
|
|
1165
|
+
THE CSV FILE IS VERY LARGE (OVER 100,000 TOKENS). YOU WILL RUN OUT OF CONTEXT IF YOU READ IT ALL!
|
|
1166
|
+
- DO NOT read the entire file or you will exceed context limits and CRASH
|
|
1167
|
+
- Use: Read(file_path='$temp_csv_basename', offset=$read_offset, limit=25)
|
|
1168
|
+
- This will read ONLY the last 25 lines where the placeholders are
|
|
1169
|
+
- DO NOT READ FROM OFFSET 0 - that will load the entire huge file and fail!
|
|
1118
1170
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1171
|
+
CRITICAL INSTRUCTIONS:
|
|
1172
|
+
1. Read ONLY the last 25 lines using the offset specified above
|
|
1173
|
+
2. DO NOT ADD OR DELETE ANY ROWS - only EDIT the placeholder descriptions
|
|
1174
|
+
3. DO NOT CHANGE THE IDs - they are already correct
|
|
1175
|
+
4. Use the Edit tool to replace each PLACEHOLDER description with a parameter tuning idea
|
|
1176
|
+
5. You may also change the parent_id field if needed to reference a different top performer
|
|
1177
|
+
6. Each description should focus on adjusting specific parameters - include current and new values
|
|
1178
|
+
Example: \"Lower rsi_entry from 21 to 18\" or \"Increase MA period from 20 to 50\"
|
|
1179
|
+
7. CRITICAL: When editing, preserve the CSV formatting with proper quoting
|
|
1180
|
+
8. DO NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1122
1181
|
|
|
1123
1182
|
# Change to evolution directory so AI can access files
|
|
1124
1183
|
local original_pwd=$(pwd)
|
|
@@ -1140,13 +1199,13 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1140
1199
|
# Restore working directory
|
|
1141
1200
|
cd "$original_pwd"
|
|
1142
1201
|
|
|
1143
|
-
|
|
1144
|
-
# Validate that the CSV file was actually modified
|
|
1145
|
-
if ! validate_direct_csv_modification "$temp_csv" "$count" "hill-climbing" "$ai_response"; then
|
|
1202
|
+
|
|
1203
|
+
# Validate that the CSV file was actually modified with correct IDs
|
|
1204
|
+
if ! validate_direct_csv_modification "$temp_csv" "$count" "hill-climbing" "$ai_response" "$required_ids_str"; then
|
|
1146
1205
|
rm -f "$temp_csv"
|
|
1147
1206
|
return 1
|
|
1148
1207
|
fi
|
|
1149
|
-
|
|
1208
|
+
|
|
1150
1209
|
echo "[INFO] Hill climbing ideas generated successfully"
|
|
1151
1210
|
return 0
|
|
1152
1211
|
}
|
|
@@ -1174,8 +1233,23 @@ generate_structural_mutation_direct() {
|
|
|
1174
1233
|
local temp_csv="$FULL_EVOLUTION_DIR/temp-csv-$$.csv"
|
|
1175
1234
|
cp "$FULL_CSV_PATH" "$temp_csv"
|
|
1176
1235
|
|
|
1236
|
+
# Pre-populate the CSV with stub rows
|
|
1237
|
+
echo "[INFO] Pre-populating CSV with stub rows: $required_ids_str"
|
|
1238
|
+
local first_parent_id
|
|
1239
|
+
first_parent_id=$(echo "$valid_parent_ids" | cut -d',' -f1)
|
|
1240
|
+
for id in "${required_ids[@]}"; do
|
|
1241
|
+
echo "$id,$first_parent_id,\"[PLACEHOLDER: Replace with structural modification idea]\",,pending" >> "$temp_csv"
|
|
1242
|
+
done
|
|
1243
|
+
|
|
1177
1244
|
echo "[INFO] Generating $count structural mutation ideas with IDs: $required_ids_str"
|
|
1178
|
-
|
|
1245
|
+
|
|
1246
|
+
# Count total lines in temp CSV (including header)
|
|
1247
|
+
local total_lines
|
|
1248
|
+
total_lines=$(wc -l < "$temp_csv")
|
|
1249
|
+
local read_offset=$((total_lines - 25))
|
|
1250
|
+
if [[ $read_offset -lt 1 ]]; then
|
|
1251
|
+
read_offset=1
|
|
1252
|
+
fi
|
|
1179
1253
|
|
|
1180
1254
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1181
1255
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
@@ -1187,7 +1261,9 @@ generate_structural_mutation_direct() {
|
|
|
1187
1261
|
# Use relative paths and change to evolution directory so AI can access files
|
|
1188
1262
|
local temp_csv_basename=$(basename "$temp_csv")
|
|
1189
1263
|
|
|
1190
|
-
local prompt="I need you to use your file editing capabilities to
|
|
1264
|
+
local prompt="I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1265
|
+
|
|
1266
|
+
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
1191
1267
|
|
|
1192
1268
|
IMPORTANT: You MUST use one of these exact parent IDs: $valid_parent_ids
|
|
1193
1269
|
|
|
@@ -1200,33 +1276,27 @@ IMPORTANT: DO NOT read evolution_*.py files. Generate structural ideas based ONL
|
|
|
1200
1276
|
- Your knowledge of common algorithmic structures and patterns
|
|
1201
1277
|
Reading code files wastes tokens and time. Focus on high-level architectural ideas based on the descriptions.
|
|
1202
1278
|
|
|
1203
|
-
CRITICAL
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1279
|
+
CRITICAL TASK:
|
|
1280
|
+
The CSV file already contains $count stub rows with these IDs: $required_ids_str
|
|
1281
|
+
Each stub row has a PLACEHOLDER description like: \"[PLACEHOLDER: Replace with structural modification idea]\"
|
|
1282
|
+
Your job is to REPLACE each PLACEHOLDER with a real structural modification idea.
|
|
1207
1283
|
|
|
1208
|
-
CRITICAL INSTRUCTIONS
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
4. DO NOT calculate or infer IDs - use the exact IDs provided
|
|
1215
|
-
5. Use the Edit or MultiEdit tool to APPEND exactly $count new rows AT THE END of the CSV file
|
|
1216
|
-
6. For each idea, create a row with: id,parent_id,description,,pending
|
|
1217
|
-
7. Each parent_id MUST be one of: $valid_parent_ids
|
|
1218
|
-
8. CRITICAL CSV FORMATTING RULES:
|
|
1219
|
-
- ALWAYS wrap the description field in double quotes
|
|
1220
|
-
- If the description contains quotes, escape them by doubling them (\" becomes \"\")
|
|
1221
|
-
- Example: gen01-001,gen00-000,\"Add ML-based regime detection using LSTM\",,pending
|
|
1222
|
-
- BAD: gen01-001,gen00-000,Add ML-based regime detection using LSTM,,pending
|
|
1223
|
-
- NEVER omit quotes around descriptions - this causes CSV parsing errors
|
|
1224
|
-
9. Each description should focus on architectural/structural changes based on the parent's actual code
|
|
1225
|
-
10. Reference actual components/methods found in the source code
|
|
1284
|
+
⚠️ CRITICAL FILE READING INSTRUCTIONS ⚠️
|
|
1285
|
+
THE CSV FILE IS VERY LARGE (OVER 100,000 TOKENS). YOU WILL RUN OUT OF CONTEXT IF YOU READ IT ALL!
|
|
1286
|
+
- DO NOT read the entire file or you will exceed context limits and CRASH
|
|
1287
|
+
- Use: Read(file_path='$temp_csv_basename', offset=$read_offset, limit=25)
|
|
1288
|
+
- This will read ONLY the last 25 lines where the placeholders are
|
|
1289
|
+
- DO NOT READ FROM OFFSET 0 - that will load the entire huge file and fail!
|
|
1226
1290
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1291
|
+
CRITICAL INSTRUCTIONS:
|
|
1292
|
+
1. Read ONLY the last 25 lines using the offset specified above
|
|
1293
|
+
2. DO NOT ADD OR DELETE ANY ROWS - only EDIT the placeholder descriptions
|
|
1294
|
+
3. DO NOT CHANGE THE IDs - they are already correct
|
|
1295
|
+
4. Use the Edit tool to replace each PLACEHOLDER description with a structural modification idea
|
|
1296
|
+
5. You may also change the parent_id field if needed to reference a different top performer
|
|
1297
|
+
6. Each description should focus on architectural/structural changes
|
|
1298
|
+
7. CRITICAL: When editing, preserve the CSV formatting with proper quoting
|
|
1299
|
+
8. DO NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1230
1300
|
|
|
1231
1301
|
# Change to evolution directory so AI can access files
|
|
1232
1302
|
local original_pwd=$(pwd)
|
|
@@ -1248,13 +1318,13 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1248
1318
|
# Restore working directory
|
|
1249
1319
|
cd "$original_pwd"
|
|
1250
1320
|
|
|
1251
|
-
|
|
1252
|
-
# Validate that the CSV file was actually modified
|
|
1253
|
-
if ! validate_direct_csv_modification "$temp_csv" "$count" "structural" "$ai_response"; then
|
|
1321
|
+
|
|
1322
|
+
# Validate that the CSV file was actually modified with correct IDs
|
|
1323
|
+
if ! validate_direct_csv_modification "$temp_csv" "$count" "structural" "$ai_response" "$required_ids_str"; then
|
|
1254
1324
|
rm -f "$temp_csv"
|
|
1255
1325
|
return 1
|
|
1256
1326
|
fi
|
|
1257
|
-
|
|
1327
|
+
|
|
1258
1328
|
echo "[INFO] Structural mutation ideas generated successfully"
|
|
1259
1329
|
return 0
|
|
1260
1330
|
}
|
|
@@ -1282,8 +1352,23 @@ generate_crossover_direct() {
|
|
|
1282
1352
|
local temp_csv="$FULL_EVOLUTION_DIR/temp-csv-$$.csv"
|
|
1283
1353
|
cp "$FULL_CSV_PATH" "$temp_csv"
|
|
1284
1354
|
|
|
1355
|
+
# Pre-populate the CSV with stub rows
|
|
1356
|
+
echo "[INFO] Pre-populating CSV with stub rows: $required_ids_str"
|
|
1357
|
+
local first_parent_id
|
|
1358
|
+
first_parent_id=$(echo "$valid_parent_ids" | cut -d',' -f1)
|
|
1359
|
+
for id in "${required_ids[@]}"; do
|
|
1360
|
+
echo "$id,$first_parent_id,\"[PLACEHOLDER: Replace with crossover hybrid idea]\",,pending" >> "$temp_csv"
|
|
1361
|
+
done
|
|
1362
|
+
|
|
1285
1363
|
echo "[INFO] Generating $count crossover hybrid ideas with IDs: $required_ids_str"
|
|
1286
|
-
|
|
1364
|
+
|
|
1365
|
+
# Count total lines in temp CSV (including header)
|
|
1366
|
+
local total_lines
|
|
1367
|
+
total_lines=$(wc -l < "$temp_csv")
|
|
1368
|
+
local read_offset=$((total_lines - 25))
|
|
1369
|
+
if [[ $read_offset -lt 1 ]]; then
|
|
1370
|
+
read_offset=1
|
|
1371
|
+
fi
|
|
1287
1372
|
|
|
1288
1373
|
# Get existing Python files for this generation to avoid ID collisions
|
|
1289
1374
|
local existing_py_files=$(get_existing_py_files_for_generation "$CURRENT_GENERATION")
|
|
@@ -1295,7 +1380,9 @@ generate_crossover_direct() {
|
|
|
1295
1380
|
# Use relative paths and change to evolution directory so AI can access files
|
|
1296
1381
|
local temp_csv_basename=$(basename "$temp_csv")
|
|
1297
1382
|
|
|
1298
|
-
local prompt="I need you to use your file editing capabilities to
|
|
1383
|
+
local prompt="I need you to use your file editing capabilities to fill in PLACEHOLDER descriptions in the CSV file: $temp_csv_basename
|
|
1384
|
+
|
|
1385
|
+
THE FILE HAS $total_lines TOTAL LINES. Read from line $read_offset to see the placeholder rows at the end.
|
|
1299
1386
|
|
|
1300
1387
|
IMPORTANT: You MUST use ONLY these exact parent IDs: $valid_parent_ids
|
|
1301
1388
|
|
|
@@ -1308,33 +1395,27 @@ IMPORTANT: DO NOT read evolution_*.py files. Generate crossover ideas based ONLY
|
|
|
1308
1395
|
- Your knowledge of how different algorithmic approaches can be combined
|
|
1309
1396
|
Reading code files wastes tokens and time. Focus on combining the described features creatively.
|
|
1310
1397
|
|
|
1311
|
-
CRITICAL
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1398
|
+
CRITICAL TASK:
|
|
1399
|
+
The CSV file already contains $count stub rows with these IDs: $required_ids_str
|
|
1400
|
+
Each stub row has a PLACEHOLDER description like: \"[PLACEHOLDER: Replace with crossover hybrid idea]\"
|
|
1401
|
+
Your job is to REPLACE each PLACEHOLDER with a real crossover/hybrid idea that combines 2+ algorithms.
|
|
1315
1402
|
|
|
1316
|
-
CRITICAL INSTRUCTIONS
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
4. DO NOT calculate or infer IDs - use the exact IDs provided
|
|
1323
|
-
5. Use the Edit or MultiEdit tool to APPEND exactly $count new rows AT THE END of the CSV file
|
|
1324
|
-
6. For each idea, create a row with: id,parent_id,description,,pending
|
|
1325
|
-
7. Each parent_id MUST be one of: $valid_parent_ids (choose the primary parent)
|
|
1326
|
-
8. CRITICAL CSV FORMATTING RULES:
|
|
1327
|
-
- ALWAYS wrap the description field in double quotes
|
|
1328
|
-
- If the description contains quotes, escape them by doubling them (\" becomes \"\")
|
|
1329
|
-
- Example: gen01-001,gen00-000,\"Combine gen01-123's RSI logic with gen01-456's volatility scaling\",,pending
|
|
1330
|
-
- BAD: gen01-001,gen00-000,Combine gen01-123's RSI logic with gen01-456's volatility scaling,,pending
|
|
1331
|
-
- NEVER omit quotes around descriptions - this causes CSV parsing errors
|
|
1332
|
-
9. Each description should combine actual elements from 2+ algorithms based on their source code
|
|
1333
|
-
10. Reference specific components/features found in the actual source code
|
|
1403
|
+
⚠️ CRITICAL FILE READING INSTRUCTIONS ⚠️
|
|
1404
|
+
THE CSV FILE IS VERY LARGE (OVER 100,000 TOKENS). YOU WILL RUN OUT OF CONTEXT IF YOU READ IT ALL!
|
|
1405
|
+
- DO NOT read the entire file or you will exceed context limits and CRASH
|
|
1406
|
+
- Use: Read(file_path='$temp_csv_basename', offset=$read_offset, limit=25)
|
|
1407
|
+
- This will read ONLY the last 25 lines where the placeholders are
|
|
1408
|
+
- DO NOT READ FROM OFFSET 0 - that will load the entire huge file and fail!
|
|
1334
1409
|
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1410
|
+
CRITICAL INSTRUCTIONS:
|
|
1411
|
+
1. Read ONLY the last 25 lines using the offset specified above
|
|
1412
|
+
2. DO NOT ADD OR DELETE ANY ROWS - only EDIT the placeholder descriptions
|
|
1413
|
+
3. DO NOT CHANGE THE IDs - they are already correct
|
|
1414
|
+
4. Use the Edit tool to replace each PLACEHOLDER description with a crossover idea
|
|
1415
|
+
5. You may also change the parent_id field if needed (choose the primary parent)
|
|
1416
|
+
6. Each description should combine actual elements from 2+ top performers
|
|
1417
|
+
7. CRITICAL: When editing, preserve the CSV formatting with proper quoting
|
|
1418
|
+
8. DO NOT use any git commands (git add, git commit, git reset, etc.). Only modify the file directly."
|
|
1338
1419
|
|
|
1339
1420
|
# Change to evolution directory so AI can access files
|
|
1340
1421
|
local original_pwd=$(pwd)
|
|
@@ -1356,13 +1437,13 @@ CRITICAL: Do NOT use any git commands (git add, git commit, git reset, etc.). On
|
|
|
1356
1437
|
# Restore working directory
|
|
1357
1438
|
cd "$original_pwd"
|
|
1358
1439
|
|
|
1359
|
-
|
|
1360
|
-
# Validate that the CSV file was actually modified
|
|
1361
|
-
if ! validate_direct_csv_modification "$temp_csv" "$count" "crossover" "$ai_response"; then
|
|
1440
|
+
|
|
1441
|
+
# Validate that the CSV file was actually modified with correct IDs
|
|
1442
|
+
if ! validate_direct_csv_modification "$temp_csv" "$count" "crossover" "$ai_response" "$required_ids_str"; then
|
|
1362
1443
|
rm -f "$temp_csv"
|
|
1363
1444
|
return 1
|
|
1364
1445
|
fi
|
|
1365
|
-
|
|
1446
|
+
|
|
1366
1447
|
echo "[INFO] Crossover hybrid ideas generated successfully"
|
|
1367
1448
|
return 0
|
|
1368
1449
|
}
|