mimic-generate
Two phases:
- Phase A — brief synthesis (you produce the AdBrief in your response, no API call).
- Phase B — image render (Bash + curl to the chosen provider, download to disk).
Each phase persists the Generation JSON to disk so the dashboard reflects in-progress work.
Inputs
brief— slug (Wiki/Mimic/Briefs/{brief}.mdmust exist)template— slug (Wiki/Mimic/Templates/{template}.mdmust exist)product,persona,angle,offer— free-textsize—1:1|3:4|16:9framework—standard|rmbc2provider—kie|fal|openai|google|openroutermodel— provider-specific identifier
Step 0 — Generate the ID
id = "mim_" + YYYY-MM-DD + "_" + 6 random alphanumeric chars
Use Bash to mint randomness if needed:
echo "mim_$(date -u +%Y-%m-%d)_$(LC_ALL=C tr -dc 'a-z0-9' </dev/urandom | head -c6)"
Step 1 — Read brief + template
Read Wiki/Mimic/Briefs/{brief}.md → parse frontmatter → BrandDNABrief
Read Wiki/Mimic/Templates/{template}.md → parse frontmatter → AdTemplate
Phase A — Brief synthesis
Generate the AdBrief JSON in your response. The brief is yours to author — you have all context. Schema:
{
"headline_options": ["3-5 alternative headlines, max ~10 words each"],
"subheadline_options": ["3-5 subheads, ~12-15 words each"],
"badges": ["short badge text strings (e.g. 'AS LOW AS $24.95/mo')"],
"cta": "single CTA text (e.g. 'GET QUOTE')",
"layout_instructions": "where each piece goes — references the template's locked_structural_elements",
"image_direction": "designer-facing description of the hero visual",
"image_generation_prompt": "the actual prompt that goes to the image provider — should fill in the template's image_prompt_template placeholders with brand DNA + product values",
"designer_notes": "anything else a designer would need (typography weight, color usage, photo treatment)",
"compliance_notes": "what claims this ad makes + which disclaimers apply (cite from brief.claims_guardrails)",
"rmbc2": null // only when framework === "rmbc2", populate per RMBC2Layer schema below
}
RMBC II layer (when framework === "rmbc2")
Stefan Georgi's Research → Mechanism → Brief → Copy. Add this object on the AdBrief:
{
"research_synthesis": "2-4 sentences distilling Brand DNA + persona + angle inputs",
"awareness_level": "unaware | problem-aware | solution-aware | product-aware | most-aware",
"awareness_rationale": "why you placed the persona at this level",
"ump": {
"name": "Memorable name for the Unique Mechanism of Problem (e.g. 'Collagen Architecture Breakdown at the Dermal-Epidermal Junction')",
"explanation": "what the actual underlying problem is, mechanically"
},
"ums": {
"name": "Memorable name for the Unique Mechanism of Solution (e.g. 'The Structural Renewal System')",
"explanation": "what your solution does mechanically",
"why_yours_unique": "why this version vs competitors"
},
"big_idea": "the lead angle in one line",
"hook_variations": [
{ "type": "problem-agitation | curiosity | transformation | status | scarcity | social-proof | contrast | founder-story | callout | listicle | before-after | fear-removal", "hook": "..." }
// 4-6 hooks across hook types so Adam can A/B test
],
"proof_layer": "why-believe-this anchor — testimonial / stat / certification",
"primary_objection": "the #1 objection this persona will raise",
"objection_demolish": "how the ad pre-handles the objection visually + verbally"
}
Synthesis rules
- Honor
template.template_logic.locked_structural_elements— the new ad must keep the same structural layout (same hook position, same badge structure, same CTA shape). - Honor
template.template_logic.editable_fields— those are what you swap. - Strict on
brief.banned_phrases— none of those words appear anywhere in the AdBrief. - Strict on
brief.claims_guardrails— never use acannot_claimphrasing. If you use arequires_disclaimerclaim, add the disclaimer tocompliance_notes. approved_phrasespreferred — incorporate where natural.
Persist Phase A
Write the Generation JSON now (status = drafted, image = null):
mkdir -p /Users/doorsy/Desktop/supernova/supernova-ui/data/mimic/generations
# Write JSON via Write tool to:
# /Users/doorsy/Desktop/supernova/supernova-ui/data/mimic/generations/{id}.json
Generation JSON shape:
{
"id": "mim_2026-05-08_xxxxxx",
"created": "2026-05-08T16:42:00.000Z",
"framework": "standard | rmbc2",
"brand_brief_slug": "{brief}",
"template_slug": "{template}",
"inputs": { "product": "...", "persona": "...", "angle": "...", "offer": "..." },
"size": "1:1 | 3:4 | 16:9",
"ad_brief": { /* AdBrief object */ },
"image": null,
"status": "drafted"
}
Surface to Adam: "Brief drafted, dashboard shows it now. Rendering image…"
Phase B — Image render
Provider API specs
Kie (async task pattern)
Create task: POST https://api.kie.ai/api/v1/jobs/createTask
curl -s -X POST https://api.kie.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $KIE_API_KEY" \
-H "Content-Type: application/json" \
-d "$(cat <<EOF
{
"model": "{model}",
"input": {
"prompt": {prompt},
"aspect_ratio": "{1:1|3:4|16:9}",
"resolution": "{1K if 1:1 else 2K}",
"output_format": "png"
}
}
EOF
)"
Response: {"code":200,"data":{"taskId":"..."}}
Poll: GET https://api.kie.ai/api/v1/jobs/recordInfo?taskId={id} every 2.5s until data.state === "success" or "fail". On success: data.resultJson is a JSON string with { resultUrls: ["..."] }.
Kie models: nano-banana-2, nano-banana-pro, gpt-image-2-text-to-image.
Fal (synchronous)
POST https://fal.run/{model} with Authorization: Key $FAL_KEY. Body shape branches by model family:
fal-ai/nano-banana-2/fal-ai/nano-banana-pro:{ prompt, aspect_ratio: "1:1|16:9|3:4", resolution: "1K|2K", output_format: "png", safety_tolerance: "4", num_images: 1 }fal-ai/gpt-image-2:{ prompt, image_size: "square_hd|portrait_4_3|landscape_16_9", quality: "high", num_images: 1, output_format: "png" }fal-ai/flux/dev:{ prompt, image_size, num_images: 1, enable_safety_checker: true }
Response: { "images": [{ "url": "..." }] }.
OpenAI direct
POST https://api.openai.com/v1/images/generations with Authorization: Bearer $OPENAI_API_KEY.
{ "model": "gpt-image-2", "prompt": "...", "n": 1, "size": "1024x1024 | 1024x1536 | 1536x1024", "quality": "high" }
Response: { "data": [{ "url": "..." }] } (or { "b64_json": "..." }).
Size mapping: 1:1 → 1024x1024, 3:4 → 1024x1536, 16:9 → 1536x1024.
OpenAI may require Org Verification before allowing gpt-image-2.
Google GenAI (Imagen 4)
POST https://generativelanguage.googleapis.com/v1beta/models/{model}:generateImage?key=$GOOGLE_GENAI_API_KEY. Refer to Google's docs if used — rare path.
OpenRouter
POST https://openrouter.ai/api/v1/images/generations with Authorization: Bearer $OPENROUTER_API_KEY and HTTP-Referer + X-Title headers. Model openai/gpt-image-2. Same body as OpenAI direct.
Download the image
Whichever provider returned a URL:
mkdir -p /Users/doorsy/Desktop/supernova/supernova-ui/data/mimic/images
curl -s -L -o /Users/doorsy/Desktop/supernova/supernova-ui/data/mimic/images/{id}.{ext} "{image_url}"
If the provider returned base64 (b64_json): decode via base64 -d into the same path.
{ext} — png if output_format: png (most providers default). Match the actual content-type if returned.
Update the Generation JSON
Re-Write the same {id}.json with status complete:
{
...all original fields...,
"image": {
"provider": "{provider}",
"model": "{model}",
"image_path": "data/mimic/images/{id}.{ext}",
"image_url": "{remote URL if available}"
},
"status": "complete"
}
If render failed:
{
...all original fields...,
"image": {
"provider": "{provider}",
"model": "{model}",
"error": "{error message}"
},
"status": "failed"
}
Never delete the Generation JSON — failed-state generations are visible in the gallery and can be retried.
Step 5 — Log
Invoke Skills/log-operation.md with operation mimic-generate, generation_id, brief_slug, template_slug, framework, provider, model, status, image_path (if complete), error (if failed).
Report to Adam
✓ Generated mim_2026-05-08_xxxxxx
brief: {brief} · template: {template} · {framework} · {size}
provider: {provider} ({model})
status: complete | failed
image: data/mimic/images/{id}.{ext} (or error: ...)
Dashboard: http://localhost:3001/mimic/generations/{id}
If compliance_notes flagged anything, surface that in the report so Adam knows what disclaimers must be added in design.