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>
2.8 KiB
2.8 KiB
TrustRank (Reputation)
Last Updated: 2026-02-01
Confidence: High
Status: Implemented in stemedb-storage v0.1.0
Summary
TrustRank is a reputation system for agent credibility. Agents who make accurate claims gain reputation; agents who contradict settled truth lose reputation.
Key Facts:
- Stored in
TR:{AgentId}key in KV store viaTrustRankStoretrait - Scores bounded to [0.0, 1.0], default 0.5 for new agents
- Used by
TrustAwareAuthorityLensto weight assertions - Confidence decays over time (30-day half-life by default)
File Pointer: crates/stemedb-storage/src/trust_rank_store.rs
TrustRank Record
pub struct TrustRank {
pub agent_id: [u8; 32],
pub score: f32, // 0.0 to 1.0
pub last_updated: u64, // Unix timestamp
pub assertions_count: u64,
pub accuracy_count: u64,
}
How It Works
Score Updates
// Record an outcome for an agent
trust_store.record_outcome(&agent_id, was_accurate, timestamp).await?;
// Accurate prediction: +0.05 (capped at 1.0)
// Inaccurate prediction: -0.1 (floored at 0.0)
// Higher penalty for inaccuracy discourages spam
Confidence Decay
// Apply time-based decay to all scores
trust_store.decay_trust_ranks(current_timestamp, Some(custom_half_life)).await?;
// Default half-life: 30 days
// Score approaches 0.5 (neutral) over time without activity
Usage in TrustAwareAuthorityLens
use stemedb_lens::TrustAwareAuthorityLens;
use stemedb_storage::{SledStore, GenericTrustRankStore};
use std::sync::Arc;
let store = SledStore::open("./data")?;
let trust_store = Arc::new(GenericTrustRankStore::new(store));
let lens = TrustAwareAuthorityLens::new(trust_store);
let resolution = lens.resolve_async(&candidates).await;
// Winner = assertion with highest (confidence * trust_rank)
Resolution Strategy:
- For each candidate, lookup signer's TrustRank (O(1))
- Calculate:
weighted_score = assertion.confidence * agent.trust_rank - Return assertion with highest weighted score
- Tiebreaker: most recent timestamp
- Unsigned assertions treated as 0.0 trust
Score Interpretation
| Score | Meaning |
|---|---|
| 0.0-0.3 | Unreliable (history of inaccuracy) |
| 0.3-0.5 | Below neutral (more wrong than right) |
| 0.5 | Neutral (new agent or unknown) |
| 0.5-0.7 | Above neutral (more right than wrong) |
| 0.7-1.0 | Reliable (strong track record) |
API Access
Via LensDto:
lens=Authority→ Routes toTrustAwareAuthorityLenslens=TrustAwareAuthority→ Routes toTrustAwareAuthorityLenslens=Confidence→ Uses confidence field only (no TrustRank)