Skip to content

fix: curator uses distilled observations when all messages are distilled#389

Merged
BYK merged 1 commit into
mainfrom
fix-curator-input
May 19, 2026
Merged

fix: curator uses distilled observations when all messages are distilled#389
BYK merged 1 commit into
mainfrom
fix-curator-input

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 19, 2026

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() called temporal.bySession() which returns ALL messages regardless of distilled status. After /lore:curate runs distillation first (marking messages as distilled=1), the curator was getting the full raw conversation — at 400K tokens this overwhelms the curator with already-processed content.

Fix

Two-step approach:

  1. First try temporal.undistilled() — get only unprocessed messages since last curation
  2. If all messages are distilled (the normal case after distillation runs), fall back to distillation.loadForSession() — use the compressed distillation observations as input

This 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

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.
@BYK BYK self-assigned this May 19, 2026
@BYK BYK merged commit 8dcb6ee into main May 19, 2026
10 checks passed
@BYK BYK deleted the fix-curator-input branch May 19, 2026 12:52
This was referenced May 21, 2026
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