@aipper/aiws-spec 0.0.25 → 0.0.27

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 (101) hide show
  1. package/docs/aiws-governance-positioning.md +1 -1
  2. package/docs/cli-interface.md +10 -5
  3. package/docs/collaboration-artifacts.md +1 -1
  4. package/docs/spec-contract.md +5 -12
  5. package/docs/workflow-governance-rules.json +18 -4
  6. package/docs/workflow-governance-rules.md +8 -6
  7. package/docs/workflow-router-rules.json +2 -2
  8. package/docs/workflow-router-rules.md +2 -2
  9. package/docs/workflow-stage-contracts.json +9 -9
  10. package/docs/workflow-stage-contracts.md +5 -5
  11. package/package.json +1 -1
  12. package/templates/workspace/.agents/skills/using-aiws/SKILL.md +5 -1
  13. package/templates/workspace/.agents/skills/ws-commit/SKILL.md +4 -1
  14. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +3 -4
  15. package/templates/workspace/.agents/skills/ws-dev-lite/SKILL.md +58 -0
  16. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +13 -16
  17. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +8 -8
  18. package/templates/workspace/.aiws/manifest.json +2 -6
  19. package/templates/workspace/.claude/commands/using-aiws.md +3 -2
  20. package/templates/workspace/.claude/commands/ws-dev-lite.md +31 -0
  21. package/templates/workspace/.claude/commands/ws-finish.md +9 -5
  22. package/templates/workspace/.claude/commands/ws-handoff.md +3 -2
  23. package/templates/workspace/.claude/commands/ws-review.md +2 -2
  24. package/templates/workspace/.claude/skills/using-aiws/SKILL.md +5 -1
  25. package/templates/workspace/.claude/skills/ws-commit/SKILL.md +4 -1
  26. package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +3 -4
  27. package/templates/workspace/.claude/skills/ws-dev-lite/SKILL.md +58 -0
  28. package/templates/workspace/.claude/skills/ws-finish/SKILL.md +13 -16
  29. package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +8 -8
  30. package/templates/workspace/.githooks/commit-msg +10 -0
  31. package/templates/workspace/.opencode/command/using-aiws.md +3 -2
  32. package/templates/workspace/.opencode/command/ws-dev-lite.md +34 -0
  33. package/templates/workspace/.opencode/command/ws-finish.md +9 -5
  34. package/templates/workspace/.opencode/command/ws-handoff.md +4 -3
  35. package/templates/workspace/.opencode/command/ws-review.md +2 -2
  36. package/templates/workspace/.opencode/commands/using-aiws.md +3 -2
  37. package/templates/workspace/.opencode/commands/ws-dev-lite.md +34 -0
  38. package/templates/workspace/.opencode/commands/ws-finish.md +9 -5
  39. package/templates/workspace/.opencode/commands/ws-handoff.md +4 -3
  40. package/templates/workspace/.opencode/commands/ws-review.md +2 -2
  41. package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +5 -1
  42. package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +4 -1
  43. package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +3 -4
  44. package/templates/workspace/.opencode/skills/ws-dev-lite/SKILL.md +58 -0
  45. package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +13 -16
  46. package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +8 -8
  47. package/templates/workspace/AGENTS.md +5 -3
  48. package/templates/workspace/AI_PROJECT.md +1 -1
  49. package/templates/workspace/AI_WORKSPACE.md +1 -1
  50. package/templates/workspace/changes/README.md +10 -6
  51. package/templates/workspace/changes/templates/tasks.md +1 -1
  52. package/templates/workspace/manifest.json +63 -80
  53. package/templates/workspace/memory-bank/README.md +1 -2
  54. package/templates/workspace/tools/ws_change_check.py +224 -7
  55. package/templates/workspace/.iflow/agents/feature-reviewer.md +0 -27
  56. package/templates/workspace/.iflow/agents/requirements-analyst.md +0 -24
  57. package/templates/workspace/.iflow/agents/server-commit-manager.md +0 -28
  58. package/templates/workspace/.iflow/agents/server-fix-implementer.md +0 -31
  59. package/templates/workspace/.iflow/agents/server-test-planner.md +0 -28
  60. package/templates/workspace/.iflow/agents/server-test-triager.md +0 -30
  61. package/templates/workspace/.iflow/commands/aiws-init.toml +0 -24
  62. package/templates/workspace/.iflow/commands/aiws-rollback.toml +0 -18
  63. package/templates/workspace/.iflow/commands/aiws-update.toml +0 -23
  64. package/templates/workspace/.iflow/commands/aiws-validate.toml +0 -18
  65. package/templates/workspace/.iflow/commands/server-commit.toml +0 -27
  66. package/templates/workspace/.iflow/commands/server-drain.toml +0 -99
  67. package/templates/workspace/.iflow/commands/server-fix-and-commit.toml +0 -27
  68. package/templates/workspace/.iflow/commands/server-fix.toml +0 -65
  69. package/templates/workspace/.iflow/commands/server-test-plan.toml +0 -62
  70. package/templates/workspace/.iflow/commands/server-test.toml +0 -58
  71. package/templates/workspace/.iflow/commands/server-triage.toml +0 -38
  72. package/templates/workspace/.iflow/commands/server_test-plan.toml +0 -12
  73. package/templates/workspace/.iflow/commands/server_test.toml +0 -12
  74. package/templates/workspace/.iflow/commands/ws-analyze.toml +0 -33
  75. package/templates/workspace/.iflow/commands/ws-commit.toml +0 -46
  76. package/templates/workspace/.iflow/commands/ws-contract-check.toml +0 -69
  77. package/templates/workspace/.iflow/commands/ws-deliver.toml +0 -58
  78. package/templates/workspace/.iflow/commands/ws-dev.toml +0 -34
  79. package/templates/workspace/.iflow/commands/ws-doctor.toml +0 -141
  80. package/templates/workspace/.iflow/commands/ws-env-doctor.toml +0 -74
  81. package/templates/workspace/.iflow/commands/ws-feature-deliver.toml +0 -44
  82. package/templates/workspace/.iflow/commands/ws-feature-plan.toml +0 -47
  83. package/templates/workspace/.iflow/commands/ws-finish.toml +0 -54
  84. package/templates/workspace/.iflow/commands/ws-init.toml +0 -53
  85. package/templates/workspace/.iflow/commands/ws-memory-bank-init.toml +0 -100
  86. package/templates/workspace/.iflow/commands/ws-migrate.toml +0 -59
  87. package/templates/workspace/.iflow/commands/ws-preflight.toml +0 -30
  88. package/templates/workspace/.iflow/commands/ws-pull.toml +0 -47
  89. package/templates/workspace/.iflow/commands/ws-push.toml +0 -40
  90. package/templates/workspace/.iflow/commands/ws-req-change.toml +0 -64
  91. package/templates/workspace/.iflow/commands/ws-req-contract-sync.toml +0 -25
  92. package/templates/workspace/.iflow/commands/ws-req-contract-validate.toml +0 -16
  93. package/templates/workspace/.iflow/commands/ws-req-flow-sync.toml +0 -36
  94. package/templates/workspace/.iflow/commands/ws-req-review.toml +0 -56
  95. package/templates/workspace/.iflow/commands/ws-review.toml +0 -33
  96. package/templates/workspace/.iflow/commands/ws-rule.toml +0 -43
  97. package/templates/workspace/.iflow/commands/ws-submodule-setup.toml +0 -32
  98. package/templates/workspace/tools/iflow_watchdog.sh +0 -138
  99. package/templates/workspace/tools/install_iflow_watchdog_systemd_user.sh +0 -118
  100. package/templates/workspace/tools/systemd/iflow-watchdog@.service +0 -16
  101. package/templates/workspace/tools/systemd/iflow-watchdog@.timer +0 -11
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 一句话定位
4
4
 
