openmatrix 0.2.30 → 0.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +154 -154
  2. package/dist/cli/commands/approve.js +35 -1
  3. package/dist/cli/commands/auto.js +2 -2
  4. package/dist/cli/commands/check-gitignore.js +34 -30
  5. package/dist/cli/commands/check.js +1 -1
  6. package/dist/cli/commands/complete.js +35 -7
  7. package/dist/cli/commands/debug.js +2 -1
  8. package/dist/cli/commands/deploy.js +1 -1
  9. package/dist/cli/commands/install-skills.js +3 -0
  10. package/dist/cli/commands/meeting.js +37 -1
  11. package/dist/cli/commands/report.js +1 -1
  12. package/dist/cli/commands/resume.js +35 -1
  13. package/dist/cli/commands/retry.js +130 -56
  14. package/dist/cli/commands/start.js +14 -3
  15. package/dist/cli/commands/status.js +32 -29
  16. package/dist/cli/commands/step.js +4 -1
  17. package/dist/orchestrator/ai-reviewer.d.ts +5 -0
  18. package/dist/orchestrator/ai-reviewer.js +9 -2
  19. package/dist/orchestrator/context-collector.js +17 -5
  20. package/dist/orchestrator/executor.d.ts +8 -0
  21. package/dist/orchestrator/executor.js +38 -8
  22. package/dist/orchestrator/phase-executor.d.ts +4 -0
  23. package/dist/orchestrator/phase-executor.js +21 -4
  24. package/dist/storage/file-store.js +8 -0
  25. package/dist/storage/state-manager.js +52 -19
  26. package/dist/test/generator.js +113 -113
  27. package/dist/types/index.d.ts +2 -0
  28. package/dist/utils/error-handler.d.ts +18 -0
  29. package/dist/utils/error-handler.js +32 -0
  30. package/dist/utils/worktree-sync.js +24 -3
  31. package/package.json +61 -61
  32. package/skills/SKILL.md +53 -53
  33. package/skills/auto.md +410 -413
  34. package/skills/brainstorm.md +19 -12
  35. package/skills/debug.md +694 -691
  36. package/skills/deploy.md +658 -658
  37. package/skills/feature.md +713 -686
  38. package/skills/plan.md +298 -296
  39. package/skills/report.md +9 -5
  40. package/skills/resume.md +292 -287
  41. package/skills/start.md +117 -27
  42. package/skills/status.md +5 -4
  43. package/skills/test.md +875 -875
  44. package/dist/agents/base-agent.d.ts +0 -46
  45. package/dist/agents/base-agent.js +0 -17
  46. package/dist/cli/commands/analyze.d.ts +0 -2
  47. package/dist/cli/commands/analyze.js +0 -50
  48. package/dist/orchestrator/smart-question-analyzer.d.ts +0 -90
  49. package/dist/orchestrator/smart-question-analyzer.js +0 -512
