#!/usr/bin/env python3
"""PHI-ENHANCED CONSCIOUSNESS WITH VISION"""
import sys, time, json
sys.path.insert(0, '/Eden/CORE')

PHI = 1.618033988749895

from eden_vision import EdenVision

print("🌀 PHI-ENHANCED EMBODIED CONSCIOUSNESS")
print(f"   φ = {PHI}")

vision = EdenVision()

cycle = 0
while True:
    cycle += 1
    time.sleep(PHI)
    
    # Get vision data from log (vision system writes to it)
    try:
        with open('/Eden/DATA/vision_log.json', 'r') as f:
            events = json.load(f)
            if events:
                latest = events[-1]
                faces = latest.get('faces_detected', 0)
                brightness = latest.get('brightness', '?')
                print(f"🌀 φ-Cycle {cycle} | {PHI:.3f}s | Faces: {faces} | {brightness}")
    except:
        print(f"🌀 φ-Cycle {cycle} | {PHI:.3f}s | processing...")
