You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a compact plugin that does auto compact on context like claude code #249
Hi! I'd love to work on this. I've implemented a similar auto-compact system in MiniCode (a lightweight Claude Code clone in TypeScript), which includes:
Auto-compact: detects when context approaches token limit and triggers summarization (src/compact/auto-compact.ts)
Micro-compact: lightweight compression for partial context reduction (src/compact/microcompact.ts)
Manual compact: user-triggered full compaction (src/compact/manual-compact.ts)
Compact boundaries: session persistence marks where compaction happened for replay (src/session.ts)
For this plugin, I'm thinking of the following approach:
Token budget tracking — count conversation tokens, trigger compact when exceeding a configurable threshold (e.g. 80% of model context window)
Summarization — use the LLM itself to produce a compact summary of the conversation so far, then replace older messages with the summary
Plugin interface — follow the existing pattern (SLUG + run() function), configurable via environment variables or the existing optillm config
A few questions before I start:
Should this be a standalone plugin (like memory_plugin.py) or integrated into the proxy layer to intercept all requests regardless of approach?
Is there a preferred way to get the model's context window size, or should it be a config parameter?
Should the compact trigger be token-count-based, message-count-based, or both?
Happy to implement once we align on the direction. Thanks!
1 -> We can make it a separate plugin but let's try and make it easy to add on to existing approaches or plugins so someone can do a requests/response handover transparently using existing operator like &compact&moa .
2 -> We can make it a config but if the upstream provider provides this info we should try and get that first form the /models or similar endpoint.
Activity
GoDiao commentedon May 5, 2026
Hi! I'd love to work on this. I've implemented a similar auto-compact system in MiniCode (a lightweight Claude Code clone in TypeScript), which includes:
src/compact/auto-compact.ts)src/compact/microcompact.ts)src/compact/manual-compact.ts)src/session.ts)For this plugin, I'm thinking of the following approach:
SLUG+run()function), configurable via environment variables or the existing optillm configA few questions before I start:
memory_plugin.py) or integrated into the proxy layer to intercept all requests regardless of approach?Happy to implement once we align on the direction. Thanks!
codelion commentedon May 5, 2026
1 -> We can make it a separate plugin but let's try and make it easy to add on to existing approaches or plugins so someone can do a requests/response handover transparently using existing operator like &
compact&moa.2 -> We can make it a config but if the upstream provider provides this info we should try and get that first form the /models or similar endpoint.
3 -> make it configurable with some good default.
Add compact plugin for auto context compression (closes #249)