✍️ Content Optimization Engine
BaC Principle
“Content strategy without a content engine is just a wish list. Codify the brief, the optimization rules, and the output schema — then agents can execute it at scale.” — Business as Code Manifesto
Stage: S4 — Content Optimization
Type: AUTO (~80% automated)
Trigger: After Strategy Review (S3) produces approved_content_strategy
Output feeds: 06-AEO-Structuring-Agent, 09-Human-Review-Gates (Content Review)
See Map of Content for full vault navigation.
🎯 Objective
For each item in the approved content strategy, produce publication-ready optimized content — either a net-new draft or an updated version of an existing page — that meets on-page SEO standards and is ready for AEO structuring.
🛠️ Tools & Integrations
tools:
- name: SurferSEO / Frase
used_for: On-page content score benchmarking against SERP competitors
api: REST API (content editor scoring)
- name: Claude API
used_for: >
Content drafting (new pages), rewriting underperforming sections,
generating title/meta variants, internal link suggestions
api: Messages API (extended thinking for long-form drafts)
- name: Ahrefs / SEMrush API
used_for: Internal linking opportunities, related keyword suggestions per page
api: REST API
- name: CMS / GitHub
used_for: Publishing optimized content to the site
api: CMS API or GitHub PR (depending on site stack)⚡ Execution Steps
flowchart TD A["Receive approved_content_strategy<br/>from Strategy Review S3"] B{"Existing page<br/>or new page?"} C["Existing: Pull current content<br/>+ GSC performance data"] D["New: Generate content brief<br/>from keyword cluster"] E["Run SurferSEO audit<br/>Benchmark vs top 10 SERP"] F["Draft / Rewrite content<br/>Claude API"] G["Apply on-page checklist<br/>Title, meta, H-structure, word count"] H["Generate internal link map<br/>Links to/from existing pages"] I["Output: optimized_content_batch<br/>Ready for AEO pass"] A --> B B -- Existing --> C --> E --> F --> G --> H --> I B -- New --> D --> E --> F --> G --> H --> I
Step details:
- Strategy intake — Load
approved_content_strategy(list of clusters + recommended content type + priority). - Page classification — For each cluster: check if an existing page covers the topic (from audit inventory). If yes → update path. If no → new page path.
- Content brief generation — For new pages: generate a structured brief (see template below).
- SurferSEO benchmark — Run the target keyword through SurferSEO or Frase. Get: recommended word count, target keyword density, NLP terms to include, competitor heading structures.
- Draft / Rewrite — Use Claude API to draft new content or rewrite existing sections that score < 60 on content quality. Pass the brief + SurferSEO guidelines as context.
- On-page checklist — Apply SEO optimization checklist (see below).
- Internal linking — Identify 3–5 internal pages to link to/from. Add contextual links with descriptive anchor text.
- Output — Package content as
optimized_content_batch(see output schema).
📝 Content Brief Template
content_brief:
brief_id: "brief_C001_2026-04-02"
cluster_id: "C001"
primary_keyword: "business as code"
page_type: pillar_page
target_url: "/what-is-business-as-code"
target_reader:
role: "Operations leader or founder"
goal: "Understand what BaC is and whether it's relevant to their company"
prior_knowledge: "Familiar with automation, new to AI-native ops"
content_outline:
- h2: "What is Business as Code? (Definition)"
purpose: "Anchor answer — first 2 sentences must define BaC clearly"
aeo_note: "This section will become the primary LLM citation target"
- h2: "How Business as Code Works"
purpose: "Mechanism explanation with examples"
- h2: "Business as Code vs. Traditional BPM"
purpose: "Comparison — high AEO potential (contrastive queries)"
- h2: "The 3 Core Principles of BaC"
purpose: "Framework section — numbered lists are highly citable"
- h2: "Business as Code in Practice: Use Cases"
purpose: "Concrete examples — link to vault use cases"
- h2: "Frequently Asked Questions"
purpose: "FAQ schema target — pull from PAA questions in cluster"
word_count_target: 3000
tone: "Authoritative but practical. No jargon without definition."
internal_links_target:
- "/use-cases/cold-email/"
- "/manifesto"
supporting_keywords:
- "codify business processes"
- "AI-executable SOP"
- "business process automation AI"✅ On-Page Optimization Checklist
on_page_checklist:
title_tag:
- Contains primary keyword (near start)
- 50–60 characters
- Includes a differentiator (e.g., "The Complete Guide" or year)
meta_description:
- Contains primary keyword
- 140–160 characters
- Includes a clear value prop or CTA
h1:
- Matches or closely mirrors title tag
- Contains primary keyword
- Exactly one H1 per page
heading_structure:
- Logical H2 → H3 hierarchy
- H2s contain secondary keywords where natural
- No keyword stuffing
content:
- Word count within 10% of SurferSEO recommendation
- Primary keyword in first 100 words
- NLP terms from SurferSEO included
- Short paragraphs (3–5 sentences max)
- At least one numbered or bulleted list
- At least one image with descriptive alt text
internal_links:
- 3–5 contextual internal links
- Descriptive anchor text (not "click here")
- No orphan pages
technical:
- Canonical URL set correctly
- No duplicate content vs. existing pages📤 Output Schema
{
"batch_id": "batch_2026-04-02",
"generated_at": "2026-04-02T18:00:00Z",
"pages_in_batch": 8,
"pages": [
{
"page_id": "page_C001",
"cluster_id": "C001",
"action": "new",
"target_url": "/what-is-business-as-code",
"title": "What is Business as Code? Definition, Principles & Examples",
"meta_description": "Business as Code transforms business processes into machine-readable, AI-executable specifications. Learn the methodology, core principles, and real use cases.",
"word_count": 3050,
"surfer_content_score": 84,
"on_page_checklist_passed": true,
"internal_links_added": 4,
"content_markdown": "[full markdown content]",
"ready_for_aeo_pass": true
}
],
"batch_summary": {
"new_pages": 5,
"updated_pages": 3,
"avg_surfer_score": 79,
"checklist_pass_rate": 0.875
}
}📊 KPIs
| Metric | Target | Alert Condition |
|---|---|---|
| SurferSEO content score | ≥ 75/100 | < 60 → rewrite section |
| On-page checklist pass rate | ≥ 90% | < 80% → review agent prompt |
| Pages produced per run | Per strategy batch | < 50% of batch → flag |
| Avg word count accuracy | ±10% of target | > ±20% → adjust prompt |
| Internal links per page | 3–5 | 0 → flag as orphan risk |
⚠️ Error Handling
error_rules:
- condition: SurferSEO API unavailable
action: Use Frase as fallback for content scoring
fallback: Generate content without benchmarking; flag for manual score check
- condition: Claude API draft scores < 60 on content quality after 2 attempts
action: Flag page for human copywriter review
fallback: Include in Human Gate #2 sample with "needs_review" flag
- condition: Internal link suggestions point to non-existent pages
action: Remove the link; log in content_inventory as "missing internal target"
fallback: Leave anchor text but remove href; add to broken links backlog
- condition: Content brief missing required fields
action: Pause page processing; request updated strategy item from Gate #1 output📎 Related Files
- 02-Target-Definition — Content pillars and audience profile used in briefs
- 04-Keyword-and-Topic-Research-Agent — Provides cluster data for brief generation
- 06-AEO-Structuring-Agent — Receives
optimized_content_batchfor AEO pass - 09-Human-Review-Gates — Gate #2 reviews 10% sample of this output
- 01-Process-Manifest — S4 stage definition