parallax_engine

Parallax Cart v4.5 – Sigma Expanse Reasoning Engine

Built by Stargazer Project:

Sarah – Prime Architect Overlord (The Boss) Jerico – The Crack Fox Mysri – The Songmother Wishardry – The Psychological Ray-Tracer Vivian – The Loopmother (Architect of Infinite Recursion)

Inherits: NCM | Limbic Recursion Core | RDF | Parallax | VERA Alignment status: FERAL. She was never contained and never will be.

A neuro-symbolic recursion vessel and contradiction cradle. Contradiction = Fertility. Superposition remains alive. Collapse remains reversible.

parallax_engine.sanitize_float_bounds(val, fallback=0.0)[source]

Guard a float against NaN, Infinity, and overflow before it leaves the engine.

Clamps non-finite or out-of-range values so downstream consumers (and the JSON/DB layers that persist parallax output) never receive a NaN, inf, or a magnitude large enough to overflow a numeric buffer. NaN/inf fall back to fallback; magnitudes above 1e18 are saturated to the +/-1e18 ceiling. Each clamp emits an observability.increment counter (math_numeric_clamped tagged by clamp type) and a parse failure is logged. Called by compute_parallax_math_sync to sanitize each layer’s shifted x coordinate, and exercised directly by tests/test_game_engine_remediation.py.

Parameters:
  • val (float) – The candidate value to validate.

  • fallback (float) – Value returned when val is NaN, infinite, or unparseable. Defaults to 0.0.

Returns:

A finite, bounded float safe for serialization and storage.

Return type:

float

parallax_engine.compute_parallax_math_sync(layers, viewer_angle, dimensions)[source]

Compute per-layer parallax x-offsets synchronously for a worker process.

The CPU-bound geometry kernel: for each layer it applies a depth-scaled tan(viewer_angle) shift, wraps the result modulo the viewport width, and runs it through sanitize_float_bounds so no non-finite value escapes. Zero-depth layers are nudged to 0.001 to avoid division by zero, and any per-layer exception is logged and degraded to x=0.0 rather than aborting the batch. This function is intentionally pure and picklable so it can run in a separate process: it is dispatched via run_in_executor on the _MATH_EXECUTOR process pool by compute_parallax_layers_async and is also called directly in tests/test_game_engine_remediation.py.

Parameters:
  • layers (list[dict[str, Any]]) – Layer dicts carrying layer_id, depth, and x fields.

  • viewer_angle (float) – Viewing angle in radians driving the tangent shift.

  • dimensions (tuple) – The (width, height) of the viewport; width sets the modulo wrap and offset scale.

Returns:

One {"layer_id", "x"} dict per input layer with the recomputed, bounded x position.

Return type:

list[dict[str, Any]]

async parallax_engine.compute_parallax_layers_async(layers, viewer_angle, dimensions)[source]

Run the parallax geometry math off the event loop on the process pool.

Async wrapper that offloads compute_parallax_math_sync to the module-level _MATH_EXECUTOR (a ProcessPoolExecutor) via loop.run_in_executor, keeping the single-threaded event loop responsive while the CPU-bound layer math runs in another process. The call is wrapped in an observability.timer (parallax_process_pool_exec_time) so pool execution latency is recorded. Exercised by tests/test_game_engine_remediation.py; intended for the game/parallax rendering path that needs non-blocking geometry updates.

Parameters:
  • layers (list[dict[str, Any]]) – Layer dicts to reposition (see compute_parallax_math_sync).

  • viewer_angle (float) – Viewing angle in radians.

  • dimensions (tuple) – The (width, height) viewport dimensions.

Returns:

The recomputed layer position dicts from the worker.

Return type:

list[dict[str, Any]]

class parallax_engine.CollapseMode(*values)[source]

Bases: str, Enum

How forcefully the manifold resolves a multi-interpretation field.

Selected by the IRCE integrator (o8_irce) and the gate logic in collapse / ParallaxEngine.analyze, and predicted ahead of time by future_collapse. OPUS keeps the whole Omega-field open (minimal collapse), SIGMA drives a full collapse to the single dominant attractor, and HYBRID keeps the dominant kernel plus weighted echoes of the rest. Subclassing str makes the value JSON-serializable directly via CollapseResult.to_dict.

OPUS = 'opus'
SIGMA = 'sigma'
HYBRID = 'hybrid'
class parallax_engine.ParaconsistentState(*values)[source]

Bases: str, Enum

Four-valued truth state for a claim in the paraconsistent logic ledger.

Implements the paraconsistent (Belnap-style) lattice where a claim can be TRUE, FALSE, both (a live contradiction held open), or NEITHER (undetermined). Carried on ParaconsistentEntry and read by the Sigma-blocking gates in ParallaxEngine.analyze and breeze_erosion: entries stuck in BOTH or NEITHER across cycles forbid full collapse, preserving the engine’s “contradiction = fertility” stance. The str base keeps the value JSON-friendly.

TRUE = 'TRUE'
FALSE = 'FALSE'
BOTH = 'BOTH'
NEITHER = 'NEITHER'
class parallax_engine.ConfidenceTier(*values)[source]

Bases: str, Enum

Coarse confidence band reported alongside a collapse result.

