MARKETING.md: The Config File Behind My AI Content Pipeline
Three laws. Ten formats. Three gate scripts. One command from research to Discord approval. Here's how the whole system works.
Every developer using Claude Code has a CLAUDE.md. It tells the agent what tools exist, what constraints apply, what good output looks like. Without it, the agent guesses. With it, the agent executes.
I built the same thing for marketing. It's called MARKETING.md, and it powers an AI content pipeline that runs every piece of content I ship — blog posts, cold emails, ad copy, press releases, SEO articles — through the same disciplined process before anything reaches a human for approval.
The system is called Kai Harness. Here's what it does and how it works.
The Problem It Solves
AI can write. That's not the hard part anymore.
The hard part: consistent quality across 10 different content formats, 5 different sites, written by an agent that starts fresh every session with no memory of what worked last month.
Before this system existed, every content run was a coin flip. Good brief → decent output. Bad brief → generic output. No brief → the model invented one, and it was always wrong. No tracking → no way to know if anything worked. No quality gate → hollow copy shipped because no one caught it before publish.
MARKETING.md fixes the brief problem. The gate scripts fix the quality problem. The pattern loop fixes the memory problem.
How the AI Content Pipeline Runs
One command:
kai-harness run --task blog --site kaicalls --keyword "law firm answering service"
Six steps run in sequence:
-
01
Research brief generation Google Search Console pulls live keyword data. The system builds a structured brief: keyword cluster, persona match, competitor weakness, three hook variants, recommended angle, CTA. The write agent never starts without this.
-
02
Format-specific instructions loaded Each content type has its own instructions file. Blog posts get one set of rules. Cold email sequences get another. Meta ads get a third. Structure, length, tone, required elements, and what failure looks like for that format.
-
03
Draft written The write agent reads the brief and the format instructions, then drafts. No ad-libbing on structure. No invented personas. No guessing what the keyword strategy should be.
-
04
Three gate scripts run automatically Hard blocks on fail. No human sees the draft until all three pass.
-
05
Draft posts to Discord for approval One message. Full draft. Approve or reject.
-
06
On publish: logged + 30-day performance check scheduled Every piece gets a record. The performance check fires automatically — no manual follow-up required.
Start to Discord approval request: one command.
The Three Gate Scripts
No gate pass, no publish. That's not a suggestion — it's enforced.
four_us_score.py
An LLM grades the draft on four dimensions: Unique, Useful, Ultra-specific, Urgent. Each scores 0–4. Long-form content needs 12/16. Ad copy needs 10/16. Hard block on fail.
The grader is external — the model that wrote the draft doesn't grade it. Self-grading is how you get AI that confidently rates mediocre output as excellent. External grading catches the real issues.
A recent failure note from the script:
The script triggers an automated revision loop on fail — the write agent reads the failure report, revises, re-gates. Two auto-retry attempts before escalating to human review.
banned_word_check.py
Three tiers. Tier 1 kills the draft: 14 corporate buzzwords, hollow consulting-speak, and AI-generated filler phrases. Any hit returns the exact word and a suggested replacement. Hard block.
Tier 2 flags corporate transitional filler — the phrases that signal padding over substance. Tier 3 warns on weak qualifiers — hedging language that softens claims without adding nuance.
The check runs in 2 seconds. It catches what tired eyes miss at 11pm before a deadline.
seo_lint.py
Six structural checks: title contains the target keyword, first 100 words answer the query directly, at least one H2 includes a secondary keyword, two or more internal links present, sentence length averages under 20 words, keyword density 1–2%.
Skips automatically for short-form ad copy. No point running keyword density checks on a 30-word Google RSA headline.
Three Laws
The three laws exist because every content operation breaks in the same three places.
Law 1: Without a brief, the model invents one. The invented brief is always optimistic, always generic, and never accounts for what the actual target keyword needs. Fifteen minutes of GSC data and competitor analysis prevents 80% of rewrites.
Law 2: Quality gates without enforcement are suggestions. The harness treats them as blockers. A draft that fails the Four U's score doesn't get "flagged for review later." It gets revised and re-gated before it moves.
Law 3: You can't improve what you don't track. Every piece gets a record: publish date, keyword, format, site, URL. The 30-day performance check fires from that record automatically.
Formats
Each format has different gate thresholds and different instructions. Cold email enforces a 3-touch sequence structure: personalization line, problem statement, social proof, low-friction CTA, no meeting ask in the first email. Meta ads generate three A/B/C variants with different hook angles — curiosity, direct, fear of missing out — so testing starts from day one instead of running one creative until it dies.
The format instructions are the part most content ops get wrong. They write "write a LinkedIn post" and expect the model to know that LinkedIn rewards short paragraphs, that professional-angle hooks outperform casual ones, that the first line gets cut off in the feed and needs to earn the click independently. That institutional knowledge lives in the instructions file, not in the model's weights.
The Self-Improvement Loop
When a piece wins — position 5 or better in search, CTR above 5%, average session over 90 seconds — pattern_extract.py runs on it. The script identifies structural patterns and appends to knowledge/playbooks/what-works.md.
Every Monday, a cron surfaces statistical patterns across all winners:
Those patterns feed the write agent on every subsequent run. The 50th piece the harness produces has 49 pieces of real performance data informing its approach.
Most AI content tools start fresh every session. This one compounds.
Discord Commands
What MARKETING.md Actually Contains
The config file tells the agent four specifics:
- What tools exist — which scripts to run, in what order, with what thresholds
- What formats are available — and where the instructions file for each lives
- What the three laws are — enforced, not suggested
- What winning looks like — what metrics trigger the pattern extraction loop
It's not a prompt. It's an operating spec. The difference: a prompt tells the model what to do this session. An operating spec tells it how the whole system works and what role it plays in that system.
A developer dropped into a codebase without CLAUDE.md guesses at conventions and makes expensive mistakes. An agent dropped into a content operation without MARKETING.md does the same thing. Every session. Every time.
What I'd Add Next
Proactive scheduling: the system looks at the content calendar 10 days out, identifies thin coverage on high-performing topics, and generates draft briefs before the gap appears. Right now the gap detection is reactive — it warns when you're already behind.
Negative feedback loop: the pattern extractor currently learns from winners. It should learn from underperformers too — what hook type, what format, what angle correlated with low CTR or short sessions. Negative signal is often more informative than positive.
If you want to see the full system in production — the harness, the pattern loop, the gate scripts — it all runs at meetkai.xyz. The agent skills page shows what's been shipped.