@aipper/aiws-spec 0.0.27 → 0.0.29
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/cli-interface.md +10 -12
- package/docs/opencode-autonomous-swarm.md +178 -0
- package/docs/opencode-omo-adapter.md +123 -4
- package/docs/opencode-omo-validation-checklist.md +47 -0
- package/docs/opencode-subagent-first.md +187 -0
- package/docs/workflow-delegation-context-injection.md +217 -0
- package/docs/workflow-delegation-contracts.json +68 -1
- package/docs/workflow-delegation-contracts.md +3 -0
- package/docs/workflow-delegation-contracts.schema.json +95 -0
- package/docs/workflow-governance-rules.json +47 -6
- package/docs/workflow-governance-rules.md +7 -6
- package/docs/workflow-governance-rules.schema.json +39 -1
- package/docs/workflow-router-rules.json +63 -8
- package/docs/workflow-router-rules.md +15 -6
- package/docs/workflow-stage-contracts.json +16 -8
- package/docs/workflow-stage-contracts.md +7 -7
- package/package.json +1 -1
- package/templates/workspace/.agents/skills/using-aiws/SKILL.md +22 -8
- package/templates/workspace/.agents/skills/ws-commit/SKILL.md +6 -118
- package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +6 -218
- package/templates/workspace/.agents/skills/ws-dev/SKILL.md +52 -141
- package/templates/workspace/.agents/skills/ws-finish/SKILL.md +6 -205
- package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +10 -44
- package/templates/workspace/.agents/skills/ws-intake/SKILL.md +87 -0
- package/templates/workspace/.agents/skills/ws-plan/SKILL.md +15 -9
- package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +6 -49
- package/templates/workspace/.agents/skills/ws-review/SKILL.md +6 -1
- package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +12 -53
- package/templates/workspace/.claude/commands/ws-intake.md +19 -0
- package/templates/workspace/.claude/commands/ws-review.md +5 -1
- package/templates/workspace/.claude/settings.json.example +26 -0
- package/templates/workspace/.claude/skills/ws-commit/SKILL.md +6 -118
- package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +6 -218
- package/templates/workspace/.claude/skills/ws-dev/SKILL.md +52 -141
- package/templates/workspace/.claude/skills/ws-finish/SKILL.md +6 -205
- package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +10 -44
- package/templates/workspace/.claude/skills/ws-intake/SKILL.md +31 -0
- package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +6 -49
- package/templates/workspace/.claude/skills/ws-review/SKILL.md +6 -1
- package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +12 -53
- package/templates/workspace/.opencode/command/ws-auto.md +33 -0
- package/templates/workspace/.opencode/command/ws-autonomy.md +25 -0
- package/templates/workspace/.opencode/command/ws-intake.md +22 -0
- package/templates/workspace/.opencode/command/ws-review.md +5 -1
- package/templates/workspace/.opencode/commands/ws-auto.md +33 -0
- package/templates/workspace/.opencode/commands/ws-autonomy.md +25 -0
- package/templates/workspace/.opencode/commands/ws-commit.md +4 -56
- package/templates/workspace/.opencode/commands/ws-deliver.md +10 -50
- package/templates/workspace/.opencode/commands/ws-finish.md +8 -65
- package/templates/workspace/.opencode/commands/ws-handoff.md +9 -17
- package/templates/workspace/.opencode/commands/ws-intake.md +22 -0
- package/templates/workspace/.opencode/commands/ws-migrate.md +10 -17
- package/templates/workspace/.opencode/commands/ws-plan-verify.md +5 -15
- package/templates/workspace/.opencode/commands/ws-pull.md +6 -75
- package/templates/workspace/.opencode/commands/ws-push.md +7 -82
- package/templates/workspace/.opencode/commands/ws-review.md +5 -1
- package/templates/workspace/.opencode/commands/ws-submodule-setup.md +8 -47
- package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +10 -19
- package/templates/workspace/.opencode/helpers/approval-whitelist-check.sh +148 -0
- package/templates/workspace/.opencode/helpers/approval-whitelist-run.sh +82 -0
- package/templates/workspace/.opencode/helpers/approval-whitelist-watchdog.sh +144 -0
- package/templates/workspace/.opencode/helpers/tmux-swarm-rescue.sh +56 -0
- package/templates/workspace/.opencode/helpers/tmux-swarm-scan.sh +46 -0
- package/templates/workspace/.opencode/oh-my-opencode.json.example +64 -4
- package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +93 -77
- package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-auto/SKILL.md +46 -0
- package/templates/workspace/.opencode/skills/ws-autonomy/SKILL.md +62 -0
- package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +6 -118
- package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +93 -40
- package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +6 -218
- package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +53 -142
- package/templates/workspace/.opencode/skills/ws-dev-lite/SKILL.md +19 -6
- package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +6 -205
- package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +10 -44
- package/templates/workspace/.opencode/skills/ws-intake/SKILL.md +40 -0
- package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +6 -42
- package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +4 -2
- package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +6 -49
- package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +8 -109
- package/templates/workspace/.opencode/skills/ws-push/SKILL.md +8 -100
- package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-review/SKILL.md +14 -3
- package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +10 -57
- package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +12 -53
- package/templates/workspace/AGENTS.md +12 -5
- package/templates/workspace/AI_PROJECT.md +1 -1
- package/templates/workspace/changes/README.md +9 -12
- package/templates/workspace/manifest.json +277 -203
- package/templates/workspace/.agents/skills/ws-migrate/SKILL.md +0 -54
- package/templates/workspace/.agents/skills/ws-pull/SKILL.md +0 -119
- package/templates/workspace/.agents/skills/ws-push/SKILL.md +0 -110
- package/templates/workspace/.agents/skills/ws-submodule-setup/SKILL.md +0 -65
- package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +0 -54
- package/templates/workspace/.claude/skills/ws-pull/SKILL.md +0 -119
- package/templates/workspace/.claude/skills/ws-push/SKILL.md +0 -110
- package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +0 -65
|
@@ -1,91 +1,107 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: using-aiws
|
|
3
|
-
description:
|
|
3
|
+
description: 使用时机:新会话开始、不确定下一步做什么时。触发词:路由、bootstrap、Router、工作流入口、下一步做什么。注意:已明确阶段可直接进入对应 ws-*。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- 作为默认入口,先读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
|
|
10
|
-
- 先判定当前任务属于哪个 workflow,再进入具体 `ws-*` skill
|
|
11
|
-
- 若任务意图、归因或验证入口不明确:先澄清,不直接进入实现
|
|
8
|
+
目标:默认入口,先读真值文件,判定当前任务 workflow,再进入具体 `ws-*` skill。若意图不明确:先澄清,不直接进入实现。
|
|
12
9
|
|
|
13
|
-
阶段定位:
|
|
14
|
-
|
|
10
|
+
阶段定位:bootstrap/router 阶段;负责分流,不直接完成实现。
|
|
11
|
+
|
|
12
|
+
## 必需输入
|
|
15
13
|
|
|
16
|
-
必需输入:
|
|
17
14
|
- 当前任务描述
|
|
18
|
-
- `AI_PROJECT.md`
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- `Task intent:` 当前任务意图分类
|
|
28
|
-
- `Binding:` `Req_ID` / `Problem_ID` / change 上下文是否清晰
|
|
29
|
-
- `Route:` 选中的下一步 skill
|
|
30
|
-
- `Why:` 选择该 route 的原因
|
|
31
|
-
- `Next:` 进入对应 skill,或先提澄清问题
|
|
32
|
-
|
|
33
|
-
阻断条件:
|
|
15
|
+
- `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
|
|
16
|
+
- 若已存在:`change/<change-id>` 上下文、`plan/...`、`changes/<change-id>/...`
|
|
17
|
+
|
|
18
|
+
## 必需输出
|
|
19
|
+
|
|
20
|
+
- `Root:` / `Found:` / `OpenCode mode:` / `Task intent:` / `Binding:` / `Route:` / `Why:` / `Next:`
|
|
21
|
+
|
|
22
|
+
## 阻断条件
|
|
23
|
+
|
|
34
24
|
- 无法确定项目根目录
|
|
35
25
|
- 缺失任一真值文件
|
|
36
26
|
- 无法明确当前任务意图
|
|
37
27
|
- 无法明确归因或验证入口,且不能安全推断
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
2
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
29
|
+
## 执行步骤
|
|
30
|
+
|
|
31
|
+
### 1. Preflight
|
|
32
|
+
|
|
33
|
+
读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。
|
|
34
|
+
|
|
35
|
+
- 若检测到 `.opencode/oh-my-opencode.json`:输出 `oMo-enabled`
|
|
36
|
+
- 若未检测到:输出 `standard-opencode`
|
|
37
|
+
- 若缺失任一真值文件 → route = `$ws-preflight`,建议先 `aiws init .`
|
|
38
|
+
|
|
39
|
+
### 2. 路由判定
|
|
40
|
+
|
|
41
|
+
根据 `packages/spec/docs/workflow-router-rules.json` 判定:
|
|
42
|
+
|
|
43
|
+
| 意图 | Route |
|
|
44
|
+
|------|-------|
|
|
45
|
+
| 需求/验收/合同变更 | `$ws-req-review` |
|
|
46
|
+
| 评审/审计/找风险 | `$ws-review` |
|
|
47
|
+
| finish/merge/push/cleanup | `$ws-finish` |
|
|
48
|
+
| handoff/archive | `$ws-handoff` |
|
|
49
|
+
| 先出设计方案 | `$ws-design` |
|
|
50
|
+
| 更新规范/验收标准 | `$ws-spec-update` |
|
|
51
|
+
| 中大型实现 | `$ws-plan` |
|
|
52
|
+
| 小步明确实现/修复 | `$ws-dev` |
|
|
53
|
+
| 极简修复 | `$ws-dev-lite` |
|
|
54
|
+
|
|
55
|
+
注:`$ws-dev` 默认走 subagent-first 策略(详见 `packages/spec/docs/opencode-subagent-first.md`)。主 session 应优先通过 `$ws-delegate` 派发 `aiws-worker`,除非用户明确说"直接改"或"do it inline"。
|
|
56
|
+
|
|
57
|
+
### 3. 意图不明确
|
|
58
|
+
|
|
59
|
+
只问 1-3 个关键问题,明确缺什么(意图、Req_ID/Problem_ID、verify、change 上下文),然后停止。
|
|
60
|
+
|
|
61
|
+
### 4. Continuation Routing(新 session 恢复)
|
|
62
|
+
|
|
63
|
+
`.opencode/plugins/aiws-session-start.js` 自动注入 `<resume-recommendation>` 块,包含 active change ID、phase、journal 摘要及 next action。
|
|
64
|
+
|
|
65
|
+
续跑决策表(与 `aiws-context.js#getChangeState` 同步):
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
┌──────────────────┬──────────────────────────────────────────────┐
|
|
69
|
+
│ Phase │ 推荐 Next Action │
|
|
70
|
+
├──────────────────┼──────────────────────────────────────────────┤
|
|
71
|
+
│ none(无 change) │ ws-intake 或 ws-plan 建立 change 上下文 │
|
|
72
|
+
│ intake │ ws-intake 继续澄清,或 ws-plan 转到规划 │
|
|
73
|
+
│ planning │ plan 存在 → ws-plan-verify;否则 ws-plan │
|
|
74
|
+
│ ready-for-dev │ 派发 aiws-worker(subagent-first) │
|
|
75
|
+
│ in-progress │ patches 存在 → aiws-reviewer + ws-review │
|
|
76
|
+
│ │ 上次 DONE_WITH_CONCERNS → ws-quality-review │
|
|
77
|
+
│ │ 否则 worker 继续或 aiws-reviewer 审查 │
|
|
78
|
+
│ review │ evidence 齐 → ws-finish/ws-commit │
|
|
79
|
+
│ │ 否则补 evidence 再提交 │
|
|
80
|
+
│ finished │ ws-finish 收尾归档 │
|
|
81
|
+
│ unknown │ ws-preflight 重新评估 │
|
|
82
|
+
└──────────────────┴──────────────────────────────────────────────┘
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
特殊状态:
|
|
86
|
+
- 上次 delegation 返回 `BLOCKED` → 先解决 blocker 再继续
|
|
87
|
+
- 上次 delegation 返回 `NEEDS_CONTEXT` → 补 context JSONL 后重新派发
|
|
88
|
+
- Subagent-first 默认:`ready-for-dev` / `in-progress` 默认派发 worker/reviewer
|
|
89
|
+
|
|
90
|
+
### 5. 输出路由
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Root: <path>
|
|
94
|
+
Found: <files>
|
|
95
|
+
OpenCode mode: <oMo-enabled / standard-opencode>
|
|
96
|
+
Task intent: <分类>
|
|
97
|
+
Binding: <清晰 / 缺失项>
|
|
98
|
+
Route: <$ws-... 或 clarify>
|
|
99
|
+
Why: <一句到三句>
|
|
100
|
+
Next: <继续执行对应 skill,或提出澄清问题>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## 约束
|
|
104
|
+
|
|
105
|
+
- Router 自己不实现代码;不给 route 前不直接改代码
|
|
106
|
+
- 一次只选一个主 route
|
|
107
|
+
- 若复杂度升高:`$ws-dev` 回退到 `$ws-plan`;`$ws-finish` 回退到前置门禁
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-auto
|
|
3
|
+
description: 使用时机:OpenCode/oMo 会话启动、自动 bootstrap 时。触发词:启动、bootstrap、自动、watchdog。注意:首次初始化请用 ws-preflight。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 为当前 OpenCode 工作区执行一次显式 auto bootstrap,而不是把逻辑塞进用户自己的 `opencode` wrapper。
|
|
10
|
+
- 先检查真值文件、托管内容与 autonomy 相关文件是否需要更新。
|
|
11
|
+
- 若当前仓库已启用 oMo 且 watchdog 条件齐备:自动确保 tmux 中已有 watchdog。
|
|
12
|
+
- 最后给出明确的下一步路由,而不是停留在状态描述。
|
|
13
|
+
|
|
14
|
+
必需输入:
|
|
15
|
+
- `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
|
|
16
|
+
- 当前项目根目录
|
|
17
|
+
- 当前任务意图(若已知)
|
|
18
|
+
|
|
19
|
+
必需输出:
|
|
20
|
+
- `Auto Bootstrap:`
|
|
21
|
+
- `Update:`
|
|
22
|
+
- `OpenCode mode:`
|
|
23
|
+
- `Watchdog:`
|
|
24
|
+
- `Next:`
|
|
25
|
+
|
|
26
|
+
阻断条件:
|
|
27
|
+
- 缺失任一真值文件
|
|
28
|
+
- 当前目录不是 AIWS 工作区,且不存在 `.aiws/manifest.json`
|
|
29
|
+
- `.opencode/oh-my-opencode.json` 是无效 JSON
|
|
30
|
+
|
|
31
|
+
执行步骤(强制):
|
|
32
|
+
1) 先运行 `/ws-preflight`,确认真值文件与项目根路径。
|
|
33
|
+
2) 在项目根运行:`aiws opencode auto .`
|
|
34
|
+
3) 根据输出收敛结果:
|
|
35
|
+
- 若输出 `update: required` 且随后已执行 `aiws update .`:在 `Update:` 中写明 `applied`
|
|
36
|
+
- 若输出 `mode: oMo-enabled`:在 `OpenCode mode:` 中写明 `oMo-enabled`
|
|
37
|
+
- 若输出 `watchdog:` 为 `already-running` / `created` / `started-with-new-session`:在 `Watchdog:` 中写明已就绪
|
|
38
|
+
- 若输出 `watchdog: skipped (...)`:把跳过原因原样收敛到 `Watchdog:`
|
|
39
|
+
4) 给出单一 `Next:`:
|
|
40
|
+
- 若 watchdog 已就绪且任务意图明确:进入 `/using-aiws`、`/ws-plan`、`/ws-dev` 或 `/ws-review`
|
|
41
|
+
- 若只想先声明 autonomous 合同:进入 `/ws-autonomy`
|
|
42
|
+
- 若因缺配置/缺 tmux/invalid JSON 被跳过:先修复对应缺口,不直接假装已进入 autonomous 模式
|
|
43
|
+
|
|
44
|
+
安全:
|
|
45
|
+
- `ws-auto` 允许调用 `aiws update .` 来刷新 AIWS 托管内容,但不自动启用 `.opencode/oh-my-opencode.json`。
|
|
46
|
+
- `ws-auto` 只会确保 watchdog 启动;不会自动批准 host permission,也不会自动执行 tmux rescue。
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-autonomy
|
|
3
|
+
description: 使用时机:需要自主协作、无人值守执行时。触发词:自主、自动化、协作、retry、rescue。注意:实验功能,不用于正式交付。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 为当前 OpenCode 任务声明 autonomous execution mode,而不是直接接管 runtime。
|
|
10
|
+
- 明确 completion contract / retry contract / rescue policy / evidence path。
|
|
11
|
+
- 在需要时引导使用 `.opencode/helpers/tmux-swarm-scan.sh` 与 `tmux-swarm-rescue.sh`。
|
|
12
|
+
- 在需要时引导使用 `.opencode/helpers/approval-whitelist-check.sh` 判定低风险命令/路径是否可自动放行。
|
|
13
|
+
- 在需要时引导使用 `.opencode/helpers/approval-whitelist-run.sh` 执行已获 `allow` 的简单命令。
|
|
14
|
+
- 在需要时引导使用 `.opencode/helpers/approval-whitelist-watchdog.sh` 轮询待执行队列。
|
|
15
|
+
|
|
16
|
+
必需输入:
|
|
17
|
+
- `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
|
|
18
|
+
- `packages/spec/docs/opencode-autonomous-swarm.md`
|
|
19
|
+
- `packages/spec/docs/opencode-omo-adapter.md`
|
|
20
|
+
- 当前任务绑定(`Req_ID` / `Problem_ID` / `change` / `Verify`)
|
|
21
|
+
|
|
22
|
+
必需输出:
|
|
23
|
+
- `Execution Mode:` `single-agent` / `omo-native` / `omo-native + tmux-swarm`
|
|
24
|
+
- `Completion Contract:`
|
|
25
|
+
- `Retry Contract:`
|
|
26
|
+
- `Rescue Policy:`
|
|
27
|
+
- `Evidence:`
|
|
28
|
+
- `Next:`
|
|
29
|
+
|
|
30
|
+
阻断条件:
|
|
31
|
+
- 当前任务未绑定
|
|
32
|
+
- 无法确认当前是否启用了 oMo,又不能接受回退
|
|
33
|
+
- 需要 tmux swarm 但当前环境没有 `tmux`
|
|
34
|
+
|
|
35
|
+
执行步骤(建议):
|
|
36
|
+
1) 先运行 `$ws-preflight`,确认真值文件完整。
|
|
37
|
+
2) 判断当前模式:
|
|
38
|
+
- 若未启用 `.opencode/oh-my-opencode.json`:`single-agent`
|
|
39
|
+
- 若启用了 oMo:`omo-native`
|
|
40
|
+
- 若启用了 oMo 且当前接受 tmux 巡检/救援:`omo-native + tmux-swarm`
|
|
41
|
+
3) 输出 `Completion Contract:`,至少包含:
|
|
42
|
+
- 真值文件已读取
|
|
43
|
+
- 任务/change 已绑定
|
|
44
|
+
- Verify 已执行
|
|
45
|
+
- review/evidence 已落盘
|
|
46
|
+
4) 输出 `Retry Contract:`:
|
|
47
|
+
- `ws-plan-verify` 失败 -> `ws-plan`
|
|
48
|
+
- `ws-review` blocker -> `ws-dev`
|
|
49
|
+
- `validate` 失败 -> `ws-dev`
|
|
50
|
+
5) 输出 `Rescue Policy:`:
|
|
51
|
+
- 只允许 `(y/n)`、`Press Enter to continue`、退出 copy-mode
|
|
52
|
+
- 不允许 blind `Ctrl+C` / 广播 shell 命令 / 自动 commit/push
|
|
53
|
+
6) 若选择 `omo-native + tmux-swarm`:
|
|
54
|
+
- 如需判定某个低风险命令是否可自动放行:运行 `bash .opencode/helpers/approval-whitelist-check.sh . --kind <read|write|host-permission> --command "<cmd>" [--path "<target>"]`
|
|
55
|
+
- 如需让 watchdog 真正执行已放行的简单命令:运行 `bash .opencode/helpers/approval-whitelist-run.sh . --kind <read|write|host-permission> --command "<cmd>" [--path "<target>"]`
|
|
56
|
+
- 如需持续轮询外部蜂群写入的待执行项:运行 `bash .opencode/helpers/approval-whitelist-watchdog.sh . --once` 或去掉 `--once` 持续运行
|
|
57
|
+
- 提示先运行 `.opencode/helpers/tmux-swarm-scan.sh`
|
|
58
|
+
- 如需安全救援,再运行 `.opencode/helpers/tmux-swarm-rescue.sh`
|
|
59
|
+
|
|
60
|
+
安全:
|
|
61
|
+
- `ws-autonomy` 不是 runtime controller。
|
|
62
|
+
- 任何 tmux helper 的结果都必须回收到 `.agentdocs/tmp/opencode-autonomy/`,最终再由主 agent 收敛到 `changes/<id>/...`。
|
|
@@ -1,130 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-commit
|
|
3
|
-
description:
|
|
3
|
+
description: Thin wrapper for `aiws ws-commit`
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# ws-commit
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- 支持在**当前分支直接提交**(不要求必须先切 `change/<change-id>`)
|
|
10
|
-
- 提交前审计与证据落盘(`$ws-review`)
|
|
11
|
-
- 提交前门禁校验与证据落盘(`aiws validate . --stamp`)
|
|
12
|
-
- 最后执行 `git commit`(commit 前必须让用户确认 message;不使用 `--no-verify` 绕过 hooks)
|
|
13
|
-
- 若仓库含 submodule:提交前识别并提示正确顺序(先 submodule,再 superproject)
|
|
14
|
-
- 若你经常遇到 submodule detached:建议日常拉取使用 `$ws-pull`(尽量把 submodule “挂回分支”且不改变 gitlink commit)
|
|
8
|
+
Thin skill wrapper. Delegates to `aiws ws-commit`. See `aiws ws-commit --help` for details.
|
|
15
9
|
|
|
16
|
-
安全约束(强制):
|
|
17
|
-
- 不自动 `git add -A`(避免误提交);只在用户明确指示时才执行 staging 命令
|
|
18
|
-
- 不自动 push
|
|
19
|
-
- 不写入任何 secrets
|
|
20
|
-
- 检测到 submodule 有未提交改动时,不允许直接提交 superproject(先处理 submodule)
|
|
21
|
-
- commit message 优先使用中文(命令/路径/代码标识符保持原样不翻译);格式建议:`<类型>: <简述>`(例如 `修复: 登录页空指针`、`功能: 新增 submodule targets 校验`、`重构: 提取共享脚本`)
|
|
22
|
-
- 若启用了 `.githooks/commit-msg`:默认按仓库角色区分
|
|
23
|
-
- superproject / root 仓库(存在 `.gitmodules`)默认允许自由 commit message
|
|
24
|
-
- submodule / 普通仓库默认提示优先中文
|
|
25
|
-
- 只有在 `git config aiws.commitMessagePolicy strict` 时才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
|
|
26
|
-
|
|
27
|
-
阶段定位:
|
|
28
|
-
- commit gate;负责在提交前收敛 review、validate 和 message 确认,不允许跳过 hooks。
|
|
29
|
-
|
|
30
|
-
必需输入:
|
|
31
|
-
- 当前分支与 staged diff
|
|
32
|
-
- `$ws-review` 生成的审计证据
|
|
33
|
-
- `aiws validate . --stamp` 生成的校验证据
|
|
34
|
-
- 用户确认后的 commit message
|
|
35
|
-
|
|
36
|
-
必需输出:
|
|
37
|
-
- `证据(Evidence):` review 文件路径 + validate stamp 路径
|
|
38
|
-
- `上下文(Context):` 当前分支、submodule 检测结果、阻断原因(若有)
|
|
39
|
-
- `提交信息(Commit):` 最终提交信息
|
|
40
|
-
|
|
41
|
-
阻断条件:
|
|
42
|
-
- 没有 staged changes
|
|
43
|
-
- submodule 工作区不干净或 detached 处理不完整
|
|
44
|
-
- 用户未确认 commit message
|
|
45
|
-
- validate 失败
|
|
46
|
-
|
|
47
|
-
完成判定:
|
|
48
|
-
- 提交已完成,证据路径明确,且没有通过 `--no-verify` 绕过门禁。
|
|
49
|
-
|
|
50
|
-
执行步骤(建议):
|
|
51
|
-
1) 运行 `$ws-preflight`(确保真值文件就绪)。
|
|
52
|
-
2) 运行 `$ws-review`(优先生成审计证据:`changes/<change-id>/review/codex-review.md`;无 `change-id` 时回退 `.agentdocs/tmp/review/codex-review.md`)。
|
|
53
|
-
3) 运行门禁校验并写 stamp:
|
|
54
10
|
```bash
|
|
55
11
|
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
56
|
-
./node_modules/.bin/aiws
|
|
12
|
+
./node_modules/.bin/aiws ws-commit
|
|
57
13
|
elif command -v aiws >/dev/null 2>&1; then
|
|
58
|
-
aiws
|
|
14
|
+
aiws ws-commit
|
|
59
15
|
else
|
|
60
|
-
npx @aipper/aiws
|
|
61
|
-
fi
|
|
62
|
-
```
|
|
63
|
-
4) 输出当前提交上下文(必须输出给用户确认):
|
|
64
|
-
```bash
|
|
65
|
-
git branch --show-current
|
|
66
|
-
git status --porcelain
|
|
67
|
-
```
|
|
68
|
-
5) 检测是否存在 submodule(有则进入 submodule 感知模式):
|
|
69
|
-
```bash
|
|
70
|
-
if [[ -f .gitmodules ]]; then
|
|
71
|
-
git config --file .gitmodules --get-regexp '^submodule\..*\.path$' || true
|
|
72
|
-
else
|
|
73
|
-
echo "[info] no .gitmodules"
|
|
74
|
-
fi
|
|
75
|
-
```
|
|
76
|
-
6) 若存在 submodule,逐个检查子仓库工作区是否干净:
|
|
77
|
-
```bash
|
|
78
|
-
while read -r _ sub_path; do
|
|
79
|
-
[[ -z "${sub_path:-}" ]] && continue
|
|
80
|
-
echo "== submodule: ${sub_path} =="
|
|
81
|
-
git -C "${sub_path}" rev-parse --abbrev-ref HEAD 2>/dev/null || true
|
|
82
|
-
git -C "${sub_path}" status --porcelain || true
|
|
83
|
-
done < <(git config --file .gitmodules --get-regexp '^submodule\..*\.path$' 2>/dev/null || true)
|
|
84
|
-
```
|
|
85
|
-
判定规则(强制):
|
|
86
|
-
- 任一 submodule `git status --porcelain` 非空:停止 superproject commit,先在对应 submodule 完成 commit,再回到 superproject 更新并提交 gitlink。
|
|
87
|
-
- 若该 submodule 当前为 detached HEAD:先按 `.gitmodules` 的目标分支挂到 `aiws/pin/<target_branch>`;不要直接切 `change/<change-id>` / `main` / `master` 来“解 detached”。
|
|
88
|
-
处理指引(detached submodule):
|
|
89
|
-
```bash
|
|
90
|
-
cur_branch="$(git branch --show-current)"
|
|
91
|
-
change_id="$(echo "${cur_branch}" | sed -n 's|^change/||p')"
|
|
92
|
-
targets="changes/${change_id}/submodules.targets"
|
|
93
|
-
|
|
94
|
-
source tools/ws_resolve_sub_target.sh
|
|
95
|
-
ws_resolve_sub_target "${sub_path}" "${sub_name}" "${targets}" "${cur_branch}" || exit 2
|
|
96
|
-
target_branch="${_resolved_branch}"
|
|
97
|
-
remote="${_resolved_remote}"
|
|
98
|
-
|
|
99
|
-
git -C "${sub_path}" fetch "${remote}" --prune
|
|
100
|
-
if ! git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/${remote}/${target_branch}"; then
|
|
101
|
-
echo "error: missing ${remote}/${target_branch} for submodule path=${sub_path}"
|
|
102
|
-
exit 2
|
|
16
|
+
npx @aipper/aiws ws-commit
|
|
103
17
|
fi
|
|
104
|
-
git -C "${sub_path}" checkout -B "aiws/pin/${target_branch}" HEAD
|
|
105
|
-
git -C "${sub_path}" branch --set-upstream-to "${remote}/${target_branch}" "aiws/pin/${target_branch}" >/dev/null 2>&1 || true
|
|
106
18
|
```
|
|
107
|
-
7) 检查当前 staging 内容(必须输出给用户确认):
|
|
108
|
-
```bash
|
|
109
|
-
git status --porcelain
|
|
110
|
-
git diff --staged --submodule=short
|
|
111
|
-
```
|
|
112
|
-
8) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
|
|
113
|
-
9) 生成中文 commit message 草案(格式:`<类型>: <简述>`),输出给用户确认后再执行。
|
|
114
|
-
- 类型参考:`功能` / `修复` / `重构` / `文档` / `测试` / `构建` / `杂项`
|
|
115
|
-
- 简述用一句话概括本次改动的"为什么"而非"改了什么"
|
|
116
|
-
- 命令/路径/代码标识符保持原样不翻译
|
|
117
|
-
- 若用户给出全英文 message:优先改写成中文;若用户明确要求保留英文,也可以提交(但 strict 模式下会被 hook 拒绝)
|
|
118
|
-
10) 执行提交(不带 `--no-verify`):
|
|
119
|
-
```bash
|
|
120
|
-
git commit -m "<message>"
|
|
121
|
-
```
|
|
122
|
-
11) 输出提交结果(可选):
|
|
123
|
-
```bash
|
|
124
|
-
git show --stat --oneline -1
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
输出要求:
|
|
128
|
-
- `证据(Evidence):` `changes/<change-id>/review/codex-review.md`(无 `change-id` 时回退 `.agentdocs/tmp/review/codex-review.md`) + `.agentdocs/tmp/aiws-validate/*.json`
|
|
129
|
-
- `上下文(Context):` 当前分支 + 是否检测到 submodule + 若阻断则给出阻断原因
|
|
130
|
-
- `提交信息(Commit):` 最终使用的 commit message(仅当用户确认后)
|
|
@@ -1,63 +1,116 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-delegate
|
|
3
|
-
description:
|
|
3
|
+
description: 使用时机:需要拆分子任务、委托给子 agent 时。触发词:委托、子 agent、拆分、并行、sub-agent。注意:简单任务不需委托。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
7
|
|
|
8
8
|
目标:在 OpenCode 中,优先借用 `oh-my-opencode` 的现有 agent 做任务拆分;若 oMo 不可用,再回退为普通 OpenCode delegation / 单 agent 执行。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 必需输入
|
|
11
|
+
|
|
11
12
|
- 真值文件:`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
|
|
12
13
|
- delegation contract:`packages/spec/docs/workflow-delegation-contracts.md`
|
|
14
|
+
- 上下文策展规范:`packages/spec/docs/workflow-delegation-context-injection.md`
|
|
13
15
|
- OpenCode + oMo 适配说明:`packages/spec/docs/opencode-omo-adapter.md`
|
|
16
|
+
- 连续执行循环:`packages/spec/docs/opencode-subagent-first.md`
|
|
14
17
|
- 当前任务已绑定 `Req_ID` / change / Verify
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
## 必需输出
|
|
20
|
+
|
|
21
|
+
- `Delegation Plan:` role / preferred agent / readScope / writeScope / artifactTargets / fallback
|
|
22
|
+
- `Context Curation:` 上下文策展详情
|
|
18
23
|
- `Execution Mode:` `omo-native` / `opencode-native` / `single-agent`
|
|
19
24
|
- `Evidence:` 产物路径
|
|
20
25
|
- `Next:` 回到 `ws-dev` / `ws-review` / `ws-commit` / `ws-finish`
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
## 阻断条件
|
|
28
|
+
|
|
23
29
|
- 任务未绑定
|
|
24
30
|
- 没有写清委托边界
|
|
31
|
+
- 上下文策展未执行(未生成 JSONL 或未在 prompt 中引用)
|
|
25
32
|
- 无法判断当前是否可用 oMo,又不能接受回退
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
34
|
+
## 角色映射
|
|
35
|
+
|
|
36
|
+
| aiws 角色 | oMo Agent |
|
|
37
|
+
|-----------|-----------|
|
|
38
|
+
| `planner` | `planner-sisyphus` |
|
|
39
|
+
| `explorer` | `@explore` / `@librarian` |
|
|
40
|
+
| `reviewer` | `@oracle` |
|
|
41
|
+
| `integrator` | 当前主 agent |
|
|
42
|
+
|
|
43
|
+
## 连续执行循环(Worker → Reviewer → Fix)
|
|
44
|
+
|
|
45
|
+
默认闭环(详见 `packages/spec/docs/opencode-subagent-first.md`):
|
|
46
|
+
|
|
47
|
+
1. 主 session 策展上下文 JSONL → dispatch `aiws-worker`
|
|
48
|
+
2. 检查 worker 返回状态(DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED)
|
|
49
|
+
3. DONE → dispatch `aiws-reviewer`
|
|
50
|
+
4. Reviewer pass → 收敛 evidence;fail → 返回 worker 修复(最多 3 次)
|
|
51
|
+
5. DONE_WITH_CONCERNS → 先 `ws-quality-review`
|
|
52
|
+
6. NEEDS_CONTEXT → 补充上下文重试(最多 2 次)
|
|
53
|
+
7. BLOCKED → 输出 blocker 详情,不继续
|
|
54
|
+
|
|
55
|
+
## 上下文策展
|
|
56
|
+
|
|
57
|
+
详细规范见 `packages/spec/docs/workflow-delegation-context-injection.md`。
|
|
58
|
+
|
|
59
|
+
策展步骤:
|
|
60
|
+
1. 读取合同基线(`delegation-contracts.json` 中对应角色的 `contextFiles`)
|
|
61
|
+
2. 展开 glob 为实际路径(替换 `<id>`)
|
|
62
|
+
3. 委托者调整:添加/删除/调整 priority/sections
|
|
63
|
+
4. 预算检查:high+medium ≤ 5 文件,总行数 ≤ 4000
|
|
64
|
+
5. 写入 `changes/<id>/analysis/<role>-context.jsonl`
|
|
65
|
+
|
|
66
|
+
OpenCode 插件 `aiws-inject-context` 会自动注入 JSONL 上下文——只需在 `task()` 中指定 `role: <role>`。
|
|
67
|
+
|
|
68
|
+
## 子 agent 返回协议
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
**Status:** DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
|
|
72
|
+
**Completed:** 实现内容
|
|
73
|
+
**Files Changed:** 文件路径
|
|
74
|
+
**Verification:** 命令 + 结果
|
|
75
|
+
**Artifacts:** analysis|patches|review|evidence 下的路径
|
|
76
|
+
**Concerns:** 疑虑或未完成项
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 状态处理
|
|
80
|
+
|
|
81
|
+
- **DONE**: 进入 ws-review;若已过 review 则准备 ws-finish
|
|
82
|
+
- **DONE_WITH_CONCERNS**: 先 ws-quality-review,根据风险决定是否阻断
|
|
83
|
+
- **NEEDS_CONTEXT**: 补上下文重试(最多 2 次);仍失败则回退单 agent
|
|
84
|
+
- **BLOCKED**: 停止委托;解 blocker 后重试;永不到达则升级给用户
|
|
85
|
+
|
|
86
|
+
## Delegation Plan 格式
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
**Delegation Plan:**
|
|
90
|
+
- role: worker
|
|
91
|
+
- preferred agent: aiws-worker
|
|
92
|
+
- task: <描述>
|
|
93
|
+
- readScope: <文件/目录>
|
|
94
|
+
- writeScope: <文件/目录>
|
|
95
|
+
- artifactTargets: changes/<id>/patches/, changes/<id>/evidence/
|
|
96
|
+
- fallback: single-agent
|
|
97
|
+
Context Curation: changes/<id>/analysis/worker-context.jsonl
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 委托者检查清单
|
|
101
|
+
|
|
102
|
+
派遣前:
|
|
103
|
+
- [ ] 子 agent prompt 包含上下文引用
|
|
104
|
+
- [ ] JSONL 已写入 `changes/<id>/analysis/<role>-context.jsonl`
|
|
105
|
+
- [ ] 预算检查通过
|
|
106
|
+
- [ ] readScope / writeScope / artifactTargets 已声明
|
|
107
|
+
|
|
108
|
+
返回后:
|
|
109
|
+
- [ ] 解析 Status 行
|
|
110
|
+
- [ ] 非 DONE → 按状态处理规则行动
|
|
111
|
+
- [ ] 非 DONE → 记录决策到 `delegation-decisions.md`
|
|
59
112
|
|
|
60
113
|
安全:
|
|
61
|
-
- 不让 `ws-delegate` 变成第二套 orchestrator
|
|
62
|
-
-
|
|
63
|
-
-
|
|
114
|
+
- 不让 `ws-delegate` 变成第二套 orchestrator
|
|
115
|
+
- 不让 delegated agent 越权写未授权文件
|
|
116
|
+
- 不跳过 submodule drift check(若 `.gitmodules` 存在)
|