stemedb/crates/stemedb-sim/src/main.rs
jordan 1ce4004807 feat: Complete Phase 2 (The Cortex) - query, lens, and API layers
This commit adds the read path (Cortex) to complement the write path (Spine):

## Crates
- stemedb-api: HTTP API with axum + utoipa OpenAPI
  - /v1/assert, /v1/query, /v1/epoch, /v1/skeptic, /v1/trace, /v1/audit
  - Metered endpoints with quota enforcement
  - Ed25519 signature verification
- stemedb-lens: Truth resolution lenses
  - RecencyLens, ConsensusLens, ConfidenceLens
  - VoteAwareConsensusLens (Ballot Box pattern)
  - TrustAwareAuthorityLens (The Hive pattern)
  - SkepticLens (conflict analysis)
  - EpochAwareLens (paradigm-safe queries)
- stemedb-query: Query engine with materialized views

## Storage Extensions
- VoteStore: Vote aggregation with cached counts
- TrustRankStore: Agent reputation with decay
- AuditStore: Query audit trail
- IndexStore: SP/P/S index structures
- SupersessionStore: Epoch supersession chains

## SDKs
- sdk/go/steme: Go HTTP client with Ed25519 signing
- sdk/go/adk: ADK-Go tools for AI agents

## Documentation
- Updated CLAUDE.md, architecture.md, roadmap.md
- New ai-lookup entries for all services
- Use case docs for consumer health intelligence
- Arena roadmap for simulation advancement

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 13:22:44 -07:00

54 lines
1.6 KiB
Rust

//! StemeDB Spine Simulator Binary
//!
// CLI binaries use println! for user-facing output (not tracing)
#![allow(clippy::print_stdout, clippy::print_stderr)]
//!
//! This binary validates the "Spine" (Durability + Schema + Ingestion) by simulating
//! multiple agents creating, signing, and writing assertions to the WAL, which are then
//! asynchronously ingested into the Storage Engine.
//!
//! # Usage
//!
//! ```bash
//! cargo run --bin stemedb-sim
//! ```
//!
//! # Exit Codes
//!
//! - 0: Simulation completed successfully
//! - 1: Simulation completed with verification errors
//! - 2: Simulation setup failed (fatal error)
use std::process::ExitCode;
use stemedb_sim::{run_simulation, SimulationConfig};
#[tokio::main]
async fn main() -> ExitCode {
// Initialize tracing
tracing_subscriber::fmt::init();
// Run with default configuration
let config = SimulationConfig::default();
match run_simulation(config).await {
Ok(result) => {
println!("\n{}", result.summary());
if result.is_success() {
println!("\n🎉 The Arena: Spine validation PASSED.");
ExitCode::SUCCESS
} else {
println!("\n💥 The Arena: Spine validation FAILED.");
for err in &result.errors {
println!(" [Tick {}] {:?}: {}", err.tick, err.kind, err.message);
}
ExitCode::from(1)
}
}
Err(e) => {
eprintln!("\n🔥 Fatal setup error: {}", e);
ExitCode::from(2)
}
}
}