5
- `aiws` 不是“把模板分发到 Claude Code / OpenCode / Codex / iFlow 的 CLI 薄封装”,而是以 `packages/spec/` 为单一真值,通过 workflow contracts 统一约束、门禁、协同和证据的 AI workspace 工作流治理系统。
5
+ `aiws` 不是“把模板分发到 Claude Code / OpenCode / Codex 的 CLI 薄封装”,而是以 `packages/spec/` 为单一真值,通过 workflow contracts 统一约束、门禁、协同和证据的 AI workspace 工作流治理系统。
6
6
 
7
7
  CLI 分发能力依然重要,但它只是治理内核的一层实现,不是产品的全部定义。
8
8
 
@@ -33,11 +33,10 @@
33
33
  语义:
34
34
  - 在目标仓库根目录写入/补齐模板(默认 `workspace`)。
35
35
  - 默认生成 required + optional 文件/目录。
36
- - 写入/更新 tool-native 文件(默认覆盖 Claude/OpenCode/Codex/iFlow):
36
+ - 写入/更新 tool-native 文件(默认覆盖 Claude/OpenCode/Codex):
37
37
  - Codex repo skills:`.agents/skills/`
38
38
  - Claude Code native skills + compatibility commands:`.claude/skills/` + `.claude/commands/`
39
39
  - OpenCode native skills + native commands + legacy compatibility commands:`.opencode/skills/` + `.opencode/commands/` + `.opencode/command/`
40
- - iFlow commands:`.iflow/commands/`
41
40
  - 写入/更新 `.gitignore` 的 aiws 托管块(其余内容保留)。
42
41
  - 生成并写入 `.aiws/manifest.json`:
43
42
  - 记录 `template_id/spec_version/aiws_version`
@@ -57,11 +56,12 @@
57
56
  - 更新前必须备份将改动的文件到 `.aiws/backups/<timestamp>/`。
58
57
  - 只允许更新:
59
58
  - `replace_file` 文件:整文件覆盖
60
- - `managed_blocks` 文件:仅更新托管块
59
+ - `managed_blocks` 文件:更新托管块;若文件顶部存在 YAML frontmatter,则同步该 frontmatter
61
60
  - required 但不在上述两类中的文件:不改动内容(最多补齐缺失文件)
62
61
  - 对于 `managed_blocks`:
63
62
  - 若文件在当前模板是新增项(旧 `.aiws/manifest.json` 里不存在该 path):允许在 `update` 时自动补齐文件,再写入托管块。
64
63
  - 若文件在旧 `.aiws/manifest.json` 已存在,但缺失指定 block、marker 不成对、或 marker 被破坏:必须失败(退出码 `2`),不做自动修复(提示用户重新 `aiws init` 或手工修复)。
64
+ - 若该文件有 YAML frontmatter(例如 command 的 `description`):允许在保留块外正文的前提下,用模板 frontmatter 覆盖工作区 frontmatter。
65
65
  - 更新完成后刷新 `.aiws/manifest.json`(版本与 hash)。
66
66
 
67
67
  接口(仅定义):
@@ -274,14 +274,15 @@ Dashboard API(本地只读):
274
274
  ### `aiws change start`
275
275
 
276
276
  语义:
277
- - 默认行为:切分支到 `change/<change-id>`(存在则切换;不存在则创建)。
277
+ - 默认行为:切分支到 `change/<change-id>`(存在则切换;不存在则创建);若仓库存在 `.gitmodules`,只切 superproject,本次不会递归切换 submodules。
278
278
  - 若检测到 `.gitmodules`(git submodules)且未显式指定 `--switch/--no-switch/--worktree`:默认优先采用 `--worktree`(避免切走 superproject 分支导致 submodule 状态混乱);若不满足 `--worktree` 前置条件则回退为 `--no-switch`。
279
279
  - 若 `changes/<change-id>/` 不存在:等价执行 `aiws change new ...`。
280
280
  - 可选:`--hooks` 等价于 `aiws hooks install .`。
281
281
  - 可选:`--switch` 显式允许切换 superproject 分支(仅在存在 `.gitmodules` 时有意义;否则等价于默认行为)。
282
- - 实现细节:当存在 `.gitmodules` 且使用 `--switch` 时,CLI 会尝试使用 `git switch/checkout --recurse-submodules` submodules 工作区跟随 superproject 指针;若 git 不支持该选项,会降级为普通切分支并提示手工更新 submodules。
282
+ - 实现细节:当存在 `.gitmodules` 且使用 `--switch` 时,CLI 只切 superproject 分支;submodules 保持当前状态,由 `ws-pull` / `ws-finish` 再统一挂回 `aiws/pin/<target-branch>`。
283
283
  - 可选:`--no-switch` 不切换当前分支(仅确保目标分支存在,并初始化变更工件);适用于 superproject + submodule 场景,避免意外切换 A 目录分支导致 submodule 状态混乱。
284
284
  - 可选:`--worktree` 使用 `git worktree` 创建一个独立工作区并在其中 checkout `change/<change-id>`,当前目录分支保持不变(推荐用于 superproject + submodule)。
285
+ - 当 `.gitmodules` 存在时,submodule 的 detached HEAD 恢复应统一使用 `aiws/pin/<target-branch>`;不要把 submodule 切到 `change/<change-id>`。
285
286
  - 默认 worktree 目录:`../<repo-name>-<change-id>`(相对于 git root)
286
287
  - 可选:`--worktree-dir <path>` 覆盖 worktree 目录(推荐放在仓库外;相对路径按 `../` 作为基准理解)
287
288
  - 可选:`--submodules` 在 worktree 内执行 `git submodule update --init --recursive`(避免新 worktree 下 submodule 目录为空)
@@ -309,6 +310,9 @@ Dashboard API(本地只读):
309
310
  - 若 `--push` 后只完成了 push、但 cleanup 仍未完成,命令应返回非 0,并记录 `finish_cleanup_pending` 以提示修复后重跑
310
311
  - 旧版错误写入的 `finish_done`(例如 `push: false` 或 `cleanup: not_requested`)不得视为真正完成;CLI 应降级为未完成状态,允许重试
311
312
  - 只有完整 finish 成功(兼容旧事件 `finish`,新事件 `finish_done`)后,治理阶段才可进入 `ws-handoff`
