Skip to content

Commit b2aa29a

Browse files
committed
feat(intelligence): ADR-043 External Intelligence Providers for SONA Learning
Implement trait-based IntelligenceProvider extension point for external quality signals. Addresses PR #190 proposal (renumbered from ADR-029 to avoid collision with existing ADR-029-rvf-canonical-format). - IntelligenceProvider trait with load_signals() and quality_weights() - FileSignalProvider built-in for JSON file-based signal exchange - IntelligenceLoader for multi-provider registration and aggregation - QualitySignal, QualityFactors, ProviderQualityWeights types - calibration_bias() on TaskComplexityAnalyzer for router feedback - 12 unit tests (all passing) Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent 4405843 commit b2aa29a

4 files changed

Lines changed: 782 additions & 0 deletions

File tree

crates/ruvllm/src/claude_flow/model_router.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,29 @@ impl TaskComplexityAnalyzer {
657657
}
658658
}
659659

660+
/// Returns signed calibration error.
661+
///
662+
/// Positive value = systematically over-predicting complexity,
663+
/// negative value = systematically under-predicting.
664+
/// Returns 0.0 if no feedback has been recorded.
665+
pub fn calibration_bias(&self) -> f32 {
666+
let with_feedback: Vec<_> = self
667+
.accuracy_history
668+
.iter()
669+
.filter(|r| r.actual.is_some())
670+
.collect();
671+
672+
if with_feedback.is_empty() {
673+
return 0.0;
674+
}
675+
676+
let sum: f32 = with_feedback
677+
.iter()
678+
.map(|r| r.predicted - r.actual.unwrap())
679+
.sum();
680+
sum / with_feedback.len() as f32
681+
}
682+
660683
/// Get accuracy statistics
661684
pub fn accuracy_stats(&self) -> AnalyzerStats {
662685
let with_feedback: Vec<_> = self

0 commit comments

Comments
 (0)