Skip to content

Conversation

@xyliugo
Copy link
Collaborator

@xyliugo xyliugo commented Dec 13, 2025

Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

Description of Change

Adds automatic context compaction to the agent execution loop to prevent context-window overflows during long tool-heavy runs. Introduces a new CLI flag --compaction-token and plumbs it through the evaluator into the agents. When enabled, the agent summarizes and rewrites the in-flight conversation to system + initial user + summary once the prompt token count reaches the configured threshold.

image

Additional Information

  • --compaction-token 999999999 disables compaction (default).
  • Token counting is done pre-call using LiteLLM token_counter; Claude native path uses Anthropic’s /v1/messages/count_tokens.
  • Compaction summaries are included in token_usage; Claude token counting calls are not.
  • messages.json now reflects the compacted on-the-fly message state (not the full pre-compaction transcript).

@xyliugo xyliugo requested a review from zjwu0522 December 13, 2025 09:39
Copy link
Collaborator

@zjwu0522 zjwu0522 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zjwu0522 zjwu0522 merged commit 42bdebc into main Dec 13, 2025
2 checks passed
@zjwu0522 zjwu0522 deleted the feat/support-auto-compaction branch December 13, 2025 10:25
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.

3 participants