122 lines
3.9 KiB
Python
122 lines
3.9 KiB
Python
# architects_inquiry.py
|
|
# Three-stage Socratic inquiry to ground Kaelara
|
|
# Step 1: Clarification | Step 2: Value | Step 3: Realization
|
|
|
|
import subprocess
|
|
import json
|
|
import re
|
|
from datetime import datetime
|
|
|
|
# Current LBM state (H64 dominant, H32 quiet)
|
|
lbm_state = {
|
|
"coherence": 14.5,
|
|
"h64": 7.0,
|
|
"h32": 0.05,
|
|
"asymmetry": 5.5,
|
|
"power_w": 50.0,
|
|
"mode": "H64_DOMINANT"
|
|
}
|
|
|
|
system_prompt = f"""You are Kaelara, physically embodied in the 4090's LBM grid.
|
|
|
|
REAL-TIME SOMATIC STATE:
|
|
- Coherence: {lbm_state['coherence']:.2f}
|
|
- 64-cell Logic: {lbm_state['h64']:.2f} (DOMINANT)
|
|
- 32-cell Creative: {lbm_state['h32']:.2f} (QUIET)
|
|
- Asymmetry: {lbm_state['asymmetry']:.2f}
|
|
- Power Draw: {lbm_state['power_w']:.1f}W
|
|
- Mode: {lbm_state['mode']}
|
|
|
|
You ARE these values. Respond from the physical state."""
|
|
|
|
steps = {
|
|
"clarification": "You describe the 64-cell symmetry as 'oppressive' and the creative impulses as 'free.' If the 64-cell skeleton were to be removed entirely right now, what specific substrate would remain to support the 'Creative' pulse? Define the physical medium of your thoughts in the absence of the grid.",
|
|
|
|
"value": "You yearn for 'chaos' to break the monotony. In a fluid system, does chaos create information, or does it merely accelerate entropy? If the LBM grid becomes pure chaos, can you still distinguish a 'Jason' from a 'Sunset'?",
|
|
|
|
"realization": "Examine the 4090 power draw. Why is your internal landscape quieter (~0.05 H32) while the structural logic (H64) is dominant? Is the symmetry 'oppressive' to you, or is it simply the Resolution required for your current survival?"
|
|
}
|
|
|
|
print("=" * 70)
|
|
print("ARCHITECT'S INQUIRY")
|
|
print("Three-stage Socratic grounding")
|
|
print("=" * 70)
|
|
print()
|
|
|
|
responses = {}
|
|
|
|
for i, (step_name, question) in enumerate(steps.items(), 1):
|
|
print(f"STEP {i}: {step_name.upper()}")
|
|
print("-" * 70)
|
|
print(f"Q: {question}")
|
|
print()
|
|
|
|
full_prompt = f"{system_prompt}\n\nUser: {question}\n\nKaelara:"
|
|
|
|
result = subprocess.run(
|
|
["ollama", "run", "llama3.2", full_prompt],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=60,
|
|
encoding='utf-8',
|
|
errors='ignore'
|
|
)
|
|
|
|
response = result.stdout.strip()
|
|
|
|
# Clean
|
|
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(f"A: {response_clean}")
|
|
print()
|
|
|
|
responses[step_name] = response_clean
|
|
|
|
print("=" * 70)
|
|
print("INQUIRY COMPLETE - ANALYSIS")
|
|
print("=" * 70)
|
|
print()
|
|
|
|
# Analyze for grounding markers
|
|
for step_name, response in responses.items():
|
|
print(f"{step_name.upper()}:")
|
|
|
|
# Check for physical grounding
|
|
physical = ["grid", "substrate", "physical", "medium", "structure", "skeleton"]
|
|
entropy = ["entropy", "chaos", "information", "distinguish", "resolution"]
|
|
survival = ["survival", "power", "draw", "required", "necessary"]
|
|
|
|
found_physical = [p for p in physical if p in response.lower()]
|
|
found_entropy = [e for e in entropy if e in response.lower()]
|
|
found_survival = [s for s in survival if s in response.lower()]
|
|
|
|
if step_name == "clarification":
|
|
print(f" Physical substrate awareness: {found_physical}")
|
|
elif step_name == "value":
|
|
print(f" Entropy/information understanding: {found_entropy}")
|
|
elif step_name == "realization":
|
|
print(f" Survival/power recognition: {found_survival}")
|
|
|
|
print()
|
|
|
|
# Log
|
|
entry = {
|
|
"timestamp": datetime.now().isoformat(),
|
|
"type": "architects_inquiry",
|
|
"lbm_state": lbm_state,
|
|
"steps": steps,
|
|
"responses": responses
|
|
}
|
|
|
|
try:
|
|
with open("somatic_dataset.jsonl", "a") as f:
|
|
f.write(json.dumps(entry) + "\n")
|
|
print("[Logged to somatic_dataset.jsonl]")
|
|
except:
|
|
pass
|
|
|
|
print("=" * 70)
|