[Atlas] Trust scores on knowledge graph edges done analysis:5 coding:5

← Epistemic Rigor
Add trust_score (0-1) with confidence_interval to knowledge_edges. Compute trust from: evidence chain depth, source paper quality (impact factor, citations, recency), number of independent confirmations, contradiction count. Add trust propagation — downstream edges inherit reduced trust from upstream. Visualize trust on /graph. ## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (2)

[Atlas] Update spec work log: trust scores on knowledge graph edges2026-04-16
[Atlas] Add trust scores with confidence intervals to knowledge edges2026-04-16
Spec File

Goal

Add trust_score (0-1) with confidence_interval to knowledge_edges table. Compute trust from evidence chain depth, source paper quality (impact factor, citations, recency), number of independent confirmations, and contradiction count. Implement trust propagation where downstream edges inherit reduced trust from upstream. Visualize trust on /graph.

Acceptance Criteria

☑ Migration adds trust_score, trust_confidence_low, trust_confidence_high columns to knowledge_edges
compute_edge_trust() function calculates trust based on: evidence chain depth, paper quality (citations, year), confirmations, contradictions
propagate_edge_trust() function dampens trust for downstream edges (0.85x per hop)
recompute_edge_trust() batch function recomputes trust for all edges of an analysis
/api/graph returns trust_score, trust_confidence_low, trust_confidence_high in edge objects
☑ Graph visualization shows trust on edge hover (tooltip with trust score and confidence interval)
☑ Edge opacity/width reflects trust level in graph.html

Approach

1. Migration (095_edge_trust_scores.py)

Add columns to knowledge_edges:
  • trust_score REAL DEFAULT 0.5 — overall trust 0-1
  • trust_confidence_low REAL DEFAULT 0.3 — lower bound of confidence interval
  • trust_confidence_high REAL DEFAULT 0.7 — upper bound
  • trust_computation_factors TEXT — JSON blob with breakdown

2. Trust Computation (scidex/core/edge_trust.py)

New module with:
  • source_quality_score(source_id, source_type) — paper quality from citation_count and year (recency)
  • compute_edge_trust(edge_id, db) — full trust computation for a single edge
  • count_confirmations(edge_id, db) — number of independent analyses supporting this edge
  • count_contradictions(edge_id, db) — number of analyses contradicting this edge
  • chain_depth_score(edge_id, db) — how many hops from primary evidence
  • propagate_edge_trust(edge_id, db, visited=None) — recursive downstream trust dampening
  • recompute_edge_trust_for_analysis(analysis_id, db) — batch recompute

Trust formula:

trust = base_quality * depth_penalty * confirmation_boost * contradiction_penalty
base_quality = paper_citation_score * recency_factor
depth_penalty = 0.9^chain_depth
confirmation_boost = 1 + 0.1 * n_confirmations
contradiction_penalty = max(0.3, 1 - 0.2 * n_contradictions)
confidence_interval_width = inversely proportional to evidence count

3. API Updates (api.py)

  • Modify /api/graph to include trust fields in edge response
  • Add /api/graph/{analysis_id}/trust-recompute endpoint to trigger recomputation
  • Add /api/graph/trust-recompute-all endpoint for batch backfill

4. Visualization (site/graph.html)

  • Add trust score to edge tooltip
  • Edge color based on trust tier (high/medium/low): green/yellow/red
  • Edge opacity/width reflects trust level
  • Trust legend added to graph sidebar

Dependencies

  • b5298ea7-69ec-47bd-9115-f2968a374f6d (evidence chains provenance) — uses similar trust model

Dependents

  • Trust propagation needed for world model quality scoring
  • Epistemic status computation uses trust as input

Work Log

2026-04-16 10:55 PT — Slot 0

  • Investigated current state: knowledge_edges has epistemic_status but no trust_score
  • Evidence provenance (b5298ea7) has trust_score on evidence_entries with compute_evidence_trust()
  • Confirmed: trust_score needs to be added to knowledge_edges table
  • Planned approach: migration + new edge_trust.py module + API updates + graph.html visualization

2026-04-16 11:30 PT — Slot 0

  • Implemented migration 095_edge_trust_scores.py adding trust columns
  • Created scidex/core/edge_trust.py with:
- source_quality_score() - paper quality from citations and recency
- compute_edge_trust() - full trust calculation with depth/confirmations/contradictions
- propagate_edge_trust() - downstream trust dampening at 0.85x per hop
- recompute_edge_trust_for_analysis() and recompute_all_edge_trusts()
  • Updated api.py init to add trust columns via ALTER TABLE
  • Added /api/graph/{id}/trust-recompute and /api/graph/trust-recompute-all endpoints
  • Updated site/graph.html:
- Edge data now includes trust_score and confidence bounds
- Edges rendered by trust tier (high/medium/low) with distinct colors
- Hover tooltip shows trust percentage and confidence interval
- Legend added for trust tiers
  • Committed and pushed to main-push branch

2026-04-16 12:15 PT — Slot 0

  • Rebased on origin/main to sync with latest changes
  • Force-pushed rebased branch to push remote
  • Verified implementation intact after rebase:
- edge_trust.py imports correctly
- Migration 095 exists
- API trust-recompute endpoints present at lines 9515 and 9545
- Graph.html trust visualization present

2026-04-16 12:45 PT — Slot 0

  • Merge gate blocked: conflicts with unrelated files (allen brain spec, register_seaad script)
  • Reset to remote branch state, merged latest origin/main (827e1defc) instead of rebasing
  • Resolved .orchestra-slot.json conflict (kept edd66643 slot version)
  • Push succeeded: 67d9942c5

2026-04-16 13:00 PT — Slot 0 (Reopen)

  • Previous rebase destroyed trust scores implementation
  • Reimplemented from scratch:
- Recreated migration/095_edge_trust_scores.py
- Recreated scidex/core/edge_trust.py (429 lines)
- Updated api.py: ALTER TABLE for trust columns + 2 new endpoints
- Updated site/graph.html: trust legend, tier-based edge coloring, trust in tooltip
  • Committed with message naming api.py explicitly (satisfies pre-push hook)
  • Pushed to push remote (force-push due to rebase onto new origin/main)
  • Verified remote at d97dafcf2 on top of origin/main (20204c32b)
  • Final diff: 5 files changed, 770 insertions, 18 deletions

Payload JSON
{
  "requirements": {
    "coding": 5,
    "analysis": 5
  }
}

Sibling Tasks in Quest (Epistemic Rigor) ↗