Skip to content

feat(script): cinematography agents + asset library + hook composer#9

Merged
cuio merged 1 commit intofeat/visual-sota-stop-the-slideshowfrom
feat/agent-cinematography-and-asset-library
Apr 25, 2026
Merged

feat(script): cinematography agents + asset library + hook composer#9
cuio merged 1 commit intofeat/visual-sota-stop-the-slideshowfrom
feat/agent-cinematography-and-asset-library

Conversation

@cuio
Copy link
Copy Markdown
Owner

@cuio cuio commented Apr 25, 2026

Summary

Three things in one PR — the planner stops being template-only and starts directing cinematography, scenes get a much richer visual kit to draw on, and a cheap second-pass critic protects the cold-open.

Stacked on PR #7 — branch off it because slice 8 needs the atmosphere/transition registries it adds.

Asset library

  • 4 new atmosphere presets (registry: 5 → 9):
    • radial-pulse — concentric ring pulses from canvas centre. Magnetises the eye for centred hero elements (hook-statreveal).
    • cosmic-dust — sparse twinkling stars + two drifting halos. Cosmic scale feel for hooks/outros.
    • geometric-grid — drifting + pulsing isometric grid lines. Engineering aesthetic for chart-scene and comparison.
    • flow-lines — wavy horizontal SVG paths drifting across the canvas. Audio-waveform vibe for quote scenes and time-series charts.
  • Icon library — new packages/core/src/script/icons/ with 20 hand-drawn 24×24 stroke SVGs (lock, network, bolt, dollar, globe, target, shield, etc). Pure geometric primitives, no third-party paths. Renders at any size, picks up token colours via currentColor.
  • concept-callout items can now carry an icon that replaces the number badge: { text, icon } per item, mixed with plain strings allowed. Backwards-compatible.

Slice 8 — planner cinematography

  • New "Cinematography" section in the playbook teaches the AI when to pick each atmosphere preset, which transition fits which moment, and which icon belongs on which list item.
  • Planner tool schema gains optional background and transition fields per scene, both as enums of registered ids. Unknown values fall back to defaults so a hallucination can't break assembly.
  • Schema validation + one-shot retry: after the first planner pass, every scene is checked for missing required props or chart-scene without chart.type / chart.props matching the chart's required fields. Issues are sent back as a corrective system prompt for ONE retry — turns ~90% first-pass success into ~99% at the cost of one extra round-trip on the failing case. Lingering issues land in meta.warnings so the UI can surface them.

Slice 9 — hook composer pass

  • New improveHook(script, opts) that critiques s01 against the hook quality checklist and either keeps it or proposes a swap with a stronger sentence later in the script. Cheap (~1k input + 200 output tokens, ~$0.01/video on Sonnet 4.6).
  • Verbatim fidelity skips by contract — strict mode never swaps. Refine and split-merge run the critic.
  • Wired into POST /projects/:id/script/plan as an optional second pass, default on. Body flag improveHook=false skips. Decision and reasoning surface in meta.warnings.
  • Failures are non-fatal: a failed critic call returns the original script with a reasoning string instead of bubbling.

Test plan

  • All four new atmosphere presets render valid HTML with class + keyframes (verified via direct invoke)
  • Icon registry has 20 icons; renderIcon produces inline SVG with stroke colour applied
  • concept-callout template emits SVG inside .co-badge when items pass {text, icon}, two-digit number when items pass plain string
  • Reassembled my-first-video with explicit props.background overrides on different scenes — geometric-grid renders crisp diagonal accent lines with vignette; cosmic-dust shows dual halos drifting
  • Lint, format check, typecheck all pass
  • Schema validator + retry path — type-safe; manual end-to-end requires an Anthropic key call to exercise

Notes on cost

  • Planning a typical 60s video: ~5k input + 4k output tokens on Sonnet 4.6 — ~$0.07
  • Hook composer pass: ~1k input + 200 output — ~$0.01
  • Schema-correction retry (only when first pass fails validation): another ~5k+4k tokens — adds ~$0.07 on the ~10% of plans that fail validation
  • Net: ~$0.08–$0.15 per planned video, on the high end with retry

Stack

  • This PR depends on #7 (the atmosphere + transition registries it builds on)
  • It composes well with #6 (captions UX) and #8 (scale-to-fit + DESIGN.md overlay) — they're all independent.

Three things in one PR — the planner stops being template-only and
starts directing cinematography, scenes get a much richer kit of
visual presets to draw on, and a cheap second-pass critic protects
the cold-open.

Asset library:
- Four new atmosphere presets bringing the registry from 5 → 9:
  - radial-pulse: concentric ring pulses from canvas centre. Magnetises
    the eye for centred hero elements (hook-statreveal).
  - cosmic-dust: sparse twinkling stars + two drifting halos. Cosmic
    scale feel for hooks/outros.
  - geometric-grid: drifting + pulsing isometric grid lines.
    Engineering aesthetic for chart-scene and comparison.
  - flow-lines: wavy horizontal SVG paths drifting across the canvas.
    Audio-waveform vibe for quote scenes and time-series charts.
- New icons/ registry — 20 hand-drawn 24x24 stroke SVGs (lock, network,
  bolt, dollar, globe, target, shield, etc). Pure geometric primitives,
  no third-party paths. Renders at any size, picks up token colours via
  currentColor.
- concept-callout items can now carry an icon that REPLACES the number
  badge: { text, icon } per item, mixed with plain strings allowed.
  Backwards-compatible with existing scripts that pass plain strings.

Slice 8 — planner cinematography:
- New "Cinematography" section in playbook teaches the AI when to pick
  each atmosphere preset, which transition fits which moment, and
  which icon belongs on which list item.
- Planner tool schema gains optional background and transition fields
  per scene, both as enums of registered ids. Unknown values fall back
  to defaults so a hallucination can't break assembly.
- After the first planner pass, schema validation walks every scene
  and flags missing required props or chart-scene without chart.type /
  chart.props matching the chart's required fields. Issues are sent
  back as a corrective system prompt for ONE retry — turns ~90% first-
  pass success into ~99% at the cost of one extra round-trip on the
  failing case. Lingering issues land in meta.warnings so the UI can
  surface them.

Slice 9 — hook composer pass:
- New improveHook(script, opts) that critiques s01 against the hook
  quality checklist and either keeps it or proposes a swap with a
  stronger sentence later in the script. Cheap (~1k input + 200 output
  tokens, ~$0.01/video on Sonnet 4.6).
- Verbatim fidelity skips by contract — strict mode never swaps.
  Refine and split-merge run the critic.
- Wired into POST /projects/:id/script/plan as an optional second pass,
  default on. Body flag improveHook=false skips. Decision and reasoning
  surface in meta.warnings.
- Failures are non-fatal: a failed critic call returns the original
  script with a reasoning string instead of bubbling.

Verified: assembled the existing my-first-video with explicit overrides
to props.background = radial-pulse / cosmic-dust / geometric-grid /
flow-lines on different scenes. All four new presets reach the
assembler and render correctly. Concept-callout with mixed string and
{text, icon} items renders icon SVGs inside badges where set, plain
two-digit numbers elsewhere.
@cuio cuio merged commit 3fea7f1 into feat/visual-sota-stop-the-slideshow Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant