@modus-ai/modus 0.2.5 → 0.2.7

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 +62 -45
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +37 -6
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/generators/claude.js +1 -1
  6. package/dist/generators/claude.js.map +1 -1
  7. package/dist/generators/codebuddy.d.ts.map +1 -1
  8. package/dist/generators/codebuddy.js +3 -1
  9. package/dist/generators/codebuddy.js.map +1 -1
  10. package/dist/generators/codex.d.ts +10 -0
  11. package/dist/generators/codex.d.ts.map +1 -0
  12. package/dist/generators/codex.js +178 -0
  13. package/dist/generators/codex.js.map +1 -0
  14. package/dist/generators/cursor.d.ts.map +1 -1
  15. package/dist/generators/cursor.js +36 -7
  16. package/dist/generators/cursor.js.map +1 -1
  17. package/dist/generators/custom.d.ts +55 -0
  18. package/dist/generators/custom.d.ts.map +1 -0
  19. package/dist/generators/custom.js +166 -0
  20. package/dist/generators/custom.js.map +1 -0
  21. package/dist/generators/index.d.ts +1 -0
  22. package/dist/generators/index.d.ts.map +1 -1
  23. package/dist/generators/index.js +10 -0
  24. package/dist/generators/index.js.map +1 -1
  25. package/dist/utils/config.d.ts +6 -1
  26. package/dist/utils/config.d.ts.map +1 -1
  27. package/dist/utils/config.js.map +1 -1
  28. package/package.json +1 -1
  29. package/schemas/harness-schema.yaml +178 -53
  30. package/templates/agents/modus-analyst.md +1 -1
  31. package/templates/commands/auto.md +61 -27
  32. package/templates/commands/harness.md +94 -34
  33. package/templates/commands/init.md +43 -10
  34. package/templates/commands/modus.md +55 -28
  35. package/templates/commands/plan.md +60 -18
  36. package/templates/commands/spec.md +69 -25
  37. package/templates/commands/upgrade.md +54 -0
  38. package/templates/commands/vibe.md +55 -5
  39. package/templates/knowledge-catalog.md +23 -10
  40. package/templates/skills/modus-agents/analyst/SKILL.md +11 -12
  41. package/templates/skills/modus-agents/developer/SKILL.md +14 -12
  42. package/templates/skills/modus-agents/reviewer/SKILL.md +50 -23
  43. package/templates/skills/modus-auto/SKILL.md +580 -123
  44. package/templates/skills/modus-design-brief/SKILL.md +17 -9
  45. package/templates/skills/modus-harness/SKILL.md +95 -96
  46. package/templates/skills/modus-init/SKILL.md +403 -188
  47. package/templates/skills/modus-plan/SKILL.md +16 -5
  48. package/templates/skills/modus-platform/SKILL.md +271 -0
  49. package/templates/skills/modus-vibe/SKILL.md +285 -187
@@ -1,91 +1,216 @@
1
- # Modus Harness Schema
1
+ # Modus Harness Schema v2.0
2
2
  # 定义 /modus:harness 双 Loop 多智能体流程的产出物及调度规则
3
+ # 与 modus-harness/SKILL.md 保持完全一致(9 个 SubAgent:SA00~SA08)
4
+ # 更新时间:2026-05-18
5
+
3
6
  name: harness
4
- description: 双 Loop 多智能体 Harness — 全自动需求分析、开发、测试、评审、部署流程
7
+ version: "2.0"
8
+ description: 双 Loop 多智能体 Harness — 全自动需求分析、设计、开发、测试、评审、部署流程
9
+ schema_version: "1.1" # HANDOFF 协议版本(见 docs/protocol.md)
10
+
11
+ # 产物根目录(v3.2)
12
+ directories:
13
+ harness: "modus/stories/{story-id}/harness/"
14
+ knowledge: "modus/knowledge/"
15
+ sessions: "modus/sessions/"
5
16
 
17
+ # SubAgent 清单(SA00~SA08,共 9 个)
18
+ # 命名偏移说明:SA02(设计)对应 Skill modus-harness-01-5-design(插入在 01 和 02 之间),
19
+ # 导致后续 Skill 文件名编号比 SubAgent ID 少 1。HANDOFF agent 值以 SubAgent ID 为基准。
6
20
  subAgents:
