@namewta/speculo 0.7.1 → 0.7.2

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.
Files changed (37) hide show
  1. package/README.md +2 -1
  2. package/package.json +1 -1
  3. package/template/canonical/canonical-specdev-engineering-cognitive-mentor.md +178 -0
  4. package/template/canonical/canonical-specdev-goal-plan.md +386 -74
  5. package/template/canonical/canonical-specdev-grill-with-docs.md +178 -0
  6. package/template/canonical/canonical-specdev-spec.md +178 -0
  7. package/template/canonical/canonical-specdev-tickets.md +247 -21
  8. package/template/canonical/canonical-specdev-wayfinder.md +178 -0
  9. package/template/skills/optimize-codex-config/SKILL.md +81 -0
  10. package/template/skills/optimize-codex-config/references/configuration-contract.md +103 -0
  11. package/template/skills/optimize-codex-config/references/troubleshooting.md +79 -0
  12. package/template/skills/optimize-codex-config/scripts/audit-codex-config.mjs +747 -0
  13. package/template/workflows/specdev/I-implement/I-implement.md +11 -10
  14. package/template/workflows/specdev/I-implement/delegated-evidence-template.md +2 -1
  15. package/template/workflows/specdev/I-implement/execution-preflight.md +5 -3
  16. package/template/workflows/specdev/I-implement/merge-conflict-protocol.md +6 -5
  17. package/template/workflows/specdev/INDEX.md +5 -4
  18. package/template/workflows/specdev/P-goal-plan/P-goal-plan.md +27 -18
  19. package/template/workflows/specdev/P-goal-plan/completion-control.md +3 -3
  20. package/template/workflows/specdev/P-goal-plan/delegated-execution-template.md +6 -4
  21. package/template/workflows/specdev/P-goal-plan/delegated-execution.md +13 -7
  22. package/template/workflows/specdev/P-goal-plan/goal-plan-template.md +11 -2
  23. package/template/workflows/specdev/P-goal-plan/orchestration-protocol.md +7 -3
  24. package/template/workflows/specdev/P-goal-plan/planning-modes.md +23 -8
  25. package/template/workflows/specdev/P-goal-plan/workspace-execution-template.md +24 -0
  26. package/template/workflows/specdev/common/README.md +2 -2
  27. package/template/workflows/specdev/common/rules/change-completion.md +3 -2
  28. package/template/workflows/specdev/common/rules/path-ownership.md +2 -2
  29. package/template/workflows/specdev/common/schemas/change-status.schema.json +178 -0
  30. package/template/workflows/specdev/common/schemas/goal-plan.schema.json +10 -0
  31. package/template/workflows/specdev/common/skills/dev-worktree/SKILL.md +11 -11
  32. package/template/workflows/specdev/common/skills/dev-worktree/references/create.md +19 -4
  33. package/template/workflows/specdev/common/skills/dev-worktree/references/finalize.md +12 -5
  34. package/template/workflows/specdev/common/skills/subagent-delivery/SKILL.md +4 -3
  35. package/template/workflows/specdev/common/skills/subagent-delivery/references/external-web-subagent.md +1 -1
  36. package/template/workflows/specdev/common/skills/subagent-delivery/references/native-subagent.md +2 -3
  37. package/template/workflows/specdev/common/tools/validate-specdev.mjs +218 -5
@@ -30,6 +30,6 @@ shared_paths: ["<Path>package.json</Path>"]
30
30
 
31
31
  ## 3. Worktree 与分支
32
32
 
33
- 需要并行或临时隔离项目写入时使用独立 worktree;只读调查和顺序执行默认共用当前工作区。Worktree 防止工作区污染,路径所有权防止逻辑冲突,两者不能互相替代。
33
+ Worktree 只在存在可观察隔离需求时使用:并行写入、保护当前本地状态、一次性实验、后台恢复、provider 要求或用户明确要求。只读调查和没有其他隔离事实的顺序写入默认共用当前工作区。Agent Team、Ticket 数量和泛化的“更安全”都不构成隔离理由。Worktree 防止工作区污染,路径所有权防止逻辑冲突,两者不能互相替代。
34
34
 
35
- 生命周期由调用方明确的 workspace owner 按 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/SKILL.md</Path>` 管理。普通 Goal Plan 由当前执行或集成 owner 负责;委派 Goal Plan 才把 workspace owner 映射为 Lead。编排规则位于 `<Path>{roots.workflows}/specdev/P-goal-plan/orchestration-protocol.md</Path>`。
35
+ 生命周期由调用方明确的 workspace owner 与 integration owner 按 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/SKILL.md</Path>` 管理。`single-session` 通常把两者映射为主会话;`lead-team` 可以把 integration owner 映射为 Lead,但角色选择不决定是否使用 worktree。同一 current workspace 只允许一个项目与 SpecDev 状态写入 owner;Worker 要写项目文件时必须拥有独立 workspace。编排规则位于 `<Path>{roots.workflows}/specdev/P-goal-plan/orchestration-protocol.md</Path>`。
@@ -105,6 +105,10 @@
105
105
  "type": "string",
106
106
  "minLength": 1
107
107
  },
108
+ "integration_owner": {
109
+ "type": "string",
110
+ "minLength": 1
111
+ },
108
112
  "provider": {
109
113
  "enum": [
110
114
  "native",
@@ -116,6 +120,10 @@
116
120
  "type": "string",
117
121
  "minLength": 1
118
122
  },
123
+ "parent_branch": {
124
+ "type": "string",
125
+ "minLength": 1
126
+ },
119
127
  "branch": {
120
128
  "type": "string",
121
129
  "minLength": 1
@@ -125,11 +133,76 @@
125
133
  "minLength": 1,
126
134
  "pattern": "^(?!/)(?![A-Za-z]:[\\\\/]).+"
127
135
  },
136
+ "terminal_action": {
137
+ "enum": [
138
+ "integrate",
139
+ "retain"
140
+ ]
141
+ },
142
+ "source_checkpoint": {
143
+ "type": [
144
+ "string",
145
+ "null"
146
+ ]
147
+ },
148
+ "integration": {
149
+ "type": "object",
150
+ "required": [
151
+ "status",
152
+ "parent_before_sha",
153
+ "source_sha",
154
+ "result_sha",
155
+ "method",
156
+ "conflict_paths",
157
+ "verification",
158
+ "evidence",
159
+ "attempts"
160
+ ],
161
+ "properties": {
162
+ "status": {
163
+ "enum": [
164
+ "pending",
165
+ "running",
166
+ "passed",
167
+ "blocked"
168
+ ]
169
+ },
170
+ "parent_before_sha": {
171
+ "type": ["string", "null"]
172
+ },
173
+ "source_sha": {
174
+ "type": ["string", "null"]
175
+ },
176
+ "result_sha": {
177
+ "type": ["string", "null"]
178
+ },
179
+ "method": {
180
+ "enum": [null, "fast-forward", "merge-commit"]
181
+ },
182
+ "conflict_paths": {
183
+ "type": "array",
184
+ "items": {"type": "string"}
185
+ },
186
+ "verification": {
187
+ "enum": ["pending", "passed", "failed"]
188
+ },
189
+ "evidence": {
190
+ "type": "string",
191
+ "pattern": "^<Path>\\{roots\\.state\\}/specdev/changes/[^<]+/evidence/T-[0-9]{2,}\\.md</Path>$"
192
+ },
193
+ "attempts": {
194
+ "type": "integer",
195
+ "minimum": 0
196
+ }
197
+ },
198
+ "additionalProperties": true
199
+ },
128
200
  "status": {
129
201
  "enum": [
130
202
  "planned",
131
203
  "active",
132
204
  "review",
205
+ "integrating",
133
206
  "integrated",
134
207
  "removed",
135
208
  "blocked"
@@ -140,6 +213,111 @@
140
213
  "minLength": 1
141
214
  }
142
215
  },
216
+ "dependentRequired": {
217
+ "terminal_action": [
218
+ "integration_owner",
219
+ "parent_branch",
220
+ "source_checkpoint",
221
+ "integration"
222
+ ]
223
+ },
224
+ "allOf": [
225
+ {
226
+ "if": {
227
+ "properties": {
228
+ "status": {"const": "integrating"}
229
+ },
230
+ "required": ["status"]
231
+ },
232
+ "then": {
233
+ "required": [
234
+ "terminal_action",
235
+ "integration_owner",
236
+ "parent_branch",
237
+ "source_checkpoint",
238
+ "integration"
239
+ ],
240
+ "properties": {
241
+ "terminal_action": {"const": "integrate"}
242
+ }
243
+ }
244
+ },
245
+ {
246
+ "if": {
247
+ "properties": {
248
+ "status": {"enum": ["integrating", "integrated"]},
249
+ "terminal_action": {"const": "integrate"}
250
+ },
251
+ "required": ["status", "terminal_action"]
252
+ },
253
+ "then": {
254
+ "properties": {
255
+ "source_checkpoint": {"type": "string", "minLength": 1},
256
+ "integration": {
257
+ "properties": {
258
+ "parent_before_sha": {"type": "string", "minLength": 1},
259
+ "source_sha": {"type": "string", "minLength": 1},
260
+ "attempts": {"type": "integer", "minimum": 1}
261
+ }
262
+ }
263
+ }
264
+ }
265
+ },
266
+ {
267
+ "if": {
268
+ "properties": {
269
+ "status": {"const": "integrating"},
270
+ "terminal_action": {"const": "integrate"}
271
+ },
272
+ "required": ["status", "terminal_action"]
273
+ },
274
+ "then": {
275
+ "properties": {
276
+ "integration": {
277
+ "properties": {
278
+ "status": {"const": "running"}
279
+ }
280
+ }
281
+ }
282
+ }
283
+ },
284
+ {
285
+ "if": {
286
+ "properties": {
287
+ "status": {"const": "integrated"},
288
+ "terminal_action": {"const": "integrate"}
289
+ },
290
+ "required": ["status", "terminal_action"]
291
+ },
292
+ "then": {
293
+ "properties": {
294
+ "integration": {
295
+ "properties": {
296
+ "status": {"const": "passed"},
297
+ "result_sha": {"type": "string", "minLength": 1},
298
+ "method": {"enum": ["fast-forward", "merge-commit"]},
299
+ "verification": {"const": "passed"}
300
+ }
301
+ }
302
+ }
303
+ }
304
+ },
305
+ {
306
+ "if": {
307
+ "properties": {
308
+ "terminal_action": {"const": "retain"}
309
+ },
310
+ "required": ["terminal_action"]
311
+ },
312
+ "then": {
313
+ "properties": {
314
+ "status": {
315
+ "not": {"enum": ["integrating", "integrated"]}
316
+ }
317
+ }
318
+ }
319
+ }
320
+ ],
143
321
  "additionalProperties": true
144
322
  }
