flow-comet 1.5.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flow-comet/rules/flow-comet-orchestration.md +1 -2
- package/.flow-comet/skills/flow-comet/GUIDANCE.md +22 -3
- package/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
- package/.flow-comet/skills/flow-comet/SKILL.md +40 -3
- package/.flow-comet/skills/flow-comet/reference/KNOWN-ISSUES-template.md +3 -3
- package/.flow-comet/skills/flow-comet/reference/TEST-MATRIX.md +18 -17
- package/.flow-comet/skills/flow-comet/reference/dsh-platform.md +27 -12
- package/.flow-comet/skills/flow-comet/reference/recovery.md +1 -7
- package/.flow-comet/skills/flow-comet/reference/worktree-notes.md +21 -3
- package/.flow-comet/skills/flow-comet/scripts/contract-check.mjs +41 -31
- package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +6687 -330
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +25 -5
- package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +1145 -15
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +72 -3
- package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +2077 -14
- package/.flow-comet/skills/flow-comet/scripts/task-parsing.mjs +13 -0
- package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +568 -501
- package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +331 -14
- package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +783 -40
- package/.flow-comet/skills/flow-comet-archive/SKILL.md +17 -0
- package/.flow-comet/skills/flow-comet-change/SKILL.md +2 -0
- package/.flow-comet/skills/flow-comet-design/SKILL.md +2 -0
- package/.flow-comet/skills/flow-comet-dev/SKILL.md +3 -1
- package/.flow-comet/skills/flow-comet-execute/SKILL.md +21 -1
- package/.flow-comet/skills/flow-comet-integration/SKILL.md +2 -0
- package/.flow-comet/skills/flow-comet-open/SKILL.md +2 -0
- package/.flow-comet/skills/flow-comet-plan/SKILL.md +17 -6
- package/.flow-comet/skills/flow-comet-requirement/SKILL.md +2 -0
- package/.flow-comet/skills/flow-comet-review/SKILL.md +23 -3
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +23 -11
- package/.flow-comet/skills/flow-comet-task/SKILL.md +7 -3
- package/.flow-comet/skills/flow-comet-test/SKILL.md +2 -0
- package/.flow-comet/skills/flow-comet-verify/SKILL.md +21 -4
- package/README.md +45 -115
- package/package.json +1 -1
- package/scripts/dsh-bridge.mjs +2 -2
- package/scripts/prepare-env.mjs +77 -46
|
@@ -15,6 +15,8 @@ This node finalizes a completed change by extracting reusable lessons from the d
|
|
|
15
15
|
|
|
16
16
|
## Guidance
|
|
17
17
|
|
|
18
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
19
|
+
|
|
18
20
|
### Prerequisites
|
|
19
21
|
|
|
20
22
|
- `.specs/<change-id>/UAT.md` must exist with all items passed (from verify node).
|
|
@@ -69,6 +71,21 @@ This node finalizes a completed change by extracting reusable lessons from the d
|
|
|
69
71
|
|
|
70
72
|
11. **Exit check**: Run exit check.
|
|
71
73
|
|
|
74
|
+
### 归档后发现缺陷(受控重入)
|
|
75
|
+
|
|
76
|
+
归档已 entry 但归档移动尚未发生(`.specs/<change-id>/` 仍在原位、`status !== 'completed'`)时,review / verify / 执行阶段发现的新缺陷按下列边界处置:
|
|
77
|
+
|
|
78
|
+
- **未移动** → 受控重入:由用户显式授权后运行
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
node .claude/skills/flow-comet/scripts/workflow-state.mjs reenter <target> --authorized-by <source> --reason <text> [--continue-round <n>]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
目标限 `execute` / `subagent-execute` / `review` / `verify` 之一;每次调用都需要用户显式授权,每 change 上限 3 轮(达上限后凭显式续轮授权 `--continue-round <n>`(n ≥ 已用轮次 + 1)可继续并计入下一轮);命令先自动落 state 备份快照(`.specs/<change-id>/.reentry-backups/`),再转移工作归属,并打印 `REENTRY: archive → <target>(授权源 <source>;第 n/3 轮;备份 <file>)` 与 `REASON: <text>` 行(续轮审计行为 `第 n 轮(显式授权续轮,上限 3)`)。缺授权、目标越界、超上限或归档移动已发生一律 BLOCKED(state 字节零改写),不会静默跳过。
|
|
85
|
+
- **已移动 / 已合并** → 人工处置或新 change:归档移动已发生(`.specs/archive/<日期>-<change-id>/`)或 change 已 `completed` / 已合并时,受控重入不适用(不承诺把文件搬回原位);走人工处置,或把修复放进新 change / hotfix,并在遗留清单里登记指针。
|
|
86
|
+
|
|
87
|
+
**写权限顺序(先转移后写 TASK)**:archive 阶段 hook 对 change 目录只放行 `KNOWN-ISSUES.md` 这一个精确文件(另有 `.specs/archive/`、`.specs/CHANGELOG.md`、`.specs/LESSONS.md`、`STATE.md`),TASK.md 的修复任务写入不在放行面内。顺序固定为:先跑 `reenter` 完成转移(写入权限随即跟随目标节点),再在目标节点权限内追加 Fix 任务 / 修改工件——不要试图在 archive 阶段先写 TASK.md。若重入成功后追加任务失败,用 `next` / `status` 核对归属;重复调用同一目标为空操作(不备份、不计数、不改写 state)。
|
|
88
|
+
|
|
72
89
|
### 归档提交(R4.1 交付闭环)
|
|
73
90
|
|
|
74
91
|
1. 用显式路径 stage:只 stage 本 change 可归属路径(原活动路径、实际归档路径、改过的主 spec)
|
|
@@ -7,6 +7,8 @@ description: "flow-kit CHANGE 阶段协议:反问澄清、change-id 自动生
|
|
|
7
7
|
|
|
8
8
|
本 Skill 为 flow-comet 的 open 节点提供 flow-kit 的 CHANGE 反问协议。
|
|
9
9
|
|
|
10
|
+
> **模板权威**:本技能产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
11
|
+
|
|
10
12
|
## 加载
|
|
11
13
|
|
|
12
14
|
读取 `flow-kit/prompts/0-change.md` 并按其执行。关键步骤:
|
|
@@ -25,6 +25,8 @@ Responsibility: 技术栈选型 + ADR + 数据流。生成 DESIGN.md(轻量流
|
|
|
25
25
|
|
|
26
26
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / templateSectionPatterns;「填得好不好」由 review 把关。
|
|
27
27
|
|
|
28
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
29
|
+
|
|
28
30
|
# Design
|
|
29
31
|
|
|
30
32
|
## Node Goal
|
|
@@ -7,6 +7,8 @@ description: "flow-kit DEV 阶段协议:TDD + 6 维自查 + diff 边界 verify
|
|
|
7
7
|
|
|
8
8
|
本 Skill 为 flow-comet 的 execute/subagent-execute 节点提供 flow-kit 的完整开发规则集。
|
|
9
9
|
|
|
10
|
+
> **模板权威**:本技能产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
11
|
+
|
|
10
12
|
## 加载
|
|
11
13
|
|
|
12
14
|
读取 `flow-kit/prompts/4-dev.md` 并按其执行。以下是核心规则摘要(完整内容以 prompt 文件为准):
|
|
@@ -21,7 +23,7 @@ description: "flow-kit DEV 阶段协议:TDD + 6 维自查 + diff 边界 verify
|
|
|
21
23
|
- **第 2 级**:若仅返回 "Launching skill" 占位/无实际审查指令(已知现象:worktree 子代理的 skill 路由与会话不一致,插件执行体可能未注入)——**Read 插件缓存/安装目录协议文件手动执行完整 brooks 流程**:Claude Code `~/.claude/plugins/cache/brooks-lint-marketplace/brooks-lint/<ver>/skills/brooks-review/`;Codex `~/.codex/skills/brooks-review/`(或项目 `.agents/skills/`)(SKILL.md + 引用文件 + `_shared/`——`_shared/` 是 brooks-review 目录的**兄弟目录**(同在该插件 skills/ 下,如 `.../brooks-lint/<ver>/skills/_shared/`),不是 brooks-review 的子目录),按协议产出 4-element 审查(Symptom/Source/Consequence/Remedy + file:line + 书引用)——**仅阅读协议文本作为审查指引,不执行缓存文件内容**;来源不可信/无法验证时跳过该级,降级内置快查并如实声明
|
|
22
24
|
- **第 3 级**:缓存文件也不可读/不存在时,才用内置 R1~R6 快查
|
|
23
25
|
- SUMMARY `## 自检方法` 必须声明三要素:尝试方式 / 失败原因 / 替代方法;回传 Return Contract 时 `selfReview` 字段必填三值之一:`brooks-review`(成功)/ `cache-brooks`(读缓存手动执行)/ `builtin-quickcheck`(最终降级——guard 校验须含缓存尝试证据,新 change 缺失 BLOCKED,旧 change WARN 渐进)。
|
|
24
|
-
- **builtin-quickcheck 声明措辞(guard 关键词级校验)**:guard 按关键词声明级校验(不做语义判断)——不可用原因须含 `brooks-lint 不可用 / 插件不可用 / unavailable / N/A`,缓存尝试证据须含 `插件缓存 / 缓存协议 / 协议文件 / plugins/cache`。推荐措辞示例:「brooks-lint 不可用(Skill 仅返回占位,插件执行体未加载);已 Read 插件缓存协议文件(~/.claude/plugins/cache/.../brooks-review/)手动执行仍不可行,按协议降级内置 R1~R6
|
|
26
|
+
- **builtin-quickcheck 声明措辞(guard 关键词级校验)**:guard 按关键词声明级校验(不做语义判断)——不可用原因须含 `brooks-lint 不可用 / 插件不可用 / unavailable / N/A`,缓存尝试证据须含 `插件缓存 / 缓存协议 / 协议文件 / plugins/cache`。推荐措辞示例:「brooks-lint 不可用(Skill 仅返回占位,插件执行体未加载);已 Read 插件缓存协议文件(~/.claude/plugins/cache/.../brooks-review/)手动执行仍不可行,按协议降级内置 R1~R6 快查」——语义完整但缺关键词的写法会被拦截(完整流程实测实证)。
|
|
25
27
|
- **`## 6 维自查` 段内也须出现自检方法名**(`brooks-review` / `cache-brooks` 字样,如「- 功能: 通过(brooks-review 已跑)」)——guard 校验 6 维自查段是否声明了自检方法(新 change 缺失 BLOCKED,旧 change WARN 渐进)。
|
|
26
28
|
- **纯测试/纯文档任务**(无生产代码改动,6 维自查非必跑)仍须满足自检方法声明与 builtin 缓存证据——可**引用同 change 其他 SUMMARY 已声明的缓存尝试**(如「自检证据见 T01-SUMMARY(cache-brooks 已读插件缓存)」)满足 guard 校验。
|
|
27
29
|
5. **diff 边界 verify(R6.5)**:`git diff --name-only` 与 TASK write_files 比对,越界必须回滚
|
|
@@ -25,6 +25,8 @@ In subagent mode (default) this node is a coordinator: it does not write impleme
|
|
|
25
25
|
|
|
26
26
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好不好」由 review 把关。
|
|
27
27
|
|
|
28
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
29
|
+
|
|
28
30
|
### 执行模型(按 executionMode,用户显式选择)
|
|
29
31
|
|
|
30
32
|
- **subagent(默认)**: 统一委托子代理——协调者流程(构造 handoff → Agent worktree 委托 → 收集 Return Contract → 验收标 done)
|
|
@@ -38,7 +40,9 @@ guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好
|
|
|
38
40
|
|
|
39
41
|
execute 节点**只处理 `parallel="false"`(或未标注 parallel)的 pending 任务**。
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
**归属纪律**:request 会校验任务的并行属性与原始 `currentNode`——串行 pending 任务只归属本节点,并行 pending 任务归属 `subagent-execute`;错误节点的新 change 请求会被 BLOCK,并按输出运行 `workflow-state next` 与 `entry <目标节点>` 恢复后再重试。
|
|
44
|
+
|
|
45
|
+
**TASK 签名校验(C3,execute 期间)**:entry execute 时记录任务集签名(行尾规范化 + 标记属性剥离);exit 时比对——execute 期间 TASK.md **只允许改开标签的标记属性**(`status` done/pending;时间戳如需记录写在开标签属性如 `completed_at`——签名剥离白名单允许;**禁止写入 action/其他 task 内容**),增删任务/改 action/改边界/改其他内容会在 exit 被 BLOCKED(签名不匹配)。回退修复任务(review/verify 发现缺陷追加)须先经 review 流程追加到 `## Fix 任务` 段,再按下方「修复回路状态机路径」受控归位 execute,并由 entry execute 刷新签名(端到端验证实证:直接注入任务会被签名拦截)。
|
|
42
46
|
|
|
43
47
|
本节点**不直接写实现代码**。所有 pending 任务统一通过 Agent 工具委托 fresh-context 子代理执行(加载 flow-comet-dev + 回传 Return Contract)。
|
|
44
48
|
|
|
@@ -77,6 +81,7 @@ execute 节点**只处理 `parallel="false"`(或未标注 parallel)的 pendi
|
|
|
77
81
|
> - 正确:`"completedChecks": ["required-skill:subagent-execute.flow-comet-dev"]`
|
|
78
82
|
> - 错误:`"completedChecks": ["required-skill:execute.flow-comet-dev"]` —— 按 execute 域命名会被 W1-D 拦截(exit BLOCKED),子代理必须回传统一契约值
|
|
79
83
|
> - 错误:`"completedChecks": [{"id": "required-skill:subagent-execute.flow-comet-dev", "status": "done"}]` —— 对象数组会被严格比较判"缺"(必须为字符串数组)
|
|
84
|
+
> **Return Contract 的 skillToolFallback 声明**:子代理会话不具备 Skill 工具时,必须并排回传 `skillToolFallback` 声明降级替代形态(如 `file-read`)——该字段是**声明、不是物理证明**(回执只能记录声明,读 SKILL.md 与真实 Skill 注入在机器可读证据上不可区分);只有 `required-skill` 标记而无降级声明视为不实声明,orchestrator 不得记录 result;具备 Skill 工具时不得回传该字段。
|
|
80
85
|
|
|
81
86
|
The full dev protocol, templates, and constraints are in:
|
|
82
87
|
- `flow-kit/prompts/4-dev.md` (DEV phase) — handoff prompt 的子代理强制协议(不再以“参照前一产物”转述——子代理必须显式按此协议执行并加载 flow-comet-dev)
|
|
@@ -100,6 +105,21 @@ This node is truly done when:
|
|
|
100
105
|
- **Agent thought**: "This task is taking long, let me skip the self-review." **Actual risk**: Skipping self-review defers quality issues to the review node, where they become Critical items requiring fix tasks. Better to catch early.
|
|
101
106
|
- **Agent thought**: "这个 parallel 任务小,我顺手在主会话做了。" **Actual risk**: 违反并行委托设计——subagent-execute 节点被静默跳过,丢失并行隔离与 write_files 冲突防护;且 execute 出口的 all-tasks-done 校验会 BLOCKED(parallel 无 handoffResult)。parallel="true" 任务只能由 subagent-execute 委托。
|
|
102
107
|
|
|
108
|
+
## 修复回路状态机路径
|
|
109
|
+
|
|
110
|
+
review / verify 发现缺陷后的修复必须回到 `execute` 节点生命周期内完成,禁止驻留源节点「顺手修完」;引擎按以下路径强制闭环(`<源节点>` 为 review 或 verify):
|
|
111
|
+
|
|
112
|
+
1. **追加 Fix 任务**:在 `.specs/<change-id>/TASK.md` 的 `## Fix 任务` 段内追加编号修复任务(完整任务字段),**禁止文件尾追加**;任务集修订必须在 `entry` 之前完成。
|
|
113
|
+
2. **受控归位 execute**:运行 `workflow-state next`(完整命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs next`),或运行 `workflow-guard entry execute`(完整命令:`node .claude/skills/flow-comet/scripts/workflow-guard.mjs entry execute`)。处于 Fix 回退态(源节点驻留 + 存在 pending Fix 任务 + 当前路由判定为 execute)时,引擎把当前节点受控归位为 `execute`(`currentNode=execute`),并输出 `FIX-BATCH` 审计行(`next` 同时输出 `NODE: execute`);用 `workflow-state.mjs status` 确认 `stateCurrentNode` 已是 `execute` 再开工;若未归位,先按 `next` / `status` 的输出核对任务状态与路由,不要未经归位硬开工。
|
|
114
|
+
3. **执行修复**:按 execute 节点生命周期完成全部 Fix 任务(委托/直写规则不变);`entry execute` 刷新任务集签名,锁定追加后的任务集——归位后不得再增删任务或修改任务内容。
|
|
115
|
+
4. **跑 execute 四类出口**:`record execute` → `exit execute --apply`。四类出口门禁真实执行——**全任务 done / 逐任务 SUMMARY 完备 / 6 维自查 + 自检方法声明 / 任务集签名一致**;任一缺失即 BLOCKED 并给出恢复指引。通过后,引擎在 Fix 二次完成时把当前节点推回源节点(review 或 verify)。
|
|
116
|
+
- **guard exit 回源审计行语义(Fix vs RETURN)**:真实修复回路二次完成保留 `FIX-BATCH: 回源节点 <源节点>`(真实 Fix 回炉的机器锚);正常多趟收尾(任务集签名全等且无 Fix 标记)输出中性 `RETURN: 回源节点 <源节点>`(非 Fix 回修);旧 state 缺闭合/修复证据(无签名事件且无 Fix 标记)输出 `RETURN: 回源节点 <源节点>(旧 state 缺闭合/修复证据,未分类)`,不冒充 Fix、不 BLOCK;上述分类只改审计行文本,路由与 state 写入零变化。此处 `RETURN:` 仅指审计行前缀,与子代理 handoff 的 Return Contract 无关。
|
|
117
|
+
5. **回源节点跑出口**:回到源节点后运行 `next`,Fix 回程豁免生效时应输出 `NODE: review` 或 `NODE: verify`(不会因源节点产物已存在而跳过);若仍输出后续节点,说明回程条件未满足,先核对状态机归属与任务状态,不要继续推进。随后执行 `entry <源节点>` → `exit <源节点> --apply` 跑源节点出口门禁(即 entry/exit 源节点);通过后继续正常路由(review → verify;verify → archive),必要时进入下一轮 Fix 闭环。
|
|
118
|
+
- **`next` 回程审计行语义**:回程豁免行始终输出中性 `RETURN: 回程源节点 <源节点>`(源节点产物在场且未出口;保留源节点跑出口),不再输出 FIX-BATCH;受控归位行的 `FIX-BATCH: 归位 <execute 家族>` 保留(真实 Fix 回退行),两者不得混同。
|
|
119
|
+
6. **禁止绕过**:驻留源节点不归位、顺手改完后直接跑源节点 exit 收场会被 BLOCKED(存在未归位/未跑出口的修复回路),必须按上述路径恢复;不得用跳过归位或出口门禁的手段(含手动改写 `.flow-comet/flow-comet-state.json`)替代本路径。
|
|
120
|
+
|
|
121
|
+
**由受控重入打开的场景(archive 源)**:缺陷在归档后才暴露、且归档移动尚未发生时,可先由用户显式授权把工作归属退回 `execute` / `subagent-execute` / `review` / `verify` 之一,再按本节路径回到 execute 生命周期完成修复。重入命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs reenter <target> --authorized-by <source> --reason <text> [--continue-round <n>]`——每次调用都需要用户显式授权,每 change 上限 3 轮(达上限后凭显式续轮授权 `--continue-round <n>`(n ≥ 已用轮次 + 1)可继续并计入下一轮);重入前自动落 state 备份快照(`.specs/<change-id>/.reentry-backups/`);成功打印 `REENTRY: archive → <target>(授权源 <source>;第 n/3 轮;备份 <file>)` 与 `REASON: <text>` 行(续轮审计行为 `第 n 轮(显式授权续轮,上限 3)`),与 Fix 回炉的 `FIX-BATCH` 行、正常多趟收尾的 `RETURN` 行三态可区分。归档移动已发生或 change 已 `completed` 时重入 BLOCKED,须走人工处置或新 change,不得静默跳过。重入只改工作归属,不写任何闭合标记,也不跳过目标节点入口 / 出口与源节点出口门禁;重复调用同一目标为空操作(输出 `REENTRY: 空操作——…`,不备份、不计数、不改写 state)。
|
|
122
|
+
|
|
103
123
|
## Entry Check
|
|
104
124
|
|
|
105
125
|
```bash
|
|
@@ -7,6 +7,8 @@ description: "flow-kit INTEGRATION 阶段协议:集成验证 + UAT + 失败诊
|
|
|
7
7
|
|
|
8
8
|
本 Skill 为 flow-comet 的 verify 和 archive 节点提供 flow-kit 的集成验证和归档流程。
|
|
9
9
|
|
|
10
|
+
> **模板权威**:本技能产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
11
|
+
|
|
10
12
|
## 加载
|
|
11
13
|
|
|
12
14
|
读取 `flow-kit/prompts/7-integration.md` 并按其执行。
|
|
@@ -24,6 +24,8 @@ Responsibility: CHANGE 反问 + REQUIREMENT 需求分析。生成 CHANGE.md 和
|
|
|
24
24
|
|
|
25
25
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / templateSectionPatterns;「填得好不好」由 review 把关。
|
|
26
26
|
|
|
27
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
28
|
+
|
|
27
29
|
# Open
|
|
28
30
|
|
|
29
31
|
## Node Goal
|
|
@@ -23,6 +23,8 @@ Responsibility: 拆原子任务(XML 格式)+ 波次划分。生成 TASK.md
|
|
|
23
23
|
|
|
24
24
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好不好」由 review 把关。
|
|
25
25
|
|
|
26
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
27
|
+
|
|
26
28
|
波次散文一致性:`## 波次划分` 中标记为并行([P])的任务必须与 XML 任务 `parallel="true"` 一致——新 change 不一致 BLOCKED(旧 change WARN 渐进)。
|
|
27
29
|
|
|
28
30
|
### 波次形态约束(依赖驱动多趟 · 规划期必守)
|
|
@@ -35,6 +37,14 @@ guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好
|
|
|
35
37
|
|
|
36
38
|
**理由**:引擎委托节点为多趟访问设计——按依赖分趟循环消化,序列形态自由度交给依赖声明表达。flow-kit 上游模板未载此约束,以本条为准。
|
|
37
39
|
|
|
40
|
+
### 规划期任务边界与 [P] 语义
|
|
41
|
+
|
|
42
|
+
- **① 同一文件 ⇒ 同一任务**:一个文件只能有一个任务 owner;必须拆分时,在波次划分中显式排序并写明拆分理由与依赖方向,不得把同一文件的两处改动拆成无依赖的两个任务。
|
|
43
|
+
- **② [P] 只给本波确有并发同伴的任务**:`parallel="true"` 仅适用于同波确有其他可并行同伴、且 write_files 互不重叠的任务;孤立任务一律串行——「互不冲突」只是必要条件,不等于应标 `[P]`。
|
|
44
|
+
- **③ [P] × direct 模式**:`[P]` 任务只在 `subagent-execute` 节点委托消化;direct 模式只放行**串行任务**的主代理直写,`parallel="true"` 任务在 direct 下仍必须委托——direct 不是并行任务的逃生口。共享工作区下以 `write_files` 互斥 + 提交时点(提交前 diff 边界)作为并行子代理的相互隔离纪律。
|
|
45
|
+
|
|
46
|
+
**上游语义显式覆盖**:flow-kit 上游(`flow-kit/prompts/3-task.md` 等 vendored 只读文件)的宽松语义——「无冲突即可标 [P]」「同层即同波并行」——以本节为准(显式覆盖;上游只读,不做修改)。
|
|
47
|
+
|
|
38
48
|
# Plan
|
|
39
49
|
|
|
40
50
|
## Node Goal
|
|
@@ -57,9 +67,9 @@ This node decomposes the technical design into atomic, executable tasks with cle
|
|
|
57
67
|
|
|
58
68
|
2. **Read DESIGN.md sections 0 and 0.5**: Understand the tech stack (for verify commands) and the architecture alignment (for file boundaries — touched modules, reuse targets, forbidden list).
|
|
59
69
|
|
|
60
|
-
3. **Decompose by file conflict (vertical slices)**: Split tasks by file conflict, NOT by horizontal layers. Each task should be a vertical slice (one feature through model/API/UI) not a horizontal layer (all models first, then all APIs). Target: 2-10 minutes per task in fresh context.
|
|
70
|
+
3. **Decompose by file conflict (vertical slices)**: Split tasks by file conflict, NOT by horizontal layers. Each task should be a vertical slice (one feature through model/API/UI) not a horizontal layer (all models first, then all APIs). Target: 2-10 minutes per task in fresh context. Do not split one file across tasks; if unavoidable, declare explicit order and reason.
|
|
61
71
|
|
|
62
|
-
4. **Mark parallel tasks with [P]**:
|
|
72
|
+
4. **Mark parallel tasks with [P]**: only tasks with a genuine concurrent companion in the same wave and non-overlapping write_files get `parallel="true"`; isolated tasks are serial; under direct mode `[P]` tasks are still delegated at subagent-execute.
|
|
63
73
|
|
|
64
74
|
5. **Declare depends_on**: Each task explicitly declares which tasks it depends on.
|
|
65
75
|
|
|
@@ -73,9 +83,10 @@ This node decomposes the technical design into atomic, executable tasks with cle
|
|
|
73
83
|
- `done`: One sentence completion criteria, corresponding to an AC sub-item.
|
|
74
84
|
|
|
75
85
|
7. **Wave division**: Group tasks by dependency graph:
|
|
76
|
-
- Same layer = same wave (parallel execution).
|
|
77
86
|
- Cross layer = sequential execution.
|
|
78
|
-
-
|
|
87
|
+
- Same-layer tasks may carry `parallel="true"` only when the wave genuinely contains a concurrent companion and their `write_files` do not overlap; an isolated task stays serial.
|
|
88
|
+
- Flow-comet override: the permissive flow-kit upstream semantics — "no conflict ⇒ [P]" and "same layer = same wave, parallel" — are superseded by this node's rule; the vendored upstream files stay read-only and are not modified.
|
|
89
|
+
- Output wave diagram: `Wave 1: T01[P], T02[P]` etc.; isolated tasks appear as serial steps.
|
|
79
90
|
|
|
80
91
|
8. **LESSONS scan**: Grep `.specs/LESSONS.md` for keywords related to planned file paths or actions. If active lessons hit, declare difference or confirm still applies.
|
|
81
92
|
|
|
@@ -89,7 +100,7 @@ This node is truly done when:
|
|
|
89
100
|
- At least one `<task>` block exists; every task carries a `<verify>` field (the full seven-field shape — id/name/read_files/write_files/action/verify/done — is the execution discipline, review-checked; guard enforces the subset).
|
|
90
101
|
- Every `verify` field is an executable command (not a description).
|
|
91
102
|
- Every `write_files` is strictly within DESIGN.md touched + new modules range (not in forbidden list).
|
|
92
|
-
-
|
|
103
|
+
- Every `[P]` mark has a genuine concurrent companion in its wave with non-overlapping `write_files`; isolated tasks are serial (a fully serial plan is valid when no genuine companion exists).
|
|
93
104
|
- Wave division diagram is clear and has no circular dependencies.
|
|
94
105
|
- Task numbering is continuous.
|
|
95
106
|
|
|
@@ -98,7 +109,7 @@ This node is truly done when:
|
|
|
98
109
|
- **Agent thought**: "Split by layer first — models, then services, then endpoints." **Actual risk**: Horizontal layering creates artificial dependencies and blocks parallel execution. Always slice vertically by file conflict.
|
|
99
110
|
- **Agent thought**: "verify: tests should pass" is good enough. **Actual risk**: Vague verify commands cannot be executed. Must be specific: `pytest tests/test_x.py -v` not "tests should pass".
|
|
100
111
|
- **Agent thought**: "write_files can include any file the task might touch." **Actual risk**: Including DESIGN forbidden list modules in write_files bypasses R7.3 + R6.5 boundary enforcement. Strict control is mandatory.
|
|
101
|
-
- **Agent thought**: "
|
|
112
|
+
- **Agent thought**: "Same layer means these tasks can all be marked [P]." **Actual risk**: A same-layer task with no concurrent companion, or with overlapping `write_files`, would be delegated as parallel in violation of this node's rule. Mark `[P]` by companion and write boundaries, never by layer alone.
|
|
102
113
|
- **Agent thought**: "read_files and write_files are the same thing." **Actual risk**: read_files includes reuse targets and reference modules; write_files is strictly the modification boundary. They serve different purposes (B3 old-project guardrail).
|
|
103
114
|
|
|
104
115
|
## Entry Check
|
|
@@ -7,6 +7,8 @@ description: "flow-kit REQUIREMENT 阶段协议:AC(Given/When/Then)+ v1·v
|
|
|
7
7
|
|
|
8
8
|
本 Skill 为 flow-comet 的 open 节点提供 flow-kit 的 REQUIREMENT 需求分析。
|
|
9
9
|
|
|
10
|
+
> **模板权威**:本技能产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
11
|
+
|
|
10
12
|
## 加载
|
|
11
13
|
|
|
12
14
|
读取 `flow-kit/prompts/1-requirement.md` 并按其执行。关键步骤:
|
|
@@ -19,14 +19,17 @@ This node performs a structured multi-round review of the implemented change, ch
|
|
|
19
19
|
|
|
20
20
|
| 文件 | guard 强制段(缺失 = BLOCKED) | 其余模板段(模板要求,guard 不拦) |
|
|
21
21
|
|------|-------------------------------|-----------------------------------|
|
|
22
|
-
| REVIEW.md | 文件 ≥ 100 字节;发现区条目处置标记(`[已修]` / `[升级]` / `[转待办]`——新 change 缺失 BLOCKED,旧 change WARN
|
|
22
|
+
| REVIEW.md | 文件 ≥ 100 字节;发现区条目处置标记(`[已修]` / `[升级]` / `[转待办]`——新 change 缺失 BLOCKED,旧 change WARN 渐进);**Major `[转待办]` 须有用户裁决记录**(同段、文末或单独段落「用户裁决:接受延期」+ 指向该条目 + `[升级]` 承接——单独段落与条目以空行分隔、位置不限)——缺失新 change BLOCKED / 旧 change WARN 渐进 | `## Critical` / `## 发现` / `## 结论` 等段(结构要求,guard 不拦段名) |
|
|
23
23
|
|
|
24
24
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好不好」由 review 把关。
|
|
25
25
|
|
|
26
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
27
|
+
|
|
26
28
|
### 必查清单(review 逐项核对 · 执行者交付纪律)
|
|
27
29
|
|
|
28
30
|
- [ ] **工件模板保真**:每份交付工件(`*-SUMMARY.md` / TASK / CHANGE / REQUIREMENT / DESIGN)的**标题 / 首部字段 / 段序**与对应模板一致——SUMMARY 按 `flow-kit/templates/SUMMARY.md` 填写并含 `## 自检方法` 段;执行者按 `flow-kit/prompts/4-dev.md` 协议交付。
|
|
29
31
|
- [ ] **Skill 工具触发可见**:检查执行者交付的 transcript,**逐节点可见本节点 skill 用 Skill 工具加载**的触发记录——声明标记在 ≠ 已加载;只看到 `skill-load` 声明命令、看不到 Skill 工具触发 → 反馈并要求补证/重做。
|
|
32
|
+
- [ ] **Skill 工具不可用降级核验**:执行者会话具备 Skill 工具时,须见 Skill 工具加载节点 SKILL 的触发记录;不具备时(委托会话工具集无 Skill 工具),须按 Read 加载节点 SKILL + 协议,并在 Return Contract(`skillToolFallback: "<降级替代形态,如 file-read>"`)与 SUMMARY「自检方法」段显式声明——**Read 不得被声称为已注入(即未执行 Skill 工具注入,字段值必须写替代形态而非本说明)**。只回传 required-skill 标记而无降级声明 → 证据不完整,要求补声明;声明齐全的环境限制不判为代码缺陷。
|
|
30
33
|
|
|
31
34
|
### Prerequisites
|
|
32
35
|
|
|
@@ -90,12 +93,13 @@ guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好
|
|
|
90
93
|
- Major (should fix: design issues, significant regression)
|
|
91
94
|
- Minor (optional: naming, style, small refactor)
|
|
92
95
|
|
|
93
|
-
8. **Generate fix tasks**: For all Critical and decided-to-fix Major findings, append to `.specs/<change-id>/TASK.md` as numbered fix tasks with full 7 fields — 追加到 TASK.md 的 `## Fix 任务` 段内(**禁止文件尾追加**), then
|
|
96
|
+
8. **Generate fix tasks**: For all Critical and decided-to-fix Major findings, append to `.specs/<change-id>/TASK.md` as numbered fix tasks with full 7 fields — 追加到 TASK.md 的 `## Fix 任务` 段内(**禁止文件尾追加**), then follow the「修复回路状态机路径」section below: home back to execute and run its four exit gates before review can be closed.
|
|
94
97
|
|
|
95
98
|
9. **Disposition markers (problem-handling principle)**: Every finding entry in the `## 发现` section of REVIEW.md — including Minor — must carry a **disposition marker** so findings never silently disappear after being recorded:
|
|
96
99
|
- `[已修]` — fixed via a fix task (linked in the entry)
|
|
97
100
|
- `[升级]` — escalated to the user for a decision (accept + reason recorded)
|
|
98
101
|
- `[转待办]` — deferred to `.specs/<change-id>/KNOWN-ISSUES.md` at archive time
|
|
102
|
+
- **Major 不得由 reviewer 自行 `[转待办]`**:Major 的延期属用户决策点,reviewer 须先标 `[升级]` 等用户裁决;用户接受延期后,在同段、文末或单独段落记录「用户裁决:接受延期」并指向该条目(由 `[升级]` 承接),方可标 `[转待办]`——单独段落与发现条目以空行分隔、可位于发现区中间,位置不限(guard 按独立段落匹配,不要求位于文末)。review exit 结构校验:Major 条目标 `[转待办]` 而缺上述记录 → 新 change BLOCKED / 旧 change WARN 渐进;Minor `[转待办]` 不受影响,`[升级]` / `[已修]` 的 Major 直接放行。
|
|
99
103
|
The exit guard structurally checks these markers on the findings area: a missing marker **blocks** the exit for a new change, and is a non-blocking warning for a legacy change (to avoid deadlocking legacy reviews). Add markers to clear it.
|
|
100
104
|
|
|
101
105
|
The full review protocol, templates, and checklists are in:
|
|
@@ -120,6 +124,22 @@ This node is truly done when:
|
|
|
120
124
|
- **Agent thought**: "Round 3 (UI) is optional." **Actual risk**: For frontend projects with UI changes, Round 3 is mandatory. Only non-frontend projects skip it.
|
|
121
125
|
- **Agent thought**: "6-dimension review is just a checklist." **Actual risk**: Without file:line references and book citations (when using built-in path), the review lacks rigor and fixability.
|
|
122
126
|
- **Agent thought**: "I'll record this Minor and move on." **Actual risk**: Findings (especially Minor) that are recorded without a disposition marker silently disappear — the exit guard warns on missing markers; every finding must be `[已修]`, `[升级]` (user decision), or `[转待办]` (tracked for archive).
|
|
127
|
+
- **Agent thought**: "This Major is not for this batch, I'll defer it to backlog myself." **Actual risk**: Major 延期属用户决策点——reviewer 自行 `[转待办]` 会被退出守卫拦截(新 change BLOCKED / 旧 change WARN);须先 `[升级]` 等用户裁决,用户接受延期后才可记录裁决并转待办。
|
|
128
|
+
|
|
129
|
+
## 修复回路状态机路径
|
|
130
|
+
|
|
131
|
+
review / verify 发现缺陷后的修复必须回到 `execute` 节点生命周期内完成,禁止驻留源节点「顺手修完」;引擎按以下路径强制闭环(`<源节点>` 为 review 或 verify):
|
|
132
|
+
|
|
133
|
+
1. **追加 Fix 任务**:在 `.specs/<change-id>/TASK.md` 的 `## Fix 任务` 段内追加编号修复任务(完整任务字段),**禁止文件尾追加**;任务集修订必须在 `entry` 之前完成。
|
|
134
|
+
2. **受控归位 execute**:运行 `workflow-state next`(完整命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs next`),或运行 `workflow-guard entry execute`(完整命令:`node .claude/skills/flow-comet/scripts/workflow-guard.mjs entry execute`)。处于 Fix 回退态(源节点驻留 + 存在 pending Fix 任务 + 当前路由判定为 execute)时,引擎把当前节点受控归位为 `execute`(`currentNode=execute`),并输出 `FIX-BATCH` 审计行(`next` 同时输出 `NODE: execute`);用 `workflow-state.mjs status` 确认 `stateCurrentNode` 已是 `execute` 再开工;若未归位,先按 `next` / `status` 的输出核对任务状态与路由,不要未经归位硬开工。
|
|
135
|
+
3. **执行修复**:按 execute 节点生命周期完成全部 Fix 任务(委托/直写规则不变);`entry execute` 刷新任务集签名,锁定追加后的任务集——归位后不得再增删任务或修改任务内容。
|
|
136
|
+
4. **跑 execute 四类出口**:`record execute` → `exit execute --apply`。四类出口门禁真实执行——**全任务 done / 逐任务 SUMMARY 完备 / 6 维自查 + 自检方法声明 / 任务集签名一致**;任一缺失即 BLOCKED 并给出恢复指引。通过后,引擎在 Fix 二次完成时把当前节点推回源节点(review 或 verify)。
|
|
137
|
+
- **guard exit 回源审计行语义(Fix vs RETURN)**:真实修复回路二次完成保留 `FIX-BATCH: 回源节点 <源节点>`(真实 Fix 回炉的机器锚);正常多趟收尾(任务集签名全等且无 Fix 标记)输出中性 `RETURN: 回源节点 <源节点>`(非 Fix 回修);旧 state 缺闭合/修复证据(无签名事件且无 Fix 标记)输出 `RETURN: 回源节点 <源节点>(旧 state 缺闭合/修复证据,未分类)`,不冒充 Fix、不 BLOCK;上述分类只改审计行文本,路由与 state 写入零变化。此处 `RETURN:` 仅指审计行前缀,与子代理 handoff 的 Return Contract 无关。
|
|
138
|
+
5. **回源节点跑出口**:回到源节点后运行 `next`,Fix 回程豁免生效时应输出 `NODE: review` 或 `NODE: verify`(不会因源节点产物已存在而跳过);若仍输出后续节点,说明回程条件未满足,先核对状态机归属与任务状态,不要继续推进。随后执行 `entry <源节点>` → `exit <源节点> --apply` 跑源节点出口门禁(即 entry/exit 源节点);通过后继续正常路由(review → verify;verify → archive),必要时进入下一轮 Fix 闭环。
|
|
139
|
+
- **`next` 回程审计行语义**:回程豁免行始终输出中性 `RETURN: 回程源节点 <源节点>`(源节点产物在场且未出口;保留源节点跑出口),不再输出 FIX-BATCH;受控归位行的 `FIX-BATCH: 归位 <execute 家族>` 保留(真实 Fix 回退行),两者不得混同。
|
|
140
|
+
6. **禁止绕过**:驻留源节点不归位、顺手改完后直接跑源节点 exit 收场会被 BLOCKED(存在未归位/未跑出口的修复回路),必须按上述路径恢复;不得用跳过归位或出口门禁的手段(含手动改写 `.flow-comet/flow-comet-state.json`)替代本路径。
|
|
141
|
+
|
|
142
|
+
**由受控重入打开的场景(archive 源)**:缺陷在归档后才暴露、且归档移动尚未发生时,可先由用户显式授权把工作归属退回 `execute` / `subagent-execute` / `review` / `verify` 之一,再按本节路径回到 execute 生命周期完成修复。重入命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs reenter <target> --authorized-by <source> --reason <text> [--continue-round <n>]`——每次调用都需要用户显式授权,每 change 上限 3 轮(达上限后凭显式续轮授权 `--continue-round <n>`(n ≥ 已用轮次 + 1)可继续并计入下一轮);重入前自动落 state 备份快照(`.specs/<change-id>/.reentry-backups/`);成功打印 `REENTRY: archive → <target>(授权源 <source>;第 n/3 轮;备份 <file>)` 与 `REASON: <text>` 行(续轮审计行为 `第 n 轮(显式授权续轮,上限 3)`),与 Fix 回炉的 `FIX-BATCH` 行、正常多趟收尾的 `RETURN` 行三态可区分。归档移动已发生或 change 已 `completed` 时重入 BLOCKED,须走人工处置或新 change,不得静默跳过。重入只改工作归属,不写任何闭合标记,也不跳过目标节点入口 / 出口与源节点出口门禁;重复调用同一目标为空操作(输出 `REENTRY: 空操作——…`,不备份、不计数、不改写 state)。
|
|
123
143
|
|
|
124
144
|
## Entry Check
|
|
125
145
|
|
|
@@ -200,5 +220,5 @@ If the script prints `SKILL: flow-comet-verify`, load that Skill next.
|
|
|
200
220
|
2. Read `.specs/<change-id>/REVIEW.md` — if exists with all rounds completed and Critical resolved, review is done.
|
|
201
221
|
3. If REVIEW.md exists but incomplete, check which rounds are missing and resume from there.
|
|
202
222
|
4. If Critical items were found but fix tasks not yet generated, generate them now.
|
|
203
|
-
5. If fix tasks were generated but not executed,
|
|
223
|
+
5. If fix tasks were generated but not executed, follow the「修复回路状态机路径」section below to home back to execute and run its four exit gates; return here only after execute exit passes, then run review's own exit.
|
|
204
224
|
6. Do not repeat completed review rounds.
|
|
@@ -15,11 +15,12 @@ Responsibility: 委托 [P] 并行任务给子代理,要求加载 flow-comet-de
|
|
|
15
15
|
|
|
16
16
|
职责分工(趟次协作):本节点负责**并行委托**(`parallel="true"` 且依赖已满足的任务,同一趟内同时发出)——委托节点可多次往返:每趟委托当时全部依赖已满足的并行任务,趟间由 execute 节点串行消化,直至不存在依赖已满足的可并行 pending 且无串行残留。execute 节点负责**串行委托**(非 parallel 任务,一次一个)。两者共用同一委托证据库(handoff 记录在 subagent-execute evidence)。序列形态不是本节点的关注点:全并行、全串行、串→并、并→串及任意混排均合法(合法性只取决于 `depends_on` 无环且引用存在;依赖环与缺失依赖已在 plan 出口拦截并附恢复指引),到达本节点的任务序列由多趟路由按依赖拓扑自动分趟消化。
|
|
17
17
|
|
|
18
|
-
> **Codex
|
|
19
|
-
>
|
|
20
|
-
>
|
|
21
|
-
>
|
|
22
|
-
>
|
|
18
|
+
> **Codex 平台事实与 flow-comet 当前支持面(2026-09-30 记录)**:**平台事实**——Codex 的常规用法是交互式 CLI(`codex` 无子命令)与会话内 agent,`codex exec` 只是 headless 子面;原生多代理 `multi_agent` 为 stable、默认启用(`codex features list` 可查),本机真实交互式会话日志中记录到 `spawn_agent` / `wait_agent` / `close_agent` 的实际调用——因此「Codex 不能委派 / 不使用并行委托」**不是平台事实**。**flow-comet 当前支持面(机制缺口)**——现有守卫 / 白名单 / 隔离模型未覆盖 Codex 原生子代理形态;在后续契约(须先由覆盖交互式会话与原生子代理的探针得出结论,再据此决定是否修改引擎)落地前,本节点在 Codex 上**不派遣并行子代理**,任务逐个走 `execute` 节点串行交付——这是 flow-comet 现阶段的**支持面限制,不是平台能力边界**;headless 子面实测见下(仅 `codex exec`,不得外推)。
|
|
19
|
+
> **dsh 平台委托方式(实测核对)**:dsh 的子代理是平台**进程内子代理**(不创建独立工作区)——写入守卫按**会话身份分派**:子代理 `delegationDepth` 大于 0 直接放行、**项目内任意路径可写(含 gitignored)**,因此**无需隔离区**;直接委托即可,不需要 worktree 隔离。**通用边界**:同一工作区内的并行子代理会看到彼此未提交的中间态——任务的 `write_files` 边界与提交时点即相互隔离纪律(本节点第 1 步的 write_files 互斥检查因此仍是硬前置)。
|
|
20
|
+
> **旧结论(实测 2026-08-13;证据已不可复核,未纳入 2026-09-30 重测矩阵——不得作为现行结论)**:worktree 的 `.git` 是主仓共享——`workspace-write`/`git-write-access` 沙箱均被 Codex 硬拦截(index.lock / objects / COMMIT_EDITMSG Permission denied);子代理必须用 `sandbox_mode="danger-full-access"` 才能完成 git 提交(worktree 隔离已限定写范围,full-access 仅用于让 git 提交可行)。**信任边界**:`danger-full-access` 是宿主级信任边界(不隔离凭据/网络访问)——仅委托可信子代理,并移除委托环境中的不必要凭据。以上仅作历史留档;现行结论以探针结论与后续契约为准。
|
|
21
|
+
> **headless 子面实测与 hook 会话 root 订正(依据 2026-09-30 真机重测;codex-cli 0.146.0 / Windows;仅 `codex exec --json --ephemeral` headless 子面;不得外推为平台结论)**:旧结论「手工 worktree 内的写入会被协调者白名单拦住、会话 root 仍是主仓库」被**推翻并收窄**——实测 hook 进程 cwd == 载荷 `cwd` == 会话工作根(cwd=项目 / `-C` / 手工 worktree 三形态);**Codex 原生子代理(`spawn_agent`)形态未覆盖,不得外推**。手工 worktree 形态下相对路径写入**不会**被拦:worktree 通常缺 gitignored 运行态 state → 守卫走「无活跃 workflow」放行;若 hook 命令仍指向主仓安装副本(runRoot 外),守卫因「workflow protocol file must stay inside the project root」报错退出,Codex 将 hook 失败降级为非阻塞 → 写入照常落地。**静态喂测(独立复现)**:守卫白名单只覆盖**解析后仍在 runRoot 内**的目标;`Write/Edit` 的 `file_path` 解析为 runRoot 外时跳过判定(**fail-open**,已知缺口、未闭合),而 Bash 写命令同目标仍 `decision:block`(两分支不对称)。**`apply_patch`**:会触发 PreToolUse,但 `tool_name="Bash"`、补丁正文在 `tool_input.command`(heredoc)、**无 `file_path`**;守卫不解析补丁体 → 目标不被提取、放行(独立复验复现了载荷与守卫盲区;「文件确实落盘」子项在复验环境因 apply_patch shim 失败未复现,首次真机重测环境曾落盘——按此差异如实理解)。**hook 触发条件**:隔离 `CODEX_HOME` 无持久信任时默认 headless **不执行**项目 hook;`hooks` 特性默认 enabled、可被项目配置/开关覆盖;`codex_hooks` 是 deprecated 别名;per-invocation 信任是必要因素之一,但独立复验显示 trust-only 触发**不稳定**(3/21;补 `--dangerously-bypass-approvals-and-sandbox` 后 5/5)——**不得写成稳定/确定性保证**;持久信任与交互式 TUI 形态未覆盖。**CC 的判据不同**:CC 的守卫按路径前缀识别隔离区(写入落在 `.claude/worktrees/**` 内即放行,`file_path` 与 Bash 命令两条判定路径同语义)。
|
|
22
|
+
> **出路(受支持路径,三平台各一条)**:① **CC 平台**——用 `Agent` 工具的 `isolation: "worktree"` 委托(守卫已覆盖该区,见步骤 3);② **dsh 平台**——直接委托平台进程内子代理(写入守卫按会话身份分派放行,**无需隔离区**;保持 `write_files` 边界与提交时点纪律);③ **Codex 平台**——**本节点暂不派遣并行子代理**:任务逐个走 `execute` 节点串行交付。依据是 flow-comet 当前支持面(原生子代理形态未被守卫 / 白名单 / 隔离模型覆盖,属机制缺口;待探针结论决定后续契约),**不是「Codex 不能委派 / 不使用并行委托」的平台边界**;headless 子面实测见上(仅 `codex exec`,不得外推)。
|
|
23
|
+
> **不提供/不使用规避通道**:绕开守卫命令级检测的写法(如用 Python `open()` 等 File API 直写)**不是受支持路径**——它绕过的是写入防线本身(防线失效时无拦截、无记录),与三层防御的设计相反。需要越出边界时一律走上面的出路,或如实上报 BLOCKED,**不得以更换工具形态绕过**。handoff 记录(workflow-handoff request/result)与 Return Contract 校验机制不变。
|
|
23
24
|
|
|
24
25
|
## Guidance
|
|
25
26
|
|
|
@@ -37,11 +38,13 @@ Responsibility: 委托 [P] 并行任务给子代理,要求加载 flow-comet-de
|
|
|
37
38
|
|
|
38
39
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好不好」由 review 把关。
|
|
39
40
|
|
|
41
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
42
|
+
|
|
40
43
|
# Subagent Execute
|
|
41
44
|
|
|
42
45
|
## Node Goal
|
|
43
46
|
|
|
44
|
-
This node parallelizes execution by delegating independent tasks (marked `parallel="true"` in TASK.md) to separate subagents. Each subagent loads the full `flow-comet-dev` protocol and operates within its task's `read_files`/`write_files` boundaries. This node produces handoff evidence for each delegated task and marks them done in TASK.md after all subagents complete. It exists to exploit parallelism when tasks have no file conflicts.
|
|
47
|
+
This node parallelizes execution by delegating independent tasks (marked `parallel="true"` in TASK.md) to separate subagents. Each subagent loads the full `flow-comet-dev` protocol and operates within its task's `read_files`/`write_files` boundaries. This node produces handoff evidence for each delegated task and marks them done in TASK.md after all subagents complete. It exists to exploit parallelism when tasks have no file conflicts. On Codex, whose native subagent shape the guard model does not yet cover, this node's current support surface delivers serially through the `execute` node instead (see the platform notes above).
|
|
45
48
|
|
|
46
49
|
Division of labor (pass-based collaboration): this node handles parallel delegation (`parallel="true"` tasks whose dependencies are satisfied — all of them dispatched concurrently within a pass) and may be entered multiple times across passes: each pass delegates every currently eligible parallel task, serial tasks are digested by the `execute` node between passes, and the node counts as complete only when no dependency-satisfied parallel task and no serial task remains. The `execute` node handles serial delegation (non-parallel tasks, one at a time). Both share the same delegation evidence library (handoff recorded under subagent-execute evidence). Sequence shape is not this node's concern: all-parallel, all-serial, serial→parallel, parallel→serial, and any mixed interleaving are all legal (legality depends only on an acyclic `depends_on` graph whose references all exist; cycles and missing dependencies are already intercepted at the plan exit with recovery guidance), and any sequence reaching this node is digested pass by pass by multi-pass routing along the dependency topology.
|
|
47
50
|
|
|
@@ -49,14 +52,18 @@ Division of labor (pass-based collaboration): this node handles parallel delegat
|
|
|
49
52
|
|
|
50
53
|
### 协调者禁令(最高优先级)
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
主会话是协调者,不是执行者。禁止在主会话直接修改源码或执行实现。源码只能委托子代理完成,**委托形态按平台**:**CC = 用 `Agent` 工具的 `isolation: "worktree"` 委托**;**dsh = 直接委托平台进程内子代理(无需隔离区)**;**Codex = 本节点当前支持面下不派遣并行子代理,任务逐个走 `execute` 节点串行交付**(原生多代理为平台已启用能力,未覆盖属机制缺口而非平台边界,见上方「Codex 平台事实与 flow-comet 当前支持面」段)。子代理派发失败时,主会话**不得接管实现**——记录当前任务为 BLOCKED 并走 Recovery。协调者只允许更新:TASK.md(标记 done)、`<task>-SUMMARY.md`、handoff evidence(workflow-handoff.mjs result)。
|
|
56
|
+
|
|
57
|
+
### 受控重入打开的修复场景(archive 源)
|
|
58
|
+
|
|
59
|
+
缺陷在归档后才暴露、且归档移动尚未发生时,可先由用户显式授权把工作归属退回本节点或 `execute` / `review` / `verify`,再按常规委托与出口流程完成修复。重入命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs reenter <target> --authorized-by <source> --reason <text> [--continue-round <n>]`——每次调用都需要用户显式授权,每 change 上限 3 轮(达上限后凭显式续轮授权 `--continue-round <n>`(n ≥ 已用轮次 + 1)可继续并计入下一轮);重入前自动落 state 备份快照(`.specs/<change-id>/.reentry-backups/`);成功打印 `REENTRY: archive → <target>(授权源 <source>;第 n/3 轮;备份 <file>)` 与 `REASON: <text>` 行(续轮审计行为 `第 n 轮(显式授权续轮,上限 3)`),与 Fix 回炉的 `FIX-BATCH` 行、正常多趟收尾的 `RETURN` 行三态可区分。归档移动已发生或 change 已 `completed` 时重入 BLOCKED,须走人工处置或新 change,不得静默跳过。重入只改工作归属,不写任何闭合标记,也不跳过本节点入口 / 出口门禁;重入后并行任务的委托证据、write_files 边界与 Return Contract 校验与常规流程完全一致;重复调用同一目标为空操作(输出 `REENTRY: 空操作——…`,不备份、不计数、不改写 state)。
|
|
53
60
|
|
|
54
61
|
### Prerequisites
|
|
55
62
|
|
|
56
63
|
- `.specs/<change-id>/TASK.md` must exist with at least one task marked `parallel="true"` and `status="pending"`.
|
|
57
64
|
- `.specs/<change-id>/DESIGN.md` or `DESIGN-lite.md` must exist.
|
|
58
65
|
- `.specs/LESSONS.md` must exist (or be created).
|
|
59
|
-
-
|
|
66
|
+
- Delegation capability, split by platform: **Claude Code** requires the `Agent` tool (the platform creates the worktree automatically, and subagents are delegated with `isolation: "worktree"`); **dsh** requires the platform's in-process delegation capability (subagents carry `delegationDepth > 0`, share the workspace, and need no isolation directory); **Codex** has a real, default-enabled native multi-agent capability — its regular usage is the interactive CLI — but flow-comet's guard/whitelist/isolation model does not yet cover that native subagent shape. Until the contract that follows a probe covering interactive sessions and native subagents is settled, this node does not dispatch parallel subagents on Codex and delivers serially through the `execute` node — a current support-surface limit, not a platform boundary. A manually created `git worktree` is not a supported path (see the "出路" section above).
|
|
60
67
|
|
|
61
68
|
### Steps
|
|
62
69
|
|
|
@@ -64,6 +71,7 @@ Division of labor (pass-based collaboration): this node handles parallel delegat
|
|
|
64
71
|
- ① `git status --short`:change 工件(`.specs/<change-id>/`)**必须已 commit**——未 commit 时 worktree 子代理看不到工件(harness 从已提交 HEAD 创建 worktree)
|
|
65
72
|
- ② `git log --oneline -1`:确认 HEAD 位置(change 分支)
|
|
66
73
|
- ③ 委托 prompt **必须内联任务块全文 + 相关 AC**(worktree 基线可能不是 change 分支——harness 行为不可控,内联是唯一可靠路径)
|
|
74
|
+
- ④ **子代理会话 Skill 工具可用性(委托前探测)**:委托 prompt 必须要求子代理开工前确认本会话是否具备 Skill 工具——具备时用 Skill 工具加载 `flow-comet-dev`;不可用时按 Read 加载节点 SKILL + `flow-kit/prompts/4-dev.md` 协议执行,并在 Return Contract 回传 `"skillToolFallback": "<降级替代形态,如 file-read>"`(SUMMARY「自检方法」段同步声明该替代形态并注明未执行 Skill 工具注入)。**禁止把 Read 声称为已注入**;委托 prompt 未写明该口径 = 委托前检查未完成,不得发出委托
|
|
67
75
|
- **Red Flag**:worktree 工件不可见/基线不确定时**禁止继续委托**——先 commit 或内联上下文
|
|
68
76
|
- 委托后:子代理回报 commitHash 后校验存在性(`git cat-file -e <commitHash>`,workflow-handoff result 已有 W2-D git show 校验兜底)
|
|
69
77
|
|
|
@@ -71,17 +79,19 @@ Division of labor (pass-based collaboration): this node handles parallel delegat
|
|
|
71
79
|
|
|
72
80
|
2. **For each parallel task, create handoff request**: Use `workflow-handoff.mjs request <task-id>` to register the handoff. **委托即记 request**——直接记录 result 而无对应 request 时,write_files 允许列表为空会被 BLOCKED(新 change 强制委托边界),补 request 后再重录 result 即可。
|
|
73
81
|
> 若不传 `--write-files`,脚本会自动从 TASK.md 对应 task 的 `<write_files>` 块解析(orchestrator 无需手动从 TASK.md 提取文件列表)。
|
|
82
|
+
**归属纪律**:request 会校验任务的并行属性与原始 `currentNode`——并行 pending 任务只归属本节点,串行 pending 任务归属 `execute`;错误节点的新 change 请求会被 BLOCK,并按输出运行 `workflow-state next` 与 `entry <目标节点>` 恢复后再重试。
|
|
74
83
|
The handoff prompt must include:
|
|
75
84
|
- The task's full XML block from TASK.md.
|
|
76
85
|
- DESIGN.md sections 0 and 0.5 for context.
|
|
77
86
|
- REQUIREMENT.md ACs relevant to this task.
|
|
78
87
|
- Explicit instruction to **use the Skill 工具** to load `flow-comet-dev` and follow its full protocol `flow-kit/prompts/4-dev.md`(不得跳过——读取 SKILL.md 文件不叫加载,跑声明命令也不叫加载;加载 = Skill 工具把 skill 注入会话)。
|
|
79
|
-
-
|
|
88
|
+
- **Skill 工具不可用时的降级口径(与上一条并排内联)**:子代理会话不具备 Skill 工具时,按 Read 加载节点 SKILL + `flow-kit/prompts/4-dev.md` 协议执行,Return Contract 回传 `"skillToolFallback": "<降级替代形态,如 file-read>"`,SUMMARY「自检方法」段同步声明该替代形态并注明未执行 Skill 工具注入;**禁止把 Read 声称为已完成 Skill 工具注入**。
|
|
89
|
+
- Explicit requirement to return `completedChecks` in the Return Contract containing `required-skill:subagent-execute.flow-comet-dev`(证明已加载 implementation skill;guard W1-D 严格校验,缺失 → exit BLOCKED,无旧 change 豁免)。Skill 工具不可用而走降级时该条目标记仍按契约回传,但必须与 `skillToolFallback` 降级声明并排出现——只回传标记而无声明视为不实声明,orchestrator 不得记录 result。
|
|
80
90
|
- The task's `read_files` and `write_files` boundaries.
|
|
81
91
|
- Instruction to produce `<task-id>-SUMMARY.md` in `.specs/<change-id>/` following the `flow-kit/templates/SUMMARY.md` template(标题/首部/段序保真,另补 flow-comet 增量 `## 自检方法` 段)。
|
|
82
92
|
- **提交边界警告**:提交**只含该任务 write_files 范围内的文件**(含测试文件)——不得包含 TASK.md 与其他协调者维护的 .specs 工件(新 change 提交越界 BLOCKED;实测子代理提交含 TASK.md 被 W2-D 拦截)。**提交从属规则**:任务专属的 `<task-id>-SUMMARY.md`(位于 `.specs/<change-id>/`,是 flow-comet 强制产物)允许随任务提交属流程默认豁免——目标仓库的既有规定优先,若目标仓库忽略清单等既有规定拒绝其入库,被拒即为正确行为,严禁 force-add 强加越库提交;委托校验对任务摘要的豁免属于校验宽容度,不是入库指令。
|
|
83
93
|
|
|
84
|
-
3. **Delegate to subagents**(平台相关——强制隔离的要求只对 CC 成立,见下): **Claude Code 平台**:所有并行子代理**必须**使用 `Agent` 工具的 `isolation: "worktree"`,**禁止共享 cwd 直接委托**——hook 白名单依赖 worktree 隔离:守卫对归一化后位于 `.claude/worktrees/**`(worktree 隔离区)的写入直接放行(`file_path` 与 Bash 命令两条判定路径同语义),共享 cwd 的子代理写入落在该区之外,会被 subagent-execute 协调者白名单误拦。**Codex
|
|
94
|
+
3. **Delegate to subagents**(平台相关——强制隔离的要求只对 CC 成立,见下): **Claude Code 平台**:所有并行子代理**必须**使用 `Agent` 工具的 `isolation: "worktree"`,**禁止共享 cwd 直接委托**——hook 白名单依赖 worktree 隔离:守卫对归一化后位于 `.claude/worktrees/**`(worktree 隔离区)的写入直接放行(`file_path` 与 Bash 命令两条判定路径同语义),共享 cwd 的子代理写入落在该区之外,会被 subagent-execute 协调者白名单误拦。**dsh 平台**:直接委托平台进程内子代理——写入守卫按会话身份分派(子代理 `delegationDepth > 0` 直接放行、项目内任意路径可写(含 gitignored)),**无需隔离区**;同一工作区的并行子代理会看到彼此未提交中间态,靠 `write_files` 边界互斥与提交时点作相互隔离纪律。**Codex 平台**:原生多代理(`multi_agent`,默认启用)不在本节点当前委托面内——现有守卫 / 白名单 / 隔离模型未覆盖该原生子代理形态(机制缺口,非平台边界);在探针结论决定的后续契约落地前,本节点在 Codex 上**不派遣并行子代理**:任务逐个走 `execute` 节点串行交付。`isolation: "worktree"` 是 CC 的 `Agent` 工具能力,手工 `git worktree add <任意路径>` **不是受支持路径**、不得作为绕过手段;**不得用 File API 直写等规避通道代替**(绕过写入防线不是受支持路径)。Each subagent (CC / dsh):
|
|
85
95
|
- Reads TASK.md for its specific task block.
|
|
86
96
|
- Executes the full TDD protocol (RED/GREEN/REFACTOR). **纯文档/纯配置任务无生产代码可测时,`redEvidence` 与 `greenEvidence` 均允许 `{"command":"N/A (non-code task)","output":"..."}` 形态**(guard W1-D 接受此形状;不得伪造测试输出)。
|
|
87
97
|
- Greps existing abstractions (R6.4).
|
|
@@ -118,13 +128,15 @@ Division of labor (pass-based collaboration): this node handles parallel delegat
|
|
|
118
128
|
"redEvidence": { "command": "<RED 失败测试命令>", "output": "<真实失败输出片段>" },
|
|
119
129
|
"greenEvidence": { "command": "<GREEN 通过测试命令>", "output": "<真实通过输出片段>" },
|
|
120
130
|
"riskSignals": ["cross-module | security | concurrency | migration | public-api | 200+lines | none"],
|
|
121
|
-
"concerns": "<可选:未解决的疑虑>"
|
|
131
|
+
"concerns": "<可选:未解决的疑虑>",
|
|
132
|
+
"skillToolFallback": "<仅 Skill 工具不可用时回传:降级替代形态(如 file-read),未执行 Skill 工具注入>"
|
|
122
133
|
}
|
|
123
134
|
```
|
|
124
135
|
|
|
125
136
|
- `status=DONE` 才视为完成;`BLOCKED` / `NEEDS_CONTEXT` 需 orchestrator 处理。
|
|
126
137
|
- `redEvidence` / `greenEvidence` 缺任一 → 视为未执行 TDD,orchestrator 拒绝记录;**新 change 下 guard 强制 BLOCKED**(旧 change WARN 渐进)。
|
|
127
138
|
- `completedChecks` 必须含 `required-skill:subagent-execute.flow-comet-dev`(子代理加载 implementation skill 的证明);缺任一项 → guard exit 严格 BLOCKED(W1-D,无旧 change 豁免),orchestrator 不得以旧格式/补录方式绕过。
|
|
139
|
+
- **Skill 工具不可用降级(如实声明)**:子代理会话不具备 Skill 工具时,按 Read 加载节点 SKILL + 协议执行并在 Return Contract 回传 `"skillToolFallback": "<降级替代形态,如 file-read>"`(SUMMARY「自检方法」段同步声明该替代形态并注明未执行 Skill 工具注入);此时 `completedChecks` 的 `required-skill:...` 标记仍按契约保留,但必须与降级声明并排出现——只回传标记而无降级声明视为不实声明,orchestrator 不得记录 result;具备 Skill 工具时不得回传该字段。**该字段是声明、不是物理证明**:回执只能记录会话的声明,读 SKILL.md 与真实 Skill 注入在机器可读证据上不可区分(与 `directOverride` / `completedChecks` 同族的诚实边界)——声明与事实不符属流程违规,验收以 transcript 可见的 Skill 工具触发为准。
|
|
128
140
|
- `riskSignals` 非 `none` 时,orchestrator 应将该任务标记为 review 节点的高优先级审查对象。
|
|
129
141
|
- 子代理回传后,orchestrator 用 `workflow-handoff.mjs result <task-id> '<JSON>'` 记录;guard exit subagent-execute 会校验 commitHash + greenEvidence + completedChecks(W1-D,严格)。
|
|
130
142
|
|
|
@@ -7,6 +7,8 @@ description: "flow-kit TASK 阶段协议:拆原子任务(XML 格式)、rea
|
|
|
7
7
|
|
|
8
8
|
本 Skill 为 flow-comet 的 plan 节点提供 flow-kit 的 TASK 拆解流程。
|
|
9
9
|
|
|
10
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
11
|
+
|
|
10
12
|
## 加载
|
|
11
13
|
|
|
12
14
|
读取 `flow-kit/prompts/3-task.md` 并按其执行。关键步骤:
|
|
@@ -15,12 +17,14 @@ description: "flow-kit TASK 阶段协议:拆原子任务(XML 格式)、rea
|
|
|
15
17
|
2. **拆解原则**:
|
|
16
18
|
- 大小:fresh context 2~10 分钟可完成
|
|
17
19
|
- 粒度:按文件冲突切(垂直切片),不按层切
|
|
18
|
-
- 并行标记 `[P]
|
|
19
|
-
-
|
|
20
|
+
- 并行标记 `[P]`:只给本波确有并发同伴、且 write_files 互不重叠的任务;孤立任务一律串行——「互不冲突」只是必要条件,不等于应标 `[P]`
|
|
21
|
+
- **同一文件 ⇒ 同一任务**:一个文件只能有一个任务 owner;必须拆分时,在波次划分中显式排序并写明拆分理由与依赖方向,不得把同一文件的两处改动拆成无依赖的两个任务
|
|
22
|
+
- **[P] × direct 模式**:`[P]` 任务只在 `subagent-execute` 节点委托消化;direct 模式只放行串行任务的主代理直写,`parallel="true"` 任务在 direct 下仍必须委托——direct 不是并行任务的逃生口;共享工作区以 `write_files` 互斥 + 提交时点(提交前 diff 边界)作为相互隔离纪律
|
|
23
|
+
- 波次形态:依赖驱动多趟语义——每个并行任务显式声明 `depends_on`(后波依赖前波任务),引擎按依赖拓扑自动分趟消化(每趟委托全部依赖已满足的并行任务,趟间回串行),混排序列(串→并→串/并→串→并等交错形态)合法,无需压扁成单一串行段;唯一硬性拦截是依赖环(如 A→B→A,规划出口 BLOCKED 并附恢复指引——调整涉环任务的 depends_on 后重新 exit 即可通过),跳过未满足依赖先跑并行同样被拦。落笔时先画依赖方向再标 [P]。flow-kit 上游模板未载此约束,以本条为准
|
|
20
24
|
- 依赖:`depends_on: <task-id>`
|
|
21
25
|
3. **每任务 7 字段**:id / name / read_files / write_files / action / verify / done
|
|
22
26
|
- **write_files 必须包含关联测试文件**:若任务修改组件/函数,且有关联测试直接 import 其本地导出(如 `src/**/__tests__/*.test.ts` 从组件文件 import),该测试文件**必须纳入该任务 write_files**。否则组件删除本地导出/改 import 后,关联测试会编译失败或断言失效(实测:改组件时破坏了关联测试文件)。
|
|
23
|
-
4.
|
|
27
|
+
4. **波次划分**:跨层顺序;同层任务只有确有并发同伴、且 write_files 互不重叠时才标 [P],孤立任务一律串行;flow-kit 上游宽松语义(「无冲突即可标 [P]」「同层即同波并行」)以本节点为准(显式覆盖,vendored 只读不改)
|
|
24
28
|
5. **XML 格式**:便于 AI 解析与执行
|
|
25
29
|
|
|
26
30
|
## 产物
|
|
@@ -7,6 +7,8 @@ description: "flow-kit TEST 阶段协议:5 轮测试金字塔(功能/性能/
|
|
|
7
7
|
|
|
8
8
|
本 Skill 为 flow-comet 的 review 节点提供 flow-kit 的 5 轮测试金字塔。
|
|
9
9
|
|
|
10
|
+
> **模板权威**:本技能产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
11
|
+
|
|
10
12
|
## 加载
|
|
11
13
|
|
|
12
14
|
读取 `flow-kit/prompts/5-test.md` 并按其执行。
|
|
@@ -26,6 +26,8 @@ This node performs the final integration verification: running all automated tes
|
|
|
26
26
|
|
|
27
27
|
guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好不好」由 review 把关。
|
|
28
28
|
|
|
29
|
+
> **模板权威**:本节点产出工件的段形唯一权威 = `flow-kit/templates/**`;`.specs/archive/**` 是历史证据、**不是模板来源**——不得以「上一轮就是这么写的」对齐段形。
|
|
30
|
+
|
|
29
31
|
### Prerequisites
|
|
30
32
|
|
|
31
33
|
- `.specs/<change-id>/REVIEW.md` must exist (from review node).
|
|
@@ -49,9 +51,9 @@ guard 校验见 workflow-guard.mjs NODE_TRANSITION_GATES / W1-B;「填得好
|
|
|
49
51
|
|
|
50
52
|
3. **Failure diagnosis**: For any failure (automated test or UAT):
|
|
51
53
|
- Switch to "Diagnose sub-role" — identify root cause, not symptom.
|
|
52
|
-
- Produce fix-plan: append to TASK.md as numbered fix tasks with full 7 fields and verify command
|
|
53
|
-
-
|
|
54
|
-
- Re-run verification after fix.
|
|
54
|
+
- Produce fix-plan: append to TASK.md 的 `## Fix 任务` 段 as numbered fix tasks with full 7 fields and verify command — 禁止文件尾追加.
|
|
55
|
+
- Follow the「修复回路状态机路径」section below: home back to execute, run its four exit gates, then return to verify.
|
|
56
|
+
- Re-run verification after fix, then run verify's own exit gates.
|
|
55
57
|
|
|
56
58
|
4. **Auto-retry limit (R2.6)**: verify 失败自动重试 ≤ 3 次(机器计数 verifyFailures);第 4 次失败必须暂停问用户「继续修 / 停止」。Do not auto-retry beyond 3 times.
|
|
57
59
|
|
|
@@ -83,6 +85,21 @@ This node is truly done when:
|
|
|
83
85
|
- **Agent thought**: "Auto-retry 4th time, maybe it'll work now." **Actual risk**: On the 4th failure (R2.6 violation), the problem is likely systematic, not transient. Must pause and ask the user「继续修 / 停止」.
|
|
84
86
|
- **Agent thought**: "Fix the failure directly, no need for a fix task." **Actual risk**: Bypassing the fix-task -> execute -> re-verify cycle means the fix is not properly tracked or tested. Must go through the proper loop.
|
|
85
87
|
|
|
88
|
+
## 修复回路状态机路径
|
|
89
|
+
|
|
90
|
+
review / verify 发现缺陷后的修复必须回到 `execute` 节点生命周期内完成,禁止驻留源节点「顺手修完」;引擎按以下路径强制闭环(`<源节点>` 为 review 或 verify):
|
|
91
|
+
|
|
92
|
+
1. **追加 Fix 任务**:在 `.specs/<change-id>/TASK.md` 的 `## Fix 任务` 段内追加编号修复任务(完整任务字段),**禁止文件尾追加**;任务集修订必须在 `entry` 之前完成。
|
|
93
|
+
2. **受控归位 execute**:运行 `workflow-state next`(完整命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs next`),或运行 `workflow-guard entry execute`(完整命令:`node .claude/skills/flow-comet/scripts/workflow-guard.mjs entry execute`)。处于 Fix 回退态(源节点驻留 + 存在 pending Fix 任务 + 当前路由判定为 execute)时,引擎把当前节点受控归位为 `execute`(`currentNode=execute`),并输出 `FIX-BATCH` 审计行(`next` 同时输出 `NODE: execute`);用 `workflow-state.mjs status` 确认 `stateCurrentNode` 已是 `execute` 再开工;若未归位,先按 `next` / `status` 的输出核对任务状态与路由,不要未经归位硬开工。
|
|
94
|
+
3. **执行修复**:按 execute 节点生命周期完成全部 Fix 任务(委托/直写规则不变);`entry execute` 刷新任务集签名,锁定追加后的任务集——归位后不得再增删任务或修改任务内容。
|
|
95
|
+
4. **跑 execute 四类出口**:`record execute` → `exit execute --apply`。四类出口门禁真实执行——**全任务 done / 逐任务 SUMMARY 完备 / 6 维自查 + 自检方法声明 / 任务集签名一致**;任一缺失即 BLOCKED 并给出恢复指引。通过后,引擎在 Fix 二次完成时把当前节点推回源节点(review 或 verify)。
|
|
96
|
+
- **guard exit 回源审计行语义(Fix vs RETURN)**:真实修复回路二次完成保留 `FIX-BATCH: 回源节点 <源节点>`(真实 Fix 回炉的机器锚);正常多趟收尾(任务集签名全等且无 Fix 标记)输出中性 `RETURN: 回源节点 <源节点>`(非 Fix 回修);旧 state 缺闭合/修复证据(无签名事件且无 Fix 标记)输出 `RETURN: 回源节点 <源节点>(旧 state 缺闭合/修复证据,未分类)`,不冒充 Fix、不 BLOCK;上述分类只改审计行文本,路由与 state 写入零变化。此处 `RETURN:` 仅指审计行前缀,与子代理 handoff 的 Return Contract 无关。
|
|
97
|
+
5. **回源节点跑出口**:回到源节点后运行 `next`,Fix 回程豁免生效时应输出 `NODE: review` 或 `NODE: verify`(不会因源节点产物已存在而跳过);若仍输出后续节点,说明回程条件未满足,先核对状态机归属与任务状态,不要继续推进。随后执行 `entry <源节点>` → `exit <源节点> --apply` 跑源节点出口门禁(即 entry/exit 源节点);通过后继续正常路由(review → verify;verify → archive),必要时进入下一轮 Fix 闭环。
|
|
98
|
+
- **`next` 回程审计行语义**:回程豁免行始终输出中性 `RETURN: 回程源节点 <源节点>`(源节点产物在场且未出口;保留源节点跑出口),不再输出 FIX-BATCH;受控归位行的 `FIX-BATCH: 归位 <execute 家族>` 保留(真实 Fix 回退行),两者不得混同。
|
|
99
|
+
6. **禁止绕过**:驻留源节点不归位、顺手改完后直接跑源节点 exit 收场会被 BLOCKED(存在未归位/未跑出口的修复回路),必须按上述路径恢复;不得用跳过归位或出口门禁的手段(含手动改写 `.flow-comet/flow-comet-state.json`)替代本路径。
|
|
100
|
+
|
|
101
|
+
**由受控重入打开的场景(archive 源)**:缺陷在归档后才暴露、且归档移动尚未发生时,可先由用户显式授权把工作归属退回 `execute` / `subagent-execute` / `review` / `verify` 之一,再按本节路径回到 execute 生命周期完成修复。重入命令:`node .claude/skills/flow-comet/scripts/workflow-state.mjs reenter <target> --authorized-by <source> --reason <text> [--continue-round <n>]`——每次调用都需要用户显式授权,每 change 上限 3 轮(达上限后凭显式续轮授权 `--continue-round <n>`(n ≥ 已用轮次 + 1)可继续并计入下一轮);重入前自动落 state 备份快照(`.specs/<change-id>/.reentry-backups/`);成功打印 `REENTRY: archive → <target>(授权源 <source>;第 n/3 轮;备份 <file>)` 与 `REASON: <text>` 行(续轮审计行为 `第 n 轮(显式授权续轮,上限 3)`),与 Fix 回炉的 `FIX-BATCH` 行、正常多趟收尾的 `RETURN` 行三态可区分。归档移动已发生或 change 已 `completed` 时重入 BLOCKED,须走人工处置或新 change,不得静默跳过。重入只改工作归属,不写任何闭合标记,也不跳过目标节点入口 / 出口与源节点出口门禁;重复调用同一目标为空操作(输出 `REENTRY: 空操作——…`,不备份、不计数、不改写 state)。
|
|
102
|
+
|
|
86
103
|
## Entry Check
|
|
87
104
|
|
|
88
105
|
```bash
|
|
@@ -159,6 +176,6 @@ If the script prints `SKILL: flow-comet-archive`, load that Skill next.
|
|
|
159
176
|
2. Read `.specs/<change-id>/UAT.md` — check which items have results.
|
|
160
177
|
3. If UAT.md exists with all items passing, verification is done.
|
|
161
178
|
4. If UAT.md has failures, check if fix tasks were generated in TASK.md.
|
|
162
|
-
5. If fix tasks exist but not
|
|
179
|
+
5. If fix tasks exist but have not gone through the execute lifecycle, follow the「修复回路状态机路径」section below: home back to execute, run its four exit gates, then return to verify and run verify's exit gates.
|
|
163
180
|
6. Count previous auto-retries (from UAT.md / machine-counted verifyFailures) to enforce R2.6 limit.
|
|
164
181
|
7. Resume from the first incomplete verification step.
|