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/spark-rsi-mv/blob/main/src/main.rs # spark-rsi-mv Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger 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 `spark-rsi-mv / src / main.rs` 668 lines · 25623 bytes Raw Blame History 1 use clap::{Parser, Subcommand}; 2 use spark_rsi::balance::BalanceKernel; 3 use spark_rsi::config::SovereignConfig; 4 use spark_rsi::daemon::RsiEngine; 5 use spark_rsi::models::RsiConfig; 6 use spark_rsi::observe::observe_codebase; 7 use spark_rsi::propose::ProposalGenerator; 8 use spark_rsi::verifier::InvariantVerifier; 9 use std::path::Path; 10 use tracing_subscriber::layer::SubscriberExt; 11 use tracing_subscriber::util::SubscriberInitExt; 12 13 #[derive(Parser, Debug)] 14 #[command( 15 name = "spark-rsi", 16 about = "AIEN Sovereign Recursive Self-Improvement Engine on NVIDIA DGX Spark", 17 version = spark_rsi::version() 18 )] 19 struct Cli { 20 #[command(subcommand)] 21 command: Commands, 22 } 23 24 #[derive(Subcommand, Debug)] 25 enum LedgerCommands { 26 /// Print recent ledger blocks 27 Log { 28 #[arg(default_value = ".rsi")] 29 rsi_root: String, 30 #[arg(short, long, default_value = "20")] 31 limit: usize, 32 }, 33 /// Verify ledger integrity, SHA-256 hash chaining, Merkle roots, and blob digests 34 Verify { 35 #[arg(default_value = ".rsi")] 36 rsi_root: String, 37 #[arg(long)] 38 verifying_key_hex: Option, 39 }, 40 /// Compute Merkle root checkpoint and optionally sign with P-256 ECDSA key 41 Checkpoint { 42 #[arg(default_value = ".rsi")] 43 rsi_root: String, 44 /// Signing key as hex. Other processes can read command-line arguments; prefer 45 /// `--signing-key-file` or `RSI_LEDGER_SIGNING_KEY`. 46 #[arg(long)] 47 signing_key_hex: Option, 48 /// File holding the signing key as hex. Falls back to `RSI_LEDGER_SIGNING_KEY`. 49 #[arg(long)] 50 signing_key_file: Option, 51 }, 52 /// Record append-only PromotionEvidence block proving downstream compounding 53 Evidence { 54 #[arg(default_value = ".rsi")] 55 rsi_root: String, 56 #[arg(long)] 57 candidate_hash: String, 58 #[arg(long)] 59 downstream_cycle: String, 60 #[arg(long)] 61 downstream_hash: String, 62 #[arg(long)] 63 proof: String, 64 }, 65 } 66 67 #[derive(Subcommand, Debug)] 68 enum Commands { 69 /// Initialize operator profile and model engine configuration 70 Init { 71 #[arg(long)] 72 name: Option, 73 #[arg(long)] 74 email: Option, 75 #[arg(long)] 76 mode: Option, 77 #[arg(long)] 78 api_url: Option, 79 #[arg(long)] 80 model_id: Option, 81 }, 82 /// Display current sovereign operator profile and engine configuration 83 Profile, 84 /// Observe codebase telemetry, git state, crumbs, and soul tension 85 Observe { 86 #[arg(default_value = ".")] 87 path: String, 88 }, 89 /// Generate an atomic improvement proposal in an isolated sandbox 90 Propose { 91 #[arg(default_value = ".")] 92 path: String, 93 }, 94 /// Verify sovereign invariants: unslop standard, zero disk secrets, compile, and tests 95 Verify { 96 #[arg(default_value = ".")] 97 path: String, 98 }, 99 /// Evaluate drive versus humanity tension via the native balance kernel 100 Balance { drive: f64, humanity: f64 }, 101 /// Evaluate 4-lane drive and humanity vectors (each side summed) via the native balance kernel 102 BalanceSimd { 103 d0: f32, 104 d1: f32, 105 d2: f32, 106 d3: f32, 107 h0: f32, 108 h1: f32, 109 h2: f32, 110 h3: f32, 111 }, 112 /// Execute unprivileged Blind Judge evaluation over candidate generation 113 Judge { 114 #[arg(long, default_value = "cycle-genesis")] 115 cycle_id: String, 116 #[arg(long, default_value = "cand-001")] 117 candidate_id: String, 118 #[arg(long, default_value = "parent-000")] 119 parent_id: String, 120 #[arg(long, default_value = ".")] 121 candidate_path: String, 122 #[arg(long, default_value = ".")] 123 parent_path: String, 124 #[arg(long, default_value = ".rsi/holdouts")] 125 holdouts_dir: String, 126 #[arg(long, default_value = ".rsi/eval_outputs")] 127 output_dir: String, 128 #[arg(long)] 129 signing_key_hex: Option, 130 #[arg(long)] 131 signing_key_file: Option, 132 #[arg(long)] 133 require_latency_improvement: bool, 134 #[arg(long, default_value_t = 1.0)] 135 non_inferiority_margin_pct: f64, 136 /// The one file (relative to the candidate tree) whose exact bytes a version 2 receipt 137 /// binds. Required whenever a policy is configured. 138 #[arg(long)] 139 subject_path: Option, 140 /// Evaluation policy for version 2 receipts. Falls back to `RSI_JUDGE_POLICY_FILE`; with a 141 /// policy configured every receipt is version 2, and a malformed policy is refused. 142 #[arg(long)] 143 policy_file: Option, 144 /// Executable to run for holdouts and benchmarks, relative to each tree (version 2 names 145 /// it, never searches for it). 146 #[arg(long)] 147 executable: Option, 148 /// Build both trees into a fresh judge-owned target directory before evaluating. 149 #[arg(long, requires = "executable")] 150 build_release: bool, 151 }, 152 /// Execute a holdout test case against internal logic 153 Holdout { 154 #[arg(default_value = "")] 155 input: String, 156 }, 157 /// Run a single end-to-end RSI cycle (Observe, Propose, Verify, Balance, Ratify) 158 Cycle { 159 #[arg(default_value = ".")] 160 path: String, 161 #[arg(long, default_value = "http://127.0.0.1:18080")] 162 cortex_url: String, 163 #[arg(long, default_value = "http://127.0.0.1:18006/v1")] 164 model_url: String, 165 #[arg(long, default_value = "atlas-lightning-omni")] 166 model_id: String, 167 /// Directory with a DUAL price vector, read as a diagnostic signal only (ADR 0031 s7.5) 168 #[arg(long)] 169 dual_price_vector_dir: Option, 170 /// SEC1 hex public key of the separate judge, pinned for the promotion gate. Falls back to 171 /// `RSI_JUDGE_PUBLIC_KEY`. A malformed key is refused at startup. 172 #[arg(long)] 173 judge_public_key: Option, 174 /// Evaluation policy promotion receipts must be bound to. Falls back to 175 /// `RSI_JUDGE_POLICY_FILE`. A malformed policy is refused at startup. 176 #[arg(long)] 177 judge_policy_file: Option, 178 }, 179 /// Run the continuous recursive self-improvement daemon loop 180 Daemon { 181 #[arg(default_value = ".")] 182 path: String, 183 #[arg(short, long, default_value = "60")] 184 interval: u64, 185 #[arg(long, default_value = "http://127.0.0.1:18080")] 186 cortex_url: String, 187 #[arg(long, default_value = "http://127.0.0.1:18006/v1")] 188 model_url: String, 189 #[arg(long, default_value = "atlas-lightning-omni")] 190 model_id: String, 191 /// Directory with a DUAL price vector, read as a diagnostic signal only (ADR 0031 s7.5) 192 #[arg(long)] 193 dual_price_vector_dir: Option, 194 /// SEC1 hex public key of the separate judge, pinned for the promotion gate. Falls back to 195 /// `RSI_JUDGE_PUBLIC_KEY`. A malformed key is refused at startup. 196 #[arg(long)] 197 judge_public_key: Option, 198 /// Evaluation policy promotion receipts must be bound to. Falls back to 199 /// `RSI_JUDGE_POLICY_FILE`. A malformed policy is refused at startup. 200 #[arg(long)] 201 judge_policy_file: Option, 202 }, 203 /// Manage the append-only cryptographic improvement ledger 204 Ledger { 205 #[command(subcommand)] 206 action: LedgerCommands, 207 }, 208 /// Execute Tier 2 autonomous soak run (5 cycles, multi-candidate isolation, strict staging) 209 Soak { 210 #[arg(long, default_value = ".")] 211 path: String, 212 #[arg(long, default_value = ".rsi")] 213 rsi_root: String, 214 #[arg(long, default_value = "5")] 215 cycles: usize, 216 #[arg(long, default_value = "3")] 217 candidates: usize, 218 #[arg(long, default_value = "http://127.0.0.1:18080")] 219 cortex_url: String, 220 #[arg(long, default_value = "http://127.0.0.1:18006/v1")] 221 model_url: String, 222 #[arg(long, default_value = "atlas-lightning-omni")] 223 model_id: String, 224 /// Signing key as hex. Other processes can read command-line arguments; prefer 225 /// `--signing-key-file` or `RSI_SOAK_SIGNING_KEY`. 226 #[arg(long)] 227 signing_key_hex: Option, 228 /// File holding the signing key as hex. Falls back to `RSI_SOAK_SIGNING_KEY`. 229 #[arg(long)] 230 signing_key_file: Option, 231 #[arg(long)] 232 operator_key_hex: Option, 233 #[arg(long)] 234 holdouts_dir: Option, 235 #[arg(long)] 236 margin: Option, 237 }, 238 /// Display the sovereign programming philosophy manifesto 239 Philosophy, 240 } 241 242 /// Environment variable holding the operator's evaluation policy for version 2 receipts. 243 const JUDGE_POLICY_ENV: &str = "RSI_JUDGE_POLICY_FILE"; 244 /// Environment variable holding the separate judge's SEC1 hex public key. 245 const JUDGE_PUBLIC_KEY_ENV: &str = "RSI_JUDGE_PUBLIC_KEY"; 246 247 /// Environment variable holding the `ledger checkpoint` signing key as hex. 248 const LEDGER_SIGNING_KEY_ENV: &str = "RSI_LEDGER_SIGNING_KEY"; 249 /// Environment variable holding the `soak` signing key as hex. 250 const SOAK_SIGNING_KEY_ENV: &str = "RSI_SOAK_SIGNING_KEY"; 251 252 /// The flag when given, otherwise the non-empty environment variable. 253 fn flag_or_env(flag: Option, var: &str) -> Option { 254 flag.or_else(|| std::env::var(var).ok().filter(|v| !v.trim().is_empty())) 255 } 256 257 /// Key hex from the hex flag, else the key file, else the environment variable: the order the 258 /// judge uses. An unreadable or empty key file is an error, never a fallback. 259 fn key_hex( 260 hex_flag: Option, 261 key_file: Option, 262 var: &str, 263 ) -> Result, String> { 264 if let Some(hex_str) = hex_flag { 265 return Ok(Some(hex_str.trim().to_string())); 266 } 267 if let Some(path) = key_file { 268 let text = std::fs::read_to_string(&path) 269 .map_err(|e| format!("cannot read key file {}: {}", path, e))?; 270 let text = text.trim(); 271 if text.is_empty() { 272 return Err(format!("key file {} is empty", path)); 273 } 274 return Ok(Some(text.to_string())); 275 } 276 Ok(flag_or_env(None, var).map(|v| v.trim().to_string())) 277 } 278 279 /// Loads the judge pins `cycle` and `daemon` hand the promotion gate, so a malformed policy or 280 /// key stops the command at startup instead of surfacing as a refusal cycles later. 281 fn validated_judge_pins( 282 public_key: Option, 283 policy_file: Option, 284 ) -> Result<(Option, Option), String> { 285 let public_key = flag_or_env(public_key, JUDGE_PUBLIC_KEY_ENV); 286 let policy_file = flag_or_env(policy_file, JUDGE_POLICY_ENV); 287 if let Some(p) = &policy_file { 288 spark_rsi::actor::judge::EvaluationPolicy::load(Path::new(p))?; 289 } 290 if let Some(k) = &public_key { 291 let bytes = 292 hex::decode(k.trim()).map_err(|e| format!("judge public key is not hex: {}", e))?; 293 p256::ecdsa::VerifyingKey::from_sec1_bytes(&bytes) 294 .map_err(|e| format!("judge public key is invalid: {}", e))?; 295 } 296 Ok((public_key, policy_file)) 297 } 298 299 #[tokio::main] 300 async fn main() -> Result<(), Box> { 301 tracing_subscriber::registry() 302 .with( 303 tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()), 304 ) 305 .with(tracing_subscriber::fmt::layer()) 306 .init(); 307 308 let cli = Cli::parse(); 309 310 match cli.command { 311 Commands::Init { 312 name, 313 email, 314 mode, 315 api_url, 316 model_id, 317 } => { 318 let mut cfg = SovereignConfig::load(); 319 if let Some(n) = name { 320 cfg.operator.name = n; 321 } 322 if let Some(e) = email { 323 cfg.operator.email = e; 324 } 325 if let Some(m) = mode { 326 cfg.engine.mode = m; 327 } 328 if let Some(u) = api_url { 329 cfg.engine.api_base_url = u; 330 } 331 if let Some(mid) = model_id { 332 cfg.engine.model_id = mid; 333 } 334 335 cfg.save() 336 .map_err(|e| format!("Failed to save config: {}", e))?; 337 println!("⚡ Sovereign operator profile initialized successfully."); 338 println!( 339 "Configuration saved to: {:?}", 340 SovereignConfig::config_path() 341 ); 342 println!("Author signature: {}", cfg.author_string()); 343 println!( 344 "Engine mode: {} ({})", 345 cfg.engine.mode, cfg.engine.api_base_url 346 ); 347 } 348 Commands::Profile => { 349 let cfg = SovereignConfig::load(); 350 println!("{}", toml::to_string_pretty(&cfg)?); 351 } 352 Commands::Observe { path } => { 353 let snap = observe_codebase(Path::new(&path)) 354 .map_err(|e| format!("Failed to observe codebase: {}", e))?; 355 println!("{}", serde_json::to_string_pretty(&snap)?); 356 } 357 Commands::Propose { path } => { 358 let repo_path = Path::new(&path); 359 if let Some(prop) = ProposalGenerator::scan_and_propose_unslop(repo_path) { 360 println!("{}", serde_json::to_string_pretty(&prop)?); 361 } else { 362 println!( 363 "{}", 364 serde_json::json!({"status": "no_improvements_proposed", "note": "Working tree conforms to invariants."}) 365 ); 366 } 367 } 368 Commands::Verify { path } => { 369 let report = InvariantVerifier::run_full_verification(Path::new(&path)); 370 println!("{}", serde_json::to_string_pretty(&report)?); 371 if !report.passed { 372 std::process::exit(1); 373 } 374 } 375 Commands::Balance { drive, humanity } => { 376 let verdict = BalanceKernel::evaluate(drive, humanity); 377 println!("{}", serde_json::to_string_pretty(&verdict)?); 378 } 379 Commands::BalanceSimd { 380 d0, 381 d1, 382 d2, 383 d3, 384 h0, 385 h1, 386 h2, 387 h3, 388 } => { 389 let verdict = BalanceKernel::evaluate_simd([d0, d1, d2, d3], [h0, h1, h2, h3]); 390 println!("{}", serde_json::to_string_pretty(&verdict)?); 391 } 392 Commands::Judge { 393 cycle_id, 394 candidate_id, 395 parent_id, 396 candidate_path, 397 parent_path, 398 holdouts_dir, 399 output_dir, 400 signing_key_hex, 401 signing_key_file, 402 require_latency_improvement, 403 non_inferiority_margin_pct, 404 subject_path, 405 policy_file, 406 executable, 407 build_release, 408 } => { 409 let policy_file = flag_or_env(policy_file, JUDGE_POLICY_ENV); 410 match (&policy_file, &subject_path) { 411 (Some(_), None) => { 412 return Err( 413 "a judge policy is configured but --subject-path is missing; \ 414 refusing to fall back to a version 1 receipt" 415 .into(), 416 ) 417 } 418 (None, Some(_)) => { 419 return Err(format!( 420 "--subject-path needs a policy (--policy-file or {})", 421 JUDGE_POLICY_ENV 422 ) 423 .into()) 424 } 425 (None, None) => eprintln!( 426 "no judge policy (--policy-file or {}): writing a version 1 receipt, \ 427 which is history only and never promotes", 428 JUDGE_POLICY_ENV 429 ), 430 (Some(_), Some(_)) => {} 431 } 432 let judge_cli = spark_rsi::actor::JudgeCli { 433 cycle_id, 434 candidate_id, 435 parent_id, 436 candidate_path, 437 parent_path, 438 holdouts_dir, 439 output_dir, 440 signing_key_hex, 441 signing_key_file, 442 require_latency_improvement, 443 non_inferiority_margin_pct, 444 subject_path, 445 policy_file, 446 executable, 447 build_release, 448 public_key: false, 449 print_holdout_digest: false, 450 }; 451 spark_rsi::actor::judge::run_judge_cli(judge_cli)?; 452 } 453 Commands::Holdout { input } => { 454 let res = spark_rsi::evaluate_holdout_case(&input); 455 println!("{}", res); 456 } 457 Commands::Cycle { 458 path, 459 cortex_url, 460 model_url, 461 model_id, 462 dual_price_vector_dir, 463 judge_public_key, 464 judge_policy_file, 465 } => { 466 let (judge_public_key_hex, judge_policy_file) = 467 validated_judge_pins(judge_public_key, judge_policy_file)?; 468 let config = RsiConfig { 469 target_repo: path, 470 cortex_url, 471 cortex_space: "atlas-memory".to_string(), 472 loop_interval_secs: 60, 473 sandbox_root: "/tmp/spark-rsi-sandbox".to_string(), 474 rsi_root: ".rsi".to_string(), 475 holdouts_dir: None, 476 signing_key_hex: None, 477 require_latency_improvement: false, 478 model_url, 479 model_id, 480 canary_target: 5000, 481 operator_key_hex: None, 482 non_inferiority_margin: None, 483 ratify_roots: spark_rsi::diff_gate::default_ratify_roots(), 484 dual_price_vector_dir, 485 judge_public_key_hex, 486 judge_policy_file, 487 ..RsiConfig::default() 488 }; 489 let result = RsiEngine::run_cycle(&config).await?; 490 println!("{}", serde_json::to_string_pretty(&result)?); 491 } 492 Commands::Daemon { 493 path, 494 interval, 495 cortex_url, 496 model_url, 497 model_id, 498 dual_price_vector_dir, 499 judge_public_key, 500 judge_policy_file, 501 } => { 502 let (judge_public_key_hex, judge_policy_file) = 503 validated_judge_pins(judge_public_key, judge_policy_file)?; 504 let config = RsiConfig { 505 target_repo: path, 506 cortex_url, 507 cortex_space: "atlas-memory".to_string(), 508 loop_interval_secs: interval, 509 sandbox_root: "/tmp/spark-rsi-sandbox".to_string(), 510 rsi_root: ".rsi".to_string(), 511 holdouts_dir: None, 512 signing_key_hex: None, 513 require_latency_improvement: false, 514 model_url, 515 model_id, 516 canary_target: 5000, 517 operator_key_hex: None, 518 non_inferiority_margin: None, 519 ratify_roots: spark_rsi::diff_gate::default_ratify_roots(), 520 dual_price_vector_dir, 521 judge_public_key_hex, 522 judge_policy_file, 523 ..RsiConfig::default() 524 }; 525 RsiEngine::run_daemon(config).await?; 526 } 527 Commands::Ledger { action } => match action { 528 LedgerCommands::Log { rsi_root, limit } => { 529 let ledger = spark_rsi::ledger::ImprovementLedger::open(Path::new(&rsi_root))?; 530 let blocks = ledger.all_blocks()?; 531 let start_idx = blocks.len().saturating_sub(limit); 532 println!( 533 "=== Improvement Ledger Log ({} blocks total) ===", 534 blocks.len() 535 ); 536 for b in &blocks[start_idx..] { 537 println!( 538 "[#{:04}] {:<18} | Hash: {}.. | Prev: {}.. | Blobs: {}", 539 b.sequence, 540 b.block_type.to_string(), 541 &b.block_hash[..12], 542 &b.prev_block_hash[..12], 543 b.blob_hashes.len() 544 ); 545 } 546 } 547 LedgerCommands::Verify { 548 rsi_root, 549 verifying_key_hex, 550 } => { 551 let ledger = spark_rsi::ledger::ImprovementLedger::open(Path::new(&rsi_root))?; 552 let mut vk = None; 553 if let Some(ref hex_str) = verifying_key_hex { 554 let bytes = hex::decode(hex_str)?; 555 let key = p256::ecdsa::VerifyingKey::from_sec1_bytes(&bytes)?; 556 vk = Some(key); 557 } 558 match ledger.verify_chain_integrity(vk.as_ref()) { 559 Ok(report) => { 560 let gaps = report.unchecked(vk.is_some()); 561 if gaps.is_empty() { 562 println!("⚡ Ledger Verification: PASS"); 563 } else { 564 println!( 565 "⚠️ Ledger Verification: PARTIAL. Hash chain and blobs verified; not checked: {}", 566 gaps.join("; ") 567 ); 568 } 569 println!("{}", serde_json::to_string_pretty(&report)?); 570 } 571 Err(e) => { 572 eprintln!("❌ Ledger Verification FAILED: {}", e); 573 std::process::exit(1); 574 } 575 } 576 } 577 LedgerCommands::Checkpoint { 578 rsi_root, 579 signing_key_hex, 580 signing_key_file, 581 } => { 582 let signing_key_hex = 583 key_hex(signing_key_hex, signing_key_file, LEDGER_SIGNING_KEY_ENV)?; 584 let ledger = spark_rsi::ledger::ImprovementLedger::open(Path::new(&rsi_root))?; 585 let mut sk = None; 586 if let Some(ref hex_str) = signing_key_hex { 587 let bytes = hex::decode(hex_str)?; 588 let key = p256::ecdsa::SigningKey::from_slice(&bytes)?; 589 sk = Some(key); 590 } 591 let cp = ledger.checkpoint(sk.as_ref())?; 592 println!("⚡ Merkle Checkpoint Created"); 593 println!("{}", serde_json::to_string_pretty(&cp)?); 594 } 595 LedgerCommands::Evidence { 596 rsi_root, 597 candidate_hash, 598 downstream_cycle, 599 downstream_hash, 600 proof, 601 } => { 602 let ledger = spark_rsi::ledger::ImprovementLedger::open(Path::new(&rsi_root))?; 603 let payload = spark_rsi::ledger::PromotionEvidencePayload { 604 meta_candidate_block_hash: candidate_hash, 605 downstream_cycle_id: downstream_cycle, 606 downstream_ledger_block_hash: downstream_hash, 607 capability_improvement_proof: proof, 608 final_classification: "TRUE_RSI".to_string(), 609 }; 610 let blk = ledger.append_promotion_evidence(&payload)?; 611 println!("⚡ PromotionEvidence Block Appended: #{}", blk.sequence); 612 println!("{}", serde_json::to_string_pretty(&blk)?); 613 } 614 }, 615 Commands::Soak { 616 path, 617 rsi_root, 618 cycles, 619 candidates, 620 cortex_url, 621 model_url, 622 model_id, 623 signing_key_hex, 624 signing_key_file, 625 operator_key_hex, 626 holdouts_dir, 627 margin, 628 } => { 629 let signing_key_hex = key_hex(signing_key_hex, signing_key_file, SOAK_SIGNING_KEY_ENV)?; 630 let config = spark_rsi::soak::SoakConfig { 631 target_repo: path, 632 rsi_root, 633 sandbox_root: "/tmp/spark-rsi-soak".to_string(), 634 holdouts_dir, 635 signing_key_hex, 636 operator_key_hex, 637 cortex_url, 638 cortex_space: "atlas-memory".to_string(), 639 model_url, 640 model_id, 641 total_cycles: cycles, 642 candidates_per_cycle: candidates, 643 canary_target: 5000, 644 non_inferiority_margin: margin.or(Some(10.0)), 645 writable_prefixes: vec![ 646 "src/propose/".to_string(), 647 "src/graph/".to_string(), 648 "src/observe.rs".to_string(), 649 ], 650 }; 651 let manifest = spark_rsi::soak::SoakRunner::run_batch(&config) 652 .await 653 .map_err(|e| format!("Soak run failed: {}", e))?; 654 println!("{}", serde_json::to_string_pretty(&manifest)?); 655 } 656 Commands::Philosophy => { 657 let philosophy_file = Path::new("docs/PHILOSOPHY.md"); 658 if philosophy_file.exists() { 659 let content = std::fs::read_to_string(philosophy_file)?; 660 println!("{}", content); 661 } else { 662 println!("# Sovereign Programming Philosophy\n\nSee docs/PHILOSOPHY.md for full manifesto."); 663 } 664 } 665 } 666 667 Ok(()) 668 }