145
323
  }
@@ -15,7 +15,17 @@
15
15
  "minItems": 1,
16
16
  "uniqueItems": true
17
17
  },
18
+ "coordination_mode": {
19
+ "enum": ["single-session", "lead-team"]
20
+ },
21
+ "workspace_strategy": {
22
+ "enum": ["current", "worktree", "mixed"]
23
+ },
18
24
  "ready_for_execution": {"type": "boolean"}
19
25
  },
26
+ "dependentRequired": {
27
+ "coordination_mode": ["workspace_strategy"],
28
+ "workspace_strategy": ["coordination_mode"]
29
+ },
20
30
  "additionalProperties": true
21
31
  }
@@ -1,31 +1,31 @@
1
1
  ---
2
2
  name: specdev-dev-worktree
3
- description: 为需要隔离项目写入的 Ready Ticket 或一次性原型建立可恢复 worktree,并由调用方明确的 workspace owner 管理基线、集成或清理。
3
+ description: 为具有明确隔离触发条件的 Ready Ticket 或一次性原型建立可恢复 worktree,并由 workspace owner 与 integration owner 管理基线、自动本地集成或清理。
4
4
  ---
5
5
 
6
6
  # SpecDev Dev Worktree
7
7
 
8
8
  ## 适用范围
9
9
 
