AI Publisher: 5-Agent Article Generation Pipeline and Quality Gates

AI Publisher (github.com/jakefearsd/aipublisher, separate from the Wikantik codebase) is a Java 25, Spring Boot 3.5 and LangChain4j command-line tool that turns a topic into a wiki article by passing one document through five specialised LLM agents. Rather than relying on single-shot generation, it separates research, drafting, verification, editing and review, and loops back for revision when a stage is not satisfied. It runs against a local Ollama server by default (llm.provider=ollama, model qwen3:14b) and against Anthropic Claude with --llm.provider=anthropic and ANTHROPIC_API_KEY.

This guide covers the agent roles, the state machine and revision loop, the quality settings, and the output format.


1. Quick-Reference: The Five Agents

AgentRoleOutputRuns by default?
ResearchGathers key facts and sources and builds an outline, grounded with WikidataResearchBriefYes
WriterDrafts the article in JSPWiki syntaxArticleDraftYes
Fact CheckerVerifies every claim against the sources; outcome APPROVE, REVISE or REJECTFactCheckReportNo (pipeline.skip-fact-check=true)
EditorPolishes prose, integrates wiki links, scores qualityFinalArticleYes
CriticReviews JSPWiki syntax, structure and readabilityCriticReportNo (pipeline.skip-critique=true)

The shipped application.properties skips the fact check and the critique, so a plain java -jar aipublisher.jar -t "Topic" runs Research, Writer and Editor only. ./publish.sh (or --pipeline.skip-fact-check=false --pipeline.skip-critique=false) runs all five.


2. State Machine and Revision Loop

CREATED -> RESEARCHING -> DRAFTING -> FACT_CHECKING -> EDITING -> CRITIQUING -> PUBLISHED
                              ^             |              ^            |
                              +--- REVISION LOOP ----------+------------+

Any non-terminal state -> AWAITING_APPROVAL -> continue or REJECTED

With the defaults, a document goes DRAFTING to EDITING and EDITING to PUBLISHED, skipping the two optional phases. A fact check that returns REVISE sends the document back to drafting, and a critique can send it back to editing or drafting. The loop is bounded by pipeline.max-revision-cycles (default 3), and each phase by pipeline.phase-timeout (default PT5M). PUBLISHED and REJECTED are terminal.

Each agent extends a common BaseAgent whose process() method owns the retry loop (3 attempts with exponential backoff by default), timing and contribution recording.

3. Quality Settings

SettingShipped default
quality.min-editor-score0.8
quality.min-factcheck-confidenceMEDIUM
quality.require-verified-claimstrue
pipeline.approval.before-publishtrue (a human approves before the file is written; --auto-approve skips the prompt)
pipeline.approval.after-research, after-draft, after-factcheckfalse

WikiSyntaxValidator checks, and where possible repairs, the JSPWiki markup. When a phase fails, the partial document is written to the output directory as PageName_FAILED_<STATE>_<timestamp>.txt with a header naming the phase and error.

4. Inputs and Outputs

See also: ContentPipelineHub.