from pathlib import Path
import sys
mode=sys.argv[1]
assert mode in ('on-r2','off')
source=Path('/tmp/codex/ltb1021/2026-09-26_provider-scale_r01/analyze.py')
code=source.read_text().replace("ROOT=HERE/'attempt2'", "HERE=HERE/'"+mode+"'\nROOT=HERE\ndef save(name,data):\n    with (HERE/name).open('x') as f:json.dump(data,f,indent=2)")
exec(compile(code,str(source),'exec'))
