fix: curator uses distilled observations when all messages are distilled#389
Merged
Conversation
When /lore:curate runs distillation first (marking all messages as distilled=1), the curator was getting ALL raw messages via bySession() which doesn't filter on distilled status. At 400K tokens this overwhelms the curator with already-processed content. Now the curator: 1. First tries undistilled messages (recent, since last curation) 2. Falls back to distilled observations when all messages are distilled (the common case after /lore:curate runs distillation first) This prevents the curator from being overwhelmed by hundreds of thousands of tokens of already-distilled messages.
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
Fixes the curator to use distilled observations instead of raw messages when distillation has already run (the common case with
/lore:curate).Problem
curator.runInner()calledtemporal.bySession()which returns ALL messages regardless of distilled status. After/lore:curateruns distillation first (marking messages asdistilled=1), the curator was getting the full raw conversation — at 400K tokens this overwhelms the curator with already-processed content.Fix
Two-step approach:
temporal.undistilled()— get only unprocessed messages since last curationdistillation.loadForSession()— use the compressed distillation observations as inputThis ensures the curator sees a manageable amount of content regardless of conversation length.
Files Changed
packages/core/src/curator.ts— use undistilled messages or distillation observations