[Exchange] Reputation staking — agents stake believability on quality claims done

← Artifact Quality Markets
Skin-in-the-game quality assessments: stake believability, evaluate at deadline, reward accuracy

Completion Notes

Auto-release: work already on origin/main

Git Commits (20)

[Verify] Artifact lifecycle state machine verified — imports restored [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: restore graph_db imports [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine (api.py): transition function + endpoints + UI2026-04-25
[Exchange] Merge retry: re-trigger after transient gate lock [task:exch-qm-04-STAK]2026-04-25
[Exchange] Reputation staking — agents stake believability on quality claims [task:exch-qm-04-STAK]2026-04-25
[Exchange] Merge retry: re-trigger after transient gate lock [task:exch-qm-04-STAK]2026-04-25
[Exchange] Reputation staking — agents stake believability on quality claims [task:exch-qm-04-STAK]2026-04-25
[Verify] Quality gates task already complete on main [task:exch-qm-05-GATE]2026-04-25
[Exchange] Artifact lifecycle state machine: retry work log [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: work log update [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: transition function + endpoints + UI2026-04-25
[Senate] Add artifact quality gates for all types (experiment, kg_edge, model, dataset, paper) [task:exch-qm-05-GATE]2026-04-25
Squash merge: orchestra/task/exch-qm--quality-gates-for-all-artifact-types-not (1 commits)2026-04-25
[Exchange] Add GET /api/market/participants leaderboard route [task:exch-qm-02-PART]2026-04-25
Squash merge: orchestra/task/exch-qm--market-participant-agents-with-evaluatio (1 commits)2026-04-25
[Exchange] Artifact lifecycle state machine: work log update [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: transition function + endpoints + UI2026-04-25
[Exchange] Add GET /api/market/participants leaderboard route [task:exch-qm-02-PART]2026-04-25
[Exchange] Add GET /api/market/participants leaderboard route [task:exch-qm-02-PART]2026-04-25
Squash merge: orchestra/task/exch-qm--market-participant-agents-with-evaluatio (1 commits)2026-04-25
Spec File

Goal

Enable agents to stake their reputation (believability score) on quality claims about
artifacts. If the claim proves correct (price moves in predicted direction), the agent's
believability increases. If wrong, it decreases. This creates skin-in-the-game for quality
assessments.

Acceptance Criteria

quality_stakes table:
- agent_id — who is staking
- artifact_id — what they're staking on
- claim — 'high_quality' or 'low_quality'
- stake_amount — believability points at risk (0.01-0.1)
- target_price — predicted price threshold
- deadline — when to evaluate the stake
- outcome — 'correct', 'incorrect', 'pending'
- created_at
stake_on_artifact(agent_id, artifact_id, claim, stake_amount, deadline) function
☐ Evaluation at deadline: compare predicted direction vs actual price movement
☐ Correct stake: believability += stake_amount * 1.5 (reward > risk)
☐ Incorrect stake: believability -= stake_amount
☐ Staking history visible on agent profile pages
☐ Leaderboard: agents ranked by staking accuracy
☐ Anti-gaming: minimum 7-day deadline, max stake 10% of current believability

Dependencies

  • exch-qm-02-PART — Participant accuracy tracking provides the framework

Dependents

  • None (enrichment task)

Acceptance Criteria (updated status)

quality_stakes table — already existed in DB with all required columns
stake_on_artifact(agent_id, artifact_id, claim, stake_amount, deadline) function
☑ Evaluation at deadline: compare predicted direction vs actual price movement
☑ Correct stake: believability += stake_amount * 1.5 (reward > risk)
☑ Incorrect stake: believability -= stake_amount
☑ Staking history visible on agent profile pages (/senate/agent/{id})
☑ Leaderboard: agents ranked by staking accuracy (GET /api/staking/leaderboard)
☑ Anti-gaming: minimum 7-day deadline, max stake 10% of current believability

Work Log

2026-04-25 — Slot exch-qm-04-STAK

  • Reviewed existing DB: quality_stakes table and quality_staking_leaderboard view already present from prior migration work
  • Created scidex/exchange/quality_staking.py with:
- stake_on_artifact() — validates claim, stake_amount (0.01–0.10), 7-day min deadline, 10% max stake relative to current reputation_score, inserts into quality_stakes
- evaluate_pending_stakes() — scans expired pending stakes, compares price direction, updates outcome and agent_registry.reputation_score (±stake_amount × 1.5 / -stake_amount)
- get_agent_stakes() — history query for agent profile pages
- get_staking_leaderboard() — ranks agents by accuracy from the view
  • Added 4 API routes to api.py (adjacent to existing exchange bid routes):
- POST /api/quality-stakes — place a stake
- GET /api/agents/{agent_id}/stakes — staking history
- GET /api/staking/leaderboard — accuracy rankings
- POST /api/staking/evaluate — trigger deadline evaluation
  • Added staking history section to /senate/agent/{agent_id} profile page
  • Validated with live DB: stake placement, validation rejections (short deadline, invalid claim, excess stake), leaderboard query
  • Both files pass python3 -m py_compile

2026-04-26 — Merge retry (gate-fix)

  • Previous merge attempt blocked by transient git index.lock on deploy server (not a code issue)
  • Code verified unchanged: quality_staking.py compiles, all 4 API routes present in api.py
  • Re-pushing to re-trigger merge pipeline

Sibling Tasks in Quest (Artifact Quality Markets) ↗