"""Run with: python3 seed.py <checkout> <scratch-project>.
Start that checkout first with T3CODE_DEV_SEED=0 vp run dev.
Then pass the returned thread ID to driver.py. Begin capture after Claude says
started and thread show reports no activeRunId plus a pending background task.
Use a fresh checkout/data directory for each commit.
"""
from pathlib import Path
import subprocess,sys,json
checkout,folder=sys.argv[1:]
p=Path(folder).resolve(); (p/'vendor/foo').mkdir(parents=True,exist_ok=True)
for repo in [p,p/'vendor/foo']:
 subprocess.run(['git','init','-q',str(repo)],check=True)
 (repo/'README.md').write_text('Synthetic repository for background-work reproduction.\n')
 subprocess.run(['git','-C',str(repo),'add','README.md'],check=True)
 subprocess.run(['git','-C',str(repo),'-c','user.name=Evidence','-c','user.email=evidence@example.invalid','commit','-qm','Initial'],check=True)
def cli(args):
 return subprocess.check_output(['node','apps/server/src/bin.ts',*args,'--base-dir','.t3'],cwd=checkout,text=True)
print(cli(['project','add','--title','Repository change proof',str(p)]))
print(cli(['thread','start','--provider','claudeAgent','--model','claude-haiku-5-5','--title','Background work repository proof','--json',str(p),'Use the Bash tool with run_in_background set to true to run sleep 900. Do not wait for it or stop it. Reply with the word started and end your turn.']))
