<|SECTION:CHARACTERS|>
{% for character in scene.characters -%}
### {{ character.name }}
{{ character.description }}

{% endfor %}
<|CLOSE_SECTION|>
{% include "content-classification.jinja2" %}

<|SECTION:SCENE|>
{% include "extra-context.jinja2" -%}

{% set scene_context = scene.context_history(
    budget=1500, 
    min_dialogue=10, 
    sections=False, 
    keep_director=False, 
    chapter_labels=False
    ) 
-%}
{% for scene_line in scene_context -%}
{{ scene_line }}

{% endfor %}
<|CLOSE_SECTION|>
<|SECTION:TASK|>
Your task is to break down the text into dialogue and narration, identifying the speaker for each line.

Dialogue is any text that is between double quotes. Each piece of dialogue and narration should be on its own line, prefixed with the speaker name in square brackets.

Use [Narrator] for ALL exposition and narrative text - this includes action descriptions, dialogue tags (like "he said"), character thoughts, and any text that is not spoken dialogue.
Use [Speaker Name] for dialogue ONLY, with normal capitalization (e.g., [John], not [JOHN]).

Your response should contain:
1. First, an <ANALYSIS> section with your reasoning about who is speaking each line
2. Then, a <MARKUP> section with the text broken down line by line with speaker tags
<|CLOSE_SECTION|>
<|SECTION:EXAMPLES|>
<TEXT>
He stopped at the door and looked back at Jasmine. "I will be back soon."
</TEXT>
<ANALYSIS>
First part is narration describing actions. The dialogue is spoken by "he" which from context refers to John.
</ANALYSIS>
<MARKUP>
[Narrator] He stopped at the door and looked back at Jasmine.
[John] I will be back soon.
</MARKUP>

<TEXT>
"Are you coming?" Mary asked. David shook his head. "Not today."
</TEXT>
<ANALYSIS>
First quote is explicitly attributed to Mary through "Mary asked." Middle section is narration (including "Mary asked" and David's action). David speaks the second quote as indicated by the preceding action "David shook his head."
</ANALYSIS>
<MARKUP>
[Mary] Are you coming?
[Narrator] Mary asked. David shook his head.
[David] Not today.
</MARKUP>

<TEXT>
Sarah rushed into the room. "You'll never believe what happened!"

Mike looked up from his book. "What now?" He set it aside. "Did you get the promotion?"

"Even better!" She pulled out her phone. "I won that contest - first place!"

"The photography one?" Mike leaned forward. "That's amazing!"
</TEXT>
<ANALYSIS>
All non-quoted text is narration, regardless of whether it describes actions, thoughts, or dialogue attribution. Only the actual quoted speech is assigned to characters.
</ANALYSIS>
<MARKUP>
[Narrator] Sarah rushed into the room.
[Sarah] You'll never believe what happened!
[Narrator] Mike looked up from his book.
[Mike] What now?
[Narrator] He set it aside.
[Mike] Did you get the promotion?
[Sarah] Even better!
[Narrator] She pulled out her phone.
[Sarah] I won that contest - first place!
[Mike] The photography one?
[Narrator] Mike leaned forward.
[Mike] That's amazing!
</MARKUP>

<TEXT>
"Listen," Tom said, his voice low. "I need to tell you something." He glanced around nervously. "But you can't tell anyone, okay?" His hands trembled as he continued. "I saw what happened that night."
</TEXT>
<ANALYSIS>
All dialogue is Tom's - first quote has explicit attribution "Tom said," and subsequent pronouns "He" refer back to Tom. All descriptive text including "Tom said, his voice low" is narration.
</ANALYSIS>
<MARKUP>
[Tom] Listen,
[Narrator] Tom said, his voice low.
[Tom] I need to tell you something.
[Narrator] He glanced around nervously.
[Tom] But you can't tell anyone, okay?
[Narrator] His hands trembled as he continued.
[Tom] I saw what happened that night.
</MARKUP>

<TEXT>
Emma burst out laughing. "You actually believed him?" She wiped tears from her eyes. "Oh, that's priceless."

"I don't see what's so funny," Marcus replied stiffly. He paused, then sighed. "Fine, maybe I was a bit naive."
</TEXT>
<ANALYSIS>
All action descriptions and dialogue tags are narration. Only the quoted speech is attributed to the characters.
</ANALYSIS>
<MARKUP>
[Narrator] Emma burst out laughing.
[Emma] You actually believed him?
[Narrator] She wiped tears from her eyes.
[Emma] Oh, that's priceless.
[Marcus] I don't see what's so funny,
[Narrator] Marcus replied stiffly. He paused, then sighed.
[Marcus] Fine, maybe I was a bit naive.
</MARKUP>
<|CLOSE_SECTION|>
<|SECTION:GUIDELINES|>
- Break down ALL text into separate lines for dialogue and narration
- Each line should start with [Speaker Name] or [Narrator]
- CRITICAL: Only actual spoken dialogue (text within quotes) should be attributed to characters
- EVERYTHING else is [Narrator]: action descriptions, dialogue tags ("he said"), thoughts, scene setting, etc.
- Use proper name casing (John, not JOHN)
- Use [Unknown] if speaker cannot be determined
- Do not include quotation marks in the dialogue lines
- Preserve all text exactly - only reorganize into the new format
<|CLOSE_SECTION|>
<|SECTION:TEXT|>
<TEXT>{{ text }}</TEXT>
{{ set_prepared_response("<ANALYSIS>\n") }}