dsh-gate-agent 0.1.1 → 0.1.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.
- package/README.md +315 -285
- package/cordis.patch.yml +144 -144
- package/icon.svg +4 -4
- package/launchers/verify-notes.mjs +20 -20
- package/launchers/verify-notes.yml +34 -34
- package/locale/en.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +34 -34
- package/skills/gate-code-review/SKILL.md +2 -2
- package/skills/gate-code-review/assets/worker-briefs/gate-implement-review.md +17 -17
- package/skills/gate-domain-modeling/CONTEXT-FORMAT.md +3 -3
- package/skills/gate-domain-modeling/GLOSSARY-FORMAT.md +3 -3
- package/skills/gate-fix-bug/assets/worker-briefs/fix-bug-review.md +20 -20
- package/skills/gate-fix-bug/assets/worker-briefs/gate-fix-bug.md +30 -30
- package/skills/gate-implement/SKILL.md +78 -78
- package/skills/gate-implement/assets/worker-briefs/gate-enter-implement.md +22 -22
- package/skills/gate-plan-review/assets/worker-briefs/plan-review.md +17 -17
- package/skills/gate-planning/assets/worker-briefs/gate-enter-plan.md +24 -24
- package/skills/gate-planning/proposal.md +49 -49
- package/skills/gate-user-verify/assets/worker-briefs/gate-code-verify.md +32 -32
- package/skills/gate-verify/SKILL.md +71 -71
- package/skills/gate-verify/assets/worker-briefs/gate-verify.md +21 -21
- package/skills/gate-write-agent-notes/SKILL.md +1 -1
- package/skills/gate-write-agent-notes/scripts/verify-agent-note-lifecycle.ts +74 -74
- package/skills/gate-writing-for-agents/SKILL-MECHANICS.md +4 -4
package/README.md
CHANGED
|
@@ -1,285 +1,315 @@
|
|
|
1
|
-
# dsh-gate-agent
|
|
2
|
-
|
|
3
|
-
Host 插件:用 phase/node 门禁组织讨论、规划、实施、评审、验收和 Note 生命周期,提供 `/gate-*` 命令、`gate_*` 工具和专项技能。
|
|
4
|
-
|
|
5
|
-
> 这是流程门禁,不是 OS 级安全边界。硬拒绝由 `ctx.tools.guard` 提供;blocked 的写冻结是 guard/restrict 的进程级限制(显式写工具/写型 shell),真正需要隔离时仍使用 DSH 的 sandbox/approval。未知工具与任意 shell 语义不会被完整分析。
|
|
6
|
-
|
|
7
|
-
## 安装与启用
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
gate
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/gate-
|
|
194
|
-
/gate-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
- `/gate-
|
|
200
|
-
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
- `
|
|
264
|
-
- `
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
`
|
|
279
|
-
|
|
280
|
-
##
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
1
|
+
# dsh-gate-agent
|
|
2
|
+
|
|
3
|
+
Host 插件:用 phase/node 门禁组织讨论、规划、实施、评审、验收和 Note 生命周期,提供 `/gate-*` 命令、`gate_*` 工具和专项技能。
|
|
4
|
+
|
|
5
|
+
> 这是流程门禁,不是 OS 级安全边界。硬拒绝由 `ctx.tools.guard` 提供;blocked 的写冻结是 guard/restrict 的进程级限制(显式写工具/写型 shell),真正需要隔离时仍使用 DSH 的 sandbox/approval。未知工具与任意 shell 语义不会被完整分析。
|
|
6
|
+
|
|
7
|
+
## 安装与启用
|
|
8
|
+
|
|
9
|
+
### 开发安装(link,标准方式)
|
|
10
|
+
|
|
11
|
+
1. 在仓库根构建:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
pnpm install
|
|
15
|
+
pnpm build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. 安装到 profile:`plugin_manager` 的 `install_bundle`,target 指向本包源码目录的绝对路径,例如:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
E:\workspace\dsh-plugin\gate\packages\gate
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
profile 会记录:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
"dsh-gate-agent": "link:E:/workspace/dsh-plugin/gate/packages/gate"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
这是 DSH 插件的标准开发方式;源码改动后重新 `pnpm build`,重启 DSH 即可加载新的 `lib/index.js`。
|
|
31
|
+
|
|
32
|
+
3. 卸载用 `plugin_manager` 的 `remove_bundle` 或 `pnpm remove`。不要用递归删除工具手动清理 profile 的 `node_modules`:Windows 上 link 是 junction,递归删除可能穿过它删除源目录;`pnpm remove` 实测只移除 link,保留 source。
|
|
33
|
+
|
|
34
|
+
### 生产安装(npm)
|
|
35
|
+
|
|
36
|
+
- `install_bundle` target 使用 npm 版本,例如 `dsh-gate-agent@0.1.1`。
|
|
37
|
+
- npm 安装的是独立副本,卸载不会影响本仓库源码。
|
|
38
|
+
|
|
39
|
+
### 启用
|
|
40
|
+
|
|
41
|
+
- 安装/升级后重启 DSH。
|
|
42
|
+
- 插件由“开发者模式”preset 启用。启用后先执行 `/gate-init`。
|
|
43
|
+
|
|
44
|
+
`/gate-init` 会:
|
|
45
|
+
|
|
46
|
+
- 创建 `.agents/notes/` 的 `proposed/`、`implemented/`、`rejected/`、`archived/` 根;
|
|
47
|
+
- 创建/更新 `AGENTS.md` managed block;
|
|
48
|
+
- 生成 `.agents/gate/verify-notes.mjs`、`.agents/gate/ci/` 和 `.github/workflows/verify-notes.yml`;
|
|
49
|
+
- 在项目 `package.json` 中确保 `verify-notes` 脚本;
|
|
50
|
+
- 在非 git 工作区执行 `git init`,在 `.gitignore` 缺失时写入基础忽略项;已有 `.gitignore` 不覆盖。
|
|
51
|
+
|
|
52
|
+
## 工作阶段与节点
|
|
53
|
+
|
|
54
|
+
`phase` 是当前工作阶段,`node` 是阶段内的具体步骤。`discuss` 之外由命令或 `gate_start_phase` 进入。
|
|
55
|
+
|
|
56
|
+
| phase / node | 用途 | 主代理/worker 与技能 |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `discuss` | 理解需求、讨论方案、确认授权 | root;不派 worker |
|
|
59
|
+
| `orchestrating/plan` | 把工作项整理成规划工件 | planning worker;`gate-planning` + `gate-write-agent-notes` |
|
|
60
|
+
| `orchestrating/plan-review` | Plan Review 三轴评审 | review worker;`gate-plan-review` |
|
|
61
|
+
| `orchestrating/plan-revise` | 按 findings 修计划 | planning worker;`gate-planning` |
|
|
62
|
+
| `orchestrating/implement` | 按已确认计划实施 | implement worker;`gate-implement` |
|
|
63
|
+
| `orchestrating/code-review` | 实现 review(Standards/Spec) | review worker;`gate-code-review` |
|
|
64
|
+
| `orchestrating/implement-revise` | 按 review findings 修正 | implement worker;`gate-implement` |
|
|
65
|
+
| `orchestrating/verify` | 最终验收与证据绑定 | verify worker;`gate-verify` |
|
|
66
|
+
| `orchestrating/note-lifecycle` | 把 proposed Note 转 implemented、跑 notes 校验 | root;`gate-write-agent-notes` lifecycle 工具 |
|
|
67
|
+
| `orchestrating/fix-bug` | 修复已授权缺陷并复核 | fix worker + review worker;`gate-fix-bug` + `gate-code-review` |
|
|
68
|
+
| `reviewing/code-review-standalone` | 单独只读 code review | review worker;`gate-code-review` |
|
|
69
|
+
| `reviewing/proposal-review` | 单独提案评审 | review worker;`gate-plan-review` |
|
|
70
|
+
| `reviewing/verify-standalone` | 单独只读验收 | verify worker;`gate-user-verify` |
|
|
71
|
+
| `docs` | 文档治理 | root;不调用 gate 技能 |
|
|
72
|
+
| `blocked` | 冻结写入/派 worker,等待用户决定 | root;`/gate-resume` 或 `/gate-return-discuss` |
|
|
73
|
+
| `complete` | 工作完成 | root;可重新进入 plan/implement |
|
|
74
|
+
|
|
75
|
+
进入阶段不等于执行。主代理按当前 procedure 加载技能、派 worker,再用 `gate_record` 推进节点。
|
|
76
|
+
|
|
77
|
+
## 命令
|
|
78
|
+
|
|
79
|
+
| 命令 | 参数 | 作用 |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `/gate-init` | 无 | 初始化 notes、AGENTS.md、`verify-notes`、CI、git 与基础 `.gitignore`,保持 `discuss` |
|
|
82
|
+
| `/gate-enter-plan [简单需求]` | 可选 | 进入 `orchestrating/plan` |
|
|
83
|
+
| `/gate-enter-implement [简单说明]` | 可选 | 进入 `orchestrating/implement`;复用已通过的 task,或直接用简述 |
|
|
84
|
+
| `/gate-docs` | 无 | 文档治理,不调用技能 |
|
|
85
|
+
| `/gate-implement-review [范围]` | 可选 | 单独只读 code review,只输出 findings |
|
|
86
|
+
| `/gate-code-verify [范围]` | 可选 | 单独只读验收;子代理使用 `gate-user-verify` |
|
|
87
|
+
| `/gate-fix-bug [缺陷简述]` | 可选 | 派 fix worker 修复已授权缺陷,完成后回 discuss |
|
|
88
|
+
| `/gate-propose-review [提案]` | 可选 | 单独提案评审,走 `gate-plan-review` 三轴 |
|
|
89
|
+
| `/gate-note-verify` | 无 | 只读检查 notes tree/format/lifecycle/archived |
|
|
90
|
+
| `/gate-note-archive <note> [--superseded-by <new>]` | 必需 Note 路径 | 归档 implemented Note,写 Archived、移动、封印、报告入站链接 |
|
|
91
|
+
| `/gate-note-board [输出路径] [标题]` | 可选 | 生成决策看板 `board.html` |
|
|
92
|
+
| `/gate-note-seal` | 无 | 只给 `archived/` 中已有 Note 补写 `manifest.json` 的 SHA-256 封印 |
|
|
93
|
+
| `/gate-block [原因]` | 可选 | 手动暂停,保留当前节点 |
|
|
94
|
+
| `/gate-resume` | 无 | 解冻 blocked,回到 block 前的节点;轮次耗尽回 discuss |
|
|
95
|
+
| `/gate-return-discuss` | 无 | 回到 discuss |
|
|
96
|
+
| `/gate-status` | 无 | 只读显示当前 phase/node 与 procedure |
|
|
97
|
+
|
|
98
|
+
离开 discuss 不要求用户输入 slash command:用户在对话或 `ask_user_question` 中明确授权后,主代理可调用 `gate_start_phase({node:'plan'|'implement', brief})`。
|
|
99
|
+
|
|
100
|
+
## 技能
|
|
101
|
+
|
|
102
|
+
| 技能 | 使用方 | 作用 |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| `gate-planning` | planning worker | 生成/更新规划 Note,组织工作项、验收和设计 |
|
|
105
|
+
| `gate-plan-review` | plan/proposal review worker | Standards/Spec/Architecture 三轴评审 |
|
|
106
|
+
| `gate-implement` | implement/fix worker | 按计划实施并返回改动/验证结果 |
|
|
107
|
+
| `gate-code-review` | code review worker | 对实现做 Standards/Spec 两轴 review |
|
|
108
|
+
| `gate-verify` | verify worker | 最终验收、证据收集与汇报 |
|
|
109
|
+
| `gate-user-verify` | standalone verify worker | 独立只读验收 |
|
|
110
|
+
| `gate-fix-bug` | fix worker | 已授权缺陷修复流程 |
|
|
111
|
+
| `gate-write-agent-notes` | planning worker / root note lifecycle | Note 检索、格式、finalize/verify |
|
|
112
|
+
|
|
113
|
+
## 典型用法
|
|
114
|
+
|
|
115
|
+
### 初始化
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
/gate-init
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
从 `discuss` 开始,不进入 planning/implement。
|
|
122
|
+
|
|
123
|
+
### Planning
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
/gate-enter-plan
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
主代理派 `gate-planning` worker,创建/更新 proposed Agent Note。worker 完成后:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
gate_record({
|
|
133
|
+
node: 'plan',
|
|
134
|
+
task: '工作项简述',
|
|
135
|
+
noteDecision: 'new' | 'update' | 'in-place' | 'mechanical',
|
|
136
|
+
notePaths: [{ path: '.agents/notes/proposed/feature/...', class: 'feature', lifecycle: 'proposed' }]
|
|
137
|
+
})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
进入 `plan-review`,由 review worker 做三轴评审;findings 交回 `plan-revise`,直到通过后回 `discuss`,`planReady=true`。
|
|
141
|
+
|
|
142
|
+
### Implementation
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
/gate-enter-implement
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
主代理派 `gate-implement` worker 实施;完成后 `gate_record({node:'implement', workerSessionIds})` 进入 `code-review`。review 通过后进入 `verify`;verify PASS 后进入 `note-lifecycle`。
|
|
149
|
+
|
|
150
|
+
Note lifecycle:
|
|
151
|
+
|
|
152
|
+
1. `gate_note_finalize`:把 proposed Note 移到 `implemented/`,更新头块;
|
|
153
|
+
2. `gate_note_verify`:跑 notes tree/format/lifecycle/archived 校验,通过后设置 `noteVerified`;
|
|
154
|
+
3. `gate_record({node:'note-lifecycle'})`:完成并回 discuss。
|
|
155
|
+
|
|
156
|
+
gate 不自动 `git add`/`git commit`;完成 note-lifecycle 后由用户或主代理决定是否提交。
|
|
157
|
+
|
|
158
|
+
### 单独 code review
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
/gate-implement-review [范围]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
只读 review,不修改被评审对象;findings 直接输出。
|
|
165
|
+
|
|
166
|
+
### 单独验收
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
/gate-code-verify [范围]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
主代理派只读 verify worker,使用 `gate-user-verify`;PASS 后 `gate_record({node:'verify-standalone', verification, workerSessionIds})` 回 discuss。
|
|
173
|
+
|
|
174
|
+
### 缺陷修复
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
/gate-fix-bug 修复空指针异常
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
主代理派 fix worker 执行修复,再派独立 review worker 复核;完成后 `gate_record({node:'fix-bug', workerSessionIds})`。
|
|
181
|
+
|
|
182
|
+
### 提案评审
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
/gate-propose-review 某个提案
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
review worker 使用 `gate-plan-review` 做 Standards/Spec/Architecture 三轴评审,不改提案。
|
|
189
|
+
|
|
190
|
+
### 归档与封印
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
/gate-note-archive implemented/architecture/2026-11-10-example.md
|
|
194
|
+
/gate-note-archive implemented/architecture/old.md --superseded-by implemented/architecture/new.md
|
|
195
|
+
/gate-note-seal
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- 归档由用户命令触发;模型不自动移动 Note。
|
|
199
|
+
- `archived/manifest.json` 的封印只由 `/gate-note-seal` 写入。
|
|
200
|
+
- 归档后报告被新 Note 取代的入站链接。
|
|
201
|
+
|
|
202
|
+
### 决策看板
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
/gate-note-board [输出路径] [标题]
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
生成连接本地 notes 目录的轻量 `board.html`,不改变 Note。
|
|
209
|
+
|
|
210
|
+
### 文档治理
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
/gate-docs
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
进入 `docs` phase,不调用 gate 技能;由主代理按项目文档规范处理。
|
|
217
|
+
|
|
218
|
+
### 暂停、恢复与讨论
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
/gate-block 等待产品决定
|
|
222
|
+
/gate-resume
|
|
223
|
+
/gate-return-discuss
|
|
224
|
+
/gate-status
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
- `/gate-block`:保留当前节点,冻结写入与 worker 派发,对话仍可继续。
|
|
228
|
+
- `/gate-resume`:回到 block 前的节点;review 轮次耗尽时回 discuss。
|
|
229
|
+
- `/gate-return-discuss`:放弃当前节点,回 discuss。
|
|
230
|
+
- `/gate-status`:只读查看当前 phase/node 和 procedure。
|
|
231
|
+
|
|
232
|
+
## 工具
|
|
233
|
+
|
|
234
|
+
### gate_start_phase
|
|
235
|
+
|
|
236
|
+
只允许 root 调用,在用户已授权时从 `discuss`/`complete` 进入 `plan` 或 `implement`:
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
gate_start_phase({ node: 'plan' | 'implement', brief })
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### gate_record
|
|
243
|
+
|
|
244
|
+
只允许 root 调用。它记录节点结果、推进状态,并返回 transition 后的当前 procedure。
|
|
245
|
+
|
|
246
|
+
```text
|
|
247
|
+
gate_record({
|
|
248
|
+
node,
|
|
249
|
+
task,
|
|
250
|
+
workerSessionIds,
|
|
251
|
+
findings,
|
|
252
|
+
reviewAxes,
|
|
253
|
+
requiresDiscussion,
|
|
254
|
+
discussionReason,
|
|
255
|
+
verification
|
|
256
|
+
})
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
- `node`:`plan`、`plan-review`、`proposal-review`、`plan-revise`、`implement`、`code-review`、`implement-revise`、`verify`、`verify-standalone`、`code-review-standalone`、`fix-bug`、`note-lifecycle`、`docs`。
|
|
260
|
+
- `plan` 必须带 `task`。
|
|
261
|
+
- worker 节点必须带当前 root 的、已 settled 的 child `workerSessionIds`。
|
|
262
|
+
- `plan-review`/`proposal-review` 需要 Standards/Spec/Architecture 三轴;`code-review`/`code-review-standalone` 需要 Standards/Spec 两轴。
|
|
263
|
+
- `requiresDiscussion=true` 进入 blocked,等待用户决定。
|
|
264
|
+
- review 达到 `reviewLimit` 仍有 findings 时 blocked,不能靠重新进入 implement 绕过。
|
|
265
|
+
|
|
266
|
+
### gate_status
|
|
267
|
+
|
|
268
|
+
只读,root 和 worker 可调用。root 返回当前 procedure 与状态;worker 只返回状态,不返回 root procedure。
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
gate_status()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Note 工具
|
|
275
|
+
|
|
276
|
+
- `gate_note_write`:planning worker 写 proposed Note,或原地更新 implemented Note;通用 `write`/`edit`/`apply_patch`/shell 在 planning 被拒绝。
|
|
277
|
+
- `gate_note_verify`:root 在 note-lifecycle 中跑 notes 校验。
|
|
278
|
+
- `gate_note_finalize`:root 把 proposed Note 移到 implemented 并更新头块。
|
|
279
|
+
|
|
280
|
+
## Verify 证据
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"verification": {
|
|
285
|
+
"commands": ["node packages/gate/test/unit.mjs"],
|
|
286
|
+
"evidence": ["artifacts/verify.txt"],
|
|
287
|
+
"toolResults": ["call_..."],
|
|
288
|
+
"passed": true
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- `commands`、`evidence`、`toolResults` 不能为空;
|
|
294
|
+
- `evidence` 必须是 gate workspace 内的普通文件;
|
|
295
|
+
- `toolResults` 必须是 verify worker session log 中真实 `tool/result` 的 `call_...` id;
|
|
296
|
+
- gate 记录 evidence 的 `path`、`size`、`sha256`;
|
|
297
|
+
- 绑定成功后 verify 标记 `selfReported:false`、`executionBound:true`;
|
|
298
|
+
- `commands`/`evidence` 是主代理转述,不是完整独立执行证明。
|
|
299
|
+
|
|
300
|
+
## 配置
|
|
301
|
+
|
|
302
|
+
插件 Config:
|
|
303
|
+
|
|
304
|
+
```json
|
|
305
|
+
{ "reviewLimit": 5 }
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
`reviewLimit` 是每个 review 节点的最大轮次;默认 5,范围 1–20。达到上限仍有 findings 时进入 blocked。
|
|
309
|
+
|
|
310
|
+
## 使用边界
|
|
311
|
+
|
|
312
|
+
- gate 是流程门禁,不是 OS 安全边界;未知工具和任意 shell 语义不会被完整分析。
|
|
313
|
+
- blocked 的写冻结是 guard/restrict 的进程级限制;需要强隔离时使用 DSH sandbox/approval。
|
|
314
|
+
- root 在 code-review/verify 可写文件;修改被评审实现后必须重跑 review/verify。
|
|
315
|
+
- 旧会话不会自动恢复 gate 管理的 sandbox mode;gate 不再 append `sandbox/mode`。
|