@hunter-harness/workflow-harness 0.4.0 → 0.4.2

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 (386) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
  3. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  4. package/harness/bundles/general/claude-code/harness-execute/SKILL.md +1 -1
  5. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  6. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  7. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +1 -1
  8. package/harness/bundles/general/claude-code/harness-pull/SKILL.md +1 -1
  9. package/harness/bundles/general/claude-code/harness-push/SKILL.md +1 -1
  10. package/harness/bundles/general/claude-code/harness-review/SKILL.md +1 -1
  11. package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
  12. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +1 -1
  13. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
  14. package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
  15. package/harness/bundles/general/claude-code/scripts/harness_archive.py +29 -6
  16. package/harness/bundles/general/claude-code/scripts/harness_deploy.py +1 -1
  17. package/harness/bundles/general/claude-code/scripts/harness_knowledge_candidates.py +398 -0
  18. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  19. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
  20. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  21. package/harness/bundles/general/codebuddy/harness-execute/SKILL.md +1 -1
  22. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  23. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  24. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +1 -1
  25. package/harness/bundles/general/codebuddy/harness-pull/SKILL.md +1 -1
  26. package/harness/bundles/general/codebuddy/harness-push/SKILL.md +1 -1
  27. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +1 -1
  28. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
  29. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +1 -1
  30. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
  31. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
  32. package/harness/bundles/general/codebuddy/scripts/harness_archive.py +29 -6
  33. package/harness/bundles/general/codebuddy/scripts/harness_deploy.py +1 -1
  34. package/harness/bundles/general/codebuddy/scripts/harness_knowledge_candidates.py +398 -0
  35. package/harness/bundles/general/codex/.harness-build.json +1 -1
  36. package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
  37. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  38. package/harness/bundles/general/codex/harness-execute/SKILL.md +1 -1
  39. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
  40. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  41. package/harness/bundles/general/codex/harness-plan/SKILL.md +1 -1
  42. package/harness/bundles/general/codex/harness-pull/SKILL.md +1 -1
  43. package/harness/bundles/general/codex/harness-push/SKILL.md +1 -1
  44. package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
  45. package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
  46. package/harness/bundles/general/codex/harness-submit/SKILL.md +1 -1
  47. package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
  48. package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
  49. package/harness/bundles/general/codex/scripts/harness_archive.py +29 -6
  50. package/harness/bundles/general/codex/scripts/harness_deploy.py +1 -1
  51. package/harness/bundles/general/codex/scripts/harness_knowledge_candidates.py +398 -0
  52. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  53. package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
  54. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  55. package/harness/bundles/general/cursor/harness-execute/SKILL.md +1 -1
  56. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  57. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  58. package/harness/bundles/general/cursor/harness-plan/SKILL.md +1 -1
  59. package/harness/bundles/general/cursor/harness-pull/SKILL.md +1 -1
  60. package/harness/bundles/general/cursor/harness-push/SKILL.md +1 -1
  61. package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
  62. package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
  63. package/harness/bundles/general/cursor/harness-submit/SKILL.md +1 -1
  64. package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
  65. package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
  66. package/harness/bundles/general/cursor/scripts/harness_archive.py +29 -6
  67. package/harness/bundles/general/cursor/scripts/harness_deploy.py +1 -1
  68. package/harness/bundles/general/cursor/scripts/harness_knowledge_candidates.py +398 -0
  69. package/harness/bundles/general/pi/.harness-build.json +6 -0
  70. package/harness/bundles/general/pi/CONTEXT.md +98 -0
  71. package/harness/bundles/general/pi/README.md +478 -0
  72. package/harness/bundles/general/pi/contracts/build-profile-v3.schema.json +302 -0
  73. package/harness/bundles/general/pi/contracts/ci-metrics.schema.json +36 -0
  74. package/harness/bundles/general/pi/contracts/doctor-capability.schema.json +43 -0
  75. package/harness/bundles/general/pi/contracts/external-platform-observation.schema.json +62 -0
  76. package/harness/bundles/general/pi/contracts/fixtures/managed-execution.json +341 -0
  77. package/harness/bundles/general/pi/contracts/process-identity.schema.json +132 -0
  78. package/harness/bundles/general/pi/contracts/run-session.schema.json +142 -0
  79. package/harness/bundles/general/pi/contracts/service-retirement-receipt.schema.json +85 -0
  80. package/harness/bundles/general/pi/contracts/service-session.schema.json +147 -0
  81. package/harness/bundles/general/pi/contracts/workflow-policy.json +574 -0
  82. package/harness/bundles/general/pi/harness-archive/SKILL.md +322 -0
  83. package/harness/bundles/general/pi/harness-archive/checklist.md +71 -0
  84. package/harness/bundles/general/pi/harness-archive/reference.md +150 -0
  85. package/harness/bundles/general/pi/harness-archive/scripts/gen-manifest.ps1 +31 -0
  86. package/harness/bundles/general/pi/harness-archive/templates/summary-data-template.json +218 -0
  87. package/harness/bundles/general/pi/harness-codebase-map/SKILL.md +116 -0
  88. package/harness/bundles/general/pi/harness-codebase-map/checklist.md +126 -0
  89. package/harness/bundles/general/pi/harness-codebase-map/reference.md +364 -0
  90. package/harness/bundles/general/pi/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  91. package/harness/bundles/general/pi/harness-codebase-map/templates/CONCERNS.md +49 -0
  92. package/harness/bundles/general/pi/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  93. package/harness/bundles/general/pi/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  94. package/harness/bundles/general/pi/harness-codebase-map/templates/STACK.md +55 -0
  95. package/harness/bundles/general/pi/harness-codebase-map/templates/STRUCTURE.md +69 -0
  96. package/harness/bundles/general/pi/harness-codebase-map/templates/TESTING.md +64 -0
  97. package/harness/bundles/general/pi/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  98. package/harness/bundles/general/pi/harness-codebase-map/templates/map-summary.md +64 -0
  99. package/harness/bundles/general/pi/harness-execute/SKILL.md +170 -0
  100. package/harness/bundles/general/pi/harness-knowledge-ingest/SKILL.md +103 -0
  101. package/harness/bundles/general/pi/harness-knowledge-query/SKILL.md +97 -0
  102. package/harness/bundles/general/pi/harness-plan/SKILL.md +157 -0
  103. package/harness/bundles/general/pi/harness-plan/checklist.md +243 -0
  104. package/harness/bundles/general/pi/harness-plan/protocols.md +133 -0
  105. package/harness/bundles/general/pi/harness-plan/reference.md +468 -0
  106. package/harness/bundles/general/pi/harness-pull/SKILL.md +55 -0
  107. package/harness/bundles/general/pi/harness-push/SKILL.md +83 -0
  108. package/harness/bundles/general/pi/harness-review/SKILL.md +166 -0
  109. package/harness/bundles/general/pi/harness-review/checklist.md +124 -0
  110. package/harness/bundles/general/pi/harness-review/protocols.md +69 -0
  111. package/harness/bundles/general/pi/harness-review/reference.md +114 -0
  112. package/harness/bundles/general/pi/harness-run/SKILL.md +188 -0
  113. package/harness/bundles/general/pi/harness-run/checklist.md +279 -0
  114. package/harness/bundles/general/pi/harness-run/protocols.md +141 -0
  115. package/harness/bundles/general/pi/harness-run/reference.md +886 -0
  116. package/harness/bundles/general/pi/harness-submit/SKILL.md +182 -0
  117. package/harness/bundles/general/pi/harness-submit/checklist.md +452 -0
  118. package/harness/bundles/general/pi/harness-submit/reference.md +152 -0
  119. package/harness/bundles/general/pi/harness-sync/SKILL.md +72 -0
  120. package/harness/bundles/general/pi/harness-sync/reference.md +176 -0
  121. package/harness/bundles/general/pi/harness-test/SKILL.md +250 -0
  122. package/harness/bundles/general/pi/harness-test/checklist.md +359 -0
  123. package/harness/bundles/general/pi/harness-test/pitfalls-java.md +14 -0
  124. package/harness/bundles/general/pi/harness-test/pitfalls.md +307 -0
  125. package/harness/bundles/general/pi/harness-test/reference.md +880 -0
  126. package/harness/bundles/general/pi/harness-test/scripts/runtime-helpers.mjs +216 -0
  127. package/harness/bundles/general/pi/protocols/archive-report-protocol.md +196 -0
  128. package/harness/bundles/general/pi/protocols/ci-layering-protocol.md +22 -0
  129. package/harness/bundles/general/pi/protocols/evidence-based-reporting-protocol.md +134 -0
  130. package/harness/bundles/general/pi/protocols/execution-session-protocol.md +52 -0
  131. package/harness/bundles/general/pi/protocols/external-platform-protocol.md +27 -0
  132. package/harness/bundles/general/pi/protocols/ledger-protocol.md +365 -0
  133. package/harness/bundles/general/pi/protocols/memory-closeout-protocol.md +21 -0
  134. package/harness/bundles/general/pi/protocols/model-routing-protocol.md +22 -0
  135. package/harness/bundles/general/pi/protocols/powershell-protocol.md +238 -0
  136. package/harness/bundles/general/pi/protocols/registry-governance-protocol.md +31 -0
  137. package/harness/bundles/general/pi/protocols/report-pipeline-protocol.md +172 -0
  138. package/harness/bundles/general/pi/protocols/sensitive-info-protocol.md +110 -0
  139. package/harness/bundles/general/pi/protocols/state-layout-protocol.md +209 -0
  140. package/harness/bundles/general/pi/protocols/submit-protocol.md +78 -0
  141. package/harness/bundles/general/pi/protocols/verification-graph-protocol.md +32 -0
  142. package/harness/bundles/general/pi/scripts/harness_adoption_metrics.py +391 -0
  143. package/harness/bundles/general/pi/scripts/harness_apidoc.py +53 -0
  144. package/harness/bundles/general/pi/scripts/harness_archive.py +11345 -0
  145. package/harness/bundles/general/pi/scripts/harness_change.py +1626 -0
  146. package/harness/bundles/general/pi/scripts/harness_check_gate.py +113 -0
  147. package/harness/bundles/general/pi/scripts/harness_context.py +1774 -0
  148. package/harness/bundles/general/pi/scripts/harness_deploy.py +968 -0
  149. package/harness/bundles/general/pi/scripts/harness_efficiency.py +443 -0
  150. package/harness/bundles/general/pi/scripts/harness_environment.py +1690 -0
  151. package/harness/bundles/general/pi/scripts/harness_events.py +2234 -0
  152. package/harness/bundles/general/pi/scripts/harness_events_sync.py +1425 -0
  153. package/harness/bundles/general/pi/scripts/harness_execution_contracts.py +596 -0
  154. package/harness/bundles/general/pi/scripts/harness_fixback.py +1975 -0
  155. package/harness/bundles/general/pi/scripts/harness_gate.py +3816 -0
  156. package/harness/bundles/general/pi/scripts/harness_headless.py +37 -0
  157. package/harness/bundles/general/pi/scripts/harness_integration.py +2564 -0
  158. package/harness/bundles/general/pi/scripts/harness_knowledge_candidates.py +796 -0
  159. package/harness/bundles/general/pi/scripts/harness_ledger.py +3556 -0
  160. package/harness/bundles/general/pi/scripts/harness_migration_head.py +220 -0
  161. package/harness/bundles/general/pi/scripts/harness_orchestration.py +344 -0
  162. package/harness/bundles/general/pi/scripts/harness_paths.py +676 -0
  163. package/harness/bundles/general/pi/scripts/harness_phase.py +1726 -0
  164. package/harness/bundles/general/pi/scripts/harness_plan_aggregate.py +249 -0
  165. package/harness/bundles/general/pi/scripts/harness_plan_finalize.py +1016 -0
  166. package/harness/bundles/general/pi/scripts/harness_preflight.py +650 -0
  167. package/harness/bundles/general/pi/scripts/harness_process.py +1065 -0
  168. package/harness/bundles/general/pi/scripts/harness_profile.py +1817 -0
  169. package/harness/bundles/general/pi/scripts/harness_report_model.py +442 -0
  170. package/harness/bundles/general/pi/scripts/harness_retry.py +175 -0
  171. package/harness/bundles/general/pi/scripts/harness_review.py +631 -0
  172. package/harness/bundles/general/pi/scripts/harness_runtime.py +2243 -0
  173. package/harness/bundles/general/pi/scripts/harness_service.py +3355 -0
  174. package/harness/bundles/general/pi/scripts/harness_state.py +365 -0
  175. package/harness/bundles/general/pi/scripts/harness_sync.py +407 -0
  176. package/harness/bundles/general/pi/scripts/harness_test_cleanup.py +175 -0
  177. package/harness/bundles/general/pi/scripts/harness_test_guard.py +1899 -0
  178. package/harness/bundles/general/pi/scripts/harness_test_runner.py +1586 -0
  179. package/harness/bundles/general/pi/scripts/harness_verification.py +593 -0
  180. package/harness/bundles/general/pi/scripts/harness_workflow_policy.py +266 -0
  181. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  182. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  183. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
  184. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  185. package/harness/bundles/java/claude-code/harness-execute/SKILL.md +1 -1
  186. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  187. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  188. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  189. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
  190. package/harness/bundles/java/claude-code/harness-pull/SKILL.md +1 -1
  191. package/harness/bundles/java/claude-code/harness-push/SKILL.md +1 -1
  192. package/harness/bundles/java/claude-code/harness-review/SKILL.md +1 -1
  193. package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
  194. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +1 -1
  195. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
  196. package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
  197. package/harness/bundles/java/claude-code/scripts/harness_archive.py +29 -6
  198. package/harness/bundles/java/claude-code/scripts/harness_deploy.py +1 -1
  199. package/harness/bundles/java/claude-code/scripts/harness_knowledge_candidates.py +398 -0
  200. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  201. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  202. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
  203. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  204. package/harness/bundles/java/codebuddy/harness-execute/SKILL.md +1 -1
  205. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  206. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  207. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  208. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
  209. package/harness/bundles/java/codebuddy/harness-pull/SKILL.md +1 -1
  210. package/harness/bundles/java/codebuddy/harness-push/SKILL.md +1 -1
  211. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +1 -1
  212. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
  213. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +1 -1
  214. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
  215. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
  216. package/harness/bundles/java/codebuddy/scripts/harness_archive.py +29 -6
  217. package/harness/bundles/java/codebuddy/scripts/harness_deploy.py +1 -1
  218. package/harness/bundles/java/codebuddy/scripts/harness_knowledge_candidates.py +398 -0
  219. package/harness/bundles/java/codex/.harness-build.json +1 -1
  220. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  221. package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
  222. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  223. package/harness/bundles/java/codex/harness-execute/SKILL.md +1 -1
  224. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
  225. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  226. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  227. package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
  228. package/harness/bundles/java/codex/harness-pull/SKILL.md +1 -1
  229. package/harness/bundles/java/codex/harness-push/SKILL.md +1 -1
  230. package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
  231. package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
  232. package/harness/bundles/java/codex/harness-submit/SKILL.md +1 -1
  233. package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
  234. package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
  235. package/harness/bundles/java/codex/scripts/harness_archive.py +29 -6
  236. package/harness/bundles/java/codex/scripts/harness_deploy.py +1 -1
  237. package/harness/bundles/java/codex/scripts/harness_knowledge_candidates.py +398 -0
  238. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  239. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  240. package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
  241. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  242. package/harness/bundles/java/cursor/harness-execute/SKILL.md +1 -1
  243. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  244. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  245. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  246. package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
  247. package/harness/bundles/java/cursor/harness-pull/SKILL.md +1 -1
  248. package/harness/bundles/java/cursor/harness-push/SKILL.md +1 -1
  249. package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
  250. package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
  251. package/harness/bundles/java/cursor/harness-submit/SKILL.md +1 -1
  252. package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
  253. package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
  254. package/harness/bundles/java/cursor/scripts/harness_archive.py +29 -6
  255. package/harness/bundles/java/cursor/scripts/harness_deploy.py +1 -1
  256. package/harness/bundles/java/cursor/scripts/harness_knowledge_candidates.py +398 -0
  257. package/harness/bundles/java/pi/.harness-build.json +6 -0
  258. package/harness/bundles/java/pi/CONTEXT.md +98 -0
  259. package/harness/bundles/java/pi/README.md +478 -0
  260. package/harness/bundles/java/pi/contracts/build-profile-v3.schema.json +302 -0
  261. package/harness/bundles/java/pi/contracts/ci-metrics.schema.json +36 -0
  262. package/harness/bundles/java/pi/contracts/doctor-capability.schema.json +43 -0
  263. package/harness/bundles/java/pi/contracts/external-platform-observation.schema.json +62 -0
  264. package/harness/bundles/java/pi/contracts/fixtures/managed-execution.json +341 -0
  265. package/harness/bundles/java/pi/contracts/process-identity.schema.json +132 -0
  266. package/harness/bundles/java/pi/contracts/run-session.schema.json +142 -0
  267. package/harness/bundles/java/pi/contracts/service-retirement-receipt.schema.json +85 -0
  268. package/harness/bundles/java/pi/contracts/service-session.schema.json +147 -0
  269. package/harness/bundles/java/pi/contracts/workflow-policy.json +574 -0
  270. package/harness/bundles/java/pi/harness-apidoc/SKILL.md +97 -0
  271. package/harness/bundles/java/pi/harness-apidoc/checklist.md +142 -0
  272. package/harness/bundles/java/pi/harness-apidoc/reference.md +233 -0
  273. package/harness/bundles/java/pi/harness-archive/SKILL.md +322 -0
  274. package/harness/bundles/java/pi/harness-archive/checklist.md +71 -0
  275. package/harness/bundles/java/pi/harness-archive/reference.md +150 -0
  276. package/harness/bundles/java/pi/harness-archive/scripts/gen-manifest.ps1 +31 -0
  277. package/harness/bundles/java/pi/harness-archive/templates/summary-data-template.json +218 -0
  278. package/harness/bundles/java/pi/harness-codebase-map/SKILL.md +116 -0
  279. package/harness/bundles/java/pi/harness-codebase-map/checklist.md +126 -0
  280. package/harness/bundles/java/pi/harness-codebase-map/reference.md +364 -0
  281. package/harness/bundles/java/pi/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  282. package/harness/bundles/java/pi/harness-codebase-map/templates/CONCERNS.md +49 -0
  283. package/harness/bundles/java/pi/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  284. package/harness/bundles/java/pi/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  285. package/harness/bundles/java/pi/harness-codebase-map/templates/STACK.md +55 -0
  286. package/harness/bundles/java/pi/harness-codebase-map/templates/STRUCTURE.md +69 -0
  287. package/harness/bundles/java/pi/harness-codebase-map/templates/TESTING.md +64 -0
  288. package/harness/bundles/java/pi/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  289. package/harness/bundles/java/pi/harness-codebase-map/templates/map-summary.md +64 -0
  290. package/harness/bundles/java/pi/harness-execute/SKILL.md +170 -0
  291. package/harness/bundles/java/pi/harness-knowledge-ingest/SKILL.md +103 -0
  292. package/harness/bundles/java/pi/harness-knowledge-query/SKILL.md +97 -0
  293. package/harness/bundles/java/pi/harness-package/SKILL.md +94 -0
  294. package/harness/bundles/java/pi/harness-package/checklist.md +322 -0
  295. package/harness/bundles/java/pi/harness-package/reference.md +210 -0
  296. package/harness/bundles/java/pi/harness-plan/SKILL.md +157 -0
  297. package/harness/bundles/java/pi/harness-plan/checklist.md +243 -0
  298. package/harness/bundles/java/pi/harness-plan/protocols.md +133 -0
  299. package/harness/bundles/java/pi/harness-plan/reference.md +468 -0
  300. package/harness/bundles/java/pi/harness-pull/SKILL.md +55 -0
  301. package/harness/bundles/java/pi/harness-push/SKILL.md +83 -0
  302. package/harness/bundles/java/pi/harness-review/SKILL.md +166 -0
  303. package/harness/bundles/java/pi/harness-review/checklist.md +124 -0
  304. package/harness/bundles/java/pi/harness-review/protocols.md +69 -0
  305. package/harness/bundles/java/pi/harness-review/reference.md +114 -0
  306. package/harness/bundles/java/pi/harness-run/SKILL.md +206 -0
  307. package/harness/bundles/java/pi/harness-run/checklist.md +252 -0
  308. package/harness/bundles/java/pi/harness-run/protocols.md +141 -0
  309. package/harness/bundles/java/pi/harness-run/reference.md +820 -0
  310. package/harness/bundles/java/pi/harness-submit/SKILL.md +189 -0
  311. package/harness/bundles/java/pi/harness-submit/checklist.md +452 -0
  312. package/harness/bundles/java/pi/harness-submit/reference.md +152 -0
  313. package/harness/bundles/java/pi/harness-sync/SKILL.md +72 -0
  314. package/harness/bundles/java/pi/harness-sync/reference.md +176 -0
  315. package/harness/bundles/java/pi/harness-test/SKILL.md +264 -0
  316. package/harness/bundles/java/pi/harness-test/checklist.md +320 -0
  317. package/harness/bundles/java/pi/harness-test/pitfalls-java.md +16 -0
  318. package/harness/bundles/java/pi/harness-test/pitfalls.md +307 -0
  319. package/harness/bundles/java/pi/harness-test/reference.md +792 -0
  320. package/harness/bundles/java/pi/harness-test/scripts/runtime-helpers.mjs +216 -0
  321. package/harness/bundles/java/pi/protocols/archive-report-protocol.md +196 -0
  322. package/harness/bundles/java/pi/protocols/ci-layering-protocol.md +22 -0
  323. package/harness/bundles/java/pi/protocols/evidence-based-reporting-protocol.md +134 -0
  324. package/harness/bundles/java/pi/protocols/execution-session-protocol.md +52 -0
  325. package/harness/bundles/java/pi/protocols/external-platform-protocol.md +27 -0
  326. package/harness/bundles/java/pi/protocols/ledger-protocol.md +365 -0
  327. package/harness/bundles/java/pi/protocols/memory-closeout-protocol.md +21 -0
  328. package/harness/bundles/java/pi/protocols/model-routing-protocol.md +22 -0
  329. package/harness/bundles/java/pi/protocols/powershell-protocol.md +238 -0
  330. package/harness/bundles/java/pi/protocols/registry-governance-protocol.md +31 -0
  331. package/harness/bundles/java/pi/protocols/report-pipeline-protocol.md +172 -0
  332. package/harness/bundles/java/pi/protocols/sensitive-info-protocol.md +110 -0
  333. package/harness/bundles/java/pi/protocols/state-layout-protocol.md +209 -0
  334. package/harness/bundles/java/pi/protocols/submit-protocol.md +78 -0
  335. package/harness/bundles/java/pi/protocols/verification-graph-protocol.md +32 -0
  336. package/harness/bundles/java/pi/scripts/harness_adoption_metrics.py +391 -0
  337. package/harness/bundles/java/pi/scripts/harness_apidoc.py +53 -0
  338. package/harness/bundles/java/pi/scripts/harness_archive.py +11345 -0
  339. package/harness/bundles/java/pi/scripts/harness_change.py +1626 -0
  340. package/harness/bundles/java/pi/scripts/harness_check_gate.py +113 -0
  341. package/harness/bundles/java/pi/scripts/harness_context.py +1774 -0
  342. package/harness/bundles/java/pi/scripts/harness_deploy.py +968 -0
  343. package/harness/bundles/java/pi/scripts/harness_efficiency.py +443 -0
  344. package/harness/bundles/java/pi/scripts/harness_environment.py +1690 -0
  345. package/harness/bundles/java/pi/scripts/harness_events.py +2234 -0
  346. package/harness/bundles/java/pi/scripts/harness_events_sync.py +1425 -0
  347. package/harness/bundles/java/pi/scripts/harness_execution_contracts.py +596 -0
  348. package/harness/bundles/java/pi/scripts/harness_fixback.py +1975 -0
  349. package/harness/bundles/java/pi/scripts/harness_gate.py +3816 -0
  350. package/harness/bundles/java/pi/scripts/harness_headless.py +37 -0
  351. package/harness/bundles/java/pi/scripts/harness_integration.py +2564 -0
  352. package/harness/bundles/java/pi/scripts/harness_knowledge_candidates.py +796 -0
  353. package/harness/bundles/java/pi/scripts/harness_ledger.py +3556 -0
  354. package/harness/bundles/java/pi/scripts/harness_migration_head.py +220 -0
  355. package/harness/bundles/java/pi/scripts/harness_orchestration.py +344 -0
  356. package/harness/bundles/java/pi/scripts/harness_paths.py +676 -0
  357. package/harness/bundles/java/pi/scripts/harness_phase.py +1726 -0
  358. package/harness/bundles/java/pi/scripts/harness_plan_aggregate.py +249 -0
  359. package/harness/bundles/java/pi/scripts/harness_plan_finalize.py +1016 -0
  360. package/harness/bundles/java/pi/scripts/harness_preflight.py +650 -0
  361. package/harness/bundles/java/pi/scripts/harness_process.py +1065 -0
  362. package/harness/bundles/java/pi/scripts/harness_profile.py +1817 -0
  363. package/harness/bundles/java/pi/scripts/harness_report_model.py +442 -0
  364. package/harness/bundles/java/pi/scripts/harness_retry.py +175 -0
  365. package/harness/bundles/java/pi/scripts/harness_review.py +631 -0
  366. package/harness/bundles/java/pi/scripts/harness_runtime.py +2243 -0
  367. package/harness/bundles/java/pi/scripts/harness_service.py +3355 -0
  368. package/harness/bundles/java/pi/scripts/harness_state.py +365 -0
  369. package/harness/bundles/java/pi/scripts/harness_sync.py +407 -0
  370. package/harness/bundles/java/pi/scripts/harness_test_cleanup.py +175 -0
  371. package/harness/bundles/java/pi/scripts/harness_test_guard.py +1899 -0
  372. package/harness/bundles/java/pi/scripts/harness_test_runner.py +1586 -0
  373. package/harness/bundles/java/pi/scripts/harness_verification.py +593 -0
  374. package/harness/bundles/java/pi/scripts/harness_workflow_policy.py +266 -0
  375. package/harness/manifests/general/claude-code.json +17 -17
  376. package/harness/manifests/general/codebuddy.json +17 -17
  377. package/harness/manifests/general/codex.json +17 -17
  378. package/harness/manifests/general/cursor.json +17 -17
  379. package/harness/manifests/general/pi.json +475 -0
  380. package/harness/manifests/java/claude-code.json +19 -19
  381. package/harness/manifests/java/codebuddy.json +19 -19
  382. package/harness/manifests/java/codex.json +19 -19
  383. package/harness/manifests/java/cursor.json +19 -19
  384. package/harness/manifests/java/pi.json +499 -0
  385. package/hunter-workflow-family.json +2 -2
  386. package/package.json +1 -1
