- Rust workspace with stemedb-core crate - Full .claude/ configuration (agents, skills, commands, guides) - ai-lookup/ for token-efficient fact storage - Quality gates: clippy, fmt, jscpd duplication detection - Pre-commit hook with 5-phase quality checks - CLAUDE.md router and CODING_GUIDELINES.md standards Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.3 KiB
1.3 KiB
Lens
Last Updated: 2025-01-31 Confidence: High
Summary
A Lens resolves conflicting assertions into a deterministic answer at read time. Multiple truths coexist; the Lens chooses which to return.
Key Facts:
- Stateless compute (no side effects)
- Deterministic (same input = same output)
- Fast (runs on every read, avoid allocations)
- Pluggable (implement
Lenstrait)
File Pointer: crates/stemedb-lens/src/lib.rs (planned)
The Trait
pub trait Lens {
fn resolve(&self, candidates: &[Assertion], context: &QueryContext) -> LensResult;
}
Standard Lenses
| Lens | Strategy | Use Case |
|---|---|---|
| Recency | Latest timestamp wins | News, real-time |
| Consensus | Highest vote count | Democratic truth |
| Authority | Weighted by agent reputation | Expert truth |
| Skeptic | Returns variance/conflict | Finding controversy |
Query Flow
- Client:
GET(Subject="Tesla", Predicate="Revenue", Lens="Consensus") - Index lookup:
SP:Tesla:Revenue->[Hash1, Hash2, Hash3] - Hydrate: Load assertions from hashes
- Resolve:
ConsensusLens.resolve(assertions, context) - Return: Single deterministic answer with confidence