{# RENDERED CONTEXT #}
{% set rendered_context -%}
{% include "character-context.jinja2" -%}
{% include "memory-context.jinja2" -%}
{% include "extra-context.jinja2" -%}
{% if context_investigation %}
<|SECTION:POTENTIALLY RELEVANT INFORMATION|>
{{ context_investigation }}
<|CLOSE_SECTION|>
{% endif %}
{% include "dynamic-instructions.jinja2" %}
{% include "scene-intent.jinja2" %}
{% include "content-classification.jinja2" %}
{% endset %}
{# END RENDERED CONTEXT #}

{# SCENE CONTEXT #}
{% set scene_context_text %}
{% set scene_context = scene.context_history(
    budget=max_tokens-300-count_tokens(rendered_context), 
    min_dialogue=15, 
    sections=False, 
    keep_director=False, 
    chapter_labels=True
    ) 
-%}
{% for scene_line in scene_context -%}
{{ scene_line }}

{% endfor %}
{% endset %}
{# END SCENE CONTEXT #}

{# RENDER PROMPT #}
{{ rendered_context }}
<|SECTION:SCENE|>
{{ scene_context_text }}
<|CLOSE_SECTION|>
{% with _text=scene_context_text %}{% include "internal-note-help.jinja2" %}{% endwith %}
{# END RENDER PROMPT #}