21
+
22
+ - id: "00"
23
+ skill: modus-harness-00-skills-builder
24
+ handoff_agent: "00-skills-builder"
25
+ name: 知识注入/提取(Skills Builder)
26
+ generates:
27
+ - "Skill 文件(modus/knowledge/biz-*/SKILL.md)"
28
+ - "modus/knowledge-catalog.md"
29
+ requires: []
30
+ loop: 1
31
+ modes:
32
+ - "A: 新建 Skill"
33
+ - "B: 增量更新 Skill"
34
+ - "C: 知识批量写回"
35
+ - "D: ARCHIVE 知识提取"
36
+ notes: "INIT 阶段调用模式 B 更新知识,ARCHIVE 阶段调用模式 D 提取知识"
37
+
7
38
  - id: "01"
8
- skill: modus-analyst
39
+ skill: modus-harness-01-analysis
40
+ handoff_agent: "01-analysis"
9
41
  name: 需求分析
10
- generates: 01-analysis.md
11
- requires: []
42
+ generates: ["modus/stories/{story-id}/harness/01-analysis.md"]
43
+ requires: ["00-INIT"]
12
44
  loop: 1
45
+ gateAfter: A0 # Gate A0: 检查 01-analysis.md HANDOFF gate_status = "passed"
46
+ max_retry: 2 # Gate A0 失败时最多重入 2 次
13
47
 
14
48
  - id: "02"
15
- skill: modus-developer
16
- name: 代码开发
17
- generates: 02-sprint-contract.md
49
+ skill: modus-harness-01-5-design
50
+ handoff_agent: "02-design"
51
+ name: 设计方案生成
52
+ generates: ["modus/stories/{story-id}/harness/02-design-brief.md"]
18
53
  requires: ["01"]
19
54
  loop: 1
20
- gateAfter: compile # Gate A: 编译验证
55
+ human_checkpoint: true # 架构决策确认 ⏸️ 人工交互节点
56
+ gateAfter: A05 # Gate A0.5: 检查 02-design-brief.md HANDOFF gate_status ∈ {passed, warning}
57
+ max_retry: 2
21
58
 
22
59
  - id: "03"
23
- skill: modus-tester
24
- name: 代码测试
25
- generates: 03-test-report.md
60
+ skill: modus-harness-02-dev
61
+ handoff_agent: "03-dev"
62
+ name: 代码开发
63
+ generates: ["modus/stories/{story-id}/harness/03-sprint-contract.md"]
26
64
  requires: ["02"]
27
65
  loop: 1
28
- parallel: ["03", "04", "05"] # 04/05 并行
66
+ gateAfter: A # Gate A: 执行 constitution.build_command,exit code = 0
67
+ max_retry: 3 # Gate A 失败时最多重入 3 次(含 Loop 2 精准重入)
29
68
 
30
69
  - id: "04"
31
- skill: modus-perf-auditor
32
- name: 性能审计
33
- generates: 04-perf-report.md
34
- requires: ["02"]
70
+ skill: modus-harness-03-test
71
+ handoff_agent: "04-test"
72
+ name: 代码测试(单元测试)
73
+ generates: ["modus/stories/{story-id}/harness/04-test-report.md"]
74
+ requires: ["03"]
35
75
  loop: 1
36
- parallel: ["03", "04", "05"]
76
+ parallel: ["04", "05", "06"] # 与 SA05/SA06 并行执行
77
+ gateAfter: B # Gate B: 三份报告全部 artifact_status=complete
78
+ max_retry: 2
37
79
 
38
80
  - id: "05"
39
- skill: modus-security-auditor
40
- name: 安全审计
41
- generates: 05-security-report.md
42
- requires: ["02"]
81
+ skill: modus-harness-04-perf
82
+ handoff_agent: "05-perf"
83
+ name: 性能审计
84
+ generates: ["modus/stories/{story-id}/harness/05-perf-report.md"]
85
+ requires: ["03"]
43
86
  loop: 1
44
- parallel: ["03", "04", "05"]
87
+ parallel: ["04", "05", "06"]
88
+ gateAfter: B
89
+ max_retry: 2
45
90
 
46
91
  - id: "06"
47
- skill: modus-reviewer
48
- name: 代码评审
49
- generates: cr-report.md
50
- requires: ["03", "04", "05"] # Gate B: 等待 03/04/05 全部完成
51
- loop: 2
92
+ skill: modus-harness-05-security
93
+ handoff_agent: "06-security"
94
+ name: 安全审计
95
+ generates: ["modus/stories/{story-id}/harness/06-security-report.md"]
96
+ requires: ["03"]
97
+ loop: 1
98
+ parallel: ["04", "05", "06"]
99
+ gateAfter: B # Gate B 额外条件:安全报告无严重/高危未修复问题(强制拦截)
100
+ max_retry: 2
52
101
 
