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/start.md CHANGED
@@ -52,9 +52,9 @@ Step 1: 初始化 .openmatrix 目录
52
52
  Step 2: 验证前置条件(plan.md + tasks-input.json 必须已存在)
53
53
  Step 3: 智能分析任务类型(开发/非开发)
54
54
  Step 4: 提交文档(git add docs/ + 所有 .md 文件, commit)
55
- Step 5: 必选问题(开发任务:质量等级; 严格模式可选E2E; 非开发:跳过)<- 不可跳过
55
+ Step 5: 必选问题(开发任务:质量等级+E2E+Agent模式; 非开发:仅Agent模式)<- 不可跳过
56
56
  Step 6: 可选问题(仅复杂开发任务)+ 展示执行计划
57
- Step 7: 调用 openmatrix start --tasks-json <- 必须完成,不可跳过
57
+ Step 7: 调用 openmatrix start --tasks-json --parallel/--single-agent <- 必须完成,不可跳过
58
58
  Step 8: 从 CLI 返回结果中读取 subagentTasks 列表 <- 必须完成
59
59
  Step 9: 逐个执行 subagentTasks(调用 Agent 工具) <- 只有这步才能写代码
60
60
  ```
@@ -62,12 +62,13 @@ Step 9: 逐个执行 subagentTasks(调用 Agent 工具) <- 只有
62
62
  **违反以下任一规则将导致任务执行失败:**
63
63
 
64
64
  - **禁止在 Step 9 之前写任何业务代码** — 所有代码必须在 Step 9 通过 Agent 执行
65
- - **禁止跳过 Step 5 必选问题** — 开发任务必须选质量等级,非开发任务无需问答
65
+ - **禁止跳过 Step 5 必选问题** — 开发任务必须选质量等级+Agent模式,非开发任务必须选Agent模式
66
66
  - **禁止跳过 Step 7** — 必须调用 CLI,不能用其他方式代替
67
67
  - **禁止自行规划 Phase** — 任务由 CLI 的 TaskPlanner 拆分,AI 只提取 goals
68
68
  - **禁止用 Bash/npm/write 直接写业务代码** — 业务代码只能通过 Step 9 的 Agent 执行
69
69
  - **禁止在 start 中生成 plan** — plan 由 /om:plan 生成,start 只负责执行
70
70
  - **使用 Agent 工具执行子任务** — 不通过其他编排系统
71
+ - **禁止省略 Agent 模式参数** — CLI 命令必须包含 --parallel 或 --single-agent
71
72
  </MANDATORY-EXECUTION-ORDER>
72
73
 
73
74
  <IRON-LAW>
@@ -248,9 +249,11 @@ EOF
248
249
 
249
250
  | goalTypes | 需要询问 |
250
251
  |-----------|---------|
251
- | `development` | 5.1 质量等级 -> 5.2 E2E(仅严格模式可选) |
252
- | `testing` | 无需问答,直接进入 Step 7 |
253
- | `documentation` / `other` | 无需问答,直接进入 Step 7 |
252
+ | `development` | 5.1 质量等级 -> 5.2 E2E(仅严格模式可选) -> 5.3 Agent 模式 |
253
+ | `testing` | 5.3 Agent 模式(其他跳过) |
254
+ | `documentation` / `other` | 5.3 Agent 模式(其他跳过) |
255
+
256
+ **注意**:所有任务类型都需要选择 Agent 模式(Step 5.3),因为这影响执行效率。
254
257
 
255
258
  #### 5.1 质量等级(仅 `goalTypes: development`)
256
259
 
@@ -269,12 +272,14 @@ AskUserQuestion: `header: "质量等级"`, `multiSelect: false`
269
272
  | 模式 | E2E | AI 验收 | 执行方式 |
270
273
  |-----|-----|---------|---------|
271
274
  | 严格模式 | 可选问一句(Step 5.2) | 必须 | TDD(先测试后开发) |
272
- | 平衡模式 | 不需要(自动跳过) | 必须 | 先开发后测试 |
275
+ | 平衡模式 | 可选问一句(Step 5.2) | 必须 | 先开发后测试 |
273
276
  | 快速模式 | 不需要(自动跳过) | 不需要 | 直接开发 |
274
277
 
275
- #### 5.2 E2E 测试(仅 `严格模式` 可选,其他模式自动跳过)
278
+ #### 5.2 E2E 测试(仅 `严格模式/平衡模式` 可选,快速模式自动跳过)
279
+
280
+ **只有选择「严格模式」或「平衡模式」时才询问此问题,快速模式自动推断为「不需要」。**
276
281
 
277
- **只有选择「严格模式」时才询问此问题,平衡模式和快速模式自动推断为「不需要」。**
282
+ **注意:E2E 测试耗时较长,仅在涉及前端页面/UI/Web 的任务时询问,其他类型任务默认跳过。**
278
283
 
279
284
  AskUserQuestion: `header: "E2E 测试"`, `multiSelect: false`
280
285
 
@@ -286,16 +291,86 @@ AskUserQuestion: `header: "E2E 测试"`, `multiSelect: false`
286
291
  | `视觉验证` | 需要浏览器可视化验证,可检查页面样式和布局 |
287
292
  | `不需要` | 仅进行单元测试和集成测试,节省时间 |
288
293
 
289
- #### 执行模式自动推断
294
+ #### 5.3 Agent 执行模式(所有任务类型)
295
+
296
+ **Agent 执行模式决定任务如何分配和执行,是影响效率的关键决策。**
290
297
 
291
- **执行模式不再通过问答选择,而是根据质量等级自动推断:**
298
+ AskUserQuestion: `header: "Agent 模式"`, `multiSelect: false`
292
299
 
293
- - **严格模式** 全自动执行 + TDD 流程
294
- - **平衡模式** → 全自动执行 + 先开发后测试
295
- - **快速模式** 全自动执行 + 直接开发
300
+ **question:** 选择 Agent 执行模式(决定任务如何分配和执行)
301
+
302
+ | label | description |
303
+ |-------|-------------|
304
+ | `多 Agent 并行 (推荐)` | 多个 Agent 同时执行独立任务,速度快,适合任务边界清晰的项目 |
305
+ | `单 Agent 串行` | 一个 Agent 顺序执行所有任务,上下文连贯,适合复杂依赖任务 |
306
+
307
+ **两种模式的详细对比:**
308
+
309
+ | 特性 | 多 Agent 并行 | 单 Agent 串行 |
310
+ |-----|--------------|--------------|
311
+ | **执行速度** | ⚡ 快(并行执行) | 🐢 慢(顺序执行) |
312
+ | **上下文连贯性** | ⚠️ 可能不连贯 | ✅ 完全连贯 |
313
+ | **决策一致性** | ⚠️ 各 Agent 可能不同 | ✅ 单一决策者 |
314
+ | **任务独立性** | ✅ 失败不影响其他 | ❌ 一个失败可能阻塞后续 |
315
+ | **内存占用** | ⚠️ 较高(多个进程) | ✅ 较低(单进程) |
316
+ | **依赖处理** | ⚠️ 需要等待依赖完成 | ✅ 自动处理依赖 |
317
+ | **调试难度** | ⚠️ 多 Agent 日志分散 | ✅ 单一日志流 |
318
+ | **适用场景** | 任务边界清晰、无复杂依赖 | 任务间强依赖、需要全局视角 |
319
+
320
+ **推荐选择指南:**
321
+
322
+ ```
323
+ 任务特点判断流程:
324
+
325
+ ┌─────────────────────────────────────┐
326
+ │ 任务之间是否有强依赖关系? │
327
+ │ (例如: 任务B 需要 任务A 的产出) │
328
+ └──────────────┬──────────────────────┘
329
+
330
+ ┌──────┴──────┐
331
+ │ │
332
+ 有依赖 无依赖
333
+ │ │
334
+ ▼ ▼
335
+ 单 Agent 多 Agent
336
+ 串行模式 并行模式
337
+ │ │
338
+ │ │
339
+ ┌────┴────┐ ┌────┴────┐
340
+ │ │ │ │
341
+ │ 上下文 │ │ 速度快 │
342
+ │ 连贯 │ │ 效率高 │
343
+ │ 决策一致 │ │ 独立性 │
344
+ └──────────┘ └──────────┘
345
+ ```
346
+
347
+ **典型场景推荐:**
348
+
349
+ | 场景 | 推荐 | 理由 |
350
+ |-----|------|------|
351
+ | 重构模块结构 | 单 Agent | 需要全局视角,任务间强关联 |
352
+ | 添加多个独立 API | 多 Agent | 任务独立,并行效率高 |
353
+ | 实现完整功能流程 | 单 Agent | 有上下文依赖,需要连贯决策 |
354
+ | 批量修复多个 bug | 多 Agent | 各 bug 独立,可并行 |
355
+ | 从零搭建系统 | 单 Agent | 架构决策需要一致性 |
356
+ | 添加多个测试文件 | 多 Agent | 测试文件独立,并行快 |
357
+
358
+ #### 审批模式自动推断
359
+
360
+ **审批模式不再通过问答选择,而是根据质量等级自动推断:**
361
+
362
+ | 质量等级 | 审批模式 | 执行流程 |
363
+ |---------|---------|---------|
364
+ | 严格模式 | 全自动执行 | TDD(先测试后开发) |
365
+ | 平衡模式 | 全自动执行 | 先开发后测试 |
366
+ | 快速模式 | 全自动执行 | 直接开发 |
296
367
 
297
368
  **非开发任务**(testing/documentation/other)默认使用「全自动执行」。
298
369
 
370
+ **注意**:审批模式(approval mode)和 Agent 模式(agent mode)是两个独立的配置:
371
+ - **审批模式**:决定是否需要用户确认(自动推断,无需问答)
372
+ - **Agent 模式**:决定任务执行方式(并行 vs 串行,Step 5.3 问答选择)
373
+
299
374
  #### 常见借口
300
375
 
301
376
  | 借口 | 真相 |
@@ -336,7 +411,7 @@ Goals:
336
411
 
337
412
  **CLI 自动从当前 runId 目录读取 tasks-input.json 和 plan.md。**
338
413
 
339
- **根据质量等级自动设置执行参数:**
414
+ **根据质量等级和 Agent 模式自动设置执行参数:**
340
415
 
341
416
  | 质量等级 | CLI 参数 | 执行方式 |
342
417
  |---------|---------|---------|
@@ -344,32 +419,46 @@ Goals:
344
419
  | 平衡模式 | `--quality balanced --mode auto` | 先开发后测试 |
345
420
  | 快速模式 | `--quality fast --mode auto` | 直接开发 |
346
421
 
347
- **开发任务**(有质量等级选择):
422
+ | Agent 模式 | CLI 参数 | 执行方式 |
423
+ |-----------|---------|---------|
424
+ | 多 Agent 并行 | `--parallel` | 多个 Agent 同时执行 |
425
+ | 单 Agent 串行 | `--single-agent` | 一个 Agent 顺序执行 |
426
+
427
+ **开发任务**(有质量等级 + Agent 模式选择):
428
+
348
429
  ```bash
349
- openmatrix start --tasks-json @tasks-input.json --quality <质量等级> --mode auto --json
430
+ # Agent 并行模式(默认推荐)
431
+ openmatrix start --tasks-json @tasks-input.json --quality <质量等级> --mode auto --parallel --json
432
+
433
+ # 单 Agent 串行模式
434
+ openmatrix start --tasks-json @tasks-input.json --quality <质量等级> --mode auto --single-agent --json
350
435
  ```
351
436
 
352
437
  如果存在研究上下文(`.openmatrix/{runId}/research/context.json`),增加 `--research-context` 参数:
353
438
  ```bash
354
- openmatrix start --tasks-json @tasks-input.json --research-context @research/context.json --quality <质量等级> --mode auto --json
439
+ openmatrix start --tasks-json @tasks-input.json --research-context @research/context.json --quality <质量等级> --mode auto --parallel --json
355
440
  ```
356
441
 
357
442
  如果启用了 E2E 测试(功能测试),加上 `--e2e-tests`:
358
443
  ```bash
359
- openmatrix start --tasks-json @tasks-input.json --quality strict --mode auto --e2e-tests --json
444
+ openmatrix start --tasks-json @tasks-input.json --quality strict --mode auto --parallel --e2e-tests --json
360
445
  ```
361
446
 
362
447
  如果选择了视觉验证,加上 `--e2e-tests --e2e-type visual`:
363
448
  ```bash
364
- openmatrix start --tasks-json @tasks-input.json --quality strict --mode auto --e2e-tests --e2e-type visual --json
449
+ openmatrix start --tasks-json @tasks-input.json --quality strict --mode auto --parallel --e2e-tests --e2e-type visual --json
365
450
  ```
366
451
 
367
- **非开发任务**(无质量等级,默认全自动执行):
452
+ **非开发任务**(无质量等级,但需要 Agent 模式选择):
368
453
  ```bash
369
- openmatrix start --tasks-json @tasks-input.json --mode auto --json
454
+ # Agent 并行模式
455
+ openmatrix start --tasks-json @tasks-input.json --mode auto --parallel --json
456
+
457
+ # 单 Agent 串行模式
458
+ openmatrix start --tasks-json @tasks-input.json --mode auto --single-agent --json
370
459
  ```
371
460
 
372
- **注意**: `@tasks-input.json` 表示 CLI 自动从当前 runId 目录读取。CLI 会自动检测 `current.json` 定位 runId
461
+ **注意**: `@tasks-input.json` 表示 CLI 自动从当前 runId 目录读取文件。CLI 会检测 `.openmatrix/current.json` 获取 runId,然后读取 `.openmatrix/{runId}/tasks-input.json`。
373
462
 
374
463
  此命令返回 JSON 包含 `subagentTasks` 列表。
375
464
 
@@ -638,9 +727,10 @@ Agent-1 完成 -> 写入 context.md -> Agent-2 读取 Agent-1 的上下文 ->
638
727
  ```
