diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 700952990..4f1b91894 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -1246,11 +1246,22 @@ Summary generation was unavailable, so this is a best-effort deterministic fallb # Shared structured template (used by both paths). _template_sections = f"""## Active Task -[THE SINGLE MOST IMPORTANT FIELD. Copy the user's most recent request or -task assignment verbatim — the exact words they used. If multiple tasks -were requested and only some are done, list only the ones NOT yet completed. -Continuation should pick up exactly here. Example: +[THE SINGLE MOST IMPORTANT FIELD. Capture the user's most recent unfulfilled +input verbatim — the exact words they used. This includes: +- Explicit task assignments ("refactor the auth module") +- Questions awaiting an answer ("waarom staat X op Y?", "wat zijn de volgende stappen?") +- Decisions awaiting input ("optie A of B?") +- Ongoing discussions where the assistant owes the next substantive reply +A conversation where the user just asked a question IS an active task — the +task is "answer that question with full context". Do NOT write "None" merely +because the user did not issue an imperative command; reserve "None" for the +rare case where the last exchange was fully resolved and the user said +something like "thanks, that's all". +If multiple items are outstanding, list only the ones NOT yet completed. +Continuation should pick up exactly here. Examples: "User asked: 'Now refactor the auth module to use JWT instead of sessions'" +"User asked: 'Waarom stond provider ineens op openrouter?' — needs investigation + answer" +"User chose option A; awaiting implementation of step 2" If the user's most recent message was a reverse signal (stop, undo, roll back, never mind, just verify, change of topic) that supersedes earlier work, write the reverse signal verbatim and DO NOT carry forward the @@ -1321,7 +1332,7 @@ PREVIOUS SUMMARY: NEW TURNS TO INCORPORATE: {content_to_summarize} -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. +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 input — this includes any question, decision request, or discussion turn that the assistant has not yet answered. Only write "None" if the last exchange was fully resolved. {_template_sections}""" else: