Skip to content

feat(config): support configuring preserved messages in compaction#1305

Open
narcilee7 wants to merge 1 commit intoMoonshotAI:mainfrom
narcilee7:feat/config-compaction-messages
Open

feat(config): support configuring preserved messages in compaction#1305
narcilee7 wants to merge 1 commit intoMoonshotAI:mainfrom
narcilee7:feat/config-compaction-messages

Conversation

@narcilee7
Copy link
Copy Markdown

@narcilee7 narcilee7 commented Mar 2, 2026

Related Issue

N/A (Resolves internal TODO in src/kimi_cli/soul/kimisoul.py)

Description

This PR adds a new configuration option max_preserved_messages to the loop_control section in config.toml.

  • Feature: Users can now control the number of recent messages preserved when auto-compaction is triggered.
  • Default: The default value is set to 2, maintaining the existing behavior while offering flexibility for users who wish to retain more context.
  • Implementation: Updated LoopControl config model and KimiSoul initialization to pass the configured value to SimpleCompaction.

Checklist

  • I have read the https://github.com/MoonshotAI/kimi-cli/blob/main/CONTRIBUTING.md document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

1 participant