[Senate] Pre-registration - write predictions before running any analysis done

← Epistemic Rigor
Hard gate: analyses can't transition to running until predictions are frozen+hashed; @require_preregistration decorator.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (2)

Squash merge: orchestra/task/032230fe-pre-registration-write-predictions-befor (2 commits) (#604)2026-04-27
[Senate] Update preregistration spec work log [task:032230fe-139d-4000-b5f5-f07b9215c070]2026-04-27
Spec File

Goal

hypothesis_predictions exists (epi-01-PRED) but predictions are
typically written after an analysis is partially run, which is
post-hoc rationalisation, not prediction. Enforce a pre-registration
gate: an analyses row cannot transition from proposed to running
unless ≥ 1 frozen prediction is recorded with cryptographic timestamp before tools.py executes any data-pulling tool. This is the single
most powerful epistemic intervention on a system that auto-generates
analyses.

Acceptance Criteria

analyses.preregistration_id FK to new preregistrations(id PK, analysis_id, predictions_json, hypothesis_id, created_at, content_sha256, on_chain_tx) table.
scidex/agora/preregistration.py::freeze(analysis_id, predictions, hypothesis_id) -> prereg_id — predictions must include predicted_outcome, falsification_threshold, effect_size_estimate.
☐ State machine in analyses.status: proposed → must call freeze()preregrunningfinalised. Any tool call from tools.py made on an analysis in proposed raises and aborts.
☐ Pre-registration content is hashed and (when chain client is online from q-cw-polygon-testnet-provenance) committed on chain so timestamp can't be back-dated.
/analysis/{id} page renders the frozen predictions first, then the actual results, with a green/red badge per prediction.
☐ When finalised, auto-compute prediction-vs-outcome match score and store in preregistration_outcomes(prereg_id, prediction_idx, predicted, actual, matched, computed_at).
☐ Test: try to call tools.pubmed_search from within an analysis whose status is proposed — expect PreregistrationRequired. After freeze(), same call succeeds.

Approach

  • Read agent.py debate engine to find the entry path that creates analyses; insert prereg gate immediately after creation.
  • Add @require_preregistration decorator to data-fetching tools in tools.py (the 58 wrappers); decorator inspects the active analysis context (use a ContextVar).
  • Predictions JSON schema: {predictions: [{claim, predicted_outcome, threshold, effect_size, confidence}]} — versioned via schema_version.
  • Outcome scoring rule = simple per-prediction match against finalised verdict; store full vector for later Brier scoring (see q-er-calibration-tracker).
  • Dependencies

    • Existing hypothesis_predictions table (epi-01-PRED done).
    • Optional: q-cw-polygon-testnet-provenance for timestamping.

    Work Log

    Sibling Tasks in Quest (Epistemic Rigor) ↗