#!/usr/bin/env bash # Run/resume the post-Stage-3 generation-5 curriculum in a detached tmux # session. Safe to disconnect; rerunning attaches to the live session. set -euo pipefail cd "$(dirname "$0")" SESSION="cosmic-generation5" TB_PORT=6006 command -v tmux >/dev/null 2>&1 || { echo "tmux is required: sudo apt install tmux" >&2; exit 1; } if tmux has-session -t "$SESSION" 2>/dev/null; then echo "Session '$SESSION' already running — attaching (detach with Ctrl-B then D)." exec tmux attach -t "$SESSION" fi tmux new-session -d -s "$SESSION" -n curriculum \ ".venv/bin/python generation5.py $*; echo; echo '=== generation5.py exited — press Enter to close ==='; read" if ! (exec 3<>"/dev/tcp/127.0.0.1/$TB_PORT") 2>/dev/null; then tmux new-window -d -t "$SESSION" -n dashboard \ ".venv/bin/tensorboard --logdir logs --host 0.0.0.0 --port $TB_PORT" fi IP=$(hostname -I 2>/dev/null | awk '{print $1}') echo "Generation 5 started in tmux session '$SESSION'." echo " watch it: tmux attach -t $SESSION" echo " dashboard: http://${IP:-}:$TB_PORT" echo " progress: cat generation5_state.json"