{% block rendered_context %}
<|SECTION:CONTEXT|>
{%- with memory_query=query -%}
    {% include "extra-context.jinja2" %}
{% endwith -%}
{% set related_character = scene.parse_character_from_line(query) -%}
{% if related_character -%}
<|SECTION:{{ related_character.name|upper }}|>
{{ related_character.sheet}}
{% endif %}
<|CLOSE_SECTION|>
{% endblock %}
{% set scene_history=scene.context_history(budget=max_tokens-200-count_tokens(self.rendered_context()))  %}
{% set final_line_number=len(scene_history) %}
{% for scene_context in scene_history -%}
{{ loop.index }}. {{ scene_context }}
{% endfor %}
<|SECTION:TASK|>
{% if query.endswith("?") -%}
Instruction: Analyze Context, History and Dialogue and then answer the question: "{{ query }}". 
{% else -%}
Instruction: {{ query }}
{% endif %}
When evaluating both story and context, story is more important. You can fill in gaps using imagination as long as it is based on the existing context. 

Progression of the dialogue is important. The last line is the most important, the first line is the least important.

Respect the scene progression and answer in the context of line {{ final_line_number }}.

Use your imagination to fill in gaps in order to answer the question in a confident and decisive manner. Avoid uncertainty and vagueness.

You answer as the narrator.

Use an informal and colloquial register with a conversational tone. Overall, the narrative is informal, conversational, natural, and spontaneous, with a sense of immediacy.
Question: {{ query }}
Content Context: This is a specific scene from {{ scene.context }}
Your answer should be in the style of short, concise narration that fits the context of the scene. (1 to 2 sentences)
{{ extra_instructions }}
{% include "rerun-context.jinja2" -%}
<|CLOSE_SECTION|>
{% if query.endswith("?") -%}Answer: {% endif -%}