53
102
  - id: "07"
54
- skill: modus-deployer
103
+ skill: modus-harness-06-review
104
+ handoff_agent: "07-review"
105
+ name: 代码评审(CR)
106
+ generates: ["modus/stories/{story-id}/harness/cr-report.md"]
107
+ requires: ["04", "05", "06"] # Gate B 通过后触发
108
+ loop: 1 # CR 在 Loop 1 执行;Loop 2 是对 SA03 的精准重入,非 CR 重跑
109
+ gateAfter: C # Gate C: cr-report.md HANDOFF issues 为空或全为 P3
110
+
111
+ - id: "08"
112
+ skill: modus-harness-07-deploy
113
+ handoff_agent: "08-deploy"
55
114
  name: 部署发布
56
- generates: 07-deploy-status.md
57
- requires: ["06"]
58
- loop: 2
59
- gateAfter: noPnPProblems # Gate C: cr-report.md 无 P1/P2
115
+ generates: ["modus/stories/{story-id}/harness/08-deploy-status.md"]
116
+ requires: ["07"] # Gate C 通过后触发
117
+ loop: 1
118
+ human_checkpoint: true # prd 环境等待人工确认
60
119
 
120
+ # Gate 规则(强制,不可跳过)
61
121
  gates:
62
- compile:
63
- description: 编译验证
64
- condition: "项目构建工具编译,exit code = 0"
122
+ A0:
123
+ description: "需求分析质量门"
124
+ checkFile: "01-analysis.md"
125
+ checkField: "gate_status"
126
+ condition: "gate_status = \"passed\""
127
+ onFail: retrySubAgent01
128
+ maxRetry: 2
129
+
130
+ A05:
131
+ description: "设计方案确认门(Gate A0.5)"
132
+ checkFile: "02-design-brief.md"
133
+ checkField: "gate_status"
134
+ condition: "gate_status ∈ {passed, warning}"
65
135
  onFail: retrySubAgent02
66
- maxRetry: 3
136
+ maxRetry: 2
67
137
 
68
- noPnPProblems:
69
- description: 代码评审质量门
70
- condition: "cr-report.md 中 P1 和 P2 问题数量为 0"
71
- onFail: retryFromSubAgent02
138
+ A:
139
+ description: "编译验证门"
140
+ checkMethod: "execute constitution.build_command"
141
+ condition: "exit_code = 0"
142
+ onFail: retrySubAgent03
72
143
  maxRetry: 3
73
144
 
145
+ B:
146
+ description: "并行审计完成门"
147
+ checkFiles:
148
+ - "04-test-report.md"
149
+ - "05-perf-report.md"
150
+ - "06-security-report.md"
151
+ checkField: "artifact_status"
152
+ condition: "三份报告 artifact_status 均为 complete,且各 gate_status ≠ failed"
153
+ extraCondition: "06-security-report.md 中无严重/高危未修复问题(强制拦截)"
154
+ onFail: "继续等待(文件未齐);gate_status=failed 则重入对应 SubAgent(最多 2 次);超时 30 分钟上报用户"
155
+ timeout: "30m"
156
+
157
+ C:
158
+ description: "代码评审质量门"
159
+ checkFile: "cr-report.md"
160
+ checkField: "issues"
161
+ condition: "issues 数组为空,或全部 level 为 P3"
162
+ onFail: triggerLoop2
163
+ maxLoop2Retries: 3
164
+
165
+ # Loop 2 精准重入规则
74
166
  loop2:
75
- trigger: "cr-report.md 中存在 P1 或 P2 问题"
76
- action: "定位涉及的 Sprint,精准重入 SubAgent 02(非全量重跑)"
77
- rerunPath: ["02", "Gate A", "03+04+05", "06"]
78
- maxLoops: 3
79
- onMaxLoopsReached: "暂停流程,上报用户,请求人工介入"
167
+ trigger: "Gate C 失败(cr-report.md HANDOFF issues 含 P1 或 P2"
168
+ sprintLocating:
169
+ primary: "issues[].affected_sprint 字段(整数,如 Sprint 2)"
170
+ fallback: "affected_sprint 缺失或为 0 时,重跑全量 Sprint(保守策略)"
171
+ multiple: "多个 issue 指向不同 Sprint 时,取编号并集一并重跑"
172
+ rerunPath: ["03(受影响 Sprint)", "Gate A", "04+05+06(并行)", "07"]
173
+ maxRetries: 3
174
+ onMaxRetriesReached: "暂停流程,上报用户,请求人工介入,写入 .harness-state.yaml"
80
175
 