10
- - 用于并行写代码且路径所有权不冲突的 Ready Ticket,或明确要求临时隔离的一次性原型。
11
- - 只读调查和顺序执行默认共用当前工作区。
12
- - 调用方必须明确 workspace owner、implementation owner、固定基线、工作项 ID、持久化 owner 和允许的结束动作。
13
- - 普通执行不建立额外角色;委派 Goal Plan 才把 workspace owner/implementation owner 分别映射为 Lead/Worker
10
+ - 只用于具备 `parallel-write`、`protect-local-state`、`disposable-experiment`、`background-resume`、`provider-requirement` 或 `user-requested` 触发事实的 Ready Ticket/原型。
11
+ - 只读调查、Agent Team 本身和没有其他隔离事实的顺序执行默认共用当前工作区。
12
+ - 调用方必须明确 trigger、workspace owner、implementation owner、integration owner、固定基线、父分支、工作项 ID、持久化 owner 和允许的结束动作。
13
+ - Coordination workspace 正交:`single-session` 可以使用本 Skill;`lead-team` 不自动使用。Current workspace Worker 只读;Worker 写入必须绑定本 Skill 创建的独立 workspace
14
14
  - 平台原生 worktree 优先;不可用时使用 Git worktree。
15
15
 
16
16
  ## 生命周期
17
17
 
18
18
  1. 创建或恢复时加载 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/references/create.md</Path>`。
19
- 2. implementation owner 完成后返回工作项状态、Evidence/record 路径、`workspace_ref`、checkpoint、commit 或 PR 引用和未验证项;Ticket worktree 从 `active` 更新为 `review`。
20
- 3. workspace owner 集成或清理时加载 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/references/finalize.md</Path>`;一次性原型只评估和清理,不合入生产分支。
19
+ 2. implementation owner 完成后返回工作项状态、Evidence/record 路径、`workspace_ref`、不可变 source checkpoint、commit 或 PR 引用和未验证项;Ticket worktree 从 `active` 更新为 `review`。
20
+ 3. `terminal_action=integrate` 时 integration owner 自动加载 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/references/finalize.md</Path>`;`retain` 保持 review。一次性原型只评估和清理,不合入生产分支。
21
21
 
22
- Ticket worktree 状态依次为 `planned → active → review → integrated → removed`;失败进入 `blocked`,记录写入 `<Path>{roots.state}/specdev/changes/{change}/.status.json</Path>` 的 `worktrees`。原型的 branch、`workspace_ref` 和清理结果只写入 `<Path>{roots.state}/specdev/changes/{change}/prototypes/{prototype-id}/record.md</Path>`,不伪造 Ticket worktree 记录。
22
+ Ticket worktree 状态依次为 `planned → active → review → integrating → integrated → removed`;失败进入 `blocked`,记录写入 `<Path>{roots.state}/specdev/changes/{change}/.status.json</Path>` 的 `worktrees`。`integrating` 是带完整授权、来源和尝试证据的可恢复锁:同一父分支一次只允许一个 integration owner;fast-forward 与 merge-commit 都必须落到可复核的 `integrated/passed` 终态。原型的 branch、`workspace_ref` 和清理结果只写入 `<Path>{roots.state}/specdev/changes/{change}/prototypes/{prototype-id}/record.md</Path>`,不伪造 Ticket worktree 记录。
23
23
 
24
24
  ## 边界
25
25
 
26
- - 每个并行 Ticket 使用独立 worktree、分支和相同 `base_sha`;每个原型使用独立 worktree 和分支。
26
+ - 每个隔离 Ticket 使用独立 worktree 和分支;同一并行 Wave 固定相同 `base_sha`。每个原型使用独立 worktree 和分支。
27
27
  - Git provider 固定使用 `<project-root>/specdev-worktree/<work-item-id>/`,持久化 `workspace_ref: specdev-worktree/<work-item-id>`;`<project-root>` 由 `workspace.json#path_base: project-root` 解析。
28
28
  - native/external provider 保留其可迁移 opaque locator;所有 provider 都不保存机器绝对路径、认证秘密或真实用户数据。
29
29
  - 项目根 `.gitignore` 的 `specdev-worktree/` 条目由 `speculo init` 单一维护;缺失时创建流程阻塞并提示重新运行 init。
30
- - E2E 仅适用于用户界面交互受影响的变更。普通执行由当前集成 owner 运行;委派执行由 Lead 在集成阶段运行。
31
- - 合并、推送、PR、删除分支或 worktree 仍需用户授权。
30
+ - E2E 仅适用于用户界面交互受影响的变更,由 integration owner 在集成阶段运行。
31
+ - `terminal_action=integrate` 授权本地 fast-forward,以及分叉集成所需的暂存、merge continue 和一次集成专用 merge commit;不授权普通实现提交、push、PR、远端 merge、部署、迁移或删除分支/worktree
@@ -3,8 +3,8 @@
3
3
  ## 前置
