feat: add auto context compress ability for agent#1329
Open
Lerr1uqs wants to merge 2 commits intoMoonshotAI:mainfrom
Open
feat: add auto context compress ability for agent#1329Lerr1uqs wants to merge 2 commits intoMoonshotAI:mainfrom
Lerr1uqs wants to merge 2 commits intoMoonshotAI:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Description
Purpose / 目的
This PR introduces ACC (Auto Context Compress) mode to give the agent the ability to
autonomously decide when to compact context, so it can sustain longer-running tasks
with better continuity and less context exhaustion.
本 PR 引入 ACC(Auto Context Compress)模式,核心目标是让 agent 具备
自主判断上下文压缩时机的能力,从而支持更长时间连续作业,
减少上下文耗尽导致的中断与退化。
Why this matters / 为什么重要
Fixed-threshold compaction is reactive and may miss the best timing.
In long workflows, the agent often has better local judgment on when older context becomes
low-value.
ACC adds runtime context-capacity awareness and controlled compaction access, enabling
proactive compression while preserving task continuity.
固定阈值压缩偏被动,触发时机不一定最优。
在长链路任务中,agent 往往更清楚哪些历史上下文已经低价值。
ACC 提供运行时容量感知和受控压缩能力,让 agent 能主动压缩并保持任务连续性。
What changed / 改动内容
Added
/accslash command (toggle/on/off/status).Added ACC mode indicator (
ACC) in shell bottom toolbar.When ACC is enabled, each LLM step appends a lightweight runtime hint including:
Added
AccCompactContexttool:task_summaryReused existing compaction pipeline and extended it to append
task_summaryafter compactionso post-compaction behavior remains aligned with current task progress.
新增
/acc斜杠命令(切换/开启/关闭/状态)。在 Shell 底栏新增 ACC 模式标记(
ACC)。ACC 开启时,每次 LLM step 前附加轻量提示,包括:
新增
AccCompactContext工具:task_summary复用现有压缩链路,并在压缩后追加
task_summary,确保压缩后仍能按当前任务进度继续执行。
Non-invasive implementation / 非侵入式实现原则
No large refactor in agent spec or tool loading architecture.
ACC logic is added incrementally around existing
KimiSoulflow and current compactionmechanisms.
Existing
/compactbehavior is preserved.不改动 agent spec 与工具加载主架构。
ACC 仅在现有
KimiSoul与压缩流程外围做增量扩展。现有
/compact行为保持不变。Tests / 测试
Added/updated focused tests:
tests/core/test_acc_tool.pytests/core/test_kimisoul_slash_commands.pytests/ui_and_conv/test_prompt_tips.pyValidation command:
Result: all passed.
Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.