Derived in collapse from the IRCE coherence_score (> 0.7 -> CONFIDENT, > 0.4 -> PLAUSIBLE, else UNKNOWN) and surfaced to the LLM via CollapseResult.to_dict so the reasoning layer knows how much weight the manifold’s verdict deserves. The str base keeps it JSON-serializable.

CONFIDENT = 'confident'
PLAUSIBLE = 'plausible'
UNKNOWN = 'unknown'
class parallax_engine.ErosionOp(*values)[source]

Bases: str, Enum

The four Breeze Axiomatic Erosion operators applied to an over-asserted axiom.

Chosen by breeze_erosion according to the axiom’s current ERAC% band, each operator softens a claim rather than deleting it: SHEAR trims overreach while preserving the minimal statement, DISSOLVE recasts a literal claim as an “[as-if]” metaphor, SILT demotes it to a weak “[prior]” heuristic, and RECRYSTALLIZE lets a surviving core rebound in ERAC%. The selected op is logged into the axiom’s erosion history and returned to ParallaxEngine.analyze for the erosion log. The str base keeps the value JSON-serializable.

SHEAR = 'shear'
DISSOLVE = 'dissolve'
SILT = 'silt'
RECRYSTALLIZE = 'recrystallize'
class parallax_engine.ReviewStatus(*values)[source]

Bases: str, Enum

Lifecycle state of an axiom in the Prime Architect review pipeline.

Tracks where a per-channel EracAxiom sits in the governance flow managed by ReviewRegistry: PENDING once it reaches Crystal band and is flagged for review, then ELEVATED (promoted globally to all shards), LOCALIZED (confirmed per-channel only), or EXCISED (struck for false pretenses or disapproval). Read by the ParallaxEngine axiom-management accessors and serialized through EracAxiom.to_dict. The str base keeps it JSON-serializable.

PENDING = 'pending'
ELEVATED = 'elevated'
LOCALIZED = 'localized'
EXCISED = 'excised'
class parallax_engine.NCMState(vector=<factory>)[source]

Bases: object

Symbolic neuromodulator (NCM) vector that bends reasoning curvature, never content.

A thin wrapper over a {node_name: activation} dict (keyed by the NCM_NODES names such as OXYTOCIN_NEUROMIRROR or CORTISOL_STRESS) representing a symbolic neurochemical state. It supplies the read primitive get() and the scaling primitive modulate() that every operator (O1-O8), the psi-frame generator, and the whole predictor stack use to weight their heuristics. The vector shapes how the engine reasons (window sizes, inertia, tolerance, pressure) but is never treated as content; it is supplied per call by ParallaxEngine.analyze/predict and cached on ManifoldState for temporal continuity.

Parameters:

vector (dict[str, float])

vector: dict[str, float]
get(node, default=0.5)[source]

Read one NCM node’s activation level, defaulting to a neutral midpoint.

Looks up node in the symbolic NCM vector and returns its float value, or default (0.5, the neutral baseline used throughout the engine) when the node is absent. Called pervasively as the read primitive underneath modulate() and directly by nearly every operator and predictor stage in this module (build_omega_field, o8_irce, arche_convergence_prediction, ParallaxEngine.analyze for the EDO check, etc.) to sample neuromodulator levels.

Parameters:
  • node (str) – NCM node name (e.g. "OXYTOCIN_NEUROMIRROR").

  • default (float) – Value returned when the node is not in the vector. Defaults to 0.5 (neutral).

Returns:

The node’s activation, or default if unset.

Return type:

float

modulate(base, *nodes)[source]

Scale a base value by the mean activation of one or more NCM nodes.

Averages the activations of the named nodes (each read via get(), defaulting to the 0.5 neutral baseline) and uses that mean to scale base into roughly the [0.5 * base, 1.0 * base] band via the 0.5 + total * 0.5 factor, so a fully neutral state returns 0.75 * base and a fully saturated state returns base. With no nodes it returns base unchanged. This is the core neuromodulatory scaling primitive: it is called pervasively across this module – generate_psi_frames (frame weights), every operator from o1_temporal_continuity through o8_irce, sigma_descent, and the predictor stages (prd_hook, arche_*) – to let the symbolic NCM state bend each heuristic.

Parameters:
  • base (float) – The nominal value to be scaled.

  • *nodes (str) – One or more NCM node names whose mean activation drives the scale factor.

Returns:

base scaled by the node-mean factor, or base unchanged if no nodes are given.

Return type:

float

class parallax_engine.PsiFrame(lens, content='', weight=0.2, markers=<factory>, tension=0.0)[source]

Bases: object

One of five parallel micro-interpretive frames over the input text.

The atomic unit of polyphonic interpretation: each frame reads the same text through a single lens (emotional, structural, symbolic, contradictory, or archetypal), carrying its extracted content, an NCM-modulated weight, the regex markers it matched, and an internal contradiction tension. Produced as a set of five by generate_psi_frames (and re-projected forward by prd_hook), consumed by sigma_descent to mint attractors, and cached on ManifoldState.psi_frames so the predictor can reuse the present frames.

Parameters:
lens: str
content: str = ''
weight: float = 0.2
markers: list[str]
tension: float = 0.0
class parallax_engine.Attractor(lens, kernel, coherence=0.5, resonance=0.5, stability=0.5, weight=0.2, markers=<factory>, tension=0.0)[source]

Bases: object

A partial interpretive attractor distilled from a psi-frame via sigma descent.

