π View the Architecture Diagram β
Status: β
Production Ready
Mode: Cursor AI Agent (No API Keys Required)
Mission: Create exceptional SEO content for Solidroad
cd /Users/renanserrano/script-nata
# Create new session
python3 agentic-human-loop/content_pipeline_with_ai_agent.py
# Resume latest session (after completing AI tasks)
python3 agentic-human-loop/content_pipeline_with_ai_agent.py --resume
# Resume specific session
python3 agentic-human-loop/content_pipeline_with_ai_agent.py --resume session_YYYYMMDD_HHMMSS
# Generate spokes in batches of 3 (recommended)
python3 agentic-human-loop/content_pipeline_with_ai_agent.py --resume --spokes-batch 3
# Quality evaluation runs automatically (Step 13)
# Secrets loaded from GCP Secret Manager (or .env for local dev)Watch for:
π€ AGENT_TASK_READYβ AI synthesis/generation neededπ¨ RESCUE_TASK_READYβ Quality issue needs fixing
agentic-human-loop/
β
βββ π content_pipeline_with_ai_agent.py β THE MAIN SCRIPT
βββ π README.md β THIS FILE (start here)
βββ π docs/ β ALL DOCUMENTATION
β βββ user-guide/ β FOR USERS (3 files)
β β βββ QUICK_START.md β How to run the pipeline
β β βββ AI_AGENT_EXECUTION_PROMPTS.md β Ready-to-use prompts
β β βββ ZERO_COMPROMISE_MODE.md β Philosophy & rescue tasks
β βββ developer-guide/ β FOR DEVELOPERS (19 files)
β βββ doc-visualizer/ β Visual docs browser (Next.js)
β βββ 00_INDEX.md β Start here for deep-dive
β βββ STEP_00_brand_gap_analysis.md β Per-step technical docs
β βββ STEP_01_content_analysis.md
β βββ STEP_02_url_analysis.md
β βββ STEP_02B_competitor_scraping.md
β βββ STEP_02C_url_semantic_analysis.md
β βββ STEP_03_scraping_analysis.md
β βββ STEP_04_ai_synthesis.md β AI agent task
β βββ STEP_05_article_generation.md β AI agent task
β βββ STEP_06_writing_rules.md β AI agent task
β βββ STEP_07_internal_links.md
β βββ STEP_08_citations.md
β βββ STEP_09_infrastructure.md
β βββ STEP_10_spoke_cluster.md β AI agent task
β βββ STEP_11_final_summary.md
β βββ HUB_SPOKE_STRATEGY_ANALYSIS.md β Strategic analysis
β
βββ π brand-context/ β BRAND RULES
β βββ solidroad β Brand voice & positioning
β βββ rule_draft.ts β Draft agent rules
β βββ rule_writing.ts β 15 writing rules
β βββ rule_citations.md β Citation guidelines
β βββ internal_linking_map.json β Internal link strategy
β βββ sitemap β Site structure
β
βββ π datasets/ β INPUT DATA
β βββ conversation-analytics-platform.csv
β
βββ π publishing/ β PUBLISHING TOOLS
β βββ append_to_google_sheets.py β Google Sheets publisher
β βββ README.md β Publishing setup guide
β
βββ π results/local_pipeline/ β PIPELINE OUTPUTS
βββ session_YYYYMMDD_HHMMSS/ β Per-session results
βββ step14a_FRAMER_EXPORT.csv β HTML export (auto-generated)
- Brand Gap Analysis - Measure Solidroad vs competitor visibility
- Content Pattern Analysis - Extract keywords from 696+ responses
- URL Analysis - Identify most-cited domains
- URL Semantic Analysis - Search intent classification
- Browser Scraping - Scrape 7-10 competitors (AI agent browser tools)
- Competitor Analysis - Analyze scraped content (waits for Step 2B)
- AI Synthesis - Strategic recommendations (AI agent required)
- Article Generation - Hub article (3,000-6,000 words) or Spoke (1,500-2,000 words)
- Writing Rules - Apply brand voice (AI agent required)
- Strategic Internal Links - Add 8-12 contextual links from sitemap (AI agent required)
- Research & Add Citations - Web search for authoritative sources, NO citations in TL;DR/intro (AI agent required)
- Intelligent Infrastructure - Hub/Spoke registration in linking map (AI agent required)
- Spoke Cluster Generation - Generate 10 supporting spokes if Hub detected (AI agent required, batched)
- Cluster Crosslinking - Connect Hub β Spokes + cross-spoke links (25-30 total links, AI agent required)
- HTML Conversion - Convert markdown to Framer-compatible HTML, fix internal links, export to CSV with structure metadata (automated)
- Metadata Generation - AI agent writes SEO descriptions using bigrams/trigrams from dataset (AI agent required)
CSV Structure (Visual Content Map):
- Columns: Title, Date, Author, Prompt, Article_Type, Hub_Title, Related_Spokes, Final_URL, Description, Content
- Google Sheets becomes visual Hub/Spoke map (no separate JSON file!)
- See content structure at a glance
- Content Quality Evaluation - Multi-model validation (Claude + Perplexity) validates #1 rankings
We NEVER skip steps.
- CSV missing? β AI agent rescue task (find data)
- Scraping fails? β AI agent rescue task (manual retrieval)
- Low quality? β AI agent rescue task (fix it)
- Insufficient data? β AI agent rescue task (augment it)
Quality gates at every critical step. Block until exceptional.
- Step 2B: Browser scrape competitors β 7-10 competitor URLs
- Step 4: Synthesize analysis β strategic recommendations + Hub vs Spoke decision
- Step 5: Generate article β Hub (3,000-6,000 words) or Spoke (1,500-2,000 words)
- Step 6: Apply writing rules β brand alignment (15 rules enforced)
- Step 7: Strategic internal links β 8-12 contextual links from sitemap (25+ URLs available)
- Step 8: Research & add citations β Replace
[CITATION NEEDED]with real sources (NO citations in TL;DR/intro!) - Step 9: Infrastructure update β Intelligent Hub/Spoke registration
- Step 10: Generate 10 spokes β Batched generation with review checkpoints (if Hub)
- Step 10B-C: Add & verify spoke citations β All 10 spokes get proper citations (AI agent required)
- Step 11: Cluster crosslinking β Add Hub β Spoke + cross-spoke links (~25-30 total links, AI agent required)
- Step 12B: HTML quality review β Fix conversion issues (AI agent required)
- Step 12D: Link verification β Test all internal links & citations work (AI agent required)
- Triggered when quality gates fail
- Creates detailed mission brief
- Blocks pipeline until resolved
Start here: docs/user-guide/QUICK_START.md - How to run the pipeline
Strategy: docs/user-guide/HUB_SPOKE_STRATEGY_ANALYSIS.md - Hub & Spoke architecture explained
Philosophy: docs/user-guide/ZERO_COMPROMISE_MODE.md - Why we never compromise
Prompts: docs/user-guide/AI_AGENT_EXECUTION_PROMPTS.md - Copy-paste prompts for AI agent
Navigation: docs/developer-guide/00_INDEX.md - Start here for technical deep-dive
Per-step docs: docs/developer-guide/STEP_XX_*.md - Technical guides (one per step)
Each developer guide now includes:
- π€ Why This Step Exists - Foundational "why" (problem/reality/solution)
- π Overview - What it does in one sentence
- π― Why It Matters - Impact on content quality
- βοΈ How It Works - Technical implementation
- π Inputs/Outputs - Data flow
- π¨ Quality Gates - What must pass to proceed
- π§ Common Issues - Troubleshooting
- π‘ How to Improve - Enhancement opportunities
NEW (Nov 2024): All step documentation now starts with "Why This Step Exists" - a no-bullshit explanation of the fundamental reason each step is in the pipeline. Understand the problem being solved before diving into implementation.
Critical:
- Python 3.9+
- Brand configuration:
brand-context/config.jsonβ Configure your brand!
Data Source (choose one):
- Option A (Athena): Enable
athena_integrationin config β No CSV needed! β RECOMMENDED - Option B (CSV): Provide
datasets/conversation-analytics-platform.csv
Dependencies:
pandas, requests, beautifulsoup4, python-dotenv
For Publishing:
google-auth, google-auth-oauthlib, google-auth-httplib2, google-api-python-client
Optional (improves quality):
- Brand context files in
brand-context/ - Network access for scraping (Step 2B)
API keys are managed via GCP Secret Manager (project athena-hq).
Scripts use get_secret() from autonomous/secrets.py which checks env vars first, then falls back to Secret Manager.
Local dev: Use a .env file as before β get_secret() picks it up from env.
Production: No .env on disk. Secrets fetched from GCP at runtime.
# First-time setup: push .env secrets to GCP Secret Manager
pip install google-cloud-secret-manager
python3 scripts/setup_secrets.py --dry-run # preview
python3 scripts/setup_secrets.py # push to GCP
# Grant your service account access
python3 scripts/setup_secrets.py --grant-access YOUR_SA@PROJECT.iam.gserviceaccount.comRequired secrets: ANTHROPIC_API_KEY, RESEND_API_KEY, YOUTUBE_API_KEY, FRAMER_API_KEY
Optional: PERPLEXITY_API_KEY, OPENAI_API_KEY (for multi-model evaluation in Step 13)
This pipeline is brand-agnostic with Athena-first configuration!
Provide just 3 values, pipeline fetches everything else from AthenaHQ:
{
"athena_integration": {
"website_id": "your-athena-website-id"
},
"publishing": {
"author_name": "Your Name",
"google_sheets": {
"spreadsheet_id": "YOUR_SHEET_ID",
"sheet_name": "Sheet1"
}
}
}Pipeline auto-fills from Athena:
- β Brand name, URL, keywords (from Athena settings)
- β Competitors (23+ with identifiers)
- β Language, personas, locations
- β Category & tags (from dataset bigrams/trigrams)
Result: Only 3 values needed! (77% reduction)
Provide all values in config.json if not using Athena:
{
"brand": {
"name": "Your Company",
"url": "https://yourcompany.com",
"keywords": ["yourcompany"]
},
"competitor_analysis": {
"target_domain": "your_industry",
"domain_keywords": {"your_industry": ["competitor1", ...]}
},
"publishing": {...}
}1. Copy configuration template:
cp agentic-human-loop/brand-context/config.json.example agentic-human-loop/brand-context/config.json2. Update config.json:
{
"brand": {
"name": "Your Company",
"url": "https://yourcompany.com",
"author_name": "Your Name",
"keywords": ["yourcompany", "your company"],
"default_product_links": [...]
},
"competitor_analysis": {
"target_domain": "your_industry",
"domain_keywords": {
"your_industry": ["competitor1", "competitor2", ...]
}
},
"publishing": {
"google_sheets": {
"spreadsheet_id": "YOUR_SHEET_ID",
"sheet_name": "Sheet1"
}
}
}3. Run pipeline:
python3 agentic-human-loop/content_pipeline_with_ai_agent.pyEverything adapts to your brand automatically! β
- β Brand name, URL, author (appears in all content)
- β Brand keywords (for gap analysis)
- β Product URLs (for internal linking)
- β Competitor list (for content differentiation)
- β Google Sheets publishing destination
- β Word count targets (hub/spoke)
- β Default category and tags
- β Content generation (AI adapts to your brand voice file)
- β Quality evaluation (works for any content cluster)
- β Publishing workflow (OAuth2 for any Google account)
- β All 15 pipeline steps
See: brand-context/README.md for complete configuration guide
See: CONFIGURATION_GUIDE.md for configuration modes
See: ATHENA_INTEGRATION_GUIDE.md for Athena setup
Managing multiple clients:
# Client A: Solidroad
brand-context/config-solidroad.json
# Client B: Another Company
brand-context/config-clientb.json
# Switch clients:
cp brand-context/config-clientb.json brand-context/config.json
python3 agentic-human-loop/content_pipeline_with_ai_agent.pyResult: Generate content for Client B using their branding! β
Output:
- 1 Hub article (3,000-6,000 words - comprehensive pillar content)
- 10 spoke articles (1,500-2,000 words each - focused deep-dives)
- ~50+ internal links interconnecting all 11 articles
- Real citations from authoritative sources (ICMI, Gartner, Forrester)
- Intelligent content hub architecture (Hub β Spokes)
Result:
- Solidroad dominates entire keyword cluster (11 unique keywords)
- 11 SERP positions instead of 1
- Topical authority established through dense internal linking
- Brand visibility improves from 0.1% to 5%+ (data-backed positioning)
- VP/Director audience served with exceptional content
We're Solidroad.
We ship exceptional or we ship nothing.
No compromises. No shortcuts. Excellence every time.
| Issue | Solution |
|---|---|
| "CSV not found" | Check datasets/conversation-analytics-platform.csv |
| API key not found | Check GCP Secret Manager or local .env β see Secrets Management section |
| Scraping timeout | Rescue task created - manual retrieval required |
| Pipeline blocks | Read rescue/task file, complete mission, re-run |
python3 publishing/append_to_google_sheets.pyResult: Articles published to Sheets β Framer auto-syncs
# Enable in config.json first
python3 publishing/sync_to_athena.pyResult: Keywords + URLs registered in Athena for tracking
See: publishing/README.md for setup guides
Ready? β docs/user-guide/QUICK_START.md