Description
This task proposes creating a MediaWiki extension to generate on-demand, AI-powered summaries of talk page discussion threads using Wanda's LLM backend (https://www.mediawiki.org/wiki/Extension:Wanda).
Long discussion threads on talk pages are difficult to catch up on. Similar to Gmail's thread summarization, an inline "Summarize" button next to thread topics will send comments to Wanda's configured LLM provider and display a structured summary (main points, differing positions, consensus status, open questions). Summaries are client-side only, labelled as AI-generated, and never saved to page wikitext.
Planned Features
Core Functionality
- Inline "Summarize" button integrated into topic headers (via DiscussionTools or section headers)
- Ephemeral, client-side summary display—never saved to page wikitext or revision history
- Neutral point-of-view (NPOV) extraction of key arguments and participant stances (Support / Oppose / Neutral)
- Detection of current consensus state, open questions, and pending action items
- Clear "AI-generated" provenance badge, timestamp, and model disclaimer
- Hash-based caching via WANObjectCache to prevent duplicate LLM calls for identical thread states
- Multilingual support to summarize discussions into the user's interface language
- Reuses Wanda's existing LLM backend configuration, rate limits, and daily token budget
Technical Implementation
The extension will follow a multi-step pipeline:
- Thread Extraction: Hook into DiscussionTools or parse section wikitext to extract comment trees, indentation levels, timestamps, and usernames while stripping signature noise.
- Context Management: Tokenize thread comments; apply chronological chunking for long threads (>50 comments) to stay within context limits.
- Prompt & Neutrality Enforcement: Instruct the LLM to produce structured JSON with strict NPOV neutrality and claim attribution.
- Backend Invocation: Route requests through Wanda's LLMService provider abstraction (OpenAI, Gemini, Ollama, Wikimedia internal).
- Client-Side Rendering: Render a collapsible Codex card (CdxAccordion / CdxMessage) below the thread header with copy and refresh actions.
Configuration Options
// Cache duration for summaries in seconds (keyed by thread hash) $wgDiscussionSummarizerCacheDuration = 86400; // Minimum comments required before showing "Summarize" button $wgDiscussionSummarizerMinComments = 3; // Max tokens for summary response $wgDiscussionSummarizerMaxTokens = 800; // Temperature (lower for consistent, factual summaries) $wgDiscussionSummarizerTemperature = 0.2; // Allowed namespaces (Talk, Project Talk, etc.) $wgDiscussionSummarizerAllowedNamespaces = [ NS_TALK, NS_PROJECT_TALK ]; // Preferred summary language mode ('user' or 'wiki') $wgDiscussionSummarizerLanguageMode = 'user';
API Enhancements
Add a new API module action=wandasummarize:
| Parameter | Required | Description |
|---|---|---|
| page | Yes | Title of the talk page |
| section | No | Section index number on the page |
| threadid | No | DiscussionTools thread ID |
| detail_level | No | Summary detail: concise, standard, detailed (default: standard) |
| lang | No | Target ISO language code (default: user interface language) |
| force_refresh | No | Bypass cache and re-query LLM (default: false) |
Example API request:
api.php?action=wandasummarize&page=Project:Village_pump_(policy)§ion=4&format=json
Example API response:
json
{
"wandasummarize": {
"success": true,
"thread_title": "RfC: Deprecating legacy citation templates",
"comment_count": 24,
"cached": false,
"summary": {
"overview": "Community discussion on deprecating legacy citation templates in favor of standard Lua-based modules.",
"positions": [
{
"stance": "Support",
"arguments": "Reduces Lua overhead and simplifies visual editor configuration."
},
{
"stance": "Oppose / Caution",
"arguments": "Over 100k transclusions risk formatting breakage; requires bot trials first."
}
],
"consensus_status": "Leaning toward soft deprecation with a phased bot migration.",
"open_questions": [
"Has a bot approval request (BRFA) been submitted?"
],
"action_items": [
"Draft Phabricator task for bot migration trial."
]
},
"disclaimer": "AI-generated summary via Wanda. Does not replace community consensus."
}
}Example Use Cases
Use Case 1: Policy Discussion / RfC
Thread: "RfC: Guidelines for Digital Self-Published Sources" (32 comments)
Process:
- Extract 32 comments and group participant stances.
- Identify primary division: strict ban vs. exceptions for established experts.
- Determine consensus level: leaning toward expert exceptions with editorial history.
- Format into structured overview, positions, and open questions.
Response:
- Overview: Debate on amending WP:SPS guidelines for independent newsletters and podcasts.
- Positions: Support strict ban (concerns over verification) vs. Allow recognized experts (media landscape evolution).
- Consensus: Majority support accepting self-published material from authors with established third-party publishing records.
- Open Questions: How to objectively evaluate "established third-party publication" status.
Use Case 2: Article Talk Page Content Dispute
Thread: "Proposed changes to 'Legacy' section weight" (16 comments)
Process:
- Parse debate over inclusion of a recent academic critique.
- Group viewpoints: WP:DUE inclusion vs. WP:UNDUE fringe concerns.
- Highlight that discussion is actively seeking a single-sentence compromise.
Response:
- Overview: Dispute over balancing recent critical scholarship in the biographical legacy section.
- Positions: Pro-inclusion (WP:DUE representation) vs. Anti-inclusion (WP:UNDUE fringe claim).
- Consensus: No consensus reached yet; editors are drafting compromise wording.
- Open Questions: Are there secondary reviews corroborating the recent critique?
Use Case 3: Technical Bug Triage
Thread: "Table overflow regression on mobile Safari" (11 comments)
Process:
- Identify reported browser symptom and affected skins.
- Trace debugging findings and isolate CSS overflow rule regression.
- Note submitted patch and pending testing steps.
Response:
- Overview: Discussion investigating wide tables overflowing viewport boundaries on mobile Safari after MW 1.43 deployment.
- Root Cause: CSS override in ext.skin.responsive.styles.
- Current Status: Patch submitted on Gerrit; awaiting testing on iOS devices.