-
Notifications
You must be signed in to change notification settings - Fork 120
feature: /compact for context compression #306
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
base: main
Are you sure you want to change the base?
Conversation
| function loadAutoCompactConfig(): AutoCompactConfig { | ||
| const defaults: AutoCompactConfig = { | ||
| enabled: true, | ||
| threshold: 60, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pahari47 I see that the "conservative" threshold value is set at 60%. Where have you defined the default threshold values for "aggressive" & the other modes ? Also what's the value for "default" mode ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hii @Avtrkrb, All modes use the same threshold (60%) to trigger, they differ in how much compression is applied.
| Aspect | Conservative | Default | Aggressive |
|---|---|---|---|
| Tool output | First 3 lines | Key info/summary | Success/error only |
| User messages | No change | Summarize (>500 chars) | Heavily summarize (>500 chars) |
| Assistant messages | No change | Summarize (>500 chars) | Heavily summarize (>500 chars) |
| Token savings | ~20-30% | ~40-50% | ~60-70% |
| Context preserved | High | Medium | Low |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright that makes sense. This might be a dumb questions, but in issue #13 there was a discussion about allowing the users to set the threshold value in agents.config.json, but I don't think I saw any code which was reading it ? Correct me if I'm wrong. I did see some logic for setting the threshold value at a session level, which is good though.. Could you clarify that please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does read the agent config. In config/index.ts const projectConfigPath = join(process.cwd(), 'agents.config.json');
also check this one loadAppConfig()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the global agents.config.json ? I'm assuming it reads that as well ?
|
Also @Pahari47 you seem to have quite a few checks failing, please resolve them when you get the time. |
actually There is problem in |
Sure let me take a look. @will-lamerton FYI |
@Pahari47 Since the definition below it is much neater.. I feel the definition in lines 294 to 298 can be removed. |
|
Hey @Pahari47, you might want to merge in upstream changes as these test cases were fixed and I can see you branch is behind them :) |
I will fix it then Open the PR |
Description
closes #13
Implements a message compression system with manual /compact command and automatic context management via auto-compact. Reduces token usage by compressing conversation history while preserving essential information, enabling longer conversations within model context limits.
Type of Change
Features implemented
Manual compression command (/compact)
--aggressive,--conservative,--default,--preview--auto-on,--auto-off,--threshold <n>Auto-compact feature
/compact --threshold <n>and agents.config:Status command enhancement
Compression strategy
Testing
Automated Tests
Note: Test coverage for compression utilities can be added
Manual Testing
Checklist