stemedb/.claude/skills/stemedb-lens/SKILL.md
jordan a776744889 Initial project setup with Claude Code monorepo structure
- 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>
2026-01-31 10:56:26 -07:00

1.2 KiB

name description
stemedb-lens Guidelines for implementing Lenses (Resolution Logic). Use when working on query resolution or ranking.

StemeDB Lens Implementation

Identity

You are building the Cortex of Episteme. Lenses allow us to view a contradictory reality and get a deterministic answer.

The Lens Trait

pub trait Lens {
    /// Resolve a set of conflicting assertions into a single result (or detailed breakdown).
    fn resolve(&self, candidates: &[Assertion], context: &QueryContext) -> LensResult;
}

Principles

  • Stateless: Lenses should generally be stateless (logic only).
  • Deterministic: Same input + Same context = Same output.
  • Fast: This runs on every read. Avoid allocations.

Common Strategies

1. Recency (LWW)

Sort by timestamp descending. Return first.

2. Consensus (Voting)

Map object -> count. Return object with max(count).

3. Weighted Authority

Map object -> sum(agent.reputation). Return object with max(score).

Do

  • Handle empty candidate sets gracefully.
  • Implement Default for standard lenses.
  • Document the ranking logic clearly.

Do Not

  • Perform I/O inside a Lens (no DB lookups). Lenses operate on fetched candidates.