Harness engineering for marketing. 28 quality rules score every piece. 8 YAML policies gate publishing. A self-improvement loop makes the 50th piece better than the 1st.
A CI/CD pipeline for marketing content. Brief → Write → Score → Gate → Publish → Check → Learn. Each stage enforced.
Pulls live GSC + GA4 data. Identifies competitor weakness. Outputs structured JSON brief.
Loads knowledge frameworks, winning patterns, and MARKETING.md config. No free choices about structure.
28 rules across 4 categories score 0–100. Per-line violations with exact fix suggestions.
YAML policy decides: auto-approve (score ≥85), hold for review (60–85), or reject (<60). SQLite audit trail.
On rejection, feeds exact violations back to the writer. Rule ID, line number, fix suggestion. Max 2 retries.
Posts draft + score + proposal ID. Human approves or rejects. python -m scripts.quality gate --approve <id>
Cron pulls GSC position + CTR, GA4 session duration. Grades winner / avg / underperformer.
28 rules encoding marketing research into automated checks. Algorithmic Authorship, GEO/AEO citation science, content structure, and Four U's — all scored per-line with fix suggestions.
Conditions after clauses, verb-first instructions, sentence length, anchor words, entity naming, back-references, filler detection. 15 rules from SEO research.
Citation density, quotation marks, statistics per 1K words, technical term frequency. Based on academic research: citations +115%, quotes +40%, stats +37%.
Reading level (grade 6–8), active voice ≥90%, heading balance, paragraph length, you/your ratio, AI cliche detection.
LLM-scored uniqueness, usefulness, specificity, urgency. Each 1–4, minimum 12/16. Separate model call — grader ≠ writer.
$ python -m scripts.quality score article.md Score: 78.3/100 (grade C) Algorithmic Authorship: 82.1 (weight 0.35) GEO/AEO Signals: 65.0 (weight 0.20) Content Structure: 89.4 (weight 0.25) Four U's: 71.0 (weight 0.20) Top fixes: 1. [AA-01] Condition before clause (line 14, 6 violations) "If you want better results, do X" → "Do X to get better results" 2. [GEO-01] Citation density low (3 per 1K words, target: 5) 3. [CS-07] AI cliche detected (line 42): "it's important to note"
Each content format has a YAML policy. Auto-approve, hold, or reject based on score. Required rules and blocked terms per format. Change the YAML, change the behavior.
| Policy | Format | Auto-approve | Hold | Reject | Blocked terms |
|---|---|---|---|---|---|
blog-publish |
Blog, SEO | ≥85 | 60–85 | <60 | "in conclusion", "harness the power"... |
linkedin-article |
≥80 | 55–80 | <55 | "it's important to note"... | |
cold-email |
Cold email | ≥75 | 50–75 | <50 | "guaranteed", "act now"... |
press-release |
PR | ≥80 | 55–80 | <55 | "excited to announce", "industry-leading"... |
tiktok-script |
TikTok | ≥70 | 45–70 | <45 | "link in bio", "mind-blowing" |
meta-ad |
Meta ads | ≥70 | 45–70 | <45 | "click here", "don't miss out"... |
google-ad |
Google ads | ≥65 | 40–65 | <40 | — |
default |
Everything else | ≥85 | 60–85 | <60 | — |
Every published piece feeds data back. Quality scores correlate with search performance. Policy thresholds auto-adjust. The 100th piece has 99 data points behind it.
Batch quality-scores all published content. Stores per-rule scores alongside GSC/GA4 performance data.
Correlates quality rule scores with winner/loser classification. Finds which rules actually predict search success.
Surfaces statistical patterns: best persona per site, best hook type, best publish day. Only states patterns with n≥5 and ≥15% lift.
When winner patterns emerge, adjusts YAML policy approve/reject thresholds. Updates MARKETING.md learned defaults. Next run picks up changes without restart.
One orchestrator. Seven domain specialists. Each agent gets only the context it needs.
heartbeat fires (every 30 min) ├── sessions_spawn(kaicalls-agent) → #kai-calls ├── sessions_spawn(abp-agent) → #awesomebackyard ├── sessions_spawn(finance-agent) → #finance ├── sessions_spawn(gate-agent) → #zehrava ├── sessions_spawn(bwk-agent) → #build-with-kai ├── sessions_spawn(infra-agent) → #health └── sessions_spawn(research-agent) → #research sessions_yield() → each agent returns NOTHING or posts directly to its channel → 7 checks in parallel ~30s vs. serial ~3.5min
Every write action — emails sent, calls made, vendor outreach — goes through Gate before execution. Human approval, then automation.
Agent proposes an action (e.g. gmail.send, kaicalls.outbound). Gate holds it pending approval. Nothing executes until a human approves at the dashboard.
Each intent type has a policy. abp-followup-call enforces TCPA hours. outbound-email checks for duplicates. Rules run before approval is even requested.
All pending, approved, and blocked proposals visible at zehrava.com/dashboard. One click to approve or block. PII scrubbed from the public log.
ABP lead arrives → abp-agent runs
├── ZIP → NJ → Ken Rent match
├── OpenAI draft vendor email
├── gate.propose({ policy: "outbound-email", payload: {...} })
│ → returns proposalId
├── Post to #awesomebackyard: "Approve at zehrava.com/dashboard"
└── Human approves → email sends automatically
No code. No re-run. Gate handles execution on approval.
~5,800 lines of Python. One command for any metric across 10+ data sources.
$ cmo kaicalls leads --days=7 # 57 leads this week. 34 with emails. Houston HVAC top source. $ cmo ga4 all --days=7 # Traffic overview for ALL 10 sites in one table $ cmo stripe_report mrr # MRR: $67.91 | 11 active subs | 0 at-risk $ cmo gsc opportunities --site=kaicalls # SEO opportunities: 12 keywords ranking 4-10 (low-hanging fruit) $ cmo daily_report executive # Cross-product status in 30 seconds
| Module | Commands | Data Source |
|---|---|---|
kaicalls |
leads, calls, agents, transcripts, dashboard, funnel, weekly | Supabase |
bwk |
counts, businesses, plans, generations, invocations | Supabase |
abp |
counts, leads, vendors, blog, dashboard | Supabase |
ga4 |
sites, overview, pages, sources, channels, daily, all | Google Analytics |
gsc |
sites, queries, pages, opportunities, devices, gaps | Search Console |
stripe_report |
mrr, revenue, subs, customers, overview, at-risk | Stripe API |
instantly |
campaigns, leads, stats, upload | Instantly API |
daily_report |
executive, daily, weekly | All sources |
100+ markdown files. 1000+ indexed chunks. Semantic search via ChromaDB.
/knowledge/ ├── frameworks/ │ ├── content-copywriting/ # Algorithmic Authorship, Four U's, QDP │ ├── aeo-ai-search/ # Perplexity ranking, Entity SEO, AEO │ └── meta-advertising/ # Andromeda, GEM, Lattice ├── channels/ # LinkedIn, SEO, email, PR, TikTok (10) ├── checklists/ # Content, SEO, technical audits (16) ├── personas/ # 8 audience archetypes + pain points ├── playbooks/ # Local SEO, content velocity, TAM (8) ├── design/ # B2B SaaS, B2C fintech guides └── examples/ # LinkedIn articles scoring 14-16/16
Everything connected. Everything automated.
The harness page walks through every stage of the content pipeline with implementation details, config examples, and real output.