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

1003 B
Raw Blame History

title, type, tags, last_updated
title type tags last_updated
上下文修剪 concept
ai-agent
memory
context
2026-04-02

Definition

通过 TTL生存时间和保留策略主动清理旧上下文的机制与内存刷新配合工作。

Configuration

{
  "contextPruning": {
    "mode": "cache-ttl",
    "ttl": "6h",
    "keepLastAssistants": 3
  }
}

Mechanism

  • 6 小时后积极修剪旧上下文
  • 保留最后 3 个 Assistants 响应
  • 结合内存刷新Agent 早期将重要内容写入磁盘,旧上下文在导致溢出前被清理

Key Insight

长会话是内存系统真正接受测试的地方。短对话很少触及压缩。是 2 小时的深度工作会话中你会丢失上下文且无法找出原因。在负载下测试你的内存系统,而不仅仅是在快速聊天中。