Skip to content

fix(chatd): improve compaction prompt to preserve forward momentum#22989

Merged
kylecarbs merged 1 commit into
mainfrom
kylecarbs/improve-compaction-prompt
Mar 12, 2026
Merged

fix(chatd): improve compaction prompt to preserve forward momentum#22989
kylecarbs merged 1 commit into
mainfrom
kylecarbs/improve-compaction-prompt

Conversation

@kylecarbs
Copy link
Copy Markdown
Member

Problem

The summarization prompt explicitly tells the model to "Omit pleasantries and next-step suggestions" and the summary prefix frames the compacted context as passive history: Summary of earlier chat context:. After compaction mid-task, the model reads a factual recap with no forward momentum, loses its direction, and either stops or asks the user what to do.

Research

I compared our compaction prompt against several other agents:

Agent Key Pattern
Codex Prompt says "Include what remains to be done (clear next steps)". Prefix: "Another language model started to solve this problem..."
Mux Includes "Current state of the work (what's done, what's in progress)" + appends the user's follow-up intent
Continue "Make sure it is clear what the current stream of work was at the very end prior to compaction so that you can continue exactly where you left off"
Copilot Chat Dedicated sections for Active Work State, Recent Operations, Pre-Summary State, and a Continuation Plan with explicit next actions

Every other major agent explicitly preserves forward intent and in-progress state. Coder was the only one telling the model to omit next steps.

Changes

Summary prompt:

  • Removes Omit next-step suggestions
  • Adds structured Include: list with explicit items for in-progress work, remaining work, and the specific action being performed when compaction fired
  • Frames the operation as context compaction (matching Codex's framing)

Summary prefix:

  • Old: Summary of earlier chat context:
  • New: The following is a summary of the earlier conversation. The assistant was actively working when the context was compacted. Continue the work described below:

The prefix is the first thing the model reads post-compaction — framing it as an active handoff with an explicit "Continue" directive primes the model to resume work rather than wait.

The previous summarization prompt told the model to "omit next-step
suggestions," and the summary prefix framed compacted context as
passive history ("Summary of earlier chat context"). This caused the
model to lose direction mid-task after compaction — it would read a
factual recap with no forward momentum and stop or ask the user what
to do next.

The new prompt:
- Removes the "omit next-step suggestions" instruction
- Explicitly asks for in-progress and remaining work
- Captures the specific action being performed when compaction fired
- Frames the summary prefix as an active handoff with a "Continue"
  directive

This aligns with patterns used by Codex, Mux, Continue, and Copilot
Chat, all of which preserve forward intent through compaction.
@kylecarbs kylecarbs enabled auto-merge (squash) March 12, 2026 12:59
@kylecarbs kylecarbs merged commit 53bfbf7 into main Mar 12, 2026
26 checks passed
@kylecarbs kylecarbs deleted the kylecarbs/improve-compaction-prompt branch March 12, 2026 13:03
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants