#!/usr/bin/env bash # Stop the sx-loops tmux session. Prompts the claude sessions to exit cleanly # first (/exit in each window), then kills the tmux session after a grace # period. Loops stop immediately; in-progress iterations commit what they have. set -euo pipefail SESSION="sx-loops" if ! tmux has-session -t "$SESSION" 2>/dev/null; then echo "No sx-loops session running." exit 0 fi WINDOWS=$(tmux list-windows -t "$SESSION" -F '#W') for w in $WINDOWS; do tmux send-keys -t "$SESSION:$w" "/exit" C-m 2>/dev/null || true done echo "Sent /exit to all windows. Waiting 5s for clean shutdown..." sleep 5 tmux kill-session -t "$SESSION" echo "Killed sx-loops session."