639
728
 
640
729
  **中断恢复:** 如果会话中断,再次执行 `/om:start` 时:
641
- 1. 读取 `.openmatrix/state.json`
642
- 2. 如果 `status === 'running'`,读取所有任务,找到 status 不是 completed 的任务
643
- 3. 从中断的任务继续执行,不需要重新开始
730
+ 1. 读取 `.openmatrix/current.json` 获取 runId
731
+ 2. 读取 `.openmatrix/${runId}/state.json`
732
+ 3. 如果 `status === 'running'`,读取所有任务,找到 status 不是 completed 的任务
733
+ 4. 从中断的任务继续执行,不需要重新开始
644
734
 
645
735
  **Meeting 处理(auto 模式):** 记录并跳过,执行完成后统一展示。
646
736
 
@@ -740,7 +830,7 @@ Step 1-2: 初始化 + 验证前置条件 -> Step 3-4: 分析类型 + 提交文
740
830
  | 质量等级 | E2E 问题 | AI 验收 | 执行模式 |
741
831
  |---------|---------|---------|---------|
742
832
  | 严格模式 | 可选问一句 | 必须 | 全自动 + TDD |
743
- | 平衡模式 | 不需要 | 必须 | 全自动 + 先开发后测试 |
833
+ | 平衡模式 | 可选问一句 | 必须 | 全自动 + 先开发后测试 |
744
834
  | 快速模式 | 不需要 | 不需要 | 全自动 + 直接开发 |
745
835
 
746
836
  ## Git 提交格式
package/skills/status.md CHANGED
@@ -43,10 +43,11 @@ description: "Use when checking task execution progress, run status, completion
43
43
  </objective>
44
44
 
45
45
  <process>
46
- 1. 读取 `.openmatrix/state.json` 获取全局状态
47
- 2. 读取 `.openmatrix/tasks/` 下所有任务
48
- 3. 读取 `.openmatrix/approvals/` 下待处理审批
49
- 4. 展示格式化状态概览
46
+ 1. 读取 `.openmatrix/current.json` 获取当前 runId
47
+ 2. 读取 `.openmatrix/{runId}/state.json` 获取全局状态
48
+ 3. 读取 `.openmatrix/{runId}/tasks/` 下所有任务
49
+ 4. 读取 `.openmatrix/{runId}/approvals/` 下待处理审批
50
+ 5. 展示格式化状态概览
50
51
 
51
52
  ## 输出格式
52
53