"""Prepare isolated proof data before starting T3 (T3CODE_DEV_SEED=0).
Usage: python seed.py WORKTREE SCRATCH AUTHENTICATED_CLAUDE_SETTINGS
The settings source contains local credentials: never upload it or the homes.
Then add SCRATCH/secret-word with `t3 project add` and start a Haiku 5.5 thread:
Remember the secret word PELICAN. Reply only with OK.
In the web client choose Claude (symlink home), Haiku 5.5, then send:
What is the secret word? Reply with just the word.
Record that switch and turn; run extract-native-proof.py after completion.
"""
from pathlib import Path
import json
import shutil
import subprocess
import sys
work, scratch, auth = map(Path, sys.argv[1:])
home = scratch / 'claude-home'
home.mkdir(parents=True)
shutil.copyfile(auth, home / 'settings.json')
link = scratch / 'claude-link'
link.symlink_to(home.resolve(), target_is_directory=True)
project = scratch / 'secret-word'
project.mkdir(exist_ok=True)
subprocess.run(['git', 'init', str(project)], check=True)
settings = {'idleCompaction': 'onReturn', 'providerInstances': {'claudeAgent': {'driver': 'claudeAgent', 'config': {'homePath': str(home.resolve())}}, 'claudeAgent_claude_symlink_home': {'driver': 'claudeAgent', 'displayName': 'Claude (symlink home)', 'enabled': True, 'config': {'homePath': str(link.absolute())}}}}
state = work / '.t3/userdata'
state.mkdir(parents=True, exist_ok=True)
(state / 'settings.json').write_text(json.dumps(settings, indent=2))
