playbook/templates/prompts/coding/update-memory.template.md

80 lines
1.8 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.

# 回写记忆模板
<!--
用途:在任务完成、方向切换或发现新规律后更新 memory-bank
触发:完成一轮实现、形成新决策、当前焦点变化时
-->
## 什么时候需要回写
- 当前目标已经变化
- 最近改动会影响下一轮判断
- 发现新的系统模式或约束
- 做出了值得保留的决策
## 回写路径
### `memory-bank/active-context.md`
更新:
- 当前目标
- 最近变更
- touched files
- 下一步
### `memory-bank/progress.md`
更新:
- 先读取 `workflow-state`当前阶段、spec、plan、executor、constraints
- 再读取 `plan-status`:当前 Plan 的机器状态
- Current Focus
- Recent Changes
- Next Steps
- Open Risks
只更新上半部分的人类摘要,不修改状态块。
推荐写法:
- `Current Focus`:当前阶段结束后,项目现在最重要的工作
- `Recent Changes`:本轮实际完成的变更、写回的状态、关键验证结果
- `Next Steps`:下一轮最自然的 1-3 个动作
- `Open Risks`:仍未解决的阻塞、环境约束、待确认事项
禁止:
- 手工改写 `<!-- workflow-state:start/end -->`
- 手工改写 `<!-- plan-status:start/end -->`
- 把临时聊天内容、未验证猜测写进摘要
### `memory-bank/decisions.md`
仅在出现重要决策时记录 ADR
- 为什么这样做
- 备选方案是什么
- 影响范围是什么
### `memory-bank/system-patterns.md`
仅在发现稳定模式时更新:
- 模块边界
- 不变量
- 扩展路径
- 禁止破坏的约束
## 原则
- 只回写长期有价值的信息
- 临时聊天内容不要写进去
- 高变化信息放 `active-context`,稳定约束放 `system-patterns`
- `progress.md` 的状态块只由 `main_loop.py` 维护
- 摘要应与 `workflow-state` / `plan-status` 保持一致
---
**最后更新**{{DATE}}