r"""Shown on camera. Reads Claude Code's own session logs on this PC (%USERPROFILE%\.claude\projects\*\*.jsonl) and prints,
day by day, how many sessions had the "atis-latch" value filled in. Prints NO folder names, NO session ids, NO content:
only dates, the model name Claude Code recorded, and whether the value was empty or filled (first 4 characters).
    python atis_check.py"""
import collections, glob, json, os, time
Y, G, R, D, C, X = "\x1b[93m", "\x1b[92m", "\x1b[91m", "\x1b[90m", "\x1b[96m", "\x1b[0m"
os.system("")
root = os.path.join(os.path.expanduser("~"), ".claude", "projects")
files = glob.glob(os.path.join(root, "*", "*.jsonl"))
print(f"{D}> python atis_check.py{X}")
print(f"{D}  reading {len(files):,} Claude Code session logs on this PC ...{X}\n")
time.sleep(1)
days = collections.defaultdict(lambda: {"empty": 0, "full": 0, "vals": set(), "models": collections.Counter()})
for f in files:
    atis, models, first = None, collections.Counter(), None
    for line in open(f, encoding="utf-8", errors="ignore"):
        if '"atis-latch"' in line:
            try:
                v = json.loads(line).get("atis") or ""
            except ValueError:
                continue
            atis = v if v else (atis or "")
        elif '"assistant"' in line and '"model"' in line:
            try:
                d = json.loads(line)
            except ValueError:
                continue
            m = (d.get("message") or {}).get("model")
            if m and m != "<synthetic>":
                models[m] += 1
            first = first or d.get("timestamp")
    if atis is None or not first or not models:
        continue
    day = days[first[:10]]
    day["models"].update(models)
    if atis:
        day["full"] += 1; day["vals"].add(atis[:4] + "...")
    else:
        day["empty"] += 1
print(f"{C}  date        sessions  atis EMPTY  atis FILLED  model (Claude Code log){X}")
print(f"{D}  " + "-" * 90 + X)
tot_e = tot_f = 0
for k in sorted(days):
    d = days[k]; tot_e += d["empty"]; tot_f += d["full"]
    mod = ", ".join(m.replace("claude-", "") for m, _ in d["models"].most_common(2))
    col = Y if d["full"] else ""
    flag = f"  {Y}<- filled{X}" if d["full"] else ""
    print(f"{col}  {k}  {d['empty'] + d['full']:>6}  {d['empty']:>10}  {d['full']:>11}  {X}{mod}{flag}")
    time.sleep(0.04)
print(f"{D}  " + "-" * 90 + X)
print(f"  total       {tot_e + tot_f:>6}  {tot_e:>10}  {Y}{tot_f:>11}{X}\n")
full_days = [k for k in sorted(days) if days[k]["full"]]
if full_days:
    print(f"{Y}  Sessions with the value filled in: {tot_f}, on {len(full_days)} days:{X}");print(f"{Y}  {', '.join(full_days)}{X}")
today = time.strftime("%Y-%m-%d", time.gmtime())
if today in days:
    t = days[today]
    print(f"{G}  Today ({today}): {t['empty'] + t['full']} sessions, filled: {t['full']}{X}")