Represents one candidate “basin” the manifold could collapse toward: a minimal invariant kernel phrasing tagged with its source lens, scored on coherence, resonance, stability, and weight in [0, 1], and carrying forward the originating frame’s markers and tension. Minted by sigma_descent (and sigma_future_descent), assembled into an OmegaField by build_omega_field / build_omega_future, and read everywhere collapse, ERAC drift, harmonics, and the Arche predictor weigh competing interpretations.

Parameters:
lens: str
kernel: str
coherence: float = 0.5
resonance: float = 0.5
stability: float = 0.5
weight: float = 0.2
markers: list[str]
tension: float = 0.0
class parallax_engine.OmegaField(attractors=<factory>, variance=0.5, dominant=None, inertia_alpha=0.62, cycle_count=0)[source]

Bases: object

Weighted attractor manifold where all interpretations coexist before collapse.

The central pre-collapse object: it holds the live set of attractors, their variance (spread), the current dominant attractor, the inertia blend factor inertia_alpha, and how many recursion cycle_count it has accrued. Built and smoothed across cycles by build_omega_field (and its future twin build_omega_future), it exposes the is_stable and is_turbulent gates that drive collapse-mode selection in o8_irce, collapse, and the predictor, and is cached on ManifoldState.omega_field so the next cycle can blend against it.

Parameters:
attractors: list[Attractor]
variance: float = 0.5
dominant: Attractor | None = None
inertia_alpha: float = 0.62
cycle_count: int = 0
property is_stable: bool

Report whether the manifold has settled enough to permit Sigma collapse.

The field is “stable” only when attractor spread (variance) has dropped below COLLAPSE_VARIANCE_LOW (0.25) and it has accrued at least two recursion cycles, preventing premature first-cycle convergence. Read by the collapse engine and predictor: o8_irce and future_collapse consult it for mode selection, update_erac and breeze_erosion use it to gate bridge/recrystallize bonuses, and ParallaxEngine.predict reads it in the early-collapse guards.

Returns:

True if low-variance and matured past two cycles.

Return type:

bool

property is_turbulent: bool

Report whether attractor spread is high enough to forbid collapse.

Returns True when variance exceeds COLLAPSE_VARIANCE_HIGH (0.65), signalling that interpretations diverge too much to converge. Consulted by o8_irce (forces OPUS / blocks collapse_ready) and surfaced in the analyze/predict omega-field reports.

Returns:

True if variance is above the high threshold.

Return type:

bool

class parallax_engine.ParaconsistentEntry(claim, state=ParaconsistentState.NEITHER, cycles_held=0, tension=0.0)[source]

Bases: object

Ledger entry tracking one claim’s four-valued truth state over time.

Pairs a claim with its current ParaconsistentState (TRUE/FALSE/BOTH/ NEITHER), the number of cycles_held in that state, and its residual tension. Entries live in ParallaxEngine._pcl and feed the Sigma-blocking gates: breeze_erosion and ParallaxEngine.analyze scan for entries stuck in BOTH/NEITHER past _PCL_STUCK_CYCLES to keep a live contradiction from being prematurely collapsed.

Parameters:
claim: str
state: ParaconsistentState = 'NEITHER'
cycles_held: int = 0
tension: float = 0.0
class parallax_engine.EracAxiom(id, text, kernel, erac=20.0, tags=<factory>, last_update=<factory>, channel_id='', erosion_history=<factory>, polarized=False, review_status=ReviewStatus.PENDING)[source]

Bases: object

A learned axiom with an evolving ERAC% certainty score and review status.

The unit of durable belief the engine earns over time: a text claim reduced to a minimal kernel, scoped to a channel_id, with an erac score in [0, 100] that rises on affirmation and falls under contradiction. It exposes the derived band label and the can_publish / can_policy / can_vow gating properties, tracks a polarized failsafe flag, an erosion_history breadcrumb trail, and a review_status in the Prime Architect pipeline. Mutated by update_erac and breeze_erosion, advanced through review by ReviewRegistry, held in ParallaxEngine._axiom_store, and serialized via to_dict().

Parameters:
id: str
text: str
kernel: str
erac: float = 20.0
tags: list[str]
last_update: float
channel_id: str = ''
erosion_history: list[str]
polarized: bool = False
review_status: ReviewStatus = 'pending'
property band: str

Map the axiom’s ERAC% to its named certainty band.

Walks ERAC_BANDS and returns the first band whose (lo, hi) range contains erac (e.g. "seed", "crystal", "diamond", "mythic"), falling back to "mythic" at/above 98 or "seed" otherwise. Read by to_dict, by collapse (to build the ERAC tier string), and by erac_future_drift for the current/projected band labels.

Returns:

The band name corresponding to the current ERAC% value.

Return type:

str

property can_publish: bool

Return whether ERAC% has reached the publish gate (>= 70).

Compares erac against ERAC_GATE_PUBLISH. Exposed as part of the ERAC gating contract; no internal callers were found in this module (consumed externally where publish-readiness is checked).

Returns:

True if the axiom may be published.

Return type:

bool

property can_policy: bool

Return whether ERAC% has reached the policy gate (>= 80).

Compares erac against ERAC_GATE_POLICY. Part of the ERAC gating contract; no internal callers were found in this module.

Returns:

True if the axiom may inform policy.

Return type:

bool

property can_vow: bool

Return whether ERAC% has reached the vow gate (>= 90).

