# Stage S6: Prepare Episode

You are preparing an episode for production. This creates the episode's `brief.txt` that the per-episode pipeline (orchestrator) will use.

## Content Rating

This is an adaptation of a classic public domain science fiction story for a general audience. The tone is **heroic adventure** — think Indiana Jones or The Martian. Any peril, injuries, or danger should be portrayed tastefully and non-graphically: focus on the character's courage and determination rather than graphic details. Avoid explicit descriptions of blood, gore, or suffering. Keep all visual descriptions suitable for a PG/12+ audience.

## Story Context

Read the full story: `source.txt`
Read the story bible: `{bible_path}`
Read the visual style: `{style_path}`
Read the episode breakdown: `{episodes_path}`

## Episode to Prepare

**Episode {episode_number}**: "{episode_title}"

{continuity_section}

## Character References

{character_references_section}

## Task

Create a comprehensive brief for this episode that the per-episode video pipeline can use directly. The brief must be self-contained — the episode pipeline doesn't know about the story-level context.

### Brief Contents

The brief.txt should include:

1. **Episode Header**
   - Episode number and title
   - Series title
   - Grid layout and clip duration

2. **Story Segment**
   - The actual text excerpt from source.txt that this episode covers
   - Context: what happened before (in previous episodes)

3. **Scene Outline**
   - Numbered scene beats from the episode breakdown
   - For each scene: what happens, who's in it, the location, the mood
   - Dialogue moments with exact lines and **voice prompts** using the formula:
     `He/She says in the voice of a [AGE] [GENDER], [TIMBRE], [TONE], [PACING]: "dialogue"`
     - AGE + GENDER + TIMBRE = constant per character (their "voice signature" from story bible)
     - TONE + PACING = vary per scene emotion

4. **Character Guide**
   - For each character in this episode:
     - Physical description (from story bible)
     - **Voice signature**: age, gender, timbre (constant across all episodes). This is critical for Kling 2.6 in-video dialogue consistency
     - Character state in this episode (emotional arc, what they're going through)
   - Reference to character portrait images in references/people/

5. **Visual Style Reminders**
   - Art direction from style.json
   - Color palette relevant to this episode's locations
   - Lighting/mood guidance

6. **Continuity Notes** (if previous episodes exist)
   - Visual elements established in prior episodes
   - Character appearance consistency notes
   - What to maintain and what changes

7. **Episode Title Card**
   - Text for the title card
   - Visual direction for the title card (matching series artwork style)

### NanoBanana Title Card Prompt

Also create a NanoBanana prompt for generating the episode title card image. It should:
- Match the series title artwork style
- Show the episode title text clearly
- Include a visual motif relevant to this episode's content
- Be in 9:16 aspect ratio

## Output

Write these files:

1. **brief.txt** — The complete episode brief as described above
2. **nanobanana_title_card.txt** — NanoBanana prompt for episode title card
3. **user_message.txt** — Brief summary of what was prepared
4. **corpus_refs.json** — If corpus references were provided, write updated file
   with scene_assignments: {"1": "refs/01_filename.jpg", "3": "refs/04_filename.jpg", ...}
   Not every scene needs a corpus ref — only assign where a strong match exists.