313
+ - 当 `--push` 完整成功时,CLI 应自动执行 archive:将 `changes/<id>/` 移动到 `changes/archive/<YYYY-MM-DD>-<id>/`,生成 `handoff.md`,提交 `归档: <change-id>`,并将该 archive commit push 到同一目标分支
314
+ - 若 auto-archive commit/push 失败,应报错并保留已归档工件,提示用户继续提交/推送 archive 结果;不应要求重新做 merge
315
+ - 若发现“已 finish 但 active `changes/<id>/` 仍存在”的 `finished_unarchived` 状态,应视为 finish closeout 未完成:默认恢复动作是重跑 `aiws change finish <id> --push`,而不是继续开发或要求从头再做 merge
312
316
 
313
317
  接口(仅定义):
314
318
  - `aiws change finish [<change-id>] [--into <branch> | --base <branch>]`
@@ -367,6 +371,7 @@ Dashboard API(本地只读):
367
371
 
368
372
  语义:
369
373
  - 严格校验后归档:将 `changes/<id>/` 移动到 `changes/archive/<YYYY-MM-DD>-<id>/`。
374
+ - 默认用于手工恢复 / 历史兼容场景;标准链路下应由 `aiws change finish --push` 自动触发。
370
375
  - 默认要求 `tasks.md` 无未勾选任务;`--force` 可跳过(不建议)。
371
376
  - 更新 `.ws-change.json`:
372
377
  - `archived_at`
@@ -41,7 +41,7 @@ changes/<change-id>/
41
41
  - `.agentdocs/tmp/review/spec-review.md`
42
42
  - `.agentdocs/tmp/review/quality-review.md`
43
43
  - `.agentdocs/tmp/review/verify-before-complete.md`
44
- - `aiws change archive <change-id>` 生成的 `handoff.md` 应概述协同工件,帮助下一次会话快速接手。
44
+ - 标准链路下,由 `aiws change finish --push` 自动归档生成的 `handoff.md` 应概述协同工件;`aiws change archive <change-id>` 仅保留为手工恢复 / 历史兼容入口。
45
45
 
46
46
  ## 生命周期映射
47
47
 
@@ -51,6 +51,7 @@
51
51
  - 对于模板 manifest 声明为 `managed_blocks` 的文件:
52
52
  - 若该 path 是模板新增项(旧 `.aiws/manifest.json` 的 `managed` 中不存在),`aiws update` 可自动补齐文件并写入托管块。
53
53
  - 若该 path 在旧 `.aiws/manifest.json` 已存在,但缺失指定 block、marker 不成对、或 marker 被破坏,`aiws update` 必须失败(不做自动修复)。
54
+ - 若该文件带有**顶部 YAML frontmatter**(例如 command 的 `description`),`aiws update` 还应同步该 frontmatter,避免工具元数据漂移;块外其余正文仍保持用户可追加。
54
55
 
55
56
  ## `.gitignore` 托管块(默认约定)
56
57
 
@@ -89,7 +90,7 @@ secrets/test-accounts.json
89
90
  - `spec_version`:`@aipper/aiws-spec` 版本
90
91
  - `aiws_version`:`@aipper/aiws` 版本
91
92
  - `installed_at` / `updated_at`:ISO 8601 UTC 时间
92
- - `tools`:`["claude","opencode","codex","iflow"]` 的子集
93
+ - `tools`:`["claude","opencode","codex"]` 的子集
93
94
  - `managed`:托管面清单(文件级或托管块级 hash)
94
95
 
95
96
  hash 规则(用于跨平台稳定性):
@@ -108,7 +109,7 @@ hash 规则(用于跨平台稳定性):
108
109
  "aiws_version": "0.0.0",
109
110
  "installed_at": "2026-01-25T00:00:00Z",
110
111
  "updated_at": "2026-01-25T00:00:00Z",
