claude-evolve 1.8.39 → 1.8.41

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.
@@ -894,38 +894,53 @@ ideate_ai_strategies() {
894
894
  # Track successes - continue even if some strategies fail
895
895
  local strategies_attempted=0
896
896
  local strategies_succeeded=0
897
-
897
+
898
+ # Helper to check if we've reached the target for this generation
899
+ check_generation_complete() {
900
+ local current_count
901
+ current_count=$(grep -c "^gen${CURRENT_GENERATION}-" "$FULL_CSV_PATH" 2>/dev/null || echo "0")
902
+ if [[ $current_count -ge $TOTAL_IDEAS ]]; then
903
+ echo "[INFO] Generation $CURRENT_GENERATION reached target ($current_count >= $TOTAL_IDEAS), stopping early" >&2
904
+ return 0
905
+ fi
906
+ return 1
907
+ }
908
+
898
909
  if [[ $NOVEL_EXPLORATION -gt 0 ]]; then
899
910
  ((strategies_attempted++))
900
911
  if generate_novel_ideas_direct "$NOVEL_EXPLORATION"; then
901
912
  ((strategies_succeeded++))
913
+ check_generation_complete && return 0
902
914
  else
903
915
  echo "[WARN] Novel exploration strategy failed, continuing with other strategies" >&2
904
916
  fi
905
917
  fi
906
-
918
+
907
919
  if [[ $HILL_CLIMBING -gt 0 ]]; then
908
920
  ((strategies_attempted++))
909
921
  if generate_hill_climbing_direct "$HILL_CLIMBING" "$top_performers"; then
910
922
  ((strategies_succeeded++))
923
+ check_generation_complete && return 0
911
924
  else
912
925
  echo "[WARN] Hill climbing strategy failed, continuing with other strategies" >&2
913
926
  fi
914
927
  fi
915
-
928
+
916
929
  if [[ $STRUCTURAL_MUTATION -gt 0 ]]; then
917
930
  ((strategies_attempted++))
918
931
  if generate_structural_mutation_direct "$STRUCTURAL_MUTATION" "$top_performers"; then
919
932
  ((strategies_succeeded++))
933
+ check_generation_complete && return 0
920
934
  else
921
935
  echo "[WARN] Structural mutation strategy failed, continuing with other strategies" >&2
922
936
  fi
923
937
  fi
924
-
938
+
925
939
  if [[ $CROSSOVER_HYBRID -gt 0 ]]; then
926
940
  ((strategies_attempted++))
927
941
  if generate_crossover_direct "$CROSSOVER_HYBRID" "$top_performers"; then
928
942
  ((strategies_succeeded++))
943
+ check_generation_complete && return 0
929
944
  else
930
945
  echo "[WARN] Crossover strategy failed, continuing with other strategies" >&2
931
946
  fi
@@ -1657,8 +1672,72 @@ CRITICAL: You must use your file editing tools (Edit/MultiEdit) to modify the CS
1657
1672
  return 0
1658
1673
  }
1659
1674
 
1660
- # Determine generation number for this ideation run
1661
- CURRENT_GENERATION=$(get_next_generation)
1675
+ # AIDEV-NOTE: Determine which generation to use for ideation
1676
+ # Check if the HIGHEST existing generation needs more ideas before creating a new one
1677
+ get_highest_generation() {
1678
+ if [[ ! -f "$FULL_CSV_PATH" ]]; then
1679
+ echo "0"
1680
+ return
1681
+ fi
1682
+ "$PYTHON_CMD" -c "
1683
+ import csv
1684
+ max_gen = 0
1685
+ with open('$FULL_CSV_PATH', 'r') as f:
1686
+ reader = csv.reader(f)
1687
+ next(reader, None) # Skip header
1688
+ for row in reader:
1689
+ if row and len(row) > 0:
1690
+ id_field = row[0].strip()
1691
+ if id_field.startswith('gen') and '-' in id_field:
1692
+ try:
1693
+ gen_part = id_field.split('-')[0]
1694
+ gen_num = int(gen_part[3:])
1695
+ max_gen = max(max_gen, gen_num)
1696
+ except (ValueError, IndexError):
1697
+ pass
1698
+ print(max_gen)
1699
+ "
1700
+ }
1701
+
1702
+ count_generation_ideas() {
1703
+ local gen="$1"
1704
+ grep -c "^gen${gen}-" "$FULL_CSV_PATH" 2>/dev/null || echo "0"
1705
+ }
1706
+
1707
+ count_generation_pending() {
1708
+ local gen="$1"
1709
+ grep -c "^gen${gen}-.*,pending" "$FULL_CSV_PATH" 2>/dev/null || echo "0"
1710
+ }
1711
+
1712
+ # Find the right generation to use
1713
+ highest_gen=$(get_highest_generation)
1714
+ if [[ $highest_gen -eq 0 ]]; then
1715
+ # No generations yet, start with 1
1716
+ CURRENT_GENERATION=1
1717
+ echo "[INFO] No existing generations, starting with generation 1"
1718
+ else
1719
+ # Check if highest generation needs more ideas
1720
+ existing_ideas=$(count_generation_ideas "$highest_gen")
1721
+ pending_ideas=$(count_generation_pending "$highest_gen")
1722
+
1723
+ echo "[INFO] Highest generation: $highest_gen with $existing_ideas total ideas ($pending_ideas pending)"
1724
+
1725
+ if [[ $existing_ideas -ge $TOTAL_IDEAS ]]; then
1726
+ # Highest generation is full, create a new one
1727
+ CURRENT_GENERATION=$(get_next_generation)
1728
+ echo "[INFO] Generation $highest_gen is full ($existing_ideas >= $TOTAL_IDEAS), creating generation $CURRENT_GENERATION"
1729
+ elif [[ $pending_ideas -ge $TOTAL_IDEAS ]]; then
1730
+ # Already have enough pending, skip ideation
1731
+ echo "[INFO] Generation $highest_gen already has $pending_ideas pending ideas (target: $TOTAL_IDEAS)"
1732
+ echo "[INFO] Skipping ideation - workers will process existing ideas"
1733
+ exit 0
1734
+ else
1735
+ # Continue filling the current highest generation
1736
+ CURRENT_GENERATION=$highest_gen
1737
+ echo "[INFO] Continuing generation $CURRENT_GENERATION (need $((TOTAL_IDEAS - existing_ideas)) more ideas)"
1738
+ fi
1739
+ fi
1740
+
1662
1741
  echo "[INFO] Starting ideation for generation $CURRENT_GENERATION"
