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.
@@ -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,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 ]] && 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.
201
200
 
202
201
  Project Brief:
203
202
  $(cat "$FULL_BRIEF_PATH")
204
203
 
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
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 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
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
- Generate exactly $count ideas now:"
216
+ Add exactly $count rows to the CSV file now."
216
217
 
217
- generate_and_add_ideas "$prompt" "$count" ""
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 (parameter tuning)
221
- generate_hill_climbing_ideas() {
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="Generate exactly $count parameter tuning ideas (one per line, no numbering).
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
- 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
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 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
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
- Generate exactly $count parameter tuning ideas now:"
251
+ Add exactly $count parameter tuning rows to the CSV file now."
244
252
 
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"
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
- generate_structural_mutation_ideas() {
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="Generate exactly $count structural modifications (one per line, no numbering).
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
- 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
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 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
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
- Generate exactly $count structural modification ideas now:"
286
+ Add exactly $count structural modification rows to the CSV file now."
276
287
 
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"
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
- generate_crossover_ideas() {
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="Generate exactly $count hybrid combinations (one per line, no numbering).
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
- 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
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
- # Remove numbering/bullets
336
- line=$(echo "$line" | sed 's/^[0-9]*\. *//;s/^[-*] *//')
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
- add_idea "$line" "$based_on_id"
339
- ((ideas_added++))
321
+ Add exactly $count hybrid combination rows to the CSV file now."
340
322
 
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
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
- echo "[INFO] Generating $TOTAL_IDEAS idea(s) with Claude (legacy mode)..."
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
- # 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
-
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
- 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"
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",