feat: Role 四段式描述 (identity/prepare/execute/report) #361
Reference in New Issue
Block a user
Delete Branch "feat/359-role-four-phase"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
扩展 RoleDefinition,新增 identity/prepare/execute/report 四段式字段。
Why
Agent 需要区分准备阶段(加载 skill)、执行阶段和汇报阶段。不同 agent 适配同一个 workflow 时,需要结构化的 role 描述。(#359)
Changes
workflow-protocol/types.ts— RoleDefinition 新增 4 字段(string | null),systemPrompt 改为可选workflow-protocol/schemas.ts— ROLE_DEFINITION schema 更新,新字段均为 optionalcli-workflow/validate.ts— 放宽校验,接受新字段cli-workflow/commands/workflow.ts— materialize 时 strip null 字段cli-workflow/commands/thread.ts— read 时优先显示 identitycli-workflow/cli.ts— 加 --version 从 package.json 读取Ref
Refs #359, #360
设计方向 👍,但需要更彻底:
必须改
删掉
systemPrompt— 既然拆成四段式就不要保留旧字段,不需要向前兼容。涉及types.ts、schemas.ts、validate.ts、buildRolePromptfallback 逻辑、materializestrip 逻辑。四段式字段全部 required —
identity/prepare/execute/report不应该是 optional/nullable。Role 必须完整描述四个阶段。schemarequired数组加上这四个字段,类型改为string(不是string | null)。thread.ts— 去掉 systemPrompt fallback 后,建议直接用buildRolePrompt(roleDef)统一渲染,而不是只显示 identity。buildRolePrompt— 去掉 legacy 分支,简化为直接拼四段,不需要模式判断。现有 workflow YAML 迁移 — 确认所有现存 workflow 文件都改成四段式,不留 systemPrompt。
LGTM ✅ systemPrompt 零残留,四段式全 required,测试覆盖到位。