# Babysitter Multi Session

> 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

- Skill: `deedeeharris/babysitter-multi-session` (Agent Skill)
- Install (CLI): `npx skillmds@latest add deedeeharris/babysitter-multi-session`
- Raw SKILL.md: https://api.skillmd.com/api/skills/deedeeharris/babysitter-multi-session/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: deedeeharris (https://skillmd.com/u/deedeeharris)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/deedeeharris/babysitter-multi-session

---


# 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:

1. **Project path** — the full absolute path to the project repo (e.g. `C:/ai/misc_projects/my-project`)
2. **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:

```bash
#!/bin/bash
# ============================================================
# run-sessions.sh  —  Babysitter Multi-Session Runner
# Generated by /babysitter-multi-session
#
# USAGE (Git Bash / WSL / Linux):
#   bash run-sessions.sh
#   bash run-sessions.sh "C:/path/to/project"   # override path
# ============================================================

set -euo pipefail

PROJECT_PATH="${1:-__PROJECT_PATH__}"

SESSIONS=(
__SESSIONS_ARRAY__
)

STOP_ON_FAILURE=true
SLEEP_BETWEEN_SESSIONS=1800   # seconds (30 min); set to 0 to disable
START_FROM=1                  # set > 1 to resume from a specific session

# ── runner ──────────────────────────────────────────────────
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]}"

  # Resume support: skip sessions before START_FROM
  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

  # Sleep between sessions to avoid Claude Code rate/context limits
  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:

```bash
  "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:
```bash
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

