hunter-harness 0.1.0

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 (184) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/dist/bin.js +3356 -0
  4. package/package.json +34 -0
  5. package/resources/bootstrap-ir/manifest.json +19 -0
  6. package/resources/bootstrap-ir/skills/harness-apidoc.yaml +24 -0
  7. package/resources/bootstrap-ir/skills/harness-archive.yaml +24 -0
  8. package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +24 -0
  9. package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +24 -0
  10. package/resources/bootstrap-ir/skills/harness-package.yaml +24 -0
  11. package/resources/bootstrap-ir/skills/harness-plan.yaml +24 -0
  12. package/resources/bootstrap-ir/skills/harness-review.yaml +24 -0
  13. package/resources/bootstrap-ir/skills/harness-run.yaml +24 -0
  14. package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +28 -0
  15. package/resources/bootstrap-ir/skills/harness-submit.yaml +24 -0
  16. package/resources/bootstrap-ir/skills/harness-sync.yaml +24 -0
  17. package/resources/bootstrap-ir/skills/harness-test.yaml +24 -0
  18. package/resources/bootstrap-ir/templates/claude-code-skill.md +12 -0
  19. package/resources/harness/general/.harness-build.json +5 -0
  20. package/resources/harness/general/CONTEXT.md +65 -0
  21. package/resources/harness/general/README.md +478 -0
  22. package/resources/harness/general/agents/harness-evaluator.md +96 -0
  23. package/resources/harness/general/agents/harness-explorer.md +72 -0
  24. package/resources/harness/general/agents/harness-reviewer.md +69 -0
  25. package/resources/harness/general/harness-archive/SKILL.md +215 -0
  26. package/resources/harness/general/harness-archive/checklist.md +52 -0
  27. package/resources/harness/general/harness-archive/reference.md +103 -0
  28. package/resources/harness/general/harness-archive/scripts/gen-manifest.ps1 +31 -0
  29. package/resources/harness/general/harness-archive/templates/render-summary.mjs +171 -0
  30. package/resources/harness/general/harness-archive/templates/summary-data-template.json +128 -0
  31. package/resources/harness/general/harness-codebase-map/SKILL.md +112 -0
  32. package/resources/harness/general/harness-codebase-map/checklist.md +126 -0
  33. package/resources/harness/general/harness-codebase-map/reference.md +364 -0
  34. package/resources/harness/general/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  35. package/resources/harness/general/harness-codebase-map/templates/CONCERNS.md +49 -0
  36. package/resources/harness/general/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  37. package/resources/harness/general/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  38. package/resources/harness/general/harness-codebase-map/templates/STACK.md +55 -0
  39. package/resources/harness/general/harness-codebase-map/templates/STRUCTURE.md +69 -0
  40. package/resources/harness/general/harness-codebase-map/templates/TESTING.md +64 -0
  41. package/resources/harness/general/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  42. package/resources/harness/general/harness-codebase-map/templates/map-summary.md +64 -0
  43. package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -0
  44. package/resources/harness/general/harness-knowledge-ingest/design.md +842 -0
  45. package/resources/harness/general/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  46. package/resources/harness/general/harness-knowledge-ingest/mcp-config.example.json +10 -0
  47. package/resources/harness/general/harness-knowledge-ingest/reference.md +309 -0
  48. package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  49. package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  50. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +43 -0
  51. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +38 -0
  52. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +36 -0
  53. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +1 -0
  54. package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +1792 -0
  55. package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -0
  56. package/resources/harness/general/harness-plan/SKILL.md +127 -0
  57. package/resources/harness/general/harness-plan/checklist.md +243 -0
  58. package/resources/harness/general/harness-plan/protocols.md +124 -0
  59. package/resources/harness/general/harness-plan/reference.md +376 -0
  60. package/resources/harness/general/harness-review/SKILL.md +156 -0
  61. package/resources/harness/general/harness-review/checklist.md +124 -0
  62. package/resources/harness/general/harness-review/protocols.md +68 -0
  63. package/resources/harness/general/harness-review/reference.md +86 -0
  64. package/resources/harness/general/harness-run/SKILL.md +132 -0
  65. package/resources/harness/general/harness-run/checklist.md +259 -0
  66. package/resources/harness/general/harness-run/protocols.md +78 -0
  67. package/resources/harness/general/harness-run/reference.md +834 -0
  68. package/resources/harness/general/harness-submit/SKILL.md +159 -0
  69. package/resources/harness/general/harness-submit/checklist.md +407 -0
  70. package/resources/harness/general/harness-submit/reference.md +152 -0
  71. package/resources/harness/general/harness-sync/SKILL.md +82 -0
  72. package/resources/harness/general/harness-sync/reference.md +153 -0
  73. package/resources/harness/general/harness-test/SKILL.md +180 -0
  74. package/resources/harness/general/harness-test/checklist.md +319 -0
  75. package/resources/harness/general/harness-test/pitfalls.md +260 -0
  76. package/resources/harness/general/harness-test/reference.md +791 -0
  77. package/resources/harness/general/protocols/archive-report-protocol.md +175 -0
  78. package/resources/harness/general/protocols/evidence-based-reporting-protocol.md +134 -0
  79. package/resources/harness/general/protocols/ledger-protocol.md +270 -0
  80. package/resources/harness/general/protocols/powershell-protocol.md +181 -0
  81. package/resources/harness/general/protocols/report-pipeline-protocol.md +150 -0
  82. package/resources/harness/general/protocols/sensitive-info-protocol.md +92 -0
  83. package/resources/harness/general/protocols/state-layout-protocol.md +131 -0
  84. package/resources/harness/general/protocols/submit-protocol.md +78 -0
  85. package/resources/harness/general/scripts/harness_archive.py +2319 -0
  86. package/resources/harness/general/scripts/harness_deploy.py +613 -0
  87. package/resources/harness/general/scripts/harness_events.py +680 -0
  88. package/resources/harness/general/scripts/harness_ledger.py +671 -0
  89. package/resources/harness/general/scripts/harness_preflight.py +780 -0
  90. package/resources/harness/general/scripts/harness_service.py +1331 -0
  91. package/resources/harness/java/.harness-build.json +5 -0
  92. package/resources/harness/java/CONTEXT.md +65 -0
  93. package/resources/harness/java/README.md +478 -0
  94. package/resources/harness/java/agents/harness-evaluator.md +96 -0
  95. package/resources/harness/java/agents/harness-explorer.md +72 -0
  96. package/resources/harness/java/agents/harness-reviewer.md +69 -0
  97. package/resources/harness/java/harness-apidoc/SKILL.md +86 -0
  98. package/resources/harness/java/harness-apidoc/checklist.md +142 -0
  99. package/resources/harness/java/harness-apidoc/reference.md +233 -0
  100. package/resources/harness/java/harness-archive/SKILL.md +215 -0
  101. package/resources/harness/java/harness-archive/checklist.md +52 -0
  102. package/resources/harness/java/harness-archive/reference.md +103 -0
  103. package/resources/harness/java/harness-archive/scripts/gen-manifest.ps1 +31 -0
  104. package/resources/harness/java/harness-archive/templates/render-summary.mjs +171 -0
  105. package/resources/harness/java/harness-archive/templates/summary-data-template.json +128 -0
  106. package/resources/harness/java/harness-codebase-map/SKILL.md +112 -0
  107. package/resources/harness/java/harness-codebase-map/checklist.md +126 -0
  108. package/resources/harness/java/harness-codebase-map/reference.md +364 -0
  109. package/resources/harness/java/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  110. package/resources/harness/java/harness-codebase-map/templates/CONCERNS.md +49 -0
  111. package/resources/harness/java/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  112. package/resources/harness/java/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  113. package/resources/harness/java/harness-codebase-map/templates/STACK.md +55 -0
  114. package/resources/harness/java/harness-codebase-map/templates/STRUCTURE.md +69 -0
  115. package/resources/harness/java/harness-codebase-map/templates/TESTING.md +64 -0
  116. package/resources/harness/java/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  117. package/resources/harness/java/harness-codebase-map/templates/map-summary.md +64 -0
  118. package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -0
  119. package/resources/harness/java/harness-knowledge-ingest/design.md +842 -0
  120. package/resources/harness/java/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  121. package/resources/harness/java/harness-knowledge-ingest/mcp-config.example.json +10 -0
  122. package/resources/harness/java/harness-knowledge-ingest/reference.md +309 -0
  123. package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  124. package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  125. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +43 -0
  126. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +38 -0
  127. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +36 -0
  128. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +1 -0
  129. package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +1792 -0
  130. package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -0
  131. package/resources/harness/java/harness-package/SKILL.md +87 -0
  132. package/resources/harness/java/harness-package/checklist.md +322 -0
  133. package/resources/harness/java/harness-package/reference.md +210 -0
  134. package/resources/harness/java/harness-plan/SKILL.md +127 -0
  135. package/resources/harness/java/harness-plan/checklist.md +243 -0
  136. package/resources/harness/java/harness-plan/protocols.md +124 -0
  137. package/resources/harness/java/harness-plan/reference.md +376 -0
  138. package/resources/harness/java/harness-review/SKILL.md +156 -0
  139. package/resources/harness/java/harness-review/checklist.md +124 -0
  140. package/resources/harness/java/harness-review/protocols.md +68 -0
  141. package/resources/harness/java/harness-review/reference.md +86 -0
  142. package/resources/harness/java/harness-run/SKILL.md +148 -0
  143. package/resources/harness/java/harness-run/checklist.md +250 -0
  144. package/resources/harness/java/harness-run/protocols.md +78 -0
  145. package/resources/harness/java/harness-run/reference.md +814 -0
  146. package/resources/harness/java/harness-submit/SKILL.md +166 -0
  147. package/resources/harness/java/harness-submit/checklist.md +407 -0
  148. package/resources/harness/java/harness-submit/reference.md +152 -0
  149. package/resources/harness/java/harness-sync/SKILL.md +82 -0
  150. package/resources/harness/java/harness-sync/reference.md +153 -0
  151. package/resources/harness/java/harness-test/SKILL.md +192 -0
  152. package/resources/harness/java/harness-test/checklist.md +317 -0
  153. package/resources/harness/java/harness-test/pitfalls-java.md +16 -0
  154. package/resources/harness/java/harness-test/pitfalls.md +260 -0
  155. package/resources/harness/java/harness-test/reference.md +788 -0
  156. package/resources/harness/java/protocols/archive-report-protocol.md +175 -0
  157. package/resources/harness/java/protocols/evidence-based-reporting-protocol.md +134 -0
  158. package/resources/harness/java/protocols/ledger-protocol.md +270 -0
  159. package/resources/harness/java/protocols/powershell-protocol.md +181 -0
  160. package/resources/harness/java/protocols/report-pipeline-protocol.md +150 -0
  161. package/resources/harness/java/protocols/sensitive-info-protocol.md +92 -0
  162. package/resources/harness/java/protocols/state-layout-protocol.md +131 -0
  163. package/resources/harness/java/protocols/submit-protocol.md +78 -0
  164. package/resources/harness/java/scripts/harness_archive.py +2319 -0
  165. package/resources/harness/java/scripts/harness_deploy.py +613 -0
  166. package/resources/harness/java/scripts/harness_events.py +680 -0
  167. package/resources/harness/java/scripts/harness_ledger.py +671 -0
  168. package/resources/harness/java/scripts/harness_preflight.py +780 -0
  169. package/resources/harness/java/scripts/harness_service.py +1331 -0
  170. package/resources/harness/manifests/general.json +296 -0
  171. package/resources/harness/manifests/java.json +324 -0
  172. package/resources/manifest.json +19 -0
  173. package/resources/skills/harness-apidoc/SKILL.md +50 -0
  174. package/resources/skills/harness-archive/SKILL.md +48 -0
  175. package/resources/skills/harness-codebase-map/SKILL.md +53 -0
  176. package/resources/skills/harness-knowledge-ingest/SKILL.md +48 -0
  177. package/resources/skills/harness-package/SKILL.md +48 -0
  178. package/resources/skills/harness-plan/SKILL.md +51 -0
  179. package/resources/skills/harness-review/SKILL.md +50 -0
  180. package/resources/skills/harness-run/SKILL.md +48 -0
  181. package/resources/skills/harness-skill-optimizer/SKILL.md +54 -0
  182. package/resources/skills/harness-submit/SKILL.md +47 -0
  183. package/resources/skills/harness-sync/SKILL.md +48 -0
  184. package/resources/skills/harness-test/SKILL.md +50 -0
