[Exchange] Belief Evolution Tracking for Hypotheses
Task ID: q06-b1-5D2ECAD1
Priority: 90
Layer: Exchange (The Exchange — prediction market layer)
Goal
Track how confidence in hypotheses changes over time to measure whether SciDEX is converging on scientific truth. Implement a belief_snapshots table that captures weekly snapshots of hypothesis scores, evidence counts, citations, and reviewer engagement. Visualize belief trajectories on hypothesis detail pages and correlate with market price history to show convergence/divergence patterns. This is a foundational feature for measuring platform effectiveness — does increased evidence lead to stable consensus or continued volatility?
Acceptance Criteria
☐ Database schema: belief_snapshots table created with fields (id, hypothesis_id, score, evidence_count, citations, reviewer_count, snapshot_date)
☐ Migration script created and applied using the migration framework
☐ Weekly auto-snapshot mechanism (cron or scheduled task) to capture current state of all hypotheses
☐ API endpoint /api/hypotheses/{id}/belief_trajectory returning time series data
☐ Belief trajectory chart on hypothesis detail pages (score over time)
☐ Correlation visualization: belief trajectory vs. price_history on same chart
☐ Initial snapshot taken for all existing hypotheses
☐ Documentation: how snapshots work, what they measure, interpretation guide
☐ Tested: verify snapshots are captured, API returns correct data, charts render
Approach
Create migration for belief_snapshots table
- Use migration framework (
scidex db migrate)
- Schema: id (PK), hypothesis_id (FK), score (REAL), evidence_count (INT), citations (INT), reviewer_count (INT), snapshot_date (TEXT/ISO8601)
- Add index on (hypothesis_id, snapshot_date) for efficient queries
Build snapshot capture function
- Function:
capture_belief_snapshot(hypothesis_id) in new
belief_tracker.py - Query current state from
hypotheses table and
price_history - Insert into
belief_snapshots with current timestamp
- Handle missing data gracefully
Implement weekly auto-snapshot
- Add cron job or use Orchestra recurring task
- Script:
snapshot_beliefs.py — iterate all active hypotheses and capture snapshots
- Log snapshot count and any errors
Add API endpoint for belief trajectory
- Route:
/api/hypotheses/{id}/belief_trajectory - Return JSON:
{"snapshots": [...], "price_history": [...]} - Include both belief_snapshots and market price_history for correlation
Update hypothesis detail page with chart
- Use Chart.js or similar lightweight library
- Dual-axis chart: belief score (left Y) and price (right Y) vs. time (X)
- Show evidence_count as tooltip or secondary visualization
Bootstrap initial snapshots
- Run one-time script to capture current state for all existing hypotheses
- This gives baseline for future comparisons
Test and document
- Verify snapshots captured correctly
- Check API returns valid JSON
- Confirm chart renders on hypothesis pages
- Document interpretation: stable vs. volatile beliefs
Work Log
2026-04-02 [timestamp] — Slot 7
- Started task: belief evolution tracking
- Creating spec file