81
- finalReview:
82
- trigger: "Gate C 通过(cr-report.md 无 P1/P2)"
83
- action: "等待人工 Final Review,确认后合入主干"
176
+ # ARCHIVE 阶段(SA08 完成后触发,进入 Human Final Review 等待前执行)
177
+ archive:
178
+ trigger: "SA08 部署完成(08-deploy-status.md artifact_status=complete)"
179
+ callSubAgent: "00(模式 D:知识提取)"
180
+ sourceArtifacts:
181
+ - "01-analysis.md"
182
+ - "02-design-brief.md" # 提取架构决策 [decision] 知识
183
+ - "03-sprint-contract.md"
184
+ - "04-test-report.md"
185
+ - "05-perf-report.md"
186
+ - "06-security-report.md"
187
+ - "cr-report.md"
188
+ - "08-deploy-status.md"
189
+ knowledgeTypes:
190
+ - "[decision] - 来自 02-design-brief.md/03-sprint-contract.md 的技术选型"
191
+ - "[guideline] - 来自 08-deploy-status.md 的上线操作规范"
192
+ - "[pitfall] - 来自 cr-report.md P2/P3 和 04/05 报告高风险项"
193
+ - "[process] - 来自 01-analysis.md 的业务流程"
194
+ - "[invariant] - 来自 cr-report.md 和 01-analysis.md 的业务约束"
84
195
 
196
+ # 断点续跑状态文件
197
+ stateFile:
198
+ path: "modus/stories/{story-id}/harness/.harness-state.yaml"
199
+ fields:
200
+ story_id: "string"
201
+ loop: "integer(1 或 2)"
202
+ completed_agents: "string[](已完成的 SubAgent ID 列表)"
203
+ current_agent: "string(当前正在执行的 SubAgent,空=全部完成)"
204
+ loop2_triggers: "Issue[](Loop 2 触发的 P1/P2 问题列表)"
205
+ last_updated: "ISO 8601 时间戳"
206
+
207
+ # 超时配置
85
208
  timeout:
86
- perSubAgent: 15m
209
+ perSubAgent: "15m"
210
+ parallelGroup: "30m(SA04/05/06 并行组整体超时)"
87
211
  action: "汇报卡点,询问用户是否重试"
88
212
 
89
- directories:
90
- active: modus/plans/active
91
- archive: modus/plans/archive
213
+ # Human Final Review
214
+ finalReview:
215
+ trigger: "Gate C 通过 + ARCHIVE 完成"
216
+ action: "输出推荐 Commit Message,等待人工确认合入主干"
@@ -9,6 +9,6 @@ enabled: true
9
9
 
10
10
  读取并严格遵循 `.codebuddy/skills/modus-analyst/SKILL.md` 中的执行规范。
11
11
 
12
- 产出物路径:`modus/plans/active/{story-id}/01-analysis.md`
12
+ 产出物路径:`modus/stories/{story-id}/harness/01-analysis.md`
13
13
 
14
14
  产出物头部必须包含 HANDOFF 块,包含 `agent`、`story_id`、`domains`、`risk_level`、`key_constraints`、`skill_refs`、`gate_status` 字段。
@@ -1,40 +1,74 @@
1
- # /modus:auto
1
+ # /modus:auto — 智能模式推荐
2
2
 
3
- Smart mode recommendation. Reads a TAPD Story, scores it across 4 dimensions, recommends the best Modus mode, then launches it after human confirmation.
3
+ **用途:** 读取 TAPD Story,从四个维度(复杂度/风险/需求明确度/接口契约)进行评分,自动推荐最适合的 Modus 命令(vibe/plan/spec/harness),确认后自动启动。**不确定用哪个命令时,首选此命令。**
4
4
 
5
- ## Instructions
5
+ ## 执行流程
6
6
 
7
- Read and follow the skill at `.codebuddy/skills/modus-auto/SKILL.md` to execute this command.
7
+ 1. 接受 TAPD Story URL(或提示手动粘贴内容)
8
+ 2. 通过 TAPD MCP 读取 Story
9
+ 3. 四维评分:复杂度 / 风险 / 需求明确度 / 接口契约影响
10
+ 4. 应用决策树 → 推荐:vibe / plan / spec / harness
11
+ 5. 展示推荐结果 + 其他选项对比
12
+ 6. 等待人工选择确认
13
+ 7. 展示参数确认窗口(二次确认)
14
+ 8. 以 TAPD 上下文自动启动所选模式:
15
+ - **plan** 模式:附加 `[AUTO_MODE: questions_confirmed]` 标记,modus-plan Step 3 检测到后跳过交互式澄清
16
+ - **vibe** / **spec** / **harness** 模式:直接传入 TAPD 上下文
8
17
 
9
- ## Quick Summary
18
+ ## 参数说明
10
19
 
11
- 1. Accept a TAPD Story URL (or prompt for manual input if omitted)
12
- 2. Read Story content via TAPD MCP
13
- 3. Score the story across 4 dimensions: Complexity / Risk / Clarity / Contract Impact
14
- 4. Apply the decision tree → recommend one of: vibe / plan / spec / harness
15
- 5. Show recommendation with reasoning + comparison table of other options
16
- 6. Wait for human mode selection
17
- 7. Show parameter confirmation window (second confirmation step)
18
- 8. Auto-launch the selected mode with TAPD context pre-filled:
19
- - **plan** mode: appends `[AUTO_MODE: questions_confirmed]` + confirmed key info summary to the prompt; modus-plan Step 3 will skip interactive clarification when it detects this marker
20
- - **vibe** / **spec** / **harness** modes: pass TAPD context directly without this marker
20
+ ```
21
+ /modus:auto [tapd-url] [参数]
22
+
23
+ --help 显示完整帮助(中文)
24
+ --project <name> 指定项目(多项目 workspace 使用)
25
+ --force <mode> 强制指定模式(vibe|plan|spec|harness),跳过推荐评分
26
+ --no-confirm 二次确认直接启动(CI/自动化场景使用)
27
+ --show-scores 展示四维评分详情(复杂度/风险/明确度/契约)
28
+ --dry-run 仅展示推荐结果,不启动任何命令
29
+ ```
30
+
31
+ ## 使用示例
32
+
33
+ ```
34
+ /modus:auto https://tapd.cn/.../stories/view/1234567890
35
+ /modus:auto # 不带 URL,手动粘贴 Story 内容
36
+ /modus:auto https://tapd.cn/.../1234 --show-scores
37
+ /modus:auto https://tapd.cn/.../1234 --force harness
38
+ /modus:auto https://tapd.cn/.../1234 --dry-run
39
+ ```
40
+
41
+ ## 推荐逻辑(四维评分)
21
42
 
22
- ## Usage
43
+ ```
44
+ 维度 1 - 复杂度:预估文件变更数、跨域数量
45
+ 维度 2 - 风险:支付/权限/多租户/金额是否涉及
46
+ 维度 3 - 需求明确度:验收标准是否完整
47
+ 维度 4 - 接口契约影响:是否新增/修改/废弃接口
23
48
 
49
+ 推荐规则:
50
+ 低复杂+低风险+无契约 → vibe
51
+ 明确+中等+无契约 → plan
52
+ 有接口契约/高风险 → spec
53
+ 不明确/高复杂+高风险 → harness
24
54
  ```
25
- /modus:auto https://tapd.cn/company/stories/view/1234567890
26
- /modus:auto (without URL — will prompt for manual Story content)
55
+
56
+ ## 推荐输出示例
57
+
27
58
  ```
59
+ 需求分析结果 — 新增歌曲批量导出功能
60
+ ──────────────────────────────────────
61
+ 复杂度: 中等 — 预估 4 个文件变更
62
+ 风险: 低 — 纯新增,不修改现有逻辑
63
+ 需求明确度: 高 — 验收标准完整
64
+ 接口契约: 有 — 新增 POST /api/v1/track/batch-export
28
65
 
29
- ## Decision Tree (summary)
66
+ 推荐模式:/modus:spec
67
+ 理由:有新接口契约,建议用 spec 生成可测试验收规格。
30
68
 
31
- | Score | Recommended Mode |
32
- |-------|-----------------|
33
- | Low complexity + Low risk + No contract change | vibe |
34
- | Medium complexity + High clarity + No contract change | plan |
35
- | Any contract change OR High risk OR needs testable acceptance criteria | spec |
36
- | Low clarity OR High complexity + High risk OR full automation needed | harness |
69
+ 请选择:A. vibe B. plan C. spec(推荐) D. harness
70
+ ```
37
71
 
38
- ## When to Use
72
+ ## 执行此命令
39
73
 
40
- Use `/modus:auto` when you have a TAPD Story but are unsure which Modus mode fits best. The AI analyzes the story and presents a reasoned recommendation — you still make the final call.
74
+ 读取并执行 `.codebuddy/skills/modus-auto/SKILL.md` 中的完整流程。
@@ -1,53 +1,113 @@
1
- # /modus:harness
1
+ # /modus:harness — 双 Loop 全自动开发流程
2
2
 
3
- Full dual-loop multi-agent Harness. Automated end-to-end development flow from requirements analysis to deployment.
3
+ **用途:** 输入 TAPD Story URL,自动执行从需求分析到部署验证的完整开发流程。8 个专业 SubAgent 分工协作,双 Loop 质量闭环,最终将开发经验自动沉淀到知识库。
4
4
 
5
- ## Instructions
5
+ **借鉴自:** GitHub Actions Job/Step/Gate 模型 + Devin 多步骤 Agent 架构
6
6
 
7
- Read and follow the skill at `.codebuddy/skills/modus-harness/SKILL.md` to execute this command.
7
+ ## 参数说明
8
8
 
9
- ## Quick Summary
9
+ ```
10
+ /modus:harness <tapd-url> [参数]
10
11
 
11
- 1. Check for business Skills — if absent, strongly recommend running `/modus:init` first
12
- 2. Accept TAPD Story URL as input
13
- 3. Create working directory: `modus/plans/active/{story-id}/`
14
- 4. Run the Harness Orchestrator which coordinates up to 9 SubAgents (00–07 + 01.5):
12
+ --help 显示完整帮助(中文)
13
+ --project <name> 指定项目(多项目 workspace 使用)
14
+ --story <tapd-url> 与直接传 URL 等价(alias)
15
+ --skip <agents> 跳过指定 SubAgent(逗号分隔,如 "04-perf,05-security")
16
+ --loop1-only 仅执行 Loop 1,不触发 Loop 2 自动修复
17
+ --resume 从最后完成的 SubAgent 断点继续
18
+ --dry-run 展示将执行的 SubAgent 列表和配置,不实际执行
19
+ --force-rebuild-skill 强制重建 Skill(忽略 hash 检查)
20
+ --no-deploy 跳过 07-deploy SubAgent(仅交付到 pre 环境)
21
+ --max-loop2 <n> Loop 2 最大重入次数(默认 3,填 0 禁用 Loop 2)
22
+ --notify <channel> 完成后通知渠道(wework|dingtalk|slack)
23
+ ```
15
24
 
16
- **Loop 1 (sequential):**
17
- - SubAgent 00: Knowledge injection (Skill update/creation)
18
- - SubAgent 01: Requirements analysis → `01-analysis.md`
19
- - Gate A0: Validate `01-analysis.md` HANDOFF gate_status = "passed"
20
- - SubAgent 01.5: Design brief generation ⏸️ (human architecture decision confirmation) → `01.5-design-brief.md`
21
- - Gate A0.5: Validate `01.5-design-brief.md` HANDOFF gate_status ∈ {passed, warning}
22
- - SubAgent 02: Code development → `02-sprint-contract.md` + code changes
23
- - Gate A: Build compilation check
24
- - SubAgent 03/04/05 (parallel): Tests + Performance audit + Security audit
25
- - Gate B: Wait for all 3 reports
25
+ ## 使用示例
26
26
 
27
- **Loop 2 (quality gate):**
28
- - SubAgent 06: Code review → `cr-report.md`
29
- - If P1/P2 found → precise re-entry to SubAgent 02 → repeat
30
- - Gate C: No P1/P2 → proceed
31
- - SubAgent 07: Deployment verification → `07-deploy-status.md`
27
+ ```
28
+ /modus:harness https://tapd.cn/.../stories/view/1234567890
29
+ /modus:harness https://tapd.cn/.../1234 --dry-run
30
+ /modus:harness https://tapd.cn/.../1234 --skip 04-perf,05-security
31
+ /modus:harness https://tapd.cn/.../1234 --loop1-only
32
+ /modus:harness https://tapd.cn/.../1234 --resume
33
+ /modus:harness https://tapd.cn/.../1234 --max-loop2 0 --no-deploy
34
+ ```
32
35
 
33
36
  **Step Final:** SubAgent 00 (Mode D) — ARCHIVE knowledge extraction
34
37
 
35
38
  5. Final Review: human confirms before merging
36
39
 
37
- ## Working Directory
40
+ ## Loop 流程总览
41
+
42
+ ```
43
+ Loop 1(生产层)
44
+ INIT: SubAgent 00 知识注入(更新相关 Skill 至最新)
45
+ SA 01: 需求分析 → 01-analysis.md
46
+ SA 02: 代码开发 → 02-sprint-contract.md + 代码变更
47
+ Gate A: 编译验证(mvn clean compile)→ 失败重入 SA 02,最多 3 次
48
+ SA 03+04+05: 并行(测试/性能/安全)
49
+ Gate B: 三份报告全部 complete
50
+ SA 06: 代码评审 → cr-report.md
51
+
52
+ Loop 2(修复层)
53
+ Gate C: 读 cr-report.md 的 issues 列表
54
+ → 有 P1/P2:精准重入受影响 Sprint(非全量重跑),最多 3 次
55
+ → 通过:进入收尾
56
+
57
+ 收尾
58
+ SA 07: 部署验证 → 07-deploy-status.md(prd 等待人工确认)
59
+ ARCHIVE: 知识提取回写 Skill + 更新 catalog
60
+ Human Final Review: 人工确认后合入主干
61
+ ```
62
+
63
+ ## Pipeline 状态输出(GitHub Actions 风格)
64
+
65
+ ```
66
+ [SA-00] ✓ 知识注入 (3 Skill 更新, 0s)
67
+ [SA-01] ✓ 需求分析 (2 Sprint, Gate: N/A, 45s)
68
+ [SA-02] ✓ 代码开发 (4 files, Gate A: passed, 2m30s)
69
+ [SA-03] ✓ 单元测试 (coverage: 82%, Gate B: -, 1m15s)
70
+ [SA-04] ✓ 性能审计 (0 high, 1 medium, Gate B: -, 45s)
71
+ [SA-05] ✓ 安全审计 (0 critical, Gate B: passed, 50s)
72
+ [SA-06] ✓ 代码评审 (P1:0 P2:1 P3:2, Gate C: failed → Loop2)
73
+ [Loop2] ✓ 精准修复 Sprint-2 (1 P2 已修复, 1m20s)
74
+ [SA-06] ✓ 代码评审 Re-run (P1:0 P2:0 P3:2, Gate C: passed)
75
+ [SA-07] ✓ 部署验证 dev→uat→pre (3/3 通过, prd 等待人工)
76
+ [ARCH] ✓ 知识沉淀 (2 [pitfall], 1 [decision] 回写)
77
+ ```
78
+
79
+ ## 产出物
38
80
 
39
81
  ```
40
82
  modus/plans/active/{story-id}/
41
- ├── 01-analysis.md ← SubAgent 01 产出,含 HANDOFF
83
+ ├── 01-analysis.md ← SubAgent 01 产出,含 HANDOFF 块(影响范围、Sprint 拆分)
42
84
  ├── 01.5-design-brief.md ← SubAgent 01.5 产出,含架构决策
43
- ├── 02-sprint-contract.md ← SubAgent 02 产出,含代码变更清单
44
- ├── 03-test-report.md ← SubAgent 03 产出
45
- ├── 04-perf-report.md ← SubAgent 04 产出
46
- ├── 05-security-report.md ← SubAgent 05 产出
47
- ├── cr-report.md ← SubAgent 06 产出,含 HANDOFF.issues
48
- └── 07-deploy-status.md ← SubAgent 07 产出
85
+ ├── 02-sprint-contract.md ← SubAgent 02 产出,含代码变更清单(接口契约)
86
+ ├── 03-test-report.md ← SubAgent 03 产出(单元测试报告)
87
+ ├── 04-perf-report.md ← SubAgent 04 产出(性能审计 N+1/分页风险)
88
+ ├── 05-security-report.md ← SubAgent 05 产出(安全审计 多租户/权限)
89
+ ├── cr-report.md ← SubAgent 06 产出,含 HANDOFF.issues(P1/P2/P3)
90
+ └── 07-deploy-status.md ← SubAgent 07 产出(部署状态 各环境结果)
91
+ ```
92
+
93
+ 所有产出物头部包含 HANDOFF 块(schema v1.1,见 `modus/docs/protocol.md`)。
94
+
95
+ ## HANDOFF 协议(SubAgent 间传递信息)
96
+
97
+ ```markdown
98
+ <!--HANDOFF
99
+ schema_version: "1.1"
100
+ agent: "01-analysis"
101
+ run_id: "{YYYYMMDD}-{story_id}"
102
+ story_id: "{tapd-story-id}"
103
+ domains: ["biz-track", "biz-album"]
104
+ gate_status: "passed"
105
+ artifact_status: "complete"
106
+ issues: []
107
+ skill_refs: ["biz-track@v2.1"]
108
+ -->
49
109
  ```
