Case

Content PipelineTopic in, publication-ready article out.

2025Internal toolLive

A seven-stage AI pipeline that takes a topic and produces a publication-ready article: SEO metadata, generated images with deterministic post-processing, and direct CMS publishing, while enforcing the client's specific voice, framework, and quality rules at every stage.

Story

Seven stages, each with its own job. Each one feeds the next.

The ask was a tool their team could actually use, not a proof of concept that needed a developer in the room to run. A niche content publisher was producing domain-specific long-form articles at volume and needed every piece to be indistinguishable from their best human writing, not just in style, but in strict adherence to a specific intellectual framework, a controlled vocabulary, and quality standards that had previously required manual review on every piece.

Decompose the generation task into seven discrete stages, each with its own model, its own prompt, and its own job. Haiku handles fast, structured work: research analysis, title refinement, image scene descriptions, HTML conversion. Sonnet handles the reasoning-heavy work: drafting, outline construction, voice-sensitive rewrites, and adversarial evaluation. By the time the draft runs, it has real search data, retrieved source passages, a structured outline, and key takeaways already in context.

Pipeline
ResearchSERP researchLive search results go to Claude for structured intent analysis: keyword clusters, audience targeting, competitor angles, and writing style signals.
TitleTitle and key takeawaysHaiku refines the title and extracts takeaways for the stages that follow.
OutlineRAG-grounded outlineChromaDB and Sonnet build a structured outline with source passages mapped to each section.
DraftFull draftSonnet writes to the client's voice, framework, and banned vocabulary.
EvaluateAdversarial evaluationA second Sonnet call with a critic prompt returns a structured PASS, FLAG, or FAIL verdict with flagged line references.
ImagesImage generation and post-processingfal.ai or DALL-E 3 produce the images, then a PIL pipeline applies texture, grain, vignette, and text compositing.
PublishCMS publishImages upload to cloud storage, the HTML is rewritten with final URLs, and the posts record is upserted in the client's Supabase backend.
Shipped
  • RAG-grounded generation: top passages retrieved at the article level and per section heading, injected into the draft prompt as an organized block, not appended noise
  • Adversarial evaluation against the client's framework rules, banned vocabulary, and factual risk categories
  • Image post-processing that makes output look designed, not generated
  • One-click path from draft to live through direct CMS publishing
  • Real-time SSE streaming of every stage to the browser, with blocking AI calls in async threads so the event loop stays clear
  • Click-to-fix review: every flagged paragraph opens inline for a targeted Claude rewrite that replaces only that paragraph
  • Short-form script generator and ElevenLabs voiced audio, from article to audio without leaving the tool
Stack
API serverFastAPI + Uvicorn: async-native, SSE streaming
AI: draftingClaude Sonnet: outline, draft, evaluation, rewrites, TikTok scripts
AI: fast tasksClaude Haiku: SERP analysis, title, scene descriptions, HTML conversion
SearchSerpAPI: live Google results for research grounding
RAGChromaDB (local vector store) + OpenAI embeddings
Image generationfal.ai / DALL-E 3: with PIL post-processing pipeline
AudioElevenLabs TTS: voice-tagged script to audio
Publishing targetSupabase: Postgres posts table + Storage for images
DeploymentRailway: Nixpacks build, zero-config
Outcome

The pipeline runs end to end without a developer present: topic in, publication-ready article out, with generated images, SEO metadata, and a direct CMS publish in a single session.

Four problems separate a demo from a production content tool. Voice enforcement at scale: one generation pass isn't enough, so a separate adversarial prompt acts as a critic rather than a creator, and the evaluation stage is the quality gate. RAG that changes the output: the articles cite real arguments from real sources without hallucinated attribution. Image post-processing as a quality layer: AI-generated images look AI-generated, so a deterministic PIL pipeline runs on every image. Content filter handling: the system detects rejection, retries with a softened prompt, and falls back across providers. Discovered through production testing, not documented anywhere.

The design pattern generalizes to any domain where a client has a specific voice, a specific knowledge base, and a specific quality bar. Generate with the right model for each stage. Ground in a curated source corpus. Audit with an adversarial prompt before anything ships. That architecture, not any particular prompt, is what produces output that clients trust enough to publish without a human rewrite.

Next caseROEDA rule handles it, or a person does.All work →

Have a problem that fits?

Get a plan by tomorrow →