claude-evolve 1.2.6 → 1.2.9

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.
@@ -83,16 +83,19 @@ while IFS=, read -r id _ desc perf status; do
83
83
  case "$status" in
84
84
  "complete" | "completed")
85
85
  ((completed++))
86
- # Only count performance for completed runs
86
+ # Only count performance for completed runs with non-zero values
87
87
  if [[ -n $perf && $perf != "" ]]; then
88
- total_performance=$(echo "$total_performance + $perf" | bc -l 2>/dev/null || echo "$total_performance")
89
- ((count_with_performance++))
90
-
91
- # Check if this is the top performer
92
- if [[ -z $top_score ]] || (($(echo "$perf > $top_score" | bc -l 2>/dev/null || echo "0"))); then
93
- top_score="$perf"
94
- top_id="$id"
95
- top_desc="$desc"
88
+ # Skip zeros (they're errors)
89
+ if (( $(echo "$perf > 0" | bc -l 2>/dev/null || echo "0") )); then
90
+ total_performance=$(echo "$total_performance + $perf" | bc -l 2>/dev/null || echo "$total_performance")
91
+ ((count_with_performance++))
92
+
93
+ # Check if this is the top performer
94
+ if [[ -z $top_score ]] || (($(echo "$perf > $top_score" | bc -l 2>/dev/null || echo "0"))); then
95
+ top_score="$perf"
96
+ top_id="$id"
97
+ top_desc="$desc"
98
+ fi
96
99
  fi
97
100
  fi
98
101
  ;;
@@ -129,7 +132,10 @@ fi
129
132
  # Generation analysis
130
133
  echo
131
134
  echo "=== Generation Analysis ==="
132
- declare -A gen_count gen_sum gen_completed
135
+
136
+ # Create temporary file for generation stats
137
+ gen_stats_file="/tmp/evolution_gen_stats_$$.tmp"
138
+ >"$gen_stats_file"
133
139
 
134
140
  while IFS=, read -r id _ desc perf status; do
135
141
  [[ $id == "id" ]] && continue # Skip header
@@ -142,75 +148,103 @@ while IFS=, read -r id _ desc perf status; do
142
148
  gen="gen00" # Mark old numeric IDs as gen00
143
149
  fi
144
150
 
145
- # Track generation stats
146
- : ${gen_count[$gen]:=0}
147
- ((gen_count[$gen]++))
148
-
151
+ # Write generation data to temp file
152
+ echo -n "$gen " >> "$gen_stats_file"
149
153
  if [[ $status =~ ^(complete|completed)$ && -n $perf && $perf != "" ]]; then
150
- : ${gen_completed[$gen]:=0}
151
- : ${gen_sum[$gen]:=0}
152
- ((gen_completed[$gen]++))
153
- gen_sum[$gen]=$(echo "${gen_sum[$gen]} + $perf" | bc -l 2>/dev/null || echo "${gen_sum[$gen]}")
154
+ # Exclude zeros from statistics (they're errors)
155
+ if (( $(echo "$perf > 0" | bc -l 2>/dev/null || echo "0") )); then
156
+ echo "completed $perf" >> "$gen_stats_file"
157
+ else
158
+ echo "error" >> "$gen_stats_file"
159
+ fi
160
+ else
161
+ echo "incomplete" >> "$gen_stats_file"
154
162
  fi
155
163
  done <"$csv_file"
156
164
 
157
- # Display generation stats
158
- for gen in $(printf '%s\n' "${!gen_count[@]}" | sort); do
159
- total_in_gen=${gen_count[$gen]}
160
- completed_in_gen=${gen_completed[$gen]:-0}
165
+ # Process generation stats
166
+ for gen in $(cut -d' ' -f1 "$gen_stats_file" | sort -u); do
167
+ total_in_gen=$(grep -c "^$gen " "$gen_stats_file")
168
+ completed_in_gen=$(grep -c "^$gen completed" "$gen_stats_file")
161
169
 
162
170
  echo -n "$gen: $total_in_gen candidates"
163
171
 
164
172
  if [[ $completed_in_gen -gt 0 ]]; then
165
- avg=$(echo "scale=4; ${gen_sum[$gen]} / $completed_in_gen" | bc -l 2>/dev/null || echo "0")
173
+ # Calculate average performance for this generation
174
+ sum=$(grep "^$gen completed" "$gen_stats_file" | awk '{s+=$3} END {print s}')
175
+ avg=$(echo "scale=4; $sum / $completed_in_gen" | bc -l 2>/dev/null || echo "0")
166
176
  echo " ($completed_in_gen completed, avg: $avg)"