111
- "tools": ["claude", "opencode", "codex", "iflow"],
112
+ "tools": ["claude", "opencode", "codex"],
112
113
  "managed": [
113
114
  { "path": ".githooks/pre-commit", "mode": "replace_file", "sha256": "<sha256>" },
114
115
  { "path": ".gitignore", "mode": "managed_blocks", "blocks": { "gitignore": "<sha256>" } }
@@ -125,7 +126,7 @@ hash 规则(用于跨平台稳定性):
125
126
 
126
127
  说明:
127
128
  - tool-native 文件是 derived 产物;aiws 按模板 `manifest.json` 的 `update` 策略维护(`managed_blocks` 或 `replace_file`)。
128
- - 默认覆盖:Claude Code / OpenCode / Codex / iFlow
129
+ - 默认覆盖:Claude Code / OpenCode / Codex。
129
130
 
130
131
  约定路径(示例;最终以模板 manifest 为准):
131
132
  - Claude Code native:`.claude/skills/*/SKILL.md`(skills)
@@ -134,7 +135,6 @@ hash 规则(用于跨平台稳定性):
134
135
  - OpenCode native commands:`.opencode/commands/p-aiws-*.md`
135
136
  - OpenCode legacy compatibility:`.opencode/command/p-aiws-*.md`(command;migration window)
136
137
  - Codex:`.agents/skills/*/SKILL.md`(skills)
137
- - iFlow:`.iflow/commands/aiws-*.toml`(commands)
138
138
 
139
139
  补充(workflow 入口,同样由模板提供;最终以模板 manifest 为准):
140
140
  - Claude Code native:`.claude/skills/ws-*/SKILL.md`
@@ -143,7 +143,6 @@ hash 规则(用于跨平台稳定性):
143
143
  - OpenCode native commands:`.opencode/commands/ws-*.md`
144
144
  - OpenCode legacy compatibility:`.opencode/command/ws-*.md`
145
145
  - Codex:`.agents/skills/ws-*/SKILL.md`
146
- - iFlow:`.iflow/commands/ws-*.toml`
147
146
 
148
147
  注意(Codex):
149
148
  - Codex 的 repo skills 目录为 `.agents/skills/`(可随仓库共享;prompts 已 deprecated)。
@@ -164,7 +163,7 @@ hash 规则(用于跨平台稳定性):
164
163
  - aiws 的最低承诺是:这些文件提供一致的“工作流入口”(例如引导执行 `npx @aipper/aiws init|update|validate|rollback`),从而把用户带回同一套真值文件与门禁。
165
164
 
166
165
  每个文件的托管方式(推荐):
167
- - 对于 commands 类文件(如 `.claude/commands/*.md`、`.opencode/commands/*.md`、`.opencode/command/*.md`):每个文件包含**一个且仅一个**托管块(block id 形如 `claude:aiws-init`),aiws update 只更新托管块,块外内容保留给用户追加说明。
166
+ - 对于 commands 类文件(如 `.claude/commands/*.md`、`.opencode/commands/*.md`、`.opencode/command/*.md`):每个文件包含**一个且仅一个**托管块(block id 形如 `claude:aiws-init`);若文件顶部存在 YAML frontmatter(例如 `description`),`aiws update` 还会同步该 frontmatter,块外正文其余部分保留给用户追加说明。
168
167
  - 对于 skills 类文件(`.agents/skills/*/SKILL.md`、`.claude/skills/*/SKILL.md`、`.opencode/skills/*/SKILL.md`):由于文件顶部 YAML front matter 需要保持一致性,默认采用 `replace_file` 全量托管;如需自定义请新增独立 skill 目录。
169
168
 
170
169
  最小矩阵(建议写清以下字段,便于未来实现与验收):
@@ -193,9 +192,3 @@ hash 规则(用于跨平台稳定性):
193
192
  - `autodiscovery`:不作为契约要求(由工具决定;aiws 不做保证)
194
193
  - `reload_needed`:不作为契约要求
195
194
  - `fallback`:显式使用 `$ws-preflight` / `$ws-plan` / `$ws-dev` / `$ws-review` / `$ws-commit`(或在 shell 直接运行 `npx @aipper/aiws init|update|validate|rollback`)
196
- - iFlow
197
- - `path_pattern`:`.iflow/commands/aiws-*.toml`
198
- - `purpose`:提供 commands/命令入口/说明(同上)
199
- - `autodiscovery`:不作为契约要求
200
- - `reload_needed`:不作为契约要求
201
- - `fallback`:同上
@@ -2,6 +2,13 @@
2
2
  "version": 1,
3
3
  "description": "Machine-readable governance inference rules for aiws change status/next/dashboard.",
4
4
  "governanceRules": [
5
+ {
6
+ "id": "finish_resume_required",
7
+ "when": { "signal": "finish_resume_required", "truthy": true },
8
+ "currentStage": "ws-finish",
9
+ "recommendedStage": "ws-finish",
10
+ "rationale": "finish already completed locally, but archive/push closeout is still pending; rerun finish to resume"
11
+ },
5
12
  {
6
13
  "id": "strict_blockers",
7
14
  "when": { "signal": "blockers_strict_count", "gt": 0 },
@@ -21,7 +28,7 @@
21
28
  "when": { "signal": "finish_state", "eq": "done" },
22
29
  "currentStage": "ws-finish",
23
30
  "recommendedStage": "ws-handoff",
24
- "rationale": "finish completed; archive/handoff remains"
31
+ "rationale": "finish completed; archive should already exist and handoff is ready for follow-up"
25
32
  },
26
33
  {
27
34
  "id": "finish_failed",
@@ -266,12 +273,19 @@
266
273
  "id": "guidance_finish_handoff",
267
274
  "when": { "signal": "governance_rule_id", "eq": "finish_completed" },
268
275
  "lines": [
269
- "收尾已完成:下一步运行 `$ws-handoff`,并归档 change"
276
+ "收尾已完成且 change 应已归档:下一步运行 `$ws-handoff` 检查/补充归档 handoff"
277
+ ]
278
+ },
279
+ {
280
+ "id": "guidance_finish_resume_required",
281
+ "when": { "signal": "governance_rule_id", "eq": "finish_resume_required" },
282
+ "lines": [
283
+ "finish closeout 未完成:直接重跑 `aiws change finish {change_id} --push`(不要先在目标分支 worktree 运行 `aiws validate . --stamp`)"
270
284
  ]
271
285
  },
272
286
  {
273
287
  "id": "guidance_finish_retry",
274
- "when": { "signal": "governance_rule_id", "in": ["finish_failed", "finish_local"] },
288
+ "when": { "signal": "governance_rule_id", "in": ["finish_failed", "finish_local", "finish_resume_required"] },
275
289
  "lines": [
276
290
  "收尾未完整完成:检查 push / cleanup / submodule 状态后重跑 `$ws-finish`"
277
291
  ]
@@ -280,7 +294,7 @@
280
294
  "id": "guidance_handoff",
281
295
  "when": { "signal": "governance_current_stage", "eq": "ws-handoff" },
282
296
  "lines": [
283
- "进入交接:在 AI 工具中运行 `$ws-handoff`,并生成/检查归档 handoff"
297
+ "进入交接:在 AI 工具中运行 `$ws-handoff`,并检查归档 handoff 是否足够支撑下一次接力"
284
298
  ]
285
299
  },
286
300
  {
@@ -11,16 +11,17 @@
11
11
 
12
12
  - version: `1`
13
13
  - description: Machine-readable governance inference rules for aiws change status/next/dashboard.
14
- - governance rules: 16
15
- - guidance rules: 16
14
+ - governance rules: 17
15
+ - guidance rules: 17
16
16
 
17
17
  ## 阶段推断规则
18
18
 
19
19
  | Rule ID | Match | Current | Next | Rationale |
20
20
  | --- | --- | --- | --- | --- |
21
+ | `finish_resume_required` | `finish_resume_required` is truthy | `ws-finish` | `ws-finish` | finish already completed locally, but archive/push closeout is still pending; rerun finish to resume |
21
22
  | `strict_blockers` | `blockers_strict_count` > 0 | `ws-plan-verify` | `ws-plan-verify` | strict blockers remain unresolved |
22
23
  | `unchecked_tasks` | `tasks_unchecked` > 0 | `ws-dev` | `ws-dev` | {tasks_unchecked} unchecked task(s) remain |
23
- | `finish_completed` | `finish_state` == `done` | `ws-finish` | `ws-handoff` | finish completed; archive/handoff remains |
24
+ | `finish_completed` | `finish_state` == `done` | `ws-finish` | `ws-handoff` | finish completed; archive should already exist and handoff is ready for follow-up |
24
25
  | `finish_failed` | `finish_state` == `failed` | `ws-finish` | `ws-finish` | finish started locally but push/cleanup failed; resolve and rerun finish |
25
26
  | `finish_cleanup_pending` | `finish_state` == `cleanup_pending` | `ws-finish` | `ws-finish` | push completed but cleanup is still pending ({finish_state_reason}); resolve and rerun finish |
26
27
  | `finish_local` | `finish_state` == `local` | `ws-finish` | `ws-finish` | finish started locally but is not fully completed yet |
@@ -51,9 +52,10 @@
51
52
  | `guidance_deliver_verify_before_complete_missing` | (`governance_current_stage` == `ws-deliver`) AND (`verify_before_complete_ready` is falsy) | 补齐完成前 gate:运行 `$ws-verify-before-complete`,并落盘 `changes/<change-id>/evidence/verify-before-complete.md` |
52
53
  | `guidance_deliver_finish` | (`governance_current_stage` == `ws-deliver`) AND (`governance_recommended_stage` == `ws-finish`) | 交付工件齐全后,进入 `$ws-finish`(安全合并 + push + cleanup) |
53
54
  | `guidance_finish_cleanup_pending` | `governance_rule_id` == `finish_cleanup_pending` | push 已完成,但 cleanup 仍未完成({finish_state_reason});清理对应 worktree 后重跑 `$ws-finish` |
54
- | `guidance_finish_handoff` | `governance_rule_id` == `finish_completed` | 收尾已完成:下一步运行 `$ws-handoff`,并归档 change |
55
- | `guidance_finish_retry` | `governance_rule_id` in [`finish_failed`, `finish_local`] | 收尾未完整完成:检查 push / cleanup / submodule 状态后重跑 `$ws-finish` |
56
- | `guidance_handoff` | `governance_current_stage` == `ws-handoff` | 进入交接:在 AI 工具中运行 `$ws-handoff`,并生成/检查归档 handoff |
55
+ | `guidance_finish_handoff` | `governance_rule_id` == `finish_completed` | 收尾已完成且 change 应已归档:下一步运行 `$ws-handoff` 检查/补充归档 handoff |
56
+ | `guidance_finish_resume_required` | `governance_rule_id` == `finish_resume_required` | finish closeout 未完成:直接重跑 `aiws change finish {change_id} --push`(不要先在目标分支 worktree 运行 `aiws validate . --stamp`) |
57
+ | `guidance_finish_retry` | `governance_rule_id` in [`finish_failed`, `finish_local`, `finish_resume_required`] | 收尾未完整完成:检查 push / cleanup / submodule 状态后重跑 `$ws-finish` |
58
+ | `guidance_handoff` | `governance_current_stage` == `ws-handoff` | 进入交接:在 AI 工具中运行 `$ws-handoff`,并检查归档 handoff 是否足够支撑下一次接力 |
57
59
  | `guidance_default` | `governance_current_stage` == `` | 按阶段契约继续推进当前 change |
58
60
 
59
61
  ## 说明
@@ -106,7 +106,7 @@
106
106
  "match": "目标明确、归因清晰、验证入口明确,且无需先改 requirements 或单独评审。",
107
107
  "routeTo": "ws-dev",
108
108
  "gate": "若执行中发现复杂度升高,必须回退到 `ws-plan`。",
109
- "rationale": "router 允许明确的小步任务直接实现,但必须保留回退计划阶段的门。"
109
+ "rationale": "router 允许明确的小步任务直接实现,但必须保留回退计划阶段的门;若用户明确要走轻量入口,可在实现阶段显式使用 `ws-dev-lite` 作为 `ws-dev` 的 facade。"
110
110
  }
111
111
  ],
112
112
  "routeCases": [
@@ -172,7 +172,7 @@
172
172
  "request": "修复 codex install-skills 的默认路径,并补一条可复现回归。",
173
173
  "expectedRuleId": "direct_implementation",
174
174
  "expectedRoute": "ws-dev",
175
- "why": "小步明确实现允许直接进入 dev,但仍保留回退到 plan 的门。"
175
+ "why": "小步明确实现允许直接进入 dev;若用户明确要轻量直修,可进一步显式使用 ws-dev-lite,但治理归属仍收敛到 ws-dev。"
176
176
  }
177
177
  ],
178
178
  "clarificationTriggers": [
@@ -46,7 +46,7 @@ router 在做任何 workflow 判断前,必须先读取:
46
46
  | `finish_request` | 收尾/合并/推送/cleanup | 用户要求 finish、merge、push、收尾、交付完成、清理 worktree 或 branch。 | `ws-finish` | 必须满足 finish gate,不能跳过 validate / push / cleanup。 | finish 是独立治理阶段,不能与普通实现混用。 |
47
47
  | `handoff_request` | 交接/归档总结 | 用户要求 handoff、交接说明、archive summary、会话总结或接力说明。 | `ws-handoff` | 先确认 change 已 finish 或 archive 上下文存在。 | handoff 依赖已有证据与归档上下文,不应在实现前触发。 |
48
48
  | `plan_first` | 中大型实现或需要建立 change 上下文 | 任务是多步实现、跨文件、跨模块、需要方案、需要新建 change/worktree,或当前还没有计划工件。 | `ws-plan` | plan 过 gate 前不进入 `ws-dev`。 | medium/complex 任务必须先生成可落盘计划,避免 router 直接跳进实现。 |
49
- | `direct_implementation` | 小步实现/修复/配置调整 | 目标明确、归因清晰、验证入口明确,且无需先改 requirements 或单独评审。 | `ws-dev` | 若执行中发现复杂度升高,必须回退到 `ws-plan`。 | router 允许明确的小步任务直接实现,但必须保留回退计划阶段的门。 |
49
+ | `direct_implementation` | 小步实现/修复/配置调整 | 目标明确、归因清晰、验证入口明确,且无需先改 requirements 或单独评审。 | `ws-dev` | 若执行中发现复杂度升高,必须回退到 `ws-plan`。 | router 允许明确的小步任务直接实现,但必须保留回退计划阶段的门;若用户明确要走轻量入口,可在实现阶段显式使用 `ws-dev-lite` 作为 `ws-dev` 的 facade。 |
50
50
 
51
51
  ## Route Cases
52
52
 
@@ -59,7 +59,7 @@ router 在做任何 workflow 判断前,必须先读取:
59
59
  | `case_finish_request` | 用户要求合并、push、cleanup 或 finish 当前 change。 | 把 demo-change finish 掉并 push,顺便 cleanup worktree。 | `finish_request` | `ws-finish` | finish 是独立治理阶段,必须先走 finish gate。 |
60
60
  | `case_handoff_request` | 用户要求 handoff、交接说明、archive summary 或接力文档。 | 给这个 change 写 handoff,并补 archive summary。 | `handoff_request` | `ws-handoff` | handoff 依赖已有 finish/archive 上下文,不能当成普通实现。 |
61
61
  | `case_plan_first` | 任务是跨文件、多步实现,且需要先建立 change/worktree 或方案。 | 实现 dashboard 的阶段治理视图并补测试,需要新建 change 和计划。 | `plan_first` | `ws-plan` | 中大型实现应先落盘计划,再进入 dev。 |
62
- | `case_direct_implementation` | 任务是小步明确修复,归因和验证入口都已清楚。 | 修复 codex install-skills 的默认路径,并补一条可复现回归。 | `direct_implementation` | `ws-dev` | 小步明确实现允许直接进入 dev,但仍保留回退到 plan 的门。 |
62
+ | `case_direct_implementation` | 任务是小步明确修复,归因和验证入口都已清楚。 | 修复 codex install-skills 的默认路径,并补一条可复现回归。 | `direct_implementation` | `ws-dev` | 小步明确实现允许直接进入 dev;若用户明确要轻量直修,可进一步显式使用 ws-dev-lite,但治理归属仍收敛到 ws-dev。 |
63
63
 
64
64
  ## 必须先澄清的情形
65
65
 
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "notes": [
21
21
  "ws-deliver 用于多 repo / submodule 场景的顺序提交与交付准备。",
22
- "ws-finish 用于 fast-forward 合并、push worktree cleanup。",
23
- "ws-handoff 通常在 archive 后使用,为下一次会话留下交接说明。",
22
+ "ws-finish 用于 fast-forward 合并、push、worktree cleanup,并在完整 finish 后自动归档 change。",
23
+ "ws-handoff 通常在 finish 自动归档后使用,用于查看/补充归档交接说明。",
24
24
  "若存在独立 change worktree,治理信号应优先读取该 worktree;若 worktree metadata 已 stale,则降级为 warning 并回退到当前 worktree。"
25
25
  ],
26
26
  "stages": [
@@ -82,18 +82,18 @@
82
82
  },
83
83
  {
84
84
  "stage": "ws-finish",
85
- "goal": "安全合并、push、cleanup",
85
+ "goal": "安全合并、push、cleanup,并自动归档",
86
86
  "requiredInputs": "干净工作区;已提交的 change;push 目标;submodule 真值(若有)",
87
- "requiredOutputs": "Merge;Push;Worktree cleanup;Evidence",
87
+ "requiredOutputs": "Merge;Push;Worktree cleanup;Archive/Handoff;Evidence",
88
88
  "blockers": "dirty 工作区;ff 失败;submodule 无法安全 push",
89
- "next": "ws-handoff 或 archive"
89
+ "next": "ws-handoff"
90
90
  },
91
91
  {
92
92
  "stage": "ws-handoff",
93
- "goal": "生成可接力的归档交接说明",
94
- "requiredInputs": "已归档或待归档的 change",
93
+ "goal": "查看/补充可接力的归档交接说明",
94
+ "requiredInputs": "已归档的 change",
95
95
  "requiredOutputs": "changes/archive/.../handoff.md;Next",
96
- "blockers": "无法定位 change;archive 失败;handoff 无法生成",
96
+ "blockers": "无法定位已归档 change;handoff 无法生成或读取",
97
97
  "next": "新 change 通过 Depends_On 接力"
98
98
  }
99
99
  ],
