Batch page selection
Paste titles, load from a category, or find pages that transclude a template (optional prefix filter). Validation shows editable pages and skips problems early.
Select pages by title list, category, or template transclusion, run AI operations (wikilinks, spellcheck, formatting, style, templates, or custom instructions), review wiki-style diffs, approve, and save through MediaWiki's normal edit pipeline.
Built for production wikis: server-side LLM calls, permissions, rate limits, and audit logging.
Paste titles, load from a category, or find pages that transclude a template (optional prefix filter). Validation shows editable pages and skips problems early.
Wikilinks, spellcheck, formatting, writing style, templates (with remote reference fetch), and custom instructions.
The browser starts a batch and polls for progress. Cancel mid-run to stop remaining pages. Configurable concurrency per poll.
Lazy-loaded wikitext diffs plus a Preview article button that opens the rendered proposed page in a new tab before save.
Approve per page or in bulk. Saves use your edit summary, draft tokens, and the aibatcheditor change tag.
Proposal warnings, diff-reviewed confirmations, post-save revision links, rate limits, and Monolog audit channel.
Requires MediaWiki 1.43+ (Vue and Codex in core). Tested on 1.43 LTS through 1.45+.
| Environment | Supported? | Notes |
|---|---|---|
| Self-hosted (Docker, VPS, local) | Yes | Admin installs extension and configures LLM |
| Private / corporate wikis | Yes | Same requirements |
| Wiki farms (Miraheze, ShoutWiki) | Maybe | Custom extensions + outbound HTTPS required |
| Wikimedia wikis (Wikipedia, Commons) | No | Third-party; not in WMF deployment |
Processes only existing, non-redirect wikitext pages the user can edit. PHP 8.1+, JavaScript, and outbound HTTPS to the LLM API are required.
The extension edits wikitext — it is not a web search or research agent.
Prompts follow a surgical-edit contract: smallest necessary change, copy everything else unchanged, return input as-is when already satisfied. Provide external facts in your instructions when needed.
$wgAIBatchEditorPromptPreview).
| Feature | Behavior |
|---|---|
| Privacy notice | Shown when the LLM is configured |
| Rate-limit notice | Draft disabled when batch exceeds remaining hourly quota |
| Lazy diffs | Diffs load on demand, not automatically |
| Proposal warnings | Flags major deletions, near-empty output, large growth, removed headings |
| Diff-reviewed gate | Confirms approve/save if diffs were not previewed |
| Draft tokens | HMAC tokens bind proposals to user, revision, and content hash |
| Post-save links | Revision and history links after successful save |
Requires MediaWiki 1.43+ and a Grok-compatible chat completions endpoint (xAI by default).
git clone https://github.com/urimacias/AIBatchEditor/ extensions/AIBatchEditor
Add to LocalSettings.php:
wfLoadExtension( 'AIBatchEditor' );
$wgAIBatchEditorApiUrl = 'https://api.x.ai/v1/chat/completions';
// XAI_API_KEY in $IP/.env — loaded automatically; do not commit the key
Sensible defaults are built in (model grok-4.3, 420 s LLM timeout, batch cap 100, 500 requests/hour, concurrency 1). Set $wgAIBatchEditorConcurrency = 2 for parallel LLM calls; set $wgAIBatchEditorReasoningEffort = 'low' for faster grok-4.5. Batch progress uses CACHE_DB automatically. Store the API key in $IP/.env or Docker .env, never in git.
Users need the aibatchedit right (granted to sysop by default).
Batch progress is stored in CACHE_DB (mw_objectcache) by the extension. Optional APCu for general wiki speed:
$wgMainCacheType = CACHE_ACCEL;
$wgSessionCacheType = CACHE_DB;
| Setting | Default | Purpose |
|---|---|---|
$wgAIBatchEditorApiUrl | '' | LLM endpoint (server-side only) |
$wgAIBatchEditorApiKey | '' | API key / bearer token |
$wgAIBatchEditorModel | grok-4.3 | Model identifier |
$wgAIBatchEditorMaxBatch | 100 | Max pages per batch |
$wgAIBatchEditorMaxPageSize | 2097152 | Max wikitext bytes per page, 2 MiB (0 = no limit) |
$wgAIBatchEditorMaxInstructionsLength | 8192 | Max AI instruction bytes |
$wgAIBatchEditorRequestTimeout | 420 | LLM HTTP timeout (seconds) |
$wgAIBatchEditorTemperature | 0.1 | LLM temperature; lower = stricter instruction following |
$wgAIBatchEditorPromptPreview | false | Debug flag: expose prompts in UI/API (enable only for troubleshooting) |
$wgAIBatchEditorRateLimitPerHour | 500 | AI requests per user per hour |
$wgAIBatchEditorPollIntervalMs | 2500 | Client interval between batch status polls |
$wgAIBatchEditorConcurrency | 1 | Pages per advance (LLM in parallel when > 1) |
$wgAIBatchEditorReasoningEffort | '' | xAI effort: low / medium / high (empty = omit) |
$wgAIBatchEditorStubMode | false | Deterministic AI stub for automated browser tests only |
$wgAIBatchEditorTemplateSourceWiki | https://es.wikipedia.org | Default remote wiki for template references |
$wgAIBatchEditorTemplateSourceAllowHosts | see extension.json | Allowed hosts for template source overrides |
$wgAIBatchEditorOperationProfiles | see extension.json | Per-operation profile intensity (UI help + LLM prompt) |
$wgAIBatchEditorSystemPrompt | [] | Wiki context after ROLE (WIKI CONTEXT); prefer identity; op checklists need “UNICAMENTE con la operación equivalente” |
$wgAIBatchEditorSystemPromptAppend | [] | Wiki-wide extra system-prompt bullets at end (append-only; operation task takes precedence) |
| Module | Mode | Purpose |
|---|---|---|
aibatcheditorlist | read | Validate and list pages; rate-limit status |
aibatcheditorpreview | read | Build LLM prompts without calling the AI |
aibatcheditorbatchstart | read | Start server-side batch; returns batchId |
aibatcheditorbatchadvance | read | Process next batch chunk (LLM work) |
aibatcheditorbatchstatus | read | Read batch progress (fast; no LLM) |
aibatcheditorbatchcancel | read | Cancel a running batch; clears pending pages |
aibatcheditordiff | read | Render preview diff |
aibatcheditorarticlepreview | read | Stage proposed wikitext; return article preview URL |
aibatcheditorrefreshdrafttokens | write | Refresh draftToken values before save |
aibatcheditorsave | write | Save approved edits (requires draftToken per edit) |
The UI uses batchadvance for LLM work and lightweight batchstatus polls for progress. Wikitext and draftToken come from advance responses only. Save recovers stale tokens server-side; aibatcheditorrefreshdrafttokens is available for API integrations.
127 PHPUnit tests (62 unit + 65 integration) + Playwright E2E. Run from the MediaWiki root with dev dependencies installed.
composer install --dev
./extensions/AIBatchEditor/tests/run-phpunit.sh
# E2E (Node.js + sysop credentials + stub mode)
export MW_E2E_USER=Admin
export MW_E2E_PASSWORD='your-password'
export AIBATCHEDITOR_E2E_STUB=1
./extensions/AIBatchEditor/tests/run-e2e.sh
See tests/QA-CHECKLIST.md in the repository for manual release verification.