--- title: "Context Window" type: concept tags: [AI, 模型, Context] sources: [yang-xia-ri-ji-4, yang-long-xia-5-tian] last_updated: 2026-04-14 --- ## Definition 模型能处理的上下文大小,决定了对话长度和信息保留量。 ## 典型值 | 模型 | Context Window | |------|---------------| | MiniMax-M2.7 | 200K tokens | | deepseek-reasoner | 16K tokens | ## Compaction机制 OpenClaw的对话压缩机制: - 当对话填满Context Window时,将旧消息压缩成摘要 - 摘要抓住要点,但丢失细节(姓名、数字、具体决定) - safeguard模式预留一半token给compaction ## Memory Flush解决方案 压缩前将重要上下文写入磁盘: ```json { "compaction": { "memoryFlush": { "enabled": true, "softThresholdTokens": 4000 } } } ``` ## Connections - [[Compaction]] ← 上下文压缩 ← [[Context-Window]] - [[Memory-Flush]] ← 保护机制 ← [[Context-Window]] - [[Embedding Vector]] ← 限制 ← [[Context-Window]] - [[Generation]] ← 限制 ← [[Context-Window]] - [[Indexing]] ← 限制 ← [[Context-Window]]