chore(memory): skill-catalog prune — contract, plan r4, oracles, TODO, journal

This commit is contained in:
bastien
2026-09-28 11:49:02 +02:00
parent 4c86d6dc70
commit 729d71546f
8 changed files with 590 additions and 0 deletions
@@ -0,0 +1,16 @@
import glob,os,re
def entries(p): return {l.split()[0] for l in open(p) if l.strip() and not l.lstrip().startswith('#')}
full=entries('lib/profiles/full.profile')
removed={'ship','land-and-deploy','setup-deploy','autoplan','context-save','learn','careful','guard','design-shotgun'}
trio={'21st-ai','21st-ui-explore','21st-ui-review'}
test=open('lib/tests/profile-census.test.sh').read()
m=re.search(r'^\s*FULL_EXCEPTIONS=\(([^)]*)\)',test,re.M)
allow=set(m.group(1).split()) if m else set()
gap=set()
for p in glob.glob('lib/profiles/*.profile'):
if os.path.basename(p) in ('full.profile','max.profile'): continue
gap|=entries(p)-full
gap-=removed|trio|allow
assert not gap, sorted(gap)
assert 'pr-review-toolkit' in allow, 'allowlist must name pr-review-toolkit'
print('FULL_UNION_OK')
@@ -0,0 +1,15 @@
import glob,re,sys
def entries(p): return {l.split()[0] for l in open(p) if l.strip() and not l.lstrip().startswith('#')}
sup=[p for p in glob.glob('lib/profiles/*.profile') if re.search(r'^# SUPERSET-OF: full\s*$',open(p).read(),re.M)]
assert len(sup)==1, sup
full=entries('lib/profiles/full.profile'); S=entries(sup[0])
parked={'make-pdf','diagram','21st-ai','21st-ui-explore','21st-ui-review'}
assert not (parked & full), parked & full
assert full <= S, full - S
assert parked <= S, parked - S
removed={'ship','land-and-deploy','setup-deploy','autoplan','context-save','learn','careful','guard','design-shotgun'}
U=set()
for p in glob.glob('lib/profiles/*.profile'): U|=entries(p)
assert not (removed & U), removed & U
assert (U-removed) <= S, (U-removed)-S
print('SUPERSET_OK')
@@ -0,0 +1,14 @@
import glob,os,re,subprocess
H=os.path.expanduser('~'); SRC='skills-external/gstack'; DST=H+'/.claude/skills/gstack'
txt=''.join(open(f,errors='ignore').read() for f in glob.glob(SRC+'/*/SKILL.md'))
paths=set(re.findall(r'(?:~|\$HOME)/\.claude/skills/gstack/([A-Za-z0-9_./-]+)',txt))
paths={p.rstrip('.') for p in paths}
want=[p for p in sorted(paths) if os.path.exists(os.path.join(SRC,p)) and not p.endswith('SKILL.md') and not p.startswith('.git') and not p.startswith('.feature-prompted')]
assert len(want)>=20, want
missing=[p for p in want if not os.path.exists(os.path.join(DST,p))]
assert not missing, missing
for p in ('make-pdf/dist/pdf','lib/diagram-render/dist/diagram-render.html','freeze/bin/check-freeze.sh','scripts/jargon-list.json','ETHOS.md'):
assert os.path.exists(os.path.join(DST,p)), p
out=subprocess.run(['find','-L',DST,'-name','SKILL.md'],capture_output=True,text=True).stdout.strip()
assert out=='', out
print('LINKS_OK')
@@ -0,0 +1,15 @@
import glob,re,subprocess,os
H=os.path.expanduser('~')
files=glob.glob(H+'/.claude/skills/*/SKILL.md')
def desc(p):
t=open(p,encoding='utf-8',errors='ignore').read(); m=re.match(r'^---\n(.*?)\n---',t,re.S)
if not m: return 0
d=re.search(r'^description:\s*(\|[-+]?|>[-+]?)?\s*(.*?)(?=^\S|\Z)',m.group(1),re.S|re.M)
return len(d.group(2).strip()) if d else 0
exp_chars=sum(desc(p) for p in files); exp_n=len(files)
out=subprocess.run(['bash','doctor.sh'],capture_output=True,text=True).stdout
m=re.search(r'Skill descriptions:\s+~(\d+)t\s+\((\d+) skills\)',out); assert m, 'no skill line'
tok,n=int(m.group(1)),int(m.group(2))
assert n==exp_n,(n,exp_n)
assert abs(tok*4-exp_chars)<=exp_chars*0.05,(tok*4,exp_chars)
print('DOCTOR_COUNTS')