{% set character_context %}
{% if include_character_context %}{% include "character-context.jinja2" %}{% endif %}
{% endset %}

{% set passthrough_context %}
{% if extra_context %}
<|SECTION:POTENTIALLY RELEVANT CONTEXT|>
{% for context in extra_context %}{{ context }}
---
{% endfor %}
<|CLOSE_SECTION|>
{% endif %}
{% endset %}

{% set main_context %}
<|SECTION:MAIN CONTEXT|>
{{ text }}
<|CLOSE_SECTION|>
{% endset %}

{% set rendered_context %}
{{ character_context }}

{{ passthrough_context }}

{{ main_context }}
{% endset %}

{% if num_queries > 1 %}{% set label_questions="questions" %}{% else %}{% set label_questions="question" %}{% endif %}

{% set questions = instruct_text("Ask the narrator "+to_str(num_queries)+" important "+label_questions+" to gather additional context to assist with the following goal: "+goal+"

1. Focus on established facts, lore, and background information.
2. Avoid asking for information already provided in the given context.
3. Address gaps in the current narrative or explore relevant backstory.
4. If characters mention specific states, locations, items, or other characters, prioritize queries about these.
5. Phrase queries as direct requests for information from the world database.
6. For unfamiliar elements, ask straightforward questions to clarify their nature or significance.

Your response must be a brief analysis of the scene followed by your "+to_str(num_queries)+" important "+label_questions+" (use a numbered list).", rendered_context, as_list=True) %}
{%- with memory_query=join(questions, "\n") -%}
    {% include "extra-context.jinja2" %}
{% endwith %}

{{ rendered_context }}

<|SECTION:TASK|>
Answer the following questions:

{% for question in questions %}
{{ loop.index }}. {{ question }}
{% endfor %}

Your answers should be truthful and contain relevant data. Pay close attention to timestamps when retrieving information from the context.

Provide your answers in a clear and concise manner. 1 paragraph per answer is sufficient.

<|CLOSE_SECTION|>
<|SECTION:RELEVANT CONTEXT|>
{{ bot_token }}Answers: 