@ai-content-space/loopx 0.1.10 → 0.2.1
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/AGENTS.md +49 -0
- package/README.md +69 -448
- package/README.zh-CN.md +69 -459
- package/docs/loopx/design/loopx-skill-suite-v1-design.md +80 -0
- package/docs/loopx/plans/loopx-skill-suite-v1-implementation.md +81 -0
- package/package.json +7 -3
- package/plugins/loopx/.codex-plugin/plugin.json +4 -4
- package/plugins/loopx/skills/clarify/SKILL.md +38 -311
- package/plugins/loopx/skills/debug/SKILL.md +1 -1
- package/plugins/loopx/skills/exec/SKILL.md +71 -0
- package/plugins/loopx/skills/finish/SKILL.md +349 -0
- package/plugins/loopx/skills/fix-review/SKILL.md +216 -0
- package/plugins/loopx/skills/go-style/SKILL.md +2 -2
- package/plugins/loopx/skills/kratos/SKILL.md +1 -1
- package/plugins/loopx/skills/plan/SKILL.md +138 -271
- package/plugins/loopx/skills/refactor-plan/SKILL.md +71 -0
- package/plugins/loopx/skills/review/SKILL.md +72 -105
- package/plugins/loopx/skills/review/code-reviewer.md +168 -0
- package/plugins/loopx/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
- package/plugins/loopx/skills/spec/SKILL.md +76 -0
- package/plugins/loopx/skills/subagent-exec/SKILL.md +282 -0
- package/plugins/loopx/skills/subagent-exec/agents/openai.yaml +3 -0
- package/plugins/loopx/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
- package/plugins/loopx/skills/subagent-exec/codex-subagents.md +37 -0
- package/plugins/loopx/skills/subagent-exec/implementer-prompt.md +113 -0
- package/plugins/loopx/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
- package/plugins/loopx/skills/tdd/SKILL.md +1 -1
- package/plugins/loopx/skills/verify/SKILL.md +1 -1
- package/scripts/claude-workflow-hook.mjs +109 -0
- package/scripts/codex-workflow-hook.mjs +2 -5
- package/scripts/install-skills.mjs +3 -3
- package/scripts/verify-skills.mjs +34 -2
- package/skills/RESOLVER.md +22 -17
- package/skills/clarify/SKILL.md +38 -311
- package/skills/debug/SKILL.md +1 -1
- package/skills/exec/SKILL.md +71 -0
- package/skills/finish/SKILL.md +349 -0
- package/skills/fix-review/SKILL.md +216 -0
- package/skills/go-style/SKILL.md +2 -2
- package/skills/kratos/SKILL.md +1 -1
- package/skills/plan/SKILL.md +138 -271
- package/skills/refactor-plan/SKILL.md +71 -0
- package/skills/review/SKILL.md +72 -105
- package/skills/review/code-reviewer.md +168 -0
- package/skills/spec/DESIGN_SPEC_TEMPLATE.md +323 -0
- package/skills/spec/SKILL.md +76 -0
- package/skills/subagent-exec/SKILL.md +282 -0
- package/skills/subagent-exec/agents/openai.yaml +3 -0
- package/skills/subagent-exec/code-quality-reviewer-prompt.md +25 -0
- package/skills/subagent-exec/codex-subagents.md +37 -0
- package/skills/subagent-exec/implementer-prompt.md +113 -0
- package/skills/subagent-exec/spec-reviewer-prompt.md +61 -0
- package/skills/tdd/SKILL.md +1 -1
- package/skills/verify/SKILL.md +1 -1
- package/src/autopilot-runtime.mjs +1 -1
- package/src/cli.mjs +78 -7
- package/src/context-manifest.mjs +2 -2
- package/src/html-views.mjs +129 -195
- package/src/install-discovery.mjs +210 -6
- package/src/next-skill.mjs +2 -4
- package/src/plan-runtime.mjs +219 -93
- package/src/runtime-maintenance.mjs +5 -2
- package/src/workflow.mjs +749 -71
- package/templates/architecture.md +58 -16
- package/templates/development-plan.md +42 -12
- package/plugins/loopx/scripts/plugin-install.test.mjs +0 -125
- package/plugins/loopx/skills/archive/SKILL.md +0 -55
- package/plugins/loopx/skills/autopilot/SKILL.md +0 -93
- package/plugins/loopx/skills/build/SKILL.md +0 -228
- package/skills/ai-slop-cleaner/SKILL.md +0 -114
- package/skills/archive/SKILL.md +0 -55
- package/skills/autopilot/SKILL.md +0 -93
- package/skills/autoresearch/SKILL.md +0 -68
- package/skills/build/SKILL.md +0 -228
- package/skills/deep-interview/SKILL.md +0 -461
- package/skills/ralph/SKILL.md +0 -271
- package/skills/ralplan/SKILL.md +0 -49
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# <项目/功能>设计文档
|
|
2
|
+
|
|
3
|
+
> 模板用途:用于需求已澄清后的软件设计方案、概要设计、详细设计和评审材料。保持章节顺序;不适用的章节写“无/不涉及”并说明原因。
|
|
4
|
+
|
|
5
|
+
## 一、修订历史
|
|
6
|
+
|
|
7
|
+
| 版本号 | 修订内容 | 修订时间 | 修订人 |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| V1.0.0 | 新建初稿 | YYYY-MM-DD | <姓名> |
|
|
10
|
+
|
|
11
|
+
## 二、需求信息
|
|
12
|
+
|
|
13
|
+
### 2.1 需求背景
|
|
14
|
+
|
|
15
|
+
- 背景:
|
|
16
|
+
- 需求目的:
|
|
17
|
+
- 目标用户/使用方:
|
|
18
|
+
- 需求链接:
|
|
19
|
+
- 关联原始材料:
|
|
20
|
+
|
|
21
|
+
### 2.2 需求范围
|
|
22
|
+
|
|
23
|
+
- 本期范围:
|
|
24
|
+
- 非目标:
|
|
25
|
+
- 决策边界:
|
|
26
|
+
- 依赖方:
|
|
27
|
+
- 约束条件:
|
|
28
|
+
|
|
29
|
+
### 2.3 可行性分析
|
|
30
|
+
|
|
31
|
+
- 业务可行性:
|
|
32
|
+
- 技术可行性:
|
|
33
|
+
- 团队接受能力:
|
|
34
|
+
- 时间成本:
|
|
35
|
+
- 资源成本:
|
|
36
|
+
- 替代方案:
|
|
37
|
+
- 关键风险:
|
|
38
|
+
|
|
39
|
+
## 三、概要设计
|
|
40
|
+
|
|
41
|
+
### 3.1 方案总述
|
|
42
|
+
|
|
43
|
+
- 设计目标:
|
|
44
|
+
- 总体思路:
|
|
45
|
+
- 核心模块:
|
|
46
|
+
- 主要难点:
|
|
47
|
+
- 技术指标:
|
|
48
|
+
|
|
49
|
+
### 3.2 整体架构设计
|
|
50
|
+
|
|
51
|
+
- 业务模式:
|
|
52
|
+
- 系统边界:
|
|
53
|
+
- 上下游系统:
|
|
54
|
+
- 应用架构:
|
|
55
|
+
- 技术架构:
|
|
56
|
+
- 数据流转:
|
|
57
|
+
|
|
58
|
+
### 3.3 核心流程设计
|
|
59
|
+
|
|
60
|
+
按核心业务流程描述触发方、参与系统、关键状态、数据变化和异常分支。
|
|
61
|
+
|
|
62
|
+
| 流程 | 触发条件 | 参与系统/模块 | 主流程 | 异常/补偿 | 输出 |
|
|
63
|
+
|---|---|---|---|---|---|
|
|
64
|
+
| <流程名> | <条件> | <模块> | <步骤> | <处理> | <结果> |
|
|
65
|
+
|
|
66
|
+
### 3.4 功能模块
|
|
67
|
+
|
|
68
|
+
| 模块 | 职责 | 关键功能 | 依赖 | 备注 |
|
|
69
|
+
|---|---|---|---|---|
|
|
70
|
+
| <模块名> | <职责> | <功能> | <依赖> | <备注> |
|
|
71
|
+
|
|
72
|
+
### 3.5 新增/调整功能说明
|
|
73
|
+
|
|
74
|
+
按端、系统或业务域拆分,例如 H5、后台、开放接口、清结算、资金资产、权限等。
|
|
75
|
+
|
|
76
|
+
## 四、详细设计
|
|
77
|
+
|
|
78
|
+
> 每个模块使用同一结构展开;复杂模块可继续拆到 4.x.x。
|
|
79
|
+
|
|
80
|
+
### 4.x <模块/领域>详细设计
|
|
81
|
+
|
|
82
|
+
#### 4.x.1 需求内容
|
|
83
|
+
|
|
84
|
+
- 入口:
|
|
85
|
+
- 操作人/调用方:
|
|
86
|
+
- 前置条件:
|
|
87
|
+
- 输出结果:
|
|
88
|
+
|
|
89
|
+
#### 4.x.2 方案设计
|
|
90
|
+
|
|
91
|
+
- 核心逻辑:
|
|
92
|
+
- 状态流转:
|
|
93
|
+
- 数据变更:
|
|
94
|
+
- 计算公式:
|
|
95
|
+
- 幂等设计:
|
|
96
|
+
- 权限/越权控制:
|
|
97
|
+
- 异常处理:
|
|
98
|
+
- 补偿/重试:
|
|
99
|
+
- 日志与审计:
|
|
100
|
+
|
|
101
|
+
#### 4.x.3 流程步骤
|
|
102
|
+
|
|
103
|
+
1. <步骤>
|
|
104
|
+
2. <步骤>
|
|
105
|
+
3. <步骤>
|
|
106
|
+
|
|
107
|
+
#### 4.x.4 边界条件
|
|
108
|
+
|
|
109
|
+
| 场景 | 处理方式 | 用户/调用方感知 | 监控/告警 |
|
|
110
|
+
|---|---|---|---|
|
|
111
|
+
| <场景> | <处理> | <感知> | <告警> |
|
|
112
|
+
|
|
113
|
+
## 五、存储类设计
|
|
114
|
+
|
|
115
|
+
### 5.1 库表设计
|
|
116
|
+
|
|
117
|
+
#### 5.1.1 数据库模型图
|
|
118
|
+
|
|
119
|
+
说明核心实体关系;如使用图,请附图或 Mermaid。
|
|
120
|
+
|
|
121
|
+
#### 5.1.2 表结构
|
|
122
|
+
|
|
123
|
+
| 表名 | 用途 | 主键 | 关键索引 | 数据量预估 | 备注 |
|
|
124
|
+
|---|---|---|---|---|---|
|
|
125
|
+
| <table> | <用途> | <pk> | <idx> | <规模> | <备注> |
|
|
126
|
+
|
|
127
|
+
字段明细:
|
|
128
|
+
|
|
129
|
+
| 字段 | 类型 | 是否必填 | 默认值 | 含义 | 来源/取值逻辑 | 备注 |
|
|
130
|
+
|---|---|---|---|---|---|---|
|
|
131
|
+
| <field> | <type> | 是/否 | <default> | <含义> | <逻辑> | <备注> |
|
|
132
|
+
|
|
133
|
+
### 5.2 数据迁移/初始化
|
|
134
|
+
|
|
135
|
+
- DDL:
|
|
136
|
+
- DML:
|
|
137
|
+
- 数据回填:
|
|
138
|
+
- 老数据兼容:
|
|
139
|
+
- 新老系统读写关系:
|
|
140
|
+
|
|
141
|
+
### 5.3 缓存设计
|
|
142
|
+
|
|
143
|
+
| 场景 | Key | Value | 数据结构 | 过期时长 | 容量预估 | 失效/刷新策略 |
|
|
144
|
+
|---|---|---|---|---|---|---|
|
|
145
|
+
| <场景> | <key> | <value> | <结构> | <TTL> | <容量> | <策略> |
|
|
146
|
+
|
|
147
|
+
## 六、其他组件设计
|
|
148
|
+
|
|
149
|
+
### 6.1 消息设计
|
|
150
|
+
|
|
151
|
+
| 场景 | Group | Topic | 生产者 | 消费者 | 幂等键 | 失败补偿 |
|
|
152
|
+
|---|---|---|---|---|---|---|
|
|
153
|
+
| <场景> | <group> | <topic> | <producer> | <consumer> | <key> | <补偿> |
|
|
154
|
+
|
|
155
|
+
### 6.2 配置设计
|
|
156
|
+
|
|
157
|
+
| 配置项 | 环境 | 默认值 | 是否动态生效 | 说明 | 风险 |
|
|
158
|
+
|---|---|---|---|---|---|
|
|
159
|
+
| <config> | <env> | <value> | 是/否 | <说明> | <风险> |
|
|
160
|
+
|
|
161
|
+
### 6.3 定时任务/批处理
|
|
162
|
+
|
|
163
|
+
| 任务 | 触发时间 | 处理范围 | 幂等 | 失败重试 | 影响评估 |
|
|
164
|
+
|---|---|---|---|---|---|
|
|
165
|
+
| <job> | <cron> | <范围> | <方式> | <策略> | <影响> |
|
|
166
|
+
|
|
167
|
+
### 6.4 技术组件
|
|
168
|
+
|
|
169
|
+
- 分布式锁:
|
|
170
|
+
- 唯一 ID:
|
|
171
|
+
- 加解密/验签:
|
|
172
|
+
- 字典转换:
|
|
173
|
+
- Excel/文件处理:
|
|
174
|
+
- 用户信息透传:
|
|
175
|
+
- 限流/熔断:
|
|
176
|
+
|
|
177
|
+
## 七、接口设计
|
|
178
|
+
|
|
179
|
+
### 7.1 接口设计原则
|
|
180
|
+
|
|
181
|
+
- 接口和字段注释必须完整,明确必填、非必填、默认值和枚举。
|
|
182
|
+
- 非纯查询接口必须说明幂等策略。
|
|
183
|
+
- 异常码、异常文案和抛出条件必须明确。
|
|
184
|
+
- 重要接口必须说明日志、链路字段、性能、限流、熔断和数据流水。
|
|
185
|
+
- 如接口文档在 YApi/OpenAPI/Apifox 等平台维护,必须给出链接。
|
|
186
|
+
|
|
187
|
+
### 7.2 接口清单
|
|
188
|
+
|
|
189
|
+
| 接口 | 调用方 | 服务方 | 权限/认证 | 幂等 | 文档地址 | 备注 |
|
|
190
|
+
|---|---|---|---|---|---|---|
|
|
191
|
+
| <接口名> | <caller> | <provider> | <auth> | <key> | <url> | <备注> |
|
|
192
|
+
|
|
193
|
+
### 7.3 接口明细
|
|
194
|
+
|
|
195
|
+
#### 7.3.x <接口名>
|
|
196
|
+
|
|
197
|
+
- 路径/方法:
|
|
198
|
+
- 请求头:
|
|
199
|
+
- 请求参数:
|
|
200
|
+
- 响应参数:
|
|
201
|
+
- 错误码:
|
|
202
|
+
- 业务校验:
|
|
203
|
+
- 数据变更:
|
|
204
|
+
- 日志字段:
|
|
205
|
+
|
|
206
|
+
## 八、系统发布
|
|
207
|
+
|
|
208
|
+
### 8.1 灰度方案
|
|
209
|
+
|
|
210
|
+
- 灰度范围:
|
|
211
|
+
- 灰度开关:
|
|
212
|
+
- 验证指标:
|
|
213
|
+
- 放量节奏:
|
|
214
|
+
|
|
215
|
+
### 8.2 降级方案
|
|
216
|
+
|
|
217
|
+
- 降级触发条件:
|
|
218
|
+
- 降级行为:
|
|
219
|
+
- 用户影响:
|
|
220
|
+
- 恢复方式:
|
|
221
|
+
|
|
222
|
+
### 8.3 关联系统/功能影响
|
|
223
|
+
|
|
224
|
+
| 系统/功能 | 影响 | 依赖动作 | 负责人 | 验证方式 |
|
|
225
|
+
|---|---|---|---|---|
|
|
226
|
+
| <系统> | <影响> | <动作> | <负责人> | <验证> |
|
|
227
|
+
|
|
228
|
+
### 8.4 回滚方案
|
|
229
|
+
|
|
230
|
+
- 回滚条件:
|
|
231
|
+
- 回滚步骤:
|
|
232
|
+
- 数据回滚:
|
|
233
|
+
- 配置回滚:
|
|
234
|
+
- 风险:
|
|
235
|
+
|
|
236
|
+
## 九、系统监控与维护
|
|
237
|
+
|
|
238
|
+
### 9.1 监控与告警
|
|
239
|
+
|
|
240
|
+
- 系统异常:
|
|
241
|
+
- 业务异常:
|
|
242
|
+
- 重试异常:
|
|
243
|
+
- 超时:
|
|
244
|
+
- 关键接口指标:
|
|
245
|
+
- 告警渠道:
|
|
246
|
+
|
|
247
|
+
### 9.2 性能与容量
|
|
248
|
+
|
|
249
|
+
- TPS/吞吐:
|
|
250
|
+
- CPU/内存/磁盘 IO/网络 IO:
|
|
251
|
+
- 数据容量:
|
|
252
|
+
- 缓存容量:
|
|
253
|
+
- 跑批耗时:
|
|
254
|
+
- 是否压测:
|
|
255
|
+
|
|
256
|
+
### 9.3 可靠性与兜底
|
|
257
|
+
|
|
258
|
+
- 幂等击穿:
|
|
259
|
+
- 并发失效:
|
|
260
|
+
- 冷热备:
|
|
261
|
+
- 关键任务独立性:
|
|
262
|
+
- 字段兜底:
|
|
263
|
+
- 老新数据兼容:
|
|
264
|
+
|
|
265
|
+
## 十、排期与规划
|
|
266
|
+
|
|
267
|
+
### 10.1 任务拆分与工作量评估
|
|
268
|
+
|
|
269
|
+
| 任务 | 范围 | 负责人 | 工作量 | 依赖 | 备注 |
|
|
270
|
+
|---|---|---|---|---|---|
|
|
271
|
+
| <任务> | <范围> | <负责人> | <人天> | <依赖> | <备注> |
|
|
272
|
+
|
|
273
|
+
### 10.2 计划时间
|
|
274
|
+
|
|
275
|
+
- 数据方案评审:
|
|
276
|
+
- 开发开始/结束:
|
|
277
|
+
- CR:
|
|
278
|
+
- 联调完成/提测:
|
|
279
|
+
- 测试用例评审:
|
|
280
|
+
- 测试开始/结束:
|
|
281
|
+
- 预发布:
|
|
282
|
+
- 上线:
|
|
283
|
+
- 线上验证:
|
|
284
|
+
|
|
285
|
+
### 10.3 发布计划
|
|
286
|
+
|
|
287
|
+
1. 需求纳入发布版本
|
|
288
|
+
2. 测试环境申请与部署
|
|
289
|
+
3. 代码 CR
|
|
290
|
+
4. 发布评审 checklist
|
|
291
|
+
5. 预发布/灰度/线上环境部署
|
|
292
|
+
6. 稳定观察
|
|
293
|
+
|
|
294
|
+
### 10.4 遗留问题与后续规划
|
|
295
|
+
|
|
296
|
+
| 问题 | 影响 | 处理计划 | 负责人 | 截止时间 |
|
|
297
|
+
|---|---|---|---|---|
|
|
298
|
+
| <问题> | <影响> | <计划> | <负责人> | <时间> |
|
|
299
|
+
|
|
300
|
+
### 10.5 Planning Handoff
|
|
301
|
+
|
|
302
|
+
- `plan` 可以决定:
|
|
303
|
+
- 必须返回 `spec` 的事项:
|
|
304
|
+
- 必须返回 `clarify` 的事项:
|
|
305
|
+
- 推荐下一步:
|
|
306
|
+
|
|
307
|
+
```text
|
|
308
|
+
$plan docs/loopx/design/<需求名>需求设计文档.md
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## 十一、QA
|
|
312
|
+
|
|
313
|
+
### 11.1 评审记录
|
|
314
|
+
|
|
315
|
+
| 评审时间 | 评审人 | 评审问题 | 处理进展 | 结论 |
|
|
316
|
+
|---|---|---|---|---|
|
|
317
|
+
| <时间> | <姓名> | <问题> | <进展> | <结论> |
|
|
318
|
+
|
|
319
|
+
### 11.2 待确认问题
|
|
320
|
+
|
|
321
|
+
| 问题 | 需要谁确认 | 阻塞阶段 | 推荐答案 | 状态 |
|
|
322
|
+
|---|---|---|---|---|
|
|
323
|
+
| <问题> | <角色> | clarify/spec/plan/subagent-exec/exec/review | <建议> | open/closed |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec
|
|
3
|
+
description: "Writes software design specs from already-clarified requirements, including solution approach, architecture outline, detailed design, tradeoffs, verification design, and handoff context. Not for unresolved requirements, PRD generation, implementation task planning, or code changes."
|
|
4
|
+
when_to_use: "spec, design spec, technical design, design proposal, detailed design, architecture design, 设计方案, 概要设计, 详细设计, 技术方案"
|
|
5
|
+
metadata:
|
|
6
|
+
version: "0.2.1"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# loopx Spec
|
|
10
|
+
|
|
11
|
+
Turn clarified requirements into design documents. Do not invent missing requirements. Do not write an implementation plan. Do not change code.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
Use the user's PRD, external requirements document, or approved `clarify` output as the source of truth.
|
|
16
|
+
|
|
17
|
+
Before writing, inspect relevant code and docs when the task touches an existing system. If a design question can be answered from the repo, answer it from evidence. If a material requirement, constraint, owner decision, or product behavior is still unclear, stop and route back to `clarify`.
|
|
18
|
+
|
|
19
|
+
## Core Loop
|
|
20
|
+
|
|
21
|
+
Write the design as a decision document, not a task list.
|
|
22
|
+
|
|
23
|
+
Use [DESIGN_SPEC_TEMPLATE.md](DESIGN_SPEC_TEMPLATE.md) as the required output structure. Keep the section order. If a section does not apply, write `无` or `不涉及` with a short reason instead of deleting it.
|
|
24
|
+
|
|
25
|
+
Cover:
|
|
26
|
+
|
|
27
|
+
- problem framing and design goals
|
|
28
|
+
- explicit non-goals and decision boundaries
|
|
29
|
+
- system context and affected modules
|
|
30
|
+
- proposed solution
|
|
31
|
+
- alternatives considered and why rejected
|
|
32
|
+
- data model, state model, and contracts
|
|
33
|
+
- key flows and edge cases
|
|
34
|
+
- failure modes, rollback, migration, and compatibility
|
|
35
|
+
- security, privacy, performance, and operational concerns when relevant
|
|
36
|
+
- testing and verification strategy
|
|
37
|
+
- open risks that do not block planning
|
|
38
|
+
|
|
39
|
+
For brownfield work, distinguish repo evidence from inference.
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
|
|
43
|
+
Write Markdown by default. Derive `<需求名>` from the clarified requirement title or the user's own wording, not from an opaque slug:
|
|
44
|
+
|
|
45
|
+
- `docs/loopx/design/<需求名>需求设计文档.md`
|
|
46
|
+
|
|
47
|
+
If the user asks for a presentable document or visual review artifact, also write:
|
|
48
|
+
|
|
49
|
+
- `docs/loopx/design/<需求名>需求设计文档.html`
|
|
50
|
+
|
|
51
|
+
The Markdown spec must include these sections:
|
|
52
|
+
|
|
53
|
+
- `# <项目/功能>设计文档`
|
|
54
|
+
- `一、修订历史`
|
|
55
|
+
- `二、需求信息`
|
|
56
|
+
- `三、概要设计`
|
|
57
|
+
- `四、详细设计`
|
|
58
|
+
- `五、存储类设计`
|
|
59
|
+
- `六、其他组件设计`
|
|
60
|
+
- `七、接口设计`
|
|
61
|
+
- `八、系统发布`
|
|
62
|
+
- `九、系统监控与维护`
|
|
63
|
+
- `十、排期与规划`
|
|
64
|
+
- `十一、QA`
|
|
65
|
+
|
|
66
|
+
The `十、排期与规划` section must include a `Planning Handoff` subsection stating what `plan` may decide without re-opening design and what must return to `clarify` or `spec`.
|
|
67
|
+
|
|
68
|
+
## Handoff
|
|
69
|
+
|
|
70
|
+
After the spec is complete, recommend:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
$plan docs/loopx/design/<需求名>需求设计文档.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use `plan` only after the design document is internally consistent and all material requirements questions are resolved.
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagent-exec
|
|
3
|
+
description: "Executes approved loopx implementation plans with fresh subagents per independent task and staged review. Not for planning, unclear requirements, or tightly coupled edits."
|
|
4
|
+
when_to_use: "approved implementation plan, independent tasks, subagent execution, staged spec review, code quality review, parallel-capable execution"
|
|
5
|
+
metadata:
|
|
6
|
+
version: "0.2.1"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Subagent Exec
|
|
10
|
+
|
|
11
|
+
Execute plan by dispatching fresh subagent per task, with two-stage review after each: spec compliance review first, then code quality review.
|
|
12
|
+
|
|
13
|
+
**Why subagents:** You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
|
|
14
|
+
|
|
15
|
+
**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration
|
|
16
|
+
|
|
17
|
+
**Continuous execution:** Do not pause to check in with your human partner between tasks. Execute all tasks from the plan without stopping. The only reasons to stop are: BLOCKED status you cannot resolve, ambiguity that genuinely prevents progress, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
20
|
+
|
|
21
|
+
```dot
|
|
22
|
+
digraph when_to_use {
|
|
23
|
+
"Have implementation plan?" [shape=diamond];
|
|
24
|
+
"Tasks mostly independent?" [shape=diamond];
|
|
25
|
+
"Stay in this session?" [shape=diamond];
|
|
26
|
+
"subagent-exec" [shape=box];
|
|
27
|
+
"exec" [shape=box];
|
|
28
|
+
"Manual execution or brainstorm first" [shape=box];
|
|
29
|
+
|
|
30
|
+
"Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];
|
|
31
|
+
"Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
|
|
32
|
+
"Tasks mostly independent?" -> "Stay in this session?" [label="yes"];
|
|
33
|
+
"Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];
|
|
34
|
+
"Stay in this session?" -> "subagent-exec" [label="yes"];
|
|
35
|
+
"Stay in this session?" -> "exec" [label="no - parallel session"];
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**vs. Exec (parallel session):**
|
|
40
|
+
- Same session (no context switch)
|
|
41
|
+
- Fresh subagent per task (no context pollution)
|
|
42
|
+
- Two-stage review after each task: spec compliance first, then code quality
|
|
43
|
+
- Faster iteration (no human-in-loop between tasks)
|
|
44
|
+
|
|
45
|
+
## The Process
|
|
46
|
+
|
|
47
|
+
```dot
|
|
48
|
+
digraph process {
|
|
49
|
+
rankdir=TB;
|
|
50
|
+
|
|
51
|
+
subgraph cluster_per_task {
|
|
52
|
+
label="Per Task";
|
|
53
|
+
"Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
|
|
54
|
+
"Implementer subagent asks questions?" [shape=diamond];
|
|
55
|
+
"Answer questions, provide context" [shape=box];
|
|
56
|
+
"Implementer subagent implements, tests, commits, self-reviews" [shape=box];
|
|
57
|
+
"Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)" [shape=box];
|
|
58
|
+
"Spec reviewer subagent confirms code matches spec?" [shape=diamond];
|
|
59
|
+
"Implementer subagent fixes spec gaps" [shape=box];
|
|
60
|
+
"Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [shape=box];
|
|
61
|
+
"Code quality reviewer subagent approves?" [shape=diamond];
|
|
62
|
+
"Implementer subagent fixes quality issues" [shape=box];
|
|
63
|
+
"Mark task complete in update_plan" [shape=box];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
"Read plan, extract all tasks with full text, note context, create update_plan" [shape=box];
|
|
67
|
+
"More tasks remain?" [shape=diamond];
|
|
68
|
+
"Dispatch final code reviewer subagent for entire implementation" [shape=box];
|
|
69
|
+
"Use loopx:finish" [shape=box style=filled fillcolor=lightgreen];
|
|
70
|
+
|
|
71
|
+
"Read plan, extract all tasks with full text, note context, create update_plan" -> "Dispatch implementer subagent (./implementer-prompt.md)";
|
|
72
|
+
"Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer subagent asks questions?";
|
|
73
|
+
"Implementer subagent asks questions?" -> "Answer questions, provide context" [label="yes"];
|
|
74
|
+
"Answer questions, provide context" -> "Dispatch implementer subagent (./implementer-prompt.md)";
|
|
75
|
+
"Implementer subagent asks questions?" -> "Implementer subagent implements, tests, commits, self-reviews" [label="no"];
|
|
76
|
+
"Implementer subagent implements, tests, commits, self-reviews" -> "Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)";
|
|
77
|
+
"Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)" -> "Spec reviewer subagent confirms code matches spec?";
|
|
78
|
+
"Spec reviewer subagent confirms code matches spec?" -> "Implementer subagent fixes spec gaps" [label="no"];
|
|
79
|
+
"Implementer subagent fixes spec gaps" -> "Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)" [label="re-review"];
|
|
80
|
+
"Spec reviewer subagent confirms code matches spec?" -> "Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [label="yes"];
|
|
81
|
+
"Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" -> "Code quality reviewer subagent approves?";
|
|
82
|
+
"Code quality reviewer subagent approves?" -> "Implementer subagent fixes quality issues" [label="no"];
|
|
83
|
+
"Implementer subagent fixes quality issues" -> "Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [label="re-review"];
|
|
84
|
+
"Code quality reviewer subagent approves?" -> "Mark task complete in update_plan" [label="yes"];
|
|
85
|
+
"Mark task complete in update_plan" -> "More tasks remain?";
|
|
86
|
+
"More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
|
|
87
|
+
"More tasks remain?" -> "Dispatch final code reviewer subagent for entire implementation" [label="no"];
|
|
88
|
+
"Dispatch final code reviewer subagent for entire implementation" -> "Use loopx:finish";
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Model Selection
|
|
93
|
+
|
|
94
|
+
Use the least powerful model that can handle each role to conserve cost and increase speed.
|
|
95
|
+
|
|
96
|
+
**Mechanical implementation tasks** (isolated functions, clear specs, 1-2 files): use a fast, cheap model. Most implementation tasks are mechanical when the plan is well-specified.
|
|
97
|
+
|
|
98
|
+
**Integration and judgment tasks** (multi-file coordination, pattern matching, debugging): use a standard model.
|
|
99
|
+
|
|
100
|
+
**Architecture, design, and review tasks**: use the most capable available model.
|
|
101
|
+
|
|
102
|
+
**Task complexity signals:**
|
|
103
|
+
- Touches 1-2 files with a complete spec → cheap model
|
|
104
|
+
- Touches multiple files with integration concerns → standard model
|
|
105
|
+
- Requires design judgment or broad codebase understanding → most capable model
|
|
106
|
+
|
|
107
|
+
## Handling Implementer Status
|
|
108
|
+
|
|
109
|
+
Implementer subagents report one of four statuses. Handle each appropriately:
|
|
110
|
+
|
|
111
|
+
**DONE:** Proceed to spec compliance review.
|
|
112
|
+
|
|
113
|
+
**DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review.
|
|
114
|
+
|
|
115
|
+
**NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.
|
|
116
|
+
|
|
117
|
+
**BLOCKED:** The implementer cannot complete the task. Assess the blocker:
|
|
118
|
+
1. If it's a context problem, provide more context and re-dispatch with the same model
|
|
119
|
+
2. If the task requires more reasoning, re-dispatch with a more capable model
|
|
120
|
+
3. If the task is too large, break it into smaller pieces
|
|
121
|
+
4. If the plan itself is wrong, escalate to the human
|
|
122
|
+
|
|
123
|
+
**Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.
|
|
124
|
+
|
|
125
|
+
## Prompt Templates
|
|
126
|
+
|
|
127
|
+
- `./codex-subagents.md` - Codex subagent tool mapping and required runtime support
|
|
128
|
+
- `./implementer-prompt.md` - Dispatch implementer subagent
|
|
129
|
+
- `./spec-reviewer-prompt.md` - Dispatch spec compliance reviewer subagent
|
|
130
|
+
- `./code-quality-reviewer-prompt.md` - Dispatch code quality reviewer subagent
|
|
131
|
+
|
|
132
|
+
## Example Workflow
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
You: I'm using Subagent Exec to execute this plan.
|
|
136
|
+
|
|
137
|
+
[Read plan file once: docs/loopx/plans/feature-plan.md]
|
|
138
|
+
[Extract all 5 tasks with full text and context]
|
|
139
|
+
[create update_plan with all tasks]
|
|
140
|
+
|
|
141
|
+
Task 1: Hook installation script
|
|
142
|
+
|
|
143
|
+
[Get Task 1 text and context (already extracted)]
|
|
144
|
+
[Dispatch implementation subagent with full task text + context]
|
|
145
|
+
|
|
146
|
+
Implementer: "Before I begin - should the hook be installed at user or system level?"
|
|
147
|
+
|
|
148
|
+
You: "User level (~/.config/loopx/hooks/)"
|
|
149
|
+
|
|
150
|
+
Implementer: "Got it. Implementing now..."
|
|
151
|
+
[Later] Implementer:
|
|
152
|
+
- Implemented install-hook command
|
|
153
|
+
- Added tests, 5/5 passing
|
|
154
|
+
- Self-review: Found I missed --force flag, added it
|
|
155
|
+
- Committed
|
|
156
|
+
|
|
157
|
+
[Dispatch spec compliance reviewer]
|
|
158
|
+
Spec reviewer: ✅ Spec compliant - all requirements met, nothing extra
|
|
159
|
+
|
|
160
|
+
[Get git SHAs, dispatch code quality reviewer]
|
|
161
|
+
Code reviewer: Strengths: Good test coverage, clean. Issues: None. Approved.
|
|
162
|
+
|
|
163
|
+
[Mark Task 1 complete]
|
|
164
|
+
|
|
165
|
+
Task 2: Recovery modes
|
|
166
|
+
|
|
167
|
+
[Get Task 2 text and context (already extracted)]
|
|
168
|
+
[Dispatch implementation subagent with full task text + context]
|
|
169
|
+
|
|
170
|
+
Implementer: [No questions, proceeds]
|
|
171
|
+
Implementer:
|
|
172
|
+
- Added verify/repair modes
|
|
173
|
+
- 8/8 tests passing
|
|
174
|
+
- Self-review: All good
|
|
175
|
+
- Committed
|
|
176
|
+
|
|
177
|
+
[Dispatch spec compliance reviewer]
|
|
178
|
+
Spec reviewer: ❌ Issues:
|
|
179
|
+
- Missing: Progress reporting (spec says "report every 100 items")
|
|
180
|
+
- Extra: Added --json flag (not requested)
|
|
181
|
+
|
|
182
|
+
[Implementer fixes issues]
|
|
183
|
+
Implementer: Removed --json flag, added progress reporting
|
|
184
|
+
|
|
185
|
+
[Spec reviewer reviews again]
|
|
186
|
+
Spec reviewer: ✅ Spec compliant now
|
|
187
|
+
|
|
188
|
+
[Dispatch code quality reviewer]
|
|
189
|
+
Code reviewer: Strengths: Solid. Issues (Important): Magic number (100)
|
|
190
|
+
|
|
191
|
+
[Implementer fixes]
|
|
192
|
+
Implementer: Extracted PROGRESS_INTERVAL constant
|
|
193
|
+
|
|
194
|
+
[Code reviewer reviews again]
|
|
195
|
+
Code reviewer: ✅ Approved
|
|
196
|
+
|
|
197
|
+
[Mark Task 2 complete]
|
|
198
|
+
|
|
199
|
+
...
|
|
200
|
+
|
|
201
|
+
[After all tasks]
|
|
202
|
+
[Dispatch final code-reviewer]
|
|
203
|
+
Final reviewer: All requirements met, ready to merge
|
|
204
|
+
|
|
205
|
+
Done!
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Advantages
|
|
209
|
+
|
|
210
|
+
**vs. Manual execution:**
|
|
211
|
+
- Subagents follow TDD naturally
|
|
212
|
+
- Fresh context per task (no confusion)
|
|
213
|
+
- Parallel-safe (subagents don't interfere)
|
|
214
|
+
- Subagent can ask questions (before AND during work)
|
|
215
|
+
|
|
216
|
+
**vs. Exec:**
|
|
217
|
+
- Same session (no handoff)
|
|
218
|
+
- Continuous progress (no waiting)
|
|
219
|
+
- Review checkpoints automatic
|
|
220
|
+
|
|
221
|
+
**Efficiency gains:**
|
|
222
|
+
- No file reading overhead (controller provides full text)
|
|
223
|
+
- Controller curates exactly what context is needed
|
|
224
|
+
- Subagent gets complete information upfront
|
|
225
|
+
- Questions surfaced before work begins (not after)
|
|
226
|
+
|
|
227
|
+
**Quality gates:**
|
|
228
|
+
- Self-review catches issues before handoff
|
|
229
|
+
- Two-stage review: spec compliance, then code quality
|
|
230
|
+
- Review loops ensure fixes actually work
|
|
231
|
+
- Spec compliance prevents over/under-building
|
|
232
|
+
- Code quality ensures implementation is well-built
|
|
233
|
+
|
|
234
|
+
**Cost:**
|
|
235
|
+
- More subagent invocations (implementer + 2 reviewers per task)
|
|
236
|
+
- Controller does more prep work (extracting all tasks upfront)
|
|
237
|
+
- Review loops add iterations
|
|
238
|
+
- But catches issues early (cheaper than debugging later)
|
|
239
|
+
|
|
240
|
+
## Red Flags
|
|
241
|
+
|
|
242
|
+
**Never:**
|
|
243
|
+
- Skip reviews (spec compliance OR code quality)
|
|
244
|
+
- Proceed with unfixed issues
|
|
245
|
+
- Dispatch multiple implementation subagents in parallel (conflicts)
|
|
246
|
+
- Make subagent read plan file (provide full text instead)
|
|
247
|
+
- Skip scene-setting context (subagent needs to understand where task fits)
|
|
248
|
+
- Ignore subagent questions (answer before letting them proceed)
|
|
249
|
+
- Accept "close enough" on spec compliance (spec reviewer found issues = not done)
|
|
250
|
+
- Skip review loops (reviewer found issues = implementer fixes = review again)
|
|
251
|
+
- Let implementer self-review replace actual review (both are needed)
|
|
252
|
+
- **Start code quality review before spec compliance is ✅** (wrong order)
|
|
253
|
+
- Move to next task while either review has open issues
|
|
254
|
+
|
|
255
|
+
**If subagent asks questions:**
|
|
256
|
+
- Answer clearly and completely
|
|
257
|
+
- Provide additional context if needed
|
|
258
|
+
- Don't rush them into implementation
|
|
259
|
+
|
|
260
|
+
**If reviewer finds issues:**
|
|
261
|
+
- Implementer (same subagent) fixes them
|
|
262
|
+
- Reviewer reviews again
|
|
263
|
+
- Repeat until approved
|
|
264
|
+
- Don't skip the re-review
|
|
265
|
+
|
|
266
|
+
**If subagent fails task:**
|
|
267
|
+
- Dispatch fix subagent with specific instructions
|
|
268
|
+
- Don't try to fix manually (context pollution)
|
|
269
|
+
|
|
270
|
+
## Integration
|
|
271
|
+
|
|
272
|
+
**Required workflow skills:**
|
|
273
|
+
|
|
274
|
+
- **loopx:plan** - Creates the plan this skill executes
|
|
275
|
+
- **loopx:review** - Code review template for reviewer subagents
|
|
276
|
+
- **loopx:finish** - Complete development after all tasks
|
|
277
|
+
|
|
278
|
+
**Subagents should use:**
|
|
279
|
+
- **loopx:tdd** - Subagents follow TDD for each task
|
|
280
|
+
|
|
281
|
+
**Alternative workflow:**
|
|
282
|
+
- **loopx:exec** - Use for parallel session instead of same-session execution
|