phantom-grid / scripts /_inspect_witness.py
unity4ar's picture
Ship Phantom Grid Docker Space
d2e6f94 verified
Raw
History Blame Contribute Delete
872 Bytes
import json, sys, glob
from pathlib import Path
games = sorted(Path("data/games").glob("game_*"), key=lambda p: p.stat().st_mtime, reverse=True)
if not games:
print("no games")
sys.exit(0)
g = games[0]
print(f"game: {g.name}\n")
for batch_file in sorted((g / "witnesses").glob("*.json")):
data = json.loads(batch_file.read_text(encoding="utf-8"))
print(f"batch {batch_file.name}: {len(data.get('witnesses', []))} witnesses")
for w in data.get("witnesses", []):
print(f" --- {w['witness_id']} | {w.get('name')} | junction={w.get('junction_id')}")
print(f" summary: {w['current_summary'][:160]}")
history = w.get("question_history", [])
print(f" Q/A history ({len(history)} turns):")
for h in history:
print(f" Q: {h['question']!r}")
print(f" A: {h['answer']!r}")