1663
1742
 
1664
1743
  # Main execution with retry logic and exponential backoff
@@ -1667,16 +1746,16 @@ wait_seconds=300 # Start with 5 minutes
1667
1746
  max_wait_seconds=300 # Cap at 5 minutes
1668
1747
 
1669
1748
  while true; do
1670
- # AIDEV-NOTE: Check if we already have enough pending ideas for this generation
1671
- # This prevents endless ideation loops when partial results were written but
1672
- # the function returned failure (e.g., 2/4 strategies succeeded)
1749
+ # Re-check pending count in case another process added ideas
1673
1750
  pending_count=$(grep -c "^gen${CURRENT_GENERATION}-.*,pending" "$FULL_CSV_PATH" 2>/dev/null || echo "0")
1674
- if [[ $pending_count -ge $TOTAL_IDEAS ]]; then
1675
- echo "[INFO] Already have $pending_count pending ideas for generation $CURRENT_GENERATION (target: $TOTAL_IDEAS)"
1676
- echo "[INFO] Skipping ideation - workers will process existing ideas"
1751
+ total_count=$(grep -c "^gen${CURRENT_GENERATION}-" "$FULL_CSV_PATH" 2>/dev/null || echo "0")
1752
+
1753
+ if [[ $total_count -ge $TOTAL_IDEAS ]]; then
1754
+ echo "[INFO] Generation $CURRENT_GENERATION now has $total_count ideas (target: $TOTAL_IDEAS)"
1755
+ echo "[INFO] Ideation complete for this generation"
1677
1756
  exit 0
1678
1757
  elif [[ $pending_count -gt 0 ]]; then
1679
- echo "[INFO] Found $pending_count existing pending ideas for generation $CURRENT_GENERATION (target: $TOTAL_IDEAS)"
1758
+ echo "[INFO] Found $pending_count pending, $total_count total for generation $CURRENT_GENERATION (target: $TOTAL_IDEAS)"
1680
1759
  fi
1681
1760
 
1682
1761
  if [[ $use_strategies == true ]]; then
package/lib/config.sh CHANGED
@@ -60,7 +60,7 @@ DEFAULT_WORKER_MAX_CANDIDATES=3
60
60
  # Default LLM CLI configuration
61
61
  DEFAULT_LLM_RUN="glm-zai kimi-coder glm-zai kimi-coder glm-zai kimi-coder codex-oss-local haiku"
62
62
  # Ideate: Commercial models for idea generation + local fallback
63
- DEFAULT_LLM_IDEATE="opus-think kimi-k2-openrouter gemini-3-pro-preview sonnet-think gpt5high grok-4-openrouter deepseek-openrouter glm-zai"
63
+ DEFAULT_LLM_IDEATE="opus-think kimi-k2-openrouter gemini-3-pro-preview gpt5high grok-4-openrouter deepseek-openrouter glm-zai kimi-coder"
64
64
 
65
65
  # Load configuration from a YAML file and update variables
66
66
  _load_yaml_config() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.8.39",
3
+ "version": "1.8.41",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",