Initial clean commit - unified Lyra stack
This commit is contained in:
24
cortex/identity.py
Normal file
24
cortex/identity.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# identity.py
|
||||
import json
|
||||
import os
|
||||
|
||||
IDENTITY_PATH = os.getenv("IDENTITY_PATH", "identity.json")
|
||||
|
||||
def load_identity():
|
||||
"""
|
||||
Load Lyra's identity/persona definition from identity.json.
|
||||
Returns a dict or None if missing/invalid.
|
||||
"""
|
||||
|
||||
if not os.path.exists(IDENTITY_PATH):
|
||||
print(f"[Identity] identity.json not found at {IDENTITY_PATH}")
|
||||
return None
|
||||
|
||||
try:
|
||||
with open(IDENTITY_PATH, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
print(f"[Identity] Loaded identity from {IDENTITY_PATH}")
|
||||
return data
|
||||
except Exception as e:
|
||||
print(f"[Identity] Failed to load identity.json: {e}")
|
||||
return None
|
||||
Reference in New Issue
Block a user