#!/usr/bin/env bash
set -eu
# Run separately in each installed commit worktree. Use fresh isolated state.
# CODEX_HOME must contain working provider credentials and the metalog MCP config.
# Configure metalog: python3 metalog.py <output-jsonl>.
# Start the app first: T3CODE_DEV_SEED=0 CODEX_HOME=<scratch> vp run dev
project="$1"
node apps/server/src/bin.ts project add --base-dir .t3 --title 'MCP metadata proof' "$project"
node apps/server/src/bin.ts thread start --base-dir .t3 --provider codex --model gpt-6-astra --title 'MCP metadata reproduction' --json "$project" 'Call metalog record_marker with marker parent. Then use orchestrator_capabilities and delegate_task to start exactly one Codex child using gpt-6-astra. Tell that child to call metalog record_marker with marker child and return the full tool result. Use T3 delegate_task, not native spawn_agent. Wait as the tool directs. Finally show a table with marker, thread_source (absent if the key is missing), native thread_id, model, codex_version from both results. Do no file work.'
# Pair the web client and open the returned thread. Keep the MCP JSONL output.
