Files
arcattackandClaude Opus 4.8 f914fc040a context-system: complete migration -> CLAUDE.md is now a 160-line router (zero context lost)
Full migration of the 2236-line monolithic CLAUDE.md into the progressive-context
knowledge graph (per spark-lesson / expert-seed.md), so the deep RE knowledge loads
on-demand instead of every session.

ZERO CONTEXT LOST:
- docs/PROGRESS_LOG.md = the complete old CLAUDE.md, VERBATIM (byte-identical) -- the
  lossless safety net + the "full detail" quick-lookup fallback.
- 18 context/*.md topic files (1343 lines) digest every section (§1-3 -> project-overview,
  §4 -> content-archives, §5 -> asset-formats/bgf-format, §5a -> source-completeness,
  §5b/§8 -> wintesla-port, §7/§10 -> locomotion, §10a -> build-and-run, §10b ->
  reconstruction-method, §10c -> combat-damage + reconstruction-gotchas, §10d -> subsystems,
  render notes -> rendering, gauges -> gauges-hud, MP -> multiplayer, §9 -> open-questions).
- reference/glossary.yaml (53 terms). decomp-reference.md = the offsets/ClassIDs/addresses hub.

CLAUDE.md (160 lines) = router: identity, answer/reason protocols, quick-lookup table,
evidence tiers (T0 engine-truth / T1 decompiled+verified / T2 reconstructed+runtime /
T3 guarded / T4 hypothesis), conventions + DO-NOT (the systemic bug classes), structure.
Retains the load-bearing work directives (build recipe pointer, "keep current" mandate).

Knowledge graph validates CLEAN (scratchpad/checkctx.py -- all [[links]] + quick-lookup +
docs refs resolve; [[name]] -> topic file or glossary term). docs/*.md ledgers stay as the
detailed logs; context/*.md are the curated digests that route into them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 22:19:50 -05:00

25 lines
1.3 KiB
Python

import re, glob, os, yaml
sys_ids = set(os.path.basename(f)[:-3] for f in glob.glob('context/*.md'))
# glossary top-level keys = valid link targets too
try:
gl = yaml.safe_load(open('reference/glossary.yaml',encoding='utf-8'))
gloss_keys = set(gl.keys()) if isinstance(gl, dict) else set()
except Exception as e:
gloss_keys = set(re.findall(r'^([A-Za-z][A-Za-z0-9_-]*):', open('reference/glossary.yaml',encoding='utf-8').read(), re.M))
valid = sys_ids | gloss_keys
# template placeholders that are documentation, not real links:
IGNORE = {'other-topic','other-topic-a','other-topic-b','topic-id','name'}
print("topic ids:", len(sys_ids), "| glossary keys:", len(gloss_keys))
bad=0
for f in glob.glob('context/*.md') + ['CLAUDE.md']:
txt=open(f,encoding='utf-8',errors='replace').read()
for m in re.findall(r'\[\[([a-z0-9-]+)\]\]', txt):
if m not in valid and m not in IGNORE:
print(f" UNRESOLVED [[{m}]] in {f}"); bad+=1
cl=open('CLAUDE.md',encoding='utf-8',errors='replace').read()
for m in re.findall(r'`(context/[a-z0-9-]+\.md)`', cl):
if not os.path.exists(m): print(f" MISSING quick-lookup {m}"); bad+=1
for m in re.findall(r'`(docs/[A-Z0-9_]+\.md)`', cl):
if not os.path.exists(m): print(f" MISSING docs ref {m}"); bad+=1
print("RESULT:", "CLEAN" if bad==0 else f"{bad} unresolved")