4
4
 
5
5
  - Ticket `ready: true` 且依赖完成,或原型问题与临时写入范围已锁定;项目写路径无冲突。
6
- - 并行 Ticket 要求 `<Path>{roots.state}/specdev/config.json</Path>` 中 `git.worktree_for_parallel: true`;一次性原型要求 P-prototype 已取得本次临时 worktree 授权。
7
- - 调用方已指定 workspace owner、implementation owner、工作项 ID、持久化 owner,并固定 `base_sha`;并行 Ticket 共用同一基线。
6
+ - 调用方已记录允许的 trigger 及其事实。`parallel-write` 还要求 `<Path>{roots.state}/specdev/config.json</Path>` 中 `git.worktree_for_parallel: true`;一次性原型要求 P-prototype 已取得本次临时 worktree 授权。
7
+ - 调用方已指定 workspace owner、implementation owner、integration owner、父分支、工作项 ID、持久化 owner、`integrate | retain`,并固定 `base_sha`;并行 Ticket 共用同一基线。
8
8
 
9
9
  ## 创建
10
10
 
@@ -15,16 +15,31 @@
15
15
  5. Git fallback 固定 `physical_path = <project-root>/specdev-worktree/<work-item-id>`、`workspace_ref = specdev-worktree/<work-item-id>`,从 `base_sha` 执行 `git worktree add -b <work-item-branch> <physical-path> <base-sha>`。已存在但未与同一记录和 Git 注册匹配的目标路径一律阻塞。
16
16
  6. 分支使用 `speculo/<change>/<work-item-id>`;现有分支未能匹配记录时停止。
17
17
  7. 安装项目所需依赖,运行最小基线检查。E2E 不属于 implementation owner 的创建基线。
18
- 8. Ticket 将记录写入 `worktrees`:
18
+ 8. Ticket 将记录写入 `worktrees`;`owner` 保持 implementation owner 的兼容含义:
19
19
 