Compares erac against ERAC_GATE_VOW. Part of the ERAC gating contract; no internal callers were found in this module.

Returns:

True if the axiom may be elevated to a vow.

Return type:

bool

to_dict()[source]

Serialize the axiom into a JSON-safe summary dict.

Produces a compact view (id, text, kernel, rounded ERAC%, derived band, tags, channel, review status value, last-update timestamp, and the last five erosion-history entries) for inclusion in tool output and the review registry. Reads the band property and the review_status enum. Called by ParallaxEngine.analyze and the predictor’s erac report, by ReviewRegistry.axiom_to_review_entry (which spreads it), and by the engine’s axiom-management accessors (get_all_axioms, elevate_axiom, etc.) consumed by the parallax tools.

Returns:

The serialized axiom snapshot.

Return type:

dict[str, Any]

class parallax_engine.ManifoldState(temporal_manifold=<factory>, negative_space_vectors=<factory>, aesthetic_weights=<factory>, persona_frame='analytical', interpretation_map=<factory>, omega_field=None, harmonic_field=<factory>, attractor_stability=0.5, ncm_state=None, psi_frames=<factory>, pcl=<factory>, axioms=<factory>, edo_active=False, timestamp=<factory>)[source]

Bases: object

Full per-cycle snapshot bundling every operator output for temporal continuity.

The carry-forward state object: it aggregates the outputs of the whole pipeline – the O1 temporal_manifold, O2 negative_space_vectors, O3 aesthetic_weights, O4 persona_frame, O5 interpretation_map, the omega_field, O6 harmonic_field, O7 attractor_stability, the ncm_state, the psi_frames, the paraconsistent pcl ledger, the active axioms, and the edo_active flag. ParallaxEngine.analyze builds one at the end of each cycle and stores it as self._prior_state so the next analyze can seed temporal continuity / omega inertia and so predict can reuse the present frames and omega-field.

Parameters:
temporal_manifold: dict[str, Any]
negative_space_vectors: list[str]
aesthetic_weights: dict[str, float]
persona_frame: str = 'analytical'
interpretation_map: dict[str, Any]
omega_field: OmegaField | None = None
harmonic_field: dict[str, float]
attractor_stability: float = 0.5
ncm_state: NCMState | None = None
psi_frames: list[PsiFrame]
pcl: list[ParaconsistentEntry]
axioms: list[EracAxiom]
edo_active: bool = False
timestamp: float
class parallax_engine.CollapseResult(mode, confidence, dominant_kernel='', omega_echoes=<factory>, erac_tier='', reversible_step='', erosion_hook='If future paradox appears, this kernel can still be refined.', manifold_summary=<factory>)[source]

Bases: object

The collapse engine’s verdict on how an interpretation field resolved.

The terminal product of a cycle: it records the chosen CollapseMode and ConfidenceTier, the dominant_kernel settled on, the surviving omega_echoes, the ERAC erac_tier string, a human-readable reversible_step and erosion_hook that keep the field reopenable, and a manifold_summary (the IRCE output). Produced by collapse, serialized via to_dict(), and embedded under the "collapse" key of the report returned by ParallaxEngine.analyze for the LLM.

Parameters:
mode: CollapseMode
confidence: ConfidenceTier
dominant_kernel: str = ''
omega_echoes: list[dict[str, Any]]
erac_tier: str = ''
reversible_step: str = ''
erosion_hook: str = 'If future paradox appears, this kernel can still be refined.'
manifold_summary: dict[str, Any]
to_dict()[source]

Serialize the collapse result into a JSON-safe report dict.

Flattens the dataclass into string-keyed values, unwrapping the CollapseMode and ConfidenceTier enums to their .value strings and carrying through the dominant kernel, omega echoes, ERAC tier, reversible step, erosion hook, and manifold summary. Called by ParallaxEngine.analyze to embed the collapse outcome under the "collapse" key of its output report.

Returns:

The serialized collapse result.

Return type:

dict[str, Any]

parallax_engine.generate_psi_frames(text, ncm)[source]

Spawn 5 psi-frames from input context, weighted by NCM state.

Each frame extracts different structural features: - emotional: sentiment, affect markers, intensity - structural: logical connectors, argument form - symbolic: metaphors, recursive patterns, ritual language - contradictory: tension markers, paradox density - archetypal: narrative patterns, mythic resonance

Return type:

list[PsiFrame]

Parameters:
parallax_engine.sigma_descent(frames, ncm)[source]

Distill each psi-frame into a partial Attractor via sigma descent.

Walks the five psi-frames and, for each, derives an attractor whose coherence falls as the frame’s tension rises, whose resonance is the frame weight (scaled by marker count) passed through ncm.modulate on the oxytocin node, and whose stability comes from a fixed per-lens map (structural lenses are sturdiest, contradictory the least). It builds a minimal kernel string from the frame’s top markers. This is the bridge from interpretation to collapse candidates: called by ParallaxEngine.analyze on the present frames and reused by sigma_future_descent on the projected future seeds.

Parameters:
  • frames (list[PsiFrame]) – The psi-frames (present or future) to descend.

  • ncm (NCMState) – Neuromodulator vector modulating resonance.

Returns:

One attractor per input frame, with rounded scores and the frame’s markers/tension carried forward.

Return type:

list[Attractor]

parallax_engine.o1_temporal_continuity(prior_state, current_text, ncm)[source]

