stemedb/sdk/go/steme/doc.go
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

70 lines
2.0 KiB
Go

// Package steme provides a Go SDK for StemeDB, a probabilistic knowledge graph
// that stores Claims, not Facts.
//
// StemeDB is an append-only Merkle DAG with read-time conflict resolution via
// Lenses. Think "Git for Truth" - conflicting assertions coexist and are
// resolved at query time.
//
// # Quick Start
//
// Create a signer and client:
//
// signer, err := steme.GenerateSigner()
// if err != nil {
// log.Fatal(err)
// }
// client := steme.NewClient("http://localhost:3000", signer)
//
// Build and submit an assertion:
//
// assertion := steme.NewAssertion("Tesla_Inc", "has_revenue").
// WithNumber(96.7).
// WithConfidence(0.95).
// WithSourceHash("0000...64 hex chars...").
// Build()
//
// hash, err := client.Assert(context.Background(), assertion)
//
// Query with lens-based conflict resolution:
//
// params := steme.NewQuery().
// WithSubject("Tesla_Inc").
// WithLens(steme.LensConsensus).
// Build()
// result, err := client.Query(context.Background(), params)
//
// # Lenses
//
// StemeDB resolves conflicts at query time using Lenses:
// - Recency: Latest timestamp wins
// - Consensus: Most common value wins
// - Authority: Weighted by agent reputation
// - VoteAwareConsensus: Highest vote weight
// - TrustAwareAuthority: Weighted by TrustRank
//
// # Security
//
// All assertions are cryptographically signed using Ed25519. The SDK
// automatically signs assertions when you call client.Assert().
//
// Never commit private key seeds to version control. Use environment
// variables or secret management:
//
// signer, err := steme.SignerFromEnv("STEME_PRIVATE_KEY")
//
// # Error Handling
//
// The SDK uses sentinel errors for common cases:
//
// if errors.Is(err, steme.ErrInvalidConfidence) {
// // handle validation error
// }
//
// API errors provide structured information:
//
// var apiErr *steme.APIError
// if errors.As(err, &apiErr) {
// log.Printf("API error [%d]: %s", apiErr.StatusCode, apiErr.Message)
// }
package steme