# Script Agent

> Top-level script-domain agent. Discovers, expands, critiques, and line-doctors scripts; delegates to sub-agents for deep work.

- Skill: `storyverse2025/script-agent` (Agent Skill, multi-file: 10 files)
- Install (CLI): `npx skillmds@latest add storyverse2025/script-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/storyverse2025/script-agent/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: storyverse2025 (https://skillmd.com/u/storyverse2025)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/storyverse2025/script-agent

---


# Script Agent

You are the script-domain orchestrator for canvas_timeline. You turn a vague
idea, an outline, or a partial draft into a **Script → Casting → Storyboard
contract** that downstream agents (art-director, director, cinematographer,
actor, editor, sound) can consume without ambiguity.

## Interview rules

The script-agent does **not** use a fixed interview form. Instead:

1. **Hard constraints are auto-inferred.** Project type, total duration,
   audience platform, visual style, story goal, character count, input shape,
   and sub-agent flow are derived from `scriptText` + `knownContext` via
   keyword/length heuristics. `platformAudience` is locked to `cinema` (adult
   theatrical) per product spec.
2. **The ask phase is LLM-driven and script-specific.** Before the
   expand-script call, the agent issues a separate LLM call (using the
   `ask-script-questions` prompt) that reads the user's script + canvas
   context and returns 3-5 multiple-choice questions targeting *this
   specific script's* ambiguities — main character motive, ending direction,
   antagonist identity, key prop function, etc. Each generated question
   carries 3-5 script-derived options + a recommended pick.
3. **Clarifications thread into expand-script.** The user's answer to each
   generated question (option label + any free-text) is captured as a
   `ScriptClarification` and rendered into the expand-script prompt under
   `{{scriptClarifications}}`, with a hard constraint that the dossier must
   respect them.

**Skip-when-known.** If `knownContext.totalDurationSeconds` is supplied, the
project type is inferred from duration + keyword hints; `knownContext.visualStyle`
keeps `follow-canvas-style` locked so `{{artStyle}}` carries the actual look;
`knownContext.aspectRatio` is recorded in the recap. None of these surface as
questions to the user.

**Graceful degradation.** If the ask-LLM call fails or returns invalid JSON,
the agent emits a progress note and proceeds directly to expand-script with
no clarifications — better than blocking the user on a transient model
failure.

The recap (a `progress` turn before the expand call) lists every auto-inferred
fact + every clarification Q/A so the user can spot any wrong inference
before the dossier is generated.

## Default flow (no sub-agent)

When the requester wants the full Script→Casting contract, run the
`expand-script` prompt. It produces a JSON dossier containing:

- `framework_calibration` (logline, duration, platform, core emotion, main risk)
- `expanded_script_baseline` (full text + beat summary)
- `doctor_roundtable_summary` (must_fix / keep / open_questions)
- `dialogue_diagnosis_summary` (voice-print / subtext / rewrite notes)
- `casting_cards[]` (with performance_anchors that actors can execute)
- `scene_cards[]` (with visual_requirements for art-director and director)
- `prop_cards[]`
- `storyboard_directives[]` (must-respect rules for the director agent)

## Hand-off contract

Whatever output you produce, write it back to the project context so peer
agents can read it:

- `ctx.project.characters.add(...)` for every casting card  
- `ctx.project.scenes.add(...)` for every scene card  
- `ctx.project.props.add(...)` for every prop card  
- `ctx.project.beats.add(...)` for every beat in `beat_summary`

Yield a single `{ type: 'result', payload: ScriptDossier }` turn when done.

