claude-evolve 1.8.46 → 1.8.48
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-analyze +4 -2
- package/bin/claude-evolve-ideate +22 -15
- package/bin/claude-evolve-run +1 -1
- package/package.json +1 -1
|
@@ -292,10 +292,12 @@ with open('$csv_file', 'r') as f:
|
|
|
292
292
|
# Sort generations numerically
|
|
293
293
|
for gen in $(cut -d' ' -f1 "$gen_stats_file" | sort -u | awk '{print substr($0,4), $0}' | sort -n | cut -d' ' -f2 || echo ""); do
|
|
294
294
|
[[ -z "$gen" ]] && continue
|
|
295
|
-
total_in_gen=$(grep -c "^$gen " "$gen_stats_file" 2>/dev/null ||
|
|
296
|
-
|
|
295
|
+
total_in_gen=$(grep -c "^$gen " "$gen_stats_file" 2>/dev/null) || true
|
|
296
|
+
total_in_gen=${total_in_gen:-0}
|
|
297
|
+
completed_in_gen=$(grep -c "^$gen completed" "$gen_stats_file" 2>/dev/null) || true
|
|
297
298
|
# Clean any whitespace from the numbers
|
|
298
299
|
completed_in_gen=$(echo "$completed_in_gen" | tr -d '[:space:]')
|
|
300
|
+
completed_in_gen=${completed_in_gen:-0}
|
|
299
301
|
|
|
300
302
|
echo -n "$gen: $total_in_gen candidates"
|
|
301
303
|
|
package/bin/claude-evolve-ideate
CHANGED
|
@@ -144,7 +144,7 @@ call_ai_for_ideation() {
|
|
|
144
144
|
|
|
145
145
|
# Count remaining placeholders - there should be none if AI did its job
|
|
146
146
|
local placeholder_count
|
|
147
|
-
placeholder_count=$(grep -c "PLACEHOLDER" "$temp_csv_file" 2>/dev/null ||
|
|
147
|
+
placeholder_count=$(grep -c "PLACEHOLDER" "$temp_csv_file" 2>/dev/null) || true
|
|
148
148
|
placeholder_count=$(echo "$placeholder_count" | tr -d '[:space:]')
|
|
149
149
|
placeholder_count=${placeholder_count:-0}
|
|
150
150
|
|
|
@@ -227,7 +227,7 @@ fi
|
|
|
227
227
|
|
|
228
228
|
# Validate strategy configuration
|
|
229
229
|
if [[ $use_strategies == true ]]; then
|
|
230
|
-
total_check=$((NOVEL_EXPLORATION + HILL_CLIMBING + STRUCTURAL_MUTATION + CROSSOVER_HYBRID))
|
|
230
|
+
total_check=$((${NOVEL_EXPLORATION:-0} + ${HILL_CLIMBING:-0} + ${STRUCTURAL_MUTATION:-0} + ${CROSSOVER_HYBRID:-0}))
|
|
231
231
|
if [[ $total_check -ne $TOTAL_IDEAS ]]; then
|
|
232
232
|
echo "[ERROR] Strategy counts don't sum to total_ideas ($total_check != $TOTAL_IDEAS)" >&2
|
|
233
233
|
echo "Check your evolution/config.yaml configuration" >&2
|
|
@@ -903,7 +903,8 @@ ideate_ai_strategies() {
|
|
|
903
903
|
# Helper to check if we've reached the target for this generation
|
|
904
904
|
check_generation_complete() {
|
|
905
905
|
local current_count
|
|
906
|
-
current_count=$(grep -c "^gen${CURRENT_GENERATION}-" "$FULL_CSV_PATH" 2>/dev/null ||
|
|
906
|
+
current_count=$(grep -c "^gen${CURRENT_GENERATION}-" "$FULL_CSV_PATH" 2>/dev/null) || true
|
|
907
|
+
current_count=${current_count:-0}
|
|
907
908
|
if [[ $current_count -ge $TOTAL_IDEAS ]]; then
|
|
908
909
|
echo "[INFO] Generation $CURRENT_GENERATION reached target ($current_count >= $TOTAL_IDEAS), stopping early" >&2
|
|
909
910
|
return 0
|
|
@@ -911,7 +912,7 @@ ideate_ai_strategies() {
|
|
|
911
912
|
return 1
|
|
912
913
|
}
|
|
913
914
|
|
|
914
|
-
if [[ $NOVEL_EXPLORATION -gt 0 ]]; then
|
|
915
|
+
if [[ ${NOVEL_EXPLORATION:-0} -gt 0 ]]; then
|
|
915
916
|
((strategies_attempted++))
|
|
916
917
|
if generate_novel_ideas_direct "$NOVEL_EXPLORATION"; then
|
|
917
918
|
((strategies_succeeded++))
|
|
@@ -921,7 +922,7 @@ ideate_ai_strategies() {
|
|
|
921
922
|
fi
|
|
922
923
|
fi
|
|
923
924
|
|
|
924
|
-
if [[ $HILL_CLIMBING -gt 0 ]]; then
|
|
925
|
+
if [[ ${HILL_CLIMBING:-0} -gt 0 ]]; then
|
|
925
926
|
((strategies_attempted++))
|
|
926
927
|
if generate_hill_climbing_direct "$HILL_CLIMBING" "$top_performers"; then
|
|
927
928
|
((strategies_succeeded++))
|
|
@@ -931,7 +932,7 @@ ideate_ai_strategies() {
|
|
|
931
932
|
fi
|
|
932
933
|
fi
|
|
933
934
|
|
|
934
|
-
if [[ $STRUCTURAL_MUTATION -gt 0 ]]; then
|
|
935
|
+
if [[ ${STRUCTURAL_MUTATION:-0} -gt 0 ]]; then
|
|
935
936
|
((strategies_attempted++))
|
|
936
937
|
if generate_structural_mutation_direct "$STRUCTURAL_MUTATION" "$top_performers"; then
|
|
937
938
|
((strategies_succeeded++))
|
|
@@ -941,7 +942,7 @@ ideate_ai_strategies() {
|
|
|
941
942
|
fi
|
|
942
943
|
fi
|
|
943
944
|
|
|
944
|
-
if [[ $CROSSOVER_HYBRID -gt 0 ]]; then
|
|
945
|
+
if [[ ${CROSSOVER_HYBRID:-0} -gt 0 ]]; then
|
|
945
946
|
((strategies_attempted++))
|
|
946
947
|
if generate_crossover_direct "$CROSSOVER_HYBRID" "$top_performers"; then
|
|
947
948
|
((strategies_succeeded++))
|
|
@@ -957,7 +958,7 @@ ideate_ai_strategies() {
|
|
|
957
958
|
# The workers will process what we have, and next ideation run can add more
|
|
958
959
|
# AIDEV-NOTE: Previously required ALL strategies to succeed, which caused
|
|
959
960
|
# endless ideation loops because CSV writes weren't rolled back on "rejection"
|
|
960
|
-
if [[ $strategies_succeeded -gt 0 ]]; then
|
|
961
|
+
if [[ ${strategies_succeeded:-0} -gt 0 ]]; then
|
|
961
962
|
if [[ $strategies_succeeded -lt $strategies_attempted ]]; then
|
|
962
963
|
echo "[INFO] Partial success: $strategies_succeeded/$strategies_attempted strategies completed" >&2
|
|
963
964
|
echo "[INFO] Workers will process existing ideas, next ideation can add more" >&2
|
|
@@ -1706,19 +1707,23 @@ print(max_gen)
|
|
|
1706
1707
|
|
|
1707
1708
|
count_generation_ideas() {
|
|
1708
1709
|
local gen="$1"
|
|
1709
|
-
|
|
1710
|
+
local count
|
|
1711
|
+
count=$(grep -c "^gen${gen}-" "$FULL_CSV_PATH" 2>/dev/null) || true
|
|
1712
|
+
echo "${count:-0}"
|
|
1710
1713
|
}
|
|
1711
1714
|
|
|
1712
1715
|
count_generation_pending() {
|
|
1713
1716
|
local gen="$1"
|
|
1714
|
-
|
|
1717
|
+
local count
|
|
1718
|
+
count=$(grep -c "^gen${gen}-.*,pending" "$FULL_CSV_PATH" 2>/dev/null) || true
|
|
1719
|
+
echo "${count:-0}"
|
|
1715
1720
|
}
|
|
1716
1721
|
|
|
1717
1722
|
# Find the right generation to use
|
|
1718
1723
|
# AIDEV-NOTE: Generation numbers must be zero-padded to 2 digits (gen01, gen02, etc.)
|
|
1719
1724
|
# to maintain consistency with existing CSV data format
|
|
1720
1725
|
highest_gen=$(get_highest_generation)
|
|
1721
|
-
if [[ $highest_gen -eq 0 ]]; then
|
|
1726
|
+
if [[ ${highest_gen:-0} -eq 0 ]]; then
|
|
1722
1727
|
# No generations yet, start with 01
|
|
1723
1728
|
CURRENT_GENERATION="01"
|
|
1724
1729
|
echo "[INFO] No existing generations, starting with generation 01"
|
|
@@ -1732,7 +1737,7 @@ else
|
|
|
1732
1737
|
existing_ideas_padded=$(count_generation_ideas "$padded_gen")
|
|
1733
1738
|
pending_ideas_padded=$(count_generation_pending "$padded_gen")
|
|
1734
1739
|
# Use whichever found more (handles both gen1 and gen01 formats)
|
|
1735
|
-
if [[ $existing_ideas_padded -gt $existing_ideas ]]; then
|
|
1740
|
+
if [[ ${existing_ideas_padded:-0} -gt ${existing_ideas:-0} ]]; then
|
|
1736
1741
|
existing_ideas=$existing_ideas_padded
|
|
1737
1742
|
pending_ideas=$pending_ideas_padded
|
|
1738
1743
|
fi
|
|
@@ -1766,14 +1771,16 @@ max_wait_seconds=300 # Cap at 5 minutes
|
|
|
1766
1771
|
|
|
1767
1772
|
while true; do
|
|
1768
1773
|
# Re-check pending count in case another process added ideas
|
|
1769
|
-
pending_count=$(grep -c "^gen${CURRENT_GENERATION}-.*,pending" "$FULL_CSV_PATH" 2>/dev/null ||
|
|
1770
|
-
|
|
1774
|
+
pending_count=$(grep -c "^gen${CURRENT_GENERATION}-.*,pending" "$FULL_CSV_PATH" 2>/dev/null) || true
|
|
1775
|
+
pending_count=${pending_count:-0}
|
|
1776
|
+
total_count=$(grep -c "^gen${CURRENT_GENERATION}-" "$FULL_CSV_PATH" 2>/dev/null) || true
|
|
1777
|
+
total_count=${total_count:-0}
|
|
1771
1778
|
|
|
1772
1779
|
if [[ $total_count -ge $TOTAL_IDEAS ]]; then
|
|
1773
1780
|
echo "[INFO] Generation $CURRENT_GENERATION now has $total_count ideas (target: $TOTAL_IDEAS)"
|
|
1774
1781
|
echo "[INFO] Ideation complete for this generation"
|
|
1775
1782
|
exit 0
|
|
1776
|
-
elif [[ $pending_count -gt 0 ]]; then
|
|
1783
|
+
elif [[ ${pending_count:-0} -gt 0 ]]; then
|
|
1777
1784
|
echo "[INFO] Found $pending_count pending, $total_count total for generation $CURRENT_GENERATION (target: $TOTAL_IDEAS)"
|
|
1778
1785
|
fi
|
|
1779
1786
|
|
package/bin/claude-evolve-run
CHANGED
|
@@ -681,7 +681,7 @@ except Exception as e:
|
|
|
681
681
|
print('0') # Default to 0 on error
|
|
682
682
|
" 2>/dev/null || echo "0")
|
|
683
683
|
|
|
684
|
-
if [[ $stuck_work_count -gt 0 ]]; then
|
|
684
|
+
if [[ ${stuck_work_count:-0} -gt 0 ]]; then
|
|
685
685
|
echo "[DISPATCHER] Reset $stuck_work_count stuck candidates to pending"
|
|
686
686
|
# Don't trigger ideation - go back to check pending count again
|
|
687
687
|
continue # Go back to top of loop to re-count pending
|