Skip to content

Preserve recent messages during session compaction#2259

Draft
rumpl wants to merge 1 commit intodocker:mainfrom
rumpl:nicer-compaction
Draft

Preserve recent messages during session compaction#2259
rumpl wants to merge 1 commit intodocker:mainfrom
rumpl:nicer-compaction

Conversation

@rumpl
Copy link
Copy Markdown
Member

@rumpl rumpl commented Mar 26, 2026

Before compaction, the last ~20k tokens of messages are now kept aside and excluded from summarization. The summary item records a FirstKeptEntry index pointing to the first preserved message, and GetMessages reconstructs the conversation as [summary, kept_messages...].

This allows the LLM to continue naturally after a compaction event by retaining recent conversational context verbatim while still compacting older history.

Before compaction, the last ~20k tokens of messages are now kept aside
and excluded from summarization. The summary item records a
FirstKeptEntry index pointing to the first preserved message, and
GetMessages reconstructs the conversation as [summary, kept_messages...].

This allows the LLM to continue naturally after a compaction event
by retaining recent conversational context verbatim while still
compacting older history.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant