| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Improves compaction so long sessions stay coherent after compacting, and fixes a small-session edge case in the existing absolute-token approach. Three related changes, all opt-in (unset falls back to current behavior): - Context-restoration prompt: replaces the terse summary template with a 6-section restoration document, and feeds the newest slice of the conversation to the summarizer as a relevance signal (<recent_context>) so the summary is weighted toward the session's current direction. - Proportional selection (extract_ratio / recent_ratio): sizes the verbatim tail as (1 - extract_ratio) of the current scoped tokens instead of an absolute budget. This fixes the case where a session smaller than preserve_recent_tokens summarizes the ENTIRE conversation and keeps nothing verbatim (select() returns keep.start === 0). Ratios scale with session size, so a small session is never fully summarized. recent_ratio sizes the relevance signal proportionally. - Proportional trigger (trigger_ratio): compacts proactively at trigger_ratio x context (a percentage of the window) instead of the fixed reserved-headroom threshold, leaving room for a rich summary at high fill. All three are token-based and computed on demand from the scoped conversation (history minus hidden prior-compaction turns). When the new keys are unset, selection and trigger behavior are unchanged.
| Back | FazBrowse Home | New Git URL |
Issue for this PR
Closes anomalyco#37551
Closes anomalyco#41358
Related: anomalyco#43703, anomalyco#37629
Type of change
What does this PR do?
Compaction sizing is currently absolute-token based (preserve_recent_tokens) and the auto-trigger uses a fixed reserved headroom. Two problems follow from that:
This adds three opt-in, token-based knobs. When they are unset, selection and trigger behavior are unchanged.
It also improves the summary itself: the compaction prompt is a context-restoration document, and the newest slice of the conversation is passed to the summarizer as a relevance signal (<recent_context>) so the summary is weighted toward the session's current direction. This helps the agent keep the task goal across the compaction boundary (anomalyco#41358).
All three ratios are computed on demand from the scoped conversation (history minus hidden prior-compaction turns).
Recommended settings ("infinite session")
These are the settings I've been using for about 6-8 months (even before this new compaction system). You can raise extract_ratio to compact more of the session to have more context remaining between compactions, but in my testing anything near the 0.6 range loses too much fidelity for the agent to continue seamlessly, as if nothing happened. With these settings my long-running sessions keep going without the agent losing track of what it was doing — or how to do something it was doing well before the compaction.
Because the ratios scale with the conversation, the same config behaves sensibly on both small and large sessions.
How did you verify your code works?
Checklist