Phase 4: The Cybernetic Nervous System & Thermodynamic Orchestration
This commit is contained in:
1 parent
4be0958758
commit
e5c6e17140
45 files changed
+4486
-742
No files matched your search
@@ -0,0 +1,68 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'becomingone')))
|
||||
|
||||
# The prompt asks for `from memory.temporal import KAIROS`
|
||||
# I will try to accommodate this by importing KAIROSTemporalEngine
|
||||
try:
|
||||
from becomingone.core.engine import KAIROSTemporalEngine as KAIROS, TemporalConfig
|
||||
except ImportError:
|
||||
from core.engine import KAIROSTemporalEngine as KAIROS, TemporalConfig
|
||||
|
||||
import numpy as np
|
||||
import datetime
|
||||
from datetime import timezone
|
||||
|
||||
def test_extreme_phase_drift_and_noise():
|
||||
print("Testing Temporal Engine for Coherence Collapse under Adversarial Conditions...")
|
||||
|
||||
# 1. Base conditions
|
||||
config = TemporalConfig(
|
||||
tau_scale=1.0,
|
||||
omega=2.0 * np.pi,
|
||||
coherence_threshold=0.95,
|
||||
history_size=10000,
|
||||
dampening=0.999,
|
||||
noise_std=0.005 # Baseline noise
|
||||
)
|
||||
engine = KAIROS(config=config, name="TestEngine-Baseline")
|
||||
|
||||
# Run baseline to ensure it works
|
||||
print("Running Baseline...")
|
||||
for i in range(50):
|
||||
engine.temporalize(f"baseline_token_{i}")
|
||||
|
||||
print(f"Baseline Coherence: {engine.coherence:.4f}, Collapsed: {engine.collapsed}")
|
||||
|
||||
# 2. Extreme conditions testing
|
||||
print("\nStarting Adversarial Noise and Phase Drift Tests...")
|
||||
noise_levels = [0.01, 0.05, 0.1, 0.5, 1.0, 5.0, 10.0]
|
||||
|
||||
for noise in noise_levels:
|
||||
config = TemporalConfig(
|
||||
tau_scale=0.1, # Fast tau
|
||||
omega=10.0 * np.pi, # High oscillation
|
||||
coherence_threshold=0.95,
|
||||
history_size=1000,
|
||||
noise_std=noise
|
||||
)
|
||||
engine = KAIROS(config=config, name=f"TestEngine-Noise-{noise}")
|
||||
|
||||
# Inject adversarial phase drift
|
||||
collapse_step = -1
|
||||
for i in range(200):
|
||||
# Adversarial token generator (random junk + phase shift)
|
||||
token = f"adv_token_{np.random.rand()}_{i * np.pi}"
|
||||
engine.temporalize(token)
|
||||
|
||||
# Since the engine uses token strings, we also modify phases directly if possible,
|
||||
# but temporalize already takes tokens and hashes them or uses the model.
|
||||
|
||||
if engine.collapsed and collapse_step == -1:
|
||||
collapse_step = i
|
||||
|
||||
print(f"Noise {noise:.3f} | Final Coherence: {engine.coherence:.4f} | Collapsed: {engine.collapsed} (at step {collapse_step})")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_extreme_phase_drift_and_noise()
|
||||
Reference in new issue
Block a user