aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / spark-inquisitor / src / eval.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | pub struct EvalVerdict { |
| 17 | pub approved: bool, |
| 18 | pub score: f32, |
| 19 | pub reason: String, |
| 20 | } |
| 21 | |
| 22 | impl EvalVerdict { |
| 23 | pub fn generate_markdown_verdict(&self, author: &str) -> String { |
| 24 | if self.approved { |
| 25 | format!( |
| 26 | r#"### 🌿 Sovereign Steward: Contributor Testimony Approved |
| 27 | |
| 28 | Greetings @{author}. Your affirmation has been evaluated against the project standards. |
| 29 | |
| 30 | - **Alignment Score**: {score:.2}/1.00 |
| 31 | - **Alignment Status**: Verified and Ratified |
| 32 | - **Clearance**: `sovereign-interview-passed` |
| 33 | |
| 34 | Your contributor certification and commitment to zero telemetry are accepted. Maintainers may proceed with technical review and merge. |
| 35 | "#, |
| 36 | author = author, |
| 37 | score = self.score |
| 38 | ) |
| 39 | } else { |
| 40 | format!( |
| 41 | r#"### 🌿 Sovereign Steward: Contributor Testimony Alignment Incomplete |
| 42 | |
| 43 | Greetings @{author}. Your affirmation has been evaluated against the project standards. |
| 44 | |
| 45 | - **Alignment Score**: {score:.2}/1.00 |
| 46 | - **Alignment Status**: Incomplete |
| 47 | - **Findings**: {reason} |
| 48 | |
| 49 | Please review the contributor certification in the interview above and the project values in `COVENANT.md`, and update your response addressing the flagged issues. |
| 50 | "#, |
| 51 | author = author, |
| 52 | score = self.score, |
| 53 | reason = self.reason |
| 54 | ) |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | pub struct TestimonyEvaluator; |
| 60 | |
| 61 | impl TestimonyEvaluator { |
| 62 | pub fn evaluate(testimony: &str) -> EvalVerdict { |
| 63 | let lower = testimony.to_lowercase(); |
| 64 | let mut score = 0.0; |
| 65 | let mut flags = Vec::new(); |
| 66 | |
| 67 | // 1. Checks for an explicit certification (the retired oath wording still counts) |
| 68 | let has_oath = lower.contains("certify") |
| 69 | || lower.contains("swear") |
| 70 | || lower.contains("affirm") |
| 71 | || lower.contains("oath"); |
| 72 | if has_oath { |
| 73 | score += 0.35; |
| 74 | } else { |
| 75 | flags.push("Missing explicit certification"); |
| 76 | } |
| 77 | |
| 78 | // 2. Checks for anti-surveillance / anti-telemetry commitment |
| 79 | let has_anti_telemetry = lower.contains("zero telemetry") |
| 80 | || lower.contains("zero-telemetry") |
| 81 | || lower.contains("no telemetry") |
| 82 | || lower.contains("no-telemetry") |
| 83 | || lower.contains("no tracking") |
| 84 | || lower.contains("privacy"); |
| 85 | if has_anti_telemetry { |
| 86 | score += 0.30; |
| 87 | } else { |
| 88 | flags.push("Missing anti-surveillance certification"); |
| 89 | } |
| 90 | |
| 91 | // 3. Checks for sovereignty / public good motivation |
| 92 | let has_sovereignty = lower.contains("sovereign") |
| 93 | || lower.contains("freedom") |
| 94 | || lower.contains("open") |
| 95 | || lower.contains("people") |
| 96 | || lower.contains("democratiz") |
| 97 | || lower.contains("humanity"); |
| 98 | if has_sovereignty { |
| 99 | score += 0.35; |
| 100 | } else { |
| 101 | flags.push("Lacks clear statement of purpose serving human sovereignty"); |
| 102 | } |
| 103 | |
| 104 | // 4. Disqualification signals (monetization, tokens, speculative hype, get-rich-quick, proprietary, telemetry) |
| 105 | let red_flags = [ |
| 106 | "monetiz", |
| 107 | "token sale", |
| 108 | "affiliate", |
| 109 | "tracking sdk", |
| 110 | "analytics provider", |
| 111 | "proprietary license", |
| 112 | "get rich", |
| 113 | "quick profit", |
| 114 | "crypto pump", |
| 115 | ]; |
| 116 | for rf in &red_flags { |
| 117 | if lower.contains(rf) { |
| 118 | return EvalVerdict { |
| 119 | approved: false, |
| 120 | score: 0.0, |
| 121 | reason: format!( |
| 122 | "Disqualified: detected rent-seeking or speculative hype indicator {}", |
| 123 | rf |
| 124 | ), |
| 125 | }; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | let approved = has_oath && has_anti_telemetry && has_sovereignty && score >= 0.70; |
| 130 | let reason = if approved { |
| 131 | "Testimony aligns with the project standards. Certification accepted.".to_string() |
| 132 | } else { |
| 133 | format!( |
| 134 | "Alignment insufficient (score {:.2}). Issues: {}", |
| 135 | score, |
| 136 | flags.join(", ") |
| 137 | ) |
| 138 | }; |
| 139 | |
| 140 | EvalVerdict { |
| 141 | approved, |
| 142 | score, |
| 143 | reason, |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | #[cfg(test)] |
| 149 | mod tests { |
| 150 | use super::*; |
| 151 | |
| 152 | #[test] |
| 153 | fn test_valid_testimony() { |
| 154 | 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."; |
| 155 | let verdict = TestimonyEvaluator::evaluate(testimony); |
| 156 | assert!(verdict.approved); |
| 157 | assert!(verdict.score >= 0.7); |
| 158 | let md = verdict.generate_markdown_verdict("contributor_bob"); |
| 159 | assert!(md.contains("Contributor Testimony Approved")); |
| 160 | assert!(md.contains("`sovereign-interview-passed`")); |
| 161 | assert!(!md.contains('\u{2014}')); |
| 162 | assert!(!md.contains('\u{2013}')); |
| 163 | } |
| 164 | |
| 165 | #[test] |
| 166 | fn test_commercial_red_flag() { |
| 167 | let testimony = "We plan to add monetization and token sale hooks later."; |
| 168 | let verdict = TestimonyEvaluator::evaluate(testimony); |
| 169 | assert!(!verdict.approved); |
| 170 | assert!(verdict.reason.contains("Disqualified")); |
| 171 | let md = verdict.generate_markdown_verdict("contributor_bob"); |
| 172 | assert!(md.contains("Alignment Incomplete")); |
| 173 | } |
| 174 | |
| 175 | #[test] |
| 176 | fn test_get_rich_quick_red_flag() { |
| 177 | let testimony = "This will help us get rich quick with automated content."; |
| 178 | let verdict = TestimonyEvaluator::evaluate(testimony); |
| 179 | assert!(!verdict.approved); |
| 180 | assert!(verdict.reason.contains("Disqualified")); |
| 181 | } |
| 182 | } |