Sonnet & Prose is a production-grade, multi-agent AI system designed for Answer Engine Optimization (AEO) and strategic content synthesis. It transforms complex inquiries into data-grounded narratives, research reports, and deep-dive articles optimized for both human clarity and LLM extraction.
The system has evolved from a single script into a decoupled multi-agent architecture. It separates the "Hearing" (Intent Detection), "Refinement" (Human-in-the-loop), and "Scribe" (Synthesis) into specialized workers.
- Simplicity Protocol: A system-wide mandate to prioritize clarity. Complex technical concepts (HSM, PCI-DSS) are automatically grounded using plain-English analogies (Vaults, Fire Codes).
- Meat-First Protocol: Articles are architected to deliver high-density technical value or core findings in the opening paragraphs, satisfying "Zero-Click" search requirements.
- Dynamic Word Budgeting: The system semantically extracts target lengths (e.g., "1500 words") and uses an Architect-Scribe recursive pattern to strategically distribute word counts across sections.
- Contextual Root Cause Analysis: Synthesis doesn't just describe a problem; it analyzes systemic factors and regulatory anchors (e.g., NDPA, POPIA) found in the research context.
The system utilizes a Hub-and-Spoke model built on Google Cloud Gen2 infrastructure and the Model Context Protocol (MCP).
graph TD
A[Slack User] <--> B(n8n Webhook Bus)
B <--> C[Worker: Feedback]
C --> D[Cloud Tasks Queue]
D --> E[Worker: Story Synthesis]
subgraph "Sensory Hub (MCP)"
E <--> F[MCP Server]
F --> G[SerpAPI / Google Trends]
F --> H[Academic / Scholar]
F --> I[Custom Code Analysis]
end
subgraph "The Brain (Context)"
E --> J[Firestore: Vector/Session RAG]
C --> J
E --> K[Unified Model Gateway]
end
E --> L[Slack/Ghost: AEO-Ready HTML]
The primary synthesis engine. It handles Deep Dives, pSEO Article Generation, and Topic Cluster Proposals. It supports parallelized section drafting for high-speed delivery of long-form content.
The "Hearing" layer. It manages the Human-in-the-loop (HITL) cycle, allowing users to approve, refine, or repurpose drafts. It maintains context through a dedicated triage model that separates casual chat from strategic commands.
The "Sensory Gateway." It decouples tool execution from orchestration. All external research, code analysis, and geo-aware trend detection are handled via the Model Context Protocol.
Validation and benchmarking. It tests system logic against "Golden" responses to ensure zero regression in technical accuracy or pSEO formatting.
- GCP Service Account with Firestore, Secret Manager, and Cloud Task permissions.
- n8n for Slack webhook management.
- API Keys: Anthropic (Sonnet 3.5/4.5), SerpAPI, Ghost Admin Key.
# Deploy Sensory Hub
gcloud run deploy mcp-server --source ./mcp-server
# Deploy Feedback Triage
gcloud functions deploy process-feedback-logic --gen2 --source ./worker-feedback
# Deploy Synthesis Engine
gcloud functions deploy process-story-logic --gen2 --source ./worker-story- pSEO Synthesis: Repurpose existing drafts or code snippets into Ghost CMS-ready HTML articles.
- Comparative Regional Trends: Query multiple markets (Lagos vs. Nairobi) simultaneously with ISO-enforced grounding.
- Human-in-the-loop Editing: Refine a 2000-word outline via Slack before the Scribe begins the draft.
- Technical-to-Regulatory Mapping: Automatically link technical features to compliance frameworks like NDPA/POPIA.
Note: This project is ADK-compliant and follows a strict Zero-Markdown leakage policy for web publishing.