#!/usr/bin/env bash
# Runs after the maven crawler finishes: classify, regenerate the master
# Brain note, summarise stats. Safe to call repeatedly.
set -euo pipefail

cd /root/aria

echo "=== classify ==="
python3 scripts/maven-classify.py 2>&1 | tail -30

echo
echo "=== build master note ==="
python3 scripts/maven-build-note.py 2>&1 | tail -5

echo
echo "=== stats ==="
raw_count=$(ls /root/aria/state/maven/lessons-raw/ | wc -l)
echo "raw NEXT_DATA snapshots: $raw_count"
echo "classified entries: $(wc -l < /root/aria/state/maven/lessons-classified.jsonl)"
echo "errors so far: $(wc -l < /root/aria/state/maven/errors.jsonl 2>/dev/null || echo 0)"