@@ -0,0 +1,322 @@
1
+ ---
2
+ name: harness-archive
3
+ description: 归档所有变更产出(计划/测试报告/审查/SQL/API文档)到 .harness/archive/,含归档元数据。仅当用户显式调用
4
+ /harness-archive 时使用;不得被其他阶段 skill 自动接续触发。
5
+ ---
6
+ <!-- generated by harness_deploy.py; core=3719b9e9d98df0f9; overlay=none; agent=pi; do not edit -->
7
+ # harness-archive — 变更归档
8
+
9
+ ## Purpose
10
+
11
+ 把变更事实安全封存、生成确定性 ZIP,并在已连接 Hunter Platform 时上传保存。归档结局、发布资格、Git 远端和平台上传分别建模,互不冒充前置条件。
12
+
13
+ ## When to Use
14
+
15
+ 仅当用户显式调用 `/harness-archive` 时执行。submit/merge 完成后**不自动**进入本阶段;用户口头说"归档/收尾"而未调用本 skill 时,先确认。
16
+
17
+ 前置只看本次 `plannedPhases` 与用户选择的生命周期结局。Submit、Test 或 Review 未在计划中时记录为“未执行”,不得临时补跑;无 Git、无 upstream、仅本地 commit 都允许归档和平台上传,只是不能声明为发布候选。
18
+
19
+ 自动调用边界:
20
+
21
+ - 归档涉及移动/删除原变更目录,**禁止被其他 skill 自动调用**;只接受用户显式 `/harness-archive` 调用。
22
+ - `harness_archive.py auto-gate` 只影响**本次显式调用内**是否需要归档确认对话:实际计划中的最后阶段已终态、archive-boundary/content snapshot 存在且保存门禁满足时可跳过确认。auto-gate 不构成跨阶段自动触发的授权。
23
+
24
+ ## 前置条件
25
+
26
+ - **最终产品身份**:Git 项目优先使用 Submit 最终收据/当前 HEAD;提交前验证而内容未变化时由 `certify-local` 自动重绑定 commit。非 Git 项目使用确定性内容清单与产品树散列,并记录 `sourceControl=none`。
27
+ - **正常完成**按 `plannedPhases` 检查已规划阶段;被省略阶段记录 `NOT_RUN` / `NOT_APPLICABLE`。**结束未完成变更**只要求足以识别和安全封存变更的最小设计、事件与内容清单,不要求补齐测试、评审或提交。
28
+ - 所有 events、ledger、reports、receipts 和 upload state 都通过 state layout 解析器读取;split-v1 的权威状态位于 `.harness/state/changes/<change>`,禁止复制到旧目录。
29
+ - **产品候选验证**:
30
+ - 有远端 CI:保留 `product-candidate-ci.json` 兼容证据;归档会把有效的 legacy schema v1 证据迁移为 `remote-claimed` 的 schema v2 `product-candidate-verification.json`,不会冒充 `remote-attested`。
31
+ - `remote-attested` 必须同时带远端运行 URL 与 `verification.attestationDigest`;只有 URL、旧 JSON 哈希或 ledger 哈希只能达到 `remote-claimed`。
32
+ - 无 CI:`execute` 在候选收据缺失时自动尝试本地认证,只复用身份一致且完整的 `unitTestFull` ledger 证据,并在产品内容未变化时把提交前验证安全重绑定到当前 HEAD;认证不会执行测试。只有需要单独诊断认证结果时才手工运行 `certify-local`。
33
+ - `release-candidate` 要求候选验证通过;正常本地完成或结束未完成变更使用 `--intent record-only`,固定 `releaseEligible=false`,但仍生成 ZIP 并上传平台。
34
+
35
+ ## Inputs
36
+
37
+ - `$ARGUMENTS`:变更名(可选);必须由 `harness_change.py resolve` 解析 contract/state 双层目录,禁止按 mtime 或固定旧路径猜测。
38
+
39
+ ## 统一读取协议
40
+
41
+ 0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
42
+ 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
43
+ 2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
44
+ 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
45
+ 4. **design** — 设计真相源按序取第一个存在的:`plans/<change>-design.md`(v2 发布产物,哈希绑定)→ `spec/<change>-design.md`(legacy 手写)。两份**同时存在**时以 `plans/` 为准,并记 `🟡 WARN 设计文档双份`——v2 发布的那份才受完整性门禁保护,读手写的那份等于绕过校验
46
+ 5. **plan** — 任务真相源:`plans/<change>-plan.md`
47
+ 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
48
+ 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
49
+ 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
50
+ 9. **每个 skill 边界只刷新一次状态快照** — 先运行 `python <skills-root>/scripts/harness_state.py capture --project . --change-dir ".harness/changes/<change-name>" --json`。首次 Plan 捕获时,脚本把当时的 Git HEAD 写入不可变 `changeBase`;后续阶段只刷新 `git.head` 与各段指纹,不得用当前 HEAD 覆盖 `changeBase`。只有迁移旧 change 且已能证明真实计划起点时,才在首次补录时传 `--base <baseCommit>`。`changedSegments=[]` 时复用已有 profile/rules/map/change/code 指纹,不再重复跑全量 `harness-sync` 或代码库扫描。`knowledge` 段仅为兼容空段,知识始终按需远端查询;快照不能替代源码读取和验证门禁。
51
+
52
+ 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
53
+ > 片段:read-protocol
54
+
55
+ ## Workflow
56
+
57
+ 先用 `harness_change.py resolve [--change] --json` 解析 change;多个 active change 未显式选择时返回 `CHANGE_SELECTION_REQUIRED`,禁止按 Glob/mtime 自动选择。常规路径只运行一次 `harness_archive.py execute`。该命令一次性完成状态采集、自动门禁和 finalize,并复用同一份预检结果。调用者不得再串行运行 `auto-gate`、`status` 和 `finalize`,避免重复扫描、重复事件和幽灵 change 目录。
58
+
59
+ ### Phase 0:读取规则和上下文
60
+
61
+ 1. 读取本文件。
62
+ 2. 用 `harness_change.py resolve [--change] --json` 解析 `$ARGUMENTS`;多个 active change 时让用户选择。
63
+ 3. 按共享读取协议刷新一次状态快照。首次 Plan 已记录的 `changeBase` 必须保持不变,归档阶段不得把当前 HEAD 写回为基线。
64
+ 4. 常规路径不预读全部参考资料。仅在 `execute` 返回阻断或需要解释结果时,读取 `reference.md` 和对应协议章节。
65
+
66
+ ### Phase 1:确认归档对象(扫描未归档变更)
67
+
68
+ 使用 resolver 返回的 active changes 展示变更概要;同时读取 `plannedPhases`、已完成阶段和用户表达的生命周期结局。Git remote 与平台连接不是归档前置条件,不在这里额外探测。
69
+
70
+ - 发现多个未归档变更 → 让用户选择或终止
71
+
72
+ ### Phase 2:确定归档结局
73
+
74
+ 根据用户当前指令确定一次归档结局:
75
+
76
+ - 明确要求发布候选:`--intent release-candidate --closure completed`。
77
+ - 正常完成但不要求发布:`--intent record-only --closure completed`。
78
+ - 主动停止或被其他方案替代:`--intent record-only --closure abandoned|superseded --closure-reason "<中文原因>"`。
79
+
80
+ 信息已经明确时,不重复询问。信息不足且会改变结局时,才用中文提供「正常完成」「发布候选」「主动废弃」「被其他方案替代」「取消」。无 upstream 不阻止保存。
81
+
82
+ ### Phase 3:执行归档
83
+
84
+ 1. 不要为归档预先补跑测试或手工修 ledger。候选收据缺失时,`execute` 会先尝试复用身份一致的全量 ledger 完成本地认证;无法认证时保留结构化原因,`record-only` 仍按事实归档,`release-candidate` 则由发布门禁决定是否阻断。
85
+ 2. 运行一次 `harness_archive.py execute --change-dir "<executionRoot>" --archive-root ".harness/archive" --intent <...> --closure <...> [--closure-reason "..."] --json`。`execute` 只采集一次状态,并把准备耗时、正式归档耗时和唯一阶段轮次写入事件。调用者不得在它前后再运行 `auto-gate`、`status`、`finalize` 或手工追加 archive 阶段边界。
86
+ 3. `meta/archive-meta.md` 与 `reports/final/summary-data.json` 均由脚本生成。禁止手写、补字段或手工修改 ledger 以绕过门禁。
87
+ 4. `execute` 失败时,先按 `reasonCode` 处理,不要盲目重跑:
88
+ - `ARCHIVE_BASE_EQUALS_FEATURE_TIP`:正常完成不允许空范围归档。仅可选择受控认领既有提交范围、改为未完成封存,或取消。
89
+ - 受控认领既有范围:先展示 base、tip 和产品文件清单;获得用户明确确认后运行 `adopt-existing-range --base <base> --tip <tip> --reason "<中文原因>" --confirm-existing-range --json`,再重跑一次 `execute`。禁止直接编辑 snapshot 或 ledger。
90
+ - `abandoned` / `superseded`:允许没有产品增量,但必须保存中文原因,并固定 `releaseEligible=false`。
91
+ - 其他阻断:读取 `reference.md` 中对应错误的恢复说明;原变更目录必须保留。
92
+
93
+ **本地不执行知识 ingest**;服务端在 ZIP 持久保存并解包后 ingest。失败时保留原目录、ZIP 和回执。
94
+ - **归档包上传**:始终先生成一个确定性 ZIP;有远程凭据时再调用 `npx hunter-harness archive upload`。ZIP 仅包含 `summary-data.json`、`spec/**/*.md`、`plans/**/*.md`、`archive-meta.md`、`change-context.json` 和稳定 manifest;明确排除 logs、review/test 报告、HTML、缓存、备份、凭据和临时文件。
95
+ - **失败可恢复**:无论远端凭据是否齐全,都先生成 ZIP 与 `<change-key>.upload.json`;上传或服务端 ingest 失败不破坏本地归档。待上传 ZIP 与逐 change 回执保留在 `.harness/state/local/archive-packages/`,可枚举独立重试。只有 CLI 核验 package hash 且服务端同时返回 `archive_status=durable`、`knowledge_status=ready` 后,才清理对应 ZIP 与回执;`indexing` 记为 pending,不记为失败。
96
+ - **监控终态(C3)**:auto-upload 之后自动 `events-sync`,用归档前 change 路径派生的 `run_id` + 原 `change_key` 上报;失败只记 warning。
97
+
98
+ - **Read `reference.md`** — 仅在阻断恢复或需要解释输出字段时读取
99
+ - **Read `templates/summary-data-template.json`** — 仅在排查 summary 校验失败时读取
100
+
101
+ ### Phase 4:验证与提示
102
+
103
+ 以 `execute` 返回的 manifest、ZIP、上传回执和 `finalStatus` 为权威结果。只有返回字段缺失或不一致时,才读取 `checklist.md` 做人工诊断。不要为了重复确认成功结果再次扫描整个目录。
104
+
105
+ ## P0 执行可信度规则
106
+
107
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
108
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
109
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
110
+
111
+ ## 生成内容语言约定
112
+
113
+ - sync/ingest 等生成的文档、规则、知识条目、架构说明一律**优先使用中文**撰写(标识符、命令、代码、API 字段名保持原文)
114
+ - 面向平台展示的标题/摘要/正文默认中文;仅当用户明确要求或目标系统强制时才用英文
115
+ > 片段:p0-trust
116
+
117
+ ## 关键规则(硬门禁速查)
118
+
119
+ > 每条规则的详细判定、模板见 `reference.md` 对应章节;归档报告协议见 `../protocols/archive-report-protocol.md`,Shell 执行安全见 `../protocols/powershell-protocol.md`,敏感信息见 `../protocols/sensitive-info-protocol.md`,证据化报告见 `../protocols/evidence-based-reporting-protocol.md`,状态目录见 `../protocols/state-layout-protocol.md`。
120
+
121
+ ### 一、同一时间最多 1 个未归档变更
122
+
123
+ 扫描排除 `.harness/archive/`;多个未归档变更 → 让用户选择或终止,不批量归档。
124
+
125
+ ### 二、归档前确认或自动门禁
126
+
127
+ `execute` 内部运行自动门禁。实际计划最后阶段已终态、边界快照存在且 `status.archivable=true` 时直接执行;未满足时返回阻断且不移动原目录。用户取消后不得重跑。
128
+
129
+ ### 二·A、两个常见阻断的正规出路(不要自己拼 python -c)
130
+
131
+ | 阻断 | 出路 |
132
+ |------|------|
133
+ | `SENSITIVE_EVIDENCE_UNQUARANTINED`(默认只告警,`HUNTER_HARNESS_SENSITIVE_SCAN=block` 时才阻断) | `python <skills-root>/scripts/harness_runtime.py quarantine-evidence --project . --change-dir ".harness/changes/<cn>" --file "<相对 change-dir 的路径>" --reason "<为什么是敏感证据>" --json`(`--file` 可重复)。私有根默认已与项目同盘、且在项目根之外——**不要**手工指定项目内的路径,归档的密钥扫描会以 `SECRET_SCAN_PRIVATE_PATH_IN_COPY_ROOT` 拒绝 |
134
+ | `DIFF_ZERO_WITH_NONEMPTY_COMMIT`(提交范围非空但 filesChanged=0) | 契约缺 `ownership.productPaths`,全部改动被判为 `foreignPaths`。用 `python <skills-root>/scripts/harness_change.py declare-ownership --change <cn> --product-path "<目录前缀或精确文件>" --json` 按计划的实际改动范围声明(可重复;只收精确路径,不支持通配)。**不要**手改 `change-context.json` |
135
+
136
+ ### 二·A·1、发布内容预检与服务端 422
137
+
138
+ `status`(`execute` 的预检)会用**与服务端同源的规则**(`packages/core` 的
139
+ `scanSensitiveFiles`)扫描**真正会进 ZIP 的那批文件**——`reports/final/summary-data.json`、
140
+ `spec/**.md`、`plans/**.md`、`candidates/knowledge.json`、`meta/archive-meta.md`、
141
+ `meta/change-context.json`。`runtime/` 是过程草稿,从不入包,也不进这道扫描。
142
+
143
+ 结果在 `checks.publication_content_scan`:
144
+
145
+ - `blocked=false` → 上传不会因内容被拒
146
+ - `blocked=true` → **服务端会以 HTTP 422 `archive contains sensitive content` 拒收**。
147
+ 归档不阻断(服务端策略不归本地裁决),但必须在此时处理,别等跑完全流程才发现
148
+ - `reasonCode=PUBLICATION_CONTENT_SCAN_UNAVAILABLE` → CLI 不可用,预检没跑;归档继续,
149
+ 上传仍可能 422
150
+
151
+ 每条 finding 都带 `rule_id / path / line / column / overridable / recovery_action`。
152
+
153
+ **处置:**
154
+
155
+ | 命中类型 | 出路 |
156
+ |---|---|
157
+ | `overridable=true`(medium/low,如 `HH_INTERNAL_ADDRESS` 内网地址、`HH_WINDOWS_ABSOLUTE_PATH`) | 若确属设计固有内容,在源文件该行附近加行内标注:`<!-- hunter-harness-ignore: <RULE_ID> reason=<简短理由> -->`,然后 `republish` 重建重传 |
158
+ | `overridable=false`(high,如私钥、真实 token) | **不提供豁免。** 必须真正脱敏后重新打包 |
159
+
160
+ > ⚠️ 行内标注是**申报**,不是绕过:它把"这是设计决策"写进文档本身,可审计、可追溯。
161
+ > **不要**为了过扫描去删改设计文档的事实内容——那是篡改证据。
162
+ >
163
+ > ✅ 行内标注**服务端确认生效**:平台归档入口跑的是同一个 `scanSensitiveFiles`,
164
+ > 它直接从文件内容里解析 `hunter-harness-ignore`,命中转为 `overridden`、不再阻断。
165
+ > 上传端点只收裸 ZIP、没有独立申报通道,靠的就是这条写在文档里的标注。
166
+ >
167
+ > ⚠️ 一处已知的服务端滞后:**不带凭据的连接串**(如 `postgres://dbhost:5432/appdb`)
168
+ > 本地预检判 `low`/可豁免,而线上服务端目前仍判 `high`——high 不接受行内标注,
169
+ > 这类设计文档暂时无法上传。平台侧修复已提交(见 hunter-platform
170
+ > `fix(archive): 归档 422 给出可执行出路`),**部署后**两侧一致。在那之前遇到这一条:
171
+ > 等平台部署,不要为了过扫描删掉连接串。带凭据的连接串(`user:pass@host`)两侧都是
172
+ > `high`,必须真正脱敏。
173
+
174
+ ### 二·B、归档补传(上传失败或历史归档缺条目)
175
+
176
+ 归档上传成功后 ZIP 与回执会被清理,旧版本产生的归档从未入 outbox——所以
177
+ `harness-push --scope archive` 找不到可复用的包属于正常状态,不是故障。补传从已封存的
178
+ 归档目录重建确定性包:
179
+
180
+ ```powershell
181
+ python <skills-root>/scripts/harness_archive.py republish --change <change-key> --dry-run --json # 只看包内容
182
+ python <skills-root>/scripts/harness_archive.py republish --change <change-key> --json # 重建并上传
183
+ ```
184
+
185
+ 脚本在 `<skills-root>/scripts/` 共享,**不在 `harness-archive/scripts/`**(见 read-protocol 第 0 条)。
186
+
187
+ 在项目根内任意目录直接跑即可,**不需要** `--project`。
188
+
189
+ 归档目录是封存的(after-manifest 覆盖其每个字节),因此 `republish` **不写回**归档目录:
190
+ 缺失的 `candidates/knowledge.json` 只在内存中按已归档 summary 生成并放进包里。平台的知识
191
+ 条目只来自这个包;`--scope all` 走的是 branch_file 通道,不进知识管道。
192
+
193
+ **服务端一个 change key 只存一个不可变包**,所以补传只适用于「从未成功上传」与「字节完全一致的
194
+ 重试」。已 durable 的 change 会在本地就判出结果:字节一致 → `ARCHIVE_ALREADY_PUBLISHED`
195
+ (exit 0,不重传);字节不同 → `ARCHIVE_REMOTE_IMMUTABLE_CONFLICT`(exit 1,**不发起上传**)。
196
+ **已发布归档无法从客户端补知识条目**——注入候选必然改变字节,服务端拒绝替换;要补需要平台侧
197
+ 提供重新索引或归档版本化能力。
198
+ 只想重试**同一个包**(例如知识索引失败)时用 `--retry-retained`:它上传盘上留存的原包字节,
199
+ 不重建。**重建得不到已发布的字节**——包 manifest 绑定归档自己的提交,封存目录与 harness 本身
200
+ 也都会前进;`--no-knowledge-injection` 只是不注入候选,不等于能复现旧包。
201
+ 留存包与远端字节不同(即那是一次失败尝试的残留)时,`--retry-retained` 同样在本地判出
202
+ `ARCHIVE_REMOTE_IMMUTABLE_CONFLICT` 并拒绝上传。
203
+
204
+ ### 三、文件移动只用内置工具或 PowerShell
205
+
206
+ 移动用 Read+Write+验证 或 PowerShell;**禁止 Bash mv/cp/rm**。移动失败时不删除原目录,报错退出让用户手动处理。
207
+
208
+ ### 四、数据化归档门禁
209
+
210
+ 必须通过 `harness_archive.py finalize` 生成权威 `reports/final/summary-data.json` 并完成 validate。平台监控直接读取该数据;本地不再生成重复的 HTML 报告。统计数字只能来自 summary-data、events、ledger 或 manifest。详见 `../protocols/report-pipeline-protocol.md`、`../protocols/archive-report-protocol.md`、`reference.md`。
211
+
212
+ ### 五、manifest/checksum 必须存在
213
+
214
+ 归档前后生成 `evidence/archive-manifest-before.json` / `archive-manifest-after.json`(path/size/sha256),before/after 不一致时**不得删除原目录**。复杂 PowerShell 写入 `scripts/*.ps1` 后 `-File` 执行,禁止内联 `$` / `$_` / `@{}`。详见 `reference.md`。
215
+
216
+ ### 六、归档前确认四项
217
+
218
+ - 生命周期结局与中文原因已确认;正常完成、主动废弃、被其他方案替代不得混写
219
+ - Git 项目记录当前 HEAD 与 upstream 状态;无 upstream 只影响发布资格,不阻止保存。非 Git 项目记录内容身份
220
+ - Test/Review 只按 `plannedPhases` 核对;未规划或提前结束时如实标记未执行
221
+ - 平台连接与 Git remote 分开检查;无 Git remote 仍生成 ZIP,并在平台已连接时上传
222
+
223
+ ### 七、verification-ledger 汇总状态
224
+
225
+ 归档前读 `evidence/verification-ledger.json`,提取各阶段 status、postTestClassification、复用关系,供 summary-data 真实记录状态演进。若 ledger 有 `postTestClassification`,summary-data 必须记录该分类及对应的复用/重测决策。
226
+
227
+ 门禁策略未声明 `database` 能力,且 `requiredValidations` / `requiredValidationsByPhase` 也未要求 `dbCompatibility` 时,数据库兼容性投影固定为 `NOT_APPLICABLE`,原因来自能力配置。不得要求纯前端、文档或无数据库项目伪造数据库证据。
228
+
229
+ ### 八、summary-data 不得伪造且必须记录状态演进
230
+
231
+ 无测试报告 → 显示"未运行测试 / 静态验证",不得 100% 通过率;无 review → "📝ADVISORY:未运行 review"。状态用 ✅OK / 🟡WARN / 🔁REUSED / 🔁RETESTED / 📝ADVISORY / 🧹NON_BEHAVIORAL_CLEANUP,复用前一阶段结果显示 🔁REUSED,**不得伪装成重新执行,不得无脑全绿**。
232
+
233
+ `summary-data.json` 是最终报告的唯一权威数据源,必须产出并通过 validate/adequacy。平台按该文件展示归档结果,本地不维护第二份展示文件。
234
+
235
+ ### 九、CONDITIONAL_OK 最终状态
236
+
237
+ API 测试 `USER_SKIPPED` 或 DB 兼容 `BLOCKED_BY_DBA` 时,最终状态必须是 `CONDITIONAL_OK`,不能显示纯 `OK`。
238
+
239
+ ### 十、未提交测试文件归档
240
+
241
+ 未提交但用于验证的测试文件必须归档到 `backups/uncommitted-tests/`,并在 summary-data 中记录。
242
+
243
+ ### 十一、归档事件单一所有权
244
+
245
+ `execute` 在一次性预检通过后负责且仅负责一次正式 `phase.start` / `phase.end`。准备阶段单独使用 `phase.prepare.start/end`,不计为归档重跑。调用者不得重复追加阶段边界。归档后 events.ndjson 与自动渲染的 execution-log.md 一起位于 archive。
246
+
247
+ ### 十二、Shell 安全 / 敏感信息 / 证据化报告
248
+
249
+ git 命令通过 `powershell.exe -Command "..."` 执行;archive-meta.md 和 summary-data.json 不得含明文 token、密码或密钥;归档报告必须区分 ✅真实成功 / 🟡跳过·静态验证 / ❌失败。
250
+
251
+ ### 十三、归档完整性与发布资格分离
252
+
253
+ `archiveIntegrity` 表示归档内容是否完整;`candidateVerification` 表示候选验证证据及保证级别;`releaseEligible` 只有两者均满足发布策略时才为 true。`record-only` 允许保留证据不足的历史事实,但绝不等价于 CI 绿灯或可发布。
254
+
255
+ ## Output Format
256
+
257
+ > 归档元数据格式见 `reference.md` 的 archive-meta 模板;最终报告使用 `templates/summary-data-template.json` 定义的数据结构。
258
+
259
+ 产出文件:
260
+
261
+ - `.harness/archive/YYYY-MM-DD-<change-name>/meta/archive-meta.md` — 归档元数据
262
+ - `.harness/archive/YYYY-MM-DD-<change-name>/events.ndjson` — 结构化事件层(新流程推荐;旧 archive 可缺失)
263
+ - `.harness/archive/YYYY-MM-DD-<change-name>/reports/final/summary-data.json` — 最终报告数据源
264
+ - `.harness/archive/YYYY-MM-DD-<change-name>/evidence/archive-manifest-before.json` / `archive-manifest-after.json` — 归档前后 manifest/checksum
265
+ - `.harness/state/local/archive-packages/<change-name>.remote.json` — 远端上传回执(`archiveId`/`archiveStatus`/`knowledgeStatus`/`uploadStatus`/`fileCount`)
266
+
267
+ ### 结束报告必须回显两条上传结果 ⚠️
268
+
269
+ 归档会做**两次**独立上传,二者成败无关,必须分别如实回显:
270
+
271
+ | 上传 | 载什么 | 结果在哪 |
272
+ |------|--------|---------|
273
+ | `steps.archive_push` | 归档 ZIP(核心产物) | `archiveId`/`archiveStatus`/`uploadStatus`/`knowledgeStatus`,同时落盘 `state/local/archive-packages/<cn>.remote.json` |
274
+ | `steps.managed_snapshot_push` | **归档交付物(每个变更目录的 `plans/`、`spec/`、`docs/` 全部,`reports/` 只取 `final/` 定稿)、`.harness/codebase` 架构地图、`.harness/rules`、`.harness/project.yaml`、指令入口** | `ok`/`reasonCode`/`exitCode`/`cliCode`/`detail` |
275
+
276
+ 走 `harness-push`(remote-sync,产生分支快照)而非 legacy `push`(proposal 管道)。
277
+ 归档目录下的 `runtime/`、`meta/`、`evidence/`、`logs/`、`fixback/`、`.publication-staging/`
278
+ 等过程文件不上传;`reports/review/` 与 `reports/test/` 同样是过程产物,不上传——
279
+ 这条边界与归档 ZIP 的包内容边界一致。交付物目录里的 `*.log`、`*.tmp`、凭证与 `.env*`
280
+ 也仍被安全规则拦下。
281
+
282
+ ```
283
+ 远端归档:arc_3ff325bb…(archiveStatus=durable,uploadStatus=ready,knowledgeStatus=ready,8 文件)
284
+ 受管快照:❌ MANAGED_SNAPSHOT_UPLOAD_FAILED(exitCode=1,detail=…)→ 归档 plan/spec/report 与规则/架构地图未上平台,需 npx hunter-harness harness-push --scope config,rules,architecture,instructions,branch_files --yes --non-interactive 重试
285
+ ```
286
+
287
+ **第二条尤其不能省**:它是 best-effort,失败不阻断归档,于是最容易被淹没成一句警告——而平台上"分支文件里没有 plan/spec"正是它失败的后果。成功时也要写明 `submitted` 数量;`ok=false` 时必须带上 `reasonCode` 与 `detail`,不得省略或写成"已完成"。
288
+
289
+ ## 渐进披露
290
+
291
+ - **Read `checklist.md`** 仅在 `execute` 返回结果缺失或 manifest 不一致时
292
+ - **Read `reference.md`** 仅在阻断恢复、受控范围认领或解释最终状态时
293
+ - **Read `templates/summary-data-template.json`** 仅在 summary 校验失败时
294
+
295
+ ## 交互白名单
296
+
297
+ 仅当生命周期结局不明确,或需要受控认领既有提交范围时,允许阻断式确认。拒绝后终止,不执行任何移动。
298
+
299
+ ## 执行日志
300
+
301
+ `events.ndjson` 为唯一事实源(schema_version 3,兼容读取 v1/v2;`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止用 Write/Edit 直接维护**。直接修改的内容会在 `phase.end` 或 finalize 时被完整重建覆盖,属于数据丢失;需要保留的详情必须进入事件 `note`。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
302
+
303
+ **`phase.start` 由 `harness_gate.py begin` 写,不要再手工追加一次。** 两条同 `run-id` 的
304
+ `phase.start` 会让 `plan finalize` 以 `PHASE_START_DUPLICATE` 卡死,而且手工那次会先触发
305
+ auto-seal、把正在开始的 attempt 封成 `RECOVERED`。要补触发指令说明就带 `--note` 跑 `gate begin`。
306
+ (重复追加现已按 `(phase, run-id)` 判为幂等 no-op,但依赖它不如不写。)
307
+
308
+ ```powershell
309
+ # 阶段开始:gate begin 负责,note 在这里给
310
+ python <skills-root>/scripts/harness_gate.py begin --change-dir ".harness/changes/<change-name>" --phase <phase> --note "<触发指令>"
311
+ # 阶段中的其他事件才用 append
312
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type <command|issue|verification> --run-id <phase-run-id> --note "<摘要>"
313
+ ```
314
+
315
+ > **脚本接线**:`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 护栏解读。
316
+
317
+ > **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 边界保持最新。
318
+
319
+ 每个阶段的 `phase.start` 与对应 `phase.end` 必须复用同一 `--run-id` / `--attempt`;阶段结束必须写 `--status OK|WARN|FAIL|BLOCKED`。重试同一阶段时生成新的 run-id 并增加 `--attempt <n>`,不得覆盖或伪装成一次执行。**`attempt` 按 phase 全局递增,不是按 run-id**:一个 run-id 只绑定一个 attempt,重试必须「新 run-id + 下一个 attempt」两者同时换,只换其一会撞 `EVENT_ATTEMPT_CONFLICT` 或 `PHASE_ALREADY_CLOSED`。已发布 plan 的修订通过重跑 `plan evidence-pack` + `plan finalize` 分配新 attempt(`harness_plan_finalize.py republish` 已于 0.3.0 移除)。
320
+
321
+ 阶段跑得久(plan/run 常见)时用 `harness_context.py renew --project . --change <cn> --executor <tool>` 续租;租约到期本身不再阻断 `close`(同一 owner 的过期租约不构成冲突,收据里记 `leaseLapsed`),但续租能让 `view` 的状态如实反映在跑。跨工具继续执行时写 `--executor-tool <codex|claude-code|codebuddy|cursor>`,并在接棒事件写 `--handoff-from-tool` / `--handoff-reason`;也可由 `HUNTER_HARNESS_TOOL/AGENT/MODEL/RUN_ID` 环境变量统一注入。
322
+ > 片段:logging · phase=`archive`
@@ -0,0 +1,71 @@
1
+ ---
2
+ description: harness-archive 的归档前检查项和归档后验证项。仅在 Phase 1 检查和 Phase 4 验证时读取。
3
+ ---
4
+
5
+ # harness-archive 检查清单
6
+
7
+ ## P0 数据化归档门禁
8
+
9
+ 归档遵循 `../protocols/archive-report-protocol.md`,门禁要点见 SKILL.md `## 关键规则` 四/五/九:
10
+
11
+ - 生成并校验 `reports/final/summary-data.json`;平台直接使用该文件展示结果。
12
+ - 归档前生成 `evidence/archive-manifest-before.json`,移动后生成 `archive-manifest-after.json`。
13
+ - 归档统计只能来自 summary-data 或 manifest。
14
+ - before/after checksum 不一致时,不得删除原目录。
15
+ - 需要跨工作区恢复时传 `--durable-root <独立存储>`;成功必须为 `ARCHIVED_DURABLE`,并验证 content-addressed object 与 durable receipt 可读回。
16
+ - `restore-durable` 只恢复到不存在的目标;目标已存在或对象 digest 不符时 fail closed,禁止覆盖。
17
+ - 未配置 durable root 时显式记录 `ARCHIVED_LOCAL_ONLY` 风险,不得把同工作区 move 宣称为独立备份。
18
+
19
+ ### Wave-A 状态机与身份(IA-1 / IA-4)
20
+
21
+ 硬顺序:feature frozen → local gates → product candidate CI → **CI green** → merge → authoritative CI → archive product candidate → archive-only governance → release。
22
+
23
+ - [ ] `evidence/product-candidate-ci.json`(或等价 ledger 字段)`conclusion=success`,含 `runUrl` + `commit`;否则 `PRODUCT_CI_NOT_GREEN` 阻断
24
+ - [ ] summary/identity 含 `productCommit` / `productTreeHash` / `archiveCommit`;`productTreeHash` 排除 `.harness/**`
25
+ - [ ] 产品输入在 archive 后变化 → `ARCHIVE_EVIDENCE_REOPEN_REQUIRED`,旧 archive 不可作发布证据
26
+ - [ ] Manifest:coverage 字节在最终 snapshot 后不得静默漂移;后写报告必须 `exclusionReasons`,禁止假绿 `checksumStatus=OK`
27
+
28
+ ### Environment 合同(IA-3)
29
+
30
+ - [ ] 使用可写环境栈前:`harness_environment.py fingerprint` → `acquire` lease → run → `release`
31
+ - [ ] 租约落在主仓 `.harness/runtime/env-leases/`;跨 change 默认不得共享可写 volume
32
+
33
+ ## 归档前检查(Phase 1)
34
+
35
+ > ⚠️ **单一所有权**:`execute` 负责一次准备记录和一次正式 `phase.start` / `phase.end`。归档前检查不得自行追加 archive 阶段边界。
36
+
37
+ - [ ] 未在调用 `execute` 前手工追加 archive 阶段边界,也未串行调用 `auto-gate`、`status`、`finalize`
38
+ - [ ] 只有一个未归档变更目录(多个时终止或让用户选择)
39
+ - [ ] 已确认 `closure`:正常完成 / 主动废弃 / 被其他方案替代;后两者有中文 `closure-reason`
40
+ - [ ] 正常完成按 `plannedPhases` 核对;提前结束只要求可识别变更与安全封存的最小材料
41
+ - [ ] 变更目录下有 plans/ 子目录(至少有计划文件)
42
+ - [ ] `events.ndjson` 存在;执行日志允许由 finalize 从事件流重新渲染(旧 archive 才兼容根目录 `execution-log.md`)
43
+ - [ ] 准备生成 `archive-manifest-before.json`(path/size/sha256)
44
+ - [ ] 准备生成 `summary-data.json`(业务目标、阶段状态、验证、产物、维护者结论)
45
+ - [ ] Git 项目记录 dirty/HEAD/upstream;无 upstream 或仅本地 commit 允许归档,但 `releaseEligible=false`
46
+ - [ ] 非 Git 项目生成确定性内容清单与产品树散列,并记录 `sourceControl=none`
47
+ - [ ] 最终产品身份来自 Submit 收据或当前内容;提交前候选只允许在验证输入未变化时由 `certify-local` 自动重绑定
48
+ - [ ] `changeBase` 来自首次 Plan 快照,后续阶段未用当前 HEAD 覆盖;正常完成时 base 与产品 tip 不得相同
49
+ - [ ] 如使用既有提交范围,`meta/archive-range-adoption.json` 由 `adopt-existing-range --confirm-existing-range` 生成,未手工修改 ledger 或 snapshot
50
+ - [ ] 主动废弃或被替代允许没有产品增量,但必须有中文原因,且不得声明为发布候选
51
+ - [ ] **test/review 报告状态确认**:
52
+ - ✅ `.harness/changes/<change-name>/tests/test-report-*.md` 存在 → 归档正常
53
+ - 🟡 不存在 → 必须在 archive-meta.md 和 summary-data.json 中标记「跳过测试」或「未运行测试」,不得伪造通过率
54
+ - ✅ `.harness/changes/<change-name>/reports/review/review-report-*.md` 存在(旧路径 `reviews/review-report-*.md` 兼容回退)→ 作为 📝ADVISORY 归档材料
55
+ - 📝 `.harness/changes/<change-name>/reports/review/fixback-*.md` 存在 → 随 review 报告一并归档;默认 advisory,除非 `strict-review-gate=true`
56
+ - 🟡 不存在但 `logs/execution-log.md` 有 harness-review 小节 → **review 已运行但未落盘**(harness-review `context:fork` 交接缝常见,见 `agent/case-candidates/2026-06-30-harness-review-forked-not-persisting-report.md`):从 execution-log/会话补落盘到 `reports/review/review-report-YYYYMMDD-HHmm.md` 再归档,**不得误标"未运行 review"**(实际跑过)
57
+ - 🟡 不存在且 execution-log 无 review 小节 → 在 archive-meta.md 和 summary-data.json 中标记「📝ADVISORY:未运行 review」
58
+
59
+ ## 归档后验证(Phase 4)
60
+
61
+ - [ ] `.harness/archive/YYYY-MM-DD-<change-name>/` 目录存在(通过 Glob 实际扫描确认)
62
+ - [ ] 所有子目录(plans/, tests/, reviews/, sqls/)已完整移入(通过 Glob 实际扫描确认,不仅看预期路径)
63
+ - [ ] before/after manifest 校验通过(排除 `logs/execution-log.md`——归档追加结束记录预期 sha256 变化;其他 moved 文件 sha256 必须一致,missing/mismatch=0)
64
+ - [ ] archive-meta.md 由 finalize 自动生成且字段完整;调用者未手写或补改
65
+ - [ ] summary-data.json 已生成,且为合法 JSON
66
+ - [ ] **summary-data.json 真实性检查**:
67
+ - 无测试报告时,`summary-data.json.verification.unitTests.status` / `summary-data.json.verification.apiTests.status` 必须标记为 `NOT_RUN`、`USER_SKIPPED`、`BLOCKED` 或 `STATIC_ONLY`,不得显示 100%
68
+ - 无 review 报告时,`summary-data.json.reviewSummary.status` 必须标记为 `ADVISORY_NOT_RUN`,不得显示 100%
69
+ - 跳过、复用、人工确认的部分必须明确标记,不伪装成 ✅
70
+ - [ ] 原目录 `.harness/changes/<change-name>/` 已删除(仅在前面所有验证通过后)
71
+ - [ ] .harness/ 下无残留未归档变更目录
@@ -0,0 +1,150 @@
1
+ ---
2
+ description: harness-archive 的归档流程、manifest、summary-data 校验、目录结构与最终状态规则。
3
+ ---
4
+
5
+ # harness-archive 参考
6
+
7
+ ## 归档流程(对齐 SKILL.md Workflow)
8
+
9
+ - **Phase 0 读取上下文**:读 SKILL.md,解析 `$ARGUMENTS`,刷新一次状态快照。常规路径不预读全部参考资料。
10
+ - **Phase 1 确认归档对象**:使用 `harness_change.py resolve` 解析 contract/state 双层目录;多变更让用户选择或终止。
11
+ - **Phase 2 确定归档结局**:已有明确指令时直接使用;只有结局不明确或需要认领既有提交范围时才询问。
12
+ - **Phase 3 执行归档**:
13
+ 1. 运行一次 `python <skills-root>/scripts/harness_archive.py execute --change-dir ... --archive-root ".harness/archive" --intent <...> --closure <...> --json`。不要预先运行 `auto-gate` 或 `status`,也不要随后直接运行 `finalize`。候选收据缺失时,`execute` 会先尝试复用完整且身份一致的 `unitTestFull` ledger;产品内容未变化而 HEAD 因提交前移时,只重绑定候选身份,不重跑测试。
14
+ 2. `execute` 在同一进程中复用预检结果,并负责且仅负责一次正式 `phase.start` / `phase.end`。准备耗时单独记录。`meta/archive-meta.md` 与 summary 均由 finalize 内部生成;禁止手写。
15
+ 3. finalize 在 before-manifest 前执行 cleanup(删除 lock/pid/launcher/credential,截断超大日志)。它采用冻结优先:collect 前 fsync 事件并写 `evidence/evidence-cutoff.json`;cutoff 后不再追加事件。source consistency 或 summary consistency 失败时,脚本保留原 changes 目录并非零退出。
16
+ - **Phase 4 验证与提示**:优先使用 `execute` 返回的 manifest、ZIP 和上传回执;仅在结果缺失或不一致时读取 `checklist.md`。
17
+
18
+ 数据库兼容性由项目能力配置决定。门禁策略既未声明 `database` 能力,也未把 `dbCompatibility` 列为必需验证时,汇总结果为 `NOT_APPLICABLE`,并以 `capability-profile` 作为类型化来源;只有明确具备数据库能力或明确要求该验证时才检查数据库证据。
19
+
20
+ ## 基线折叠的恢复方式
21
+
22
+ `ARCHIVE_BASE_EQUALS_FEATURE_TIP` 表示正常完成的归档范围为空。不要修改 ledger、state snapshot 或制造空提交。按实际情况选择:
23
+
24
+ 1. 本次变更确实对应仓库中一段已有提交:展示 base、tip 和产品文件清单,获得用户明确确认后运行:
25
+
26
+ ```powershell
27
+ python <skills-root>/scripts/harness_archive.py adopt-existing-range --change-dir ".harness/changes/<change>" --base <base> --tip <tip> --reason "<中文原因>" --confirm-existing-range --json
28
+ ```
29
+
30
+ 命令生成不可覆盖的 `meta/archive-range-adoption.json`,并绑定仓库身份、ownership、diffHash 和文件清单。随后只重跑一次 `execute`。
31
+ 2. 需求未完成:使用 `--intent record-only --closure abandoned|superseded --closure-reason "<中文原因>"`。零产品增量作为 warning 保存,不阻止封存,且 `releaseEligible=false`。
32
+ 3. 无法证明范围或用户拒绝确认:取消归档,保留原目录。
33
+
34
+ ## manifest 生成
35
+
36
+ manifest 每项包含:
37
+
38
+ ```json
39
+ {"path":"...","size":123,"sha256":"...","lastModified":"..."}
40
+ ```
41
+
42
+ 建议使用固定脚本,禁止内联复杂 PowerShell(包含 `$`、`$_`、`@{}`、script block、管道 JSON 输出):
43
+
44
+ ```powershell
45
+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "harness-skills/harness-archive/scripts/gen-manifest.ps1" -RootPath ".harness/changes/<change>" -OutputPath ".harness/changes/<change>/evidence/archive-manifest-before.json"
46
+ ```
47
+
48
+ 移动到 archive 目录后,再生成 after manifest:
49
+
50
+ ```powershell
51
+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "harness-skills/harness-archive/scripts/gen-manifest.ps1" -RootPath ".harness/archive/<date-change>" -OutputPath ".harness/archive/<date-change>/evidence/archive-manifest-after.json"
52
+ ```
53
+
54
+ **校验 before/after 时排除 execution-log**(通用):`logs/execution-log.md` 在归档过程会追加结束记录(Phase 4),before(移动前含开始记录)与 after(含开始+结束记录)sha256 必然不同——这是预期追加,非文件损坏。校验脚本需跳过 `logs/execution-log.md`,其他 moved 文件 sha256 必须一致;若其他文件 missing/mismatch,才表示移动损坏,不得删除原目录。
55
+
56
+ ## summary-data.json 与 harness_archive.py
57
+
58
+ `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 维度。必须包含:
59
+
60
+ - `businessGoal`:本次变更为了做什么;
61
+ - `stageStatus`:plan/run/test/review/submit/archive;
62
+ - `diffStat`:filesChanged/insertions/deletions/range —— 来自 `git diff --numstat` + `git diff --stat <base>..<head>`,不得手写;
63
+ - `durations`:totalMinutes + stages[{stage,skill,startedAt,endedAt,minutes,result}] —— 从 `logs/execution-log.md` 各 `[N] harness-<skill>` 小节的 `开始`/`结束`/`耗时` 解析;
64
+ - `skillCalls`:每个 skill 的调用次数(含重入)+ 结果 —— 从 execution-log 统计;
65
+ - `verification`:单元/API/覆盖展示,含 passRate —— 来自 `evidence/verification-ledger.json`;
66
+ - `efficiency`:墙钟/活动/资源等待、验证尝试、失败分类、环境 prepare/reuse/reset/cleanup、重复命令与 wrapper 数 —— 由 `harness_efficiency.py` 从运行回执自动汇总;
67
+ - `changedFiles`:path/summary/insertions/deletions —— 来自 `git diff --numstat <base>..<head>`;
68
+ - `reviewSummary`:red/yellow + redFixed/redConfirmed/yellowFixed/yellowDeferred 修复进度;
69
+ - `maintenanceNotes`:给后续维护者看的结论;
70
+ - `knownRisks`:剩余风险或人工确认项;
71
+ - `decisions`:已采纳的设计决策/需求/API 契约 —— 来自 `evidence/decisions.json`(见下节),生成器只做校验与透传,不从 markdown 提取。
72
+
73
+ 报告必须突出业务目标和维护者结论。所有统计数字只能来自 events、summary-data、ledger 或 manifest,不得手写另一套。历史 archive 没有 `events.ndjson` 时,允许从 ledger/log/manifest 回放,并在 `reportPipeline.sources` 中记录来源。
74
+
75
+ ## evidence/decisions.json(可选,知识沉淀入口)
76
+
77
+ 重要设计决策、长期约束、API 契约要进入平台知识库的唯一通道:在 plan/execute/review 阶段由人或 agent 把**已采纳**的结论写入 `.harness/changes/<change>/evidence/decisions.json`(schema_version 1):
78
+
79
+ ```json
80
+ {
81
+ "schema_version": 1,
82
+ "decisions": [
83
+ {
84
+ "id": "D-001",
85
+ "title": "一句话结论(必填,≤500 字)",
86
+ "rationale": "为什么(可选,≤4000 字)",
87
+ "entry_type": "decision | requirement | api-contract",
88
+ "status": "adopted | proposed | rejected | superseded",
89
+ "path": "docs/design/x.md(可选,相对路径,溯源用)",
90
+ "line": 42,
91
+ "keywords": ["可选,≤32 个"],
92
+ "source": "plan | review | manual | archive"
93
+ }
94
+ ]
95
+ }
96
+ ```
97
+
98
+ - 只有 `status: "adopted"` 的记录会成为知识候选(`entry_type` 原样落到知识条目上);其余状态保留在 summary 里做记录。
99
+ - 与 reviewFindings 的裁决门槛同源:**筛选必须在上游发生**——不要把讨论过程原文倒进来,归档时不做任何 LLM 提取。
100
+ - 不合 schema 的记录会被丢弃并在 `maintenanceNotes` 留一条计数说明;丢弃不无声。
101
+ - 未裁决(OPEN/UNKNOWN)的 RED/YELLOW findings 若导致候选为 0,finalize 会显式告警提示先裁决再 republish。
102
+
103
+ ## 平台展示与数据校验
104
+
105
+ 平台监控直接读取 `reports/final/summary-data.json`,归档阶段不再生成本地 HTML 报告,也不得由模型临场维护第二份展示数据。
106
+
107
+ `validate` 是 `harness_archive.py finalize` 的内嵌同进程步骤(不再作为独立 `report validate` CLI 调用)。finalize 在 validate error 存在时恢复原 `.harness/changes/<change>` 目录并 exit 非 0,绝不归档未通过校验的变更。
108
+
109
+ ## repair(归档后修复,不改写原版)
110
+
111
+ 归档后发现来源事实与 summary-data 不一致时,使用显式修复(`replay` 仍为只读):
112
+
113
+ ```powershell
114
+ python <skills-root>/scripts/harness_archive.py repair --archive-dir ".harness/archive/<archive-id>" --json
115
+ ```
116
+
117
+ repair 在 archive 外生成候选版本。来源校验与数据校验通过后,写入不可变 `derived/v<N>/`(summary-data.json + repair-record.json),并更新 `derived/authoritative.json` pointer;原 summary 与 manifest 不覆盖。知识层仅从 authoritative pointer 且 hash 校验通过的版本提取。
118
+
119
+ ## archive-meta.md 模板
120
+
121
+ 由 `harness_archive.py finalize` 生成(手写视为数据丢失)。frontmatter 与 summary-data 同源:
122
+
123
+ ```markdown
124
+ ---
125
+ archive-id: YYYY-MM-DD-<change-name>
126
+ change-name: <change-name>
127
+ archived-at: YYYY-MM-DD HH:mm
128
+ final-commit: <hash>
129
+ base-commit: <hash>
130
+ final-status: <OK|WARN|CONDITIONAL_OK|FAIL> # 与 summary-data.finalStatus 同源
131
+ source: harness-archive
132
+ ---
133
+ # 归档元数据 — <change-name>
134
+ ## 阶段状态
135
+ ## 变更文件
136
+ ## 已知风险
137
+ ```
138
+
139
+ cleanup 步骤(before-manifest 前):删除 `events.ndjson.lock`、`runtime/*.pid`、launcher、credential/token/secret 文件名;截断 `logs/**/*.log` 超过 64KB 的尾部保留。
140
+
141
+ ## 目录结构与最终状态规则
142
+
143
+ - 平台直接读取 `reports/final/summary-data.json`;本地不生成重复展示文件。
144
+ - 新路径优先:`meta/`、`logs/`、`evidence/`、`reports/final/`、`scripts/`、`backups/uncommitted-tests/`。旧路径只做读取兼容,不再写大量根目录文件。
145
+ - 当 `summary-data.json.verification.apiTests.status=USER_SKIPPED` 或 `verification.dbCompatibility.status=BLOCKED_BY_DBA`,最终状态必须是 `CONDITIONAL_OK`。
146
+ - 复杂 PowerShell 命令写入 `scripts/*.ps1` 后 `-File` 执行,禁止内联 `$` / `$_`。
147
+
148
+ ## 执行日志记录
149
+
150
+ 归档只向 `events.ndjson` 追加事件(schema_version 3,兼容读取 v1/v2);`logs/execution-log.md` 由 `harness_events.py append` 自动渲染,禁止手工 Edit。事件类型与脚本用法见 SKILL.md `## 执行日志` 与 `../protocols/report-pipeline-protocol.md`。
@@ -0,0 +1,31 @@
1
+ param(
2
+ [Parameter(Mandatory=$true)][string]$RootPath,
3
+ [Parameter(Mandatory=$true)][string]$OutputPath
4
+ )
5
+
6
+ $ErrorActionPreference = 'Stop'
7
+ $root = (Resolve-Path $RootPath).Path
8
+ # 排除 OutputPath 自身:重新生成 manifest 时旧 manifest 文件会被扫到,导致递归(新 manifest 含旧 manifest 的 sha256,fileCount 虚高 +1)。
9
+ # OutputPath 不存在时(首次生成)$excludePath=$null,Where-Object 不过滤。
10
+ $excludePath = $null
11
+ if (Test-Path $OutputPath) {
12
+ $excludePath = (Resolve-Path $OutputPath).Path
13
+ }
14
+ $items = Get-ChildItem -Path $root -File -Recurse | Where-Object { $excludePath -eq $null -or $_.FullName -ne $excludePath } | Sort-Object FullName | ForEach-Object {
15
+ $relative = $_.FullName.Substring($root.Length).TrimStart('\','/') -replace '\\','/'
16
+ $hash = Get-FileHash -Path $_.FullName -Algorithm SHA256
17
+ [PSCustomObject]@{
18
+ path = $relative
19
+ sizeBytes = $_.Length
20
+ sha256 = $hash.Hash.ToLowerInvariant()
21
+ }
22
+ }
23
+ $result = [PSCustomObject]@{
24
+ root = $root
25
+ generatedAt = (Get-Date).ToString('s')
26
+ fileCount = @($items).Count
27
+ totalBytes = (@($items) | Measure-Object -Property sizeBytes -Sum).Sum
28
+ files = @($items)
29
+ }
30
+ $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
31
+ [System.IO.File]::WriteAllText((Resolve-Path (Split-Path $OutputPath -Parent)).Path + [System.IO.Path]::DirectorySeparatorChar + (Split-Path $OutputPath -Leaf), ($result | ConvertTo-Json -Depth 8), $utf8NoBom)