@@ -102,7 +102,7 @@
102
102
  "每个阶段都必须有明确输出,不能只给“建议继续”而不留下工件或证据。",
103
103
  "遇到阻断条件时必须停止,不能为了推进速度跳过门禁。",
104
104
  "如果一个阶段没有留下可审计路径,它就不算真正完成。",
105
- "`ws-finish` 只有在 merge、push、cleanup 都完成后才算完成;仅本地 merge 成功不等于可进入 `ws-handoff`。"
105
+ "`ws-finish` 只有在 merge、push、cleanup、archive 都完成后才算完成;仅本地 merge 成功不等于可进入 `ws-handoff`。"
106
106
  ],
107
107
  "evidence": {
108
108
  "intro": "最少证据集合:",
@@ -16,8 +16,8 @@
16
16
 
17
17
  说明:
18
18
  - ws-deliver 用于多 repo / submodule 场景的顺序提交与交付准备。
19
- - ws-finish 用于 fast-forward 合并、push worktree cleanup
20
- - ws-handoff 通常在 archive 后使用,为下一次会话留下交接说明。
19
+ - ws-finish 用于 fast-forward 合并、push、worktree cleanup,并在完整 finish 后自动归档 change
20
+ - ws-handoff 通常在 finish 自动归档后使用,用于查看/补充归档交接说明。
21
21
  - 若存在独立 change worktree,治理信号应优先读取该 worktree;若 worktree metadata 已 stale,则降级为 warning 并回退到当前 worktree。
22
22
 
23
23
  ## 阶段表
@@ -31,8 +31,8 @@
31
31
  | `ws-review` | 审计规范、风险与验证完整性 | 当前 diff;验证结果;真值文件 | review 文件;Top risks;Next | 无改动可审;无法写审计证据 | ws-commit 或修复后重审 |
32
32
  | `ws-commit` | 串联 review、validate、commit 确认 | staged diff;review 证据;validate stamp;用户确认的 message | Evidence;Context;Commit | 无 staged changes;submodule dirty;validate 失败;message 未确认 | ws-deliver / ws-finish |
33
33
  | `ws-deliver` | 在 submodule 场景下完成顺序提交与证据收敛 | change 上下文;.gitmodules;submodules.targets;各 repo 状态 | submodule 提交摘要;superproject 提交摘要;Evidence | submodule 真值不完整;不在正确 change;commit 未确认 | ws-finish |
34
- | `ws-finish` | 安全合并、push、cleanup | 干净工作区;已提交的 change;push 目标;submodule 真值(若有) | Merge;Push;Worktree cleanup;Evidence | dirty 工作区;ff 失败;submodule 无法安全 push | ws-handoff 或 archive |
35
- | `ws-handoff` | 生成可接力的归档交接说明 | 已归档或待归档的 change | changes/archive/.../handoff.md;Next | 无法定位 change;archive 失败;handoff 无法生成 | 新 change 通过 Depends_On 接力 |
34
+ | `ws-finish` | 安全合并、push、cleanup,并自动归档 | 干净工作区;已提交的 change;push 目标;submodule 真值(若有) | Merge;Push;Worktree cleanup;Archive/Handoff;Evidence | dirty 工作区;ff 失败;submodule 无法安全 push | ws-handoff |
35
+ | `ws-handoff` | 查看/补充可接力的归档交接说明 | 已归档的 change | changes/archive/.../handoff.md;Next | 无法定位已归档 change;handoff 无法生成或读取 | 新 change 通过 Depends_On 接力 |
36
36
 
37
37
  ## 统一规则
38
38
 
@@ -40,7 +40,7 @@
40
40
  - 每个阶段都必须有明确输出,不能只给“建议继续”而不留下工件或证据。
41
41
  - 遇到阻断条件时必须停止,不能为了推进速度跳过门禁。
42
42
  - 如果一个阶段没有留下可审计路径,它就不算真正完成。
43
- - `ws-finish` 只有在 merge、push、cleanup 都完成后才算完成;仅本地 merge 成功不等于可进入 `ws-handoff`。
43
+ - `ws-finish` 只有在 merge、push、cleanup、archive 都完成后才算完成;仅本地 merge 成功不等于可进入 `ws-handoff`。
44
44
 
45
45
  ## 证据约定
46
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipper/aiws-spec",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "AIWS spec and templates (single source of truth).",
5
5
  "type": "module",
6
6
  "files": [
@@ -53,7 +53,7 @@ description: 默认 workflow bootstrap/router:先读真值,再路由到正
53
53
  - finish / merge / push / cleanup:`$ws-finish`
54
54
  - handoff / archive summary:`$ws-handoff`
55
55
  - 中大型实现、需要方案、需要 change/worktree:`$ws-plan`
56
- - 小步明确实现/修复/配置调整:`$ws-dev`
56
+ - 小步明确实现/修复/配置调整:`$ws-dev`(若是 simple/local 单点修复,且用户明确希望走轻量入口,可显式进入 `$ws-dev-lite`)
57
57
  4) 若任务意图或归因不明确:
58
58
  - 只问 1-3 个关键澄清问题
59
59
  - 明确写出缺的是什么:意图、`Req_ID` / `Problem_ID`、verify、change 上下文
@@ -64,6 +64,10 @@ description: 默认 workflow bootstrap/router:先读真值,再路由到正
64
64
  - `Binding:`
65
65
  - `Route:`
66
66
  - `Why:`
67
+ - 若 `Route: $ws-dev` 且任务属于 simple/local 单点修复:
68
+ - `Next:` 可优先进入 `$ws-dev-lite`
69
+ - 否则:
70
+ - `Next:` 进入对应主 skill
67
71
  - 然后在同一轮中继续遵循对应 skill 的契约
68
72
  6) 路由约束:
69
73
  - router 自己不是实现阶段;不要在给出 route 之前直接改代码
@@ -19,7 +19,10 @@ description: 提交(当前分支可直提;submodule 感知;先审计/门
19
19
  - 不写入任何 secrets
20
20
  - 检测到 submodule 有未提交改动时,不允许直接提交 superproject(先处理 submodule)
21
21
  - commit message 优先使用中文(命令/路径/代码标识符保持原样不翻译);格式建议:`<类型>: <简述>`(例如 `修复: 登录页空指针`、`功能: 新增 submodule targets 校验`、`重构: 提取共享脚本`)
22
- - 若启用了 `.githooks/commit-msg`:默认会提示优先中文;只有在 `git config aiws.commitMessagePolicy strict` 时才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
22
+ - 若启用了 `.githooks/commit-msg`:默认按仓库角色区分
23
+ - superproject / root 仓库(存在 `.gitmodules`)默认允许自由 commit message
24
+ - submodule / 普通仓库默认提示优先中文
25
+ - 只有在 `git config aiws.commitMessagePolicy strict` 时才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
23
26
 
24
27
  阶段定位:
25
28
  - commit gate;负责在提交前收敛 review、validate 和 message 确认,不允许跳过 hooks。
@@ -218,10 +218,9 @@ aiws change state "${change_id}" --write
218
218
  aiws change finish <change-id> --into <base-branch>
219
219
  ```
220
220
 
221
- ## F) (可选)归档变更工件
222
- ```bash
223
- aiws change archive <change-id>
224
- ```
221
+ ## F) 归档说明
222
+ - 标准链路下不需要再单独执行 `aiws change archive <change-id>`。
223
+ - 进入 `$ws-finish` 并使用 `aiws change finish --push` 时,会自动完成 archive + handoff。
225
224
 
226
225
  输出要求:
227
226
  - `Submodules:` 每个 submodule 的分支/提交摘要(repo → commit sha → message)
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: ws-dev-lite
3
+ description: 轻量开发(simple/local 单点修复;最小改动 + 最小验证)
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:在不引入完整重流程的前提下,完成一次 simple/local 小问题修复,并保持可验证、可追溯。
9
+
10
+ 定位:
11
+ - `ws-dev` 的轻量入口,不是新的 workflow stage。
12
+ - 适用于单点修复、局部配置调整、明确回归修复;不适用于中大型任务。
13
+
14
+ 适用前提:
15
+ - 目标明确,且能归因到 `Req_ID` 或 `Problem_ID`
16
+ - 验证入口明确,且能做最小可复现验证
17
+ - 一般只影响单文件或紧密相关的小范围文件
18
+ - 不需要先改 `REQUIREMENTS.md`,也不需要先单独做 review
19
+
20
+ 立即升级回主流程的情形:
21
+ - 发现任务其实是 medium/complex、跨模块、跨目录或需要方案设计
22
+ - 无法明确归因、verify、change 上下文
23
+ - 需要新建复杂 change/worktree 或处理 submodule 目标分支真值
24
+ - 修复过程中出现连锁改动、需要补系统性测试或需求调整
25
+
26
+ 默认约束:
27
+ - 先做 `$ws-preflight`
28
+ - 默认不创建 `plan/...`
29
+ - 默认不跑 `$ws-plan-verify`
30
+ - 默认不要求先做双 review
31
+ - 若后续准备提交/交付,仍需进入 `$ws-review` / `$ws-commit` / `$ws-finish`
32
+
33
+ 执行步骤:
34
+ 1) 先读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`,输出约束摘要。
35
+ 2) 先判断自己是否真的属于 lite:
36
+ - 用一句话写清 `Goal`
37
+ - 用一句话写清 `Why lite`
38
+ - 若说不清,立刻回退到 `$ws-dev` 或 `$ws-plan`
39
+ 3) 在当前 change 上下文内实施最小改动:
40
+ - 不为“形式完整”额外扩 scope
41
+ - 不默认补与本问题无关的重构或测试矩阵
42
+ 4) 运行最小可复现验证:
43
+ - 优先使用 `AI_WORKSPACE.md` 已声明的命令
44
+ - 若只需局部回归,允许运行更窄的验证,但要说明为什么足够
45
+ 5) 留下至少一个可追溯证据:
46
+ - 实际改动文件
47
+ - 或 `.agentdocs/tmp/...`
48
+ - 或 `changes/<change-id>/...`
49
+ 6) 输出:
50
+ - `变更文件(Changed):`
51
+ - `验证(Verify):`
52
+ - `证据(Evidence):`
53
+ - `Next:` 若准备提交,进入 `$ws-review` 或 `$ws-commit`
54
+
55
+ 输出要求:
56
+ - 明确说明为什么这是 lite,而不是完整 `ws-dev`
57
+ - 未运行不声称已运行
58
+ - 一旦发现复杂度升高,立刻停止 lite 叙事,切回 `$ws-dev` 或 `$ws-plan`
@@ -14,7 +14,8 @@ description: 收尾(门禁 + 安全合并 + submodule→主仓库顺序 push
14
14
  前置(必须):
15
15
  - 工作区是干净的:`git status --porcelain` 无输出(若有未提交改动:先 commit 或 stash)
16
16
  - change 分支已存在:`change/<change-id>`(也支持 `changes/`、`ws/`、`ws-change/`)
17
- - 若使用 worktree:在目标分支所在 worktree 执行(`aiws change finish` 会提示正确的 worktree)
17
+ - 若使用 worktree:普通 finish 的 `validate/evidence/state` 先在 `change/<change-id>` worktree 完成;真正执行 `aiws change finish` 时再切到目标分支所在 worktree(命令会提示正确的 worktree
18
+ - 若 `aiws change status <change-id>` 输出 `governance_rule: finish_resume_required`:说明 merge 已发生,只剩 push / archive / cleanup closeout;直接在该 worktree 运行 `aiws change finish <change-id> --push`,不要先跑 `aiws validate . --stamp`
18
19
  - 若存在 `.gitmodules`:必须为每个 submodule 配置 `submodule.<name>.branch`(否则无法确定性减少 detached;先运行 `$ws-submodule-setup` 并提交 `.gitmodules`)
19
20
 
20
21
  阶段定位:
@@ -60,7 +61,11 @@ if [[ -f .gitmodules ]]; then
60
61
  fi
61
62
  fi
62
63
  ```
63
- 1) (推荐)先跑一次门禁并落盘证据:
64
+ 0.5) 先运行 `aiws change status <change-id>`,优先看稳定字段 `governance_rule:`:
65
+ - 若为 `finish_resume_required`:直接跳到步骤 2 执行 `aiws change finish <change-id> --push`
66
+ - 若不是该值:按普通 finish 继续;不要依赖自然语言提示句做分支判断
67
+
68
+ 1) (推荐,仅适用于普通 finish,且应在 `change/<change-id>` worktree 执行)先跑一次门禁并落盘证据:
64
69
  ```bash
65
70
  if [[ -x "./node_modules/.bin/aiws" ]]; then
66
71
  ./node_modules/.bin/aiws validate . --stamp
@@ -70,7 +75,10 @@ else
70
75
  npx @aipper/aiws validate . --stamp
71
76
  fi
72
77
  ```
73
- 1.1) (强烈建议)收敛持久证据并回填 `Evidence_Path`:
78
+ 若你已经位于目标分支 worktree,且 `governance_rule` 不是 `finish_resume_required`:
79
+ - 不要在这里跑 `aiws validate . --stamp`
80
+ - 先回 `change/<change-id>` worktree 补齐 finish gate,或先跑 `$ws-verify-before-complete`
81
+ 1.1) (强烈建议,仅适用于普通 finish)收敛持久证据并回填 `Evidence_Path`:
74
82
  ```bash
75
83
  change_id="<change-id>"
76
84
  if [[ -x "./node_modules/.bin/aiws" ]]; then
@@ -81,7 +89,7 @@ else
81
89
  npx @aipper/aiws change evidence "${change_id}"
82
90
  fi
83
91
  ```
84
- 1.2) (可选)生成状态快照(建议):
92
+ 1.2) (可选,仅适用于普通 finish)生成状态快照(建议):
85
93
  ```bash
86
94
  aiws change state "${change_id}" --write
87
95
  ```
@@ -206,15 +214,4 @@ fi
206
214
  ```
207
215
  说明:
208
216
  - 该命令内部已经包含主仓库 push 成功后安全清理独立 change worktree 的逻辑。
209
-
210
- 7) (可选)归档变更工件(完成交付后推荐):
211
- ```bash
212
- change_id="<change-id>"
213
- if [[ -x "./node_modules/.bin/aiws" ]]; then
214
- ./node_modules/.bin/aiws change archive "${change_id}"
215
- elif command -v aiws >/dev/null 2>&1; then
216
- aiws change archive "${change_id}"
217
- else
218
- npx @aipper/aiws change archive "${change_id}"
219
- fi
220
- ```
217
+ - 当 `--push` 完整成功时,还会自动把 `changes/<change-id>/` 归档到 `changes/archive/...`,生成 `handoff.md`,并补一个 `归档: <change-id>` commit。
@@ -11,15 +11,15 @@ description: 交接(归档后生成/查看 changes/archive/.../handoff.md)
11
11
  - 指引在归档与依赖场景下如何使用 handoff
12
12
 
13
13
  说明:
14
- - `handoff.md` `aiws change archive` 自动生成:`changes/archive/<date>-<change-id>/handoff.md`
14
+ - `handoff.md` 默认由 `aiws change finish --push` 自动归档时生成:`changes/archive/<date>-<change-id>/handoff.md`
15
15
  - `Depends_On` 依赖若已归档,`aiws change start` 会尝试读取依赖的 `handoff.md` 并输出摘要
16
16
 
17
17
  阶段定位:
18
- - handoff / archive 阶段;负责把已完成 change 的上下文压缩成后续协作者可直接接手的说明。
18
+ - handoff / archive 阶段;负责查看或补充已归档 change 的交接说明。
19
19
 
20
20
  必需输入:
21
- - 当前或已归档的 `change/<change-id>`
22
- - 对应 archive 目录或准备归档的 change 工件
21
+ - 已归档的 `change/<change-id>`
22
+ - 对应 archive 目录
23
23
 
24
24
  必需输出:
25
25
  - `Change_ID:` 当前交接对象
@@ -28,7 +28,6 @@ description: 交接(归档后生成/查看 changes/archive/.../handoff.md)
28
28
 
29
29
  阻断条件:
30
30
  - 无法定位目标 change
31
- - 未归档且无法执行 `aiws change archive <change-id>`
32
31
  - `handoff.md` 无法生成或读取
33
32
 
34
33
  完成判定:
@@ -36,15 +35,16 @@ description: 交接(归档后生成/查看 changes/archive/.../handoff.md)
36
35
 
37
36
  执行建议:
38
37
  1) 先运行 `$ws-preflight`。