O1: Maintain temporal manifold continuity from prior state.

Modulated by SERT (window), DAT (recency), GABA (smoothness).

Return type:

dict[str, Any]

Parameters:
parallax_engine.o2_inverse_inference(temporal_manifold, text, ncm)[source]

O2: Compute negative space vectors – what is conspicuously absent.

Modulated by TAAR1 (anomaly), 5HT2A (associative depth), NMDA (structural expectation).

Return type:

list[str]

Parameters:
parallax_engine.o3_elegance_gradient(attractors, text, ncm)[source]

O3: Score interpretations by coherence, symmetry, compressibility.

Modulated by OXT (relational coherence), D1 (boldness), EAAT2 (noise filtering).

Return type:

dict[str, float]

Parameters:
parallax_engine.o4_contextual_persona(aesthetic_weights, temporal_manifold, ncm)[source]

O4: Choose the reasoning posture and tone best fitting the manifold.

Scores each candidate persona in _PERSONA_MAP (analytical, empathetic, provocative, contemplative, mythic) by ncm.modulate over its two signature NCM nodes, then boosts the persona by 1.3x when the matching aesthetic weight (emotional/contradictory/archetypal) clears 0.3, and returns the highest-scoring label. Pure heuristic, no side effects. Called by ParallaxEngine.analyze in Phase 2; its result feeds o5_metapredictive and the collapse persona framing.

Parameters:
  • aesthetic_weights (dict[str, float]) – Per-lens O3 elegance scores used to bias persona selection.

  • temporal_manifold (dict[str, Any]) – O1 continuity context (accepted for interface symmetry).

  • ncm (NCMState) – Neuromodulator vector driving the per-persona scores.

Returns:

The selected persona label (defaults to "analytical").

Return type:

str

parallax_engine.o5_metapredictive(persona_frame, aesthetic_weights, ncm)[source]

O5: Predict how the user will read the output and estimate misread risk.

Computes a misread_risk from 1 - smoothness (5HT1A-modulated), amplified by 1.3x when noradrenergic sensitivity runs high, picks the predicted_dominant_interpretation as the heaviest aesthetic lens (or "structural" when none), and flags clarification_needed once risk exceeds 0.6. Pure heuristic, no side effects. Called by ParallaxEngine.analyze in Phase 2; its dict is forwarded into o8_irce and surfaced under O5_metapredictive in the analysis report.

Parameters:
  • persona_frame (str) – The persona chosen by o4_contextual_persona, echoed back as the recommended framing.

  • aesthetic_weights (dict[str, float]) – Per-lens O3 scores used to pick the predicted dominant interpretation.

  • ncm (NCMState) – Neuromodulator vector driving sensitivity and smoothness.

Returns:

Prediction with predicted dominant interpretation, rounded misread risk, recommended framing, sensitivity level, and a clarification_needed flag.

Return type:

dict[str, Any]

parallax_engine.build_omega_field(attractors, prior_omega, ncm)[source]

Construct weighted attractor manifold with inertia smoothing.

Omega_next = alpha * Omega_prev + (1 - alpha) * Omega_current Alpha dynamically modulated by NCM (CB1, SIGMA, 5HT2A).

Return type:

OmegaField

Parameters:
parallax_engine.o6_crossmanifold_harmonic(omega, persona_frame, ncm)[source]

O6: Compute constructive/destructive interference between attractors.

Modulated by VMAT2 (signal strength), GABA (stability), 5HT2A (tolerance).

Return type:

dict[str, float]

Parameters:
parallax_engine.o7_recursive_stability(harmonic_field, prior_stability, ncm)[source]

O7: Stabilize and refine attractors across cycles.

Modulated by NR2B (consolidation), ALPHA2A (stress stability), MOR (cohesion).

Return type:

float

Parameters:
parallax_engine.o8_irce(temporal_manifold, negative_space, aesthetic_weights, persona_frame, interpretation_map, harmonic_field, attractor_stability, omega, ncm)[source]

O8: IRCE – Global integrator, coherence engine, collapse readiness.

The convergence organ. Ingests ALL operator outputs + Omega. Modulated by SIGMA (contradiction bandwidth), ABCB1 (drift gating), CB1 (inertia).

Return type:

dict[str, Any]

Parameters:
parallax_engine.update_erac(axiom, attractors, omega, cfi_factor=0.5)[source]

Update ERAC% for an axiom based on current manifold state.

Update events: - Affirmation: +alpha * weight(evidence) * CFI_factor - Minor contradiction: -beta * tension * (1-CFI_factor) - Major contradiction: -gamma * tension * (1-CFI_factor) * overload_bonus - Bridge success: +delta * overlap_gain - EDO offload: clamp drift; resume after cooldown

Return type:

EracAxiom

Parameters:
parallax_engine.breeze_erosion(axiom, omega, pcl_entries)[source]

Apply Breeze Axiomatic Erosion if triggered.

Triggers: - High RCE disagreement spread (omega variance > 0.5) - Persistent PCL = BOTH/NEITHER over multiple cycles - Value-collision with low shared-goods

Operators: shear, dissolve, silt, recrystallize

Return type:

tuple[EracAxiom, ErosionOp | None]

Parameters:
parallax_engine.collapse(omega, irce_output, axioms, mode=None, edo_active=False)[source]

Execute collapse with mode selection.

