Skip to content

Script Formulas

A script formula is a high-level narrative template that shapes the macro structure and voice of a short-form script — the kind of structural pattern that drives organic reach on TikTok, Reels, and Shorts. The formula is opt-in via the script_formula input on workflows that generate scripts (video/talking-head, video/formula-shorts, and any workflow that ultimately calls stages.script.generate_script).

NameSummaryRecommended duration
reframeTake a familiar negative pattern, accept it, then flip it toward a positive twin.25 s
youre_doing_it_wrongConfidently accuse the viewer of doing an everyday thing wrong, then deliver a small surprising correction.30 s
validationName a quietly carried feeling, give permission to feel it, offer one calm rule that protects it.25 s
pattern_interruptOpen with a surreal image or absurd claim, pivot it into ordinary useful advice.30 s
listiclePromise N things up front, deliver them tightly, end on the strongest one for rewatchability.35 s

The full registry lives in fabric_workflow_sdk.stages.script_formulas. Each formula ships with a numbered structural prompt and 2–3 paraphrased exemplar narrations that teach the model the structure, not specific topics.

Terminal window
fabric run video/talking-head \
--input topic="overthinking" \
--input script_formula=reframe \
--input duration_secs=25

video/formula-shorts accepts both a formula (the production-style VideoFormula) and a script_formula (the narrative template).

Terminal window
fabric run video/formula-shorts \
--input formula="my-tiktok-style" \
--input topic="cold showers" \
--input script_formula=youre_doing_it_wrong
from fabric_workflow_sdk.stages.script import generate_script
result = await generate_script({
"topic": "comparison kills happiness",
"duration_secs": 25,
"script_formula": "validation",
})

When script_formula is set, generate_script looks up the formula in SCRIPT_FORMULAS and appends a structured prompt block (structure + exemplars) to the generation prompt. Unknown formula names log a warning and fall back to formula-less generation, so older clients and typos never break runs.

The injection point is stages/script.py immediately before build_script_prompt(...). The block is added via the same extra_blocks channel used by research grounding and prompt extensions.

SCRIPT_FORMULAS is a plain dict; appending entries is the only step needed for new formulas to become available. Each entry needs a structure (numbered-step prompt block), 2–3 paraphrased exemplars, and a sensible recommended_duration_secs.

Future plan: feed top-performing real scripts back as exemplars once a performance-feedback loop is wired in (see specs/plans/074-daily-drop-and-character-roster.md).

Fabric does not post the rendered videos to social platforms — that’s out of scope by design (see ADR 0001-posting-out-of-scope.md). Use video/export-platforms to produce a per-platform bundle and subscribe to workflow.run.completed webhooks from your posting layer.