39
- 2) 若本 change 已完成并准备归档:运行 `aiws change archive <change-id>`(会先做严格校验,并移动目录到 `changes/archive/`,同时生成 `handoff.md`)。
38
+ 2) 先确认本 change 已通过 `aiws change finish <change-id> --push` 完成自动归档。
40
39
  3) 查看 handoff:
41
40
  ```bash
42
41
  change_id="<change-id>"
43
42
  ls -1 changes/archive/*-"${change_id}"/handoff.md
44
43
  sed -n '1,160p' changes/archive/*-"${change_id}"/handoff.md
45
44
  ```
46
- 4) 若要让后续 change 可接力:在 `proposal.md` 里声明 `Blocks`(下一步建议会据此生成)。
47
- 5) 若本 change 使用了外部 / 子 agent 协作:确认关键结论已经进入 `review/` `evidence/`,避免 handoff 只留下原始 patch/分析文件而没有最终结论。
45
+ 4) 若是历史/异常场景,尚未归档且需要手工恢复,再运行 `aiws change archive <change-id>`。
46
+ 5) 若要让后续 change 可接力:在 `proposal.md` 里声明 `Blocks`(下一步建议会据此生成)。
47
+ 6) 若本 change 使用了外部 / 子 agent 协作:确认关键结论已经进入 `review/` 或 `evidence/`,避免 handoff 只留下原始 patch/分析文件而没有最终结论。
48
48
 
49
49
  输出要求:
50
50
  - `Change_ID:` <change-id>
@@ -5,7 +5,7 @@
5
5
  "aiws_version": "0.0.0",
6
6
  "installed_at": "1970-01-01T00:00:00Z",
7
7
  "updated_at": "1970-01-01T00:00:00Z",
8
- "tools": ["claude", "opencode", "codex", "iflow"],
8
+ "tools": ["claude", "opencode", "codex"],
9
9
  "managed": [
10
10
  { "path": ".githooks/pre-commit", "mode": "replace_file", "sha256": "<sha256>" },
11
11
  { "path": ".githooks/pre-push", "mode": "replace_file", "sha256": "<sha256>" },
@@ -27,10 +27,6 @@
27
27
  { "path": ".codex/prompts/aiws-init.md", "mode": "managed_blocks", "blocks": { "codex:aiws-init": "<sha256>" } },
28
28
  { "path": ".codex/prompts/aiws-update.md", "mode": "managed_blocks", "blocks": { "codex:aiws-update": "<sha256>" } },
29
29
  { "path": ".codex/prompts/aiws-validate.md", "mode": "managed_blocks", "blocks": { "codex:aiws-validate": "<sha256>" } },
30
- { "path": ".codex/prompts/aiws-rollback.md", "mode": "managed_blocks", "blocks": { "codex:aiws-rollback": "<sha256>" } },
31
- { "path": ".iflow/commands/aiws-init.md", "mode": "managed_blocks", "blocks": { "iflow:aiws-init": "<sha256>" } },
32
- { "path": ".iflow/commands/aiws-update.md", "mode": "managed_blocks", "blocks": { "iflow:aiws-update": "<sha256>" } },
33
- { "path": ".iflow/commands/aiws-validate.md", "mode": "managed_blocks", "blocks": { "iflow:aiws-validate": "<sha256>" } },
34
- { "path": ".iflow/commands/aiws-rollback.md", "mode": "managed_blocks", "blocks": { "iflow:aiws-rollback": "<sha256>" } }
30
+ { "path": ".codex/prompts/aiws-rollback.md", "mode": "managed_blocks", "blocks": { "codex:aiws-rollback": "<sha256>" } }
35
31
  ]
36
32
  }