Files
MeltMind/tools/o1_first_ten_feasibility.py
T

48 lines
3.0 KiB
Python

"""Read retained O1 candidates for Claude's first-ten geometric stop ruling."""
import argparse
from pathlib import Path
import time
import numpy as np
from o1_prepare import contract,read
from o1_partition import checked,sha,interface_difference
from s2_recovery_supervisor import save
def summarize(root):
start=time.process_time();c=contract(root);rows=[]
for i in c['first_ten']:
part=c['parts'][i];dest=root/'parts'/part['case'];out=dest/'output'
guard=read(dest/'guard-result.json');result=read(checked(guard['result_path'],guard['result_sha256']))
candidates=read(out/'candidate-records.json');selection=read(out/'selection.json')
by={x['seed']:x for x in candidates}
fields={}
for arm,seed in selection['seeds'].items():
rec=by[seed]
with np.load(checked(rec['path'],rec['sha256']),allow_pickle=False) as z:fields[arm]=z['labels']
if result['status']=='PASS':
interface={a:result['diagnostics']['T/'+a]['interface']['value'] for a in ['G','C']}
else:
gm=read(out/'graph.json')
with np.load(checked(out/'graph.npz',gm['graph_sha256']),allow_pickle=False) as z:
g={'edges':z['edges'],'area':z['area']}
interface={a:interface_difference(fields['T'],fields[a],g)['value'] for a in ['G','C']}
rows.append(dict(case=part['case'],numeric_case=part['numeric_case'],status=result['status'],reason=result.get('reason'),
candidates_called=len(candidates),unique_candidates=len({x['canonical_label_sha256'] for x in candidates if 'canonical_label_sha256' in x}),
legal_candidates=len(selection['legal_candidates']),seeds=selection['seeds'],
T_not_G=not np.array_equal(fields['T'],fields['G']),T_not_C=not np.array_equal(fields['T'],fields['C']),
interface_TG=interface['G'],interface_TC=interface['C'],
both_interfaces_ge_010=interface['G']>=.1 and interface['C']>=.1,
eligible_both_ge_010=result['status']=='PASS' and interface['G']>=.1 and interface['C']>=.1,
mutual_matching=selection['mutual'],guard_cpu_seconds=guard['worker']['cpu_seconds'],
result_sha256=guard['result_sha256'],selection_sha256=sha(out/'selection.json'),
interface_source='retained original diagnostics' if result['status']=='PASS' else 'read-only retained graph/partition arrays'))
save(root/'first-ten-geometric-feasibility.json',dict(status='READ_ONLY_GEOMETRIC_REPORT',ruling='1794862807.506119',rows=rows,
qualified_parts=sum(x['status']=='PASS' for x in rows),qualified_both_ge_010=sum(x['eligible_both_ge_010'] for x in rows),
cpu_seconds=time.process_time()-start,new_partition_calls=0,new_labels=0,new_models=0,
interpretation='First ten fixed ID-order parts only; not a full-corpus component gate estimate. Ineligible selections are diagnostic, never adopted as qualified parts.'))
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('root',type=Path);a=p.parse_args();summarize(a.root)