Files
nexus/wiki/concepts/Compaction.md
2026-04-14 16:02:50 +08:00

36 lines
856 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Compaction内存压缩"
type: concept
tags: [AI, Agent, 上下文]
sources: [yang-xia-ri-ji-4, yang-long-xia-5-tian]
last_updated: 2026-04-14
---
## Definition
OpenClaw在对话填满Context Window时将旧消息压缩成摘要的机制。
## 问题
- 摘要抓住要点,但丢失细节
- 姓名、数字、具体决定统统消失
- 所有消息一视同仁(重要指令和闲聊得到相同待遇)
## 解决方案Memory Flush
```json
{
"compaction": {
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 4000
}
}
}
```
在压缩运行前将重要上下文写入memory/YYYY-MM-DD.md
## 关键洞察
"压缩不是敌人。未写入的上下文才是。" — 比利哥
## Connections
- [[Context-Window]] ← 受限于 ← [[Compaction]]
- [[Memory-Flush]] ← 保护机制 ← [[Compaction]]