支持通过 /compact 指令手动触发上下文压缩
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## 背景
当前任务接近上下文容量上限时(例如界面显示已使用约 81% token),用户无法手动触发 compact,只能等待系统自动处理。这让用户无法主动控制上下文整理时机,也增加了继续工作时突然达到上限的风险。
## 需求
希望支持一个可由用户手动触发的 `/compact` 指令(或等价的手动 compact 入口),在当前任务中立即执行上下文压缩。
## 期望行为
- 用户发送 `/compact` 后,立即对当前任务执行一次上下文压缩。
- 压缩完成后保留任务目标、关键结论、待办事项和必要的最近消息,避免影响任务连续性。
- 压缩进行中显示明确的进行中状态,完成后告知用户结果;失败时给出可理解的错误信息。
- 即使当前上下文尚未达到自动 compact 阈值,也允许用户主动执行。
- 如果当前环境或模型不支持 compact,应明确提示不支持原因,而不是静默忽略指令。
## 使用场景
长时间任务、代码调试或多轮对话中,用户希望在继续工作前主动释放上下文空间,降低接近 token 上限导致任务中断的概率。
Contributor guide
Research direction
No implementation files, entry points, or tests are named. Start by locating the command handling and context-compaction flow, then trace how task state and model capability errors are reported. Done means /compact triggers an immediate supported compaction, preserves the requested context, shows progress and completion or failure, and explains unsupported environments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100