20
20
  ```json
21
21
  {
22
22
  "ticket_id": "T-01",
23
23
  "owner": "<implementation-owner>",
24
+ "integration_owner": "<integration-owner>",
24
25
  "provider": "git",
25
26
  "base_sha": "<sha>",
27
+ "parent_branch": "<parent-branch>",
26
28
  "branch": "speculo/<change>/T-01",
27
29
  "workspace_ref": "specdev-worktree/T-01",
30
+ "terminal_action": "integrate",
31
+ "source_checkpoint": null,
32
+ "integration": {
33
+ "status": "pending",
34
+ "parent_before_sha": null,
35
+ "source_sha": null,
36
+ "result_sha": null,
37
+ "method": null,
38
+ "conflict_paths": [],
39
+ "verification": "pending",
40
+ "evidence": "<Path>{roots.state}/specdev/changes/{change}/evidence/T-01.md</Path>",
41
+ "attempts": 0
42
+ },
28
43
  "status": "active",
29
44
  "updated_at": "<ISO-8601>"
30
45
  }
@@ -32,4 +47,4 @@
32
47
 
33
48
  native/external provider 将示例中的 provider 与 `workspace_ref` 换为对应可迁移 locator,不套用 Git 物理路径。原型不使用本 JSON 结构,只在 record 的 Run and Assets 中记录源码 branch/commit,并在 frontmatter 写入 `workspace_ref` 与清理状态。
34
49
 
35
- 完成条件:工作区可定位、基线可用、调用方记录与实际 provider、分支和 checkpoint 一致;Git provider 的引用与工作项 ID 完全一致。失败时在调用方拥有的记录中设为 `blocked` 并保留现场。
50
+ `terminal_action=integrate` 不替代来源实现提交授权;进入 `review` 前必须把已获授权的最终 commit 写为 `source_checkpoint`。完成条件:工作区可定位、基线可用、调用方记录与实际 provider、分支和 checkpoint 一致;Git provider 的引用与工作项 ID 完全一致。失败时在调用方拥有的记录中设为 `blocked` 并保留现场。
@@ -4,10 +4,17 @@
4
4
 
5
5
  仅生产 Ticket 进入本段;一次性原型不得合入生产分支。
6
6
 
7
- 1. workspace owner 确认记录为 `review`,读取 implementation owner 的 Evidence,实际修改未越过路径契约。
8
- 2. 在目标集成基线上应用变更并运行受影响的定向与回归验证。
9
- 3. 仅当变更影响用户界面交互时,由当前集成 owner 运行验收所需的最小 E2E;委派执行中 implementation owner 只提供场景和预期结果,Lead 负责运行。
10
- 4. 验证通过后将记录更新为 `integrated`;冲突或失败时设为 `blocked` 并保留 worktree。
7
+ 1. integration owner 确认记录为 `review`、`terminal_action=integrate`,读取 implementation owner 的 Evidence,并验证实际修改未越过 writable/shared owner 合同。`source_checkpoint` 必须是不可变 commit,且与记录 branch 当前 tip 一致、从 `base_sha` 可达。
8
+ 2. 确认目标 checkout 正位于 `parent_branch`、index 与项目 working tree 干净,并把当前 HEAD 固定为 `parent_before_sha`。目标不干净、父分支不匹配、其他记录已在同一父分支 `integrating` 或 HEAD 在集成期间变化时停止,不覆盖用户工作。
9
+ 3. 将记录原子更新为 `integrating`,设置 `integration.status=running`、`parent_before_sha`、`source_sha` 并递增 `attempts`。中断恢复时先核对记录、Git `MERGE_HEAD` 和当前 HEAD,不重复开始第二次集成。
10
+ 4. 恢复已有 `integrating` 记录时只进入一个分支:HEAD 仍等于 `parent_before_sha` 且没有 `MERGE_HEAD` 时恢复同一次尝试;HEAD 已等于 `source_checkpoint`、没有 `MERGE_HEAD` 且 `parent_before_sha` 可达来源时,将其视为已完成但尚未落状态的 fast-forward;`MERGE_HEAD` 等于 `source_checkpoint` 时恢复未完成 merge。其他 HEAD、来源或 merge 状态漂移一律设为 `blocked`,不修改 Git 现场。
11
+ 5. 若 `parent_before_sha` 是 `source_checkpoint` 的祖先,先在来源 workspace 运行 Ticket 定向验证、受影响回归、项目 typecheck/lint/build 和适用最小 E2E,再从目标 checkout 执行 `git merge --ff-only <source_checkpoint>`。重读目标 HEAD、tree 和 Evidence,确认 HEAD 精确等于 `source_checkpoint` 后,记录 `method=fast-forward`、`result_sha=source_checkpoint`、空 `conflict_paths`、验证命令与结果、`verification=passed`、Evidence 和 `integration.status=passed`,再把 worktree 状态更新为 `integrated`。这是 fast-forward 的终态,不继续执行 merge-commit 步骤。
12
+ 6. 若双方已分叉,从干净目标 checkout 执行 `git merge --no-ff --no-commit <source_checkpoint>`。出现冲突时加载 `<Path>{roots.workflows}/specdev/I-implement/merge-conflict-protocol.md</Path>`,并将本记录作为持久授权来源;不为 `git add`、继续 merge 或集成提交重复请求确认。
13
+ 7. 在未提交的合并结果上运行 Ticket 定向验证、受影响回归、项目 typecheck/lint/build 和适用最小 E2E。可由既有意图机械修正的失败最多处理 3 轮;不得放宽断言、删除检查或引入未批准行为。
14
+ 8. 验证通过后完成一次集成专用 merge commit,重读 HEAD、parents、tree、diff 和 Evidence,确认父分支为第一 parent、`source_checkpoint` 为第二 parent,记录 `method=merge-commit`、`result_sha`、conflict paths、`verification=passed`、Evidence 与 `integration.status=passed`,再把 worktree 状态更新为 `integrated`。
15
+ 9. 冲突需要新产品/架构/安全/迁移决定、修改越过授权路径、验证无法通过、目标状态漂移或提交 hook 无法安全完成时,执行 `git merge --abort`(仅限本流程从干净目标开始的 merge),设置 worktree 与 integration 为 `blocked`,记录最小失败、已通过行为和恢复条件,并保留来源 worktree。
16
+
17
+ Fast-forward 路径的 `result_sha` 等于 `source_checkpoint`;merge-commit 路径必须保持父分支为第一 parent、来源 checkpoint 为第二 parent。任何成功结果都必须能从记录和 Evidence 复核。
11
18
 
12
19
  ## 清理
13
20
 
@@ -15,4 +22,4 @@
15
22
  2. Git provider 从 project root 解析 `specdev-worktree/<work-item-id>`,重验无路径逃逸且与 `git worktree list --porcelain` 的记录一致,再从主工作树移除;native/external 通过对应 provider 管理入口移除。
16
23
  3. 确认 worktree 不再注册且工作项目录不存在后删除对应分支。Ticket 将状态更新为 `removed`;原型把 `cleanup_status` 更新为 `clean`。保留项目根 `specdev-worktree/` 统一目录及 `.gitignore` 条目。
17
24
 
18
- PR 或暂缓集成时保留 worktree。清理失败时停止;仅在用户明确要求时使用强制删除。
25
+ PR、`terminal_action=retain` 或暂缓集成时保留 worktree。成功集成也不自动清理。清理失败时停止;仅在用户明确要求时使用强制删除。
@@ -11,11 +11,12 @@ description: 交付合同:只为用户已选择委派的 Goal Plan 生成可
11
11
 
12
12
  - `operation`:`plan` 或 `execute`;
13
13
  - `execution_model`:`native-subagent` 或 `external-web-subagent`;
14
+ - mutation role:`read-only`、`lead-write` 或 `worker-write`,以及独立确定的 workspace allocation;
14
15
  - Lead、Ticket、Goal Plan、Spec、适用 ADR/CONTEXT、Wave/Gate 和依赖 Evidence;
15
16
  - 项目写、只读和 shared 路径,验证矩阵与当前源码基线;
16
17
  - provider、会话或 workspace locator、源码交付方式,以及用户当前明确授权。
17
18
 
18
- 普通 Goal Plan 和缺失 Goal Plan 的 Ticket 直接由 `<Path>{roots.workflows}/specdev/I-implement/I-implement.md</Path>` 执行,不调用本 Skill。委派输入缺失时返回调用方补齐,不猜测 checkpoint、权限或验收结果。
19
+ `single-session` Goal Plan 和缺失 Goal Plan 的 Ticket 直接由 `<Path>{roots.workflows}/specdev/I-implement/I-implement.md</Path>` 执行,不调用本 Skill;只读辅助 Agent 由对应 research/review 能力管理。Lead Team 输入缺失时返回调用方补齐,不猜测 checkpoint、权限或验收结果。
19
20
 
20
21
  ## 流程
21
22
 
@@ -23,7 +24,7 @@ description: 交付合同:只为用户已选择委派的 Goal Plan 生成可
23
24
 
24
25
  一个交付链只有一个 Lead。Lead 保留需求解释、仓库保护、Wave/Gate、shared owner、权限控制、交付集成、独立验收和最终状态同步责任。
25
26
 
26
- 将本次请求解析为逐动作授权:local changes、commit、push、PR、merge、deploy、migration、production configuration、production feature 和 real user data。未明确授权的动作记为 `not-authorized`;项目指令、历史授权和 Agent 建议不扩大权限。
27
+ 将本次请求解析为逐动作授权:local changes、implementation commit、local worktree integration、push、PR、remote merge、deploy、migration、production configuration、production feature 和 real user data。未明确授权的动作记为 `not-authorized`;项目指令、历史授权和 Agent 建议不扩大权限。`terminal_action=integrate` 只满足对应 Ticket 的 local worktree integration,不扩展其他动作。
27
28
 
28
29
  **完成标准**:`operation` 和 `execution_model` 唯一;Lead、授权动作、目标和条件均可判定。
29
30
 
@@ -44,7 +45,7 @@ description: 交付合同:只为用户已选择委派的 Goal Plan 生成可
44
45
 
45
46
  ### 4. 规划或执行交付合同
46
47
 
47
- `operation=plan` 时,向调用方返回:里程碑级 Delivery Contract,以及每个 Ticket 的独立 Dispatch Packet。每个派单块必须包含目标、权威输入、边界优先级、路径合同、依赖证据、基线、验证与反向验证、授权、恢复 locator、最多修正轮次和返回字段。调用方将它写入 `<Path>{roots.state}/specdev/changes/{change}/goal-plan.md</Path>`,不复制完整历史对话或 Ticket 全文。
48
+ `operation=plan` 时,向调用方返回:里程碑级 Delivery Contract,以及每个 Ticket 的独立 Dispatch Packet。每个派单块必须包含目标、权威输入、边界优先级、路径合同、mutation role、workspace allocation、依赖证据、基线、验证与反向验证、授权、恢复 locator、最多修正轮次和返回字段。`worker-write` 没有独立 workspace 时拒绝规划;read-only 不得返回项目或状态写入。调用方将结果写入 `<Path>{roots.state}/specdev/changes/{change}/goal-plan.md</Path>`,不复制完整历史对话或 Ticket 全文。
48
49
 
49
50
  `operation=execute` 时,先核对派单块与当前 Goal Plan、Ticket、基线和权限;再接收原生 Worker 或外部 provider 的候选交付,检查范围与事实声明,由 Lead 运行适用验证,并把结果写入 `<Path>{roots.state}/specdev/changes/{change}/evidence/{ticket-id}.md</Path>`。外部声明、截图或模拟结果在 Lead 复核前保持 `unverified`。
50
51
 
@@ -18,7 +18,7 @@
18
18
  2. 用户结果、里程碑位置、相关模块、公共契约和领域不变量;
19
19
  3. allowed/read-only/shared 路径、保留行为和依赖策略;
20
20
  4. 需要返回的方案、修改清单、patch/源码、测试、实际命令和风险;
21
- 5. 当前授权矩阵与逐项验收标准;
21
+ 5. mutation role、workspace allocation、当前授权矩阵与逐项验收标准;
22
22
  6. 未实际运行的检查必须标记 `unverified`。
23
23
 
24
24
  公开仓库 URL 使用 `<Url>https://example.com/owner/repository</Url>` 形式并同时给出 branch 与 checkpoint。Provider 无法读取仓库、需要私有上下文或固定工作区快照时使用 source-package 分支。
