microcompact

Microcompact 是第三层压缩策略,专门压缩工具调用历史。

设计理念

问题

AI 的思考过程(thinking)占用大量 token:

Assistant: Let me analyze the code structure first...
[长篇分析文本]
Now I'll read the main file...
[更多思考过程]
Based on this, I should...
[继续思考]

Tool calls: [readCode, readFile, grepSearch]

解决方案

保留工具调用,移除思考过程:

Assistant: [thinking removed]

Tool calls: [readCode, readFile, grepSearch]

核心实现

压缩算法

选择性保留

某些思考过程需要保留:

触发时机

自动触发

手动触发

压缩效果

示例

压缩前 (约 5000 tokens):

压缩后 (约 500 tokens):

节省: 90% tokens

保留策略

保留最近的消息

保留关键信息

与其他压缩层的配合

组合使用

下一步