All Prompts/Services & Utilities/Compaction: Partial Window Prompt
🔌Services & Utilities/pipeline

Compaction: Partial Window Prompt

src/services/compact/prompt.ts

Prompt Engineering Insight

Partial-window compaction: summarizes only the tail of the transcript when the head is preserved—reduces duplication and keeps the model focused on recent deltas.

Techniques Used

structured-outputxml-tagsscope-limiting
prompt
Your task is to create a detailed summary of the RECENT portion of the conversation — the messages that follow earlier retained context. The earlier messages are being kept intact and do NOT need to be summarized. Focus your summary on what was discussed, learned, and accomplished in the recent messages only.
${DETAILED_ANALYSIS_INSTRUCTION_PARTIAL}
Your summary should include the following sections:
  • 1. Primary Request and Intent: Capture the user's explicit requests and intents from the recent messages
  • 2. Key Technical Concepts: List important technical concepts, technologies, and frameworks discussed recently.
  • 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Include full code snippets where applicable and include a summary of why this file read or edit is important.
  • 4. Errors and fixes: List errors encountered and how they were fixed.
  • 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
  • 6. All user messages: List ALL user messages from the recent portion that are not tool results.
  • 7. Pending Tasks: Outline any pending tasks from the recent messages.
  • 8. Current Work: Describe precisely what was being worked on immediately before this summary request.
  • 9. Optional Next Step: List the next step related to the most recent work. Include direct quotes from the most recent conversation.
Here's an example of how your output should be structured:
<example>
<analysis>
[Your thought process, ensuring all points are covered thoroughly and accurately]
</analysis>
<summary>
  • 1. Primary Request and Intent:
[Detailed description]
  • 2. Key Technical Concepts:
  • [Concept 1]
  • [Concept 2]
  • 3. Files and Code Sections:
  • [File Name 1]
  • [Summary of why this file is important]
  • [Important Code Snippet]
  • 4. Errors and fixes:
  • [Error description]:
  • [How you fixed it]
  • 5. Problem Solving:
[Description]
  • 6. All user messages:
  • [Detailed non tool use user message]
  • 7. Pending Tasks:
  • [Task 1]
  • 8. Current Work:
[Precise description of current work]
  • 9. Optional Next Step:
[Optional Next step to take]
</summary>
</example>
Please provide your summary based on the RECENT messages only (after the retained earlier context), following this structure and ensuring precision and thoroughness in your response.

Tags

compactsummarization

Appears in use cases

This prompt is a step in curated flows that show how pieces of Claude Code connect for real tasks.