Files
nexus/wiki/concepts/内存刷新.md
2026-04-18 00:18:08 +08:00

1.0 KiB
Raw Blame History

title, type, tags, last_updated
title type tags last_updated
内存刷新 concept
ai-agent
memory
persistence
2026-04-02

Definition

在压缩触发前,提醒 Agent 将重要上下文写入磁盘的机制,确保重要内容在压缩擦除后仍能存活。

Mechanism

当会话接近上下文限制时OpenClaw 触发一个静默回合,提醒 Agent 在压缩运行前将持久事实保存到 memory/YYYY-MM-DD.md。

Configuration

{
  "compaction": {
    "memoryFlush": {
      "enabled": true,
      "softThresholdTokens": 4000
    }
  }
}

注意4000 这个数值要根据使用的模型来调整。使用 Gemini/Claude/GPT-4.1 等大模型(上下文窗口 32K/128K/200K tokens4000 太保守,会导致频繁的 summary 和上下文"碎片化"。

Key Insight

如果只在上下文窗口中,它是临时的。如果在磁盘上,它就能存活。