Agent 可以策略性遗忘,从而永远工作下去
每轮静默执行。把旧的 tool_result 替换为短占位符,只保留最新一轮的完整结果。用户无感知,但持续节省 token。
silent, every turn, no LLM call
当 token 数超过阈值(如 50000)时触发。保存完整 transcript 到文件,用 LLM 生成摘要替换所有消息,保留关键决策和当前任务。
threshold: 50000 tokens
模型主动调用 compact 工具,附带自己的总结。适合完成大阶段性工作后主动清理上下文。模型知道什么重要、什么可以忘记。
model-triggered, with custom summary
"逐个读取 src/ 目录下的所有 Java 文件(触发对旧结果的微压缩)"
"Read every Java file in the src/ directory one by one (triggers micro-compact on older results)"
"持续读取文件,直到触发自动压缩"
"Keep reading files until compression triggers automatically"
"使用 compact 工具手动压缩对话"
"Use the compact tool to manually compress the conversation"