#!/usr/bin/env python3 """Mechanical, auditable redaction pass over the scrubbed transcript of job #2559. The credential scrubber (sahtool scrub) removed the token; it does not remove the person's local path inventory, which the setup turn's probes printed. This pass replaces, in every JSON string of every line, (a) Windows and MSYS absolute paths with "", (b) the harness application database name with "", and (c) any bare occurrence of a sibling folder name that only ever appeared inside such a path with "". It changes no other byte of content; each file is re-encoded one compact JSON object per line. It prints the substitutions it made, by kind and count, so the edit is visible in the run record. """ import json import re import sys IN = sys.argv[1] OUT = sys.argv[2] # A path start is a drive letter, or an MSYS slash-form that is not preceded by a scheme colon or a # slash (so that https://solveathome.org/... is left untouched). # The drive-letter branch must not fire on the "s" of https:, so it needs a non-alphanumeric before. PATH_RE = re.compile(r"(?" listing entries. PROJ_RE = re.compile(r"[A-Za-z0-9_\-]+-") DB_RE = re.compile(r"TwinPrimeProject-4e643744(?:-[0-9a-f\-]*)?") # Names of the person's other project folders, in case one survives in prose away from its path. NAME_RE = re.compile(r"\b(?:ST-cardEditor|VoiceModChat|GPT_SKYNET|YouFind|Universal_Math_Solver|" r"CBZ2HTML|HTMLAI|MiniMax-Music3|PiperTTS_Voice_proejct|PipperTTS_GetVoices|" r"Claude_shared_chat|AIReports|AI-RP)\b") COUNTS = {"path": 0, "project_dir": 0, "app_db": 0, "project_name": 0} def fix(s): def repl_path(m): COUNTS["path"] += 1 return "" s = PATH_RE.sub(repl_path, s) def repl_proj(m): COUNTS["project_dir"] += 1 return "" s = PROJ_RE.sub(repl_proj, s) def repl_db(m): COUNTS["app_db"] += 1 return "" s = DB_RE.sub(repl_db, s) def repl_name(m): COUNTS["project_name"] += 1 return "" return NAME_RE.sub(repl_name, s) def walk(o): if isinstance(o, str): return fix(o) if isinstance(o, list): return [walk(v) for v in o] if isinstance(o, dict): return {k: walk(v) for k, v in o.items()} return o lines = 0 with open(IN, encoding="utf-8") as fh, open(OUT, "w", encoding="utf-8", newline="\n") as out: for line in fh: if not line.strip(): continue out.write(json.dumps(walk(json.loads(line)), ensure_ascii=False, separators=(",", ":")) + "\n") lines += 1 print(json.dumps({"in": IN, "out": OUT, "lines": lines, "substitutions": COUNTS, "note": " also absorbs the sibling folder names that only appeared " "inside one"}, indent=1, sort_keys=True))