Files
nexus/wiki/concepts/Context-Reset.md
2026-05-03 05:42:12 +08:00

42 lines
1.5 KiB
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: "Context Reset"
type: concept
tags:
- "agentic-ai"
- "context-window"
- "recovery"
sources:
- "Your-AI-Isn-t-Stupid---It-Just-Needs-a-Better-Harness--Lychee-Technology-Engineering-Blog"
last_updated: 2026-04-20
---
## Overview
Context Reset——当 [[Context-Anxiety]] 触发时Harness 将当前 Agent 状态保存至磁盘、终止实例、启动全新 Agent 的程序化操作,用于解决长周期任务超出单次 context window 的问题。
## Trigger Condition
```python
if (tokens_used / max_context) > 0.7: # 阈值需按模型调优
trigger_context_reset()
```
## Procedure
1. **Save state**: 完整项目状态写入持久存储(磁盘文件)
2. **Terminate**: 终止当前 LLM 实例
3. **Launch fresh**: 启动全新 Agent加载保存状态
4. **Orient**: 新 Agent 读取状态、定位自身、继续工作
## Why Not In-Place Summarization?
原地摘要summarize → keep in same context仍让模型在嘈杂、退化的上下文中操作。Context Reset 提供完全干净的上下文窗口——代价更高,但可靠性显著提升,适用于超长周期任务。
## Trade-off
- **In-place summarization**: 便宜,但 context 仍嘈杂
- **Context Reset**: 昂贵(需重新加载状态),但可靠性高
## Source
- [[Your-AI-Isn-t-Stupid---It-Just-Needs-a-Better-Harness--Lychee-Technology-Engineering-Blog]]
## See Also
- [[Context-Anxiety]] — 触发条件
- [[State-Externalization]] — 持久化状态文件格式
- [[7-Layer-Harness-Stack]] — 第 7 层 Constraints & Recovery 的核心机制