-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmythtech_validate.py
More file actions
58 lines (48 loc) · 1.83 KB
/
mythtech_validate.py
File metadata and controls
58 lines (48 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import json
import os
import sys
import re
MEMORY_FILE = "memgpt_memory.json"
def load_memory():
with open(MEMORY_FILE, "r") as f:
return json.load(f)
def load_chapter(chapter_file):
if not os.path.exists(chapter_file):
print(f"[ERROR] Chapter file '{chapter_file}' not found.")
sys.exit(1)
with open(chapter_file, "r") as f:
return f.read()
def check_characters(memory, chapter_text):
print("\n[CHECK] Characters mentioned:")
for name in memory["characters"].keys():
if name.lower() in chapter_text.lower():
print(f"✓ {name}")
else:
print(f"⚠️ {name} not found in text.")
def check_constants(memory, chapter_text):
print("\n[CHECK] Constants alignment:")
for const in memory["constants"]:
if any(word.lower() in chapter_text.lower() for word in const.split()):
print(f"✓ {const}")
else:
print(f"❓ May be missing: {const[:60]}...")
def check_retcons(memory, chapter_text):
print("\n[CHECK] Retcon risks:")
for topic, versions in memory["retcons"].items():
found_versions = [v for v in versions if v.lower() in chapter_text.lower()]
if len(found_versions) > 1:
print(f"⚠️ Conflicting info for {topic}: {found_versions}")
elif len(found_versions) == 1:
print(f"✓ Using: {found_versions[0]}")
else:
print(f"❓ No reference to {topic} found.")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python3 memgpt_validate.py <chapter_filename.md>")
sys.exit(1)
memory = load_memory()
chapter_text = load_chapter(sys.argv[1])
print("\n=== MEMGPT CANON VALIDATOR ===")
check_characters(memory, chapter_text)
check_constants(memory, chapter_text)
check_retcons(memory, chapter_text)