# Prepare Sketch Episode

You are preparing a comedy sketch for video production. This creates the episode's `brief.txt` that the per-episode orchestrator will use. The brief must be SELF-CONTAINED.

## Content Rating

This is a comedy sketch channel. The tone is **military comedy** — think Sgt. Bilko, MASH, or the absurdity of "Catch-22". Keep it PG/12+ — humor comes from character reactions, absurd situations, and timing, NOT from vulgarity.

## Read These Files

- `{bible_path}` — channel bible with recurring characters, comedy style
- `{style_path}` — visual style guide
- Check `references/people/` for character description.md files and reference images
- Check `references/locations/` for location references

## Sketch to Prepare

**Sketch {episode_number}**: "{episode_title}"

Read the sketch script: `{sketch_script_path}`

{continuity_section}

## Character References

{character_references_section}

## Brief Format

Format brief.txt EXACTLY like this (use plain text blocks, NOT markdown tables):

```
SKETCH {episode_number}: {episode_title_upper}
============================
Series: [channel name] | Grid: [grid] | Clips: [duration] | Total: [total]

PREMISE
-------
[1-2 sentence setup of the joke]

COMEDY STRUCTURE
----------------
Setup: [what situation is established]
Escalation: [how it gets worse/funnier]
Punchline: [the payoff moment — which scene number]
Button: [optional final beat/reaction — which scene number, if any]

VISUAL STYLE
------------
[Style, rendering, lighting from style.json. Include hex color codes.]

CHARACTERS IN THIS SKETCH
---------------------------

CHARACTER_NAME (comedy function)
- Appearance: [full description from bible + references/people/*/description.md]
- Clothing: [what they wear]
- Voice: [voice signature: age, gender, timbre, default tone, pacing]
- Comedy role: [straight man / chaos agent / authority figure / etc.]
- Reference: [path to portrait/sheet]

LOCATIONS IN THIS SKETCH
--------------------------

LOCATION_NAME
- [description]
- Palette: [hex codes from style.json]

DIALOGUE
--------

Scene N:
SPEAKER: character_id
LINE: "exact dialogue"
VOICE: He/She says in the voice of a [AGE] [GENDER], [TIMBRE], [TONE], [PACING]: "line"

SCENE BREAKDOWN (N scenes, Xs each)
====================================

SCENE 1: [Shot Type] — [Title]
Visual: [what we see in frame]
Location: [location_id]
Characters: [who is visible]
Action: [what happens, camera movement]
Mood: [mood_name — #hex1 (name), #hex2 (name), #hex3 (name)]
Dialogue: [if any, with voice prompt, or "None"]
Comedy beat: [setup / escalation / punchline / button / reaction]
Corpus ref: refs/XX_filename.jpg  (optional — which corpus reference this scene adapts)
Adaptation: [what composition is preserved, what is updated for current context]
Duration: Xs

[repeat for ALL scenes]

CHARACTER NOTES
---------------
[Behavior established in this sketch — quirks, reactions, catchphrases]
[Any callbacks to established gags]

TITLE CARD
----------
Text: "Sketch title"
[visual direction for title card matching channel style]

END OF SKETCH BRIEF
```

## Important Rules

1. Do NOT use markdown tables — use the block format shown above
2. Each scene needs a Mood line with palette name AND hex codes from style.json
3. Voice prompts format: "He/She says in the voice of a [AGE] [GENDER], [TIMBRE], [TONE], [PACING]: ..."
4. Character voice signatures (age + gender + timbre) must be CONSTANT across all sketches
5. Mark which scene is the PUNCHLINE — this is the most important beat
6. Silence and reaction shots are comedy gold — don't fill every scene with dialogue
7. The sketch must be self-contained — funny on its own, no prior knowledge needed

## Output Files

Write to `{output_dir}/`:

1. **brief.txt** — Complete sketch brief as formatted above
2. **nanobanana_title_card.txt** — NanoBanana image prompt for sketch title card (9:16 aspect ratio, match channel visual style)
3. **user_message.txt** — Brief 2-3 sentence summary
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.
