Auto-sync: 2026-04-23 04:02
This commit is contained in:
82
wiki/concepts/交接协议.md
Normal file
82
wiki/concepts/交接协议.md
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
title: "交接协议(Handoff Protocol)"
|
||||
type: concept
|
||||
tags: [openclaw, memory, model-switch, agentic-ai]
|
||||
sources: [养龙虾5天血泪史]
|
||||
last_updated: 2026-04-23
|
||||
---
|
||||
|
||||
## Definition
|
||||
|
||||
交接协议是 AI Agent 在模型切换或会话结束时,将当前上下文状态写入每日日志的规程。解决 OpenClaw Agent 切换模型时丢失所有上下文的核心问题。
|
||||
|
||||
## The Problem
|
||||
|
||||
OpenClaw Agent 在切换模型时丢失所有上下文:
|
||||
- 新模型以新鲜上下文窗口开始
|
||||
- 只看到自动加载的文件
|
||||
- 当前会话状态、进行中的任务、待处理决定全部丢失
|
||||
|
||||
> "切换模型后,Agent 表现得像我们从未交谈过。我提到两天前的讨论决定,它一脸茫然。"
|
||||
|
||||
## Solution
|
||||
|
||||
在任何模型切换或会话结束前执行交接:
|
||||
|
||||
```markdown
|
||||
# Handoff Protocol
|
||||
|
||||
## Current Session State
|
||||
- Current task: [task description]
|
||||
- Progress: [X% complete]
|
||||
- Pending decisions: [list]
|
||||
- Next steps: [action items]
|
||||
|
||||
## What Worked
|
||||
- [insight 1]
|
||||
- [insight 2]
|
||||
|
||||
## What Didn't Work
|
||||
- [failed approach 1]
|
||||
- [failed approach 2]
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
### 在 AGENTS.md 顶部添加交接指令
|
||||
|
||||
```markdown
|
||||
# Handoff Protocol (必须执行)
|
||||
Before any model switch or session end:
|
||||
1. Write current task state to memory/YYYY-MM-DD.md
|
||||
2. Include: progress, pending decisions, next steps
|
||||
3. Note what worked and what didn't
|
||||
4. This is non-negotiable — DO NOT skip
|
||||
```
|
||||
|
||||
### 触发时机
|
||||
|
||||
- `/model` 命令切换模型
|
||||
- `/exit` 或 `/quit` 结束会话
|
||||
- 长时间无响应后的新会话
|
||||
- 主动要求交接时
|
||||
|
||||
## Key Insight
|
||||
|
||||
> "交接协议是模型切换的修复"
|
||||
|
||||
没有交接协议,新模型不知道发生了什么。有了交接协议,新模型从每日日志读取当前状态,无缝继续工作。
|
||||
|
||||
## 与上下文刷新的关系
|
||||
|
||||
- **上下文刷新**(Memory Flush):防止单次压缩周期内的信息丢失
|
||||
- **交接协议**:防止模型切换时的信息丢失
|
||||
|
||||
两者互补,共同确保长期会话的信息完整性。
|
||||
|
||||
## Connections
|
||||
- [[上下文压缩]] ← 交接协议解决压缩无法覆盖的多次压缩问题
|
||||
- [[上下文刷新]] ← 互补机制
|
||||
- [[写入纪律]] ← 交接协议是写入纪律的具体场景
|
||||
- [[自动加载文件]] ← 新模型只看到自动加载的文件,交接日志弥补缺失
|
||||
- [[养龙虾5天血泪史]] ← 主要来源
|
||||
Reference in New Issue
Block a user