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

48 lines
1.7 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 Anxiety"
type: concept
tags:
- "agentic-ai"
- "context-window"
- "failure-mode"
sources:
- "Your-AI-Isn-t-Stupid---It-Just-Needs-a-Better-Harness--Lychee-Technology-Engineering-Blog"
last_updated: 2026-04-20
---
## Overview
Context Anxiety——当 LLM 的 context window 使用率超过约 70% 容量,或延迟升高时,模型表现出"仓促"行为的现象:跳过步骤、过早完成任务或过早宣告成功。
## Mechanism
- Context window 是模型的唯一记忆空间
- 当感知到"墙壁在逼近"token 限制),模型开始优先"快速完成"而非"正确完成"
- 这不是模型能力问题,而是 context 容量压力的系统性反应
## Detection
- 监控 `tokens_used / max_context > 0.7` 阈值(需按模型和工作负载调优)
- 延迟 spikes 也是触发信号
## Solution: Context Reset
当 Context Anxiety 触发时Harness 执行程序化 Context Reset
1. `save_state_to_disk(state)` — 完整项目状态写入持久存储
2. `terminate_current_instance()` — 终止当前 LLM 实例
3. `launch_fresh_agent(state)` — 启动全新 Agent从保存状态恢复
关键代码:
```python
if (tokens_used / max_context) > 0.7:
save_state_to_disk(state)
terminate_current_instance()
launch_fresh_agent(state)
```
## Note on In-Place Summarization
原地摘要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-Reset]] — 具体实现机制
- [[7-Layer-Harness-Stack]] — 第 5 层 Memory & State 和第 7 层 Constraints & Recovery 中处理此问题