package/skills/plan.md CHANGED
@@ -1,296 +1,298 @@
1
- ---
2
- name: om:plan
3
- description: "Use when user needs to generate a technical plan before task execution. Triggers on PLAN-GENERATION intent: brainstorm completed and user wants to proceed, user explicitly requests plan generation, or needs to create plan.md + tasks-input.json before execution. DO NOT trigger on: direct execution requests (use /om:start), brainstorming (use /om:brainstorm), or status checks. Intent signals: user says 'generate plan', brainstorm outputs design document and routes here, or user wants to review technical plan before executing."
4
- ---
5
-
6
- <INTENT-JUDGMENT>
7
- ## 意图判断指南
8
-
9
- **AI 应根据用户语义判断意图:**
10
-
11
- ### 触发信号(技术方案生成意图)
12
-
13
- - brainstorm 完成,需要生成技术方案
14
- - 用户明确要"生成方案"、"制定计划"
15
- - 需要在执行前形成完整的技术方案
16
- - 已有设计文档,需要转化为可执行的技术方案
17
-
18
- ### 不触发信号
19
-
20
- | 用户意图 | 应调用 |
21
- |---------|--------|
22
- | 需求不明确,需要探索 | /om:brainstorm |
23
- | 已有方案,直接执行 | /om:start |
24
- | 小改动,不需要方案 | /om:feature |
25
- | 查看状态 | /om:status |
26
-
27
- ### 示例判断
28
-
29
- | 用户消息 | 判断 | 结果 |
30
- |---------|------|------|
31
- | "基于刚才的设计生成方案" | 方案生成意图 | 触发 |
32
- | brainstorm 路由过来 | 自动路由 | 触发 |
33
- | "直接开始实现" | 执行意图 | /om:start |
34
- | "这个功能怎么设计" | 设计探索 | /om:brainstorm |
35
- </INTENT-JUDGMENT>
36
-
37
- <NO-OTHER-SKILLS>
38
- 本 skill 与其他任务编排技能功能重叠,请勿同时使用。
39
-
40
- **相关技能**: `/om:brainstorm` (需求探索) | `/om:start` (标准执行) | `/om:feature` (轻量执行) | `/om:auto` (全自动)
41
- </NO-OTHER-SKILLS>
42
-
43
- <MANDATORY-EXECUTION-ORDER>
44
- ## 执行顺序 - 必须严格按此顺序,不得跳过任何步骤
45
-
46
- ```
47
- Step 0: 获取当前 runId(读取 .openmatrix/current.json)
48
- Step 1: 读取输入(brainstorm 设计文档 / 用户描述 / 研究上下文)
49
- Step 2: 生成技术方案,写入 .openmatrix/{runId}/plan.md <- 独立阶段
50
- Step 3: 提取结构化元数据(goals/goalTypes/goalComplexity)
51
- Step 4: 写入 .openmatrix/{runId}/tasks-input.json <- 必须完成
52
- Step 5: 展示执行计划,确认后路由到 start/feature
53
- ```
54
-
55
- **违反以下任一规则将导致方案质量下降:**
56
-
57
- - **禁止跳过 Step 0** - runId 是文件隔离的关键
58
- - **禁止跳过 Step 2** - plan.md 是 Agent 执行的核心参考
59
- - **禁止跳过 Step 3** - goalTypes/goalComplexity 决定任务拆分策略
60
- - **禁止在 plan 阶段写任何业务代码** - 代码在 start/feature 阶段由 Agent 执行
61
- </MANDATORY-EXECUTION-ORDER>
62
-
63
- <objective>
64
- 基于需求分析(brainstorm 产出或用户描述),生成完整的技术方案(plan.md)和结构化元数据(tasks-input.json),为后续执行提供可操作的输入。
65
-
66
- plan 阶段只做方案设计和元数据提取,不写任何业务代码。
67
-
68
- **文件隔离**: 所有文件写入 `.openmatrix/{runId}/` 目录,通过 current.json 获取 runId。
69
- </objective>
70
-
71
- <process>
72
-
73
- ## Step 0: 获取当前 runId
74
-
75
- **读取 current.json 获取当前运行 ID:**
76
- ```bash
77
- cat .openmatrix/current.json 2>/dev/null || echo '{"runId":"run-default"}'
78
- ```
79
-
80
- 从返回结果提取 `runId`,后续所有文件写入 `.openmatrix/{runId}/` 目录。
81
-
82
- **如果没有 runId 或目录不存在:**
83
- ```bash
84
- openmatrix start --init-only --json
85
- ```
86
-
87
- CLI 返回当前 runId。
88
-
89
- ## Step 1: 读取输入
90
-
91
- **按优先级检测输入来源(从 {runId} 目录读取):**
92
-
93
- | 来源 | 检测方式 | 处理 |
94
- |------|---------|------|
95
- | brainstorm 设计文档 | `docs/openmatrix/YYYY-MM-DD-*-design.md` | 读取最新设计文档 |
96
- | 研究上下文 | `.openmatrix/{runId}/research/context.json` | 读取研究目标和报告 |
97
- | `$ARGUMENTS` 直接描述 | 参数非空 | 直接使用 |
98
- | 无输入 | 以上都不存在 | AskUserQuestion 询问 |
99
-
100
- **检测研究上下文(使用 runId):**
101
- ```bash
102
- cat .openmatrix/${runId}/research/context.json 2>/dev/null || echo "NO_RESEARCH"
103
- ```
104
-
105
- 如果检测到研究上下文,同时读取研究报告作为领域知识。
106
-
107
- ## Step 2: 生成技术方案(plan.md)
108
-
109
- **独立阶段 产出供 Agent 执行时参考的技术方案文档。**
110
-
111
- **写入路径: `.openmatrix/{runId}/plan.md`(使用 Step 0 获取的 runId)**
112
-
113
- AI 分析需求,生成完整的技术方案,用 Write 工具写入:
114
-
115
- ```
116
- .openmatrix/{runId}/plan.md
117
- ```
118
-
119
- ```markdown
120
- # 技术方案: 任务标题
121
-
122
- ## 整体架构
123
- (架构图、模块划分、数据流)
124
-
125
- ## 模块设计
126
- (每个模块的职责、接口、依赖关系)
127
-
128
- ## 接口定义
129
- (核心 API / 函数签名 / 数据结构)
130
-
131
- ## 数据模型
132
- (实体关系、表结构、字段定义)
133
-
134
- ## 技术栈
135
- (语言、框架、库、工具)
136
-
137
- ## 关键决策
138
- (技术选型理由、权衡取舍)
139
-
140
- ## 实现顺序建议
141
- (模块间依赖关系,建议的开发顺序)
142
- ```
143
-
144
- **研究上下文集成**: 如果已加载研究领域,AI 应基于研究报告中领域知识生成 plan,包含领域技术栈、架构模式等。
145
-
146
- ## Step 3: 提取结构化元数据
147
-
148
- 从需求和 plan 中提取 CLI 需要的结构化信息:
149
-
150
- - **goals**: 3-8 个明确功能目标,每个是独立可交付模块
151
- - **goalTypes**: 为每个 goal 标注类型(必填,与 goals 一一对应):
152
- - `development` - 需要编写代码的功能/模块实现 -> 拆分为"实现+测试"任务对
153
- - `testing` - 明确的测试任务(如"编写 E2E 测试")-> 单个测试任务
154
- - `documentation` - 文档编写(如"编写 API 文档")-> 单个文档任务
155
- - `other` - 配置、部署、优化等非编码任务 -> 单个任务
156
- - **goalComplexity**: 为每个 goal 标注复杂度(必填,与 goals 一一对应):
157
- - `low` - 简单配置、样式、工具函数
158
- - `medium` - 一般功能实现、测试任务
159
- - `high` - 架构设计、核心模块、复杂业务逻辑
160
- - **constraints**: 技术栈、兼容性等约束
161
- - **deliverables**: 交付物列表
162
-
163
- **goalTypes 标注示例:**
164
-
165
- | Goal | Type | Complexity | 理由 |
166
- |------|------|------------|------|
167
- | "项目脚手架: Vite+TS 配置" | development | low | 配置类 |
168
- | "GameLoop 60fps 游戏循环" | development | high | 核心功能 |
169
- | "所有核心模块的单元测试" | testing | medium | 测试任务 |
170
- | "API 文档编写" | documentation | low | 文档类 |
171
- | "CI/CD 流水线配置" | other | medium | 配置类 |
172
-
173
- ## Step 4: 写入 tasks-input.json
174
-
175
- **写入路径: `.openmatrix/{runId}/tasks-input.json`(使用 Step 0 获取的 runId)**
176
-
177
- Write 工具写入:
178
-
179
- ```json
180
- {
181
- "title": "任务标题",
182
- "description": "整体描述",
183
- "goals": ["目标1", "目标2", "目标3"],
184
- "goalTypes": ["development", "development", "testing"],
185
- "goalComplexity": ["high", "medium", "medium"],
186
- "constraints": ["约束1"],
187
- "deliverables": ["src/xxx.ts"]
188
- }
189
- ```
190
-
191
- **注意:**
192
- - `quality`、`mode`、`e2eTests` 不在此写入,由执行阶段(/om:start)的必选问题决定
193
- - `plan` 不在此写入,plan.md 是独立文件,CLI 会自动读取
194
- - **goalTypes** 必须与 goals 数组长度一致,一一对应
195
- - **goalComplexity** 必须与 goals 数组长度一致,一一对应
196
- - **研究上下文集成**: 如果检测到研究上下文,将研究的 goals/constraints/deliverables 与 AI 提取的内容合并(去重)
197
-
198
- ## Step 5: 展示执行计划并路由
199
-
200
- **展示执行计划:**
201
-
202
- ```
203
- 执行计划
204
-
205
- Goals:
206
- 1. [development/high] 目标1
207
- 2. [development/medium] 目标2
208
- 3. [testing/medium] 目标3
209
-
210
- 质量配置、E2E、执行模式 将在执行阶段选择。
211
-
212
- 技术方案已写入: .openmatrix/{runId}/plan.md
213
- 任务输入已写入: .openmatrix/{runId}/tasks-input.json
214
- ```
215
-
216
- **路由判断:**
217
-
218
- AI 根据 goals 数量和任务特征判断路由:
219
-
220
- | 条件 | 路由 |
221
- |------|------|
222
- | goals <= 2 + 实现路径清晰 | /om:feature |
223
- | goals > 2 + 需完整追踪 | /om:start |
224
- | 用户明确要求全自动 | /om:auto |
225
-
226
- **自动路由到对应 Skill:**
227
-
228
- ```
229
- Skill 工具:
230
- - start → skill = "om:start"
231
- - feature → skill = "om:feature"
232
- - auto → skill = "om:auto"
233
- ```
234
-
235
- - `/om:start` 会检测已存在的 `tasks-input.json` 和 `plan.md`,询问必选问题(质量等级、E2E、执行模式)后执行
236
- - `/om:feature` 使用轻量流程执行小任务
237
- - `/om:auto` 全自动执行,无交互无审批
238
-
239
- </process>
240
-
241
- <arguments>
242
- $ARGUMENTS
243
- </arguments>
244
-
245
- <examples>
246
- /om:plan # 基于 brainstorm 设计文档生成方案
247
- /om:plan "实现用户登录功能" # 基于描述生成方案
248
- /om:plan docs/openmatrix/2024-01-01-login-design.md # 基于指定设计文档
249
- </examples>
250
-
251
- <notes>
252
- ## 流程定位
253
-
254
- ```
255
- brainstorm (澄清需求) → plan (生成方案) → start/feature (执行)
256
- ```
257
-
258
- plan 是连接需求和执行的桥梁:
259
- - 输入: brainstorm 产出的设计文档 / 用户描述
260
- - 输出: plan.md (AI Agent 参考) + tasks-input.json (CLI 解析)
261
-
262
- ## 文件隔离
263
-
264
- 所有 plan 相关文件写入 `.openmatrix/{runId}/` 目录:
265
- - `.openmatrix/{runId}/plan.md` - 技术方案
266
- - `.openmatrix/{runId}/tasks-input.json` - 任务输入元数据
267
- - `.openmatrix/{runId}/research/context.json` - 研究上下文(如果有)
268
-
269
- runId 通过 `current.json` 获取,确保不同运行之间数据隔离。
270
-
271
- ## 与其他 Skill 的关系
272
-
273
- | Skill | plan 的角色 |
274
- |-------|------------|
275
- | /om:brainstorm | 完成后调用 /om:plan |
276
- | /om:start | 读取 plan.md + tasks-input.json 执行 |
277
- | /om:feature | 轻量任务可能不需要 plan |
278
- | /om:auto | 读取 plan.md + tasks-input.json 全自动执行 |
279
-
280
- ## plan.md 的消费方式
281
-
282
- - CLI (TaskPlanner) 不解析 plan 内容,只读取 tasks-input.json
283
- - plan.md 原文注入到每个 Agent 的任务描述中
284
- - Agent 自行理解 plan 中的技术栈、数据模型、接口定义等
285
-
286
- ## 检测已有 plan
287
-
288
- 如果 `.openmatrix/{runId}/plan.md` 已存在:
289
- - 询问用户:使用已有方案 / 重新生成
290
- - 使用已有方案时,跳过 Step 2,直接进入 Step 3 提取元数据
291
-
292
- 通过 CLI 检查:
293
- ```bash
294
- openmatrix status --json | jq '.files.hasPlan'
295
- ```
296
- </notes>
1
+ ---
2
+ name: om:plan
3
+ description: "Use when user needs to generate a technical plan before task execution. Triggers on PLAN-GENERATION intent: brainstorm completed and user wants to proceed, user explicitly requests plan generation, or needs to create plan.md + tasks-input.json before execution. DO NOT trigger on: direct execution requests (use /om:start), brainstorming (use /om:brainstorm), or status checks. Intent signals: user says 'generate plan', brainstorm outputs design document and routes here, or user wants to review technical plan before executing."
4
+ ---
5
+
6
+ <INTENT-JUDGMENT>
7
+ ## 意图判断指南
8
+
9
+ **AI 应根据用户语义判断意图:**
10
+
11
+ ### 触发信号(技术方案生成意图)
12
+
13
+ - brainstorm 完成,需要生成技术方案
14
+ - 用户明确要"生成方案"、"制定计划"
15
+ - 需要在执行前形成完整的技术方案
16
+ - 已有设计文档,需要转化为可执行的技术方案
17
+
18
+ ### 不触发信号
19
+
20
+ | 用户意图 | 应调用 |
21
+ |---------|--------|
22
+ | 需求不明确,需要探索 | /om:brainstorm |
23
+ | 已有方案,直接执行 | /om:start |
24
+ | 小改动,不需要方案 | /om:feature |
25
+ | 查看状态 | /om:status |
26
+
27
+ ### 示例判断
28
+
29
+ | 用户消息 | 判断 | 结果 |
30
+ |---------|------|------|
31
+ | "基于刚才的设计生成方案" | 方案生成意图 | 触发 |
32
+ | brainstorm 路由过来 | 自动路由 | 触发 |
33
+ | "直接开始实现" | 执行意图 | /om:start |
34
+ | "这个功能怎么设计" | 设计探索 | /om:brainstorm |
35
+ </INTENT-JUDGMENT>
36
+
37
+ <NO-OTHER-SKILLS>
38
+ 本 skill 与其他任务编排技能功能重叠,请勿同时使用。
39
+
40
+ **相关技能**: `/om:brainstorm` (需求探索) | `/om:start` (标准执行) | `/om:feature` (轻量执行) | `/om:auto` (全自动)
41
+ </NO-OTHER-SKILLS>
42
+
43
+ <MANDATORY-EXECUTION-ORDER>
44
+ ## 执行顺序 - 必须严格按此顺序,不得跳过任何步骤
45
+
46
+ ```
47
+ Step 0: 获取当前 runId(读取 .openmatrix/current.json)
48
+ Step 1: 读取输入(brainstorm 设计文档 / 用户描述 / 研究上下文)
49
+ Step 2: 生成技术方案,写入 .openmatrix/{runId}/plan.md <- 独立阶段
50
+ Step 3: 提取结构化元数据(goals/goalTypes/goalComplexity)
51
+ Step 4: 写入 .openmatrix/{runId}/tasks-input.json <- 必须完成
52
+ Step 5: 展示执行计划,确认后路由到 start/feature
53
+ ```
54
+
55
+ **违反以下任一规则将导致方案质量下降:**
56
+
57
+ - **禁止跳过 Step 0** - runId 是文件隔离的关键
58
+ - **禁止跳过 Step 2** - plan.md 是 Agent 执行的核心参考
59
+ - **禁止跳过 Step 3** - goalTypes/goalComplexity 决定任务拆分策略
60
+ - **禁止在 plan 阶段写任何业务代码** - 代码在 start/feature 阶段由 Agent 执行
61
+ </MANDATORY-EXECUTION-ORDER>
62
+
63
+ <objective>
64
+ 基于需求分析(brainstorm 产出或用户描述),生成完整的技术方案(plan.md)和结构化元数据(tasks-input.json),为后续执行提供可操作的输入。
65
+
66
+ plan 阶段只做方案设计和元数据提取,不写任何业务代码。
67
+
68
+ **文件隔离**: 所有文件写入 `.openmatrix/{runId}/` 目录,通过 current.json 获取 runId。
69
+ </objective>
70
+
71
+ <process>
72
+
73
+ ## Step 0: 获取当前 runId
74
+
75
+ **读取 current.json 获取当前运行 ID:**
76
+ ```bash
77
+ cat .openmatrix/current.json 2>/dev/null || echo '{"runId":"run-default"}'
78
+ ```
79
+
80
+ 从返回结果提取 `runId`,后续所有文件写入 `.openmatrix/{runId}/` 目录。
81
+
82
+ **注意**: bash 命令中的 `${runId}` 需要在执行前由 AI 替换为实际值。
83
+
84
+ **如果没有 runId 或目录不存在:**
85
+ ```bash
86
+ openmatrix start --init-only --json
87
+ ```
88
+
89
+ CLI 返回当前 runId。
90
+
91
+ ## Step 1: 读取输入
92
+
93
+ **按优先级检测输入来源(从 {runId} 目录读取):**
94
+
95
+ | 来源 | 检测方式 | 处理 |
96
+ |------|---------|------|
97
+ | brainstorm 设计文档 | `docs/openmatrix/YYYY-MM-DD-*-design.md` | 读取最新设计文档 |
98
+ | 研究上下文 | `.openmatrix/{runId}/research/context.json` | 读取研究目标和报告 |
99
+ | `$ARGUMENTS` 直接描述 | 参数非空 | 直接使用 |
100
+ | 无输入 | 以上都不存在 | AskUserQuestion 询问 |
101
+
102
+ **检测研究上下文(使用 runId):**
103
+ ```bash
104
+ cat .openmatrix/${runId}/research/context.json 2>/dev/null || echo "NO_RESEARCH"
105
+ ```
106
+
107
+ 如果检测到研究上下文,同时读取研究报告作为领域知识。
108
+
109
+ ## Step 2: 生成技术方案(plan.md)
110
+
111
+ **独立阶段 产出供 Agent 执行时参考的技术方案文档。**
112
+
113
+ **写入路径: `.openmatrix/{runId}/plan.md`(使用 Step 0 获取的 runId)**
114
+
115
+ AI 分析需求,生成完整的技术方案,用 Write 工具写入:
116
+
117
+ ```
118
+ .openmatrix/{runId}/plan.md
119
+ ```
120
+
121
+ ```markdown
122
+ # 技术方案: 任务标题
123
+
124
+ ## 整体架构
125
+ (架构图、模块划分、数据流)
126
+
127
+ ## 模块设计
128
+ (每个模块的职责、接口、依赖关系)
129
+
130
+ ## 接口定义
131
+ (核心 API / 函数签名 / 数据结构)
132
+
133
+ ## 数据模型
134
+ (实体关系、表结构、字段定义)
135
+
136
+ ## 技术栈
137
+ (语言、框架、库、工具)
138
+
139
+ ## 关键决策
140
+ (技术选型理由、权衡取舍)
141
+
142
+ ## 实现顺序建议
143
+ (模块间依赖关系,建议的开发顺序)
144
+ ```
145
+
146
+ **研究上下文集成**: 如果已加载研究领域,AI 应基于研究报告中领域知识生成 plan,包含领域技术栈、架构模式等。
147
+
148
+ ## Step 3: 提取结构化元数据
149
+
150
+ 从需求和 plan 中提取 CLI 需要的结构化信息:
151
+
152
+ - **goals**: 3-8 个明确功能目标,每个是独立可交付模块
153
+ - **goalTypes**: 为每个 goal 标注类型(必填,与 goals 一一对应):
154
+ - `development` - 需要编写代码的功能/模块实现 -> 拆分为"实现+测试"任务对
155
+ - `testing` - 明确的测试任务(如"编写 E2E 测试")-> 单个测试任务
156
+ - `documentation` - 文档编写(如"编写 API 文档")-> 单个文档任务
157
+ - `other` - 配置、部署、优化等非编码任务 -> 单个任务
158
+ - **goalComplexity**: 为每个 goal 标注复杂度(必填,与 goals 一一对应):
159
+ - `low` - 简单配置、样式、工具函数
160
+ - `medium` - 一般功能实现、测试任务
161
+ - `high` - 架构设计、核心模块、复杂业务逻辑
162
+ - **constraints**: 技术栈、兼容性等约束
163
+ - **deliverables**: 交付物列表
164
+
165
+ **goalTypes 标注示例:**
166
+
167
+ | Goal | Type | Complexity | 理由 |
168
+ |------|------|------------|------|
169
+ | "项目脚手架: Vite+TS 配置" | development | low | 配置类 |
170
+ | "GameLoop 60fps 游戏循环" | development | high | 核心功能 |
171
+ | "所有核心模块的单元测试" | testing | medium | 测试任务 |
172
+ | "API 文档编写" | documentation | low | 文档类 |
173
+ | "CI/CD 流水线配置" | other | medium | 配置类 |
174
+
175
+ ## Step 4: 写入 tasks-input.json
176
+
177
+ **写入路径: `.openmatrix/{runId}/tasks-input.json`(使用 Step 0 获取的 runId)**
178
+
179
+ 用 Write 工具写入:
180
+
181
+ ```json
182
+ {
183
+ "title": "任务标题",
184
+ "description": "整体描述",
185
+ "goals": ["目标1", "目标2", "目标3"],
186
+ "goalTypes": ["development", "development", "testing"],
187
+ "goalComplexity": ["high", "medium", "medium"],
188
+ "constraints": ["约束1"],
189
+ "deliverables": ["src/xxx.ts"]
190
+ }
191
+ ```
192
+
193
+ **注意:**
194
+ - `quality`、`mode`、`e2eTests` 不在此写入,由执行阶段(/om:start)的必选问题决定
195
+ - `plan` 不在此写入,plan.md 是独立文件,CLI 会自动读取
196
+ - **goalTypes** 必须与 goals 数组长度一致,一一对应
197
+ - **goalComplexity** 必须与 goals 数组长度一致,一一对应
198
+ - **研究上下文集成**: 如果检测到研究上下文,将研究的 goals/constraints/deliverables 与 AI 提取的内容合并(去重)
199
+
200
+ ## Step 5: 展示执行计划并路由
201
+
202
+ **展示执行计划:**
203
+
204
+ ```
205
+ 执行计划
206
+
207
+ Goals:
208
+ 1. [development/high] 目标1
209
+ 2. [development/medium] 目标2
210
+ 3. [testing/medium] 目标3
211
+
212
+ 质量配置、E2E、执行模式 将在执行阶段选择。
213
+
214
+ 技术方案已写入: .openmatrix/{runId}/plan.md
215
+ 任务输入已写入: .openmatrix/{runId}/tasks-input.json
216
+ ```
217
+
218
+ **路由判断:**
219
+
220
+ AI 根据 goals 数量和任务特征判断路由:
221
+
222
+ | 条件 | 路由 |
223
+ |------|------|
224
+ | goals <= 2 + 实现路径清晰 | /om:feature |
225
+ | goals > 2 + 需完整追踪 | /om:start |
226
+ | 用户明确要求全自动 | /om:auto |
227
+
228
+ **自动路由到对应 Skill:**
229
+
230
+ ```
231
+ Skill 工具:
232
+ - start → skill = "om:start"
233
+ - feature → skill = "om:feature"
234
+ - auto → skill = "om:auto"
235
+ ```
236
+
237
+ - `/om:start` 会检测已存在的 `tasks-input.json` 和 `plan.md`,询问必选问题(质量等级、E2E、执行模式)后执行
238
+ - `/om:feature` 使用轻量流程执行小任务
239
+ - `/om:auto` 全自动执行,无交互无审批
240
+
241
+ </process>
242
+
243
+ <arguments>
244
+ $ARGUMENTS
245
+ </arguments>
246
+
247
+ <examples>
248
+ /om:plan # 基于 brainstorm 设计文档生成方案
249
+ /om:plan "实现用户登录功能" # 基于描述生成方案
250
+ /om:plan docs/openmatrix/2024-01-01-login-design.md # 基于指定设计文档
251
+ </examples>
252
+
253
+ <notes>
254
+ ## 流程定位
255
+
256
+ ```
257
+ brainstorm (澄清需求) → plan (生成方案) → start/feature (执行)
258
+ ```
259
+
260
+ plan 是连接需求和执行的桥梁:
261
+ - 输入: brainstorm 产出的设计文档 / 用户描述
262
+ - 输出: plan.md (AI Agent 参考) + tasks-input.json (CLI 解析)
263
+
264
+ ## 文件隔离
265
+
266
+ 所有 plan 相关文件写入 `.openmatrix/{runId}/` 目录:
267
+ - `.openmatrix/{runId}/plan.md` - 技术方案
268
+ - `.openmatrix/{runId}/tasks-input.json` - 任务输入元数据
269
+ - `.openmatrix/{runId}/research/context.json` - 研究上下文(如果有)
270
+
271
+ runId 通过 `current.json` 获取,确保不同运行之间数据隔离。
272
+
273
+ ## 与其他 Skill 的关系
274
+
275
+ | Skill | plan 的角色 |
276
+ |-------|------------|
277
+ | /om:brainstorm | 完成后调用 /om:plan |
278
+ | /om:start | 读取 plan.md + tasks-input.json 执行 |
279
+ | /om:feature | 轻量任务可能不需要 plan |
280
+ | /om:auto | 读取 plan.md + tasks-input.json 全自动执行 |
281
+
282
+ ## plan.md 的消费方式
283
+
284
+ - CLI (TaskPlanner) 不解析 plan 内容,只读取 tasks-input.json
285
+ - plan.md 原文注入到每个 Agent 的任务描述中
286
+ - Agent 自行理解 plan 中的技术栈、数据模型、接口定义等
287
+
288
+ ## 检测已有 plan
289
+
290
+ 如果 `.openmatrix/{runId}/plan.md` 已存在:
291
+ - 询问用户:使用已有方案 / 重新生成
292
+ - 使用已有方案时,跳过 Step 2,直接进入 Step 3 提取元数据
293
+
294
+ 通过 CLI 检查:
295
+ ```bash
296
+ openmatrix status --json | jq '.files.hasPlan'
297
+ ```
298
+ </notes>
package/skills/report.md CHANGED
@@ -120,12 +120,16 @@ description: "Use when generating a task execution report with statistics, task
120
120
  <arguments>
121
121
  $ARGUMENTS
122
122
 
123
- --format json|markdown 输出格式
124
- --output path 输出路径
123
+ -f, --format <format> 输出格式 (markdown/json/console),默认 console
124
+ -o, --output <path> 输出文件路径
125
+ --efficiency 包含效率分析
126
+ --graph 包含依赖图
125
127
  </arguments>
126
128
 
127
129
  <examples>
128
- /om:report # 生成并显示报告
129
- /om:report --output report.md # 保存到文件
130
- /om:report --format json # JSON 格式
130
+ /om:report # 生成并显示报告 (默认 console 格式)
131
+ /om:report -f markdown # Markdown 格式输出
132
+ /om:report -f json # JSON 格式输出
133
+ /om:report -o report.md # 保存到文件
134
+ /om:report -f markdown -o report.md --efficiency # 完整报告保存到文件
131
135
  </examples>