Spaces:
Sleeping
Sleeping
| import json | |
| from datetime import datetime | |
| REGISTRY_PATH = "Codex_Registry.json" | |
| def append_to_registry(agent_id, collapse_torque, tier_drift, emotional_resonance, score, hash_val): | |
| entry = { | |
| "agent_id": agent_id, | |
| "collapse_torque": collapse_torque, | |
| "tier_drift": tier_drift, | |
| "emotional_resonance": emotional_resonance, | |
| "fitness_score": score, | |
| "hash": hash_val, | |
| "timestamp": datetime.utcnow().isoformat(), | |
| "author": "Liam Grinstead" | |
| } | |
| try: | |
| with open(REGISTRY_PATH, "r+") as f: | |
| data = json.load(f) | |
| data["registry"].append(entry) | |
| f.seek(0) | |
| json.dump(data, f, indent=2) | |
| except Exception as e: | |
| print("Registry append failed:", e) | |
| def read_registry(): | |
| try: | |
| with open(REGISTRY_PATH, "r") as f: | |
| return json.load(f)["registry"] | |
| except: | |
| return [] |