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-mv/blob/main/crates/spark-adapters/src/curriculum.rs # 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 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-mv / crates / spark-adapters / src / curriculum.rs` 256 lines ยท 11083 bytes Raw Blame History 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 use crate::models::{DistillTask, TaskType, VerificationStrategy}; 17 use std::path::Path; 18 use std::process::Command; 19 use uuid::Uuid; 20 21 #[derive(Debug, Clone, Copy, PartialEq, Eq)] 22 pub enum CurriculumTrack { 23 NativeSystemsAndGpu, 24 AgentAgency, 25 ScientificReasoning, 26 GeneralFrontier, 27 DynamicMining, 28 } 29 30 impl CurriculumTrack { 31 pub fn parse(s: &str) -> Option { 32 match s.to_lowercase().as_str() { 33 "systems" | "native" | "gpu" | "cuda" => Some(CurriculumTrack::NativeSystemsAndGpu), 34 "agent" | "agency" | "tool" => Some(CurriculumTrack::AgentAgency), 35 "science" | "scientific" | "chemistry" => Some(CurriculumTrack::ScientificReasoning), 36 "frontier" | "general" | "algo" => Some(CurriculumTrack::GeneralFrontier), 37 "dynamic" | "mining" | "git" | "git_mining" | "git-mining" | "refactor" => { 38 Some(CurriculumTrack::DynamicMining) 39 } 40 _ => None, 41 } 42 } 43 44 pub fn display_name(&self) -> &'static str { 45 match self { 46 CurriculumTrack::NativeSystemsAndGpu => "Native Systems & GPU Engineering", 47 CurriculumTrack::AgentAgency => "Autonomous Agent Agency & Tool Contracts", 48 CurriculumTrack::ScientificReasoning => "Advanced Scientific & Technical Reasoning", 49 CurriculumTrack::GeneralFrontier => "General Frontier Capabilities & Systems Design", 50 CurriculumTrack::DynamicMining => "Dynamic Repository & Trace Mining", 51 } 52 } 53 } 54 55 pub struct CurriculumEngine; 56 57 impl CurriculumEngine { 58 /// Generate a batch of distillation tasks for the selected curriculum track. 59 pub fn generate_tasks( 60 track: CurriculumTrack, 61 limit: usize, 62 teacher: &str, 63 student: Option<&str>, 64 commit_to_cortex: bool, 65 ) -> Vec { 66 let (task_type, strategy, prompts) = match track { 67 CurriculumTrack::NativeSystemsAndGpu => ( 68 TaskType::CodeSynthesis, 69 VerificationStrategy::CompilerCheck, 70 vec![ 71 "Implement an allocation-free single-producer single-consumer ring buffer in Rust with acquire-release memory ordering.", 72 "Write a Rust FFI interface and layout descriptor for Blackwell Paged Attention key-value blocks.", 73 "Implement a zero-copy Ethernet and IPv4 packet header parser in pure safe Rust.", 74 "Write a thread-safe memory object pool with RAII reuse guard in Rust.", 75 "Implement a high-throughput bounded MPMC channel using atomic sequence indexes in Rust.", 76 ], 77 ), 78 CurriculumTrack::AgentAgency => ( 79 TaskType::VerificationHarness, 80 VerificationStrategy::CompilerCheck, 81 vec![ 82 "Design an autonomous agent state machine in Rust with states for Idle, Planning, ToolExecution, Verifying, and ErrorRecovery.", 83 "Implement a robust retry mechanism with exponential backoff, jitter, and classification of transient versus permanent errors.", 84 "Write a cryptographic execution receipt validator that verifies SHA-256 digests and provenance metadata.", 85 "Implement an audit logger for agent tool invocations enforcing least privilege and parameter masking.", 86 "Write a deterministic verification harness for testing multi-agent handoff receipts.", 87 ], 88 ), 89 CurriculumTrack::ScientificReasoning => ( 90 TaskType::ReasoningTrace, 91 VerificationStrategy::UnslopStrict, 92 vec![ 93 "Formulate the reaction kinetics and differential rate equations for a multi-step photocatalytic water splitting process on titanium dioxide.", 94 "Design a chemical formulation model for a moisture-curing room-temperature vulcanizing silicone sealant, detailing polymer backbone, crosslinker, and catalyst.", 95 "Derive the mathematical proof for the convergence of gradient descent on strongly convex functions with Lipschitz continuous gradients.", 96 "Model the diffusion dynamics of graphene nanoparticles in an aqueous dispersion using the Stokes-Einstein equation.", 97 "Formulate the thermodynamics of phase separation in polymer blends using Flory-Huggins solution theory.", 98 ], 99 ), 100 CurriculumTrack::GeneralFrontier => ( 101 TaskType::CodeSynthesis, 102 VerificationStrategy::CompilerCheck, 103 vec![ 104 "Implement a concurrent lock-free skip list in Rust supporting concurrent search, insert, and delete.", 105 "Write an implementation of the Raft leader election algorithm and heartbeat timer in async Rust.", 106 "Implement an LRU cache with O(1) get and put operations and thread-safe read-write locking.", 107 "Write a high-performance regex pattern matcher using non-deterministic finite automata (NFA) simulation in Rust.", 108 "Implement a B-tree indexing node with splitting and binary search in Rust.", 109 ], 110 ), 111 CurriculumTrack::DynamicMining => { 112 let dynamic_prompts = Self::mine_recent_commit_prompts(limit.max(5)); 113 return dynamic_prompts 114 .into_iter() 115 .take(limit) 116 .map(|prompt| DistillTask { 117 id: Uuid::new_v4().to_string(), 118 task_type: TaskType::RefactorLogic, 119 prompt, 120 system_prompt: Some("You are AIEN Sovereign Architect. Produce concise, verified, unslop Rust code.".to_string()), 121 teacher_model: teacher.to_string(), 122 student_model: student.map(String::from), 123 verification_strategy: VerificationStrategy::CompilerCheck, 124 commit_to_cortex, 125 }) 126 .collect(); 127 } 128 }; 129 130 prompts 131 .into_iter() 132 .take(limit) 133 .map(|prompt| DistillTask { 134 id: Uuid::new_v4().to_string(), 135 task_type, 136 prompt: prompt.to_string(), 137 system_prompt: Some("You are a verified sovereign systems specialist. Output clear, compilable native code with zero unslop.".to_string()), 138 teacher_model: teacher.to_string(), 139 student_model: student.map(String::from), 140 verification_strategy: strategy, 141 commit_to_cortex, 142 }) 143 .collect() 144 } 145 146 /// Extract real-world problem statements by inspecting recent git commits in the repo. 147 fn mine_recent_commit_prompts(limit: usize) -> Vec { 148 let repo_path = std::env::current_dir().unwrap_or_else(|_| Path::new(".").to_path_buf()); 149 if let Ok(output) = Command::new("git") 150 .args([ 151 "-C", 152 repo_path.to_str().unwrap_or("."), 153 "log", 154 "-n", 155 "10", 156 "--oneline", 157 ]) 158 .output() 159 { 160 if output.status.success() { 161 let log = String::from_utf8_lossy(&output.stdout); 162 let prompts: Vec = log 163 .lines() 164 .filter(|l| !l.is_empty()) 165 .take(limit) 166 .map(|l| { 167 let subject = l.split_whitespace().skip(1).collect::>().join(" "); 168 format!("Analyze and implement the core engineering requirements for the following system change: '{}'. Produce verified, robust Rust code.", subject) 169 }) 170 .collect(); 171 172 if !prompts.is_empty() { 173 return prompts; 174 } 175 } 176 } 177 178 vec![ 179 "Implement a robust asynchronous event bus with decoupled publishers and subscribers in Rust.".to_string(), 180 "Design a thread-safe state store with transaction rollback capabilities in Rust.".to_string(), 181 ] 182 } 183 } 184 185 #[cfg(test)] 186 mod tests { 187 use super::*; 188 189 #[test] 190 fn test_track_parsing() { 191 assert_eq!( 192 CurriculumTrack::parse("systems"), 193 Some(CurriculumTrack::NativeSystemsAndGpu) 194 ); 195 assert_eq!( 196 CurriculumTrack::parse("agent"), 197 Some(CurriculumTrack::AgentAgency) 198 ); 199 assert_eq!( 200 CurriculumTrack::parse("science"), 201 Some(CurriculumTrack::ScientificReasoning) 202 ); 203 assert_eq!( 204 CurriculumTrack::parse("frontier"), 205 Some(CurriculumTrack::GeneralFrontier) 206 ); 207 assert_eq!( 208 CurriculumTrack::parse("dynamic"), 209 Some(CurriculumTrack::DynamicMining) 210 ); 211 } 212 213 #[test] 214 fn test_track_parsing_aliases() { 215 assert_eq!( 216 CurriculumTrack::parse("cuda"), 217 Some(CurriculumTrack::NativeSystemsAndGpu) 218 ); 219 assert_eq!( 220 CurriculumTrack::parse("git"), 221 Some(CurriculumTrack::DynamicMining) 222 ); 223 assert_eq!( 224 CurriculumTrack::parse("git_mining"), 225 Some(CurriculumTrack::DynamicMining) 226 ); 227 assert_eq!( 228 CurriculumTrack::parse("git-mining"), 229 Some(CurriculumTrack::DynamicMining) 230 ); 231 assert_eq!( 232 CurriculumTrack::parse("refactor"), 233 Some(CurriculumTrack::DynamicMining) 234 ); 235 } 236 237 #[test] 238 fn test_task_generation() { 239 let tasks = CurriculumEngine::generate_tasks( 240 CurriculumTrack::NativeSystemsAndGpu, 241 2, 242 "anthropic/claude-3-7-sonnet", 243 Some("atlas-lightning-omni"), 244 true, 245 ); 246 247 assert_eq!(tasks.len(), 2); 248 assert!(tasks[0].prompt.contains("Rust")); 249 assert_eq!(tasks[0].teacher_model, "anthropic/claude-3-7-sonnet"); 250 assert_eq!( 251 tasks[0].student_model.as_deref(), 252 Some("atlas-lightning-omni") 253 ); 254 assert!(tasks[0].commit_to_cortex); 255 } 256 }