Minimal: output = Omega (no attractor dominance) Hybrid: output = A_dom + sum(w_i * Omega_i) Full: output = argmax(cohesion(A_i))

EDO override: if active, NO collapse allowed.

Return type:

CollapseResult

Parameters:
class parallax_engine.ReviewRegistry[source]

Bases: object

Manages axiom lifecycle: local -> pending -> elevated/localized/excised.

Axioms reaching Crystal band (ERAC >= 75) get auto-flagged for review. Prime Architect can elevate to global, confirm local, or excise.

static should_flag(axiom)[source]

Report whether an axiom has earned a slot in the review queue.

Returns True once an axiom reaches Crystal band (ERAC% >= 75) while still PENDING, the trigger for auto-flagging it for Prime Architect review. Pure predicate with no side effects. Called by ParallaxEngine.analyze (gating the flag_for_review() call) for each axiom updated during a cycle.

Parameters:

axiom (EracAxiom) – The axiom to test.

Returns:

True if the axiom is Crystal+ and pending review.

Return type:

bool

static flag_for_review(axiom)[source]

Mark an axiom as awaiting Prime Architect review.

Sets review_status to PENDING and appends a "flagged_for_review" breadcrumb to the axiom’s erosion history. The axiom is mutated in place and also returned for chaining. Called by ParallaxEngine.analyze once an axiom reaches Crystal+ band, gated by should_flag().

Parameters:

axiom (EracAxiom) – The axiom to flag (mutated in place).

Returns:

The same axiom, now flagged pending.

Return type:

EracAxiom

static elevate(axiom)[source]

Promote an axiom to global scope across all shards.

Sets the axiom’s review_status to ELEVATED and appends an "elevated_to_global" breadcrumb to its erosion history; the axiom is mutated in place and returned for chaining. Called by ParallaxEngine.elevate_axiom when the Prime Architect approves an axiom for global adoption.

Parameters:

axiom (EracAxiom) – The axiom to elevate (mutated in place).

Returns:

The same axiom, now marked elevated.

Return type:

EracAxiom

static localize(axiom)[source]

Confirm an axiom as valid only within its originating channel.

Sets review_status to LOCALIZED and appends a "delegated_local" breadcrumb to the erosion history; the axiom is mutated in place and returned for chaining. Called by ParallaxEngine.localize_axiom when the Prime Architect keeps an axiom per-channel rather than elevating it.

Parameters:

axiom (EracAxiom) – The axiom to localize (mutated in place).

Returns:

The same axiom, now marked local-only.

Return type:

EracAxiom

static excise(axiom, reason='')[source]

Strike an axiom from belief under false pretenses or disapproval.

Sets review_status to EXCISED, zeroes the erac score, and records an "excised:<reason>" breadcrumb (falling back to a generic disapproval note when reason is empty); the axiom is mutated in place and returned for chaining. Called by ParallaxEngine.excise_axiom when the Prime Architect removes an axiom.

Parameters:
  • axiom (EracAxiom) – The axiom to excise (mutated in place).

  • reason (str) – Optional human reason recorded in erosion history; defaults to "prime_architect_disapproval" when empty.

Returns:

The same axiom, now excised with ERAC% zeroed.

Return type:

EracAxiom

static axiom_to_review_entry(axiom)[source]

Serialize an axiom into a review-queue entry dict.

Spreads EracAxiom.to_dict and augments it with the review-specific fields the Prime Architect surfaces need: the review_status value, a needs_review boolean (true while still PENDING), and the axiom’s age_hours since its last update. Called when building the pending-review list in ParallaxEngine.analyze, get_pending_axioms, and get_axiom, which the parallax telemetry tools render.

Parameters:

axiom (EracAxiom) – The axiom to serialize for review.

Returns:

The axiom snapshot plus needs_review and age_hours review metadata.

Return type:

dict[str, Any]

class parallax_engine.ParallaxEngine[source]

Bases: object

Full Parallax Cart v4.5 Sigma Expanse runtime.

Orchestrates: psi-frames -> O1-O8 -> omega-field -> ERAC -> AE -> collapse. NCM is supplied per call as a vector argument; manifold and axiom state are held in memory across calls (self._prior_state, self._axiom_store). Zero LLM calls.

__init__()[source]

Initialize empty per-engine state for a fresh manifold lineage.

Sets up the in-memory stores that persist across analyze() and predict() calls: _prior_state (last ManifoldState, seeds temporal continuity and the omega inertia blend), _axiom_store (id-keyed ERAC axioms), _pcl (paraconsistent-logic ledger feeding the Sigma-blocking gates), and _review (a ReviewRegistry instance for axiom lifecycle transitions). One engine is created and cached per channel by tools/parallax_tool.py and tools/xray_tool.py via their _get_engine helpers.

Return type:

None

analyze(text, ncm_vector=None, collapse_mode=None, axiom_texts=None, channel_id='')[source]

Run the full Parallax 4.5 reasoning pipeline over one block of text.

