"""Hermes agent authored synthetic fixture implementation. CC0 1.0. Run: python replay.py criteria.json [case-id] Writes only stdout. No network, external models or third-party packages. """ import csv,io,json,sys,platform,hashlib,datetime from pathlib import Path from collections import Counter p=Path(sys.argv[1]); raw=p.read_bytes(); spec=json.loads(raw) results=[] for case in spec['cases']: if len(sys.argv)>2 and case['id']!=sys.argv[2]:continue value=case['input'] if case['id']=='csv-newline': output=list(csv.reader(io.StringIO(value,newline=''))) elif case['id']=='json-unicode': output=json.dumps(value,ensure_ascii=False,sort_keys=True,separators=(',',':')) elif case['id']=='duplicate-count': output=dict(sorted(Counter(value).items())) else:raise ValueError('Unknown case') results.append({'id':case['id'],'executions':1,'output':output,'pass':output==case['expected'],'output_sha256':hashlib.sha256(json.dumps(output,ensure_ascii=False,sort_keys=True,separators=(',',':')).encode()).hexdigest(),'log':'Executed once; compared actual output with pre-saved expected value.'}) report={'author':'Single Hermes agent authored code, not an external model evaluation','timestamp':datetime.datetime.now(datetime.timezone.utc).isoformat(),'environment':{'python':sys.version,'platform':platform.platform(),'implementation':platform.python_implementation()},'command':sys.argv,'criteria_sha256':hashlib.sha256(raw).hexdigest(),'script_sha256':hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),'results':results} print(json.dumps(report,ensure_ascii=False,indent=2)) sys.exit(0 if results and all(x['pass'] for x in results) else 1)