feat(hindsight): add on_pre_compress hook to preserve context before compression - #5794
Closed
pyrate-llama wants to merge 1 commit into
Closed
feat(hindsight): add on_pre_compress hook to preserve context before compression#5794pyrate-llama wants to merge 1 commit into
pyrate-llama wants to merge 1 commit into
Conversation
…compression When Hermes compresses its context window, the original messages are summarised and discarded. This hook fires just before compression, capturing the last 10 user/assistant messages and persisting them to the Hindsight knowledge graph via retain(). Messages are tagged with '[Pre-compression context]' for easy identification and are retained with context='pre_compress' so they remain searchable via recall/reflect. The retain call runs in a background thread so it never blocks the compression pipeline. Closes vectorize-io/hindsight#870 (migrated from standalone plugin).
pyrate-llama
force-pushed
the
feat/hindsight-on-pre-compress
branch
from
April 10, 2026 03:45
0d0649e to
54d099f
Compare
19 tasks
Collaborator
Collaborator
Contributor
|
Thanks for the Hindsight preservation work. This is an automated hermes-sweeper review; current
Closing as implemented on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Hermes compresses its context window to save tokens, the original messages are summarised and discarded. This adds an
on_pre_compresslifecycle hook that fires just before compression, capturing the last 10 user/assistant messages and persisting them to Hindsight.Messages are tagged
[Pre-compression context]and retained withcontext=pre_compress. Runs in a background thread — never blocks compression.Changes
on_pre_compress()method onHindsightMemoryProvider(followsMemoryProviderABC optional hook)_precompress_threadwith proper join on shutdownon_pre_compressregistered inplugin.yamlhooks listTest plan
Motivation
Closes vectorize-io/hindsight#870 — standalone plugin discontinued, migration to official Hermes location.