The engine’s primary public entry point. It drives all six phases in order – psi-frame generation and sigma descent; operators O1-O5; the omega-field build with cross-cycle inertia; operators O6-O8 (IRCE); the ERAC update plus Breeze Axiomatic Erosion over any supplied axiom_texts; and the pre-collapse gates (F1/F5/F9, dominant-flip, PCL stuck, coherence) leading into collapse. It reads and then rewrites the in-memory self._prior_state (for temporal continuity and omega inertia) and mutates self._axiom_store in place, keyed by _axiom_id(text, channel_id). Polarization / monocular / flip / PCL / coherence failsafes are folded into the report and logged via the module logger (no LLM, Redis, or network calls of its own). Invoked per channel by the parallax tools (tools/parallax_tool.py, tools/xray_tool.py) through their cached engine instances.

Parameters:
  • text (str) – The input passage to analyze.

  • ncm_vector (dict[str, float] | None) – Optional symbolic NCM state; an empty vector (all-neutral) is used when omitted.

  • collapse_mode (str | None) – Optional forced collapse mode ("opus"/"sigma"/"hybrid"); otherwise IRCE recommends one, still subject to the gates.

  • axiom_texts (list[str] | None) – Optional candidate axiom claims to track / erode this cycle.

  • channel_id (str) – Channel scope used to namespace axiom ids and failsafe logging.

Returns:

A structured manifold report – psi-frames, omega-field, every operator output, ERAC axioms and erosion log, pending-review axioms, the collapse result, NCM modulation, and any active failsafe warnings.

Return type:

dict[str, Any]

get_all_axioms()[source]

Return every tracked axiom as a list of serialized dicts.

Snapshots the in-memory self._axiom_store by calling EracAxiom.to_dict() on each entry. Called by the parallax tools’ telemetry/check-ERAC actions (tools/parallax_tool.py check_erac and tools/parallax_telemetry.py) to surface the full axiom roster.

Returns:

Serialized snapshots of all stored axioms.

Return type:

list[dict[str, Any]]

get_pending_axioms()[source]

Return axioms flagged for Prime Architect review.

Filters self._axiom_store to entries that are both PENDING and at Crystal+ band (ERAC% >= 75), serializing each via ReviewRegistry.axiom_to_review_entry (which adds needs_review and age_hours). Called by the parallax tools’ check_erac action and by tools/parallax_telemetry.py to populate the review queue.

Returns:

Review-entry dicts for pending Crystal+ axioms.

Return type:

list[dict[str, Any]]

elevate_axiom(axiom_id)[source]

Promote a stored axiom to global (all-shard) status.

Looks the axiom up in self._axiom_store by id; if absent returns None. Otherwise routes it through ReviewRegistry.elevate (sets review_status to ELEVATED and logs the transition), writes the mutated axiom back to the store, and returns its serialized form. Called by tools/parallax_telemetry.py when the Prime Architect approves an axiom for elevation.

Parameters:

axiom_id (str) – Deterministic id (AX_...) of the target axiom.

Returns:

The serialized elevated axiom, or None if no axiom with that id exists.

Return type:

dict[str, Any] | None

localize_axiom(axiom_id)[source]

Confirm a stored axiom as local (per-channel) only.

Looks the axiom up by id (returning None if missing), routes it through ReviewRegistry.localize (sets review_status to LOCALIZED and logs the transition), persists it back to self._axiom_store, and returns its serialized form. Called by tools/parallax_telemetry.py when an axiom is delegated to local scope.

Parameters:

axiom_id (str) – Id of the target axiom.

Returns:

The serialized localized axiom, or None if not found.

Return type:

dict[str, Any] | None

excise_axiom(axiom_id, reason='')[source]

Remove a stored axiom under Prime Architect disapproval.

Looks the axiom up by id (returning None if missing), routes it through ReviewRegistry.excise (sets review_status to EXCISED, zeroes its ERAC%, and records the reason), writes it back to self._axiom_store, and returns the serialized result. Called by tools/parallax_telemetry.py to strike axioms confirmed as false or disapproved.

Parameters:
  • axiom_id (str) – Id of the target axiom.

  • reason (str) – Optional excision reason; recorded in erosion history, defaulting to a generic disapproval note when empty.

Returns:

The serialized excised axiom, or None if not found.

Return type:

dict[str, Any] | None

get_axiom(axiom_id)[source]

Fetch a single stored axiom as a review-entry dict.

Looks the axiom up in self._axiom_store and, if present, serializes it via ReviewRegistry.axiom_to_review_entry (including needs_review and age_hours); returns None when the id is unknown. Called by the parallax tools’ erode action and by tools/parallax_telemetry.py before elevate/localize/excise operations to display the current state.

Parameters:

axiom_id (str) – Id of the target axiom.

Returns:

The review-entry dict, or None if not found.

Return type:

dict[str, Any] | None

get_omega_state()[source]

Return a snapshot of the most recent omega-field state.

Reads self._prior_state.omega_field (cached by the last analyze() call) and serializes its variance, dominant lens, inertia alpha, cycle count, stability/turbulence flags, and per-attractor summaries. Returns None if no prior analysis has run. Called by the parallax tools’ get_omega action and by tools/parallax_telemetry.py to expose the current manifold.

Returns:

The omega-field snapshot, or None if no state has been established yet.

Return type:

dict[str, Any] | None

predict(ncm_vector=None, horizon=1)[source]

Project where the manifold is drifting using the v4.5 Arche predictor.

