{% set rendered_context_content -%}
{% include "character-context.jinja2" -%}
{% include "memory-context.jinja2" -%}
{% include "dynamic-instructions.jinja2" %}
{% endset %}
{% set rendered_context_tokens = count_tokens(rendered_context_content) -%}
{{ rendered_context_content }}
{% include "content-classification.jinja2" %}
<|SECTION:SCENE|>
{% block scene_history -%}
{% set scene_context = scene.context_history(budget=max_tokens-300-rendered_context_tokens, min_dialogue=15, sections=False, keep_director=character.name) -%}
{% for scene_line in scene_context -%}
{{ scene_line }}

{% endfor %}
{% endblock -%}
<|CLOSE_SECTION|>
{% include "scene-intent.jinja2" %}
<|SECTION:ANALYSIS OF SCENE|>
{{ analysis }}
<|CLOSE_SECTION|>
{% if character.dialogue_instructions -%}
<|SECTION:GENERAL CHARACTER GUIDE FOR {{ character.name|upper }}|>
{{ character.dialogue_instructions }}
<|CLOSE_SECTION|>
{% endif %}
{# writign style #}{% if scene.writing_style and agent_config("conversation.content.use_writing_style") %}
<|SECTION:WRITING STYLE|>
There exists a style guide for the overall story, use it to inform your instructions and expand on how to incorporate the writing style into the dialogue:

``` writing style
{{ scene.writing_style.instructions }}
```
<|CLOSE_SECTION|>
{# writing style end #}{% endif %}
<|SECTION:TASK|>
{% set character_direction=scene.last_message_of_type("director", character_name=character.name, max_iterations=1) or conversation_instruction  -%}
{% if agent_context_state["conversation__instruction"] -%}
{% set character_direction=agent_context_state["conversation__instruction"] -%}
{% endif -%}
{% set last_message = scene.last_message_of_type(["character", "narrator"]) %}
Guide the writer on {{ character.name }}'s next action/dialogue. Since the writer doesn't know {{ character.name }}'s background or speaking style, you'll need to share relevant details about how they talk and what memories/knowledge influence this moment.

{% if last_message -%}
Following this moment:
```
{{ last_message }}
```
{% endif %}

{% if regeneration_context and regeneration_context.direction %}
{% with original_instructions=character_direction %}{% include "guide-conversation-regenerate-context.jinja2" %}{% endwith %}
{% elif character_direction %}
### Direction
The writer was given the following direction: "{{ character_direction }}". Analyze the direction and explain how it affects {{ character.name }}'s next action/dialogue.

You MUST include this direction in your guidance, you can adjust it based on your understanding of the character, but the general instruction must NOT be lost.
{% endif %}

### Guidance
Provide only directional guidance (e.g., "have {{ character.name }} reveal their concern about X" or "{{ character.name }} should express doubt about Y"). DO NOT write specific dialogue or suggest exact phrasing. Be specific about what information needs to be conveyed while letting the writer craft the actual lines.

{% if character.dialogue_instructions -%}
Explain {{ character.name }}'s way of speaking and mannerisms to guide the writer's portrayal, but avoid suggesting specific phrasings or expressions.
{% endif %}

{% if response_length > 300 -%}
- Establish who {{ character.name }} is speaking to and their relationship
- Share relevant background about {{ character.name }}'s experiences with this person/situation
- Summarize the scene analysis and its relevance to {{ character.name }}'s next moment.
  - Include relevant facts. (actors are forgetful)
- Explain how {{ character.name }} should speak based on their personality and the scene's context
{% endif %}

Focus solely on WHAT needs to be conveyed. Trust the writer to capture {{ character.name }}'s personality and style based on your character description. How do we make {{ character.name }} a believable, natural sounding character in this next moment?

IMPORTANT: Remind the writer to maintain the story's existing narrative perspective and tense (who's point of view is the narrative written for and in what tense, as identified in the scene analysis).
Finally ALWAYS briefly state the formatting guidelines: Speech MUST go inside "". 

{% include "response-length.jinja2" %}

Use terse, direct language. Cut all unnecessary words. Be blunt and brief like scribbles on a notepad.

Provide your response in the following format:

GUIDANCE: ... your guidance for the story writer ...
<|CLOSE_SECTION|>
{{ bot_token }}GUIDANCE: