#!/usr/bin/env bash
set -eu
# Run from either checkout. Arguments: isolated Claude config, sample workspace,
# and an available Claude model with a 1M context window.
config_dir=$1
sample_dir=$2
selected_model=$3
mkdir -p "$config_dir" "$sample_dir"
# Configure existing provider credentials separately; this script contains none.
python3 - "$config_dir/settings.json" <<'PY'
import json,pathlib,sys
p=pathlib.Path(sys.argv[1]);d=json.loads(p.read_text()) if p.exists() else {}
d.setdefault('env',{})['CLAUDE_CODE_AUTO_COMPACT_WINDOW']='300000'
p.write_text(json.dumps(d));p.chmod(0o600)
PY
# Start with T3CODE_DEV_SEED=0 CLAUDE_CONFIG_DIR="$config_dir" vp run dev.
# Enable Claude in Settings > Providers; leave Auto-compact after empty.
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Context example' "$sample_dir"
node apps/server/src/bin.ts thread start --base-dir .t3 --provider claudeAgent --model "$selected_model" --title 'Context check' --wait "$sample_dir" 'Reply only OK.'
# Open the resulting thread in the real web client, light theme, 1280x800.
# Hide Environment and worktree in Thread details for privacy.
# Run capture-driver.js through the preview tools on each side.
# Compare the two stills with ImageMagick compare -metric AE (must return zero).
# Crop captures to the upper 80 percent to exclude private model identifiers.
