← Back to PRs

#8903: fix: improve compaction summary instructions to preserve active work

by joetomasone open 2026-02-04 15:37 View on GitHub →
agents stale
## Problem When compacting conversation history, the merge summaries instruction was: ``` Merge these partial summaries into a single cohesive summary. Preserve decisions, TODOs, open questions, and any constraints. ``` This misses the most critical context for agent continuity: - What the agent was actively working on - Batch operation progress (e.g., '5/17 items done') - The most recent user request Result: Post-compaction amnesia where the agent knows facts but forgets what it was doing. ## Solution Expanded instructions with explicit priorities: ``` MUST PRESERVE: - Active tasks and their current status (in-progress, blocked, pending) - Batch operation progress (e.g., '5/17 items completed') - The last thing the user requested and what was being done about it - Decisions made and their rationale - TODOs, open questions, and constraints - Any commitments or follow-ups promised PRIORITIZE recent context over older history. The agent needs to know what it was doing, not just what was discussed. ``` ## Impact - Better context preservation during compaction - Reduced 'what was I doing?' moments - Batch operations can continue after compaction - Agent maintains awareness of active work <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Updates the compaction-stage “merge summaries” prompt in `src/agents/compaction.ts` to explicitly preserve agent continuity context (active task/status, batch progress, latest user request, decisions/rationale, TODOs/constraints, and promised follow-ups) and to prioritize recent context over older history when merging partial summaries during staged summarization. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - Change is limited to a static instruction string used for summary merging; no control flow, types, or external interfaces change, and the new formatting (`[].join("\n")`) is straightforward. - No files require special attention <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs