app
AI Flow: Reverse Engineering
Public Made by Adomby adom
Photos of a PCB to a tagged KiCad copy: parts placed, copper and nets with their evidence, a schematic, a measured confidence score, bench tests and a video of the run.
main
Caleb
Version 0.3.0: new copper reader, dome via filter, every layer read from the photos, net evidence, measured confidence;…
e874d7d
import json,glob,datetime as D
base='/home/adom/.claude/projects/-home-adom-project/';sid='47f679b4-ba3d-457c-819e-82d704887415';f=base+sid+'.jsonl';start='2026-11-03T20:34:05'
P=lambda s:D.datetime.fromisoformat(s.replace('Z','+00:00'))
def tally(fp):
seen={};t=[]
for l in open(fp,errors='ignore'):
try:d=json.loads(l)
except:continue
ts=d.get('timestamp')
if not ts or ts<start:continue
t.append(ts);m=d.get('message') if isinstance(d.get('message'),dict) else None
if m and m.get('usage') and m.get('role')=='assistant':seen[m.get('id') or d.get('uuid')]=m['usage']
return seen,t
tot=dict(i=0,cr=0,cw=0,o=0,n=0);ag=0;alls=[]
for fp in [f]+glob.glob(base+sid+'/subagents/*.jsonl'):
s,t=tally(fp)
if fp==f:alls=sorted(t)
elif s:ag+=1
for u in s.values():
tot['i']+=u.get('input_tokens',0);tot['cr']+=u.get('cache_read_input_tokens',0);tot['cw']+=u.get('cache_creation_input_tokens',0);tot['o']+=u.get('output_tokens',0);tot['n']+=1
act=sum(g for a,b in zip(alls,alls[1:]) if (g:=(P(b)-P(a)).total_seconds())<900)
clock=(P(alls[-1])-P(alls[0])).total_seconds()
out=dict(active=f'{act/3600:.1f} h',clock=f'{clock/3600:.0f} h',output=f"{tot['o']/1e6:.2f} M",cread=f"{tot['cr']/1e6:.0f} M",cwrite=f"{tot['cw']/1e6:.1f} M",calls=f"{tot['n']:,}",agents=ag,raw=tot,at=alls[-1],activeH=act/3600)
json.dump(out,open('cost.json','w'),indent=1);print(out)