claude-evolve 1.2.3 → 1.2.5

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.
@@ -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
- add_idea() {
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
- add_idea "$description" ""
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
- generate_novel_ideas "$TOTAL_IDEAS" ""
178
+ generate_novel_ideas_direct "$TOTAL_IDEAS"
179
179
  return 0
180
180
  fi
181
181
 
@@ -185,108 +185,148 @@ 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 ]] && generate_novel_ideas "$NOVEL_EXPLORATION" ""
190
- [[ $HILL_CLIMBING -gt 0 ]] && generate_hill_climbing_ideas "$HILL_CLIMBING" "$top_performers"
191
- [[ $STRUCTURAL_MUTATION -gt 0 ]] && generate_structural_mutation_ideas "$STRUCTURAL_MUTATION" "$top_performers"
192
- [[ $CROSSOVER_HYBRID -gt 0 ]] && generate_crossover_ideas "$CROSSOVER_HYBRID" "$top_performers"
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
- generate_novel_ideas() {
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="Generate exactly $count concise algorithm ideas (one per line, no numbering).
199
+ local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for novel algorithmic approaches.
200
+
201
+ Current CSV content:
202
+ $(cat "$FULL_CSV_PATH")
203
+
204
+ Algorithm files you can examine for context:
205
+ - Base algorithm: $FULL_ALGORITHM_PATH
206
+ - Evolved algorithms: $FULL_OUTPUT_DIR/evolution_id*.py (if any exist)
201
207
 
202
208
  Project Brief:
203
209
  $(cat "$FULL_BRIEF_PATH")
204
210
 
205
- Generate $count completely different algorithmic approaches. Each idea should be:
206
- - One clear sentence describing a specific algorithmic change
207
- - Actionable and implementable
208
- - Different from existing approaches
211
+ Requirements for new CSV rows:
212
+ - IDs must be numbers only (suitable for filenames)
213
+ - basedOnId should be empty (these are novel approaches)
214
+ - Each description should be one clear sentence describing a specific algorithmic change
215
+ - Descriptions should explore completely different approaches than existing ones
216
+ - All new rows should have empty performance and status fields
209
217
 
210
- Example format:
211
- Use ensemble of 3 random forests with different feature subsets
212
- Replace gradient descent with genetic algorithm optimization
213
- Add attention mechanism with 8 heads to capture feature interactions
218
+ Example descriptions:
219
+ - Use ensemble of 3 random forests with different feature subsets
220
+ - Replace neural network with gradient boosting decision trees
221
+ - Implement Monte Carlo tree search for feature selection
214
222
 
215
- Generate exactly $count ideas now:"
223
+ Add exactly $count rows to the CSV file now."
216
224
 
217
- generate_and_add_ideas "$prompt" "$count" ""
225
+ echo "[INFO] Calling Claude Opus to generate $count novel exploration ideas..."
226
+ if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
227
+ echo "[WARN] Claude failed to generate novel ideas" >&2
228
+ return 1
229
+ fi
230
+ echo "[INFO] Novel exploration ideas generated"
218
231
  }
219
232
 