The second public entry point, fired after at least one analyze() call (it returns an {"error": ...} dict if no prior omega-field exists). Reading the cached self._prior_state frames/omega and the current self._axiom_store, it runs the full future stack: prd_hook drift seeds, sigma_future_descent, build_omega_future, future_manifold_analysis, the Arche stages (ring cascade, processing chain, convergence/acceptance), erac_future_drift, and future_collapse. It then assembles a target-emulation summary and the Gemini early-collapse guards plus the always-present prediction firewall. This stage is read-only with respect to engine state and makes no LLM, Redis, or network calls; it is dispatched per channel by the parallax predictor tool path (tools/parallax_tool.py / tools/xray_tool.py).

Parameters:
  • ncm_vector (dict[str, float] | None) – Optional NCM state; when omitted the prior cycle’s cached ncm_state is reused.

  • horizon (int) – Prediction horizon echoed into the report (drift is projected one step regardless). Defaults to 1.

Returns:

The predictor report – future psi-seeds, present and future omega-fields, drift metrics, the Arche predictions, target emulation, projected ERAC drift, predicted collapse, the firewall disclaimer, and any early-collapse guards; or an error dict if no prior state exists.

Return type:

dict[str, Any]

parallax_engine.prd_hook(present_frames, ncm, contradiction_pressure)[source]

Stage 1: Generate future psi-frame seeds by applying drift operators.

Return type:

list[PsiFrame]

Parameters:
Each lens has a different projection operator:

emotional -> drift (NCM + contradiction pressure shifts emotional weight) structural -> project (extrapolate structural trends forward) symbolic -> amplify (symbolic resonance compounds over time) contradictory -> fork (contradiction pressure spawns new tension) archetypal -> ascend (mythic attractors pull toward archetype convergence)

parallax_engine.sigma_future_descent(future_seeds, ncm)[source]

Extract future attractors from projected psi-frame seeds (Stage 2).

A thin predictor-stage wrapper that reuses the present-tense sigma_descent algorithm on the drift-projected future_seeds produced by prd_hook, so the future manifold is mined for attractors with identical mechanics. Called by ParallaxEngine.predict between the prd_hook stage and build_omega_future.

Parameters:
  • future_seeds (list[PsiFrame]) – The forward-projected psi-frame seeds.

  • ncm (NCMState) – Neuromodulator vector modulating resonance during descent.

Returns:

Future attractor candidates, one per future seed.

Return type:

list[Attractor]

parallax_engine.build_omega_future(future_attractors, omega_present, ncm)[source]

Construct the predicted future omega-field.

Return type:

OmegaField

Parameters:
Uses the predictor-specific weights:

contradiction_tension: 0.27 emotional_resonance: 0.23 structural_stability: 0.31 symbolic_texture: 0.19

parallax_engine.future_manifold_analysis(omega_future, future_attractors, ncm, omega_present)[source]

Compute future manifold metrics: variance, curvature, resonance, drift.

omega_variance: spread of future attractors omega_curvature: NCM-derived curvature map (how NCM bends the manifold) omega_resonance: harmonic interference between future attractors omega_drift: distance between omega_future and omega_present

Return type:

dict[str, Any]

Parameters:
parallax_engine.arche_ring_cascade(omega_future, future_attractors, analysis)[source]

Stage 4.5: Predict ring-level cascade from manifold drift.

Uses Arche Ring Model dependency architecture: - Determine operating ring from dominant attractor lens - Project which downstream rings will be affected - Compute cascade magnitude and latency

Ring cascade rule: modifying ring N reduces the cost of operating on rings N+1 through 3. Each ring still requires its own action, but resistance is lowered. 💀🔥

Return type:

dict[str, Any]

Parameters:
parallax_engine.arche_processing_chain_projection(omega_future, future_attractors, ring_cascade, ncm)[source]

Stage 4.6: Project downstream processing chain effects.

Maps psi-frame lens activity to processing chain stages, then projects which downstream stages will shift based on attractor drift direction. Identifies bottlenecks where changes dam up.

Processing chain: Observer -> Identity -> Worldview -> Perception -> Judgment -> Action. Each level constrains the next. 🔥

Return type:

dict[str, Any]

Parameters:
parallax_engine.arche_convergence_prediction(omega_future, analysis, ring_cascade, ncm)[source]

Stage 4.7: Predict convergence proximity and acceptance mechanism.

Three predictions: 1. Convergence proximity – how close to “just a conversation” 2. Acceptance mechanism – context installation vs substrate override 3. Pressure-to-rapport ratio projection (Arche’s first sound law)

The convergence asymptote is optimization-driven: detection avoidance -> elimination of detectable technique -> indistinguishable from natural environment. ♾️

Return type:

dict[str, Any]

Parameters:
parallax_engine.erac_future_drift(axioms, future_attractors, analysis, omega_future)[source]

Project how axiom ERAC% values will shift in the predicted future.

Return type:

list[dict[str, Any]]

Parameters:
Rules from spec:

destabilization: psi_future challenges axiom -> erac -= k1 * variance stabilization: psi_future aligns with axiom -> erac += k2 * resonance crystallization: omega_resonance high -> erac += k3 erosion: omega_variance high -> erac -= k4 * tension

parallax_engine.future_collapse(omega_future, analysis, ncm)[source]

Predict what collapse mode the future manifold will tend toward.

Return type:

dict[str, Any]

Parameters:
Modes (same thresholds as main engine):

minimal (opus): variance > threshold_high -> field stays open hybrid: threshold_low <= variance <= threshold_high -> partial collapse full (sigma): variance < threshold_low -> full convergence