Core Content Generation Focus Sheet
How core content generation works and what fields it targets.
Blueprint Logic Map
| Section | Current logic |
|---|---|
| 1) Entry | Operator clicks Generate Content from the WooCommerce product editor. |
| 2) Pre-checks | Product edit context plus either valid hosted entitlement or entitled BYOK Gemini configuration must be available. |
| 3) Core flow | MerchantDrafts assembles prompt layers in precedence order (see Prompt Stack below), routes the request through hosted MerchantDrafts runtime or an entitled BYOK Gemini mode, normalizes the response, and renders outputs in review tabs. |
| 4) Data flow | Generated content is held in MerchantDrafts-managed state and mapped to product fields and SEO targets during apply. |
| 5) Failure handling | Provider failures and empty outputs surface readable messages and may trigger retry logic for weak responses. |
| 6) User controls | Operators can review, copy, clear, apply, or undo generated content. |
| 7) Write path | Approved content writes into the editor, excerpt, SEO selectors, and related metadata. |
| 8) Recovery/undo | One-step undo restores the pre-apply snapshot for the current session. |
Prompt Stack
Layers assembled in this order for every generation:
| Layer | Source | Role |
|---|---|---|
| 1 — Prompt Supplement | mdrfts_prompt_supplement (Settings) | Always first when set; a prefix that sits above everything else |
| 2 — System + schema | Engine hardcoded | Output structure, field labels, JSON schema |
| 3 — Product context | WooCommerce product data | Title, attributes, dimensions, related metadata |
| 4 — Business Context | mdrfts_business_context (Settings) | Brand baseline: voice, positioning, audience. Dominates all layers below. |
| 5 — Writing pattern | mdrfts_custom_writing_pattern (Settings) | Store-level approach: what to lead with, angle, what to avoid. Applied within the baseline. Empty = skipped. |
| 6 — Product emphasis | _mdrfts_custom_instructions (per-product) | Per-product intent: what to highlight for this specific product. Interpreted within the baseline; conservative enrichment only. Empty = skipped. |
Rules:
- Business Context dominates: all generated copy must stay within the brand baseline it defines.
- Writing pattern shapes the approach; it does not override brand voice or conflict with Tone/Length.
- Product emphasis narrows focus for the specific product within the baseline — it does not override it.
- If emphasis conflicts with Business Context, the baseline wins.
- Missing layers are skipped safely.
After generation, the Info tab shows an Active layers row confirming which of Business Context and Writing Pattern were injected, with direct links to Settings. A deterministic "Emphasized:" line also shows what product emphasis was applied (JS-side normalization only — no AI call).
Next Evolution
Add a lightweight review score that flags weak content before the operator writes it to the product.