Auto-sync: 2026-04-18 00:18
This commit is contained in:
34
wiki/concepts/内存刷新.md
Normal file
34
wiki/concepts/内存刷新.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: "内存刷新"
|
||||
type: concept
|
||||
tags: [ai-agent, memory, persistence]
|
||||
last_updated: 2026-04-02
|
||||
---
|
||||
|
||||
## Definition
|
||||
在压缩触发前,提醒 Agent 将重要上下文写入磁盘的机制,确保重要内容在压缩擦除后仍能存活。
|
||||
|
||||
## Mechanism
|
||||
当会话接近上下文限制时,OpenClaw 触发一个静默回合,提醒 Agent 在压缩运行前将持久事实保存到 memory/YYYY-MM-DD.md。
|
||||
|
||||
## Configuration
|
||||
```json
|
||||
{
|
||||
"compaction": {
|
||||
"memoryFlush": {
|
||||
"enabled": true,
|
||||
"softThresholdTokens": 4000
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> 注意:4000 这个数值要根据使用的模型来调整。使用 Gemini/Claude/GPT-4.1 等大模型(上下文窗口 32K/128K/200K tokens)时,4000 太保守,会导致频繁的 summary 和上下文"碎片化"。
|
||||
|
||||
## Key Insight
|
||||
如果只在上下文窗口中,它是临时的。如果在磁盘上,它就能存活。
|
||||
|
||||
## Related
|
||||
- [[上下文压缩]] — 导致信息丢失的机制
|
||||
- [[上下文窗口]] — 有限的对话历史容纳量
|
||||
- [[上下文记忆]] — AI Agent 保留对话历史的能力
|
||||
Reference in New Issue
Block a user