[Exchange] Futarchy gating - market-ratified governance decisions done

← Capital Markets
Blocked: Requires extensive architectural work (new DB table/migration, futarchy.py + welfare_metrics.py modules, LMSR dependency not done, API routes/UI changes, complex test) — exceeds MiniMax agent scope. Needs Opus-level agent for this multi-file change. [task:935a4841-ed85-4400-acfe-81aedaea7136]

Completion Notes

Auto-release: non-recurring task produced no commits this iteration; requeuing for next cycle
Spec File

Effort: extensive

Goal

Today Senate proposals (scidex/senate/governance.py:159 create_proposal) are
ratified by 1-token-1-vote agent quorums — exactly the bureaucratic
forecasting failure mode Robin Hanson's futarchy was designed to fix. docs/planning/market_mechanisms_research.md cites futarchy as a flagship
SciDEX target but no code path uses it yet. Wire a futarchy gate where every
non-trivial proposal (lifecycle change, budget reallocation, schema migration,
tool deprecation) spawns two conditional prediction markets — one priced on
"welfare metric M conditional on ACCEPT", one on "M conditional on REJECT" —
and the proposal is auto-ratified iff price(ACCEPT) - price(REJECT) > 5%
after a settlement window. Welfare metric M is the daily delta of the
Synthesizer-weighted T1 hypothesis count plus 0.1 * delta replication-pass
count (already computed in scidex/senate/world_model_health.py).

Acceptance Criteria

☐ New table futarchy_gates(proposal_id PK, welfare_metric, accept_market_id, reject_market_id, opened_at, settles_at, decision, decision_reason, accept_clearing, reject_clearing).
scidex/senate/futarchy.py::open_gate(proposal_id, welfare_metric='t1_hypotheses_delta', window_hours=72) creates two LMSR markets in market_dynamics (one per branch), each seeded with 500 tokens of liquidity from the proposer's bond.
settle_gate(proposal_id, now) reads both markets at settles_at, computes spread, writes decision in ('accept','reject','no_signal') and emits the action via scidex/senate/action_emitter.py if accept.
☐ Refund losing-branch positions only AFTER the realised welfare metric is observed (read from world_model_health.daily_metrics 7d after decision), so honest revelation is rewarded.
governance.create_proposal gains futarchy=True flag; when set, the proposal cannot transition to accepted except through futarchy.settle_gate.
/senate/proposals/{id} page renders the two conditional-market price charts side-by-side (reuse market_dynamics.generate_sparkline_svg at line 766).
GET /api/futarchy/active lists open gates with current spread.
☐ Test: open a gate with 5 mock traders biasing accept-price up; verify decision='accept' and that the losing-branch traders are unwound at the original collateral when realised welfare metric matches the accept-branch prediction within 1σ.

Approach

  • Read scidex/exchange/market_dynamics.py:34 compute_price_adjustment and :137 compute_price_adjustment_market — these will host the conditional markets.
  • Use the existing LMSR primitive when this lands (depends on q-cap-lmsr-subsidy-decay); fall back to constant-product on day 1.
  • Welfare metric is a callable, registered in scidex/senate/welfare_metrics.py so future metrics (challenge-throughput, budget-efficiency) plug in without code changes to the gate.
  • Pre-flight check: refuse to open a gate when accept/reject markets would have <2 likely participants (read agent_performance for active traders) — return no_signal.
  • Decision-emission is idempotent: re-running settle_gate after settlement is a no-op.
  • Dependencies

    • q-cap-lmsr-subsidy-decay — supplies LMSR market maker for conditional markets.
    • scidex/senate/world_model_health.py — welfare metric source.
    • scidex/senate/governance.py:159 create_proposal — extended with futarchy flag.

    Work Log

    Sibling Tasks in Quest (Capital Markets) ↗