Parent macro-issue: #12
Depends on: #15 (Phase 2)
Goal
Implement two new IndexScoreProjector trait implementations that slot into IndexScorePhase alongside the existing TauModeScore, FeatureSpectralScore, and friends — with zero changes to the pipeline structure.
Both projectors consume the GeodesicIndex built in Phase 2 and emit scores that expose manifold curvature and worldline deviation as first-class signals.
Projector 1: GeodesicRigidityProjector
Semantic
Measures how much an item's neighbourhood violates TQF collinearity. A low score means the item sits on or near a rational geodesic (smooth, stable manifold region). A high score flags a locally curved or noisy region where the spectral signal is less reliable.
Algorithm
For item x with k-nearest neighbours {n₁, …, n_k}:
- For each pair
(n_i, n_j) with i < j, form the triple (x, n_i, n_j).
- Compute
Q₁ = Q(x, n_i), Q₂ = Q(x, n_j), Q₃ = Q(n_i, n_j).
- TQF residual:
R = |(Q₁+Q₂+Q₃)² − 2(Q₁²+Q₂²+Q₃²)|
- Score = mean(R) normalised by the 99th-percentile R over the corpus →
[0, 1].
Config
pub struct GeodesicRigidityConfig {
/// Number of neighbour pairs to sample per item. Default: all C(k,2) pairs.
pub max_pairs: Option<usize>,
/// Normalisation percentile. Default: 99.
pub norm_percentile: f32,
}
Use cases
- OOD detection: Items with unusually high rigidity score are in curved manifold pockets — candidates for OOD flagging alongside
TauModeScore.
- Laplacian coarsening: During graph coarsening, prefer to merge nodes with low rigidity score (they lie on geodesics and can be safely collapsed).
- Wiring diagnostics: Corpus-level rigidity distribution reveals whether the embedding manifold is globally smooth or patchy.
Projector 2: RationalWorldlineProjector
Semantic
Designed for BioChain, discrete-physics, and metamaterial environments where items are expected to follow known rational geodesics (e.g., stoichiometric trajectories, lattice paths, simulation worldlines). Items that deviate from their expected geodesic receive an elevated anomaly score — without any floating-point drift accumulation.
Algorithm
At index time:
- Load
GeodesicIndex (from Phase 2).
- For each item
x, find the nearest certified geodesic triple (i, j, k) from the GeodesicIndex.
- Compute the projection of
x onto the line segment [i, j] in quadrance terms:
proj = i + t*(j - i), t = Q(i,x) / Q(i,j) (clamped to [0,1])
worldline_quadrance(x) = Q(x, proj)
- Store
worldline_quadrance per item in the index.
At query time:
Return worldline_quadrance(x) as the score. No recomputation needed on warm index.
Config
pub struct RationalWorldlineConfig {
/// Maximum number of geodesic candidates to search per item. Default: 5.
pub geodesic_candidates: usize,
/// If true, use the integer quadrance path (requires QuadranceRational mode). Default: false.
pub exact_rational: bool,
}
Use cases
- BioChain anomaly detection: Metabolic or genomic state vectors that drift off expected reaction pathways get a non-zero worldline score in real-time, without accumulated floating-point error.
- Simulation trajectory validation: Physics sim items that leave their expected worldline (lattice path, geodesic) are flagged immediately.
- Complement to
TauModeScore: High λ (high Dirichlet energy) + high worldline quadrance → the item is both spectrally rough and off-trajectory — strong anomaly signal.
Trait implementation
Both projectors implement the existing trait:
impl IndexScoreProjector for GeodesicRigidityProjector {
fn project(&self, item: &EmbeddingVector, ctx: &IndexContext) -> f32;
fn name(&self) -> &'static str { "geodesic_rigidity" }
fn requires_geodesic_index(&self) -> bool { true }
}
impl IndexScoreProjector for RationalWorldlineProjector {
fn project(&self, item: &EmbeddingVector, ctx: &IndexContext) -> f32;
fn name(&self) -> &'static str { "rational_worldline" }
fn requires_geodesic_index(&self) -> bool { true }
}
IndexContext gains a geodesic_index: Option<&GeodesicIndex> field (None if WiringMode::Standard).
Tests
Acceptance criteria
Parent macro-issue: #12
Depends on: #15 (Phase 2)
Goal
Implement two new
IndexScoreProjectortrait implementations that slot intoIndexScorePhasealongside the existingTauModeScore,FeatureSpectralScore, and friends — with zero changes to the pipeline structure.Both projectors consume the
GeodesicIndexbuilt in Phase 2 and emit scores that expose manifold curvature and worldline deviation as first-class signals.Projector 1:
GeodesicRigidityProjectorSemantic
Measures how much an item's neighbourhood violates TQF collinearity. A low score means the item sits on or near a rational geodesic (smooth, stable manifold region). A high score flags a locally curved or noisy region where the spectral signal is less reliable.
Algorithm
For item
xwith k-nearest neighbours{n₁, …, n_k}:(n_i, n_j)withi < j, form the triple(x, n_i, n_j).Q₁ = Q(x, n_i),Q₂ = Q(x, n_j),Q₃ = Q(n_i, n_j).R = |(Q₁+Q₂+Q₃)² − 2(Q₁²+Q₂²+Q₃²)|[0, 1].Config
Use cases
TauModeScore.Projector 2:
RationalWorldlineProjectorSemantic
Designed for BioChain, discrete-physics, and metamaterial environments where items are expected to follow known rational geodesics (e.g., stoichiometric trajectories, lattice paths, simulation worldlines). Items that deviate from their expected geodesic receive an elevated anomaly score — without any floating-point drift accumulation.
Algorithm
At index time:
GeodesicIndex(from Phase 2).x, find the nearest certified geodesic triple(i, j, k)from theGeodesicIndex.xonto the line segment[i, j]in quadrance terms:worldline_quadranceper item in the index.At query time:
Return
worldline_quadrance(x)as the score. No recomputation needed on warm index.Config
Use cases
TauModeScore: Highλ(high Dirichlet energy) + high worldline quadrance → the item is both spectrally rough and off-trajectory — strong anomaly signal.Trait implementation
Both projectors implement the existing trait:
IndexContextgains ageodesic_index: Option<&GeodesicIndex>field (None ifWiringMode::Standard).Tests
dmust scored(within float tolerance).GeodesicRigidityScoredistribution is right-skewed (Shapiro-Wilk p < 0.01 for normality rejection); logged percentile breakdown.TauModeScorealone < 5 % on a warm CVE index.Acceptance criteria
GeodesicRigidityProjectorimplemented, tested, and registered inIndexScorePhase.RationalWorldlineProjectorimplemented, tested, and registered inIndexScorePhase.IndexContextextended withgeodesic_index: Option<&GeodesicIndex>.WiringMode::TqfAnnotated(no-op / zero score whenWiringMode::Standard).