220
- # Generate hill climbing ideas (parameter tuning)
221
- generate_hill_climbing_ideas() {
233
+ # Generate hill climbing ideas by having Claude edit CSV directly
234
+ generate_hill_climbing_direct() {
222
235
  local count="$1"
223
236
  local top_performers="$2"
224
237
 
225
- local prompt="Generate exactly $count parameter tuning ideas (one per line, no numbering).
238
+ local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for parameter tuning based on successful algorithms.
239
+
240
+ Current CSV content:
241
+ $(cat "$FULL_CSV_PATH")
242
+
243
+ Algorithm files you can examine for context:
244
+ - Base algorithm: $FULL_ALGORITHM_PATH
245
+ - Evolved algorithms: $FULL_OUTPUT_DIR/evolution_id*.py (if any exist)
226
246
 
227
- Successful algorithms:
247
+ Successful algorithms to build on:
228
248
  $top_performers
229
249
 
230
250
  Project Brief:
231
251
  $(cat "$FULL_BRIEF_PATH")
232
252
 
233
- Generate $count specific parameter adjustments. Each idea should be:
234
- - One clear sentence describing a parameter change
235
- - Based on the successful algorithms above
236
- - Actionable with specific values
253
+ Requirements for new CSV rows:
254
+ - IDs must be numbers only (suitable for filenames)
255
+ - basedOnId should reference ONE of the successful algorithm IDs above (pick the best one)
256
+ - Each description should be one clear sentence about parameter tuning
257
+ - Focus on adjusting hyperparameters, thresholds, sizes, learning rates
258
+ - All new rows should have empty performance and status fields
237
259
 
238
- Example format:
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
260
+ Example descriptions:
261
+ - Increase learning rate from 0.001 to 0.01 for faster convergence
262
+ - Reduce batch size from 32 to 16 to improve gradient estimates
263
+ - Set dropout rate to 0.3 instead of 0.1 to prevent overfitting
242
264
 
243
- Generate exactly $count parameter tuning ideas now:"
265
+ Add exactly $count parameter tuning rows to the CSV file now."
244
266
 
245
- # Get the best performer's ID for basedOnId
246
- local best_id
247
- best_id=$(echo "$top_performers" | head -1 | cut -d, -f1)
248
-
249
- generate_and_add_ideas "$prompt" "$count" "$best_id"
267
+ echo "[INFO] Calling Claude Opus to generate $count hill climbing ideas..."
268
+ if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
269
+ echo "[WARN] Claude failed to generate hill climbing ideas" >&2
270
+ return 1
271
+ fi
272
+ echo "[INFO] Hill climbing ideas generated"
250
273
  }
251
274
 
252
- # Generate structural mutation ideas
253
- generate_structural_mutation_ideas() {
275
+ # Generate structural mutation ideas by having Claude edit CSV directly
276
+ generate_structural_mutation_direct() {
254
277
  local count="$1"
255
278
  local top_performers="$2"
256
279
 
257
- local prompt="Generate exactly $count structural modifications (one per line, no numbering).
280
+ local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for structural modifications based on successful algorithms.
281
+
282
+ Current CSV content:
283
+ $(cat "$FULL_CSV_PATH")
284
+
285
+ Algorithm files you can examine for context:
286
+ - Base algorithm: $FULL_ALGORITHM_PATH
287
+ - Evolved algorithms: $FULL_OUTPUT_DIR/evolution_id*.py (if any exist)
258
288
 
259
- Successful algorithms:
289
+ Successful algorithms to build on:
260
290
  $top_performers
261
291
 
262
292
  Project Brief:
263
293
  $(cat "$FULL_BRIEF_PATH")
264
294
 
265
- Generate $count structural changes. Each idea should be:
266
- - One clear sentence describing an architectural change
267
- - Keep core insights but change implementation
268
- - Actionable and specific
295
+ Requirements for new CSV rows:
296
+ - IDs must be numbers only (suitable for filenames)
297
+ - basedOnId should reference ONE of the successful algorithm IDs above (pick the best one)
298
+ - Each description should be one clear sentence about architectural changes
299
+ - Keep core insights but change implementation approach
300
+ - All new rows should have empty performance and status fields
269
301
 
270
- Example format:
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
302
+ Example descriptions:
303
+ - Replace linear layers with convolutional layers for spatial feature learning
304
+ - Use bidirectional LSTM instead of unidirectional for better context
305
+ - Add residual connections between layers to improve gradient flow
274
306
 
275
- Generate exactly $count structural modification ideas now:"
307
+ Add exactly $count structural modification rows to the CSV file now."
276
308
 
277
- # Get the best performer's ID for basedOnId
278
- local best_id
279
- best_id=$(echo "$top_performers" | head -1 | cut -d, -f1)
280
-
281
- generate_and_add_ideas "$prompt" "$count" "$best_id"
309
+ echo "[INFO] Calling Claude Opus to generate $count structural mutation ideas..."
310
+ if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
311
+ echo "[WARN] Claude failed to generate structural mutation ideas" >&2
312
+ return 1
313
+ fi
314
+ echo "[INFO] Structural mutation ideas generated"
282
315
  }
283
316
 
284
- # Generate crossover hybrid ideas
285
- generate_crossover_ideas() {
317
+ # Generate crossover hybrid ideas by having Claude edit CSV directly
318
+ generate_crossover_direct() {
286
319
  local count="$1"
287
320
  local top_performers="$2"
288
321
 
289
- local prompt="Generate exactly $count hybrid combinations (one per line, no numbering).
322
+ local prompt="Edit the file $FULL_CSV_PATH to add exactly $count new rows for hybrid combinations of successful algorithms.
323
+
324
+ Current CSV content:
325
+ $(cat "$FULL_CSV_PATH")
326
+
327
+ Algorithm files you can examine for context:
328
+ - Base algorithm: $FULL_ALGORITHM_PATH
329
+ - Evolved algorithms: $FULL_OUTPUT_DIR/evolution_id*.py (if any exist)
290
330
 
291
331
  Top performers to combine:
292
332
  $top_performers
@@ -294,59 +334,26 @@ $top_performers
294
334
  Project Brief:
295
335
  $(cat "$FULL_BRIEF_PATH")
296
336
 
297
- Generate $count combinations. Each idea should be:
298
- - One clear sentence combining elements from different algorithms above
299
- - Specific about what elements to merge
300
- - Actionable and implementable
301
-
302
- Example format:
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
337
+ Requirements for new CSV rows:
338
+ - IDs must be numbers only (suitable for filenames)
339
+ - basedOnId should reference ONE of the successful algorithm IDs above (pick the best one as base)
340
+ - Each description should be one clear sentence combining elements from different algorithms
341
+ - Be specific about what elements to merge
342
+ - All new rows should have empty performance and status fields
328
343
 
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
334
-
335
- # Remove numbering/bullets
336
- line=$(echo "$line" | sed 's/^[0-9]*\. *//;s/^[-*] *//')
344
+ Example descriptions:
345
+ - Combine ensemble voting from algorithm 3 with feature selection from algorithm 5
346
+ - Use the attention mechanism from algorithm 2 with the optimizer from algorithm 4
347
+ - Merge the preprocessing pipeline from algorithm 1 with the architecture from algorithm 6
337
348
 
338
- add_idea "$line" "$based_on_id"
339
- ((ideas_added++))
349
+ Add exactly $count hybrid combination rows to the CSV file now."
340
350
 
341
- [[ $ideas_added -ge $count ]] && break
342
- done <<<"$response"
343
-
344
- if [[ $ideas_added -eq 0 ]]; then
345
- echo "[WARN] No valid ideas extracted from Claude response" >&2
351
+ echo "[INFO] Calling Claude Opus to generate $count crossover hybrid ideas..."
352
+ if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
353
+ echo "[WARN] Claude failed to generate crossover ideas" >&2
346
354
  return 1
347
355
  fi
348
-
349
- echo "[INFO] Generated $ideas_added ideas of requested type"
356
+ echo "[INFO] Crossover hybrid ideas generated"
350
357
  }
351
358
 
352
359
  # Legacy AI generation mode (for backward compatibility)
@@ -370,56 +377,41 @@ ideate_ai_legacy() {
370
377
  fi
371
378
 
372
379
  # 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.
380
+ local prompt="Edit the file $FULL_CSV_PATH to add exactly $TOTAL_IDEAS new algorithm variation rows.
381
+
382
+ Current CSV content:
383
+ $(cat "$FULL_CSV_PATH")
384
+
385
+ Algorithm files you can examine for context:
386
+ - Base algorithm: $FULL_ALGORITHM_PATH
387
+ - Evolved algorithms: $FULL_OUTPUT_DIR/evolution_id*.py (if any exist)
375
388
 
376
389
  Project Brief:
377
- $(cat "$FULL_BRIEF_PATH")
378
- "
390
+ $(cat "$FULL_BRIEF_PATH")"
379
391
 
380
392
  if [[ -n $top_performers ]]; then
381
393
  prompt+="
394
+
382
395
  Top Performing Algorithms So Far:
383
- $top_performers
384
- "
396
+ $top_performers"
385
397
  fi
386
398
 
387
399
  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
-
393
- echo "[INFO] Generating $TOTAL_IDEAS idea(s) with Claude (legacy mode)..."
394
400
 
395
- # Call Claude and process response
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
+ Requirements for new CSV rows:
402
+ - IDs must be numbers only (suitable for filenames)
403
+ - basedOnId should be empty or reference existing algorithm ID
404
+ - Each description should be one clear sentence describing an algorithmic approach
405
+ - All new rows should have empty performance and status fields
401
406
 
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
+ Add exactly $TOTAL_IDEAS algorithm variation rows to the CSV file now."
407
408
 
408
- # Remove numbering/bullets
409
- line=$(echo "$line" | sed 's/^[0-9]*\. *//;s/^[-*] *//')
410
-
411
- add_idea "$line" ""
412
- ((ideas_added++))
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"
409
+ echo "[INFO] Calling Claude Opus to generate $TOTAL_IDEAS ideas (legacy mode)..."
410
+ if ! echo "$prompt" | claude --dangerously-skip-permissions --model opus -p; then
411
+ echo "[WARN] Claude failed to generate ideas" >&2
419
412
  return 1
420
413
  fi
421
-
422
- echo "[INFO] Successfully generated $ideas_added idea(s)"
414
+ echo "[INFO] Legacy ideas generated"
423
415
  }
424
416
 
425
417
  # Main execution
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",