Skip to content

Conversation

@luojiyin1987
Copy link
Contributor

@luojiyin1987 luojiyin1987 commented Dec 31, 2025

fixes #143

Summary

  • Add /compact-threshold slash command to view and set the auto-compact threshold ratio
  • Support multiple input formats: 0.85, 85%, or 85
  • Add reset/default option to restore default threshold (0.92)
  • Update both English and Chinese README documentation

Changes

  • src/commands/compact-threshold.ts - New command implementation
  • src/commands/index.ts - Register the new command
  • src/core/config/schema.ts - Add autoCompactThreshold to GlobalConfig
  • src/utils/session/autoCompactThreshold.ts - Threshold calculation utilities
  • src/utils/session/autoCompactCore.ts - Use threshold in auto-compact logic
  • README.md / README.zh-CN.md - Document the new command

Usage

/compact-threshold          # View current threshold
/compact-threshold 0.85     # Set to 85%
/compact-threshold 85%      # Set to 85%
/compact-threshold reset    # Reset to default (0.9)

Test plan

  • Run /compact-threshold to view current setting
  • Set threshold with /compact-threshold 0.8
  • Verify percentage input works: /compact-threshold 80%
  • Test reset: /compact-threshold reset
  • Verify invalid inputs are rejected

🤖 Generated with Claude Code

luojiyin1987 and others added 9 commits December 31, 2025 11:19
Signed-off-by: luojiyin <luojiyin@hotmail.com>
Signed-off-by: luojiyin <luojiyin@hotmail.com>
Signed-off-by: luojiyin <luojiyin@hotmail.com>
Signed-off-by: luojiyin <luojiyin@hotmail.com>
Signed-off-by: luojiyin <luojiyin@hotmail.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Keep consistent with upstream.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Help users choose appropriate threshold based on model context size.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

[BUG] 自动 compact 的能力偶尔会报错

1 participant