AI content generation pipeline guide for SYNTHEX. Documents the model registry, provider abstraction, BYOK key injection, content scoring, and repurposing flow. Use when working on AI-powered content features or debugging model selection issues.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
AI content generation pipeline guide for SYNTHEX. Documents the model registry, provider abstraction, BYOK key injection, content scoring, and repurposing flow. Use when working on AI-powered content features or debugging model selection issues.
Visual generation (binding): all images/video route through the grounded
pipeline โ see .claude/rules/real-images-only.md + the grounded-visuals
skill. Direct provider calls fail CI. This guide covers TEXT content only โ
see "Image & video generation" below before reaching for an image/video path.
Purpose
SYNTHEX generates content through a multi-layer pipeline: model registry
selects the right LLM, provider abstraction handles API differences, BYOK
key injection uses the user's own API key when available, and content scoring
evaluates quality without any AI calls.
This skill documents the full pipeline flow and the key decisions at each stage โ
for content. Image and video generation are a separate, mandated path;
see "Image & video generation" below.
text
Pipeline Flow
User Request
โ
โผ
ContentRequest (type, platform, tone, persona)
โ
โผ
API Credential Injector โโโ Does user have a BYOK key?
โ YES โ Decrypt and use user's key
โ NO โ Use platform OPENROUTER_API_KEY
โผ
Provider Abstraction (getAIProvider)
โ
โโ OpenRouter Provider (primary, supports 100+ models)
โโ Anthropic Provider (direct Claude access)
โโ Google Provider (Gemini models)
โโ OpenRouter Provider with OpenAI keys (passthrough)
โ
โผ
Model Registry โ Select model by provider + tier
โ
โผ
Content Generator โ Build prompt with persona, platform rules
โ
โผ
Generated Content
โ
โผ
Content Scorer โ Score across 5 dimensions (no AI call)
โ
โผ
Content Repurposer โ Adapt for multiple platforms
Image & video generation โ separate mandated path (REAL IMAGES ONLY)
Everything above is the text pipeline (getAIProvider()). It does not cover
images or video. ALL image/video generation goes ONLY through
generateImage()/generateBatch() in lib/services/ai/image-generation.ts
(video via lib/services/ai/video/generation-service.ts), grounded-by-default on
the owned reference library (public/reference-library/manifest.json, 143+
subjects; private Supabase bucket reference-library-private via
POST /api/admin/private-refs). Industry is auto-detected from the prompt; no
owned references โ blocked: true ("No owned references for this subject โ add
real photos to the reference library first"); useReferences: false is the
audited UNGROUNDED escape hatch. The carpet-style-v1 LoRA (trigger
ccwcarpet, lib/services/ai/image/trained-loras.json) auto-applies for
carpet-cleaning. The static guard test tests/unit/ai/no-direct-image-apis.test.ts
fails CI on any direct provider call. MCP studio tools generate_image/
generate_video inherit these defaults. The dashboard runs 3-variant batches with
tap-to-rank (image_generations lineage, groundedShare insight). See
.claude/rules/real-images-only.md + .claude/skills/grounded-visuals/.
Model Registry
File:lib/ai/model-registry.tsPurpose: Single source of truth for which models SYNTHEX uses system-wide
Persona integration: When personaId is provided, the generator loads the
persona's tone, style, vocabulary, and emotion settings from the database and
injects them into the system prompt.
Content Scorer
File:lib/ai/content-scorer.tsPurpose: Real-time content quality scoring with zero AI calls
Grounded video generation (sanctioned entry point)
Reference skill: This is a read-only architecture guide โ it documents existing systems and does not generate creative or code output. No capability uplift block is needed.
Foundation & Gate Wiring (SYN-1050)
Adopted from the senior-skill standard so every artefact this skill produces is checked against the locked foundation before it lands.
Reads at every invocation (never cached โ re-read each run):
.claude/memory/ceo-foundation.md โ voice tag (Q2.5.5), universal + brand-specific taboos, verification gates for any quantitative claim.
.claude/memory/verification-gates.md โ gate state for any claim referenced.
Output gate: every client-facing artefact this skill produces routes through brand-voice-enforce before the CEO batched-review queue. A REJECT blocks the artefact until the quoted offending string is fixed.
Evidence standard: every quantitative or factual claim carries exactly one tag โ [VERIFIED] / [INFERENCE] / [UNCONFIRMED]. Untagged = defect (.claude/rules/fabel-evidence-standard.md). Never state a projected result as fact.