docs: add Workflow as Conversation design notes

This commit is contained in:
2026-04-17 04:24:17 +00:00
parent c61a8d1666
commit 59afcf6211
+25
View File
@@ -53,3 +53,28 @@ concurrently because the projection groups events by `workflowId`.
exactly once.
- **Event-sourced** — all state is derived from the store; replaying events
rebuilds context deterministically.
## Next: Workflow as Conversation (待实现)
### 核心洞察
每个 workflow run 天然就是一条消息链(conversation)。Events 就是 messages,按 topicId 过滤即可还原完整历史。
### 当前问题
- 每个 role 写结构化 event,projection 提取字段拼成 context
- 信息在每层损耗(coder output 截断 500 字符,reviewer 看不到完整日志)
- Reviewer 不知道 architect 说了什么
### 新模型
- Projection 极简:只输出 chainHead(最后一条消息)+ 当前状态 + 该哪个 role 干活
- Role executor 自己读完整 event chain,构建上下文
- 内容永远在 event chain 里,谁需要谁去读
### 三种 Role 执行方式
1. **直接 ReAct loop** — architect:读代码、分析、制定方案
2. **生成 prompt → Cursor** — coder:需要 IDE 能力
3. **MCP tool 暴露历史** — 让 Cursor 按需回溯讨论上下文,而不是被动接收截断摘要
### 优势
- 零信息损耗:没有截断、没有字段提取
- Cursor 可以主动查 architect 意图(MCP tool)
- Projection 极简,不搬运内容