claude-evolve 1.2.3 → 1.2.4
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 +104 -147
- package/package.json +1 -1
package/bin/claude-evolve-ideate
CHANGED
|
@@ -80,7 +80,7 @@ if [[ $use_strategies == true ]]; then
|
|
|
80
80
|
fi
|
|
81
81
|
fi
|
|
82
82
|
|
|
83
|
-
# Get next ID
|
|
83
|
+
# Get next available ID
|
|
84
84
|
get_next_id() {
|
|
85
85
|
if [[ ! -f "$FULL_CSV_PATH" ]]; then
|
|
86
86
|
echo "1"
|
|
@@ -96,8 +96,8 @@ get_next_id() {
|
|
|
96
96
|
echo $((max_id + 1))
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
# Add idea to CSV
|
|
100
|
-
|
|
99
|
+
# Add idea to CSV manually (fallback for manual mode)
|
|
100
|
+
add_idea_manual() {
|
|
101
101
|
local description="$1"
|
|
102
102
|
local based_on_id="$2"
|
|
103
103
|
local id
|
|
@@ -141,7 +141,7 @@ ideate_manual() {
|
|
|
141
141
|
continue
|
|
142
142
|
fi
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
add_idea_manual "$description" ""
|
|
145
145
|
((ideas_added++))
|
|
146
146
|
|
|
147
147
|
if [[ $i -lt $TOTAL_IDEAS ]]; then
|
|
@@ -175,7 +175,7 @@ ideate_ai_strategies() {
|
|
|
175
175
|
if [[ -z $top_performers ]]; then
|
|
176
176
|
echo "[INFO] No completed algorithms found, using pure novel exploration"
|
|
177
177
|
# Generate all ideas as novel exploration
|
|
178
|
-
|
|
178
|
+
generate_novel_ideas_direct "$TOTAL_IDEAS"
|
|
179
179
|
return 0
|
|
180
180
|
fi
|
|
181
181
|
|
|
@@ -185,108 +185,120 @@ ideate_ai_strategies() {
|
|
|
185
185
|
echo " Structural mutation: $STRUCTURAL_MUTATION"
|
|
186
186
|
echo " Crossover hybrid: $CROSSOVER_HYBRID"
|
|
187
187
|
|
|
188
|
-
# Generate each type of idea
|
|
189
|
-
[[ $NOVEL_EXPLORATION -gt 0 ]] &&
|
|
190
|
-
[[ $HILL_CLIMBING -gt 0 ]] &&
|
|
191
|
-
[[ $STRUCTURAL_MUTATION -gt 0 ]] &&
|
|
192
|
-
[[ $CROSSOVER_HYBRID -gt 0 ]] &&
|
|
188
|
+
# Generate each type of idea by having Claude directly edit the CSV
|
|
189
|
+
[[ $NOVEL_EXPLORATION -gt 0 ]] && generate_novel_ideas_direct "$NOVEL_EXPLORATION"
|
|
190
|
+
[[ $HILL_CLIMBING -gt 0 ]] && generate_hill_climbing_direct "$HILL_CLIMBING" "$top_performers"
|
|
191
|
+
[[ $STRUCTURAL_MUTATION -gt 0 ]] && generate_structural_mutation_direct "$STRUCTURAL_MUTATION" "$top_performers"
|
|
192
|
+
[[ $CROSSOVER_HYBRID -gt 0 ]] && generate_crossover_direct "$CROSSOVER_HYBRID" "$top_performers"
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
# Generate novel exploration ideas
|
|
196
|
-
|
|
195
|
+
# Generate novel exploration ideas by having Claude edit CSV directly
|
|
196
|
+
generate_novel_ideas_direct() {
|
|
197
197
|
local count="$1"
|
|
198
|
-
local context="$2"
|
|
199
198
|
|
|
200
|
-
local prompt="
|
|
199
|
+
local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for novel algorithmic approaches.
|
|
201
200
|
|
|
202
201
|
Project Brief:
|
|
203
202
|
$(cat "$FULL_BRIEF_PATH")
|
|
204
203
|
|
|
205
|
-
|
|
206
|
-
-
|
|
207
|
-
-
|
|
208
|
-
-
|
|
204
|
+
Requirements for new CSV rows:
|
|
205
|
+
- IDs must be numbers only (suitable for filenames)
|
|
206
|
+
- basedOnId should be empty (these are novel approaches)
|
|
207
|
+
- Each description should be one clear sentence describing a specific algorithmic change
|
|
208
|
+
- Descriptions should explore completely different approaches than existing ones
|
|
209
|
+
- All new rows should have empty performance and status fields
|
|
209
210
|
|
|
210
|
-
Example
|
|
211
|
-
Use ensemble of 3 random forests with different feature subsets
|
|
212
|
-
Replace
|
|
213
|
-
|
|
211
|
+
Example descriptions:
|
|
212
|
+
- Use ensemble of 3 random forests with different feature subsets
|
|
213
|
+
- Replace neural network with gradient boosting decision trees
|
|
214
|
+
- Implement Monte Carlo tree search for feature selection
|
|
214
215
|
|
|
215
|
-
|
|
216
|
+
Add exactly $count rows to the CSV file now."
|
|
216
217
|
|
|
217
|
-
|
|
218
|
+
echo "[INFO] Calling Claude Opus to generate $count novel exploration ideas..."
|
|
219
|
+
if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
|
|
220
|
+
echo "[WARN] Claude failed to generate novel ideas" >&2
|
|
221
|
+
return 1
|
|
222
|
+
fi
|
|
223
|
+
echo "[INFO] Novel exploration ideas generated"
|
|
218
224
|
}
|
|
219
225
|
|
|
220
|
-
# Generate hill climbing ideas
|
|
221
|
-
|
|
226
|
+
# Generate hill climbing ideas by having Claude edit CSV directly
|
|
227
|
+
generate_hill_climbing_direct() {
|
|
222
228
|
local count="$1"
|
|
223
229
|
local top_performers="$2"
|
|
224
230
|
|
|
225
|
-
local prompt="
|
|
231
|
+
local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for parameter tuning based on successful algorithms.
|
|
226
232
|
|
|
227
|
-
Successful algorithms:
|
|
233
|
+
Successful algorithms to build on:
|
|
228
234
|
$top_performers
|
|
229
235
|
|
|
230
236
|
Project Brief:
|
|
231
237
|
$(cat "$FULL_BRIEF_PATH")
|
|
232
238
|
|
|
233
|
-
|
|
234
|
-
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
239
|
+
Requirements for new CSV rows:
|
|
240
|
+
- IDs must be numbers only (suitable for filenames)
|
|
241
|
+
- basedOnId should reference ONE of the successful algorithm IDs above (pick the best one)
|
|
242
|
+
- Each description should be one clear sentence about parameter tuning
|
|
243
|
+
- Focus on adjusting hyperparameters, thresholds, sizes, learning rates
|
|
244
|
+
- All new rows should have empty performance and status fields
|
|
237
245
|
|
|
238
|
-
Example
|
|
239
|
-
Increase learning rate from 0.001 to 0.01 for faster convergence
|
|
240
|
-
Reduce batch size from 32 to 16 to improve gradient estimates
|
|
241
|
-
Set dropout rate to 0.3 instead of 0.1 to prevent overfitting
|
|
246
|
+
Example descriptions:
|
|
247
|
+
- Increase learning rate from 0.001 to 0.01 for faster convergence
|
|
248
|
+
- Reduce batch size from 32 to 16 to improve gradient estimates
|
|
249
|
+
- Set dropout rate to 0.3 instead of 0.1 to prevent overfitting
|
|
242
250
|
|
|
243
|
-
|
|
251
|
+
Add exactly $count parameter tuning rows to the CSV file now."
|
|
244
252
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
echo "[INFO] Calling Claude Opus to generate $count hill climbing ideas..."
|
|
254
|
+
if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
|
|
255
|
+
echo "[WARN] Claude failed to generate hill climbing ideas" >&2
|
|
256
|
+
return 1
|
|
257
|
+
fi
|
|
258
|
+
echo "[INFO] Hill climbing ideas generated"
|
|
250
259
|
}
|
|
251
260
|
|
|
252
|
-
# Generate structural mutation ideas
|
|
253
|
-
|
|
261
|
+
# Generate structural mutation ideas by having Claude edit CSV directly
|
|
262
|
+
generate_structural_mutation_direct() {
|
|
254
263
|
local count="$1"
|
|
255
264
|
local top_performers="$2"
|
|
256
265
|
|
|
257
|
-
local prompt="
|
|
266
|
+
local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for structural modifications based on successful algorithms.
|
|
258
267
|
|
|
259
|
-
Successful algorithms:
|
|
268
|
+
Successful algorithms to build on:
|
|
260
269
|
$top_performers
|
|
261
270
|
|
|
262
271
|
Project Brief:
|
|
263
272
|
$(cat "$FULL_BRIEF_PATH")
|
|
264
273
|
|
|
265
|
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
274
|
+
Requirements for new CSV rows:
|
|
275
|
+
- IDs must be numbers only (suitable for filenames)
|
|
276
|
+
- basedOnId should reference ONE of the successful algorithm IDs above (pick the best one)
|
|
277
|
+
- Each description should be one clear sentence about architectural changes
|
|
278
|
+
- Keep core insights but change implementation approach
|
|
279
|
+
- All new rows should have empty performance and status fields
|
|
269
280
|
|
|
270
|
-
Example
|
|
271
|
-
Replace linear layers with convolutional layers for spatial feature learning
|
|
272
|
-
Use bidirectional LSTM instead of unidirectional for better context
|
|
273
|
-
Add residual connections between layers to improve gradient flow
|
|
281
|
+
Example descriptions:
|
|
282
|
+
- Replace linear layers with convolutional layers for spatial feature learning
|
|
283
|
+
- Use bidirectional LSTM instead of unidirectional for better context
|
|
284
|
+
- Add residual connections between layers to improve gradient flow
|
|
274
285
|
|
|
275
|
-
|
|
286
|
+
Add exactly $count structural modification rows to the CSV file now."
|
|
276
287
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
288
|
+
echo "[INFO] Calling Claude Opus to generate $count structural mutation ideas..."
|
|
289
|
+
if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
|
|
290
|
+
echo "[WARN] Claude failed to generate structural mutation ideas" >&2
|
|
291
|
+
return 1
|
|
292
|
+
fi
|
|
293
|
+
echo "[INFO] Structural mutation ideas generated"
|
|
282
294
|
}
|
|
283
295
|
|
|
284
|
-
# Generate crossover hybrid ideas
|
|
285
|
-
|
|
296
|
+
# Generate crossover hybrid ideas by having Claude edit CSV directly
|
|
297
|
+
generate_crossover_direct() {
|
|
286
298
|
local count="$1"
|
|
287
299
|
local top_performers="$2"
|
|
288
300
|
|
|
289
|
-
local prompt="
|
|
301
|
+
local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for hybrid combinations of successful algorithms.
|
|
290
302
|
|
|
291
303
|
Top performers to combine:
|
|
292
304
|
$top_performers
|
|
@@ -294,59 +306,26 @@ $top_performers
|
|
|
294
306
|
Project Brief:
|
|
295
307
|
$(cat "$FULL_BRIEF_PATH")
|
|
296
308
|
|
|
297
|
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
Combine ensemble voting from algorithm 3 with feature selection from algorithm 5
|
|
304
|
-
Use the attention mechanism from algorithm 2 with the optimizer from algorithm 4
|
|
305
|
-
Merge the preprocessing pipeline from algorithm 1 with the architecture from algorithm 6
|
|
306
|
-
|
|
307
|
-
Generate exactly $count hybrid combination ideas now:"
|
|
308
|
-
|
|
309
|
-
# Use the best performer for crossover (single parent ID)
|
|
310
|
-
local best_id
|
|
311
|
-
best_id=$(echo "$top_performers" | head -1 | cut -d, -f1)
|
|
312
|
-
|
|
313
|
-
generate_and_add_ideas "$prompt" "$count" "$best_id"
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
# Helper function to generate and add ideas using Claude
|
|
317
|
-
generate_and_add_ideas() {
|
|
318
|
-
local prompt="$1"
|
|
319
|
-
local count="$2"
|
|
320
|
-
local based_on_id="$3"
|
|
321
|
-
|
|
322
|
-
# Call Claude and process response
|
|
323
|
-
local response
|
|
324
|
-
if ! response=$(echo "$prompt" | claude --dangerously-skip-permissions --model opus -p 2>&1); then
|
|
325
|
-
echo "[WARN] Claude API call failed for $count ideas" >&2
|
|
326
|
-
return 1
|
|
327
|
-
fi
|
|
328
|
-
|
|
329
|
-
local ideas_added=0
|
|
330
|
-
while IFS= read -r line; do
|
|
331
|
-
# Clean up line
|
|
332
|
-
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
333
|
-
[[ -z $line ]] && continue
|
|
309
|
+
Requirements for new CSV rows:
|
|
310
|
+
- IDs must be numbers only (suitable for filenames)
|
|
311
|
+
- basedOnId should reference ONE of the successful algorithm IDs above (pick the best one as base)
|
|
312
|
+
- Each description should be one clear sentence combining elements from different algorithms
|
|
313
|
+
- Be specific about what elements to merge
|
|
314
|
+
- All new rows should have empty performance and status fields
|
|
334
315
|
|
|
335
|
-
|
|
336
|
-
|
|
316
|
+
Example descriptions:
|
|
317
|
+
- Combine ensemble voting from algorithm 3 with feature selection from algorithm 5
|
|
318
|
+
- Use the attention mechanism from algorithm 2 with the optimizer from algorithm 4
|
|
319
|
+
- Merge the preprocessing pipeline from algorithm 1 with the architecture from algorithm 6
|
|
337
320
|
|
|
338
|
-
|
|
339
|
-
((ideas_added++))
|
|
321
|
+
Add exactly $count hybrid combination rows to the CSV file now."
|
|
340
322
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
if [[ $ideas_added -eq 0 ]]; then
|
|
345
|
-
echo "[WARN] No valid ideas extracted from Claude response" >&2
|
|
323
|
+
echo "[INFO] Calling Claude Opus to generate $count crossover hybrid ideas..."
|
|
324
|
+
if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
|
|
325
|
+
echo "[WARN] Claude failed to generate crossover ideas" >&2
|
|
346
326
|
return 1
|
|
347
327
|
fi
|
|
348
|
-
|
|
349
|
-
echo "[INFO] Generated $ideas_added ideas of requested type"
|
|
328
|
+
echo "[INFO] Crossover hybrid ideas generated"
|
|
350
329
|
}
|
|
351
330
|
|
|
352
331
|
# Legacy AI generation mode (for backward compatibility)
|
|
@@ -370,56 +349,34 @@ ideate_ai_legacy() {
|
|
|
370
349
|
fi
|
|
371
350
|
|
|
372
351
|
# Build prompt
|
|
373
|
-
local prompt
|
|
374
|
-
prompt="It's time for your megathinking mode! You are helping with algorithm evolution. Generate exactly $TOTAL_IDEAS new algorithm idea(s) based on the following context.
|
|
352
|
+
local prompt="Edit the file $FULL_CSV_PATH to add exactly $TOTAL_IDEAS new algorithm variation rows.
|
|
375
353
|
|
|
376
354
|
Project Brief:
|
|
377
|
-
$(cat "$FULL_BRIEF_PATH")
|
|
378
|
-
"
|
|
355
|
+
$(cat "$FULL_BRIEF_PATH")"
|
|
379
356
|
|
|
380
357
|
if [[ -n $top_performers ]]; then
|
|
381
358
|
prompt+="
|
|
359
|
+
|
|
382
360
|
Top Performing Algorithms So Far:
|
|
383
|
-
$top_performers
|
|
384
|
-
"
|
|
361
|
+
$top_performers"
|
|
385
362
|
fi
|
|
386
363
|
|
|
387
364
|
prompt+="
|
|
388
|
-
Generate $TOTAL_IDEAS creative algorithm variation(s) that could potentially improve performance.
|
|
389
|
-
For each idea, provide a single line description that explains the approach.
|
|
390
|
-
Base it on the top algorithms by their ID.
|
|
391
|
-
Format: One idea per line, no numbering, no extra formatting."
|
|
392
365
|
|
|
393
|
-
|
|
366
|
+
Requirements for new CSV rows:
|
|
367
|
+
- IDs must be numbers only (suitable for filenames)
|
|
368
|
+
- basedOnId should be empty or reference existing algorithm ID
|
|
369
|
+
- Each description should be one clear sentence describing an algorithmic approach
|
|
370
|
+
- All new rows should have empty performance and status fields
|
|
394
371
|
|
|
395
|
-
|
|
396
|
-
local response
|
|
397
|
-
if ! response=$(echo "$prompt" | claude --dangerously-skip-permissions --model opus -p 2>&1); then
|
|
398
|
-
echo "[WARN] Claude API call failed, falling back to manual entry."
|
|
399
|
-
return 1
|
|
400
|
-
fi
|
|
401
|
-
|
|
402
|
-
local ideas_added=0
|
|
403
|
-
while IFS= read -r line; do
|
|
404
|
-
# Clean up line
|
|
405
|
-
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
406
|
-
[[ -z $line ]] && continue
|
|
407
|
-
|
|
408
|
-
# Remove numbering/bullets
|
|
409
|
-
line=$(echo "$line" | sed 's/^[0-9]*\. *//;s/^[-*] *//')
|
|
372
|
+
Add exactly $TOTAL_IDEAS algorithm variation rows to the CSV file now."
|
|
410
373
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
[[ $ideas_added -ge $TOTAL_IDEAS ]] && break
|
|
415
|
-
done <<<"$response"
|
|
416
|
-
|
|
417
|
-
if [[ $ideas_added -eq 0 ]]; then
|
|
418
|
-
echo "[WARN] No valid ideas extracted from Claude response"
|
|
374
|
+
echo "[INFO] Calling Claude Opus to generate $TOTAL_IDEAS ideas (legacy mode)..."
|
|
375
|
+
if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
|
|
376
|
+
echo "[WARN] Claude failed to generate ideas" >&2
|
|
419
377
|
return 1
|
|
420
378
|
fi
|
|
421
|
-
|
|
422
|
-
echo "[INFO] Successfully generated $ideas_added idea(s)"
|
|
379
|
+
echo "[INFO] Legacy ideas generated"
|
|
423
380
|
}
|
|
424
381
|
|
|
425
382
|
# Main execution
|