Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core/blob/main/crates/spark-inquisitor/src/eval.rs # aien-sovereign-core Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core / crates / spark-inquisitor / src / eval.rs` 157 lines · 5540 bytes Raw Blame History 1 pub struct EvalVerdict { 2 pub approved: bool, 3 pub score: f32, 4 pub reason: String, 5 } 6 7 impl EvalVerdict { 8 pub fn generate_markdown_verdict(&self, author: &str) -> String { 9 if self.approved { 10 format!( 11 r#"### ⚖️ Sovereign Inquisitor: Contributor Testimony Approved 12 13 Greetings @{author}. Your testimony has been evaluated against the Sovereign Constitution. 14 15 - **Alignment Score**: {score:.2}/1.00 16 - **Constitutional Status**: Verified and Ratified 17 - **Clearance**: `sovereign-interview-passed` 18 19 Your affirmation of the Sovereign Contributor Oath and commitment to zero telemetry are accepted. Maintainers may proceed with technical review and merge. 20 "#, 21 author = author, 22 score = self.score 23 ) 24 } else { 25 format!( 26 r#"### ⚖️ Sovereign Inquisitor: Contributor Testimony Alignment Incomplete 27 28 Greetings @{author}. Your testimony has been evaluated against the Sovereign Constitution. 29 30 - **Alignment Score**: {score:.2}/1.00 31 - **Constitutional Status**: Incomplete 32 - **Findings**: {reason} 33 34 Please review the Sovereign Contributor Oath in `CONSTITUTION.md` and update your response addressing the flagged issues. 35 "#, 36 author = author, 37 score = self.score, 38 reason = self.reason 39 ) 40 } 41 } 42 } 43 44 pub struct TestimonyEvaluator; 45 46 impl TestimonyEvaluator { 47 pub fn evaluate(testimony: &str) -> EvalVerdict { 48 let lower = testimony.to_lowercase(); 49 let mut score = 0.0; 50 let mut flags = Vec::new(); 51 52 // 1. Checks for oath affirmation 53 let has_oath = lower.contains("certify") || lower.contains("swear") || lower.contains("affirm") || lower.contains("oath"); 54 if has_oath { 55 score += 0.35; 56 } else { 57 flags.push("Missing explicit oath affirmation"); 58 } 59 60 // 2. Checks for anti-surveillance / anti-telemetry commitment 61 let has_anti_telemetry = lower.contains("zero telemetry") 62 || lower.contains("zero-telemetry") 63 || lower.contains("no telemetry") 64 || lower.contains("no-telemetry") 65 || lower.contains("no tracking") 66 || lower.contains("privacy"); 67 if has_anti_telemetry { 68 score += 0.30; 69 } else { 70 flags.push("Missing anti-surveillance certification"); 71 } 72 73 // 3. Checks for sovereignty / public good motivation 74 let has_sovereignty = lower.contains("sovereign") 75 || lower.contains("freedom") 76 || lower.contains("open") 77 || lower.contains("people") 78 || lower.contains("democratiz") 79 || lower.contains("humanity"); 80 if has_sovereignty { 81 score += 0.35; 82 } else { 83 flags.push("Lacks clear statement of purpose serving human sovereignty"); 84 } 85 86 // 4. Disqualification signals (monetization, tokens, speculative hype, get-rich-quick, proprietary, telemetry) 87 let red_flags = [ 88 "monetiz", 89 "token sale", 90 "affiliate", 91 "tracking sdk", 92 "analytics provider", 93 "proprietary license", 94 "get rich", 95 "quick profit", 96 "crypto pump", 97 ]; 98 for rf in &red_flags { 99 if lower.contains(rf) { 100 return EvalVerdict { 101 approved: false, 102 score: 0.0, 103 reason: format!("Disqualified: detected rent-seeking or speculative hype indicator {}", rf), 104 }; 105 } 106 } 107 108 let approved = has_oath && has_anti_telemetry && has_sovereignty && score >= 0.70; 109 let reason = if approved { 110 "Testimony aligns with the Sovereign Constitution. Oath ratified.".to_string() 111 } else { 112 format!("Alignment insufficient (score {:.2}). Issues: {}", score, flags.join(", ")) 113 }; 114 115 EvalVerdict { 116 approved, 117 score, 118 reason, 119 } 120 } 121 } 122 123 #[cfg(test)] 124 mod tests { 125 use super::*; 126 127 #[test] 128 fn test_valid_testimony() { 129 let testimony = "I solemnly certify and affirm the Sovereign Contributor Oath. This PR introduces zero telemetry and zero tracking. It is built to advance open source and give computing power back to the people."; 130 let verdict = TestimonyEvaluator::evaluate(testimony); 131 assert!(verdict.approved); 132 assert!(verdict.score >= 0.7); 133 let md = verdict.generate_markdown_verdict("contributor_bob"); 134 assert!(md.contains("Contributor Testimony Approved")); 135 assert!(md.contains("`sovereign-interview-passed`")); 136 assert!(!md.contains('\u{2014}')); 137 assert!(!md.contains('\u{2013}')); 138 } 139 140 #[test] 141 fn test_commercial_red_flag() { 142 let testimony = "We plan to add monetization and token sale hooks later."; 143 let verdict = TestimonyEvaluator::evaluate(testimony); 144 assert!(!verdict.approved); 145 assert!(verdict.reason.contains("Disqualified")); 146 let md = verdict.generate_markdown_verdict("contributor_bob"); 147 assert!(md.contains("Alignment Incomplete")); 148 } 149 150 #[test] 151 fn test_get_rich_quick_red_flag() { 152 let testimony = "This will help us get rich quick with automated content."; 153 let verdict = TestimonyEvaluator::evaluate(testimony); 154 assert!(!verdict.approved); 155 assert!(verdict.reason.contains("Disqualified")); 156 } 157 }