Dual-math systemic integrity scoring. One function in, decision vector out.
Zero dependencies. Pure Rust. No I/O. No side effects. No runtime.
Scores a 4×3 matrix of verification signals (values in [0, 1]) using two independent metrics:
- Metric A (additive): context-weighted compliance level + frozen-weight velocity. Answers "how compliant do we look, and is it getting better or worse?"
- Metric B (multiplicative): geometric-per-row, harmonic-across-rows, spectrally adjusted. Answers "how solid are we actually, given that one collapsed area dominates the aggregate?"
The product of compliance and integrity deficit is the Watermelon Index — a one-sided deception detector that fires only when the rind is green and the flesh is red.
[dependencies]
voidmetric-core = "1.0"
use voidmetric_core::{run_scoring_engine, PaddedStreamNode};
let nodes = vec![
PaddedStreamNode { masked_value: 0.85, row: 0, col: 0, last_telemetry_heartbeat: 1756977600 },
// ... 12 nodes total (4 rows × 3 cols)
];
let now = 1_756_977_600;
let result = run_scoring_engine(now, &nodes, [0.2, 0.1, 0.0], None, None, None, None);
println!("{:?}", result.status); // Nominal | CriticalRiskSwitchTriggered
println!("{}", result.watermelon_index); // 0.0 – 1.0 (deception detector)
pub fn run_scoring_engine(
now: i64,
padded_stream: &[PaddedStreamNode],
threat_intel: [f64; 3],
previous_stream: Option<&[PaddedStreamNode]>,
previous_threat_intel: Option<[f64; 3]>,
params: Option<EngineParams>,
has_ever_reported: Option<[[bool; 3]; 4]>,
) -> ScoringResult
| Parameter | Type | Description |
|---|---|---|
now |
i64 |
Current time in epoch seconds. The function is deterministic given the same now. |
padded_stream |
&[PaddedStreamNode] |
12 nodes. Each: masked_value [0,1], row 0–3, col 0–2, last_telemetry_heartbeat (epoch seconds). |
threat_intel |
[f64; 3] |
Threat-intelligence vector. Each value ∈ [0,1]. [0.0, 0.0, 0.0] = baseline. |
previous_stream |
Option<&[PaddedStreamNode]> |
Previous block for velocity computation. |
previous_threat_intel |
Option<[f64; 3]> |
Previous threat vector for frozen-weight velocity. Falls back to current if None. |
params |
Option<EngineParams> |
Override any default. See below. |
has_ever_reported |
Option<[[bool; 3]; 4]> |
Per-cell flag. Cells that have never reported are excluded; weights re-normalize. None = all 12 cells active. |
| Field | Type | Description |
|---|---|---|
metric_a_compliance |
f64 |
Additive compliance level [0, 1]. |
metric_a_velocity |
Option<f64> |
Laspeyres frozen-weight delta. None if no previous stream. |
metric_b_integrity |
f64 |
Multiplicative integrity (SI_Live) [0, 1]. |
status |
Status |
Nominal or CriticalRiskSwitchTriggered. |
watermelon_index |
f64 |
A × (1 − B). Deception detector. |
honest_failure_index |
f64 |
(1 − A) × (1 − B). Visible failure, no deception. |
row_validations |
[f64; 4] |
Per-row geometric product. Lowest row = investigate first. |
spectral_analysis |
SpectralAnalysis |
{ chaos_index_penalty, principal_eigenvalue, resonance_exploit_chain_detected }. |
temporal |
Option<TemporalAnalysis> |
None in v1.0. Multi-block support planned. |
alpha_vector |
[f64; 4] |
The domain weights that produced this result. |
threat_intel_stale |
bool |
true when threat vector is all zeros (baseline). |
threat_vector_anomaly |
bool |
true when the threat vector shifted >30% between cycles. |
| Symbol | Default | Description |
|---|---|---|
priority_alpha |
[0.50, 0.30, 0.15, 0.05] |
Domain priority weights (sum = 1). |
base_enabler_weights |
[0.4, 0.3, 0.3] |
Base enabler column weights. |
decay_rate |
0.005 |
Linear confidence bleed per hour. |
drift_volatility |
0.04 |
Deterministic aging spread coefficient (√dt scaling). |
sigmoid_steepness |
10.0 |
Sigmoid k. |
sigmoid_midpoint |
0.5 |
Sigmoid x₀. |
chaos_scale |
0.25 |
Spectral penalty scaling (κ). |
status_threshold |
0.20 |
CRITICAL trigger on SI_Live. |
resonance_threshold |
0.15 |
Resonance flag trigger on ChaosPenalty. |
breaker_threshold |
0.05 |
Risk Switch trip when any sigmoid-output C_{i,j} falls below this. |
breaker_floor |
0.015 |
Risk Switch cap on SI_Live (SI_floor). |
si_live_floor |
0.0001 |
Numerical floor preventing ln(0) in the row-validation log-sum. |
These are enforced by the math, not by configuration:
- One critical signal cannot be diluted. If any C_{i,j} <
breaker_threshold, SI_Live is capped atbreaker_floor. Full stop. - The tiling identity holds on every cycle.
watermelon_index + honest_failure_index = 1 − metric_b_integrity. Always. Assertable in tests. - The spectral check has no structural blind spot. Four deficit vectors in ℝ³ cannot be mutually orthogonal. Correlated multi-domain failure is always detectable.
- Scope exclusion is structural. Cells that have never reported are excluded from the matrix. Weights re-normalize across active cells. A "0.5 neutral" does not mask a coverage gap.
- The breaker operates on sigmoid output. The threshold applies to C_{i,j} (post-sigmoid), not to raw input. The input-space equivalent is a deterministic function of k, x₀, and the threshold value.
- The threat feed's health is in the output.
threat_intel_staleandthreat_vector_anomalyare emitted on every cycle. No operator vigilance required. - The weights are in the output.
alpha_vectoris in everyScoringResult. The score is always interpretable relative to the weights that produced it.
use voidmetric_core::{run_scoring_engine, PaddedStreamNode};
let now = 1_756_977_600;
let result = run_scoring_engine(now, &nodes, [0.0, 0.0, 0.0], None, None, None, None);
let residual = (result.watermelon_index + result.honest_failure_index - (1.0 - result.metric_b_integrity)).abs();
assert!(residual < 1e-4);
If this fails, the math is broken. It should never fail.
Each raw signal passes through three stages before entering the matrix:
- Temporal decay:
drifted = r − (0.005 × dt) − (0.04 × √dt). Older, unrefreshed signals degrade. - Sigmoid transform:
C = 1 / (1 + e^(−10 × (drifted − 0.5))). Bounded [0.0067, 0.9933]. - Matrix entry: C_{i,j} feeds both metrics. Metric A velocity uses the raw (pre-decay) value with frozen weights — a Laspeyres index, not a derivative.
npm install @voidmetric/core
Same math, same guarantees. Different runtime.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.