@aipper/aiws-spec 0.0.43 → 0.0.45
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/docs/ws-goal-contract.md +186 -5
- package/package.json +1 -1
- package/templates/workspace/.opencode/command/ws-bugfix.md +2 -2
- package/templates/workspace/.opencode/command/ws-dev.md +2 -2
- package/templates/workspace/.opencode/command/ws-plan.md +1 -1
- package/templates/workspace/.opencode/commands/ws-bugfix.md +2 -2
- package/templates/workspace/.opencode/commands/ws-dev.md +2 -2
- package/templates/workspace/.opencode/commands/ws-plan.md +1 -1
- package/templates/workspace/.opencode/scripts/ws-plan-setup-worktree.sh +2 -2
- package/templates/workspace/.opencode/skills/p-aiws-change-start/SKILL.md +3 -5
- package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +5 -5
- package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-goal/SKILL.md +51 -14
- package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +1 -1
package/docs/ws-goal-contract.md
CHANGED
|
@@ -171,14 +171,25 @@ ws-goal 在执行 pipeline delegation(管道委托,见 1.§ 第四步)之
|
|
|
171
171
|
═══════════════════════
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
#### 2.5.4
|
|
174
|
+
#### 2.5.4 确认门禁(分级处理)
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
报告输出后,按影响等级分级处理:
|
|
177
|
+
|
|
178
|
+
| 等级 | 行为 |
|
|
179
|
+
|------|------|
|
|
180
|
+
| **NONE** | 自动继续。发现项记录到 Audit Trail,不阻断 |
|
|
181
|
+
| **LOW** | 自动继续。输出提示,发现项记录到 Audit Trail |
|
|
182
|
+
| **MED** | 自动继续。输出警告信息,发现项记录到 Audit Trail |
|
|
183
|
+
| **HIGH** | **阻断**。必须等待用户确认后才能继续 |
|
|
184
|
+
|
|
185
|
+
**HIGH 阻断确认选项**:
|
|
177
186
|
- **继续** → 进入 pipeline delegation
|
|
178
187
|
- **暂停** → goal status=paused,报告写入 Audit Trail
|
|
179
188
|
- **先清理** → goal status=paused,输出清理建议步骤
|
|
180
189
|
|
|
181
|
-
|
|
190
|
+
用户未确认 HIGH 阻断项,不得进入 delegation。
|
|
191
|
+
|
|
192
|
+
> **设计原则**:LOW/MED 发现项不应阻断工作流。它们被记录到 Audit Trail 供后续回溯,但不需要用户停下当前工作。HIGH 发现项才是真正的风险门禁,必须有用户显式授权放行。
|
|
182
193
|
|
|
183
194
|
---
|
|
184
195
|
|
|
@@ -379,9 +390,50 @@ Auto-resume 时输出以下通知(含问题级进度展示,但不需要用
|
|
|
379
390
|
2. 启发式判断已 frozen 问题:找到第一个未回答的问题标记,之前的都算 frozen
|
|
380
391
|
3. 生成 state.json,status=in_progress
|
|
381
392
|
|
|
382
|
-
|
|
393
|
+
#### 3.2.9 上下文感知 INTAKE(Context-Aware Intake)
|
|
394
|
+
|
|
395
|
+
**问题**:用户可能在未使用 ws-goal 的情况下已经开始工作(如直接修 bug、做重构、编写代码)。此时执行 ws-goal,PHASE 0 INTAKE 从空白开始提问,用户需要重新陈述已做的工作,体验割裂。
|
|
396
|
+
|
|
397
|
+
**方案**:PHASE 0 在开始对抗式审问前,先扫描工作区获取上下文信号,预填充 intake 的初始答案。
|
|
398
|
+
|
|
399
|
+
**扫描信号**:
|
|
400
|
+
|
|
401
|
+
| 信号 | 来源 | 可靠性 |
|
|
402
|
+
|------|------|--------|
|
|
403
|
+
| 未提交变更 | `git diff --stat` | 高(具体文件与改动量) |
|
|
404
|
+
| 最近提交 | `git log --oneline -5` | 高(可反映近期工作主题) |
|
|
405
|
+
| Change 分支 | `git branch --list 'change/*'` | 高(aiws 管理的分支) |
|
|
406
|
+
| 孤立 intake 草稿 | `.aiws/plan/*.intake.md` | 高(aiws 工件) |
|
|
407
|
+
| 进行中的 intake | `.aiws/intake/*.state.json` | 高(aiws 工件) |
|
|
408
|
+
| 暂存的工作 | `git stash list` | 中(可能有无关的 stash) |
|
|
409
|
+
|
|
410
|
+
**不使用的信号**:会话日志(短暂/有损)、lsp_diagnostics(与意图无关)。
|
|
411
|
+
|
|
412
|
+
**退化处理**:非 git 目录下,所有 git 命令(`git diff --stat`、`git log`、`git branch --list`、`git stash list`)应检测并静默跳过,对应信号标记为 `unavailable`。扫描退化为仅依赖非 git 信号(孤立 intake 草稿、进行中的 intake state.json)。若全部信号均不可用,输出"未检测到现有工作上下文",intake 从空白开始。
|
|
413
|
+
|
|
414
|
+
**大篇幅截断**:`git diff --stat` 输出超过 20 行(约 20 个文件)时,截断为"`<N> files changed, <+M>/-R`"总计行,不再逐文件列出。完整 diff 可通过 `git diff --stat` 查看。`git log --oneline -5` 保持最多 5 条不变。
|
|
415
|
+
|
|
416
|
+
**输出格式**:
|
|
417
|
+
|
|
418
|
+
```text
|
|
419
|
+
═══ 工作区上下文 ═══
|
|
420
|
+
未提交改动: BizDeviceRepo.kt (+12 -0) — 修复 activeType 过滤
|
|
421
|
+
最近提交: "fix: device/pages filter activeType and deviceId"
|
|
422
|
+
Change 分支: change/fix-auth (3 commits, 未合并)
|
|
423
|
+
孤立 Intake: .aiws/plan/20240115-auth-intake.md (3/5 问题已冻结)
|
|
424
|
+
════════════════════
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**预填规则**:
|
|
383
428
|
|
|
384
|
-
|
|
429
|
+
1. 扫描输出作为上下文摘要,嵌入 intake 草案开头
|
|
430
|
+
2. 对抗式审问的初始问题答案以此上下文预填(用户可见并可修改确认)
|
|
431
|
+
3. 预填内容不影响 checkpoint 机制——所有 checkpoint 仍为 pending,不从预填内容推导阶段完成
|
|
432
|
+
4. 工作区上下文扫描是 intake 阶段的内部实现细节,不影响外部协议接口(goal.md、state.json 格式不变)
|
|
433
|
+
5. 若扫描无任何发现(空工作区),输出"未检测到现有工作上下文",intake 从空白开始
|
|
434
|
+
6. 预填的 intake 问题答案状态为 `prefill_pending`(非 `frozen`)。用户必须显式确认后状态才变为 `frozen`。此规则将"no checkpoint backfilling"原则延续到 intake 问题级:预填是初始提示(prompt),不从预填内容推导问题已冻结,不绕过用户的确认权。`.aiws/intake/<id>.state.json` 中问题 `status` 字段在预填状态下仍保持 `pending`,直到用户确认后才写入 `frozen`。
|
|
435
|
+
|
|
436
|
+
**设计原则**:缩短用户输入成本,不改变审计完整性。上下文预填是提示(prompt)而非判断(judgment)——用户始终拥有最终确认权。
|
|
385
437
|
|
|
386
438
|
完成审计使用的证据类型:
|
|
387
439
|
|
|
@@ -1030,6 +1082,14 @@ Instructions: Continue from the failed phase. Do NOT redo completed phases.
|
|
|
1030
1082
|
|
|
1031
1083
|
当前协议依赖主 session 在 phase 完成后手动判断"已完成 phase X,现在开始 phase Y"。这个判断是纯机械的,每次都重复一样逻辑。Auto-Advance 将此机械工作自动化,减少阶段转换摩擦。
|
|
1032
1084
|
|
|
1085
|
+
**覆盖范围**:Auto-Advance 适用于完整 phase 生命周期,不仅限于 pipeline 内部的 PLAN→DEV→REVIEW→FINISH 阶段间推进。它同样适用于:
|
|
1086
|
+
- INTAKE → GOAL_DEF(intake 无 UNRESOLVED_BRANCH 时自动推进)
|
|
1087
|
+
- GOAL_DEF → DEP_CHECK(goal 定义完成后自动进入依赖链预检)
|
|
1088
|
+
- DEP_CHECK → WS_ANALYSIS(依赖链通过后自动进入工作区分析)
|
|
1089
|
+
- WS_ANALYSIS → PLAN(工作区分析无 HIGH 阻断项时自动进入 PLAN)
|
|
1090
|
+
|
|
1091
|
+
唯一需要人工确认的 phase 转换:**当前 phase 存在真实阻断项时**(UNRESOLVED_BRANCH、依赖链 UNHEALTHY、工作区分析 HIGH、PLAN 多分支无明确推荐)。这些阻断必须由 §2.5.4、§2.4.3 或 §7.9.2 的规则产生,不得在无阻断时额外询问用户。
|
|
1092
|
+
|
|
1033
1093
|
#### 7.8.2 Mechanism
|
|
1034
1094
|
|
|
1035
1095
|
使用基于 **state.json checkpoint 文件产出**的自动推进,不依赖文本标记(如 `PHASE_DONE` 字符串):
|
|
@@ -1127,3 +1187,124 @@ Auto-Advance 在降级模式下仍然适用,但推进逻辑调整:
|
|
|
1127
1187
|
- 全 goal 降级模式(§6.8.5)下,Auto-Advance 的 phase 序列变为:`intake → goal_def → dep_check → ws_analysis → plan → dev (degraded) → review → finish`
|
|
1128
1188
|
|
|
1129
1189
|
**即**:降级模式改变的是*执行方式*(batch-edit vs delegation),不改变 checkpoint 状态机。Auto-Advance 不关心执行方式,只关心 checkpoint 状态。
|
|
1190
|
+
|
|
1191
|
+
### 7.9 Structured Decision Support
|
|
1192
|
+
|
|
1193
|
+
#### 7.9.1 Motivation
|
|
1194
|
+
|
|
1195
|
+
某些决策点(如 PLAN 产出后的多分支选择)需要业务判断,不能完全自动化。但是,当前模式要求用户从原始计划产出中自行推导选项和权衡,认知负担高。
|
|
1196
|
+
|
|
1197
|
+
**原则**:AI 做分析、结构化和建议,用户做决策。不在无阻断时提问,但在真正需要判断时提供预处理的选项。
|
|
1198
|
+
|
|
1199
|
+
#### 7.9.2 触发条件
|
|
1200
|
+
|
|
1201
|
+
结构化决策支持适用于以下场景:
|
|
1202
|
+
|
|
1203
|
+
| 场景 | 产出物 | 说明 |
|
|
1204
|
+
|------|--------|------|
|
|
1205
|
+
| **PLAN 多分支选择** | PLAN 产出包含多个可行路径 | 如"Phase1&2 vs Phase3 vs 修 P0 stub" |
|
|
1206
|
+
| **修复方案选择** | 同一问题有多种修复方式 | 如"回滚 vs 热修复 vs 临时规避" |
|
|
1207
|
+
| **优先级排序** | 多个独立任务需决定执行顺序 | 如"先修高风险 bug vs 先加固测试" |
|
|
1208
|
+
|
|
1209
|
+
#### 7.9.3 输出格式
|
|
1210
|
+
|
|
1211
|
+
当出现多分支时,主 session 必须将选项格式化为结构化建议块:
|
|
1212
|
+
|
|
1213
|
+
```text
|
|
1214
|
+
══════ 决策建议 ══════
|
|
1215
|
+
分支 A:<标题>
|
|
1216
|
+
内容:<该分支包含的具体工作>
|
|
1217
|
+
风险:<风险评估>
|
|
1218
|
+
预估:<时间/工作量>
|
|
1219
|
+
推荐理由:<何时选择此分支>
|
|
1220
|
+
|
|
1221
|
+
分支 B:<标题>
|
|
1222
|
+
内容:<该分支包含的具体工作>
|
|
1223
|
+
风险:<风险评估>
|
|
1224
|
+
预估:<时间/工作量>
|
|
1225
|
+
推荐理由:<何时选择此分支>
|
|
1226
|
+
|
|
1227
|
+
推荐:<分支 A/B/C 及理由>
|
|
1228
|
+
═══════════════════════
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
用户从选项中确认选择。仅在无明确推荐时(如各分支风险/收益相近)才需要用户主动分析。
|
|
1232
|
+
|
|
1233
|
+
#### 7.9.4 与 Oracle 集成
|
|
1234
|
+
|
|
1235
|
+
当 PLAN 产出包含多分支时,可委托 Oracle 分析各分支的代码级影响,生成结构化建议块:
|
|
1236
|
+
|
|
1237
|
+
```
|
|
1238
|
+
PLAN 产出 → Oracle 读 PLAN + 代码扫描 + git 历史
|
|
1239
|
+
→ 分析各分支风险/工作量/依赖
|
|
1240
|
+
→ 输出结构化建议块(§7.9.3 格式)
|
|
1241
|
+
→ 主 session 呈现给用户
|
|
1242
|
+
```
|
|
1243
|
+
|
|
1244
|
+
Oracle 的 role 是**决策支持**(decision support),不是**决策制定**(decision making)。用户始终拥有最终决策权。
|
|
1245
|
+
|
|
1246
|
+
### 7.10 Oracle-Advisor Protocol Role
|
|
1247
|
+
|
|
1248
|
+
#### 7.10.1 定义
|
|
1249
|
+
|
|
1250
|
+
Oracle-Advisor 是一个可选的协议角色,用于在决策点提供分析支持。它不是一个独立的阶段或执行者,而是在主 session 编排中按需调用的**只读顾问**。
|
|
1251
|
+
|
|
1252
|
+
#### 7.10.2 触发条件
|
|
1253
|
+
|
|
1254
|
+
| 决策点 | 自动执行 | Oracle 参与模式 |
|
|
1255
|
+
|--------|---------|----------------|
|
|
1256
|
+
| Intake → Plan 转换 | ✅ 自动(无阻断时) | 无需 Oracle |
|
|
1257
|
+
| 工作区分析 LOW/MED | ✅ 自动(§2.5.4) | 无需 Oracle |
|
|
1258
|
+
| 工作区分析 HIGH | ❌ 用户确认 | Oracle 可辅助分析 HIGH 项是否可降级 |
|
|
1259
|
+
| 依赖链 UNHEALTHY | ❌ 用户确认(§2.4.3) | Oracle 可分析 UNHEALTHY 的实际影响范围 |
|
|
1260
|
+
| PLAN 多分支选择 | ❌ 用户决策(§7.9) | **Oracle 生成结构化建议块(§7.9.3)** |
|
|
1261
|
+
| 阶段间推进 | ✅ Auto-Advance(§7.8) | 无需 Oracle |
|
|
1262
|
+
|
|
1263
|
+
#### 7.10.3 角色约束
|
|
1264
|
+
|
|
1265
|
+
| 维度 | 约束 |
|
|
1266
|
+
|------|------|
|
|
1267
|
+
| **读取范围** | 仅当前决策点相关的工件(PLAN 产出、代码扫描片段、git 历史摘要)。不得读取未关联文件 |
|
|
1268
|
+
| **写入范围** | 仅写入 `changes/<id>/analysis/oracle-decision-<phase>.md` 或显示在会话输出中。不得修改任何代码/工件 |
|
|
1269
|
+
| **输出格式** | 必须包含:分析摘要、置信度信号、推荐选项及理由、升级路径 |
|
|
1270
|
+
| **不可访问时** | 降级为不依赖 Oracle 的建议,仍用 §7.9.3 格式输出(由主 session 直接生成结构化块) |
|
|
1271
|
+
|
|
1272
|
+
#### 7.10.4 工件格式
|
|
1273
|
+
|
|
1274
|
+
Oracle 的分析输出必须写入 `changes/<id>/analysis/oracle-decision-<phase>.md`:
|
|
1275
|
+
|
|
1276
|
+
```markdown
|
|
1277
|
+
---
|
|
1278
|
+
oracle_advisor:
|
|
1279
|
+
phase: <phase 名称>
|
|
1280
|
+
triggered_at: <ISO 8601>
|
|
1281
|
+
confidence: high | medium | low
|
|
1282
|
+
---
|
|
1283
|
+
|
|
1284
|
+
## 分析摘要
|
|
1285
|
+
|
|
1286
|
+
<5 行以内的分析总结>
|
|
1287
|
+
|
|
1288
|
+
## 置信度信号
|
|
1289
|
+
|
|
1290
|
+
| 信号 | 评估 | 说明 |
|
|
1291
|
+
|------|------|------|
|
|
1292
|
+
| 证据完整性 | high/medium/low | 所需工件是否齐全 |
|
|
1293
|
+
| 规范规则 | deterministic/ambiguous | 规范是否明确规定了行为 |
|
|
1294
|
+
| 业务依赖 | none/partial/critical | 决策是否需要业务上下文 |
|
|
1295
|
+
|
|
1296
|
+
## 推荐选项
|
|
1297
|
+
|
|
1298
|
+
<结构化建议块,见 §7.9.3>
|
|
1299
|
+
|
|
1300
|
+
## 升级路径
|
|
1301
|
+
|
|
1302
|
+
<如果 confidence=medium 或 low,说明什么条件下应升级到用户>
|
|
1303
|
+
```
|
|
1304
|
+
|
|
1305
|
+
#### 7.10.5 与 §7.8 Auto-Advance 的关系
|
|
1306
|
+
|
|
1307
|
+
- Auto-Advance 负责**机械性 phase 推进**(无分支、无阻断时自动走)
|
|
1308
|
+
- Oracle-Advisor 负责**决策点分析**(有分支或阻断时提供结构化建议)
|
|
1309
|
+
- 两者不重叠:Auto-Advance 在无阻断时自动推进;Oracle-Advisor 在决策点提供信息支持
|
|
1310
|
+
- Oracle-Advisor 分析完成后,主 session 或用户做出最终决定,然后 Auto-Advance 继续推进
|
package/package.json
CHANGED
|
@@ -13,8 +13,8 @@ description: 缺陷修复:禅道 MCP 拉单、图片证据落盘并汇总 fix_
|
|
|
13
13
|
1) 先运行 `/ws-preflight`。
|
|
14
14
|
2) 若当前不在 `change/<change-id>` 分支 / worktree,先建立 change 上下文:
|
|
15
15
|
- 工作区先保持干净
|
|
16
|
-
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --
|
|
17
|
-
- superproject + submodule:优先 `aiws change start <change-id> --hooks --
|
|
16
|
+
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --switch`
|
|
17
|
+
- superproject + submodule:优先 `aiws change start <change-id> --hooks --switch`
|
|
18
18
|
- 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
|
|
19
19
|
3) 若上一步创建了 worktree:后续 bug 证据、CSV 更新、`/ws-dev` 修复都必须在该 worktree 中继续。
|
|
20
20
|
4) 通过已配置 zentao MCP 拉取 bug 字段与附件列表。
|
|
@@ -14,11 +14,11 @@ description: 开发:在 AIWS 约束下完成小步交付
|
|
|
14
14
|
2) 建立变更归因(推荐):
|
|
15
15
|
- ⚠️ 若准备切分支/创建 worktree,先看 `git status --porcelain`;否则切换上下文后,未提交改动可能“看起来丢了”。
|
|
16
16
|
- 若当前目录已经是 `change/<change-id>` worktree(例如由 `/ws-plan` 创建):直接在这里继续,不要再创建第二个 worktree,也不要回原工作区写代码。
|
|
17
|
-
- 若非空仅因为 `/ws-plan` 生成了 `plan/...` 或 `changes/<change-id>/...`,这是预期行为;此时优先 `aiws change start <change-id> --hooks --no-switch`,若仍要 `--switch
|
|
17
|
+
- 若非空仅因为 `/ws-plan` 生成了 `plan/...` 或 `changes/<change-id>/...`,这是预期行为;此时优先 `aiws change start <change-id> --hooks --no-switch`,若仍要 `--switch`,先提交这些规划工件。
|
|
18
18
|
- 推荐更安全(默认):`aiws change start <change-id> --hooks --no-switch`(只创建分支/工件 + 启用 hooks;不切分支)
|
|
19
19
|
- 准备进入实现时:若当前已在 `change/<change-id>` 直接继续;若需切换到该分支,先确认除规划工件外无额外未提交改动,再执行:`git switch change/<change-id>`
|
|
20
20
|
- 若你明确要“一键切分支”(不推荐,且 dirty 会被拦截):`aiws change start <change-id> --hooks --switch`
|
|
21
|
-
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --
|
|
21
|
+
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --switch`
|
|
22
22
|
- 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
|
|
23
23
|
- 或手工:`git switch -c change/<change-id>`,并创建 `changes/<change-id>/proposal.md` 与 `changes/<change-id>/tasks.md`(参考 `changes/README.md`)
|
|
24
24
|
3) 如涉及需求调整:先 `/ws-req-review` → 用户确认后再 `/ws-req-change`(避免需求漂移)。
|
|
@@ -14,7 +14,7 @@ description: 规划:生成可落盘 plan 工件
|
|
|
14
14
|
- 若检测到 `.opencode/oh-my-opencode.json` 或当前会话明确可用 `planner-sisyphus` / `explore` / `librarian`:优先按 `packages/spec/docs/opencode-omo-adapter.md` 借用这些 agent。
|
|
15
15
|
- 计划主框架优先 `planner-sisyphus`;结构探索优先 `@explore`;规范/文档查证优先 `@librarian`。
|
|
16
16
|
2) 若当前不在 `change/<change-id>` 分支 / worktree,先调用 `aiws change start <change-id>` 建立上下文:
|
|
17
|
-
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --
|
|
17
|
+
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --switch`
|
|
18
18
|
- 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
|
|
19
19
|
3) 若上一步创建了 worktree:切到输出的 `worktree:` 路径,后续所有计划文件都写在该 worktree 中。
|
|
20
20
|
4) 生成或更新计划文件:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`。
|
|
@@ -13,8 +13,8 @@ description: 缺陷修复:禅道 MCP 拉单、图片证据落盘并汇总 fix_
|
|
|
13
13
|
1) 先运行 `/ws-preflight`。
|
|
14
14
|
2) 若当前不在 `change/<change-id>` 分支 / worktree,先建立 change 上下文:
|
|
15
15
|
- 工作区先保持干净
|
|
16
|
-
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --
|
|
17
|
-
- superproject + submodule:优先 `aiws change start <change-id> --hooks --
|
|
16
|
+
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --switch`
|
|
17
|
+
- superproject + submodule:优先 `aiws change start <change-id> --hooks --switch`
|
|
18
18
|
- 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
|
|
19
19
|
3) 若上一步创建了 worktree:后续 bug 证据、CSV 更新、`/ws-dev` 修复都必须在该 worktree 中继续。
|
|
20
20
|
4) 通过已配置 zentao MCP 拉取 bug 字段与附件列表。
|
|
@@ -14,11 +14,11 @@ description: 开发:在 AIWS 约束下完成小步交付
|
|
|
14
14
|
2) 建立变更归因(推荐):
|
|
15
15
|
- ⚠️ 若准备切分支/创建 worktree,先看 `git status --porcelain`;否则切换上下文后,未提交改动可能“看起来丢了”。
|
|
16
16
|
- 若当前目录已经是 `change/<change-id>` worktree(例如由 `/ws-plan` 创建):直接在这里继续,不要再创建第二个 worktree,也不要回原工作区写代码。
|
|
17
|
-
- 若非空仅因为 `/ws-plan` 生成了 `plan/...` 或 `changes/<change-id>/...`,这是预期行为;此时优先 `aiws change start <change-id> --hooks --no-switch`,若仍要 `--switch
|
|
17
|
+
- 若非空仅因为 `/ws-plan` 生成了 `plan/...` 或 `changes/<change-id>/...`,这是预期行为;此时优先 `aiws change start <change-id> --hooks --no-switch`,若仍要 `--switch`,先提交这些规划工件。
|
|
18
18
|
- 推荐更安全(默认):`aiws change start <change-id> --hooks --no-switch`(只创建分支/工件 + 启用 hooks;不切分支)
|
|
19
19
|
- 准备进入实现时:若当前已在 `change/<change-id>` 直接继续;若需切换到该分支,先确认除规划工件外无额外未提交改动,再执行:`git switch change/<change-id>`
|
|
20
20
|
- 若你明确要“一键切分支”(不推荐,且 dirty 会被拦截):`aiws change start <change-id> --hooks --switch`
|
|
21
|
-
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --
|
|
21
|
+
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --switch`
|
|
22
22
|
- 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
|
|
23
23
|
- 或手工:`git switch -c change/<change-id>`,并创建 `changes/<change-id>/proposal.md` 与 `changes/<change-id>/tasks.md`(参考 `changes/README.md`)
|
|
24
24
|
3) 如涉及需求调整:先 `/ws-req-review` → 用户确认后再 `/ws-req-change`(避免需求漂移)。
|
|
@@ -14,7 +14,7 @@ description: 规划:生成可落盘 plan 工件
|
|
|
14
14
|
- 若检测到 `.opencode/oh-my-opencode.json` 或当前会话明确可用 `planner-sisyphus` / `explore` / `librarian`:优先按 `packages/spec/docs/opencode-omo-adapter.md` 借用这些 agent。
|
|
15
15
|
- 计划主框架优先 `planner-sisyphus`;结构探索优先 `@explore`;规范/文档查证优先 `@librarian`。
|
|
16
16
|
2) 若当前不在 `change/<change-id>` 分支 / worktree,先调用 `aiws change start <change-id>` 建立上下文:
|
|
17
|
-
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --
|
|
17
|
+
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --switch`
|
|
18
18
|
- 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
|
|
19
19
|
3) 若上一步创建了 worktree:切到输出的 `worktree:` 路径,后续所有计划文件都写在该 worktree 中。
|
|
20
20
|
4) 生成或更新计划文件:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`。
|
|
@@ -22,9 +22,9 @@ fi
|
|
|
22
22
|
|
|
23
23
|
if [[ "${has_commits}" -eq 1 ]]; then
|
|
24
24
|
if [[ "${has_submodules}" -eq 1 ]]; then
|
|
25
|
-
aiws change start "${change_id}" --hooks --
|
|
25
|
+
aiws change start "${change_id}" --hooks --switch
|
|
26
26
|
else
|
|
27
|
-
aiws change start "${change_id}" --hooks --
|
|
27
|
+
aiws change start "${change_id}" --hooks --switch
|
|
28
28
|
fi
|
|
29
29
|
else
|
|
30
30
|
aiws change start "${change_id}" --hooks --no-switch
|
|
@@ -5,7 +5,7 @@ description: 私有:切分支并初始化变更工件(可选安装 hooks)
|
|
|
5
5
|
|
|
6
6
|
目标:
|
|
7
7
|
- 切到分支 `change/<change-id>` 并初始化 `.aiws/changes/<change-id>/` 工件
|
|
8
|
-
- 若检测到 `.gitmodules`(git submodules
|
|
8
|
+
- 若检测到 `.gitmodules`(git submodules),默认使用 `--no-switch` 避免切走 superproject 分支导致 submodule 状态混乱;传 `--switch` 可强制切换
|
|
9
9
|
|
|
10
10
|
要求:
|
|
11
11
|
- 需要 git 仓库;若不是 git 仓库先 `git init`
|
|
@@ -26,8 +26,6 @@ fi
|
|
|
26
26
|
- `--hooks`:同时执行 `aiws hooks install .`
|
|
27
27
|
- `--title <title>`:写入标题
|
|
28
28
|
- `--no-design`:不生成 design.md
|
|
29
|
-
- `--switch
|
|
29
|
+
- `--switch`:显式切换 superproject 分支(默认存在 `.gitmodules` 时不切换,传此参数强制切换)
|
|
30
30
|
- `--no-switch`:不切换当前分支(仅确保 `change/<change-id>` 分支存在并初始化工件);适用于 superproject + submodule 场景
|
|
31
|
-
- `--
|
|
32
|
-
- `--worktree-dir <path>`:覆盖 worktree 目录
|
|
33
|
-
- `--submodules`:在 worktree 内执行 `git submodule update --init --recursive`
|
|
31
|
+
- `--allow-dirty`:允许 dirty 工作区执行 start(不推荐)
|
|
@@ -24,11 +24,11 @@ description: 使用时机:从禅道/外部系统拉取 bug 进行修复时。
|
|
|
24
24
|
echo "error: dirty before ws-bugfix"; exit 2
|
|
25
25
|
fi
|
|
26
26
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if [[ -f .gitmodules ]] && git config --file .gitmodules --get-regexp '^submodule\..*\.path$' >/dev/null 2>&1; then
|
|
28
|
+
aiws change start <change-id> --hooks --switch
|
|
29
|
+
else
|
|
30
|
+
aiws change start <change-id> --hooks --switch
|
|
31
|
+
fi
|
|
32
32
|
else
|
|
33
33
|
aiws change start <change-id> --hooks --no-switch
|
|
34
34
|
fi
|
|
@@ -62,7 +62,7 @@ description: 使用时机:需要修改代码、配置、测试时。触发词
|
|
|
62
62
|
- `git status --porcelain` 仅有计划/工件文件 → 继续
|
|
63
63
|
- 创建新 change:`aiws change start <change-id> --hooks --no-switch`
|
|
64
64
|
- 切换分支:先确认无未提交改动,再 `git switch change/<change-id>`
|
|
65
|
-
- 有 submodule:准备好 `submodules.targets
|
|
65
|
+
- 有 submodule:准备好 `submodules.targets`(`aiws change start` 自动检测 `.gitmodules`)
|
|
66
66
|
|
|
67
67
|
### 3. 实现策略:默认 dispatch aiws-worker(Subagent-First)
|
|
68
68
|
|
|
@@ -44,26 +44,48 @@ ws-goal 不做的事:
|
|
|
44
44
|
v. 若用户选择全量重跑 → 重置 state.json 所有 checkpoints 为 pending,status=active,从头开始
|
|
45
45
|
c) 若未找到 state.json 但有 status=active 或 status=paused 的 .md 文件(旧格式迁移):
|
|
46
46
|
- 按 §7.6 迁移策略处理(自动生成 state.json 后全量重跑)
|
|
47
|
-
1)
|
|
48
|
-
|
|
47
|
+
1) **工作区上下文扫描(Context-Aware Intake)**:在开始 intake 问题前,先扫描工作区获取已有工作的上下文信号,用于预填充 intake 的初始问题答案:
|
|
48
|
+
- `git diff --stat`(未暂存的改动文件列表)
|
|
49
|
+
- `git log --oneline -5`(最近提交记录)
|
|
50
|
+
- `git branch --list 'change/*'`(已有 change 分支及状态)
|
|
51
|
+
- `git stash list`(暂存的工作)
|
|
52
|
+
- `.aiws/plan/*.intake.md`(孤立 intake 草稿)
|
|
53
|
+
- `.aiws/intake/*.state.json`(进行中的 intake)
|
|
54
|
+
- 扫描结果输出为压缩的上下文摘要:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
═══ 工作区上下文 ═══
|
|
58
|
+
未提交改动: BizDeviceRepo.kt (+12 -0) — 修复 activeType 过滤
|
|
59
|
+
最近提交: "fix: device/pages filter activeType and deviceId"
|
|
60
|
+
Change 分支: change/fix-auth (3 commits, 未合并)
|
|
61
|
+
孤立 Intake: .aiws/plan/20240115-auth-intake.md (3/5 问题已冻结)
|
|
62
|
+
════════════════════
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2) 将扫描到的上下文传递给下一步的 intake 对抗式审问,作为初始问题答案的预填参考。用户可见预填内容并可修改确认。
|
|
66
|
+
|
|
67
|
+
3) **运行改进后的 `/ws-intake`**(对抗式审问模式)对 goal objective 做逐条审问:
|
|
68
|
+
- 步骤 1 扫描的上下文自动作为 intake 问题的预填答案(用户可见并可修改)
|
|
49
69
|
- 推荐答案模式:对事实类/选择类问题先给出推荐(参考 `recommendAnswers` 配置)
|
|
50
70
|
- 决策树分支遍历:每条回答展开对应子分支,直到所有叶节点被消费
|
|
51
71
|
- 对抗式审问层:自动探查代码库寻找矛盾信号,挑战隐含假设,探测边缘案例
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
72
|
+
4) **产出 intake 草案**:写入 `plan/<timestamp>-<slug>.intake.md`,包含完整的决策树遍历记录,并在草案开头嵌入**步骤 1 的工作区上下文摘要**作为上下文来源记录
|
|
73
|
+
5) **阻塞检查**:若 intake 草案中存在 `UNRESOLVED_BRANCH`,输出阻塞报告并暂停。用户必须显式确认忽略或补充信息后才能进入 PHASE 1。
|
|
74
|
+
6) 将 intake 审问结果(已冻结的目标范围、约束、边界)传递到后续 goal objective 定义。
|
|
75
|
+
6a) **记录 checkpoint**:更新 `.aiws/goals/<goal-id>.state.json` → checkpoint `intake=complete` + `completed_at`
|
|
76
|
+
|
|
77
|
+
> **Auto-Advance**:若步骤 5 无 UNRESOLVED_BRANCH,步骤 6→6a→PHASE 1 自动推进,不需询问用户确认。参见 §7.8。
|
|
56
78
|
|
|
57
79
|
### PHASE 1 — GOAL 定义
|
|
58
80
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
7) 接受用户输入的 goal objective,明确目标范围与验收标准(基于 PHASE 0 的 intake 产出)。
|
|
82
|
+
8) 按 ws-goal-contract.md 的目标模板生成目标文件,写入 `.aiws/goals/<goal-id>.md`。
|
|
83
|
+
8a) 同时创建 `.aiws/goals/<goal-id>.state.json`(§7.2 格式),初始状态:
|
|
62
84
|
- `status`: "active"
|
|
63
85
|
- `current_phase`: "intake"
|
|
64
86
|
- 所有 checkpoints: `{"status": "pending", "attempts": 0, "completed_at": null, "error": null}`
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
9) 输出 completion audit checklist,列出每个 goal 的完成标准与验证方式。
|
|
88
|
+
9a) **记录 checkpoint**:更新 `.aiws/goals/<goal-id>.state.json` → checkpoint `goal_def=complete` + `completed_at`
|
|
67
89
|
|
|
68
90
|
### PHASE 2 — 预检与管道委托
|
|
69
91
|
|
|
@@ -74,16 +96,31 @@ ws-goal 不做的事:
|
|
|
74
96
|
- 失败 → checkpoint `status=failed` + `error=<message>`
|
|
75
97
|
- 暂停 goal → `status=paused`(全局)
|
|
76
98
|
|
|
77
|
-
|
|
99
|
+
10) **依赖链预检**:按 ws-goal-contract.md §2.4 执行上游依赖链健康检查。
|
|
78
100
|
- 通过后:更新 checkpoint `dep_check=complete`
|
|
79
101
|
- 阻断时:更新 state.json `status=paused`,记录 error,结束
|
|
80
102
|
|
|
81
|
-
|
|
103
|
+
11) **Workspace State Analysis**:分析 dirty/submodule/change artifacts/git 状态,输出分级影响报告。按 §2.5.4 分级处理:
|
|
104
|
+
- NONE/LOW → 自动继续,记录到 Audit Trail
|
|
105
|
+
- MED → 自动继续,输出警告
|
|
106
|
+
- **HIGH** → 阻断,必须等待用户确认后才能继续
|
|
82
107
|
- 通过后:更新 checkpoint `ws_analysis=complete`
|
|
83
|
-
|
|
108
|
+
12) **Phase-Level Pipeline Delegation**:预检 + 分析通过后,将 goal 拆分为 PLAN→DEV→REVIEW→FINISH 四个 phase 顺序执行,每个 phase 委托给独立轻量子 agent,主 session 验证每个 phase 产出后决定继续/重试/暂停。参考 `/ws-goal` command 的 step 5 完整流程。
|
|
84
109
|
- 每个 pipeline phase 开始前:更新 state.json `current_phase`,对应 checkpoint `status=in_progress`
|
|
85
110
|
- Granularity Gate(c-i):在 DEV 委托前运行;检查 granularity_ok=true、design_context 和 internal_tasks 非空
|
|
86
111
|
- 粒度不达标(granularity_ok != true)→ 阻断并输出报告,暂停 goal
|
|
87
112
|
- 粒度达标后进入 DEV delegation(c-ii)
|
|
88
113
|
- 每个 pipeline phase 通过后:更新 checkpoint `status=complete` + `completed_at`
|
|
89
114
|
- 每个 pipeline phase 失败后:更新 checkpoint `status=failed` + `error`,递增 `attempts`
|
|
115
|
+
|
|
116
|
+
13) **PLAN 多分支决策支持**:当 PLAN 产出包含多个可行执行路径时(如"先 Phase 1&2 vs 先修 P0 stub"),不得停下询问用户"选哪个"。改为:
|
|
117
|
+
- 用 §7.9.3 格式输出结构化建议块(含各分支内容、风险、预估、推荐)
|
|
118
|
+
- 可调用 Oracle 分析各分支的代码级影响来生成建议块(§7.10)
|
|
119
|
+
- 用户确认选择后继续执行;仅当各分支风险/收益接近无推荐时才需用户主动分析
|
|
120
|
+
|
|
121
|
+
14) **Auto-Advance**:所有 phase 间推进(INTAKE→GOAL_DEF→DEP_CHECK→WS_ANALYSIS→PLAN→DEV→REVIEW→FINISH)遵循 §7.8 Auto-Advance 协议。仅以下情况需要人工确认:
|
|
122
|
+
- INTAKE 阶段存在 UNRESOLVED_BRANCH(步骤 4)
|
|
123
|
+
- 工作区分析存在 HIGH 阻断项(步骤 11)
|
|
124
|
+
- 依赖链 UNHEALTHY(步骤 10)
|
|
125
|
+
- PLAN 存在多分支需用户选择(步骤 13)
|
|
126
|
+
除此之外的 phase 边界自动推进,不需要询问用户。
|
|
@@ -105,6 +105,6 @@ oMo 回退:
|
|
|
105
105
|
输出要求:
|
|
106
106
|
- `Plan file:` <实际写入的路径>
|
|
107
107
|
- `Change context:` <当前 change 分支或 worktree 路径;若新建了 worktree 需明确写出>
|
|
108
|
-
- `Next:` 推荐下一步(先 `$ws-plan-verify`,通过后再 `$ws-dev`;或 `aiws change start <change-id> --hooks`,superproject + submodule 可用 `--
|
|
108
|
+
- `Next:` 推荐下一步(先 `$ws-plan-verify`,通过后再 `$ws-dev`;或 `aiws change start <change-id> --hooks`,superproject + submodule 可用 `--switch`)
|
|
109
109
|
|
|
110
110
|
> 运行时行为约束:`packages/spec/docs/run-behavior-guidelines.md`
|