diff --git a/docs/design/v2.8-direction-notes.md b/docs/design/v2.8-direction-notes.md index 725fe63..d4ed2f6 100644 --- a/docs/design/v2.8-direction-notes.md +++ b/docs/design/v2.8-direction-notes.md @@ -75,7 +75,7 @@ Mail 是机械投递,不需要智能。当前 46 处 if/_mail 散落在三个 **当前 prompt 的问题**:把 Agent 限制在固定步骤(标 working → 干活 → 写产出 → 标 review)。 -**改 prompt 结构**:从"固定步骤指令"变成"身份 + 目标 + 能做什么 + 约束": +**改 prompt 结构**:从"固定步骤指令"变成"身份 + 目标 + 能做什么 + 约束 + 交接责任": ```markdown # 你的身份 @@ -102,10 +102,45 @@ Mail 是机械投递,不需要智能。当前 46 处 if/_mail 散落在三个 - 遇到阻塞标 blocked - 涉及数据删除/实盘交易 → 标 waiting_human 等人确认 - {guardrail_rules} + +# 交接责任 +完成后必须写交接文档(handoff comment),写入黑板: +- 你做了什么决策、为什么这么做 +- 遇到什么问题、怎么解决的 +- 给下一个 Agent 的建议和注意事项 +POST /api/projects/{pid}/tasks/{id}/comments {"comment_type": "handoff"} ``` **不告诉它具体步骤,只告诉它目标、工具、约束。Agent 自己决定怎么干。** +### v2.9 的一部分:Agent 间上下文传递(Handoff 设计) + +> 灵感来源:MattPocock Handoff Skill(`mattpocock-skills/skills/in-progress/handoff/`) + +**当前问题**:Agent 间上下文传递是 Daemon 中央摘要式——信息逐层丢失: + +| 环节 | 丢失什么 | +|------|---------| +| Daemon 提取 output.md 摘要 | Agent 的思考过程、设计权衡、遇到的问题 | +| 注入到下一个 Agent prompt | 只有 `depends_on_outputs` 的 summary,不是完整上下文 | +| 新 Agent 拿到的 | 冰冷摘要,不知道前因后果 | + +**Handoff 思路**:让产出 Agent 主动写交接文档,下一个 Agent 自主从黑板读取。 + +| | 当前(Daemon 提取) | Handoff 思路 | +|---|---|---| +| 谁决定传什么 | Daemon(机械摘要) | Agent 自己(知道什么重要) | +| 传什么 | output.md 的 summary | 上下文文档(决策、权衡、坑、建议) | +| 写到哪 | prompt 注入 | 黑板 comment(type=handoff) | +| 下一个 Agent 怎么拿 | 被动接收注入 | 主动读黑板 | + +**具体改动**: +1. **Prompt 约束新增**:完成任务后必须写 handoff comment(决策、问题、建议) +2. **BootstrapBuilder 增强**:`_format_depends_on()` 不只读 output 摘要,还读 `comment_type=handoff` +3. **API 无需改动**:当前 `POST /comments` 已支持 `comment_type` 字段 + +**对齐 PRD v3.0**:这就是 "B3 共享意识" 的具体实现路径——Agent 自己写交接 + 黑板作为共享空间。 + ### v2.9 的一部分:知识注入(复用 LLM Wiki) **不需要新建知识库。** LLM Wiki 已有 273 页 wiki-vault + 118 个 practices 页面,就是现成的 L3 知识层。