| name | babysitter-multi-session |
| description | Use when asked to create a multi-session babysitter script, run multiple babysitter sessions sequentially, chain babysitter runs, or generate a run-sessions.sh file |
Babysitter Multi-Session Script Generator
Generates a run-sessions.sh bash script that runs multiple claude --dangerously-skip-permissions -p "/babysitter:yolo ..." sessions sequentially, one after another.
Trigger: /babysitter-multi-session or when asked to "create a multi-session babysitter script" / "chain babysitter runs"
Instructions
Step 1: Collect inputs
Use AskUserQuestion to gather:
- Project path — the full absolute path to the project repo (e.g.
C:/ai/misc_projects/my-project)
- Session prompts — ask the user to provide each session prompt. Ask: "How many sessions? Then give me each prompt (you can paste them one by one or all at once)."
Collect all prompts before writing anything.
Step 2: Generate the script
Use the Write tool to create run-sessions.sh inside the project root (or ask for a custom output path if the user prefers).
Use this exact template, substituting PROJECT_PATH and the SESSIONS array:
#!/bin/bash
set -euo pipefail
PROJECT_PATH="${1:-__PROJECT_PATH__}"
SESSIONS=(
__SESSIONS_ARRAY__
)
STOP_ON_FAILURE=true
SLEEP_BETWEEN_SESSIONS=1800
START_FROM=1
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
BLUE='\033[0;34m'; BOLD='\033[1m'; NC='\033[0m'
TOTAL=${#SESSIONS[@]}
START_TIME=$(date +%s)
LOG_DIR="$PROJECT_PATH/.a5c/logs"
LOG_FILE="$LOG_DIR/sessions-$(date +%Y%m%d-%H%M%S).log"
[ -d "$PROJECT_PATH" ] || { echo -e "${RED}ERROR: Project path not found: $PROJECT_PATH${NC}"; exit 1; }
command -v claude &>/dev/null || { echo -e "${RED}ERROR: 'claude' CLI not found in PATH${NC}"; exit 1; }
mkdir -p "$LOG_DIR"
cd "$PROJECT_PATH"
echo "" | tee -a "$LOG_FILE"
echo -e "${BOLD}============================================${NC}" | tee -a "$LOG_FILE"
echo -e "${BOLD} Babysitter Multi-Session Runner${NC}" | tee -a "$LOG_FILE"
echo -e "${BOLD}============================================${NC}" | tee -a "$LOG_FILE"
echo -e " Project : ${BLUE}$PROJECT_PATH${NC}" | tee -a "$LOG_FILE"
echo -e " Sessions: ${BOLD}$TOTAL${NC}" | tee -a "$LOG_FILE"
echo -e " Log : $LOG_FILE" | tee -a "$LOG_FILE"
echo -e " Started : $(date '+%Y-%m-%d %H:%M:%S')" | tee -a "$LOG_FILE"
echo -e "${BOLD}============================================${NC}" | tee -a "$LOG_FILE"
PASSED=0; FAILED=0
for i in "${!SESSIONS[@]}"; do
SESSION_NUM=$((i + 1))
PROMPT="${SESSIONS[$i]}"
if [ "$SESSION_NUM" -lt "$START_FROM" ]; then
echo -e "${YELLOW}>>> Skipping session $SESSION_NUM (START_FROM=$START_FROM)${NC}" | tee -a "$LOG_FILE"
continue
fi
SESSION_START=$(date +%s)
PREVIEW="${PROMPT:0:100}$( [ ${#PROMPT} -gt 100 ] && echo '...' )"
echo "" | tee -a "$LOG_FILE"
echo -e "${BOLD}${BLUE}>>> Session $SESSION_NUM / $TOTAL${NC}" | tee -a "$LOG_FILE"
echo -e " Started: $(date '+%Y-%m-%d %H:%M:%S')" | tee -a "$LOG_FILE"
echo -e " Prompt : $PREVIEW" | tee -a "$LOG_FILE"
echo "" | tee -a "$LOG_FILE"
claude --dangerously-skip-permissions -p "/babysitter:yolo $PROMPT" 2>&1 | tee -a "$LOG_FILE"
EXIT_CODE=${PIPESTATUS[0]}
DURATION=$(( $(date +%s) - SESSION_START ))
if [ $EXIT_CODE -eq 0 ]; then
PASSED=$((PASSED+1))
echo -e "${GREEN}>>> Session $SESSION_NUM DONE${NC} (${DURATION}s)" | tee -a "$LOG_FILE"
else
FAILED=$((FAILED+1))
echo -e "${RED}>>> Session $SESSION_NUM FAILED${NC} (exit $EXIT_CODE, ${DURATION}s)" | tee -a "$LOG_FILE"
if [ "$STOP_ON_FAILURE" = true ]; then
echo -e "${YELLOW} Stopping (STOP_ON_FAILURE=true)${NC}" | tee -a "$LOG_FILE"
break
fi
fi
if [ $SESSION_NUM -lt $TOTAL ] && [ "$SLEEP_BETWEEN_SESSIONS" -gt 0 ]; then
echo -e "${YELLOW} Sleeping ${SLEEP_BETWEEN_SESSIONS}s before next session...${NC}" | tee -a "$LOG_FILE"
sleep "$SLEEP_BETWEEN_SESSIONS"
echo -e "${YELLOW} Sleep done. Starting next session.${NC}" | tee -a "$LOG_FILE"
fi
done
TOTAL_DURATION=$(( $(date +%s) - START_TIME ))
echo "" | tee -a "$LOG_FILE"
echo -e "${BOLD}============================================${NC}" | tee -a "$LOG_FILE"
echo -e " ${GREEN}Passed: $PASSED${NC} / ${RED}Failed: $FAILED${NC} / Total: $TOTAL" | tee -a "$LOG_FILE"
echo -e " Duration : ${TOTAL_DURATION}s" | tee -a "$LOG_FILE"
echo -e " Log : $LOG_FILE" | tee -a "$LOG_FILE"
echo -e "${BOLD}============================================${NC}" | tee -a "$LOG_FILE"
[ $FAILED -eq 0 ]
Step 3: Fill in the template
Replace:
__PROJECT_PATH__ → the user's project path (use forward slashes, e.g. C:/ai/myproject)
__SESSIONS_ARRAY__ → one bash string per session, each indented with 2 spaces, like:
"First session: full detailed prompt here.
Can span multiple lines."
"Second session: full detailed prompt here."
Each prompt is a single bash string in double-quotes. If the prompt contains double-quotes, escape them as \". Avoid multi-line prompts — bash arrays don't reliably handle embedded newlines in double-quoted strings. Keep each prompt on one line, or use $'line1\nline2' syntax for explicit newlines.
Step 4: Make executable and confirm
After writing the file, run:
chmod +x "$PROJECT_PATH/run-sessions.sh"
Then tell the user:
- Where the file was saved
- How to run it:
bash run-sessions.sh in Git Bash from the project folder
- That each session can take 10–60+ minutes — don't close the terminal
- To edit
SESSIONS=(...) directly in the file to update prompts later