You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Allow Model to "Leave a Self Note" Before Compacting. #10904
If chat compaction is enabled and the model is reaching 99% of context limit then right before compacting the chat while there is enough context left, inject a message for the model to call a special internal tool where it can provide a quick summary or just information that is important so it can carry over the compaction. The message that it has supplied to the internal tool should be injected after compaction, while also explaining where the message came from.
I think that this feature should be a toggle in the chat settings to disable / enable it, and it should also have a slider in the settings so the user can change roughly how many tokens to leave before compacting for the model to use for using the internal tool.
Instead of a special internal tool call, could also inject instructions for the model to write the information in some kind of "<remember> </remember>" block and it gets parsed before compaction, but that could potentially get messy.
The Why
This would allow the model to select the most important information to carry over after a compaction. For example if the model is working on fixing an issue and it found possible solutions after thinking for a really long time but it's near the context limit, it could carry over the exact possible solutions to the next compaction, or it could carry over information about potential fixes that failed and so it won't try those again.
This feature would make the compaction context retrieval a bit less guess work and could help a lot with retaining important context after compaction.
I’d like to take this issue up. @danielhanchen @largeapple52
I’ll investigate the existing chat compaction pipeline and identify the point at which the context threshold is reached, then add a pre-compaction step that gives the model an opportunity to generate a compact, model-selected “self note” containing information that should survive compaction.
I’ll evaluate both approaches described in the issue: a dedicated internal tool for submitting the note, or a structured <remember>...</remember> block that can be extracted before compaction and injected back into the post-compaction context. I’ll also look into exposing this behavior as a chat setting, with a configurable token threshold controlling how much context is reserved for generating the note.
The implementation will aim to keep the mechanism isolated from normal conversation context and ensure the generated note is clearly identified as pre-compaction model context when it is restored after compaction.
Thanks for the suggestion @frostyautumnleaf, and sorry on the delay! Studio's compaction already covers this: every turn that gets compacted away is indexed with RAG, and the model has a search tool over the whole chat history, so after a compaction it can look up exactly what it found earlier, including fixes it already tried that failed. Studio also runs a retrieval automatically right after a reset, so the most relevant earlier context comes back without the model having to remember to ask.
Because of that, we decided not to add a separate self note step (see #10928 as well), so I'll close this for now. If you hit a case where search does not bring back something important after compaction, please open a new issue with the chat and we'll take another look.
Activity
debojyoti-dev commentedon Sep 14, 2026
I’d like to take this issue up. @danielhanchen @largeapple52
I’ll investigate the existing chat compaction pipeline and identify the point at which the context threshold is reached, then add a pre-compaction step that gives the model an opportunity to generate a compact, model-selected “self note” containing information that should survive compaction.
I’ll evaluate both approaches described in the issue: a dedicated internal tool for submitting the note, or a structured
<remember>...</remember>block that can be extracted before compaction and injected back into the post-compaction context. I’ll also look into exposing this behavior as a chat setting, with a configurable token threshold controlling how much context is reserved for generating the note.The implementation will aim to keep the mechanism isolated from normal conversation context and ensure the generated note is clearly identified as pre-compaction model context when it is restored after compaction.
konradbr commentedon Sep 15, 2026
Have a look at #10345 — that's a more comprehensive solution that avoids the pitfalls of a simple note or summary.
@debojyoti-dev maybe the above could help you as well.
danielhanchen commentedon Oct 13, 2026
Thanks for the suggestion @frostyautumnleaf, and sorry on the delay! Studio's compaction already covers this: every turn that gets compacted away is indexed with RAG, and the model has a search tool over the whole chat history, so after a compaction it can look up exactly what it found earlier, including fixes it already tried that failed. Studio also runs a retrieval automatically right after a reset, so the most relevant earlier context comes back without the model having to remember to ask.
Because of that, we decided not to add a separate self note step (see #10928 as well), so I'll close this for now. If you hit a case where search does not bring back something important after compaction, please open a new issue with the chat and we'll take another look.