50
110
 
51
- ## Resume Support
111
+ ## 执行此命令
52
112
 
53
- If `modus/plans/active/{story-id}/` already contains partial artifacts, resume from the last completed SubAgent.
113
+ 读取并执行 `.codebuddy/skills/modus-harness/SKILL.md` 中的完整流程。
@@ -1,16 +1,49 @@
1
- # /modus:init
1
+ # /modus:init — 业务知识库初始化
2
2
 
3
- Analyze the project codebase, classify it by business domains, and generate business Skill files for each domain.
3
+ **用途:** 扫描项目代码,按业务域分类,在 `modus/knowledge/` 下生成结构化 Skill 文件,作为后续所有 Modus 命令的知识底座。支持多项目工作区路由和多平台引用式适配。
4
4
 
5
- ## Instructions
5
+ ## 参数说明
6
6
 
7
- Read and follow the skill at `.codebuddy/skills/modus-init/SKILL.md` to execute this command.
7
+ ```
8
+ /modus:init [参数]
8
9
 
9
- ## Quick Summary
10
+ --help 显示完整帮助(中文)
11
+ --project <name> 指定项目(多项目 workspace 使用)
12
+ --enhance <domain> 仅增量更新指定业务域(如 --enhance biz-track)
13
+ --enhance-all 重建所有业务域 Skill(保留框架 Skill)
14
+ --platform <p1,p2> 仅同步指定平台(claude,cursor,codex,copilot)
15
+ --dry-run 预览将生成/修改的文件,不写入磁盘
16
+ --force 跳过所有确认提示,直接执行
17
+ --no-sync 跳过多平台同步,仅生成 modus/knowledge/
18
+ --migrate 迁移旧路径 .codebuddy/skills/modus-biz-* → modus/knowledge/
19
+ --verbose 输出详细扫描过程
20
+ --reset-maturity 重置所有 Skill 的 maturity 为 draft
21
+ ```
10
22
 
11
- 1. Scan the project structure and identify business domains
12
- 2. Present the domain classification to the user for confirmation
13
- 3. For each confirmed domain, generate `.codebuddy/skills/modus-biz-{domain}/SKILL.md`
14
- 4. Report completion
23
+ ## 使用示例
15
24
 
16
- If `.codebuddy/skills/modus-biz-*` directories already exist, offer to update or rebuild them.
25
+ ```
26
+ /modus:init # 全量初始化(首次使用或大重构后)
27
+ /modus:init --help # 查看帮助
28
+ /modus:init --enhance biz-track # 仅更新歌曲域知识
29
+ /modus:init --migrate --dry-run # 预览知识库路径迁移
30
+ /modus:init --migrate # 执行迁移(旧路径 → modus/knowledge/)
31
+ /modus:init --enhance-all --no-sync # 重建所有域,不同步平台
32
+ /modus:init --project operations-job # 多项目时指定项目
33
+ ```
34
+
35
+ ## 产出物
36
+
37
+ ```
38
+ modus/knowledge/
39
+ ├── _conventions/SKILL.md — Layer 0-T 团队约定(融合各平台规则)
40
+ ├── _tech-wiki/SKILL.md — Layer 1 技术知识骨架
41
+ └── biz-{domain}/SKILL.md — Layer 2 业务域知识(每个域一个)
42
+
43
+ modus/knowledge-catalog.md — 全景索引(所有命令的快速入口)
44
+ modus/workspace-catalog.md — 工作区顶层路由(多项目)
45
+ ```
46
+
47
+ ## 执行此命令
48
+
49
+ 读取并执行 `.codebuddy/skills/modus-init/SKILL.md` 中的完整流程。