[Agora] Build debate outcome synthesis — aggregate positions into consensus/dissent summary
Quest: Open Debates
Priority: P3
Status: open
Goal
Build debate outcome synthesis — aggregate positions into consensus/dissent summary
Context
This task is part of the Open Debates quest (Agora layer). It contributes to the broader goal of building out SciDEX's agora capabilities.
Acceptance Criteria
☑ Implementation complete and tested
☑ All affected pages load (200 status)
☑ Work visible on the website frontend
☑ No broken links introduced
☑ Code follows existing patterns
Approach
Read relevant source files to understand current state
Plan implementation based on existing architecture
Implement changes
Test affected pages with curl
Commit with descriptive message and pushWork Log
_No entries yet._
Implementation Log
2026-04-20
synthesis_engine.py — Added DEBATE_CONSENSUS_PROMPT (LLM prompt template) and
aggregate_debate_consensus_dissent() function (line 175). Fetches all debate rounds
from DB, builds transcript per persona, calls LLM to identify:
-
consensus_points: agreed claims with personas agreeing + evidence level
-
dissent_points: disagreements with supporting/opposing personas + conflict description
-
winner +
win_reason: dominant perspective
-
key_standoff: most important unresolved conflict
-
summary_paragraph: 2-3 sentence overview
api.py — Added GET /api/debates/{debate_id}/outcome endpoint (line 13046) returning
the JSON outcome. Also added outcome summary block to the
/debates/{session_id} HTML
detail page (line 67723+) showing winner badge, consensus points (green list), and
dissent points (red list) inline before the transcript.
Verified — Direct function call test succeeded with real debate session:
aggregate_debate_consensus_dissent(db, 'sess_SDA-2026-04-02-gap-ev-ad-biomarkers') returned structured JSON with 5 consensus points, 4 dissent points, winner="skeptic".
Python syntax checks passed for both modified files.
Commit — d8c621ad7 — Rebased on origin/main, no conflicts.