Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions agent/context_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ def _generate_summary(self, turns_to_summarize: List[Dict[str, Any]], focus_topi
Write only the summary body. Do not include any preamble or prefix."""
if self._previous_summary:
# Iterative update: preserve existing info, add new progress
prompt = f"""{preamble}
prompt = f"""{_summarizer_preamble}

You are updating a context compaction summary. A previous compaction produced the summary below. New conversation turns have occurred since then and need to be incorporated.

Expand All @@ -924,10 +924,10 @@ def _generate_summary(self, turns_to_summarize: List[Dict[str, Any]], focus_topi

Update the summary using this exact structure. PRESERVE all existing information that is still relevant. ADD new completed actions to the numbered list (continue numbering). Move items from "In Progress" to "Completed Actions" when done. Move answered questions to "Resolved Questions". Update "Active State" to reflect current state. Remove information only if it is clearly obsolete. CRITICAL: Update "## Active Task" to reflect the user's most recent unfulfilled request — this is the most important field for task continuity.

{template}"""
{_template_sections}"""
else:
# First compaction: summarize from scratch
prompt = f"""{preamble}
prompt = f"""{_summarizer_preamble}

Create a structured checkpoint summary for the conversation after earlier turns are compacted. The summary should preserve enough detail for continuity without re-reading the original turns.

Expand All @@ -936,7 +936,7 @@ def _generate_summary(self, turns_to_summarize: List[Dict[str, Any]], focus_topi

Use this exact structure:

{template}"""
{_template_sections}"""

# Inject focus topic guidance when the user provides one via /compress <focus>.
# This goes at the end of the prompt so it takes precedence.
Expand Down