@@ -0,0 +1,210 @@
1
+ ---
2
+ description: harness-package 的Maven打包参数速查、增量vs全量对比、常见问题处理和报告格式示例。仅在需要参考参数细节或处理问题时读取。
3
+ ---
4
+
5
+ # harness-package 参考 — 参数、问题与格式
6
+
7
+ ## Maven 打包参数速查
8
+
9
+ | 参数 | 说明 | 示例 |
10
+ |------|------|------|
11
+ | `-pl <modules>` | 指定构建模块列表(逗号分隔) | `-pl module-a,module-b/sub-b` |
12
+ | `-am` | 同时构建指定模块的上游依赖(Also Make) | `-pl module-a -am` |
13
+ | `-amd` | 同时构建依赖指定模块的下游模块(Also Make Dependents) | `-pl module-a -amd` |
14
+ | `-DskipTests` | 跳过测试执行(**ledger 有效时默认使用**,复用 test 阶段验证) | `mvn package -DskipTests` |
15
+ | `-Dmaven.test.skip=true` | 跳过测试编译和执行(更激进,连测试代码都不编译) | 不推荐使用 |
16
+ | `-T 4` | 并行构建,4个线程 | `mvn package -T 4` |
17
+ | `-o` | 离线模式(不从远程仓库下载) | `mvn package -o` |
18
+ | `-DfinalName=<name>` | 指定最终产物名称 | `-DfinalName=my-app` |
19
+ | `--batch-mode` | 非交互模式(CI 场景) | `mvn package --batch-mode` |
20
+
21
+ ## 可选配置(package 时序与测试策略)
22
+
23
+ 在 `.harness/config/harness-test-config.md` 中可配置 package 行为:
24
+
25
+ ```yaml
26
+ package:
27
+ preferred-order: after-submit # 默认:package 在 submit 之后运行
28
+ allow-before-submit: true # 允许发版前打包(submit 之前);false 时 package 启动检查 submit 是否已运行
29
+ reuse-ledger-tests: true # 默认:ledger 有效时用 -DskipTests 复用 test 阶段验证
30
+ force-with-tests: false # 强制带测试打包(等同 package-with-tests)
31
+ ```
32
+
33
+ - `preferred-order: after-submit`:package 的 `baseCommit` 取 submit 日志的 final pushed hash
34
+ - `allow-before-submit: true`:允许在 submit 之前运行 package,此时 `baseCommit` 为当前 HEAD;submit 后若 pull 引入新提交,须重新 package
35
+ - `reuse-ledger-tests: true`:ledger 有效时默认 `-DskipTests`,报告标明复用来源;ledger 无效时自动改为带测试打包
36
+
37
+ > 未配置时使用上述默认值。
38
+
39
+ ## 增量 vs 全量对比
40
+
41
+ | 维度 | 增量打包 | 全量打包 |
42
+ |------|----------|----------|
43
+ | **命令** | `mvn package -pl <modules> -am` | `mvn package` |
44
+ | **适用场景** | 日常发版、局部变更、迭代开发 | 首次发版、重大重构、不确定依赖关系 |
45
+ | **构建范围** | 变更模块 + 上游依赖 | 所有模块 |
46
+ | **构建速度** | 快(只构建相关模块) | 慢(全量构建) |
47
+ | **风险** | 可能遗漏间接依赖 | 无遗漏风险 |
48
+ | **产物数量** | 只产出相关模块的 jar/war | 产出所有模块的 jar/war |
49
+ | **推荐优先级** | 首选(默认模式) | 增量失败时的降级方案 |
50
+
51
+ **何时选择全量**:
52
+ - 首次部署或项目初始化
53
+ - pom.xml 结构发生重大变更
54
+ - 依赖关系不确定或增量打包出现版本冲突
55
+ - 用户明确要求全量构建
56
+
57
+ ## 常见问题处理
58
+
59
+ | 问题 | 原因 | 处理方法 |
60
+ |------|------|----------|
61
+ | **合并冲突** | 他人代码与本次变更有重叠 | 停止打包流程,提示用户手动解决冲突后重新运行 |
62
+ | **合并后编译失败** | 他人代码引入新依赖或修改公共接口 | 分析错误是否与本次变更相关,相关则修复,无关则记录并询问用户 |
63
+ | **合并后测试失败** | 他人代码破坏了本次功能 | 记录冲突点,提示用户协调解决 |
64
+ | **打包失败:找不到依赖** | 上游模块未安装到本地仓库 | 先执行 `mvn install -pl <upstream> -am`,再打包 |
65
+ | **打包失败:版本冲突** | 同一依赖多个版本,SNAPSHOT 冲突 | 检查 pom.xml 版本号,统一版本;或用 `-DallowConflictingSnapshots=true` |
66
+ | **打包失败:编译错误** | 变更文件有语法错误或类型不匹配 | 先执行 `mvn compile` 定位错误,修复后重新打包 |
67
+ | **打包失败:测试失败** | 单元测试或集成测试报错 | 检查测试日志,修复测试或用户确认后加 `-DskipTests` |
68
+ | **打包失败:离线依赖缺失** | `-o` 模式下本地仓库缺少依赖 | 去掉 `-o`,加 `-nsu` 联网下载(见 `.claude/rules/maven-offline.md`) |
69
+ | **target/ 目录不存在** | 模块未被打包命令包含 | 检查 `-pl` 参数是否遗漏该模块,或改用全量打包 |
70
+ | **增量打包遗漏产物** | `-am` 未包含足够的上游模块 | 检查依赖链,补充遗漏模块到 `-pl` 列表,或改用全量打包 |
71
+ | **parent-pom 模块无 jar 产物** | 父 pom 模块只做依赖管理,不生成 jar | 正常行为,状态标记为 SKIPPED |
72
+ | **war 包过大** | 包含了不必要的依赖或资源 | 检查 pom.xml 的依赖范围(scope),排除 provided/test 依赖 |
73
+ | **并行构建报错** | 模块间存在循环依赖或线程竞争 | 去掉 `-T` 参数,改用串行构建 |
74
+
75
+ **依赖缺失的典型解决流程**:
76
+
77
+ ```powershell
78
+ # 1. 先安装所有上游依赖到本地仓库
79
+ powershell.exe -Command "mvn install -pl module-common,module-parent -am"
80
+
81
+ # 2. 再对变更模块执行增量打包
82
+ powershell.exe -Command "mvn package -pl module-a -am"
83
+ ```
84
+
85
+ ## 报告格式示例
86
+
87
+ ```markdown
88
+ ---
89
+ change-name: user-auth-feature
90
+ package-mode: incremental
91
+ generated-at: 2026-06-17 14:30:00
92
+ base-commit: abc1234
93
+ base-commit-source: submit final pushed hash
94
+ maven-command: mvn package -pl module-auth,module-api -am -DskipTests
95
+ tests-executed: false
96
+ tests-reused-from: unitTest+apiTest
97
+ ledger-diff-hash: sha256:...
98
+ ---
99
+
100
+ # 打包报告 — user-auth-feature
101
+
102
+ ## 打包概要
103
+
104
+ | 项目 | 值 |
105
+ |------|-----|
106
+ | 变更名 | user-auth-feature |
107
+ | 打包模式 | 增量(-pl + -am) |
108
+ | Maven 命令 | `mvn package -pl module-auth,module-api -am -DskipTests` |
109
+ | 基准 commit | abc1234(来源:submit final pushed hash) |
110
+ | 开始时间 | 2026-06-17 14:25:00 |
111
+ | 结束时间 | 2026-06-17 14:30:00 |
112
+ | 构建耗时 | 5分0秒 |
113
+ | 构建结果 | SUCCESS |
114
+
115
+ ## 测试执行策略
116
+
117
+ - package 本次是否执行 tests: **否**(`-DskipTests`)
118
+ - 复用来源: verification-ledger 的 `unitTest` + `apiTest`(status=OK)
119
+ - ledger diffHash: sha256:...
120
+ - 复用成立条件: diffHash 一致 + submit 后无新提交 + 无行为性 post-test 修改
121
+ - 若 ledger 无效: 改为"是(带测试打包)"并说明原因(test 未跑 / diffHash 不一致 / submit 后有新提交 / 行为性 post-test 修改)
122
+
123
+ ## 变更模块
124
+
125
+ ### 直接变更模块 (2 个)
126
+
127
+ | 模块 | 变更文件数 | 变更类型 |
128
+ |------|-----------|----------|
129
+ | module-auth | 5 | 新增+修改 |
130
+ | module-api | 2 | 修改 |
131
+
132
+ ### 依赖链模块
133
+
134
+ | 类型 | 模块 |
135
+ |------|------|
136
+ | 上游依赖 (-am) | parent-pom, module-common |
137
+ | 下游依赖 (-amd) | 未包含 |
138
+
139
+ ## 产物清单
140
+
141
+ | 模块 | 产物文件名 | 相对路径 | 大小 | 状态 |
142
+ |------|-----------|----------|------|------|
143
+ | module-auth | auth-service-1.0.0.jar | module-auth/target/auth-service-1.0.0.jar | 12.5 MB | SUCCESS |
144
+ | module-api | api-model-1.0.0.jar | module-api/target/api-model-1.0.0.jar | 3.2 MB | SUCCESS |
145
+ | module-common | common-utils-1.0.0.jar | module-common/target/common-utils-1.0.0.jar | 8.1 MB | SUCCESS |
146
+ | parent-pom | — | — | — | SKIPPED |
147
+
148
+ **产物总计**: 3 个 jar, 总大小 23.8 MB
149
+
150
+ ## 构建日志摘要
151
+
152
+ ```
153
+ [INFO] Reactor Build Order:
154
+ parent-pom .................................. SKIPPED
155
+ module-common ................................ SUCCESS [8.1s]
156
+ module-api ................................... SUCCESS [3.2s]
157
+ module-auth .................................. SUCCESS [12.5s]
158
+ [INFO] BUILD SUCCESS
159
+ ```
160
+
161
+ ## 部署建议
162
+
163
+ - 部署顺序:common-utils → api-model → auth-service(按依赖顺序)
164
+ - 注意:auth-service 依赖 common-utils 和 api-model,确保目标环境已有这两个依赖
165
+ ```
166
+
167
+ ## 变更模块识别方法
168
+
169
+ ### 方法 1:git diff + pom.xml 映射(推荐)
170
+
171
+ ```powershell
172
+ # 1. 获取基准 commit
173
+ powershell.exe -Command "git -C '<项目路径>' merge-base HEAD origin/master"
174
+
175
+ # 2. 获取变更文件列表
176
+ powershell.exe -Command "git -C '<项目路径>' diff <base-commit> --name-only"
177
+
178
+ # 3. 对每个变更文件,向上查找 pom.xml 所在目录
179
+ # 变更文件: module-a/src/main/java/com/example/Service.java
180
+ # → pom.xml 在: module-a/pom.xml
181
+ # → 模块路径: module-a
182
+ ```
183
+
184
+ ### 方法 2:git diff + Maven Reactor 映射
185
+
186
+ ```powershell
187
+ # 1. 获取变更文件列表
188
+ powershell.exe -Command "git -C '<项目路径>' diff <base-commit> --name-only"
189
+
190
+ # 2. 对变更目录执行 Maven 列出模块
191
+ powershell.exe -Command "mvn -f <项目路径>/pom.xml help:active-profiles -pl :<module-artifactId>"
192
+ ```
193
+
194
+ ### 依赖链识别
195
+
196
+ **上游依赖(-am)**:变更模块 pom.xml 中 `<dependencies>` 引用的同项目模块,由 Maven `-am` 参数自动处理。
197
+
198
+ **下游依赖(-amd)**:需要扫描其他模块的 pom.xml,找出 `<dependency>` 中引用了变更模块 `<groupId>:<artifactId>` 的模块:
199
+
200
+ ```powershell
201
+ # 扫描所有子模块 pom.xml 中对变更模块的引用(使用 Grep 工具更高效)
202
+ Grep("<artifactId>module-a</artifactId>", "<项目路径>/", glob="**/pom.xml")
203
+ ```
204
+
205
+ ### 边界情况
206
+
207
+ - **根 pom.xml 变更**:属于父项目,需全量打包
208
+ - **多模块同一变更**:合并到 `-pl` 列表,用逗号分隔
209
+ - **无变更文件**:提示用户确认是否需要全量打包
210
+ - **新增模块**:pom.xml 本身是新增文件,需全量打包确保 Reactor 顺序正确
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: harness-plan
3
+ description: "将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划"
4
+ argument-hint: "需求描述 | --adversarial"
5
+ effort: high
6
+ allowed-tools: [Read, Glob, Grep, Edit, Write, Agent, Bash(powershell.exe:*)]
7
+ disallowed-tools:
8
+ - Bash(git *)
9
+ - Bash(mvn *)
10
+ - Bash(ls *)
11
+ - Bash(find *)
12
+ - Bash(grep *)
13
+ - Bash(cat *)
14
+ - Bash(cp *)
15
+ - Bash(mv *)
16
+ - Bash(rm *)
17
+ - Bash(mkdir *)
18
+ - Bash(touch *)
19
+ - Bash(sed *)
20
+ - Bash(awk *)
21
+ - Bash(curl *)
22
+ ---
23
+ <!-- generated by harness_deploy.py; core=8917528f7dfdc5ca; overlay=java; do not edit -->
24
+ # harness-plan — 需求规划
25
+
26
+ ## Purpose
27
+
28
+ 需求 → 设计文档 → 任务拆分 → 测试场景表(编码/测试唯一真相源)。存在 `.harness/archive/` 或 `.harness/knowledge/` 时须先 `harness-knowledge-query`。
29
+
30
+ ## When to Use
31
+
32
+ `/harness-plan`、新功能设计、技术方案、测试场景表规划。
33
+
34
+ ## 统一读取协议
35
+
36
+ 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
37
+ 2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
38
+ 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
39
+ 4. **spec** — 设计真相源:`spec/<change>-design.md`
40
+ 5. **plan** — 任务真相源:`plans/<change>-plan.md`
41
+ 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
42
+ 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
43
+ 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
44
+
45
+ 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
46
+
47
+ ## Worktree 门禁
48
+
49
+ 读取 `meta/worktree.json`(兼容旧路径 `worktree.json`):
50
+
51
+ | 条件 | 行为 |
52
+ |------|------|
53
+ | `requested=false` | 主目录执行 |
54
+ | `requested=true` + path 存在 | 切换 worktree 执行 |
55
+ | `requested=true` + path 不存在 | **必须创建**(run)或 **停止**(test/review/submit) |
56
+
57
+ **严禁** `requested=true` 时静默回主目录。创建失败 → 停止或 AskUserQuestion 降级(须 🟡WARN + 用户确认)。
58
+
59
+ **状态与代码分离**:代码/编译/测试在 `worktreeRoot`;`stateDir`(logs/events/ledger/reports)写回 `.harness/changes/<change-name>/`。
60
+
61
+ 创建命令与 JSON 模板 → 各 skill `reference.md`(plan 写决策,run 创建/更新)。
62
+
63
+ ## 原生规划协议
64
+
65
+ 内化为 `protocols.md`:`clarification-protocol`、`decision-grilling-protocol`、`implementation-planning-protocol`。不运行时调用 Superpowers/grill-me。
66
+
67
+ ## Subagent 委派
68
+
69
+ - **阶段 3 探索**:`check-agents --agent harness-explorer` → 可用则委派,否则主会话探索;无效返回不 retry
70
+ - **阶段 7.5**:仅 `--adversarial`;`check-agents --agent harness-evaluator` → `reports/plan-review/`
71
+
72
+ ## Workflow 概要
73
+
74
+ | 阶段 | 动作 |
75
+ |------|------|
76
+ | 0 | git status;脏工作区 → baseline 隔离 + `decision`,不询问 |
77
+ | 0.5 | `harness-knowledge-query`(失败记 `issue`) |
78
+ | 1 | 自动生成 change-name + 初始化 logs/events |
79
+ | 2–3 | 代码探索 + 需求澄清(高风险 → 交互白名单 ②) |
80
+ | 4 | **设计审批包** AskUserQuestion → 写 `spec/*-design.md` + `meta/worktree.json` |
81
+ | 5–6 | plan + implementation-detail + test-scenarios → `plans/` |
82
+ | 7.5 | 仅 `--adversarial` 对抗评审 |
83
+ | 8 | 产物完整性必检 → `checklist.md` |
84
+
85
+ change-name 范围变更 → 提示重命名或记 🟡WARN(→ `reference.md`)
86
+
87
+ ## P0 执行可信度规则
88
+
89
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
90
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
91
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
92
+
93
+ ## 关键规则
94
+
95
+ | 规则 | 要点 |
96
+ |------|------|
97
+ | 产物路径 | 只写 `.harness/changes/<cn>/`;禁止 superpowers 输入 |
98
+ | 设计审批包 | 一次 AskUserQuestion 含 worktree(读 `harness.json` `defaultWorktree`) |
99
+ | 阶段 8 | spec/plan/detail/scenarios/worktree.json/logs/events 缺一不可 → ❌FAIL |
100
+ | Plan 结束 | **禁止**询问执行模式;只提示 `/harness-run` |
101
+ | 知识查询 | 0.5 失败不得假装已读历史 |
102
+ | 协议 | sensitive-info / evidence-based-reporting / state-layout |
103
+
104
+ 产出物表、frontmatter、legacy 兼容、结束输出模板 → `reference.md`
105
+
106
+ ## 渐进披露
107
+
108
+ - **Read `checklist.md`** — 阶段检查与覆盖表
109
+ - **Read `protocols.md`** — 阶段 4/6 原生协议
110
+ - **Read `reference.md`** — 模板与 worktree JSON
111
+
112
+ ## 交互白名单
113
+
114
+ 1. **设计审批包**(阶段 4):设计 + 场景表 + worktree + change-name
115
+ 2. **decision-grilling**(阶段 3 澄清):高风险业务裁决(一次一问)
116
+
117
+ ## 执行日志
118
+
119
+ `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
120
+
121
+ ```powershell
122
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
123
+ ```
124
+
125
+ > **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
126
+
127
+ > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
@@ -0,0 +1,243 @@
1
+ ---
2
+ description: harness-plan 的阶段检查清单和覆盖检查列表。仅在执行完整需求规划时读取。
3
+ ---
4
+
5
+ # harness-plan 检查清单
6
+
7
+ ## 阶段 0:工作区变更检查 ⚠️ 强制检查
8
+
9
+ > 有未提交业务变更(排除 `.harness/`)→ **默认 baseline 隔离**,append `decision` 事件,**不 AskUserQuestion**,继续规划。PowerShell 失败 → ❌ 停止。
10
+
11
+ **固定命令**:`powershell.exe -Command "git -C '<项目路径>' status --porcelain"`
12
+
13
+ **判定**:stdout 为空 → ✅ 继续;stdout 非空 → baseline 隔离 + `decision`(note 含变更文件列表);Bash 被拒 → PowerShell 重试。
14
+
15
+ ## 阶段 2:Worktree 决策(并入设计审批包)
16
+
17
+ > worktree 不再单独询问。阶段 5 **设计审批包** 一次 AskUserQuestion 含 worktree 选项(推荐值读 `harness.json` `defaultWorktree`)。确认后写入 `meta/worktree.json`。
18
+
19
+ - [ ] 审批包确认后写入 worktree.json(`requested` true/false)
20
+ - [ ] 阶段 8 检查 worktree.json 存在
21
+
22
+ ## 阶段 3:代码探索确认(含 Agent/CodeGraph 降级记录)
23
+
24
+ 阶段 3 执行完成后,确认以下事项:
25
+
26
+ ```
27
+ □ 是通过 Agent 工具委派 subagent 执行的(不是主会话直接调用 codegraph)
28
+ □ subagent 返回了结构化设计概要(涉及模块、接口变更、关键决策)
29
+ □ 委派前已运行 `harness_preflight.py check-agents --agent harness-explorer`
30
+ □ `usable=false` 或未返回有效输出 → 主会话探索,**不 retry 委派**
31
+ □ 主会话未被代码探索的中间结果污染
32
+ □ 在执行日志中记录了 Agent 调用状态:
33
+ - 是否成功调用
34
+ - 使用的 agent 名称
35
+ - 是否只读
36
+ - 子代理实际 tool uses 计数
37
+ - 返回的核心结论
38
+ ```
39
+
40
+ > 如果 Agent 工具不可用,或子代理被委派但未返回有效输出(0 tool uses / 空返回 / 仅 "Done"),必须显式降级并记录:
41
+ > - 在执行日志中写明降级原因:🟡 阶段3降级:Agent 不可用 / 子代理未返回有效输出,改为主会话只读探索
42
+ > - 主会话直接使用 codegraph MCP 工具(`mcp__codegraph__codegraph_explore`)和 Read 探索代码(只读,不执行写操作)
43
+ > - 不得在主会话中执行任何写操作
44
+ > - CodeGraph 如通过 MCP 调用,必须优先用 MCP 工具,不允许通过普通 Bash 调 codegraph 命令
45
+ > - 禁止把子代理未经工具验证的文本结论当作"详尽报告"或代码证据采纳
46
+
47
+ ## 阶段 5:设计审批包 ⚠️ 强制阻断(一次 AskUserQuestion)
48
+
49
+ > 合并原「设计审核 + worktree + 场景表预览 + change-name」。推荐 worktree 读 `harness.json` `defaultWorktree`。
50
+
51
+ **展示内容**:
52
+
53
+ 1. 设计摘要 + 关键证据 + 风险 + 变更清单
54
+ 2. 测试场景表摘要 + 8 维度覆盖检查
55
+ 3. worktree 选项(是/否,含推荐理由)
56
+ 4. change-name(自动生成,可修改)
57
+ 5. 确认进入任务拆分
58
+
59
+ 确认后写入 `spec/<change>-design.md`(含 frontmatter)和 `meta/worktree.json`。
60
+
61
+ 设计文档必须包含 frontmatter:
62
+ ```yaml
63
+ ---
64
+ change-name: <change-name>
65
+ created: YYYY-MM-DD HH:mm
66
+ status: approved
67
+ source: harness-plan
68
+ ---
69
+ ```
70
+
71
+ 展示可审核包后,使用 `AskUserQuestion` 询问用户:
72
+ - **确认**:设计方向正确,继续任务拆分
73
+ - **修改**:某个部分需要调整,修改后再审核
74
+ - **取消**:方向不对,回到需求澄清阶段
75
+
76
+ ### 设计文档自审清单
77
+
78
+ 写完设计文档后,用以下清单自检,**并将自审结果展示给用户**:
79
+
80
+ ```
81
+ □ 无"TBD"/"TODO"/未完成章节
82
+ □ 各节之间无矛盾
83
+ □ 范围聚焦,无不相关内容
84
+ □ 无歧义需求(可被两种方式解读的,已选一种并明确说明)
85
+ □ 自审结果已展示给用户
86
+ ```
87
+
88
+ > 展示格式示例:
89
+ > ```
90
+ > ### 设计文档自审
91
+ > - ✅ 无 TBD/TODO/未完成章节
92
+ > - ✅ 各节之间无矛盾
93
+ > - ✅ 范围聚焦,无不相关内容
94
+ > - ⚠️ 第3.2节"枚举删除"与第4节变更清单中"标记@Deprecated"有矛盾,已修正为"删除"
95
+ > ```
96
+
97
+ ## 测试场景覆盖检查表(8 维度覆盖检查表,强制输出)
98
+
99
+ > 注意:覆盖检查表是 8 维度,与 4 维度场景表(单元/接口/数据兼容/集成)是两个不同制品。
100
+
101
+ 生成场景表后,逐项确认是否覆盖,**必须输出覆盖检查表展示给用户确认**。未覆盖的维度必须标记为缺口(⚠️ 缺口),不得全部标记为 ✅:
102
+
103
+ | 覆盖维度 | 状态 | 说明 |
104
+ |---|---|---|
105
+ | 正常路径 | ✅/🟡/❌ | 每个接口 ≥ 1 个正常场景 |
106
+ | 参数校验 | ✅/🟡/❌ | 必填缺失、格式非法、类型错误 |
107
+ | 业务规则 | ✅/🟡/❌ | 唯一性、范围约束、状态机 |
108
+ | 权限/组织边界 | ✅/🟡/❌ | 无权限、跨组织、角色限制 |
109
+ | 数据兼容 | ✅/🟡/❌ | 旧数据无新字段 |
110
+ | 错误码 | ✅/🟡/❌ | 每个异常对应明确错误码 |
111
+ | 集成影响 | ✅/🟡/❌ | 跨模块调用、端到端流程 |
112
+ | 并发/幂等 | ✅/🟡/❌ | 重复提交、并发修改 |
113
+
114
+ > 展示格式示例:
115
+ > ```
116
+ > ### 场景覆盖检查表
117
+ > | 覆盖维度 | 状态 | 说明 |
118
+ > |---|---|---|
119
+ > | 正常路径 | ✅ | 5 个接口各 ≥ 1 个正常场景 |
120
+ > | 参数校验 | ✅ | 必填缺失、格式非法已覆盖 |
121
+ > | 业务规则 | ✅ | 唯一性、状态机已覆盖 |
122
+ > | 权限/组织边界 | 🟡 | ⚠️ 缺口:未覆盖跨组织场景,需补充 |
123
+ > | 数据兼容 | ✅ | 旧数据 scene_code 迁移场景已覆盖 |
124
+ > | 错误码 | ✅ | 3 个错误码均有对应场景 |
125
+ > | 集成影响 | 🟡 | ⚠️ 缺口:未覆盖端到端流程,需部署后验证 |
126
+ > | 并发/幂等 | ❌ | ⚠️ 缺口:未覆盖重复提交场景,需补充 |
127
+ > ```
128
+
129
+ ## 阶段 7.5:计划对抗评审(可选)确认
130
+
131
+ > 仅在用户选择启用对抗评审时执行本节检查。默认不启用(高风险构建 auth/支付/迁移/并发 才启用)。
132
+
133
+ 阶段 7.5 执行完成后,确认以下事项:
134
+
135
+ ```
136
+ □ 已用 **设计审批包** 一次 AskUserQuestion(设计 + 场景表摘要 + worktree + change-name)
137
+ □ **未**单独询问 worktree 或对抗评审(对抗评审仅 `--adversarial`)
138
+ □ 用户同意后,已用 Agent 工具委派 harness-evaluator(haiku, context:fork, plan 模式只读, maxTurns:8)
139
+ □ 已用 context:fork 隔离上下文(evaluator 未参与规划,破除确认偏误)
140
+ □ 已校验子代理 tool uses > 0(0/空/Done 视为未返回有效输出,已降级为主会话自审并记录)
141
+ □ evaluator 返回了 VERDICT(APPROVED/REVISE) + 结构化问题清单(RED/YELLOW)
142
+ □ 评审报告已写入 .harness/changes/<change-name>/reports/plan-review/plan-review-YYYYMMDD-HHmm.md
143
+ □ VERDICT 和问题清单已展示给用户(不得仅记"已评审")
144
+ □ REVISE 时已询问用户是否修订;修订后可选再审
145
+ □ 评审为参考性,未阻塞阶段8
146
+ □ 执行日志记录了 evaluator 调用状态(委派成功/降级原因)+ VERDICT 摘要
147
+ □ 如为主会话自审降级,已标注"⚠️ 同会话自审,回音壁风险"
148
+ ```
149
+
150
+ ## 原生规划协议检查
151
+
152
+ ### 阶段 4:clarification + decision-grilling
153
+
154
+ 阶段 4 执行完成后,确认以下事项:
155
+
156
+ ```
157
+ □ 已读取 protocols.md,并按 clarification-protocol / decision-grilling-protocol 执行
158
+ □ 输入包含需求摘要 + 阶段0.5 context pack(如有)+ 阶段3代码探索结果 + 项目架构约束
159
+ □ 已在 execution-log 中记录五类输出:风险识别 / 复用机会 / 替代方案 / 推荐方案 / 关键决策
160
+ □ 已叠加项目架构约束(分层规范、数据模型、接口规范)
161
+ □ 需求澄清结论已写入 .harness/changes/<change-name>/logs/execution-log.md,并在 events.ndjson 记录 decision
162
+ □ 用户问题未超预算:普通需求 1-3 问,高风险需求 5-7 问;无必须裁决事项时 0 问
163
+ □ 提问遵循"一次一问、等答再继续";能由 context pack / 阶段3代码探索 / CodeGraph 自答的问题已自答,未打扰用户
164
+ □ 每个需要用户决策的问题,AI 先给出了推荐答案、理由和取舍,用户仅确认或修正
165
+ □ 高风险/业务语义决策(范围、权限、安全、支付、迁移、删除、API契约、用户可见行为)已显式等待用户确认
166
+ ```
167
+
168
+ > 不再检查 Superpowers brainstorming 是否安装或调用;阶段 4 是 harness 原生协议,不存在外部 skill 降级分支。
169
+
170
+ ### 阶段 6:implementation-planning
171
+
172
+ 阶段 6 执行完成后,确认以下事项:
173
+
174
+ ```
175
+ □ 已读取 protocols.md,并按 implementation-planning-protocol 执行
176
+ □ 输入为阶段5已审核设计文档
177
+ □ 已生成基础任务列表,并在 execution-log 记录任务拆分摘要
178
+ □ 已叠加项目层序依赖(数据/契约→业务层→接口层)
179
+ □ 已生成 4 维度场景表(单元/接口/数据兼容/集成)
180
+ □ 已确定变更名(kebab-case)
181
+ □ 产物已写入 .harness/changes/<change-name>/plans/:
182
+ - <change-name>-plan.md(简洁任务表)
183
+ - <change-name>-implementation-detail.md(自适应详细执行参考)
184
+ - <change-name>-test-scenarios.md(测试场景表)
185
+ □ implementation-detail.md 按复杂度自适应:简单任务不过度展开,复杂任务写清接口/数据/顺序/风险/测试策略
186
+ □ plan / implementation-detail / test-scenarios 三件套互相引用一致,无 TBD/TODO/空泛占位
187
+ ```
188
+
189
+ > 不再检查 Superpowers writing-plans 是否安装或调用;阶段 6 是 harness 原生协议,不存在 `docs/superpowers/` 同步分支。
190
+
191
+ ## 阶段 8:结束前产物完整性检查 ⚠️ 强制
192
+
193
+ > **缺任一文件 → ❌FAIL,不得宣称 plan 完成。**
194
+
195
+ | 文件 | 必须存在 | 检查结果 |
196
+ |------|:---:|:---:|
197
+ | `.harness/changes/<change>/spec/<change>-design.md` | ✅ | □ |
198
+ | `.harness/changes/<change>/plans/<change>-plan.md` | ✅ | □ |
199
+ | `.harness/changes/<change>/plans/<change>-implementation-detail.md` | ✅ | □ |
200
+ | `.harness/changes/<change>/plans/<change>-test-scenarios.md` | ✅ | □ |
201
+ | `.harness/changes/<change>/meta/worktree.json` | ✅ | □ |
202
+ | `.harness/changes/<change>/logs/execution-log.md` | ✅ | □ |
203
+ | `.harness/changes/<change>/events.ndjson` | ✅ | □ |
204
+
205
+ ### Plan 结束行为检查
206
+
207
+ ```
208
+ □ 未询问 Subagent-Driven / Inline Execution 等执行模式
209
+ □ 最终输出只提示了产出物路径和下一步 /harness-run
210
+ □ 未将 docs/superpowers/ 列为最终产物路径
211
+ ```
212
+
213
+ ### Legacy Frontmatter 兼容
214
+
215
+ ```
216
+ □ 已确认 plan 文件 frontmatter 存在
217
+ □ 如不存在 → 已从路径推断 change-name 和 plan-name
218
+ □ 如不存在 → 执行日志中已标记 🟡 legacy-plan
219
+ □ 旧 plan 不因 frontmatter 缺失而 FAIL
220
+ ```
221
+
222
+ ## 关键原则
223
+
224
+ - **产物路径唯一性**:`.harness/changes/<change-name>/` 是唯一真相源,plan 产物必须直接写入此目录
225
+ - **原生规划协议**:阶段 4/6 使用 clarification、decision-grilling、implementation-planning 三段内置协议,不运行时依赖 Superpowers/grill-me/writing-plans
226
+ - **阶段 2 是强制阻断检查点**——必须停下来问用户,收到回复后才能继续。不要跳过
227
+ - 代码探索只读不写——这个阶段的目标是理解,不是修改
228
+ - 场景表是后续所有步骤的真相源——宁可多花时间打磨,不要草草了事
229
+ - 如果需求不明确,优先提问而不是猜测后继续设计
230
+ - 任务拆分粒度按复杂度调整——plan 简表保持可追踪,implementation-detail 按风险和复杂度自适应展开
231
+ - **Plan 结束禁止询问执行模式**:Subagent-Driven / Inline Execution 属于 /harness-run 阶段
232
+
233
+ ## 事件记录(前置规则)
234
+
235
+ - [ ] 确定 change-name 后立即 append `phase.start` 事件;各阶段用 `harness_events.py append` 写入 `decision` / `issue` / `artifact`
236
+ - [ ] 阶段 0 在 change-name 确定前可不写事件;阶段 1 确定 change-name 后必须开始记录
237
+
238
+ ## 需求范围缩减后的 change-name 检查 ⚠️
239
+
240
+ - [ ] 阶段 4 澄清后,检查最终需求范围是否和 change-name 一致
241
+ - [ ] 如果用户取消某个需求,但 change-name 仍包含该需求关键词,必须建议重命名
242
+ - [ ] 重命名后同步目录名、spec/plan/scenarios 文件名、frontmatter、logs/execution-log、events.ndjson、meta/worktree.json
243
+ - [ ] 如果用户选择不重命名,记录 🟡WARN 到 events.ndjson(`issue` 或 `decision` 事件)