-
Notifications
You must be signed in to change notification settings - Fork 43
Add automatic compaction of historical messages for agents #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# [mycoder-agent-v1.6.0](mycoder-agent-v1.5.0...mycoder-agent-v1.6.0) (2025-03-21) ### Features * **browser:** add system browser detection for Playwright ([00bd879](00bd879)), closes [#333](#333)
# [mycoder-v1.6.0](mycoder-v1.5.0...mycoder-v1.6.0) (2025-03-21) ### Features * **browser:** add system browser detection for Playwright ([00bd879](00bd879)), closes [#333](#333)
Implements #338 - Agent self-managed message compaction: 1. Enhanced LLM abstraction to track token limits for all providers 2. Added status update mechanism to inform agents about resource usage 3. Created compactHistory tool for summarizing older messages 4. Updated agent documentation and system prompt 5. Added tests for the new functionality 6. Created documentation for the message compaction feature This feature helps prevent context window overflow errors by giving agents awareness of their token usage and tools to manage their context window.
- Change token usage threshold from 70% to 50% for compaction recommendations - Add threshold-based status updates (send updates when usage exceeds 50%) - Update documentation and tests to reflect these changes - Make compaction recommendations more proactive at high usage
Based on user feedback, I've made the following improvements:
These changes make the message compaction feature more proactive and help ensure that agents don't wait until it's too late to compact their message history. |
- Added message-compaction.md to packages/docs/docs/usage - Updated usage index to include message compaction - Added compactHistory tool to the tools table
I've updated the docs website to include information about message compaction:
The documentation covers:
This ensures that users will be able to find information about this feature in the official documentation. |
I've fixed several TypeScript errors and test failures in the message compaction implementation:\n\n- Fixed variable redeclaration in ollama.ts provider\n- Fixed variable usage before declaration in openai.ts provider\n- Fixed context access in compactHistory.ts\n- Updated tests to work with the new implementation\n- Fixed import order issues\n\nAll tests are now passing and the build is successful. |
🎉 This PR is included in version mycoder-agent-v1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Overview
This PR implements issue #338 - Agent self-managed message compaction. It adds functionality to prevent context window overflow errors when agents run for extended periods.
Features
Enhanced LLM Abstraction:
Status Update Mechanism:
Message Compaction Tool:
compactHistory
tool that agents can use to reduce context sizeDocumentation:
Testing
Added tests for:
Benefits
Closes #338