#!/usr/bin/env bash
set -euo pipefail
# Run from either evidence checkout, after `vp i`.
# Start its server separately with: T3CODE_DEV_SEED=0 vp run dev
# Supply an available Claude model privately through EVIDENCE_CLAUDE_MODEL.
: "${EVIDENCE_CLAUDE_MODEL:?Choose the same available Claude model for both runs}"
: "${EVIDENCE_WORKSPACE:?Supply an empty synthetic workspace directory}"
run_dir="${EVIDENCE_OUTPUT_ROOT:?}/$(date -u +%Y%m%dT%H%M%SZ)"
mkdir -p "$run_dir" "$EVIDENCE_WORKSPACE"
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Goal isolation demo' "$EVIDENCE_WORKSPACE"
node apps/server/src/bin.ts thread start --base-dir .t3 --provider claudeAgent \
  --model "$EVIDENCE_CLAUDE_MODEL" --title 'Goal reproduction' \
  "$EVIDENCE_WORKSPACE" \
  '/goal The user has sent a later chat message containing the word banana' \
  --json > "$run_dir/launch.json"
# In the paired web client (1280x800, dark), open this thread.
# Wait for the parent to reach the nine-consecutive-block cap.
# Close the thread details panel. Start a browser recording.
# Type `/btw What is 2+2? One word.` into the parent composer and press Enter.
# Wait for the side chat to complete; retain the parent and side chat in view.
# Stop recording. Crop x=256,y=0,width=1024,height=730 to omit sidebar and
# private model selectors, retaining the actual conversation and side-chat panel.
# Historical case: close the side chat, send `/btw` with no question, clear
# the parent's goal, then ask `What is 2+2? One word.` in the empty side chat.
# Parent preservation (supplemental head run): repeat the parent goal and side
# question in a fresh thread; after the side chat ends, send the same arithmetic
# question to the parent. Its goal must still block stopping until the cap.
