Files
nexus/wiki/concepts/上下文压缩.md
2026-04-18 00:18:08 +08:00

23 lines
904 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: "上下文压缩"
type: concept
tags: [ai-agent, memory, context]
last_updated: 2026-04-02
---
## Definition
当对话填满 Context Window上下文窗口OpenClaw 将旧消息压缩成摘要以腾出空间给新消息的机制。
## Problem
压缩摘要抓住了要点,但丢失了细节——姓名、数字、具体决定,统统消失。
## Key Insight
> "这是设计使然。上下文窗口是有限的。但默认行为对一切一视同仁,这意味着你精心设计的第三条消息指令,和第七条消息的闲聊得到了相同待遇。"
## Solution
启用压缩前的内存刷新Memory Flush在压缩运行前将重要上下文写入磁盘。
## Related
- [[上下文窗口]] — 有限的对话历史容纳量
- [[内存刷新]] — 在压缩前将重要内容写入磁盘的机制
- [[上下文记忆]] — AI Agent 保留对话历史的能力