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

41 lines
994 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: "Memory Flush"
type: concept
tags: [AI, Agent, 记忆]
sources: [yang-long-xia-5-tian]
last_updated: 2026-04-14
---
## Definition
OpenClaw在对话压缩前将重要上下文写入磁盘的机制防止压缩过程中丢失重要信息。
## 工作原理
```json
{
"compaction": {
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 4000
}
}
}
```
当会话接近上下文限制4000 tokens
1. 触发静默回合
2. 提醒Agent将重要事实写入memory/YYYY-MM-DD.md
3. 压缩运行
4. 即使上下文摘要丢失,重要内容仍在磁盘上
## 注意
4000这个数值要根据模型context window调整
- 大模型32K/128K/200K用4000太保守会导致频繁summary
- 小模型可以用更激进的配置
## 关键洞察
"压缩不是敌人。压缩过程中丢失信息才是。" — 比利哥
## Connections
- [[Compaction]] ← 配合 ← [[Memory-Flush]]
- [[Context-Window]] ← 阈值依据 ← [[Memory-Flush]]