dynamicsystemsarchitecture.org

Core Kernel & Pipeline Infrastructure

The state estimation kernel, the estimator interface, and the multi-stage pipeline runner — the three real files the Pipeline Orchestrator and the Reasoning Chain actually run on top of.

PurposeDocument the three foundational files other pages on this site reference constantly but never showed directly.
StatusVerified — kernel run fresh below; one real small bug found and noted in multi_stage_pipeline.py
Built fromDirect source review, kernel actually executed
Depends on
Superseded by
EvidenceReal execution output below; used directly by the Pipeline Orchestrator.

STATE_ESTIMATION_KERNEL_v8.py — the real kernel

The current core kernel: David Smith vectors V1-V9, cross-wiring synthesis across 20 real wirings, diagnostic generation, tilt detection integration (gracefully degrades when TiltDetector isn't available — try/except ImportError falls back to None rather than crashing), and regime-local confidence calibration. Real class name: WhiteboxStateEstimationKernel — not StateEstimationKernel, a mismatch the Pipeline Orchestrator originally had wrong.

class WhiteboxStateEstimationKernel:
    def estimate_state(self, system_id: str, system_data: Dict[str, Any]) -> StateEstimationResult:
        """Runs the real vector engine across V1-V9, cross-wires them,
        classifies a regime, and returns full provenance."""
        vector_readings = []
        for v_id in range(1, 10):
            value, confidence = self.vector_engine.compute_vector(v_id, system_data)
            vector_readings.append((v_id, value, confidence))
        # ... cross-wiring synthesis across 20 real wirings, then:
        regime = self._classify_regime(synthesized_channels)
        return StateEstimationResult(regime=regime, channels=synthesized_channels, ...)

Each of the 9 vectors gracefully degrades on missing data — real code, not aspirational:

if "spreads_bps" in data:
    spread_val = data["spreads_bps"]
    # ... real computation using it
else:
    return (0.0, 0.3)  # neutral value, low confidence -- not a crash

Real execution, run fresh

k = WhiteboxStateEstimationKernel()
r = k.estimate_state('TEST-001', {'spreads_bps': 45.0, 'volatility': 0.22, 'sentiment_bias': 0.15, 'past_returns': 3.2})
print('Regime:', r.regime.value)
print('Channels:', [(c['name'], round(c['aggregate_value'],4)) for c in r.channels])
>>> Regime: MATURING
>>> Channels: [('Strength', 0.1486), ('Dynamics', 0.1405), ('Interaction', -0.0165), ('Context', 0.1173)]

# Graceful degradation check -- completely empty input, should not crash
r2 = k.estimate_state('TEST-002', {})
print('Empty input regime:', r2.regime.value)
>>> Empty input regime: MATURING

Worth stating plainly rather than glossing over: the empty-input case returned the same regime (MATURING) as the populated case. That confirms the kernel doesn't crash on missing data — it doesn't, on its own, confirm the regime classification is meaningfully sensitive to real input variation. That's a separate, still-open question, not answered by this test.

base_estimator.py — the interface every estimator implements

Small, real, and exactly what it claims to be — no more, no less:

class BaseEstimator(ABC):
    """All estimators must implement:
    - fit(): Learn from data (can be a no-op for some estimators)
    - predict(): Return a dictionary with at least a 'score' key
    """
    def __init__(self, name: str):
        self.name = name

    @abstractmethod
    def fit(self, data: np.ndarray, **kwargs) -> None: ...

    @abstractmethod
    def predict(self, data: np.ndarray, **kwargs) -> Dict[str, Any]: ...

Only the abstract class has ever been uploaded to this site — no concrete estimator implementation exists yet. That's the real, current bottleneck on the whole pipeline, tracked on the Backtest-Only Audit.

multi_stage_pipeline.py — one real bug, found and noted

Records every stage's own channel decomposition unconditionally, in two trust modes: LIVE_GATE (a human approves each stage before advancing) and DEFERRED (runs straight through, but the same records still get generated — deferred means not checked live, not not recorded).

Real bug: the StageType enum has a stray DEFERRED member that doesn't belong to it — that value belongs conceptually to TrustMode, a copy-paste leftover:

class StageType(Enum):
    LINEAR = auto()
    FOUR_CHANNEL = auto()

    DEFERRED = auto()  # <- stray, unused, belongs to TrustMode not StageType

Harmless in practice — nothing reads it — but genuinely wrong, and worth fixing before it confuses a future reader into thinking a stage can be typed DEFERRED. Also found: a stale comment on TrustMode.DEFERRED claiming it was "never actually defined," directly contradicted by the line immediately below it defining it — a leftover note from before an earlier fix, never cleaned up.