@@ -14,7 +14,7 @@ ticket_path=<full-ticket-path> evidence_path=<full-evidence-path>
14
14
 
15
15
  派单块还必须给出项目 `writable_paths`、`read_only_paths`、`shared_paths`、完成的依赖 Evidence、合同 ID、验证矩阵、反向验证、权限和偏差升级方式。Agent 先核对基线与路径,再用不超过 10 行的开工回执记录目标、顺序和最大风险;回执写入 Ticket Evidence,不新增进度文件。
16
16
 
17
- 并行写代码时由 Lead 调用 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/SKILL.md</Path>`。所有并行 Ticket 固定同一 `base_sha`,使用独立分支和 `workspace_ref`;Agent 只修改获准项目路径,只把 Ticket 推进到 `review`。
17
+ 派单必须标记 mutation role。`read-only` Agent 只返回结论;`lead-write` 不把项目写入委派给 Agent;`worker-write` 必须引用已规划的独立 workspace,由其 integration owner 调用 `<Path>{roots.workflows}/specdev/common/skills/dev-worktree/SKILL.md</Path>` 管理。多个并行写入 Ticket 固定同一 `base_sha`,分别使用独立分支和 `workspace_ref`;Agent 只修改获准项目路径,只把 Ticket 推进到 `review`。
18
18
 
19
19
  ## 审查与修正
20
20
 
@@ -29,7 +29,6 @@ ticket_path=<full-ticket-path> evidence_path=<full-evidence-path>
29
29
 
30
30
  ## 返回
31
31
 
32
- Agent 返回 Ticket 状态、`<Path>{roots.state}/specdev/changes/{change}/evidence/{ticket-id}.md</Path>`、`workspace_ref`、checkpoint、commit/PR 引用和待 Lead E2E。Lead 负责应用或集成、回归、Gate 判断和状态同步;逻辑冲突返回契约 owner,不机械选择某一侧版本。
32
+ Agent 返回 Ticket 状态、`<Path>{roots.state}/specdev/changes/{change}/evidence/{ticket-id}.md</Path>`、`workspace_ref`、checkpoint、commit/PR 引用和待 Lead E2E。Lead 负责候选验收、回归、Gate 判断和状态同步;只有 workspace allocation 指定时才承担 integration owner。逻辑冲突返回契约 owner,不机械选择某一侧版本。
33
33
 
34
34
  **完成标准**:派单、工作区、路径修改、审查、修正和返回均可由 Goal Plan、Evidence 与 change 状态恢复。
35
-