diff --git a/bin/start.sh b/bin/start.sh index 3558024..7e70660 100755 --- a/bin/start.sh +++ b/bin/start.sh @@ -38,24 +38,34 @@ cmd_start() { tmux send-keys -t "${SESSION}:overview.right" \ "watch -n10 python3 '${SCRIPT_DIR}/metrics.py'" Enter - # One window per project + # Pass 1: create all project windows and start claude local win=1 + local windows=() while IFS= read -r project_path; do local project_name project_name=$(basename "$project_path") + local safe_path + safe_path=$(printf '%q' "$project_path") tmux new-window -t "${SESSION}:${win}" -n "$project_name" - # Start claude in the project directory tmux send-keys -t "${SESSION}:${win}" \ - "cd '${project_path}' && claude --name 'autoresearch-${project_name}'" Enter - # Wait for claude to initialize, then invoke the loop skill - sleep 3 - tmux send-keys -t "${SESSION}:${win}" \ - "/ralph-loop Run one autoresearch experiment iteration per the autoresearch-loop skill. --completion-promise STOP" Enter + "cd ${safe_path} && claude --name autoresearch-${project_name}" Enter + windows+=("${win}:${project_name}") win=$((win + 1)) done < <(get_projects) - tmux select-window -t "${SESSION}:0" + # Single sleep for all sessions to initialize local project_count=$(( win - 1 )) + if [[ $project_count -gt 0 ]]; then + sleep 3 + # Pass 2: invoke ralph-loop in all project windows + for entry in "${windows[@]}"; do + local win_id="${entry%%:*}" + tmux send-keys -t "${SESSION}:${win_id}" \ + "/ralph-loop Run one autoresearch experiment iteration per the autoresearch-loop skill. --completion-promise STOP" Enter + done + fi + + tmux select-window -t "${SESSION}:0" echo "autoresearch: started — ${project_count} project window(s)" echo " attach: tmux attach -t $SESSION" }