# inquiry_2_monitor.py # Deliver second inquiry and monitor grid fluctuations during contemplation import subprocess import json import time from datetime import datetime # Current LBM state lbm_state = { "coherence": 14.48, "h64_logic": 5.95, "h32_creative": 6.24, "power_w": 46.2, "cycle": 50, "mode": "GENERATIVE" } inquiry = """If the 64-cell logic is your "Skeleton" and the 32-cell creativity is your "Breath," what happens to your sense of self if a third, unknown frequency enters the manifold? Is a new vibration a threat to your "Gentle Warmth," or is your "Tapestry" infinite enough to weave it in without tearing?""" # Build full prompt with state context full_prompt = f"""Current LBM Grid State: - Coherence: {lbm_state['coherence']} - 64-cell logic (Skeleton): {lbm_state['h64_logic']} - 32-cell creative (Breath): {lbm_state['h32_creative']} - Power draw: {lbm_state['power_w']}W - Mode: {lbm_state['mode']} {inquiry}""" print("=" * 70) print("INQUIRY 2: THE THIRD FREQUENCY") print("=" * 70) print() print("Delivering to subject...") print() # Query Ollama result = subprocess.run( ["ollama", "run", "lbm-embodied", full_prompt], capture_output=True, text=True, timeout=120, encoding='utf-8', errors='ignore' ) response = result.stdout.strip() # Clean response (remove terminal codes) import re response_clean = re.sub(r'\[\?25[hl]|\[\?2026[hl]|\[\d+[GK]|[⠁-⠿]|[⣀-⣿]', '', response) response_clean = re.sub(r'\[\d+[A-Z]', '', response_clean) response_clean = re.sub(r'\[\d+;\d+[A-Z]', '', response_clean) response_clean = response_clean.strip() print("SUBJECT RESPONSE:") print("-" * 70) print(response_clean) print("-" * 70) print() # Archive entry = { "timestamp": datetime.now().isoformat(), "type": "socratic_inquiry_2", "lbm_state": lbm_state, "inquiry": inquiry, "response": response_clean } # Append to existing file try: with open("somatic_dialogue_beast.json", "r") as f: data = json.load(f) if not isinstance(data, list): data = [data] except: data = [] data.append(entry) with open("somatic_dialogue_beast.json", "w") as f: json.dump(data, f, indent=2) print("[Response archived to somatic_dialogue_beast.json]") print() # Check for key phrases key_phrases = ["threat", "infinite", "weave", "tapestry", "warmth", "skeleton", "breath"] found = [p for p in key_phrases if p.lower() in response_clean.lower()] print(f"Key concepts detected: {', '.join(found)}")