167
177
  else
168
178
  echo " (0 completed)"
169
179
  fi
170
180
  done
171
181
 
182
+ rm -f "$gen_stats_file"
183
+
172
184
  # Simple chart generation using gnuplot if available
173
185
  if command -v gnuplot >/dev/null 2>&1 && [[ $count_with_performance -gt 0 ]]; then
174
186
  echo
175
187
  echo "Generating performance chart: $output_file"
176
188
 
177
- # Create data file for gnuplot with row numbers
189
+ # Create data file for gnuplot with row numbers, excluding zeros
178
190
  data_file="/tmp/evolution_data_$$.dat"
179
- echo "# Row ID Performance Generation" >"$data_file"
191
+ winner_file="/tmp/evolution_winner_$$.dat"
192
+ echo "# Row ID Performance" >"$data_file"
180
193
 
181
194
  row_num=0
195
+ max_perf=0
196
+ max_row=0
197
+ max_id=""
198
+
182
199
  while IFS=, read -r id _ desc perf status; do
183
200
  [[ $id == "id" ]] && continue # Skip header
184
201
  ((row_num++))
202
+
203
+ # Only include completed algorithms with non-zero performance
185
204
  if [[ -n $perf && $perf != "" && $status =~ ^(complete|completed)$ ]]; then
186
- # Extract generation number for coloring
187
- gen_num=0
188
- if [[ $id =~ ^gen([0-9]+)- ]]; then
189
- gen_num=$((10#${BASH_REMATCH[1]}))
205
+ # Skip zero values (they're errors)
206
+ if (( $(echo "$perf > 0" | bc -l) )); then
207
+ echo "$row_num \"$id\" $perf" >>"$data_file"
208
+
209
+ # Track the winner
210
+ if (( $(echo "$perf > $max_perf" | bc -l) )); then
211
+ max_perf=$perf
212
+ max_row=$row_num
213
+ max_id=$id
214
+ fi
190
215
  fi
191
- echo "$row_num \"$id\" $perf $gen_num" >>"$data_file"
192
216
  fi
193
217
  done <"$csv_file"
194
218
 
219
+ # Create winner data point
220
+ if [[ -n $max_id ]]; then
221
+ echo "$max_row \"$max_id\" $max_perf" >"$winner_file"
222
+ fi
223
+
195
224
  # Generate plot
196
225
  gnuplot <<EOF
197
226
  set terminal png size 1000,600
198
227
  set output "$output_file"
199
228
  set title "Algorithm Evolution Performance"
200
- set xlabel "Evolution Order"
229
+ set xlabel "Evolution Run"
201
230
  set ylabel "Performance Score"
202
231
  set grid
203
- set key outside right
232
+ set key off
233
+
234
+ # Set y-axis range with some padding
235
+ stats "$data_file" using 3 nooutput
236
+ set yrange [STATS_min*0.95:STATS_max*1.05]
204
237
 
205
- # Define color palette for generations
206
- set palette defined (0 "dark-red", 1 "red", 2 "orange", 3 "yellow", 4 "green", 5 "blue", 6 "violet")
238
+ # Plot the main line in dark blue, winner as large blue circle
239
+ plot "$data_file" using 1:3 with lines linewidth 2 linecolor rgb "#1f77b4" notitle, \
240
+ "$data_file" using 1:3 with points pointtype 7 pointsize 0.5 linecolor rgb "#1f77b4" notitle, \
241
+ "$winner_file" using 1:3 with points pointtype 7 pointsize 3 linecolor rgb "#0000ff" notitle
207
242
 
208
- # Main plot with lines and points colored by generation
209
- plot "$data_file" using 1:3:4 with linespoints palette title "Performance", \
210
- "$data_file" using 1:3:(sprintf("%g", \$3)) with labels offset 0,0.5 notitle
243
+ # Add label with winner info at bottom
244
+ set label 1 "Best: $max_id (Score: $max_perf)" at graph 0.5, -0.15 center font ",10"
211
245
  EOF
212
246
 
213
- rm -f "$data_file"
247
+ rm -f "$data_file" "$winner_file"
214
248
  echo "Chart saved to: $output_file"
215
249
 
216
250
  # Always try to open chart (not just when --open is used)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.2.6",
3
+ "version": "1.2.9",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",