RFC: Role 四段式描述 + Agent Capability 适配层 #359

Closed
opened 2026-05-21 01:17:35 +00:00 by xiaoju · 0 comments
Owner

背景

当前 workflow role 只有一个 systemPrompt 字段,所有指令混在一坨。这导致:

  1. Agent 无法区分准备阶段(加载 skill/工具)和执行阶段
  2. 不同 agent(Hermes / Claude Code / 未来的其他 agent)无法按各自能力适配同一个 workflow
  3. Workflow 作者写 prompt 时缺乏结构指引

设计

Role 四段式描述

将 systemPrompt 拆分为四段,每段对应 agent 执行的一个阶段:

roles:
coder:
identity: 你是谁 — 角色人设,全程生效
prepare: Phase 1 — 开工前装备什么 skill/工具
execute: Phase 2 — 怎么干活,执行约束和边界
report: Phase 3 — 怎么汇报,配合 outputSchema

Agent 三阶段执行模型

Phase 1 Prepare: identity + prepare + skill 列表 → 加载 skill、准备工具
Phase 2 Execute: identity + execute + 上下文 → 用工具干活
Phase 3 Report: identity + report + outputSchema → 总结输出 frontmatter

向后兼容

systemPrompt 保留为 fallback。

关键原则

  • Workflow 是 agent-agnostic 的
  • prepare 是自然语言,agent 自己决定怎么响应
  • capability 是软约定,不做硬匹配

Phase 拆分

Phase 1: Protocol 类型定义

扩展 RoleDefinition,新增 identity/prepare/execute/report 字段(string | null)

Phase 2: Agent-Kit prompt 组装

修改 prompt 拼接逻辑,按阶段注入,fallback 到 systemPrompt

Phase 3: 示例 Workflow + 端到端验证

编写四段式示例 workflow,uwf-hermes 端到端跑通

完成标准

  • Phase 1 testing issue closed
  • Phase 2 testing issue closed
  • Phase 3 testing issue closed
  • 文档更新
## 背景 当前 workflow role 只有一个 systemPrompt 字段,所有指令混在一坨。这导致: 1. Agent 无法区分准备阶段(加载 skill/工具)和执行阶段 2. 不同 agent(Hermes / Claude Code / 未来的其他 agent)无法按各自能力适配同一个 workflow 3. Workflow 作者写 prompt 时缺乏结构指引 ## 设计 ### Role 四段式描述 将 systemPrompt 拆分为四段,每段对应 agent 执行的一个阶段: roles: coder: identity: 你是谁 — 角色人设,全程生效 prepare: Phase 1 — 开工前装备什么 skill/工具 execute: Phase 2 — 怎么干活,执行约束和边界 report: Phase 3 — 怎么汇报,配合 outputSchema ### Agent 三阶段执行模型 Phase 1 Prepare: identity + prepare + skill 列表 → 加载 skill、准备工具 Phase 2 Execute: identity + execute + 上下文 → 用工具干活 Phase 3 Report: identity + report + outputSchema → 总结输出 frontmatter ### 向后兼容 systemPrompt 保留为 fallback。 ### 关键原则 - Workflow 是 agent-agnostic 的 - prepare 是自然语言,agent 自己决定怎么响应 - capability 是软约定,不做硬匹配 ## Phase 拆分 ### Phase 1: Protocol 类型定义 扩展 RoleDefinition,新增 identity/prepare/execute/report 字段(string | null) ### Phase 2: Agent-Kit prompt 组装 修改 prompt 拼接逻辑,按阶段注入,fallback 到 systemPrompt ### Phase 3: 示例 Workflow + 端到端验证 编写四段式示例 workflow,uwf-hermes 端到端跑通 ## 完成标准 - [ ] Phase 1 testing issue closed - [ ] Phase 2 testing issue closed - [ ] Phase 3 testing issue closed - [ ] 文档更新
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#359