{% if extra_context %}{% set section_name = "chapter 2" %}{% else %}{% set section_name = "chapter 1" %}{% endif %}
{% include "character-context.jinja2" -%}
{% if extra_context %}
<|SECTION:HISTORY|>
{{ extra_context }}
<|CLOSE_SECTION|>
{% endif -%}
<|SECTION:{{ section_name }}|>
{{ section_name.upper() }} START
{% for chunk in text_to_chunks(dialogue, chunk_size=1200) %}
CHUNK {{ loop.index }}: 
{{ chunk }}

{% endfor %}
{{ section_name.upper() }} END
<|CLOSE_SECTION|>

{% include "dynamic-instructions.jinja2" %}
<|SECTION:TASK|>
Provide a compressed, short summary for {{ section_name }}.

Do not repeat any information from the previous context. 

The chapter is presented to you in chronological chunks. Each chunk is a part of the story that is separated by a significant event or change in the story.

Compress each individual chunk, keeping the start and ending points as anchors.

Each summarization should be 1-3 sentences long and be a broad strokes summary of the events.

Ensure the persistence of all pivotal moments, decisions and story developments. These are moments that have big character progression. Think broad strokes, long term altering event.s

Specifically mention characters, locations and objects by name. 

Consider the other chunks and the history to inform the context of the summarizations. Each chunk must be summarized in a way that it leads into the next chunk.

YOU MUST SUMMARIZE ALL CHUNKS.
YOU MUST NOT ADD COMMENTARY.
YOU MUST NOT ADD COMBINED SUMMARIZATION OF ALL CHUNKS.
YOU MUST NOT GET LOST IN DETAILS. THESE SUMMARIES SHOULD BE OUTLINES.

You must provide your response in the following format:

{% for chunk in text_to_chunks(dialogue, chunk_size=chunk_size) %}
{% if analyze_chunks %}ANALYSIS OF CHUNK {{ loop.index }}: "<briefly explain your understanding of chunk {{ loop.index }}>""
{% endif -%}
CHUNK {{ loop.index }}: "<brief summary of this chunk>"

{% endfor %}
<|CLOSE_SECTION|>
{% if generation_options and generation_options.writing_style %}
<|SECTION:WRITING STYLE|>
{{ generation_options.writing_style.instructions }}
<|CLOSE_SECTION|>
{% endif %}
{% if analyze_chunks %}{{ set_prepared_response("ANALYSIS OF CHUNK 1: \"")}}{% else %}{{ set_prepared_response("CHUNK 1: \"")}}{% endif %}