Geometry constants, domain-specific use cases with working code, parameter reference, coherence interpretation, signal model equations, and provenance. For developers who want to understand the architecture, not just use it.
pip install livingcircuit
from livingcircuit import (
AdaptiveAmplitudeStabilizer,
adaptive_amplitude_stabilizer,
harmonic_vector_stabilizer,
SimpleVoiceToneAnalyzer,
stabilize_solar_output,
ImpedanceNetworkSimulator,
ImpedanceConfig,
impedance_network_simulator,
)
Five constants anchor the entire Living Circuit architecture. They aren't arbitrary — they express geometric relationships that produce stable, coherent behavior across signal, activation, latent, and output layers. Every module uses at least two of them.
K_DRAG = 0.007297 in the Solar Output Smoother and as the impedance seed in the scalar pipeline. Too little impedance and a system short-circuits; too much and it never resolves. This value sits naturally between those extremes.These modules work on any signal. Here's exactly how to apply them in seven domains — which modules to use, how to stack them, and working code for each.
The most common failure mode in production AI systems isn't wrong answers — it's instability under load. When multiple users hit a model simultaneously, activation spikes propagate through transformer blocks and degrade output quality before anything visibly breaks. The Amplitude Stabilizer catches these spikes at the layer level before they compound.
For long reasoning chains, the Harmonic Vector Stabilizer conditions the latent representation before each block sees it. This keeps the internal state coherent across many steps — without it, extended reasoning tends to drift as early context gets diluted by new token influence.
The Phase Reflection Agent sits above all of this as a health monitor. Run it alongside inference and watch the coherence value. A sustained drop below 0.5 over multiple cycles means something upstream is drifting — catch it before it reaches the user.
import torch
import numpy as np
# Full code at modules.html#amp and modules.html#harmonic
from livingcircuit import AdaptiveAmplitudeStabilizer, harmonic_vector_stabilizer
from phase_reflection_agent_v3 import PhaseReflectionAgent
# Transformer block with full stabilization stack
class StabilizedTransformerBlock(torch.nn.Module):
def __init__(self, dim, layer_idx=0):
super().__init__()
self.norm1 = torch.nn.LayerNorm(dim)
self.norm2 = torch.nn.LayerNorm(dim)
self.attn = torch.nn.MultiheadAttention(dim, num_heads=8, batch_first=True)
self.ffn = torch.nn.Sequential(
torch.nn.Linear(dim, dim * 4),
torch.nn.GELU(),
torch.nn.Linear(dim * 4, dim)
)
self.stab1 = AdaptiveAmplitudeStabilizer(dim, layer_idx=layer_idx)
self.stab2 = AdaptiveAmplitudeStabilizer(dim, layer_idx=layer_idx)
def forward(self, x):
# Harmonic conditioning on input
t = np.linspace(0, 4 * np.pi, x.shape[1])
h = harmonic_vector_stabilizer(t)
gain = float(h["quality_score"]) * 0.1 # subtle modulation
attn_out, _ = self.attn(self.norm1(x), self.norm1(x), self.norm1(x))
x = x + self.stab1(attn_out)
ffn_out = self.ffn(self.norm2(x))
x = x + self.stab2(ffn_out)
return x
# Health monitoring during inference
monitor = PhaseReflectionAgent(name="inference-monitor")
def monitored_inference(model, input_ids, cycle):
with torch.no_grad():
output = model(input_ids)
state = monitor.step(cycle)
if state.stability < 0.35:
print(f"Cycle {cycle}: stability low ({state.stability}) — check upstream")
return output, state
Audio pipelines are especially vulnerable to amplitude spikes — a sudden loud input can clip, distort, or destabilize everything downstream. The scalar Amplitude Stabilizer handles this without hard clipping, which introduces harmonic distortion. Instead it scales proportionally, preserving the signal's character while keeping it within range.
The Harmonic Vector Stabilizer works well as a pre-processing step before feature extraction. Run your audio frame through it and the quality_score tells you how coherent the harmonic content is — useful for deciding whether a frame is worth processing or should be treated as noise.
The Solar Output Smoother doubles as an envelope follower — feed it the amplitude of each audio frame and it smooths the envelope with carried state, removing tick-to-tick noise while preserving the envelope shape.
import numpy as np
from livingcircuit import (adaptive_amplitude_stabilizer,
harmonic_vector_stabilizer,
SimpleVoiceToneAnalyzer,
stabilize_solar_output)
def process_audio_frame(frame: np.ndarray, set_pt: float, memory: float):
"""
Full audio conditioning pipeline for a single frame.
frame : raw audio samples (float32 array)
set_pt : current amplitude set point (carry forward)
memory : smoother memory (carry forward)
"""
# 1. Tone analysis — is this frame calm, neutral, or intense?
analyzer = SimpleVoiceToneAnalyzer()
tone_info = analyzer.analyze(frame)
# 2. Amplitude stabilization — prevent spikes from clipping downstream
rms = float(np.sqrt(np.mean(frame ** 2)))
stabilized_rms, set_pt = adaptive_amplitude_stabilizer(
signal=rms, set_point=set_pt,
variance_limit=0.15, impedance=0.5,
learn_rate=0.03
)
# 3. Harmonic coherence check — is this frame worth processing?
t = np.linspace(0, 2 * np.pi, len(frame))
h = harmonic_vector_stabilizer(t * tone_info["intensity"])
coherence = h["quality_score"]
# 4. Envelope smoothing with carried state
smooth_rms, memory = stabilize_solar_output(
current_val=stabilized_rms,
previous_val=set_pt,
dt=1.0 / 44100 * len(frame),
memory=memory
)
return {
"tone": tone_info["tone"],
"intensity": tone_info["intensity"],
"coherence": coherence,
"rms": smooth_rms,
"set_pt": set_pt,
"memory": memory,
}
# Usage in a streaming pipeline
set_pt = 0.1
memory = 0.0
for frame in audio_stream:
result = process_audio_frame(frame, set_pt, memory)
set_pt = result["set_pt"]
memory = result["memory"]
if result["coherence"] > 1.5: # high coherence = meaningful content
send_to_feature_extractor(frame)
EEG and ECG signals are low-amplitude, frequency-rich, and highly sensitive to processing artifacts. Hard clipping or aggressive filtering destroys the harmonic structure that carries diagnostic information. The Harmonic Vector Stabilizer conditions the signal while explicitly preserving golden-ratio harmonic relationships — the same frequency structure present in biological rhythms.
The Impedance Variance Vectors module (Module 08 — available as a standalone file on the modules page) is particularly useful for multi-channel coherence analysis. In EEG, channel coherence is a diagnostic measure — reduced coherence between channels can indicate neurological conditions. Run your electrode array through the module and the coherence score gives you a single metric for overall channel alignment.
import numpy as np
from livingcircuit import harmonic_vector_stabilizer, adaptive_amplitude_stabilizer
from impedance_variance_vectors import impedance_variance_vectors
def condition_eeg_channel(raw_signal: np.ndarray, sample_rate: int = 256):
"""
Condition a single EEG channel while preserving harmonic structure.
raw_signal : raw EEG samples (microvolts, float64)
sample_rate : samples per second (default 256 Hz)
"""
# Normalize to [-1, 1] range
peak = np.max(np.abs(raw_signal)) + 1e-9
normalized = raw_signal / peak
# Harmonic conditioning — preserves biological frequency structure
t = np.linspace(0, len(raw_signal) / sample_rate, len(raw_signal))
result = harmonic_vector_stabilizer(t, base_freq=1.0, num_harmonics=8)
# Quality score tells us how coherent the harmonic content is
quality = result["quality_score"]
# Amplitude stabilization — remove artifact spikes without hard clipping
conditioned = []
set_pt = float(normalized[0])
for sample in normalized:
stable, set_pt = adaptive_amplitude_stabilizer(
signal=sample, set_point=set_pt,
variance_limit=0.3, impedance=1.0,
learn_rate=0.01
)
conditioned.append(stable)
return np.array(conditioned) * peak, quality # restore scale
def multi_channel_coherence(eeg_array: np.ndarray):
"""
Measure phase coherence across EEG electrode array.
eeg_array : shape (n_channels, n_samples)
Returns coherence score 0–1 across all channels.
"""
substrates = np.ones(eeg_array.shape[1])
r = impedance_variance_vectors(eeg_array, substrates,
geometry_coupling=0.15)
return r["coherence"]
# Usage
channels = load_eeg_data() # shape (32, 2560) — 32 channels, 10s at 256Hz
coherence = multi_channel_coherence(channels)
print(f"Channel coherence: {coherence:.3f}")
if coherence < 0.25:
print("Low coherence — possible artifact contamination or electrode issue")
Financial tick data has two problems: sudden spikes (bad prints, fat fingers, flash crashes) and continuous noise that obscures trend. The scalar stabilizer handles spikes — it keeps values within a bounded range of a rolling set point without clipping. The Solar Smoother handles noise — it carries state between ticks and blends corrections forward, producing a clean envelope.
For ML-based trading systems, the Impedance Variance Vectors module checks feature vector coherence before feeding a batch into the model. A coherence drop across your feature set often signals a regime change — the market is doing something the model hasn't seen before, and feeding it incoherent inputs will produce unreliable output.
import numpy as np
# Full code at modules.html#scalar, modules.html#solar, modules.html#impedance, modules.html#reflection
from livingcircuit import adaptive_amplitude_stabilizer, stabilize_solar_output
from impedance_variance_vectors import impedance_variance_vectors
from phase_reflection_agent_v3 import PhaseReflectionAgent
class TickDataConditioner:
"""Clean tick data before feeding into a trading model."""
def __init__(self, variance_limit=0.05, impedance=2.0):
self.variance_limit = variance_limit
self.impedance = impedance
self.set_pt = None
self.memory = 0.0
self.prev = None
self.monitor = PhaseReflectionAgent(name="tick-monitor")
self.cycle = 0
def process(self, price: float, dt: float = 1.0):
if self.set_pt is None:
self.set_pt = price
if self.prev is None:
self.prev = price
# 1. Spike removal
clean, self.set_pt = adaptive_amplitude_stabilizer(
signal=price, set_point=self.set_pt,
variance_limit=self.variance_limit,
impedance=self.impedance,
learn_rate=0.005
)
# 2. Noise smoothing with carried state
smooth, self.memory = stabilize_solar_output(
current_val=clean,
previous_val=self.prev,
dt=dt, memory=self.memory
)
self.prev = smooth
# 3. Health check
self.cycle += 1
state = self.monitor.step(self.cycle)
return smooth, state.stability
def check_feature_coherence(feature_matrix: np.ndarray, threshold=0.3):
"""Flag batches where feature coherence has dropped."""
substrates = np.ones(feature_matrix.shape[1])
r = impedance_variance_vectors(feature_matrix, substrates)
stable = r["coherence"] >= threshold
if not stable:
print(f"Feature coherence {r['coherence']:.3f} — possible regime change")
return r["coherence"], stable
Robotic control loops are sensitive to feedback spikes — a sudden joint encoder glitch or contact event can drive a PID controller into oscillation before the system can recover. The scalar stabilizer sits between the sensor and the controller, absorbing spikes without the hard limits that cause their own oscillation problems.
For repetitive motion systems — pick-and-place, CNC, welding robots — the Phase Reflection Agent tracks cycle coherence over time. A degrading stability value across cycles is an early indicator of mechanical wear, calibration drift, or approaching system limits before anything visibly fails.
import numpy as np
from livingcircuit import adaptive_amplitude_stabilizer, stabilize_solar_output
from phase_reflection_agent_v3 import PhaseReflectionAgent
class RobotJointController:
"""
Conditioned joint controller with cycle health monitoring.
Sits between sensor feedback and PID input.
"""
def __init__(self, joint_id: str, max_velocity=1.0):
self.joint_id = joint_id
self.max_velocity = max_velocity
self.set_pt = 0.0
self.memory = 0.0
self.prev_pos = 0.0
self.monitor = PhaseReflectionAgent(name=f"joint-{joint_id}")
self.cycle = 0
def condition_feedback(self, raw_pos: float, dt: float):
# Spike rejection — protects PID from encoder glitches
clean_pos, self.set_pt = adaptive_amplitude_stabilizer(
signal=raw_pos, set_point=self.set_pt,
variance_limit=0.02, # 2% of range
impedance=3.0, # high impedance = strong correction
learn_rate=0.01
)
# Velocity smoothing with carried state
smooth_pos, self.memory = stabilize_solar_output(
current_val=clean_pos,
previous_val=self.prev_pos,
dt=dt, memory=self.memory
)
self.prev_pos = smooth_pos
# Cycle health monitoring
self.cycle += 1
state = self.monitor.step(self.cycle)
if self.cycle % 100 == 0:
summary = self.monitor.summary()
if summary["stability"]["mean"] < 0.4:
print(f"Joint {self.joint_id}: degrading stability "
f"({summary['stability']['mean']:.3f}) — inspect for wear")
return smooth_pos, state
# Usage in a control loop
controller = RobotJointController("shoulder", max_velocity=0.5)
dt = 0.001 # 1kHz control loop
while robot.running:
raw_feedback = robot.read_encoder("shoulder")
clean_feedback, health = controller.condition_feedback(raw_feedback, dt)
pid_command = pid.compute(clean_feedback)
robot.send_command("shoulder", pid_command)
The Impedance Network Simulator was built for exactly this domain. A transmission line is a series of nodes with progressive phase delay, impedance variation, and signal attenuation — that's exactly what the simulator models. Set num_nodes to the number of line segments, frequency to your operating frequency, and phase_shift_per_node to the expected delay per segment.
For three-phase power analysis, set num_nodes=3 and phase_shift_per_node=2π/3 (120° spacing). The built-in FFT returns the harmonic spectrum — useful for detecting harmonic distortion injected by nonlinear loads.
import numpy as np
from impedance_network_simulator import ImpedanceNetworkSimulator, ImpedanceConfig
# Three-phase 50Hz power system
three_phase = ImpedanceConfig(
num_nodes=3,
frequency=50.0,
phase_shift_per_node=2 * np.pi / 3, # 120° between phases
impedance_variance=0.08, # 8% variation — realistic grid tolerance
damping_factor=0.0, # continuous steady-state operation
coupling=0.05, # slight inter-phase coupling
noise_level=0.005
)
sim = ImpedanceNetworkSimulator(three_phase)
t = np.linspace(0, 0.1, 5000) # 100ms at 5kHz sample rate
signals, impedances = sim.simulate(t)
# Harmonic analysis — detect distortion
freqs, spectrum = sim.get_frequency_spectrum(node_idx=0)
peak_freq = freqs[np.argmax(spectrum)]
harmonics = freqs[spectrum > np.max(spectrum) * 0.1] # >10% of peak
print(f"Fundamental: {peak_freq:.1f} Hz")
print(f"Harmonics detected: {harmonics[:5]}")
# Phase relationships
phases = sim.calculate_phase_relationships()
print(f"Phase differences: {np.degrees(phases['phase_differences'])}")
# Transmission line — 8 segments at 100MHz
tx_line = ImpedanceConfig(
num_nodes=8,
frequency=100e6,
phase_shift_per_node=np.pi / 8, # 22.5° per segment
impedance_variance=0.15,
damping_factor=0.02, # slight attenuation per segment
coupling=0.08,
noise_level=0.01
)
tx_sim = ImpedanceNetworkSimulator(tx_line)
tx_signals, tx_z = tx_sim.simulate(np.linspace(0, 1e-7, 2000))
metrics = tx_sim.calculate_variance_metrics()
print(f"Impedance range: {metrics['min_signal']:.3f} — {metrics['max_signal']:.3f}")
Industrial sensor networks generate continuous streams of scalar values — temperature, pressure, flow rate, vibration — that need to be stable between poll intervals, free of bad readings, and monitored for drift. The combination of scalar stabilizer (spike rejection) plus solar smoother (between-poll continuity) handles the signal quality problem with no external dependencies.
For multi-sensor arrays, the Impedance Variance Vectors module gives you a coherence health metric across the whole array. When a sensor starts drifting or failing, it becomes phase-scattered relative to the others — coherence drops before the reading goes obviously out of range. This gives you an early warning signal.
import numpy as np
from livingcircuit import adaptive_amplitude_stabilizer, stabilize_solar_output
from impedance_variance_vectors import impedance_variance_vectors
from phase_reflection_agent_v3 import PhaseReflectionAgent
class IndustrialSensorNode:
"""Single sensor node with spike rejection and continuity smoothing."""
def __init__(self, sensor_id: str, expected_range: tuple):
self.sensor_id = sensor_id
self.low, self.high = expected_range
self.center = (self.low + self.high) / 2
self.variance = (self.high - self.low) / 4
self.set_pt = self.center
self.memory = 0.0
self.prev = self.center
def read(self, raw_value: float, dt: float):
# Normalize to [-1, 1] for stabilizer
norm = (raw_value - self.center) / (self.variance + 1e-9)
# Spike rejection
clean_norm, self.set_pt_norm = adaptive_amplitude_stabilizer(
signal=norm,
set_point=getattr(self, 'set_pt_norm', 0.0),
variance_limit=0.5,
impedance=1.5,
learn_rate=0.02
)
# Continuity smoothing
smooth_norm, self.memory = stabilize_solar_output(
current_val=clean_norm,
previous_val=self.prev,
dt=dt, memory=self.memory
)
self.prev = smooth_norm
# Restore scale
return smooth_norm * self.variance + self.center
def check_array_health(sensor_readings: np.ndarray, threshold=0.35):
"""
sensor_readings : shape (n_sensors, n_features)
Returns coherence score and health flag.
Coherence below threshold signals possible sensor failure or drift.
"""
substrates = np.ones(sensor_readings.shape[1])
r = impedance_variance_vectors(sensor_readings, substrates,
geometry_coupling=0.1)
healthy = r["coherence"] >= threshold
if not healthy:
print(f"Array coherence {r['coherence']:.3f} — inspect sensors")
return r["coherence"], healthy
Places signal state across a 3D harmonic field using golden ratio distance scoring, congestion penalties, and golden angle directional bias. Keeps related state close to an anchor node and recovers automatically when a node fails — routing to the nearest healthy substitute without intervention.
The first C++ module in the stack. All five geometric constants are embedded directly in the scoring function. Compiles on any C++17 compiler with no external dependencies.
AI KV-Cache locality (6×6×6 lattice) — 96/96 succeeded · 0 failures
Dead node recovery (8 nodes killed) — 30/30 auto-rectified · zero intervention
Photonic plane (8×8×1 array) — 200/200 · avg coherence score 0.921
Neuromorphic spike routing (5×5×5) — 500/500 · 0 saturation
Multi-model inference (4 models × 24L) — 96/96 locality-aware placements
// Create a 4×4×4 lattice, 1MB per node
LatticeMemoryManagerV2 manager(4, 4, 4, 1024 * 1024);
// Allocate near anchor node 0
auto result = manager.allocateNear(0, 256 * 1024);
// result.success · result.moduleId · result.score · result.reason
// Dead node — allocator reroutes automatically
manager.setFunctional(nodeId, false);
Full source and documentation — modules.html
Two golden spirals expanding outward from center — the outer tracking horizontal observer position, the inner tracking vertical. A focal point orbits toward the direction of pull. Background waves provide a continuous field beneath the spiral geometry. No auto-animation. The field only moves when the observer moves.
The same constants that drive the other twelve modules — φ, the golden angle, e, π — describe the shape of a field under attention. Signal requires a source.
First public deployment: thelivingcircuit.ai/about.html
Outer: r(i) = 42 + i·0.089 + sin(i·0.085)·pull
θ(i) = i·0.041·φ + (mouseX − cx)·i·0.00014
Inner: r(i) = 27 + i·0.067 + sin(i·0.13)·pull
θ(i) = i·0.0365·φ − (mouseY − cy)·i·0.00021
Focal: angle = atan2(mouseY−cy, mouseX−cx) × 1.4
radius = 88 + pull × 260
// Drop into any canvas element
createSpiralResonanceField(canvas);
// The field initializes with default pointer position
// and begins responding to pointermove events immediately.
// No configuration required — pure canvas, no library.
Full source and documentation — modules.html
Processes audio through a geometry-based signal chain. Polygon or circle substrate maps the input to a radius field. Integrity wobble applies symmetry-preserving oscillation. Optional geometric inversion flips the field inside-out. Full-wave rectification folds negative excursions. Harmonic injection adds rotational geometry layers.
The mass parameter (∂/∂m) controls harmonic richness and effective output impedance — higher mass means richer harmonics and less hard limiting at output.
from geometric_oscillatory_sound_rectifier import GeometricOscillatorySoundRectifier
rect = GeometricOscillatorySoundRectifier(fs=44100, base_geometry='polygon', num_sides=5)
output = rect.process(audio, integrity=0.88, wobble_freq_ratio=1.618,
mass=2.5, num_harmonics=12)
Full source — modules.html
Maps tokens into an 8D harmonic space using golden ratio phase projection. Scores token streams against a seeded anchor vector. When coherence falls below threshold, applies iterative correction passes — nudging low-similarity tokens toward the anchor without hard replacement.
Composable stack: Module 10 gates the input → Module 15 conditions the stream → Module 07 observes drift over cycles → Module 02 stabilizes the coherence score time series.
from token_coherence_conditioner import TokenCoherenceConditioner
tcc = TokenCoherenceConditioner(coherence_threshold=0.59, max_passes=4, blend_strength=0.45)
tcc.set_seed(["harmonic", "coherence", "signal", "geometry"])
result = tcc.condition(tokens)
# result["coherence"] · result["status"] · result["passes_applied"]
Full source — modules.html
A dedicated medical module is in development. It adapts the Living Circuit's harmonic coherence architecture into a read-only clinical coherence engine — designed to support clinicians working through complex cases, not to replace clinical judgment.
The core behavior carries directly from the Ghost Field principle: insufficient coherence returns a request for more data instead of overconfident output. In a medical context this means the system flags gaps, contradictions, and ambiguities in a patient record rather than bridging them with assumptions. A diagnostic odyssey case with ten years of fragmented records across four specialties is exactly the kind of problem this architecture is built for.
Built on the Clinical Cross-Reference prototype — a coherence engine that detects gaps, contradictions, anchoring bias, and urgent review flags across a patient's clinical record, while always returning a full evidence trace for independent human review.
Intended applications:
When released this will be the most significant addition to this library — and likely the most significant open application of harmonic geometry conditioning to clinical signal analysis.
Complete parameter tables for the modules with the most configuration surface.
| Parameter | Default | Description |
|---|---|---|
| t | — | 1D time array, minimum 16 samples. The signal window being conditioned. |
| amplitude | 1.0 | Output signal amplitude scaling. |
| base_freq | 1.0 | Fundamental frequency in Hz. Clamped to [0.01, 8.0]. |
| num_harmonics | 12 | Number of harmonic layers. More layers = richer signal, slower computation. Clamped to [2, 24]. |
| phase_gain | 0.32 | Amplitude of multi-harmonic phase variance. Clamped to [0, 0.75]. |
| phase_ratio | 1.61803 (φ) | Golden ratio — controls harmonic spacing. Change this to alter the harmonic relationship. |
| refraction_bias | 0.82 | Base impedance level. Higher = more signal resistance. |
| refraction_depth | 0.38 | Impedance modulation depth per layer. |
| refraction_rate | 2.39996 | Golden angle — impedance oscillation frequency. |
| min_impedance | 0.28 | Lower clamp on refraction. Prevents division-near-zero. |
| harmonic_falloff | 2.15 | Power-law amplitude decay per harmonic. Higher = energy concentrated in early harmonics. |
| Parameter | Default | Description |
|---|---|---|
| vectors | — | Input array, shape (n_vectors, dimension) or (dimension,). Any float matrix. |
| substrates | — | Coupling array. In projected mode must match dimension. In cyclic mode any length. |
| base_freq | 1.0 | Base oscillation frequency across harmonic layers. |
| variance_gain | 0.18 | Amplitude of phase variance. Raise for more field sensitivity. |
| variance_decay | 0.68 | Exponential decay of variance across layers. Does NOT significantly affect total energy. |
| substrate_strength | 0.72 | Coupling strength between substrate and impedance. |
| num_layers | 5 | Harmonic layers. More layers = deeper analysis, slower computation. |
| harmonic_falloff | 2.22 | Power-law weight decay. Lower = energy spread deeper into layers. |
| geometry_coupling | 0.35 | Influence of vector geometry on phase. Keep in [0.0, 2.0] range. |
| substrate_mode | "projected" | "projected": geometry-aware, requires substrate length == dimension. "cyclic": uniform, any length. |
| Parameter | Default | Description |
|---|---|---|
| num_nodes | — | Number of network nodes. Each gets a progressive phase shift. |
| frequency | — | Oscillation frequency in Hz. Works from 1Hz to 100MHz+. |
| phase_shift_per_node | π/4 | Phase delay between adjacent nodes in radians. Use 2π/3 for three-phase, 2π/N for uniform distribution. |
| impedance_variance | 0.2 | Log-normal spread of per-node impedance variation. Higher = more node-to-node variation. |
| damping_factor | 0.05 | Exponential amplitude decay per unit time. 0.0 = continuous oscillation. 0.5 = ~2s time constant. |
| coupling | 0.0 | Cross-node influence strength. Adjacent nodes affect each other. Capped relative to impedance_variance. |
| noise_level | 0.01 | Additive Gaussian noise amplitude. Models real-world signal degradation. |
| Parameter | Default | Description |
|---|---|---|
| name | "Visitor" | Identifier for this agent instance. Appears in logs. |
| max_history | 300 | Maximum states kept in the rolling deque. Set to None for unlimited (not recommended for long runs). |
cycle, coherence (0–1), tension (0.12–0.88), stability (0.22–0.93), refraction (0.25–1.35), hue (0–360°), floor_count (consecutive floor hits), open_question (rotating diagnostic prompt).
The coherence score appears in three modules — Harmonic Vector Stabilizer (quality_score), Impedance Variance Vectors (coherence), and Phase Reflection Agent (coherence). They all measure the same underlying thing: how consistently a signal is moving in a harmonic direction. But the scale means different things in different contexts.
The quality_score is mean(magnitude) / std(magnitude) — a signal-to-noise ratio across the harmonic output. Values above 2.0 indicate a strong, coherent harmonic signal. Values below 1.0 suggest the input is too noisy or short for meaningful harmonic analysis. Unlike the 0–1 coherence score, quality_score is unbounded above — values of 5–10 are possible for very clean, periodic inputs.
Measures |mean(signal)| / mean(|signal|) — the ratio of the mean complex signal magnitude to the mean absolute magnitude. When all vectors produce signals pointing the same complex direction, this approaches 1.0. When they scatter randomly in phase space, the complex mean cancels toward zero. This is the standard circular coherence measure from directional statistics.
Computed from 0.62 + 0.28·cos(movement) + 0.12·sin(movement·φ²), clamped to [0.18, 0.96]. This is a synthetic coherence — it models how a system's internal state would evolve under harmonic forcing. Low coherence cycles with high tension produce low stability values, which trigger the floor recovery mechanism. Watch floor_count — repeated floor hits mean the system is under sustained stress.
The mathematical foundations behind each module's core computation.
Where:
Optional cross-node coupling: S(n,t) → S(n,t) + coupling × [S(n-1,t) + S(n+1,t)]
The tanh saturation prevents variance from blowing up at high frequencies. The three-component variance (using φ, φ², and φ complement) creates a phase modulation that's rich but bounded.
The damping function approaches 1.0 (no correction) when delta is within the variance limit, and approaches 0 (full correction to set_point) as delta grows large relative to impedance. The set_point itself tracks the stabilized output, preventing long-term drift.
Recovery = 0.08 × min(floor_count, 4) — injects a coherence lift proportional to how many consecutive cycles stability has been at the floor (0.28 threshold).
How the modules connect mathematically, not just visually.
| Module | Input type | Output type | Feeds into |
|---|---|---|---|
| SimpleVoiceToneAnalyzer | float32 array (audio) | dict: tone, intensity, confidence | harmonic_vector_stabilizer (intensity → base_freq scaling) |
| harmonic_vector_stabilizer | float64 1D array (time) | dict: signal, magnitude, phase, quality_score | AdaptiveAmplitudeStabilizer (quality_score as gain modulation) |
| AdaptiveAmplitudeStabilizer | torch.Tensor (batch, seq, dim) | torch.Tensor (same shape, stabilized) | Model blocks, ffn output |
| adaptive_amplitude_stabilizer | float scalar | (float, float): stabilized value, next set_point | stabilize_solar_output |
| stabilize_solar_output | float scalar + memory | (float, float): smoothed value, next memory | Final output stream |
| impedance_variance_vectors | ndarray (n_vectors, dim) | dict: coherence, magnitude, energy | PhaseReflectionAgent (coherence as external input) |
| PhaseReflectionAgent | cycle index (int) | ReflectionState: all metrics | Upstream modules as feedback signal |
| ImpedanceNetworkSimulator | time array + config | (signals matrix, impedances array) | impedance_variance_vectors (signals as vector batch) |
The most powerful configuration uses the Phase Reflection Agent's output to dynamically adjust upstream parameters. When state.stability drops, tighten the amplitude stabilizer's variance_limit. When state.coherence rises, relax it. This creates a self-regulating system that adapts to changing conditions:
from phase_reflection_agent_v3 import PhaseReflectionAgent
from livingcircuit import adaptive_amplitude_stabilizer
monitor = PhaseReflectionAgent()
base_variance_limit = 0.3
memory = 0.0
set_pt = 0.0
for cycle, value in enumerate(signal_stream):
state = monitor.step(cycle + 1)
# Dynamically adjust variance limit based on system stability
# Low stability → tighter bounds. High stability → relax bounds.
dynamic_limit = base_variance_limit * state.stability
stabilized, set_pt = adaptive_amplitude_stabilizer(
signal=value,
set_point=set_pt,
variance_limit=dynamic_limit,
impedance=0.5 + (1.0 - state.coherence), # more impedance when incoherent
learn_rate=0.02
)
stabilized, memory = stabilize_solar_output(stabilized, set_pt, dt=1.0, memory=memory)
Every module in this library is built on geometric constants — φ, π, e, the golden angle, and α. These are not silicon-specific parameters. They are not learned weights. They are not tuned to any particular hardware architecture. They describe relationships between signals that hold regardless of what medium carries those signals.
This has a practical consequence that becomes more significant as computing hardware evolves.
Electronic signals and optical signals behave differently at the physical layer — different noise profiles, different interference patterns, different propagation characteristics. But the mathematical relationships between phase, coherence, impedance, and stability are descriptions of signal geometry, not descriptions of electronics. A coherence score of 0.6 means the same thing whether the vectors came from a GPU, a neuromorphic chip, or a photonic processor.
The five constants used across these modules:
Photonic processors use light rather than electrons to perform computation. The stability challenges are real and unsolved — phase coherence between optical channels, managing interference between signal paths, maintaining signal integrity across temperature and fabrication variation. These are signal geometry problems. The same class of problems these modules address in electronic AI systems.
A conditioning layer built on geometric constants doesn't need to be rewritten for new hardware. It needs to be reapplied. The Harmonic Vector Stabilizer's coherence output is as meaningful for an optical signal array as it is for a transformer's latent space. The Impedance Variance Vectors module measures phase alignment across any vector batch — the source of those vectors is irrelevant to the math.
The brute-force approaches to AI stability — massive parameter counts, hardware-specific optimization, empirical tuning — don't transfer cleanly when the physics changes. A framework built on geometric relationships that predate silicon does.
These modules are written in Python and C++. The math is not specific to either.
Every module is an implementation of geometric constants — φ, π, e, the golden angle, and α. The relationships they describe are substrate-agnostic. They hold in any language, on any hardware, for any signal. If you need the logic in Rust, Go, JavaScript, Swift, Julia, or anything else — drop the module source into an AI and ask for a translation. The math carries because it is not Python. Python is just the current expression of it.
The code is Python and C++. The math is not.
Drop any module into an AI as plain text. Ask for a translation to your language. The logic carries.
Paste the module source into any AI with this prompt:
"Translate this to [Rust / Go / JavaScript / C# / Swift / Julia].
Preserve all geometric constants exactly:
PHI = 1.6180339887498948
PI = 3.14159265358979323846
E = 2.71828182845904523536
GOLDEN_ANGLE = 2.399963229728653
ALPHA = 1.0 / 137.035999084
Keep the same function signatures and return structure.
Do not substitute approximations for the constants."
The five constants, the mathematical relationships between them, the scoring functions, the phase calculations, and the coherence thresholds. These are not tuned parameters — they are geometric facts. They do not change when the language changes.
Syntax, type handling, library calls for array math, and how you import or include the module. Everything cosmetic. Nothing structural.
Module 12 (Harmonic Field Allocator) is already shipped in C++ with all five constants embedded directly in the scoring function. Module 13 (Spiral Resonance Field) is pure Vanilla JS — same geometric constants, different substrate. Both prove the same point: the math is not the language.
Timestamped authorship record for all Living Circuit modules. SHA-256 hashes verify file integrity.
These works are original designs built from first principles through harmonic geometry. No prior art. The conditioning primitives published under The Living Circuit LLC were designed, authored, and tested by John Burlingame. They represent a novel approach to AI system stability and signal conditioning using geometric constants as structural anchors rather than learned parameters. These files do not degrade. The mathematics is stable. The authorship is singular.
| Module | File | SHA-256 |
|---|---|---|
| Adaptive Amplitude Stabilizer | amplitude.py | 8e152e12a0377418b3198a8ae58b05cf319f1ee7c46fbd232a702919ae710e5c |
| Harmonic Vector Stabilizer | harmonic.py | 5ab07f4e5f651689665977c4cc316636001469424f06a347491a2f0400d48c92 |
| Voice Tone Analyzer | voice.py | 84baf46e8c6fa4e7171a6598df8e5744602f2e0f70f8436a67ab7d831a6891b6 |
| Solar Output Smoother | solar.py | 6d64348745706e8c08bd63d97fc1e05445b4b73bacfbff31ad8b2d1519eb7e64 |
| Phase Reflection Agent v3 | phase_reflection_agent_v3.py | 128e8cdf7a8915d6fb25c2ece9f395cf3d32a024054eb11d859c59b253ea2004 |
| Site | the-living-circuit-v6.html | c92352ae70e806fe7e5c3f779613004e4f5cf4a2f62a465ef89259736271a3b1 |
| Harmonic Field Allocator | lattice_memory_manager_public.cpp | 0d52b1e254afe19aeb6419e47cfff3068d1a8c4bec00ea5eb05908f72984c9ac |
| Spiral Resonance Field | module13_spiral_resonance_field.js | 3833c9ca2c0162ff420facf53d6bfb059956486a590451d3ff43d4ec0350b553 |
| Geometric Oscillatory Sound Rectifier | geometric_oscillatory_sound_rectifier.py | f9afdae203d2b865d6ad1cdcd62979530b7899f4ee0dc0ba73f74cd982bdd8b6 |
| Token Coherence Conditioner | token_coherence_conditioner.py | df2e37f858f4af60e3705f0f7062402af26222c57d82ae8eaf0266c0f9bb7f8e |
| Package | livingcircuit-1.1.0.zip | 50cb8a1b39cd9b7117436a2c10b504662eea40afa2eafe3705c771b8fef06b00 |