๐ฌ Veritas Engine (DSE โ Data Signal Engine)
Last Updated: March 23, 2026 12:00 UTC
Signal quality validation, regime detection and confidence aggregation. The epistemic gatekeeper before data reaches downstream scoring engines.
๐ฏ What it does
-
๐งช Signal quality analysis: scores each entity across 5 quality dimensions (completeness, z-consistency, freshness, sample adequacy, outlier score)
-
๐ Regime detection: classifies the universe health as
normal / stress / crisisbased on aggregate signal quality -
๐งฎ Confidence aggregation: produces a validated
VeritasEngineOutputwith per-entity diagnostics and an overall run confidence -
๐ฅ Flagging: marks entities as
incomplete_features,outlier,low_sample_size, orstale_data -
โ๏ธ Epistemic layer: Truth / Governance (Reason family)
-
๐ก๏ธ Mandate: guarantee that downstream engines (Neural Engine, Horizon Engine) only consume validated signal data
-
๐ฆ Outputs:
VeritasEngineOutput,List[SignalQuality],RegimeState(no I/O in LIVELLO 1)
๐ Charter (mandate + non-goals)
โ Mandate
- Score every entity in the input universe across quality dimensions
- Detect the collective regime of the data universe (normal / stress / crisis)
- Emit a frozen, auditable output that upstream services can trust and store
- Never modify input data โ Veritas observes, does not mutate
๐ซ Non-goals
- no writes in LIVELLO 1 (no DB, no Qdrant, no StreamBus)
- not a data-cleaning service โ does not impute or interpolate missing values
- not a pre-processing engine โ does not normalize or transform features
- does not decide business outcomes โ it assesses data readiness only
๐ Interfaces
- HTTP (LIVELLO 2):
services/api_veritas_engine/exposesPOST /validate,GET /health - Cognitive Bus (LIVELLO 2): adapters emit
veritas.validation.completed,veritas.signal.flagged,veritas.regime.detected - Governance thresholds: configurable via
QUALITY_PROFILEenv var (default/strict/relaxed)
๐ก Event contract (Cognitive Bus)
Defined in vitruvyan_core/core/governance/veritas_engine/events/channels.py:
| Event | Direction | Meaning |
|---|---|---|
veritas.validation.requested | inbound | trigger a new validation run |
veritas.validation.completed | outbound | full output ready |
veritas.signal.flagged | outbound | one or more entities have quality flags |
veritas.regime.detected | outbound | regime classification emitted |
veritas.batch.processed | outbound | batch summary metrics |
๐งฉ Code map
- LIVELLO 1 (pure, no I/O):
vitruvyan_core/core/governance/veritas_engine/- Consumers:
consumers/quality_analyzer.py,consumers/regime_detector.py,consumers/confidence_aggregator.py - Domain objects:
domain/objects.py(SignalValidationRequest,EntityQualityDiagnostic,RegimeIndicators,ValidationSummary) - Governance:
governance/thresholds.py(QualityThresholds,DEFAULT_THRESHOLDS,STRICT_THRESHOLDS,RELAXED_THRESHOLDS) - Events:
events/channels.py - Monitoring:
monitoring/metrics.py(14 metric name constants)
- Consumers:
- LIVELLO 2 (service + adapters + I/O):
services/api_veritas_engine/- HTTP routes:
api/routes.py - Bus orchestration:
adapters/bus_adapter.py - Persistence (audit log):
adapters/persistence.py
- HTTP routes:
๐ Pipeline (happy path)
๐งช Validation run
POST /validate
โ
โผ
VeritasBusAdapter.run_validation()
โ
โโ 1. quality_analyzer.analyze_signal_quality(entity_ids, features, thresholds)
โ โ List[SignalQuality] (per-entity: score + flags)
โ
โโ 2. regime_detector.detect_regime(qualities, raw_features, thresholds)
โ โ RegimeState (normal | stress | crisis + score)
โ
โโ 3. confidence_aggregator.aggregate_validation(run_id, profile, qualities, regime)
โ VeritasEngineOutput (frozen, auditable)
โ
โโ emit veritas.validation.completed
โโ emit veritas.regime.detected
โโ HTTP response โ ValidationRunResponse๐ค Consumers (LIVELLO 1)
๐งช quality_analyzer โ per-entity scoring
- File:
vitruvyan_core/core/governance/veritas_engine/consumers/quality_analyzer.py - Entry:
analyze_signal_quality(entity_ids, features, thresholds) โ List[SignalQuality]
Quality dimensions (weighted sum โ [0.0, 1.0]):
| Dimension | Weight | Description |
|---|---|---|
completeness | 0.25 | ratio of present vs expected features |
z_consistency | 0.20 | inverse stddev of z-scored values (rewarded for stability) |
freshness | 0.20 | recency of last data point (staleness_days โ decay) |
sample_adequacy | 0.20 | ratio of actual_samples / min_samples |
non_outlier | 0.15 | 1 - outlier_probability |
Flags emitted when score falls below threshold:
incomplete_featuresโ completeness <low_thresholdoutlierโ outlier_probability > 0.5low_sample_sizeโ sample_adequacy <medium_thresholdstale_dataโ staleness_days > 30
๐ regime_detector โ universe regime
- File:
vitruvyan_core/core/governance/veritas_engine/consumers/regime_detector.py - Entry:
detect_regime(qualities, raw_features, thresholds) โ RegimeState
Regime score formula (โ normal / stress / crisis):
| Component | Weight | Source |
|---|---|---|
| volatility | 0.35 | std of entity quality scores |
| dispersion | 0.25 | IQR / median quality |
| low signal density | 0.25 | fraction of flagged entities |
| low freshness | 0.15 | fraction of stale entities |
Classification:
normalโ regime_score < 0.35stressโ 0.35 โค score < 0.65crisisโ score โฅ 0.65
๐งฎ confidence_aggregator โ final output assembly
- File:
vitruvyan_core/core/governance/veritas_engine/consumers/confidence_aggregator.py - Entry:
aggregate_validation(run_id, profile, qualities, regime) โ VeritasEngineOutput - Helper:
build_run_id(prefix="ve") โ str
Produces VeritasEngineOutput (from contracts.schemas):
run_id,profile,entity_count,qualities,regime,overall_confidence,diagnostics,produced_at
overall_confidence = mean of per-entity quality scores.
โ๏ธ Governance: Quality Thresholds
Frozen dataclass QualityThresholds (file: governance/thresholds.py):
| Preset | high | medium | low | Use case |
|---|---|---|---|---|
DEFAULT_THRESHOLDS | 0.80 | 0.60 | 0.40 | standard production |
STRICT_THRESHOLDS | 0.90 | 0.70 | 0.50 | regulated / audit |
RELAXED_THRESHOLDS | 0.70 | 0.50 | 0.30 | exploratory / dev |
Activate via env var: QUALITY_PROFILE=strict|relaxed (default: default).
๐ Integration with other engines
| Engine | Integration |
|---|---|
| Neural Engine | Veritas output can gate NE input: proceed only if overall_confidence โฅ threshold and regime โ crisis |
| Horizon Engine | Veritas regime classification feeds Horizon's doctrine selection (e.g. crisis โ defensive) |
| Orthodoxy Wardens | Veritas diagnostics shipped as evidence for audit chain |
๐งช Tests
- Unit tests:
vitruvyan_core/core/governance/veritas_engine/tests/test_veritas_livello1.py(11 tests) - Run:
pytest vitruvyan_core/core/governance/veritas_engine/tests/ -v - All tests are pure Python โ no Docker / Redis / Postgres required
๐ฆ vit package
- Package descriptor:
service-veritas-engine.vit(root ofvitruvyan-core) - Install:
vit install service-veritas-engine