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