"""Preserve original trial evidence and exact gate capture without runtime binaries.""" from pathlib import Path import hashlib import json import shutil base = Path(__file__).resolve().parent root = Path('C:/ar-text-9e8r6t') dest = root / 'harness/experiments/text-workspace-initial-20260913' dest.mkdir() records = [] def keep(source, relative): target = dest / relative target.parent.mkdir(parents=True, exist_ok=True) assert not target.exists() shutil.copyfile(source, target) raw = source.read_bytes() assert target.read_bytes() == raw records.append({'path': relative, 'bytes': len(raw), 'sha256': hashlib.sha256(raw).hexdigest()}) trial = base / 'trial-text-1' for source in sorted(trial.rglob('*')): rel = source.relative_to(trial) if source.is_file() and (len(rel.parts) == 1 or rel.parts[0] == 'screenshots' or rel.parts[0].startswith('verification-')): keep(source, 'trial-text-1/' + rel.as_posix()) gate = root / '.local/text-workspace-gates-20260912' for attempt in ['attempt-3', 'attempt-4']: for source in sorted((gate / attempt).iterdir()): if source.is_file() and source.suffix in ['.json', '.log', '.zip']: keep(source, attempt + '/' + source.name) for name in ['fixture-manifest.json', 'launch.py', 'verify_saved.py', 'bind_gates.py']: keep(base / name, 'helpers/' + name) keep(gate / 'gate.py', 'helpers/gate.py') keep(Path(__file__), 'helpers/archive_initial.py') with (dest / 'manifest.json').open('x', encoding='utf-8', newline='\n') as stream: json.dump({'scope': 'Original failed native trial and passing attempt4 gates; runtime binaries remain locally preserved by SHA, no native acceptance.', 'files': records}, stream, indent=2) stream.write('\n') print(json.dumps({'directory': str(dest), 'files': len(records), 'bytes': sum(r['bytes'] for r in records), 'manifestSha256': hashlib.sha256((dest / 'manifest.json').read_bytes()).hexdigest()}))