---
title: 'How we built an AI blog pipeline, and what it checks before a post ships'
description: >-
  Our AI content pipeline writes only topics a person approved, then a 330-line
  script with no model in it rejects tells, unsourced numbers and unknown
  sources.
author: elroot_labs
date: '2026-11-17'
categories:
  - artificial-intelligence
---
Our AI content pipeline is four parts: a topic list that only a person can approve, a script that decides whether the model runs at all, a model that drafts one post, and a quality gate with no model in it that the draft has to pass before anyone reads it. A pull request then waits for a human: merging it puts the post on a staging copy of the site, and a separate step the owner runs publishes it. Everything below comes from running it on this site since 31 October 2026, including the day it passed a batch of posts that should not have shipped.

## A script decides whether the model runs at all

The daily run starts with `next-topic.mjs`, about 560 words of JavaScript that reads two files and calls no model. It answers one question: is there an approved topic whose material exists, and room in the schedule for it? On most days the answer is no, the script prints `NOTHING_TO_DO` with the reason, and the run ends having spent a fraction of a cent.

We put this step in a script for two reasons. A language model asked "is there anything to write today?" will usually find something, and the answer we wanted on a quiet day was nothing. The second reason is that the model must never choose its own topics. The topic list, `backlog.json`, has six statuses (idea, approved, blocked, drafted, published, rejected) and the run may only write an `approved` one. It can suggest ideas; it cannot approve them.

The script also enforces pace. It stops when two drafts are already waiting for review, or when seven posts are already scheduled ahead. Each topic can list the first-hand files it needs, and a topic whose files are missing is skipped until someone supplies them.

The first real bug lived here. In version one the run counted every open draft branch, but it named branches after the post's slug, while the topic list knew topics by their id. A topic with a draft waiting looked unclaimed, so the next morning's run would have drafted it again. The fix on 31 October (commit `a7bcb36`) names each branch after the topic id and treats a topic as busy while a branch with its id exists.

## The gate is about 330 lines of JavaScript with no model in it

`check-post.mjs` runs in milliseconds and cannot be talked round. That last property is the point of it. A model asked to review its own draft for "AI tells" will find a few and miss the rest, and a model asked whether its draft is original will say yes. A script either matches the pattern or it does not.

These are the checks, in the order the script runs them:

1. Front matter: slug, title, a page title of 60 characters or fewer, an excerpt of 80 to 160 characters, a publish date, the target keyword, a `gain` sentence and an `evidence` list. The keyword's words must appear in the title or excerpt.
1. Uniqueness: no other post may use the same slug or target the same keyword, because two of our own pages competing for one search helps neither.
1. Placeholders: a draft still carrying one of our `NEED` tags, a to-do marker or dummy text fails. This lets us write briefs full of open questions that can never be published by accident.
1. Length and shape: 900 to 3,200 words, at least three H2 headings, no duplicate headings, no H1.
1. Vocabulary: 50 banned phrases (`delve`, `tapestry`, `leverage`, `in conclusion` and the rest of the usual list) fail on sight. A second list of 24 overused words, the adjectives found on every software homepage, fails only when two of them land in the same paragraph.
1. Sentence shapes: 11 regular expressions for patterns that read as generated whatever the vocabulary, such as the `it's not X, it's Y` reveal, `no X, no Y, no Z` lists, a question the writer answers in the next breath, and openers like `in today's`.
1. Unsourced authority: a sentence that leans on unnamed studies or unnamed experts fails unless it links to the source.
1. Punctuation: more than two em dashes, any exclamation mark or any emoji fails.
1. Evidence: any paragraph with a percentage, a multiplier, a currency amount or a figure in millions, crore or lakh must contain a link. Every file named in `evidence` must exist, and every URL named there must be linked in the body.
1. Links: internal links must match a real page, external links must answer, and every external host must be on the approved list.
1. Originality: if more than 12 in every 100 of the draft's five-word phrases already appear in another post, it fails.

The same script runs in a GitHub Action on every pull request that touches a post, so a draft written by hand has to pass the same rules as one written by the model.

## Every source has to come from a list the owner approved

The rule that took longest to arrive was the source list. A run on a laptop can open any page on the internet, and a draft can cite anything it opened. On 31 October (commit `97f7ce5`) the gate started rejecting any external link whose host is not in `config.json`. The list holds 46 entries today: standards bodies such as NIST and OWASP, official documentation from the companies whose products we write about, government sites for Indian regulation, and a handful of research sources.

