stemedb/ai-lookup/features/trustrank.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

66 lines
1.7 KiB
Markdown

# TrustRank (Reputation)
**Last Updated:** 2025-01-31
**Confidence:** Medium (planned feature)
## Summary
TrustRank is a recursive PageRank-style algorithm for agent credibility. Agents who make accurate claims early gain reputation; agents who contradict settled truth lose reputation.
**Key Facts:**
- Stored in `A:{AgentId}` key in KV store
- Background "Gardener" process calculates scores
- Used by `Authority` lens to weight assertions
- Reputation decays for low-confidence agents
**File Pointer:** `crates/stemedb-gardener/src/trustrank.rs` (planned, Phase 4)
## How It Works
### Validation Loop (Gardener)
```
Every N hours:
1. Find "Settled Facts" (>99% consensus over T time)
2. For each settled fact:
- Reward agents who claimed it early (+R)
- Punish agents who claimed opposite (-R)
3. Update A:{AgentId} scores
4. Back-propagate: high-R agents boost sources they cite
```
### Usage in Authority Lens
```rust
impl Lens for AuthorityLens {
fn resolve(&self, candidates: &[Assertion], ctx: &QueryContext) -> LensResult {
// Weight by agent reputation
let weighted: Vec<_> = candidates.iter()
.map(|a| {
let rep = ctx.get_reputation(&a.agent);
(a, rep)
})
.collect();
// Return highest weighted assertion
weighted.into_iter()
.max_by_key(|(_, rep)| *rep)
.map(|(a, _)| a.clone())
}
}
```
## Reputation Score Range
| Score | Meaning |
|-------|---------|
| 0-300 | Unreliable (spam, noise) |
| 300-600 | Neutral (unproven) |
| 600-900 | Reliable (track record) |
| 900-1000 | Authoritative (expert) |
## Related Topics
- [Lens](../services/lens.md)
- [Roadmap Phase 4](../../../roadmap.md)