Skip to content

Add a compaction handler that drops the middle first - #798

Open
jfeser wants to merge 2 commits into
masterfrom
jf-middle-compaction
Open

jfeser wants to merge 2 commits into
masterfrom
jf-middle-compaction

Conversation

@jfeser

@jfeser jfeser commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Implements threshold compaction with two strategies:

  • A history longer than the soft token cap is compacted by dropping tool call output, retaining only the most recent calls.
  • A history longer than the hard token cap is compacted by replacing the middle messages with a summary, retaining the system prompt and most recent interactions.

@jfeser
jfeser added this pull request to stack #799 September 28, 2026 16:42
Base automatically changed from jf-tool-output-truncation to master September 29, 2026 17:49
@eb8680
eb8680 force-pushed the jf-middle-compaction branch from ae1963a to 38adabb Compare September 29, 2026 17:49
@eb8680
eb8680 force-pushed the jf-middle-compaction branch from 571e5f9 to c2500bb Compare October 3, 2026 17:27
@eb8680
eb8680 removed this pull request from stack #799 October 3, 2026 17:48
@eb8680
eb8680 added this pull request to stack #814 October 3, 2026 17:48

This branch has not been deployed

No deployments
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