Skip to content

[Feature] Compaction / Rolling context window #7472

Closed

Description

@shimmyshimmer

Either compaction or rolling context window. Requested from Reddit user:

With a rolling context window, once the context limit of the chat is hit, the oldest top messages are trimmed off so space can be made for the newest messages, allowing the conversation to continue without needing to create a new chat.

As time goes on, the earliest parts of the conversation are forgotten but whatever hasn't been trimmed off is remembered.
I'm not sure if this is a feature already, as I wasn't able to find it in the UI.

Basically only the most recent subset of information is kept in the conversation context, while older messages are dropped to make space in the context for new messages.

In ChatGPT instead of making the user create an entire new chat, when a chat gets too long it will purposefully "forget" earlier parts of the conversation because they are dropped from the context window to make room for newer messages.

Activity

  1. added
    feature request
    on Jul 26, 2026
  2. TheAlex25 commented on Jul 26, 2026

    @TheAlex25

    Compaction would be cool, where the previous conversation is summarized internally into the KV cache. If that fails, then a fallback to a rolling context window.

  3. GrapeMan4 commented on Jul 27, 2026

    @GrapeMan4

    Rolling context window and compaction both have their benefits. I like the idea of both, but if i had to choose one it would probably be the rolling context

    Rolling context window preserves exact phrasing and original meaning of messages , as well as immediate task instructions without distortion.

    Its also a predictable and cheap compute footprint since token size never creeps upward beyond the ceiling limit, allowing user to continue the chat without creating a new one.

    Currently it seems the user can already summarize the conversation on their own and put key facts/points into a text file and attach it to the current chat to create their own pseudo compaction.

    This, paired with the rolling context window would be extremely powerful for maintaining a conversation long term.

  4. konradbr commented on Aug 14, 2026

    @konradbr

    +1 on this. Let me know if I can support.

    IMO: this should (must!) be fully parametric: e.g. for my use case, I need limited initial context + controlled-length sliding window + occasional compaction. Ideally would be of course vector store memory and parametric "offload"… basically thinking of a way to split the conversation into blocks and summarize and create some kind of search index that gets sent with every request so that chat history relevant to that specific request can be re-pulled-in.

    Jan has already implemented this to some extend in their desktop app.

    Here's some good reading about the possible approaches & architectures:

    https://www.youngju.dev/blog/chatbot/2026-03-12-multiturn-conversation-management-llm-memory-context-optimization.en#full-architecture

  5. rahulmathews commented on Aug 15, 2026

    @rahulmathews

    +1 on this. I can help on this.

  6. shimmyshimmer commented on Aug 21, 2026

    @shimmyshimmer
    MemberAuthor
  7. konradbr commented on Aug 25, 2026

    @konradbr

    Awesome! Now I couldn't find any settings in the UI other than "Checkpoints" in "Run Settings". Any docs on this?

    What I'm looking for (and built a prototype for as an intermediate pass-through server between any Client and OpenAI-compatible API) is:

    • The full conversation to be always sent to the LLM
    • "Compacted" messages to be replaced with some UIDs and stored (originals or vectors?) in cache
    • Decision to compact messages based on "keep first F messages", "keep last L messages", and possibly on some intermediate agent/step which suggests which other ones to keep in-between.
    • Tools to be made avaialable to the LLM to request the conversation again with selected (by UID) messages to be reintroduced
    • Controls "Keep F first", "Keep L last", "Context Length" (which might auto-adjust F/L)

    How are the rest of you using this?

  8. ZupoLlask commented on Aug 26, 2026

    @ZupoLlask

    I just noticed that when compaction is triggered during a tool call, output seems to be completely lost when apparently this doesn't trigger a failed tool call (I see a "output omitted: 2044 chars, no context room left" message in the CoT), that feels to be the sensible thing to happen so LLM is not tricked believing that output is accurate.

    Can someone confirms this behavior, please?

  9. konradbr commented on Sep 5, 2026

    @konradbr

    @ZupoLlask I can confirm the "output ommited" behaviour happens quite frequently, indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions