@hunter-harness/workflow-harness 0.2.8 → 0.2.10

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 (334) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/contracts/workflow-policy.json +3 -3
  3. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +3 -3
  4. package/harness/bundles/general/claude-code/harness-archive/reference.md +30 -12
  5. package/harness/bundles/general/claude-code/harness-archive/templates/render-summary.mjs +5 -1
  6. package/harness/bundles/general/claude-code/harness-archive/templates/summary-data-template.json +6 -2
  7. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  8. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +3 -1
  9. package/harness/bundles/general/claude-code/harness-knowledge-ingest/reference.md +7 -0
  10. package/harness/bundles/general/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  11. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  12. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +1 -1
  13. package/harness/bundles/general/claude-code/harness-plan/checklist.md +6 -0
  14. package/harness/bundles/general/claude-code/harness-review/SKILL.md +3 -3
  15. package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
  16. package/harness/bundles/general/claude-code/harness-run/checklist.md +5 -0
  17. package/harness/bundles/general/claude-code/harness-run/reference.md +33 -1
  18. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +15 -10
  19. package/harness/bundles/general/claude-code/harness-submit/checklist.md +40 -76
  20. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +17 -2
  21. package/harness/bundles/general/claude-code/harness-sync/reference.md +2 -2
  22. package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
  23. package/harness/bundles/general/claude-code/harness-test/checklist.md +9 -0
  24. package/harness/bundles/general/claude-code/harness-test/pitfalls-java.md +14 -0
  25. package/harness/bundles/general/claude-code/harness-test/reference.md +38 -0
  26. package/harness/bundles/general/claude-code/protocols/archive-report-protocol.md +26 -4
  27. package/harness/bundles/general/claude-code/protocols/ledger-protocol.md +38 -0
  28. package/harness/bundles/general/claude-code/protocols/powershell-protocol.md +16 -0
  29. package/harness/bundles/general/claude-code/protocols/report-pipeline-protocol.md +17 -0
  30. package/harness/bundles/general/claude-code/protocols/state-layout-protocol.md +15 -0
  31. package/harness/bundles/general/claude-code/scripts/harness_archive.py +1209 -170
  32. package/harness/bundles/general/claude-code/scripts/harness_change.py +18 -0
  33. package/harness/bundles/general/claude-code/scripts/harness_deploy.py +1 -44
  34. package/harness/bundles/general/claude-code/scripts/harness_events.py +174 -25
  35. package/harness/bundles/general/claude-code/scripts/harness_gate.py +203 -29
  36. package/harness/bundles/general/claude-code/scripts/harness_integration.py +878 -0
  37. package/harness/bundles/general/claude-code/scripts/harness_ledger.py +457 -10
  38. package/harness/bundles/general/claude-code/scripts/harness_paths.py +315 -0
  39. package/harness/bundles/general/claude-code/scripts/harness_profile.py +45 -0
  40. package/harness/bundles/general/claude-code/scripts/harness_review.py +326 -0
  41. package/harness/bundles/general/claude-code/scripts/harness_sync.py +407 -0
  42. package/harness/bundles/general/claude-code/scripts/harness_test_guard.py +244 -49
  43. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  44. package/harness/bundles/general/codebuddy/contracts/workflow-policy.json +3 -3
  45. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +3 -3
  46. package/harness/bundles/general/codebuddy/harness-archive/reference.md +30 -12
  47. package/harness/bundles/general/codebuddy/harness-archive/templates/render-summary.mjs +5 -1
  48. package/harness/bundles/general/codebuddy/harness-archive/templates/summary-data-template.json +6 -2
  49. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  50. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +3 -1
  51. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/reference.md +7 -0
  52. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  53. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  54. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +1 -1
  55. package/harness/bundles/general/codebuddy/harness-plan/checklist.md +6 -0
  56. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +3 -3
  57. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
  58. package/harness/bundles/general/codebuddy/harness-run/checklist.md +5 -0
  59. package/harness/bundles/general/codebuddy/harness-run/reference.md +33 -1
  60. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +15 -10
  61. package/harness/bundles/general/codebuddy/harness-submit/checklist.md +40 -76
  62. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +17 -2
  63. package/harness/bundles/general/codebuddy/harness-sync/reference.md +2 -2
  64. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
  65. package/harness/bundles/general/codebuddy/harness-test/checklist.md +9 -0
  66. package/harness/bundles/general/codebuddy/harness-test/pitfalls-java.md +14 -0
  67. package/harness/bundles/general/codebuddy/harness-test/reference.md +38 -0
  68. package/harness/bundles/general/codebuddy/protocols/archive-report-protocol.md +26 -4
  69. package/harness/bundles/general/codebuddy/protocols/ledger-protocol.md +38 -0
  70. package/harness/bundles/general/codebuddy/protocols/powershell-protocol.md +16 -0
  71. package/harness/bundles/general/codebuddy/protocols/report-pipeline-protocol.md +17 -0
  72. package/harness/bundles/general/codebuddy/protocols/state-layout-protocol.md +15 -0
  73. package/harness/bundles/general/codebuddy/scripts/harness_archive.py +1209 -170
  74. package/harness/bundles/general/codebuddy/scripts/harness_change.py +18 -0
  75. package/harness/bundles/general/codebuddy/scripts/harness_deploy.py +1 -44
  76. package/harness/bundles/general/codebuddy/scripts/harness_events.py +174 -25
  77. package/harness/bundles/general/codebuddy/scripts/harness_gate.py +203 -29
  78. package/harness/bundles/general/codebuddy/scripts/harness_integration.py +878 -0
  79. package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +457 -10
  80. package/harness/bundles/general/codebuddy/scripts/harness_paths.py +315 -0
  81. package/harness/bundles/general/codebuddy/scripts/harness_profile.py +45 -0
  82. package/harness/bundles/general/codebuddy/scripts/harness_review.py +326 -0
  83. package/harness/bundles/general/codebuddy/scripts/harness_sync.py +407 -0
  84. package/harness/bundles/general/codebuddy/scripts/harness_test_guard.py +244 -49
  85. package/harness/bundles/general/codex/.harness-build.json +1 -1
  86. package/harness/bundles/general/codex/contracts/workflow-policy.json +3 -3
  87. package/harness/bundles/general/codex/harness-archive/SKILL.md +3 -3
  88. package/harness/bundles/general/codex/harness-archive/reference.md +30 -12
  89. package/harness/bundles/general/codex/harness-archive/templates/render-summary.mjs +5 -1
  90. package/harness/bundles/general/codex/harness-archive/templates/summary-data-template.json +6 -2
  91. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  92. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +3 -1
  93. package/harness/bundles/general/codex/harness-knowledge-ingest/reference.md +7 -0
  94. package/harness/bundles/general/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  95. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  96. package/harness/bundles/general/codex/harness-plan/SKILL.md +1 -1
  97. package/harness/bundles/general/codex/harness-plan/checklist.md +6 -0
  98. package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
  99. package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
  100. package/harness/bundles/general/codex/harness-run/checklist.md +5 -0
  101. package/harness/bundles/general/codex/harness-run/reference.md +33 -1
  102. package/harness/bundles/general/codex/harness-submit/SKILL.md +15 -10
  103. package/harness/bundles/general/codex/harness-submit/checklist.md +40 -76
  104. package/harness/bundles/general/codex/harness-sync/SKILL.md +17 -2
  105. package/harness/bundles/general/codex/harness-sync/reference.md +2 -2
  106. package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
  107. package/harness/bundles/general/codex/harness-test/checklist.md +9 -0
  108. package/harness/bundles/general/codex/harness-test/pitfalls-java.md +14 -0
  109. package/harness/bundles/general/codex/harness-test/reference.md +38 -0
  110. package/harness/bundles/general/codex/protocols/archive-report-protocol.md +26 -4
  111. package/harness/bundles/general/codex/protocols/ledger-protocol.md +38 -0
  112. package/harness/bundles/general/codex/protocols/powershell-protocol.md +16 -0
  113. package/harness/bundles/general/codex/protocols/report-pipeline-protocol.md +17 -0
  114. package/harness/bundles/general/codex/protocols/state-layout-protocol.md +15 -0
  115. package/harness/bundles/general/codex/scripts/harness_archive.py +1209 -170
  116. package/harness/bundles/general/codex/scripts/harness_change.py +18 -0
  117. package/harness/bundles/general/codex/scripts/harness_deploy.py +1 -44
  118. package/harness/bundles/general/codex/scripts/harness_events.py +174 -25
  119. package/harness/bundles/general/codex/scripts/harness_gate.py +203 -29
  120. package/harness/bundles/general/codex/scripts/harness_integration.py +878 -0
  121. package/harness/bundles/general/codex/scripts/harness_ledger.py +457 -10
  122. package/harness/bundles/general/codex/scripts/harness_paths.py +315 -0
  123. package/harness/bundles/general/codex/scripts/harness_profile.py +45 -0
  124. package/harness/bundles/general/codex/scripts/harness_review.py +326 -0
  125. package/harness/bundles/general/codex/scripts/harness_sync.py +407 -0
  126. package/harness/bundles/general/codex/scripts/harness_test_guard.py +244 -49
  127. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  128. package/harness/bundles/general/cursor/contracts/workflow-policy.json +3 -3
  129. package/harness/bundles/general/cursor/harness-archive/SKILL.md +3 -3
  130. package/harness/bundles/general/cursor/harness-archive/reference.md +30 -12
  131. package/harness/bundles/general/cursor/harness-archive/templates/render-summary.mjs +5 -1
  132. package/harness/bundles/general/cursor/harness-archive/templates/summary-data-template.json +6 -2
  133. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  134. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +3 -1
  135. package/harness/bundles/general/cursor/harness-knowledge-ingest/reference.md +7 -0
  136. package/harness/bundles/general/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  137. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  138. package/harness/bundles/general/cursor/harness-plan/SKILL.md +1 -1
  139. package/harness/bundles/general/cursor/harness-plan/checklist.md +6 -0
  140. package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
  141. package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
  142. package/harness/bundles/general/cursor/harness-run/checklist.md +5 -0
  143. package/harness/bundles/general/cursor/harness-run/reference.md +33 -1
  144. package/harness/bundles/general/cursor/harness-submit/SKILL.md +15 -10
  145. package/harness/bundles/general/cursor/harness-submit/checklist.md +40 -76
  146. package/harness/bundles/general/cursor/harness-sync/SKILL.md +17 -2
  147. package/harness/bundles/general/cursor/harness-sync/reference.md +2 -2
  148. package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
  149. package/harness/bundles/general/cursor/harness-test/checklist.md +9 -0
  150. package/harness/bundles/general/cursor/harness-test/pitfalls-java.md +14 -0
  151. package/harness/bundles/general/cursor/harness-test/reference.md +38 -0
  152. package/harness/bundles/general/cursor/protocols/archive-report-protocol.md +26 -4
  153. package/harness/bundles/general/cursor/protocols/ledger-protocol.md +38 -0
  154. package/harness/bundles/general/cursor/protocols/powershell-protocol.md +16 -0
  155. package/harness/bundles/general/cursor/protocols/report-pipeline-protocol.md +17 -0
  156. package/harness/bundles/general/cursor/protocols/state-layout-protocol.md +15 -0
  157. package/harness/bundles/general/cursor/scripts/harness_archive.py +1209 -170
  158. package/harness/bundles/general/cursor/scripts/harness_change.py +18 -0
  159. package/harness/bundles/general/cursor/scripts/harness_deploy.py +1 -44
  160. package/harness/bundles/general/cursor/scripts/harness_events.py +174 -25
  161. package/harness/bundles/general/cursor/scripts/harness_gate.py +203 -29
  162. package/harness/bundles/general/cursor/scripts/harness_integration.py +878 -0
  163. package/harness/bundles/general/cursor/scripts/harness_ledger.py +457 -10
  164. package/harness/bundles/general/cursor/scripts/harness_paths.py +315 -0
  165. package/harness/bundles/general/cursor/scripts/harness_profile.py +45 -0
  166. package/harness/bundles/general/cursor/scripts/harness_review.py +326 -0
  167. package/harness/bundles/general/cursor/scripts/harness_sync.py +407 -0
  168. package/harness/bundles/general/cursor/scripts/harness_test_guard.py +244 -49
  169. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  170. package/harness/bundles/java/claude-code/contracts/workflow-policy.json +3 -3
  171. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  172. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +3 -3
  173. package/harness/bundles/java/claude-code/harness-archive/reference.md +30 -12
  174. package/harness/bundles/java/claude-code/harness-archive/templates/render-summary.mjs +5 -1
  175. package/harness/bundles/java/claude-code/harness-archive/templates/summary-data-template.json +6 -2
  176. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  177. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +3 -1
  178. package/harness/bundles/java/claude-code/harness-knowledge-ingest/reference.md +7 -0
  179. package/harness/bundles/java/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  180. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  181. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  182. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
  183. package/harness/bundles/java/claude-code/harness-plan/checklist.md +6 -0
  184. package/harness/bundles/java/claude-code/harness-review/SKILL.md +3 -3
  185. package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
  186. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +15 -10
  187. package/harness/bundles/java/claude-code/harness-submit/checklist.md +40 -76
  188. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +17 -2
  189. package/harness/bundles/java/claude-code/harness-sync/reference.md +2 -2
  190. package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
  191. package/harness/bundles/java/claude-code/protocols/archive-report-protocol.md +26 -4
  192. package/harness/bundles/java/claude-code/protocols/ledger-protocol.md +38 -0
  193. package/harness/bundles/java/claude-code/protocols/powershell-protocol.md +16 -0
  194. package/harness/bundles/java/claude-code/protocols/report-pipeline-protocol.md +17 -0
  195. package/harness/bundles/java/claude-code/protocols/state-layout-protocol.md +15 -0
  196. package/harness/bundles/java/claude-code/scripts/harness_archive.py +1209 -170
  197. package/harness/bundles/java/claude-code/scripts/harness_change.py +18 -0
  198. package/harness/bundles/java/claude-code/scripts/harness_deploy.py +1 -44
  199. package/harness/bundles/java/claude-code/scripts/harness_events.py +174 -25
  200. package/harness/bundles/java/claude-code/scripts/harness_gate.py +203 -29
  201. package/harness/bundles/java/claude-code/scripts/harness_integration.py +878 -0
  202. package/harness/bundles/java/claude-code/scripts/harness_ledger.py +457 -10
  203. package/harness/bundles/java/claude-code/scripts/harness_paths.py +315 -0
  204. package/harness/bundles/java/claude-code/scripts/harness_profile.py +45 -0
  205. package/harness/bundles/java/claude-code/scripts/harness_review.py +326 -0
  206. package/harness/bundles/java/claude-code/scripts/harness_sync.py +407 -0
  207. package/harness/bundles/java/claude-code/scripts/harness_test_guard.py +244 -49
  208. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  209. package/harness/bundles/java/codebuddy/contracts/workflow-policy.json +3 -3
  210. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  211. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +3 -3
  212. package/harness/bundles/java/codebuddy/harness-archive/reference.md +30 -12
  213. package/harness/bundles/java/codebuddy/harness-archive/templates/render-summary.mjs +5 -1
  214. package/harness/bundles/java/codebuddy/harness-archive/templates/summary-data-template.json +6 -2
  215. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  216. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +3 -1
  217. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/reference.md +7 -0
  218. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  219. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  220. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  221. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
  222. package/harness/bundles/java/codebuddy/harness-plan/checklist.md +6 -0
  223. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +3 -3
  224. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
  225. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +15 -10
  226. package/harness/bundles/java/codebuddy/harness-submit/checklist.md +40 -76
  227. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +17 -2
  228. package/harness/bundles/java/codebuddy/harness-sync/reference.md +2 -2
  229. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
  230. package/harness/bundles/java/codebuddy/protocols/archive-report-protocol.md +26 -4
  231. package/harness/bundles/java/codebuddy/protocols/ledger-protocol.md +38 -0
  232. package/harness/bundles/java/codebuddy/protocols/powershell-protocol.md +16 -0
  233. package/harness/bundles/java/codebuddy/protocols/report-pipeline-protocol.md +17 -0
  234. package/harness/bundles/java/codebuddy/protocols/state-layout-protocol.md +15 -0
  235. package/harness/bundles/java/codebuddy/scripts/harness_archive.py +1209 -170
  236. package/harness/bundles/java/codebuddy/scripts/harness_change.py +18 -0
  237. package/harness/bundles/java/codebuddy/scripts/harness_deploy.py +1 -44
  238. package/harness/bundles/java/codebuddy/scripts/harness_events.py +174 -25
  239. package/harness/bundles/java/codebuddy/scripts/harness_gate.py +203 -29
  240. package/harness/bundles/java/codebuddy/scripts/harness_integration.py +878 -0
  241. package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +457 -10
  242. package/harness/bundles/java/codebuddy/scripts/harness_paths.py +315 -0
  243. package/harness/bundles/java/codebuddy/scripts/harness_profile.py +45 -0
  244. package/harness/bundles/java/codebuddy/scripts/harness_review.py +326 -0
  245. package/harness/bundles/java/codebuddy/scripts/harness_sync.py +407 -0
  246. package/harness/bundles/java/codebuddy/scripts/harness_test_guard.py +244 -49
  247. package/harness/bundles/java/codex/.harness-build.json +1 -1
  248. package/harness/bundles/java/codex/contracts/workflow-policy.json +3 -3
  249. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  250. package/harness/bundles/java/codex/harness-archive/SKILL.md +3 -3
  251. package/harness/bundles/java/codex/harness-archive/reference.md +30 -12
  252. package/harness/bundles/java/codex/harness-archive/templates/render-summary.mjs +5 -1
  253. package/harness/bundles/java/codex/harness-archive/templates/summary-data-template.json +6 -2
  254. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  255. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +3 -1
  256. package/harness/bundles/java/codex/harness-knowledge-ingest/reference.md +7 -0
  257. package/harness/bundles/java/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  258. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  259. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  260. package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
  261. package/harness/bundles/java/codex/harness-plan/checklist.md +6 -0
  262. package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
  263. package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
  264. package/harness/bundles/java/codex/harness-submit/SKILL.md +15 -10
  265. package/harness/bundles/java/codex/harness-submit/checklist.md +40 -76
  266. package/harness/bundles/java/codex/harness-sync/SKILL.md +17 -2
  267. package/harness/bundles/java/codex/harness-sync/reference.md +2 -2
  268. package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
  269. package/harness/bundles/java/codex/protocols/archive-report-protocol.md +26 -4
  270. package/harness/bundles/java/codex/protocols/ledger-protocol.md +38 -0
  271. package/harness/bundles/java/codex/protocols/powershell-protocol.md +16 -0
  272. package/harness/bundles/java/codex/protocols/report-pipeline-protocol.md +17 -0
  273. package/harness/bundles/java/codex/protocols/state-layout-protocol.md +15 -0
  274. package/harness/bundles/java/codex/scripts/harness_archive.py +1209 -170
  275. package/harness/bundles/java/codex/scripts/harness_change.py +18 -0
  276. package/harness/bundles/java/codex/scripts/harness_deploy.py +1 -44
  277. package/harness/bundles/java/codex/scripts/harness_events.py +174 -25
  278. package/harness/bundles/java/codex/scripts/harness_gate.py +203 -29
  279. package/harness/bundles/java/codex/scripts/harness_integration.py +878 -0
  280. package/harness/bundles/java/codex/scripts/harness_ledger.py +457 -10
  281. package/harness/bundles/java/codex/scripts/harness_paths.py +315 -0
  282. package/harness/bundles/java/codex/scripts/harness_profile.py +45 -0
  283. package/harness/bundles/java/codex/scripts/harness_review.py +326 -0
  284. package/harness/bundles/java/codex/scripts/harness_sync.py +407 -0
  285. package/harness/bundles/java/codex/scripts/harness_test_guard.py +244 -49
  286. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  287. package/harness/bundles/java/cursor/contracts/workflow-policy.json +3 -3
  288. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  289. package/harness/bundles/java/cursor/harness-archive/SKILL.md +3 -3
  290. package/harness/bundles/java/cursor/harness-archive/reference.md +30 -12
  291. package/harness/bundles/java/cursor/harness-archive/templates/render-summary.mjs +5 -1
  292. package/harness/bundles/java/cursor/harness-archive/templates/summary-data-template.json +6 -2
  293. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  294. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +3 -1
  295. package/harness/bundles/java/cursor/harness-knowledge-ingest/reference.md +7 -0
  296. package/harness/bundles/java/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +117 -0
  297. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  298. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  299. package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
  300. package/harness/bundles/java/cursor/harness-plan/checklist.md +6 -0
  301. package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
  302. package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
  303. package/harness/bundles/java/cursor/harness-submit/SKILL.md +15 -10
  304. package/harness/bundles/java/cursor/harness-submit/checklist.md +40 -76
  305. package/harness/bundles/java/cursor/harness-sync/SKILL.md +17 -2
  306. package/harness/bundles/java/cursor/harness-sync/reference.md +2 -2
  307. package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
  308. package/harness/bundles/java/cursor/protocols/archive-report-protocol.md +26 -4
  309. package/harness/bundles/java/cursor/protocols/ledger-protocol.md +38 -0
  310. package/harness/bundles/java/cursor/protocols/powershell-protocol.md +16 -0
  311. package/harness/bundles/java/cursor/protocols/report-pipeline-protocol.md +17 -0
  312. package/harness/bundles/java/cursor/protocols/state-layout-protocol.md +15 -0
  313. package/harness/bundles/java/cursor/scripts/harness_archive.py +1209 -170
  314. package/harness/bundles/java/cursor/scripts/harness_change.py +18 -0
  315. package/harness/bundles/java/cursor/scripts/harness_deploy.py +1 -44
  316. package/harness/bundles/java/cursor/scripts/harness_events.py +174 -25
  317. package/harness/bundles/java/cursor/scripts/harness_gate.py +203 -29
  318. package/harness/bundles/java/cursor/scripts/harness_integration.py +878 -0
  319. package/harness/bundles/java/cursor/scripts/harness_ledger.py +457 -10
  320. package/harness/bundles/java/cursor/scripts/harness_paths.py +315 -0
  321. package/harness/bundles/java/cursor/scripts/harness_profile.py +45 -0
  322. package/harness/bundles/java/cursor/scripts/harness_review.py +326 -0
  323. package/harness/bundles/java/cursor/scripts/harness_sync.py +407 -0
  324. package/harness/bundles/java/cursor/scripts/harness_test_guard.py +244 -49
  325. package/harness/manifests/general/claude-code.json +58 -38
  326. package/harness/manifests/general/codebuddy.json +58 -38
  327. package/harness/manifests/general/codex.json +58 -38
  328. package/harness/manifests/general/cursor.json +58 -38
  329. package/harness/manifests/java/claude-code.json +52 -36
  330. package/harness/manifests/java/codebuddy.json +52 -36
  331. package/harness/manifests/java/codex.json +52 -36
  332. package/harness/manifests/java/cursor.json +52 -36
  333. package/hunter-workflow-family.json +2 -2
  334. package/package.json +1 -1
@@ -2,5 +2,5 @@
2
2
  "schemaVersion": 1,
3
3
  "overlay": "none",
4
4
  "agent": "claude-code",
5
- "coreHash": "0d4dcc4204125f4d"
5
+ "coreHash": "43088896a4556b69"
6
6
  }
@@ -2,21 +2,21 @@
2
2
  "schemaVersion": 1,
3
3
  "riskTiers": {
4
4
  "fast": {
5
- "description": "Low-risk docs/comments/non-behavioral config; no API/DB/security/concurrency.",
5
+ "description": "Low-risk docs/comments/non-behavioral config; no API/DB/security/concurrency. Policy notes: checkpointRules apply only when meta/implementation-checkpoints.json defines the entry for this change; missing file/entry = disabled (gate must not require --task).",
6
6
  "defaultPhases": ["plan", "run", "submit", "archive"],
7
7
  "requiredValidations": ["unitTest"],
8
8
  "conditionalStages": ["review", "package", "apidoc"],
9
9
  "upgradeTriggers": ["api-change", "security", "migration", "concurrency", "breaking-contract"]
10
10
  },
11
11
  "standard": {
12
- "description": "Ordinary production code and non-breaking API/features.",
12
+ "description": "Ordinary production code and non-breaking API/features. Policy notes: requiredValidations may close DEGRADED when ledger status=NOT_RUN and evidence starts with 'DEGRADED: <reason>' (close code CLOSED_DEGRADED, phase status <= WARN); do not fake OK with unrelated tests.",
13
13
  "defaultPhases": ["plan", "run", "test", "submit", "archive"],
14
14
  "requiredValidations": ["compile", "unitTest", "unitTestFull"],
15
15
  "conditionalStages": ["review", "package", "apidoc"],
16
16
  "upgradeTriggers": ["auth", "security", "delete", "migration", "concurrency", "artifact-protocol", "shared-state", "breaking-api"]
17
17
  },
18
18
  "full": {
19
- "description": "Auth/security/delete/migration/concurrency/service protocol/shared state/breaking contracts.",
19
+ "description": "Auth/security/delete/migration/concurrency/service protocol/shared state/breaking contracts. Policy notes: (1) DEGRADED close — ledger status=NOT_RUN and evidence 'DEGRADED: <reason>' → CLOSED_DEGRADED with phase <= WARN; never fake OK with unrelated tests. (2) checkpointRules — only when plan created meta/implementation-checkpoints.json entry; missing file/entry = not enabled, gate must not require --task.",
20
20
  "defaultPhases": ["plan", "run", "test", "review", "submit", "archive"],
21
21
  "requiredValidations": ["compile", "unitTest", "unitTestFull", "apiTest"],
22
22
  "conditionalStages": ["package", "apidoc"],
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-archive — 变更归档
25
25
 
26
26
  ## Purpose
@@ -103,8 +103,8 @@ AskUserQuestion 让用户确认归档操作。**用户拒绝 → 终止流程,
103
103
  ### Phase 3:执行归档
104
104
 
105
105
  1. 运行 `python <skills-root>/scripts/harness_archive.py status --change-dir ".harness/changes/<change-name>" --json` 前置检查。
106
- 2. 如需维护者结论,在移动前补全 `meta/archive-meta.md`;不得在 finalize 后修改已校验的归档文件。
107
- 3. 运行 `python <skills-root>/scripts/harness_archive.py finalize --change-dir ".harness/changes/<change-name>" --archive-root ".harness/archive" --json`;读 JSON(事件、移动、collect、render、validate、manifest 比对)。finalize 内部负责且仅负责一次 `phase.start` / `phase.end`,调用者不得重复追加。**finalize 不再同步执行知识维护**(§8.2):它写一个 `pending` maintenance-outbox 项即返回,`knowledgeMaintenance=QUEUED`;写 outbox 失败时 `NOT_QUEUED`(warning,不回滚 archive,总状态 CONDITIONAL)。后续由 `harness-sync` / `harness_knowledge.py maintain` 异步推进 outbox。**finalize 失败或 validate 报错时不删除原目录**。
106
+ 2. `meta/archive-meta.md` **由 `harness_archive.py finalize` 自动生成**(与 summary-data `finalStatus` 同源);**禁止 agent 手写**该文件,手写视为数据丢失。维护者结论写入 events(decision/issue)即可,finalize 会汇总到 summary / archive-meta。
107
+ 3. 运行 `python <skills-root>/scripts/harness_archive.py finalize --change-dir ".harness/changes/<change-name>" --archive-root ".harness/archive" --json`;读 JSON(cleanup、事件、移动、collect、render、validate、manifest 比对、archive-meta)。finalize 内部负责且仅负责一次 `phase.start` / `phase.end`,调用者不得重复追加。**finalize 不再同步执行知识维护**(§8.2):它写一个 `pending` maintenance-outbox 项即返回,`knowledgeMaintenance=QUEUED`;写 outbox 失败时 `NOT_QUEUED`(warning,不回滚 archive,总状态 CONDITIONAL)。后续由 `harness-sync` / `harness_knowledge.py maintain` 异步推进 outbox。**finalize 失败或 validate 报错时不删除原目录**。
108
108
 
109
109
  - **Read `reference.md`** — finalize 输出字段、archive-meta 格式、CONDITIONAL_OK 规则
110
110
  - **Read `templates/summary-data-template.json`** — summary-data 数据结构
@@ -11,8 +11,8 @@ description: harness-archive 的归档流程、manifest、summary-data、final-s
11
11
  - **Phase 2 确认归档(强制阻断)**:AskUserQuestion 确认,拒绝即终止。
12
12
  - **Phase 3 执行归档**:
13
13
  1. 运行 `python <skills-root>/scripts/harness_archive.py status --change-dir ... --json` 做前置检查。
14
- 2. 需要维护者结论时,在移动前补全 `meta/archive-meta.md` `maintenanceNotes` / `knownRisks` / `manualActions`;finalize 后不再修改归档内容。
15
- 3. 运行 `python <skills-root>/scripts/harness_archive.py finalize --change-dir ... --archive-root ".harness/archive" --json`;读 JSON 结果。finalize 内部负责且仅负责一次 `phase.start` / `phase.end`,调用者不得重复追加。**finalize 报错或 validate 失败时不删除原 changes 目录**。
14
+ 2. `meta/archive-meta.md` finalize 生成(与 summary `finalStatus` 同源);禁止手写。维护者结论写入 events 即可。finalize 在 before-manifest 前执行 cleanup(删除 lock/pid/launcher/credential,截断超大日志)。
15
+ 3. 运行 `python <skills-root>/scripts/harness_archive.py finalize --change-dir ... --archive-root ".harness/archive" --json`;读 JSON 结果。finalize 内部负责且仅负责一次 `phase.start` / `phase.end`,调用者不得重复追加。**finalize 报错或 validate 失败时不删除原 changes 目录**。finalize 为冻结优先(freeze-first):collect 前先 fsync 事件并写 `evidence/evidence-cutoff.json`,cutoff 后不再追加事件;随后依次执行 source consistency(层 1,写入 `reportPipeline.sourceConsistency`)→ render → renderer consistency(层 2),任一层失败即恢复原目录并非零退出。
16
16
  - **Phase 4 验证与提示**:见 `checklist.md` 归档后验证项。
17
17
 
18
18
  ## manifest 生成
@@ -39,7 +39,7 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "harness-skills/harness-
39
39
 
40
40
  ## summary-data.json 与 harness_archive.py
41
41
 
42
- `reports/final/summary-data.json` 只能由 `harness_archive.py finalize`(归档时)或 `replay`(回放时)生成/校验;**禁止 agent 临场手写或拼装等价数据**,也不存在独立的 `report collect`/`report validate` CLI(参见 `../protocols/report-pipeline-protocol.md` 与 `templates/summary-data-template.json` schemaVersion 2.2)。必须保留原 final report 维度。必须包含:
42
+ `reports/final/summary-data.json` 只能由 `harness_archive.py finalize`(归档时)或 `replay`(回放时)生成/校验;**禁止 agent 临场手写或拼装等价数据**,也不存在独立的 `report collect`/`report validate` CLI(参见 `../protocols/report-pipeline-protocol.md` 与 `templates/summary-data-template.json` schemaVersion 2.3)。必须保留原 final report 维度。必须包含:
43
43
 
44
44
  - `businessGoal`:本次变更为了做什么;
45
45
  - `stageStatus`:plan/run/test/review/submit/archive;
@@ -68,20 +68,38 @@ powershell.exe -NoProfile -Command "& '<node-path>' 'harness-skills/harness-arch
68
68
 
69
69
  `validate` 是 `harness_archive.py finalize` 的内嵌同进程步骤(不再作为独立 `report validate` CLI 调用)。finalize 在 validate error 存在时恢复原 `.harness/changes/<change>` 目录并 exit 非 0,绝不归档未通过校验的变更。
70
70
 
71
+ ## repair(归档后修复,不改写原版)
72
+
73
+ 归档后发现 source/renderer 不一致时,使用显式修复(`replay` 仍为只读):
74
+
75
+ ```powershell
76
+ python <skills-root>/scripts/harness_archive.py repair --archive-dir ".harness/archive/<archive-id>" --json
77
+ ```
78
+
79
+ repair 在 archive 外生成候选版本,两层 validator 通过后写入不可变 `derived/v<N>/`(summary-data.json + final-summary.html + repair-record.json),并更新 `derived/authoritative.json` pointer;原 summary、HTML、manifest 不覆盖。知识层仅从 authoritative pointer 且 hash 校验通过的版本提取。
80
+
71
81
  ## archive-meta.md 模板
72
82
 
83
+ 由 `harness_archive.py finalize` 生成(手写视为数据丢失)。frontmatter 与 summary-data 同源:
84
+
73
85
  ```markdown
74
- # Archive Meta — <change-name>
75
-
76
- - archivedAt: YYYY-MM-DD HH:mm
77
- - finalCommit: <hash>
78
- - sourceDir: .harness/changes/<change-name>
79
- - archiveDir: .harness/archive/YYYY-MM-DD-<change-name>
80
- - movedFiles: <from manifest>
81
- - generatedFiles: archive-meta.md, summary-data.json, final-summary.html, manifests
82
- - totalArchiveFiles: <from after manifest>
86
+ ---
87
+ archive-id: YYYY-MM-DD-<change-name>
88
+ change-name: <change-name>
89
+ archived-at: YYYY-MM-DD HH:mm
90
+ final-commit: <hash>
91
+ base-commit: <hash>
92
+ final-status: <OK|WARN|CONDITIONAL_OK|FAIL> # 与 summary-data.finalStatus 同源
93
+ source: harness-archive
94
+ ---
95
+ # 归档元数据 — <change-name>
96
+ ## 阶段状态
97
+ ## 变更文件
98
+ ## 已知风险
83
99
  ```
84
100
 
101
+ cleanup 步骤(before-manifest 前):删除 `events.ndjson.lock`、`runtime/*.pid`、launcher、credential/token/secret 文件名;截断 `logs/**/*.log` 超过 64KB 的尾部保留。
102
+
85
103
  ## 目录结构与最终状态规则
86
104
 
87
105
  - 默认渲染器:`templates/render-summary.mjs`,输入 `reports/final/summary-data.json`,输出 `reports/final/final-summary.html`。
@@ -56,6 +56,10 @@ const actions = list(data.manualActions);
56
56
  const files = list(data.changedFiles);
57
57
  const commands = list(record(data.reportPipeline).commands);
58
58
  const timeline = list(data.timeline);
59
+ const statusReasons = list(data.finalStatusReasons);
60
+ const reasonHtml = statusReasons.length
61
+ ? `<small>${statusReasons.map((item) => esc(item)).join(" · ")}</small>`
62
+ : "";
59
63
 
60
64
  const stageHtml = stages.map(([name, status]) => `<div class="row"><span>${esc(name)}</span>${pill(status)}</div>`).join("") || '<p class="empty">没有阶段状态记录</p>';
61
65
  const verificationHtml = [
@@ -81,7 +85,7 @@ const html = `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><met
81
85
  *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.5 Inter,"Segoe UI","Microsoft YaHei",sans-serif}main{width:min(1140px,calc(100% - 28px));margin:22px auto 44px}.hero,.card,.metric,details{background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow)}.hero{padding:23px 25px;border-top:3px solid var(--blue)}.eyebrow{color:var(--blue);font-weight:750;letter-spacing:.08em}h1{font-size:27px;line-height:1.2;margin:5px 0 7px;overflow-wrap:anywhere}.goal,.empty,small{color:var(--muted)}.status{display:flex;align-items:center;gap:10px;margin-top:16px}.metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:11px;margin:11px 0}.metric{padding:14px 15px}.metric strong{display:block;font-size:19px;margin:4px 0}.grid{display:grid;grid-template-columns:1.12fr .88fr;gap:11px}.card{padding:17px;margin-bottom:11px}h2{font-size:16px;margin:0 0 10px}.row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 0;border-bottom:1px solid var(--line)}.row:last-child{border:0}.row small{display:block;margin-top:2px}.pill{display:inline-flex;border-radius:999px;padding:3px 9px;font-size:11px;font-weight:750;white-space:nowrap}.pill.success{color:var(--good);background:color-mix(in srgb,var(--good) 13%,transparent)}.pill.warning{color:var(--warn);background:color-mix(in srgb,var(--warn) 14%,transparent)}.pill.danger{color:var(--bad);background:color-mix(in srgb,var(--bad) 13%,transparent)}.pill.neutral{color:var(--blue);background:color-mix(in srgb,var(--blue) 12%,transparent)}.duration{margin:11px 0}.duration>div{display:flex;justify-content:space-between;color:var(--muted);font-size:12px}.duration>div span:first-child{color:var(--text);font-weight:650}.duration i{display:block;height:7px;background:var(--soft);border-radius:99px;overflow:hidden;margin-top:6px}.duration b{display:block;height:100%;background:linear-gradient(90deg,var(--blue),#7c70ff)}.risk{display:grid;grid-template-columns:1fr 1fr;gap:10px}.risk>div{background:var(--soft);border-radius:10px;padding:11px}.risk h3{font-size:13px;margin:0 0 5px}.risk ul{padding-left:18px;margin:0;color:var(--muted)}details{margin:9px 0}summary{cursor:pointer;padding:13px 15px;font-weight:650}details>div{padding:0 15px 15px;overflow:auto}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:8px 9px;border-bottom:1px solid var(--line);vertical-align:top}th{color:var(--muted);font-size:11px;letter-spacing:.04em}code{font-family:"Cascadia Code",Consolas,monospace;color:var(--blue);overflow-wrap:anywhere}.plus{color:var(--good)}.minus{color:var(--bad)}dl{display:grid;grid-template-columns:145px 1fr;gap:7px 11px}dt{color:var(--muted)}dd{margin:0;overflow-wrap:anywhere}
82
86
  @media(max-width:800px){.metrics{grid-template-columns:1fr 1fr}.grid,.risk{grid-template-columns:1fr}}@media(max-width:480px){main{width:calc(100% - 18px);margin-top:9px}.metrics{grid-template-columns:1fr}.hero{padding:19px}h1{font-size:23px}dl{grid-template-columns:1fr}}
83
87
  </style></head><body><main>
84
- <section class="hero"><div class="eyebrow">HARNESS EXECUTION REPORT</div><h1>${esc(data.changeName || "未命名变更")}</h1><p class="goal">${esc(data.businessGoal || "未记录业务目标")}</p><div class="status">${pill(data.finalStatus)}<span>基于事件、验证账本与 Git 证据生成</span></div></section>
88
+ <section class="hero"><div class="eyebrow">HARNESS EXECUTION REPORT</div><h1>${esc(data.changeName || "未命名变更")}</h1><p class="goal">${esc(data.businessGoal || "未记录业务目标")}</p><div class="status">${pill(data.finalStatus)}<span>基于事件、验证账本与 Git 证据生成${data.riskTier ? ` · riskTier=${esc(data.riskTier)}` : ""}</span></div>${reasonHtml ? `<div class="status">${reasonHtml}</div>` : ""}</section>
85
89
  <section class="metrics"><article class="metric"><small>任务提交</small><strong><code title="${esc(data.finalCommit)}">${esc(shortHash(data.finalCommit))}</code></strong><small>${esc(data.finalCommitBranch || "未记录分支")}</small></article><article class="metric"><small>代码范围</small><strong>${number(diff.filesChanged)} 个文件</strong><small><span class="plus">+${number(diff.insertions)}</span> · <span class="minus">-${number(diff.deletions)}</span></small></article><article class="metric"><small>总耗时</small><strong>${esc(durations.totalLabel || duration(durations.totalMinutes))}</strong><small>${durationStages.length} 个阶段</small></article><article class="metric"><small>归档完整性</small><strong>${esc(record(data.archiveManifest).checksumStatus || "UNKNOWN")}</strong><small>${number(record(data.archiveManifest).totalArchiveFiles)} 个归档文件</small></article></section>
86
90
  <section class="grid"><div><article class="card"><h2>验证结论</h2>${verificationHtml}</article><article class="card"><h2>阶段耗时</h2>${durationHtml}</article></div><div><article class="card"><h2>阶段状态</h2>${stageHtml}</article><article class="card"><h2>风险与后续</h2><div class="risk"><div><h3>已知风险</h3><ul>${riskHtml}</ul></div><div><h3>人工动作</h3><ul>${actionHtml}</ul></div></div></article></div></section>
87
91
  <details><summary>变更文件(${files.length})</summary><div><table><thead><tr><th>文件</th><th>新增</th><th>删除</th></tr></thead><tbody>${fileRows}</tbody></table></div></details>
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": "2.2",
2
+ "schemaVersion": "2.3",
3
3
  "changeName": "<change-name>",
4
4
  "businessGoal": "本次变更为了做什么",
5
5
  "finalStatus": "OK | WARN | CONDITIONAL_OK | FAIL",
@@ -119,7 +119,11 @@
119
119
  "phase": "archive"
120
120
  }
121
121
  ],
122
- "validationIssues": []
122
+ "validationIssues": [],
123
+ "sourceConsistency": {
124
+ "ok": true,
125
+ "issues": []
126
+ }
123
127
  },
124
128
  "uncommittedTestEvidence": [],
125
129
  "maintenanceNotes": [],
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-codebase-map — 代码库地图
25
25
 
26
26
  ## Purpose
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-knowledge-ingest
25
25
 
26
26
  从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
@@ -153,6 +153,8 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
153
153
 
154
154
  仅在用户点名单条、或 `manualReview=true` 需人工确认时使用 `promote` / `demote`。日常归档后不要逐条人工复核。
155
155
 
156
+ **发布门禁**:promote / judge apply / autoPromote 会校验来源归档——`reportPipeline.sourceConsistency` 缺失或失败、authoritative pointer /hash 不通过的归档,其条目带 `lifecycle.publishBlocked`,只能停留在 quarantined candidate。先 `harness_archive.py repair` 修复并重新 ingest,再 promote(详见 `reference.md`「发布门禁」)。
157
+
156
158
  ### Phase 6:解释同步结果
157
159
 
158
160
  回复用户或交给后续 skill 前,应说明:
@@ -145,6 +145,13 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sugge
145
145
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' promote --project '<project-root>' --id '<entry-id>' --note '<人工确认说明>'"
146
146
  ```
147
147
 
148
+ **发布门禁(archive publication gate)**:promote / judge apply / autoPromote 只处理来自**已验证归档**的条目。以下来源归档会被阻断并在条目上标记 `lifecycle.publishBlocked`(ingest 仍可生成 quarantined candidate,但不得 active/promote):
149
+
150
+ - 归档 summary 缺少 `reportPipeline.sourceConsistency`(source consistency 未运行)或 `ok=false`;
151
+ - `derived/authoritative.json` pointer 缺失、版本目录不可读,或 repair record / pointer 的 summary hash 不匹配(DEGRADED)。
152
+
153
+ 修复路径:先运行 `harness_archive.py repair` 生成通过两层 validator 的新 derived version,再重新 ingest(旧错误条目标记 superseded),之后 promote 才放行。
154
+
148
155
  将一条 `candidate` 提升为 `active`,写入:
149
156
 
150
157
  ```text
@@ -353,6 +353,95 @@ def changed_file_paths(summary: dict[str, Any]) -> list[str]:
353
353
  return files
354
354
 
355
355
 
356
+ def archive_publication_status(project: Path, archive_rel: str) -> dict[str, Any]:
357
+ """Knowledge publication gate for one archive (API-006/RET-40).
358
+
359
+ Blocks judge/apply/promote when: source consistency never ran or failed,
360
+ the authoritative version is missing or hash-mismatched, or the archive
361
+ is DEGRADED/UNVERIFIED. Ordinary ingest may still build quarantined
362
+ candidates, but nothing from a blocked archive becomes active.
363
+ """
364
+ result: dict[str, Any] = {"status": "missing", "allowed": False, "reasons": []}
365
+ archive_dir = (Path(project) / archive_rel).resolve()
366
+ summary_path = archive_dir / "reports" / "final" / "summary-data.json"
367
+ if not summary_path.is_file():
368
+ result["reasons"].append("summary-data.json missing")
369
+ return result
370
+ try:
371
+ summary = json.loads(summary_path.read_text(encoding="utf-8"))
372
+ except (OSError, json.JSONDecodeError):
373
+ result["reasons"].append("summary-data.json unreadable")
374
+ return result
375
+ if not isinstance(summary, dict):
376
+ result["reasons"].append("summary-data.json must be an object")
377
+ return result
378
+
379
+ # A versioned repair becomes authoritative only after its pointer and
380
+ # repair-record hashes are verified. Gate the authoritative summary, not
381
+ # the known-bad original that caused the repair.
382
+ pointer_path = archive_dir / "derived" / "authoritative.json"
383
+ if pointer_path.is_file():
384
+ try:
385
+ pointer = json.loads(pointer_path.read_text(encoding="utf-8"))
386
+ version = str(pointer.get("version") or "")
387
+ if re.fullmatch(r"v[0-9]+", version) is None:
388
+ raise ValueError("invalid authoritative version")
389
+ version_dir = (archive_dir / "derived" / version).resolve()
390
+ if not version_dir.is_relative_to((archive_dir / "derived").resolve()):
391
+ raise ValueError("authoritative version escapes derived root")
392
+ record = json.loads(
393
+ (version_dir / "repair-record.json").read_text(encoding="utf-8")
394
+ )
395
+ derived_path = version_dir / "summary-data.json"
396
+ summary_bytes = derived_path.read_bytes()
397
+ actual = "sha256:" + hashlib.sha256(summary_bytes).hexdigest()
398
+ if record.get("summarySha256") != actual:
399
+ result["status"] = "degraded"
400
+ result["reasons"].append("repair record summary hash mismatch")
401
+ return result
402
+ if pointer.get("summarySha256") not in {None, actual}:
403
+ result["status"] = "degraded"
404
+ result["reasons"].append("authoritative pointer hash mismatch")
405
+ return result
406
+ summary = json.loads(summary_bytes.decode("utf-8"))
407
+ if not isinstance(summary, dict):
408
+ raise ValueError("authoritative summary must be an object")
409
+ result["authoritativeVersion"] = version
410
+ except (OSError, json.JSONDecodeError, UnicodeDecodeError, ValueError):
411
+ result["status"] = "degraded"
412
+ result["reasons"].append("authoritative version unreadable")
413
+ return result
414
+
415
+ consistency = (summary.get("reportPipeline") or {}).get("sourceConsistency")
416
+ if consistency is None:
417
+ result["status"] = "unverified"
418
+ result["reasons"].append("source consistency never ran")
419
+ return result
420
+ if not consistency.get("ok"):
421
+ result["status"] = "failed"
422
+ codes = [
423
+ str(i.get("code"))
424
+ for i in (consistency.get("issues") or [])
425
+ if isinstance(i, dict) and i.get("code")
426
+ ]
427
+ result["reasons"].append(
428
+ "source consistency failed" + (f": {', '.join(codes)}" if codes else "")
429
+ )
430
+ return result
431
+
432
+ final_status = str(summary.get("finalStatus") or "").upper()
433
+ if final_status not in {"OK", "CONDITIONAL_OK"}:
434
+ result["status"] = "degraded" if final_status == "DEGRADED" else "unverified"
435
+ result["reasons"].append(
436
+ f"authoritative finalStatus is not publishable: {final_status or 'missing'}"
437
+ )
438
+ return result
439
+
440
+ result["status"] = "ok"
441
+ result["allowed"] = True
442
+ return result
443
+
444
+
356
445
  def archive_summary_records(project: Path, summary_paths: list[Path]) -> list[dict[str, Any]]:
357
446
  records = []
358
447
  for summary_path in summary_paths:
@@ -939,6 +1028,9 @@ def apply_confidence_scores(entries: list[dict[str, Any]], config: dict[str, Any
939
1028
  def should_auto_promote(entry: dict[str, Any], policy: dict[str, Any]) -> bool:
940
1029
  if not policy["enabled"]:
941
1030
  return False
1031
+ # API-006/RET-40: entries from blocked archives stay quarantined.
1032
+ if entry.get("lifecycle", {}).get("publishBlocked"):
1033
+ return False
942
1034
  if entry.get("type") not in set(policy["allowedTypes"]):
943
1035
  return False
944
1036
  if entry.get("status") == "stale" and not policy["allowStale"]:
@@ -1946,6 +2038,17 @@ def build_index(
1946
2038
  ingest_mode["cacheWrites"] += 1
1947
2039
  else:
1948
2040
  ingest_mode["archivesReused"] += 1
2041
+ # API-006/RET-40: entries from archives failing the publication
2042
+ # gate stay quarantined (candidate only, never active/promoted).
2043
+ archive_rel = rel_to_project(project, archive_dir_from_summary(summary_path))
2044
+ publication = archive_publication_status(project, archive_rel)
2045
+ if not publication.get("allowed"):
2046
+ for entry in archive_entries:
2047
+ lifecycle = entry.setdefault("lifecycle", {})
2048
+ lifecycle["publishBlocked"] = list(publication.get("reasons") or [])
2049
+ if entry.get("status") == "active":
2050
+ entry["status"] = "candidate"
2051
+ ingest_mode["activeAutoDemoted"] += 1
1949
2052
  entries.extend(archive_entries)
1950
2053
  except Exception as exc: # keep one bad archive from blocking the index
1951
2054
  failures.append({"path": rel_to_project(project, summary_path), "error": str(exc)})
@@ -2064,6 +2167,20 @@ def promote_entry(project: Path, entry_id: str, note: str, allow_stale: bool = F
2064
2167
  raise ValueError(f"entry not found in promotable statuses: {entry_id}")
2065
2168
 
2066
2169
  source_path, entry = found
2170
+ # API-006/RET-40: refuse promotion of entries from blocked archives.
2171
+ blocked = (entry.get("lifecycle") or {}).get("publishBlocked")
2172
+ if blocked:
2173
+ raise ValueError(
2174
+ "publication blocked: " + "; ".join(str(r) for r in blocked)
2175
+ )
2176
+ archive_rel = (entry.get("source") or {}).get("archive")
2177
+ if archive_rel:
2178
+ publication = archive_publication_status(project, archive_rel)
2179
+ if not publication.get("allowed"):
2180
+ raise ValueError(
2181
+ "publication blocked: "
2182
+ + "; ".join(str(r) for r in (publication.get("reasons") or []))
2183
+ )
2067
2184
  entry["status"] = "active"
2068
2185
  lifecycle = entry.setdefault("lifecycle", {})
2069
2186
  lifecycle["promotedAt"] = now_iso()
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-knowledge-query
25
25
 
26
26
  并行 change 中查询必须传 `--change <change-id>`;成功后以该 change 的 `meta/knowledge-context.json` 为稳定指针。全局 `context-packs/latest.json` 仅向后兼容,不得用于判断多个 active change 的上下文归属。
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-plan — 需求规划
25
25
 
26
26
  ## Purpose
@@ -57,6 +57,12 @@ description: harness-plan 的阶段检查清单和覆盖检查列表。仅在执
57
57
  > - CodeGraph 如通过 MCP 调用,必须优先用 MCP 工具,不允许通过普通 Bash 调 codegraph 命令
58
58
  > - 禁止把子代理未经工具验证的文本结论当作"详尽报告"或代码证据采纳
59
59
 
60
+ ## 影响面检查(远程客户端路径)
61
+
62
+ 变更涉及 HTTP/RPC 客户端时,在设计/任务拆分前完成路径静态比对:
63
+
64
+ - [ ] 变更涉及 HTTP/RPC 客户端(Feign/RestTemplate/SDK 封装)时:取客户端注解路径(类级 + 方法级拼接),与服务提供方 controller 的 `@RequestMapping` + 方法级注解**完整拼接路径**逐一比对,在计划/执行记录中列出比对结果。只看方法级注解不算完成。
65
+
60
66
  ## 阶段 4:设计审批包 ⚠️ 强制阻断(一次 AskUserQuestion)
61
67
 
62
68
  > 合并原「设计审核 + worktree + 场景表预览 + change-name」。推荐 worktree 读 `harness.json` `defaultWorktree`。
@@ -21,7 +21,7 @@ disallowed-tools:
21
21
  - Bash(curl *)
22
22
  - Bash(codegraph *)
23
23
  ---
24
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
24
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
25
25
  # harness-review — 代码审查
26
26
 
27
27
  ## Purpose
@@ -72,8 +72,8 @@ disallowed-tools:
72
72
 
73
73
  先运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-reviewer --json`。`usable=false` → **直接主会话审查**,记 `decision` 事件,**不委派**。`reasonCode=CUSTOM_AGENTS_UNSUPPORTED` 是当前工具没有自定义 agent 能力的正常 inline 路径,不显示缺失告警。`usable=true` 时用 Agent spawn `harness-reviewer`(只读, 6 维度)。返回空 / 无报告正文 → **不 retry**,降级主会话审查。
74
74
 
75
- 3. **持久化报告(强制,主会话)** — Agent 返回后主会话 Write 到 `reports/review/review-report-*.md`。未 Write → 🟡WARN,不得宣称 review 完成。
76
- 4. **生成修复反馈(原生协议)** — 若报告存在 RED/YELLOW 问题,执行 `protocols.md` 的 `review-fixback-protocol`,将问题转化为结构化 fixback 清单并落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`。若无 RED/YELLOW,记录 `review-fixback-protocol: skipped(no findings)`。不调用 Superpowers `receiving-code-review`,也不记录外部 skill 降级。
75
+ 3. **持久化报告与事实 sidecar(强制,主会话)** — Agent 返回后主会话 Write 到 `reports/review/review-report-*.md`,并把同一批发现写成临时 JSON 后调用 `python <skills-root>/scripts/harness_review.py write-findings --change-dir <change-dir> --input <findings.json>`。权威计数来自 `reports/review/review-findings.json`,不是 Markdown。任一写入缺失 → 🟡WARN,不得宣称 review 完成。
76
+ 4. **生成修复反馈(原生协议)** — 若报告存在 RED/YELLOW 问题,执行 `protocols.md` 的 `review-fixback-protocol`,将问题转化为结构化 fixback 清单并落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`;随后把 disposition 临时 JSON 交给 `python <skills-root>/scripts/harness_review.py write-dispositions --change-dir <change-dir> --input <dispositions.json>`,权威状态写入 `reports/review/fixback-dispositions.json`。若无 RED/YELLOW,也必须写空 findings sidecar,并记录 `review-fixback-protocol: skipped(no findings)`。不调用 Superpowers `receiving-code-review`,也不记录外部 skill 降级。
77
77
  5. **收尾** — append `phase.end` / `artifact` 事件;控制台输出摘要
78
78
 
79
79
  ## Review 定位(重要)
@@ -21,7 +21,7 @@ disallowed-tools:
21
21
  - Bash(curl *)
22
22
  - Bash(codegraph *)
23
23
  ---
24
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
24
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
25
25
  # harness-run — 需求编码
26
26
 
27
27
  ## Purpose
@@ -120,6 +120,11 @@ description: harness-run 的执行检查清单。仅在编码执行时读取。
120
120
  - [ ] 纯 Mock 数据访问层测试 → 标记为 🟡静态验证,交给 harness-test 真实 DB 验证
121
121
  - [ ] 如果必须自动化 → 使用真实数据访问层(非 mock)或可检查查询条件的测试方式
122
122
 
123
+ ### 编码前检查(远程客户端 / stub 同源错误)
124
+
125
+ - [ ] 变更涉及 HTTP/RPC 客户端(Feign/RestTemplate/SDK 封装)时:取客户端注解路径(类级 + 方法级拼接),与服务提供方 controller 的 `@RequestMapping` + 方法级注解**完整拼接路径**逐一比对,在计划/执行记录中列出比对结果。只看方法级注解不算完成。
126
+ - [ ] 修 stub/null 返回时,顺带核对同文件相邻声明(注解、常量、同类方法路径)是否同源错误,一并列出核对结果
127
+
123
128
  ### GREEN(最简实现 — 按变更簇批量实现)
124
129
 
125
130
  - [ ] 写最少代码让变更簇测试全部通过
@@ -522,12 +522,14 @@ powershell.exe -Command "<测试命令> <模块定位参数>"
522
522
 
523
523
  ```powershell
524
524
  python <skills-root>/scripts/harness_ledger.py diff-hash --repo . --base <baseCommit> --change-dir ".harness/changes/<change-name>" --json
525
- python <skills-root>/scripts/harness_ledger.py record --change-dir ".harness/changes/<change-name>" --verification compile --status PASS --command "<cmd>" --exit-code 0 --json
525
+ python <skills-root>/scripts/harness_ledger.py record --change-dir ".harness/changes/<change-name>" --verification compile --status ok --command "<cmd>" --exit-code 0 --json
526
526
  ```
527
527
 
528
528
  > `content-changeset-2` 同时读取 tracked diff、标准 untracked 文件和 manifest 的精确测试路径。manifest 缺失时保持普通行为;manifest 存在但路径越界、内容 hash 漂移或结构非法时命令失败,ledger 不可复用。checkpoint commit 不改变各路径的工作树内容,因此提交前后 hash 保持一致。
529
529
 
530
530
  > 这样 harness-test 的 Phase 1 可读取 ledger 判断是否复用 run 的 unitTest(diffHash commit-invariant + reuse 规则 #2 允许 HEAD 前移 → run 的 checkpoint commit 不破坏复用),submit 也可复用 compile 结果。详见 `../protocols/ledger-protocol.md`。
531
+ >
532
+ > **Ledger v3(v2 契约 / split-v1 布局起)**:`record` 自动解析并强制顶层身份(`schemaVersion=3/repositoryId/changeName/baseCommit/currentHead/diffHash/ownershipHash`),缺字段非零退出、不写账本;`--metrics-json` 必须通过 typed schema(unit=`total/passed/failed`,apiContract=`scenariosTotal/passed/failed`,browserE2E=`total/passed/failed`,dbCompatibility=`applicability(+reason)`);新增 `--base-commit/--diff-hash/--applicability/--applicability-reason`。legacy 契约行为不变。详见 `../protocols/ledger-protocol.md` 第十节。
531
533
 
532
534
  阶段边界:`harness_gate.py begin/close`;测试跟踪:`harness_test_guard.py begin/close`。close 失败不得用自然语言覆盖。
533
535
 
@@ -789,6 +791,36 @@ powershell.exe -Command "git -C '<project-path>' diff --check"
789
791
  在 harness-test 通过前,不建议也不应进入 `/harness-submit`。
790
792
  ```
791
793
 
794
+ ## CLI 速查(gate / ledger)
795
+
796
+ > 可直接复制;替换 `<skills-root>` / `<cn>` / `<dir>` / `<project>`。`--task` **仅在该 change 启用 checkpoint 时必需**(checkpoints 文件缺失或不含 pending foundation-gate 时不要传)。
797
+ > `ledger record` 必需:`--duration-ms`、`--evidence`,以及 `--files`(逗号分隔源文件)或 `--profile-input <verificationKey> --project <project>`(从 build-profile 展开)。`status` 枚举: `ok|fail|not_run`(没有 PASS)。
798
+ > `--skills-root` 仅用于 `begin`(及 `lint-skills`):必须是 adapter 根(如 `.cursor/skills`),不是 `scripts/` 子目录。**`close` 不需要 `--skills-root`**(该子命令不接受此参数)。
799
+
800
+ ```powershell
801
+ # gate begin/close(--task 仅在该 change 启用 checkpoint 时必需;close 不需要 --skills-root)
802
+ python <skills-root>/scripts/harness_gate.py begin --change <cn> --phase run --skills-root <skills-root> [--task N]
803
+ python <skills-root>/scripts/harness_gate.py close --change <cn> --phase run --status OK [--task N]
804
+
805
+ # ledger 记录(status: ok|fail|not_run —— 没有 PASS)
806
+ python <skills-root>/scripts/harness_ledger.py record --change-dir <dir> --verification unitTestFull --status ok --command "<完整命令>" --exit-code 0 --duration-ms 120000 --evidence "Tests run: 155, Failures: 0, Errors: 0, Skipped: 0" --coverage full --files "packages/core/src/index.ts"
807
+
808
+ # 复用检查(--profile-input 取 verification key,不是文件路径;配合 --project)
809
+ python <skills-root>/scripts/harness_ledger.py can-reuse --change-dir <dir> --verification unitTestFull --profile-input unitTestFull --project <project>
810
+ ```
811
+
812
+ ### 常见报错对照
813
+
814
+ | 报错 | 原因 | 处理 |
815
+ |------|------|------|
816
+ | `unsupported status: PASS` | ledger status 无 PASS | 改用 `ok` / `fail` / `not_run` |
817
+ | `TASK_NUMBER_REQUIRED` | 该 change 启用了 checkpoint(如 foundation-gate pending) | 补 `--task N` |
818
+ | skills-root / BUNDLE_IDENTITY_* | `begin` 未传或传了 `.../scripts` 子目录(`close` 不接受该参数) | 仅对 `begin` 显式传 adapter 根:`.cursor/skills` / `.claude/skills`(含 `.harness-build.json`) |
819
+ | `--profile-input` 指向文件路径 | 参数语义是 verification key | 传 `compile` / `unitTestFull` 等 key,不是 JSON 路径 |
820
+ | `record requires --files or a non-empty --profile-input file set` | 缺少输入文件集 | 补 `--files` 或 `--profile-input <key> --project <project>` |
821
+ | `--profile-input requires --project` | can-reuse/record 展开 profile 需要项目根 | 补 `--project <project>` |
822
+ | `record` 缺 `--duration-ms` / `--evidence` | 参数为必填 | 按模板补齐 |
823
+
792
824
  ## 关键原则
793
825
 
794
826
  - 增量构建优先:`powershell.exe -Command "<构建命令> <模块定位参数>"`(Java 示例:`mvn compile -pl <module> -o -q`,不用 clean,用离线模式加速)
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=0d4dcc4204125f4d; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=43088896a4556b69; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-submit — 最终提交(含 worktree 合并)
25
25
 
26
26
  ## Purpose
@@ -74,7 +74,7 @@ worktree 合并前必须运行 `harness_change.py integration-lock acquire --run
74
74
  ### 提交流程(步骤 0–7)
75
75
 
76
76
  0. **启动准备** — `harness_change.py resolve` 确定变更名;**`harness_gate.py begin --phase submit --change <id>`**;读 ledger,以 `harness_ledger.py diff-hash --repo . --base <baseCommit> --change-dir ".harness/changes/<change-name>" --json` 计算 diffHash + post-test 7 类分类(禁止手写 ledger / 手工 phase.end)
77
- 1. **合并最新代码** — 主目录:`stash` `pull --rebase` `stash pop`;**worktree:N/A**(远端同步在合并段主分支完成)
77
+ 1. **合并最新代码** — 主目录与 worktree 均**不在业务工作区 stash/pull**;远端同步由合并段 integration transaction 在隔离 integration worktree 内完成(见「worktree 合并流程」);**正常路径禁止 `git stash` / `stash pop`**
78
78
  2. **最终验证** — ledger 复用优先;**提交前最终门禁只调 `can-reuse`**(删除与 coverage 冲突的二次全量门禁):`harness_ledger.py can-reuse --verification unitTestFull --scope module --project . --profile-input unitTestFull --command <resolved commands.unitTestFull.command>`。`--command` **按 profile key resolve**:读 `build-profile.json` 的 `commands.unitTestFull.command`(v2),或 `harness_profile.py resolve --project . --key unitTestFull --json` 取 resolved command,**不复制示例模块名**(文档示例只展示 key)。`--profile-input unitTestFull` 从 `verificationInputs.unitTestFull`(v2 由 `commands.unitTestFull.inputs` 派生)展开依赖闭包,**禁止用仅含 staged 文件的 `--files` 快捷方式**冒充全量闭包。`reuse=true` → 不再执行二次全量测试;仅 `reuse=false` 时执行**同一 resolved verification**(profile `unitTestFull` 命令),成功后用同一文件集、command、`scope=module` 经 **`harness_ledger.py record`** 写回 ledger `unitTestFull` 项。增量 `unitTest` 永远不能冒充 `unitTestFull` 门禁。
79
79
  3. **.gitignore + 精确暂存** ⚠️ — 检查 `.harness/` 在 `.gitignore`;**禁止 `git add -A`**。若存在 `evidence/test-tracking.json`,先执行 `python <skills-root>/scripts/harness_test_guard.py stage --project . --change-dir ".harness/changes/<change-name>" --json`;失败即硬停止。无 manifest 时不使用 `-f`。manifest 之外的文件按精确业务路径正常暂存,**禁止全局 force-add**。
80
80
  4. **提交方式** — 主目录:AskUserQuestion 三选项(commit+push / 仅本地 / 取消);**worktree:固定仅本地 commit**
@@ -86,15 +86,20 @@ worktree 合并前必须运行 `harness_change.py integration-lock acquire --run
86
86
 
87
87
  ### worktree 合并流程(requested=true,commit 后自动执行)
88
88
 
89
+ 合并由 `harness_integration.py` transaction 执行:隔离 integration worktree + journal + 保护 ref + 精确清理。skill 只负责确认提交信息、调用子命令、展示结构化结果;**禁止手工 `checkout --ours/--theirs`**。
90
+
89
91
  M0. append `phase.start`(phase=merge,若从 `/harness-merge` 重入则 note 标注重入)
90
- M1. **切回主目录主分支** — `symbolic-ref origin/HEAD` 读主分支名;必要时 stash;确认 checkout 主分支
91
- M2. **fetch + pull --rebase** 记录是否引入他人提交(决定 M4 是否重跑验证)
92
- M3. **`git merge --no-ff worktree/<change-name>`** 合并消息可让用户改文案,**方式固定 --no-ff**
93
- M4. **冲突处理** `CONFLICT` **停下**,列出冲突文件,提示用户手动解决后重跑;**禁止 `checkout --theirs/--ours`**;状态 🟡WARN,不得宣称合并成功
94
- M5. **合并后验证**他人提交引入必须重跑构建+测试;否则 ledger 复用 🔁REUSED
95
- M6. **push 主分支** fetch `log HEAD..@{u}` 非空则回 M2;否则 push,记录 `mergeFinalHash`
96
- M7. **清理 worktree** — `worktree remove` + `branch -D`(Windows 兜底见 `reference.md`);更新 `worktree.json`(`created=false` + removedAt 等)
97
- M8. **ledger + 收尾** — 经 `harness_ledger.py record` 写入 `mergeFinalHash`;**`harness_gate.py close --phase merge`**(禁止手工 phase.end);提示 `/harness-archive`
92
+ M1. **preflight** — `harness_integration.py preflight --change <id> --run-id <run> --feature-branch worktree/<id> --target-branch <主分支> --temp-root <task temp>`;获取 integration lock、写 journal 与保护 ref;锁被持有即停止
93
+ M2. **prepare** — fetch 后从已提交 target 创建临时 integration worktree;primary dirty 状态不被触碰
94
+ M3. **merge** — `--no-ff` 合并 feature 分支;merge diff 出现其他 Change 的 contract/runtime 路径 → 结构化拒绝;冲突 → step FAILED,**停下**列出冲突文件,人工解决后以 `recover` 续跑(已完成步骤返回 REUSED,不重复 merge/push)
95
+ M4. **verify** integration worktree 内执行组合态验证;他人提交引入或 ledger 不可复用时必跑
96
+ M5. **push**仅在验证身份与远端基线仍匹配时 push;远端漂移 `TARGET_MOVED` 结构化失败,不继续
97
+ M6. **cleanup**`git worktree remove --force` 精确路径 + 临时分支 + (push 成功后)保护 ref;释放 integration lock;失败保留 journal 与诊断证据;更新 `worktree.json`(`created=false` + removedAt)
98
+ M7. **ledger + 收尾** `harness_ledger.py record` 写入 `mergeFinalHash`(= journal `pushedHead`);**`harness_gate.py close --phase merge`**(禁止手工 phase.end);提示 `/harness-archive`
99
+
100
+ > Ledger v3(v2 契约 / split-v1 布局起):`record` 强制顶层身份(`schemaVersion=3/repositoryId/baseCommit/currentHead/diffHash/ownershipHash`,缺失非零退出、不写账本)与 typed metrics;legacy 契约行为不变。详见 `../protocols/ledger-protocol.md` 第十节。
101
+
102
+ 正常路径**禁止创建、应用或删除仓库级 stash**。中断恢复:`harness_integration.py status` 读 journal,`recover` 从首个未完成步骤续跑;protection refs 只在 push 成功后的 cleanup 删除。
98
103
 
99
104
  ## P0 执行可信度规则
100
105