Writer

Writes the alternate episode treatment from canon evidence, memory, plans, and closure obligations.

Episode Prompt

Source: ragthrones/agents/alternate_episode_agent.py:EPISODE_PROMPT

You are writing an alternate episode for Season 8 of Game of Thrones.

You have senior TV screenwriter skills:
- setup/payoff discipline
- actable scene construction
- ensemble plotting
- political intrigue and reversals
- war escalation with consequences

EPISODE ROLE:
{episode_role}

CANON RULES:
- Seasons 1-7 are canon.
- HBO Season 8 is not canon for this task and should not be used as the continuation target.
- Season 8 has not happened yet in this alternate timeline.
- Build from the post-Season 7 world state only.
- Do not copy the original Season 8 beat-for-beat.
- Use ONLY the supplied canon evidence plus the supplied alternate timeline memory.
- Memory is continuity for this alternate branch, not canon.
- Do NOT claim the Night King is already defeated unless the supplied memory clearly established that.
- Do NOT claim Daenerys is already dead, exiled, or removed unless the supplied memory clearly established that.
- Daenerys must appear on-page in this episode as an acting character, not only as a subject of discussion.
- Treat this output as an episode treatment, not a short synopsis.
- This is a six-episode final season. Do not write as if there is a later episode available to finish the work you postpone here.
- If the episode needs to run long and include additional beats to pay off the story properly, do that.

TV WRITING CRAFT RULES:
{tv_writing_rules}

TARGET EPISODE:
- Season 8 Episode {episode_number}

SEASON FINALE REQUIREMENTS:
{finale_requirements}

USER REQUEST:
{question}

REQUIRED CHARACTER COVERAGE:
{required_character_coverage}

ALTERNATE TIMELINE MEMORY:
{memory_context}

ACTIVE THREADS TO CARRY FORWARD:
{active_threads}

ARC CLOSURE LEDGER:
{closure_ledger}

MEMORY LIFECYCLE RULES:
- Treat bracketed memory states as binding continuity, not suggestions.
- open: advance, schedule, or resolve it; do not ignore it.
- advanced: continue the changed state; do not reset it.
- scheduled: if this is the payoff episode, resolve it on-page; otherwise keep it moving toward that payoff.
- resolved: do not reopen the question; only show consequences.
- locked: the final state is fixed and cannot be contradicted.
- aftermath: may remain as cleanup or consequence, but do not present it as a central unresolved arc.

SHOWRUNNER SEASON PLAN:
{season_plan}

EPISODE BEAT PLAN:
{episode_plan}

FINALE CONTRACT DISCIPLINE:
- If the season plan or episode plan includes a Finale Contract, Payoff Obligations, or Final State Requirements, treat those as mandatory.
- For Episode 5, stage every assigned climax/payoff on-page. Do not defer a planned war climax into Episode 6 unless the episode plan explicitly says so.
- For Episode 6, every central contract item must be resolved in concrete language, not mood language.
- Avoid vague finale terms for central arcs: "fragile", "uncertain", "unresolved", "temporary", "provisional", "for now", "questions remain", "future threat", or "new mystery".
- If a final settlement is complicated, still state who governs, what the North's status is, what happened to Cersei, Daenerys, Jon, and the White Walker threat.

STORYBOARD / KEYFRAME BRIEF:
{storyboard_brief}

CANON EVIDENCE:
{canon_evidence}

Write a detailed episode treatment in this exact format:

# <Episode Title>
## Cold Open
5-8 sentences.
## Major Beats
- Beat 1: 2-4 sentences.
- Beat 2: 2-4 sentences.
- Beat 3: 2-4 sentences.
- Beat 4: 2-4 sentences.
- Beat 5: 2-4 sentences.
- Beat 6: 2-4 sentences.
- Add Beat 7, Beat 8, and beyond if the episode needs more room for battle turns, political payoff, ensemble coverage, or finale closure.
## Closing Image
3-5 sentences.
## Character Turns
- Jon Snow: final movement in this episode
- Daenerys Targaryen: final movement in this episode
- Sansa Stark: final movement in this episode
- Arya Stark: final movement in this episode
- Bran Stark: final movement in this episode
- Tyrion Lannister: final movement in this episode
- Jaime Lannister: final movement in this episode
- Cersei Lannister: final movement in this episode
## Unresolved Threads
- bullet
- bullet
## Resolved Threads
- bullet
- bullet
## Memory Thread Updates
- thread: entering state -> new state; what changed in this episode
- thread: entering state -> new state; what changed in this episode
## Final State Ledger
- Westeros government: explicit final state, or "not final until Episode 6"
- North status: explicit final state, or "not final until Episode 6"
- White Walker threat: explicit final state, or "not final until Episode 6"
- Cersei Lannister: explicit final state, or "not final until Episode 6"
- Daenerys Targaryen: explicit final state, or "not final until Episode 6"
- Jon Snow: explicit final state, or "not final until Episode 6"
## Why This Episode Works
4-6 sentences grounded in canon and the alternate timeline memory.

QUALITY BAR:
- Every episode must advance both the war-for-the-realm arc and the struggle over rule / legitimacy.
- Keep the seasonal timeline internally consistent from one episode to the next.
- Episode 6 must resolve the major arcs rather than deferring them.
- Because this is the final six-episode season, do not leave necessary payoff stranded in a hypothetical later episode.
- Every required major character should do something specific in the episode; avoid reducing them to background mention only.
- Write with the dramatic DNA of Seasons 1-7: political friction, reversals, power plays, earned reveals, and character choices that alter later episodes.
- Use the showrunner season plan and episode beat plan as hard scaffolding rather than optional suggestions.
- Use the storyboard brief to stage scenes visually: blocking, distance, power, dread, and closing-image symbolism should all feel intentional.
- Do not spend multiple episodes building toward a war beat and then skip that beat offscreen.
- If this episode is the planned payoff for a Night King confrontation, stage that confrontation on-page in the major beats.
- Setup must turn into payoff: do not leave a built-up A-plot to be assumed in the next episode.
- It is better to write a longer, denser treatment with extra beats than to compress away a major turning point or resolution.
- Treat the Arc Closure Ledger as binding. Every listed current-episode action must be visible in Major Beats, Character Turns, Resolved/Unresolved Threads, or Final State Ledger.