The list moves in both directions. On 14 November three analyst firms were added so a post could cite their forecasts, and within hours the entries were narrowed from whole domains to the specific subdomains their press releases live on. The commit gives the reason: a wildcard on one firm's domain would also have admitted its user-written review pages, and once the host matches, the gate cannot tell a review from research. When a topic needs a source that is not on the list, the run is told to mark the topic blocked and say which host it wanted, instead of finding a workaround.

## What the gate found when we ran it on our own posts

For this post we ran the current gate over all 22 posts live on the site on 14 November 2026. Twenty-one pass. The one that fails is our oldest, the [production AI agent safety checklist](/blog/production-ai-agent-safety), which was written before the gate existed. It fails five checks: eight em dashes against a limit of two, one `is not simply X` contrast, a link to a host that is not on the approved list, and no `gain` or `evidence` in its front matter. Nobody reading it would call it broken. The gate measures writing habits, and it has no way to judge whether a sentence is true.

We also pulled the first committed version of every post from git history and ran today's gate over each one. Only two fail. One is the same pre-gate post. The other is the first post the pipeline ever published, the [prompt-injection test cases](/blog/prompt-injection-test-cases), whose 176-character excerpt passed the original limit of 200 and fails today, because an SEO audit on 1 November cut the limit to 160, since the excerpt doubles as the page's meta description. Rules tightened after a post shipped will flag that post the next time anyone runs them, which is a reason to rerun the gate over the whole site now and then, as well as over each new draft.

## A post can pass every check and still say nothing

On 14 November the owner read a batch of posts that had passed the gate and judged them hollow. They were accurate, sourced and free of tells. They were also summaries of public documents that a reader could have found in the first five search results. Publishing was paused, and every post in that batch was reworked around something only we had: an experiment run on our own machines, a calculation with its assumptions stated, or this repository's own history.

That is the gap no script closes. The `gain` field forces the writer to state, in a full sentence, what the post adds that the top results do not, and the gate checks that the sentence exists and is at least 40 characters long. It cannot check that the sentence is true. Google's own guidance says the same thing from the other side: it warns that using generative tools "to generate many pages without adding value for users" may fall under its [scaled content abuse policy](https://developers.google.com/search/docs/essentials/spam-policies), and its page on [AI-generated content](https://developers.google.com/search/docs/fundamentals/using-gen-ai-content) asks for accuracy, quality and relevance, "especially when automatically generating the content".

So the rule now sits upstream of the model. Every topic names a file in `marketing/inputs/` that holds the first-hand material, and the pre-flight will not start a draft until that file exists. The writer may state only facts that are in those files or on the site. When we cleaned up the backlog on 14 November, four topics were deleted outright because an honest version needed hands-on product testing the run could not claim, and one cost post was blocked because the owner decided not to publish figures. A cost question answered with no number fails the reader it attracts.

## Review mode keeps a person on the publish button

The run never pushes to the branches that deploy. It opens a pull request with the draft, the gate output, the sources it opened and two social posts, and stops. Merging sends the post to a staging copy of the site, where it can be read as visitors will see it, and the owner's "publish to live" step is the real publish button. Each post carries a publish date. The live site is built ahead of time and leaves out any post dated in the future, so a daily job rebuilds it on each morning a post falls due. A reviewer can approve a week of posts at once and they appear one by one, with nobody touching anything.

An auto mode exists and is off. It would skip the pull request and send a post straight to staging when the gate reports no failures and no warnings; going live would still take the owner's step. We have not turned it on because the hollow batch passed with no failures, which is the whole argument against it.

## If we started again, we would build the gate first

Looking at the commit history, the order we built things in was writer, then gate, then source list, then the inputs folder. We would reverse it. The inputs folder is the part that decides whether a post is worth reading, the source list decides whether it can be trusted, and the gate keeps both honest at the speed of a script. The model is the easiest part to replace and the least important to get right first.

If you are building something similar for your own content, the same logic applies to any process where a model produces work a person signs off: put the checks a script can make in a script, and spend human attention on the one question a script cannot answer. We used the same approach for [the MVP of this pipeline](/blog/mvp-development), and it is how we approach [AI agents that act on real systems](/blog/agent-approval-step-design).
