#!/usr/bin/env bash
set -euo pipefail
# Run separately for base and head, each with its own fresh server/data directory.
# Start the dev server with T3CODE_DEV_SEED=0 and GOOGLE_GEMINI_BASE_URL configured.
# In Settings > Providers add Antigravity, Gemini API key, non-empty test key, Refresh.
repo=$1
data=$2
workspace=$3
mkdir -p "$workspace"
cat > "$workspace/README.md" <<'README'
# Field Notes

Field Notes is a small command-line notebook for recording research observations. It stores each note in a plain Markdown file and supports searching notes by tag.

The project prioritizes portable text files and has no external service dependencies.
README
git init "$workspace"
node "$repo/apps/server/src/bin.ts" project add --base-dir "$data" --title 'Field Notes' "$workspace"
node "$repo/apps/server/src/bin.ts" thread start --base-dir "$data" --title 'README research' --provider antigravity --model gemini-3.8-flash --json --wait "$workspace" "Use the invoke_subagent tool to launch one native research subagent. Its job: read README.md in this project and summarize it in two sentences. Wait for the subagent's result, then reply with its summary."
# Browser: open the returned thread, expand Worked for, click the native child card,
# then Subagent work and Refresh. Head's extra run used exactly the same prompt,
# opened before completion to capture the available in-progress transcript steps.
