coding-agent-harness 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/CONTRIBUTING.md +2 -2
  2. package/README.md +63 -3
  3. package/README.zh-CN.md +52 -3
  4. package/SKILL.md +43 -43
  5. package/dist/build-dist.mjs +189 -0
  6. package/dist/check-dist-observation.mjs +428 -0
  7. package/dist/check-harness.mjs +489 -0
  8. package/dist/check-import-graph.mjs +511 -0
  9. package/dist/check-runtime-emit.mjs +304 -0
  10. package/dist/check-type-boundaries.mjs +139 -0
  11. package/dist/commands/dashboard-command.mjs +80 -0
  12. package/dist/commands/migration-command.mjs +152 -0
  13. package/dist/commands/preset-command.mjs +91 -0
  14. package/dist/commands/task-command.mjs +324 -0
  15. package/dist/harness.mjs +304 -0
  16. package/dist/lib/capability-registry.mjs +643 -0
  17. package/dist/lib/check-module-parallel.mjs +227 -0
  18. package/dist/lib/check-profiles.mjs +414 -0
  19. package/dist/lib/check-task-contracts.mjs +54 -0
  20. package/dist/lib/core-shared.mjs +254 -0
  21. package/dist/lib/dashboard-data.mjs +608 -0
  22. package/dist/lib/dashboard-workbench.mjs +334 -0
  23. package/dist/lib/dashboard-writer.mjs +200 -0
  24. package/dist/lib/git-status-summary.mjs +45 -0
  25. package/dist/lib/governance-index-generator.mjs +236 -0
  26. package/dist/lib/governance-sync.mjs +617 -0
  27. package/dist/lib/governance-table-boundary.mjs +161 -0
  28. package/{scripts → dist}/lib/harness-core.mjs +2 -0
  29. package/dist/lib/harness-paths.mjs +338 -0
  30. package/dist/lib/lesson-maintenance.mjs +139 -0
  31. package/dist/lib/markdown-utils.mjs +193 -0
  32. package/dist/lib/migration-planner.mjs +439 -0
  33. package/dist/lib/migration-support.mjs +317 -0
  34. package/dist/lib/phase-kind.mjs +46 -0
  35. package/dist/lib/preset-audit-contracts.mjs +40 -0
  36. package/dist/lib/preset-engine.mjs +516 -0
  37. package/dist/lib/preset-registry.mjs +831 -0
  38. package/dist/lib/preset-resource-contracts.mjs +83 -0
  39. package/dist/lib/review-confirm-git-gate.mjs +244 -0
  40. package/dist/lib/status-builder.mjs +87 -0
  41. package/{scripts → dist}/lib/status-dashboard-renderer.mjs +44 -46
  42. package/dist/lib/structure-migration.mjs +404 -0
  43. package/dist/lib/subagent-authorization-audit.mjs +198 -0
  44. package/dist/lib/task-audit-metadata.mjs +376 -0
  45. package/dist/lib/task-audit-migration.mjs +355 -0
  46. package/dist/lib/task-completion-consistency.mjs +29 -0
  47. package/dist/lib/task-index.mjs +133 -0
  48. package/dist/lib/task-lesson-candidates.mjs +239 -0
  49. package/dist/lib/task-lesson-sedimentation.mjs +300 -0
  50. package/dist/lib/task-lifecycle/create-task-helpers.mjs +84 -0
  51. package/dist/lib/task-lifecycle/phase-sync.mjs +82 -0
  52. package/dist/lib/task-lifecycle/review-confirm.mjs +93 -0
  53. package/dist/lib/task-lifecycle/review-gates.mjs +62 -0
  54. package/dist/lib/task-lifecycle/review-submission.mjs +52 -0
  55. package/dist/lib/task-lifecycle/scaffold-provenance.mjs +54 -0
  56. package/dist/lib/task-lifecycle/template-files.mjs +52 -0
  57. package/dist/lib/task-lifecycle/text-utils.mjs +26 -0
  58. package/dist/lib/task-lifecycle.mjs +611 -0
  59. package/dist/lib/task-metadata.mjs +116 -0
  60. package/dist/lib/task-review-model.mjs +474 -0
  61. package/dist/lib/task-scanner.mjs +439 -0
  62. package/dist/lib/task-tombstone-commands.mjs +125 -0
  63. package/dist/postinstall.mjs +14 -0
  64. package/dist/run-built-tests.mjs +84 -0
  65. package/docs-release/README.md +1 -0
  66. package/docs-release/architecture/overview.md +12 -12
  67. package/docs-release/architecture/overview.zh-CN.md +12 -12
  68. package/docs-release/architecture/system-explainer/01-system-overview.md +15 -14
  69. package/docs-release/architecture/system-explainer/02-module-dependency.md +8 -8
  70. package/docs-release/architecture/system-explainer/03-task-lifecycle.md +3 -3
  71. package/docs-release/architecture/system-explainer/04-check-and-governance.md +9 -7
  72. package/docs-release/architecture/system-explainer/05-data-flow.md +5 -5
  73. package/docs-release/architecture/system-explainer/06-preset-and-migration.md +1 -4
  74. package/docs-release/architecture/system-explainer/en-US/01-system-overview.md +15 -14
  75. package/docs-release/architecture/system-explainer/en-US/02-module-dependency.md +8 -8
  76. package/docs-release/architecture/system-explainer/en-US/03-task-lifecycle.md +3 -3
  77. package/docs-release/architecture/system-explainer/en-US/04-check-and-governance.md +10 -8
  78. package/docs-release/architecture/system-explainer/en-US/05-data-flow.md +5 -5
  79. package/docs-release/architecture/system-explainer/en-US/06-preset-and-migration.md +1 -4
  80. package/docs-release/guides/agent-installation.en-US.md +14 -8
  81. package/docs-release/guides/agent-installation.md +14 -8
  82. package/docs-release/guides/contributing.md +3 -3
  83. package/docs-release/guides/contributing.zh-CN.md +3 -3
  84. package/docs-release/guides/document-audience-and-surfaces.en-US.md +10 -10
  85. package/docs-release/guides/document-audience-and-surfaces.md +10 -10
  86. package/docs-release/guides/legacy-migration-agent-prompt.md +25 -2
  87. package/docs-release/guides/legacy-migration-agent-prompt.zh-CN.md +25 -2
  88. package/docs-release/guides/migration-playbook.en-US.md +63 -1
  89. package/docs-release/guides/migration-playbook.md +59 -1
  90. package/docs-release/guides/parent-control-repository-pattern.en-US.md +25 -25
  91. package/docs-release/guides/parent-control-repository-pattern.md +25 -25
  92. package/docs-release/guides/preset-development.md +2 -2
  93. package/docs-release/guides/repository-operating-models.en-US.md +21 -21
  94. package/docs-release/guides/repository-operating-models.md +21 -21
  95. package/docs-release/guides/task-state-machine.en-US.md +5 -5
  96. package/docs-release/guides/task-state-machine.md +5 -5
  97. package/docs-release/guides/typescript-runtime-migration-closeout.md +96 -0
  98. package/examples/minimal-project/AGENTS.md +2 -2
  99. package/examples/minimal-project/coding-agent-harness/harness.yaml +14 -0
  100. package/examples/minimal-project/coding-agent-harness/planning/tasks/demo-task/progress.md +11 -0
  101. package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/review.md +1 -1
  102. package/package.json +20 -12
  103. package/presets/legacy-migration/preset.yaml +5 -5
  104. package/presets/legacy-migration/templates/execution_strategy.append.md +1 -1
  105. package/presets/lesson-sedimentation/preset.yaml +3 -3
  106. package/presets/module/preset.yaml +2 -2
  107. package/presets/module/templates/execution_strategy.append.md +1 -1
  108. package/presets/module/templates/task_plan.append.md +3 -3
  109. package/presets/standard-task/preset.yaml +2 -2
  110. package/references/adversarial-review-standard.md +2 -2
  111. package/references/agents-md-pattern.md +14 -14
  112. package/references/cadence-ledger.md +1 -1
  113. package/references/ci-cd-standard.md +1 -1
  114. package/references/delivery-operating-model-standard.md +4 -4
  115. package/references/docs-directory-standard.md +65 -159
  116. package/references/external-source-intake-standard.md +10 -10
  117. package/references/harness-ledger.md +5 -5
  118. package/references/legacy-12-phase-bootstrap.md +2 -2
  119. package/references/lessons-governance.md +15 -15
  120. package/references/long-running-task-standard.md +6 -6
  121. package/references/module-parallel-standard.md +34 -34
  122. package/references/planning-loop.md +6 -6
  123. package/references/project-onboarding-audit.md +4 -4
  124. package/references/regression-system.md +2 -2
  125. package/references/repo-governance-standard.md +4 -4
  126. package/references/review-routing-standard.md +1 -1
  127. package/references/ssot-governance.md +19 -19
  128. package/references/taskr-gap-analysis.md +5 -5
  129. package/references/walkthrough-closeout.md +14 -14
  130. package/references/worktree-parallel.md +3 -3
  131. package/skills/preset-creator/references/complex-task-skeleton/task_plan.md +1 -1
  132. package/skills/preset-creator/references/preset-package-skeleton.md +5 -5
  133. package/templates/AGENTS.md.template +26 -26
  134. package/templates/architecture/README.md +4 -4
  135. package/templates/architecture/service-catalog.md +2 -2
  136. package/templates/architecture/services/service-template.md +1 -1
  137. package/templates/dashboard/assets/app-src/20-overview.js +11 -5
  138. package/templates/dashboard/assets/app-src/40-modules.js +1 -1
  139. package/templates/dashboard/assets/app.js +12 -6
  140. package/templates/dashboard/assets/i18n.js +4 -2
  141. package/templates/development/README.md +10 -10
  142. package/templates/development/cross-repo-debugging.md +3 -3
  143. package/templates/development/external-context/service-template.md +2 -2
  144. package/templates/development/external-source-packs/README.md +4 -4
  145. package/templates/integrations/README.md +4 -4
  146. package/templates/integrations/api-contract.md +2 -2
  147. package/templates/integrations/event-contract.md +2 -2
  148. package/templates/integrations/third-party/vendor-template.md +2 -2
  149. package/templates/integrations/webhook-contract.md +2 -2
  150. package/templates/ledger/Harness-Ledger.md +1 -1
  151. package/templates/planning/INDEX.md +1 -0
  152. package/templates/planning/module_session_prompt.md +1 -1
  153. package/templates/planning/task_plan.md +1 -1
  154. package/templates/planning/walkthrough.md +47 -0
  155. package/templates/reference/docs-library-standard.md +8 -8
  156. package/templates/reference/external-source-intake-standard.md +15 -15
  157. package/templates/reference/repo-governance-standard.md +1 -1
  158. package/templates/ssot/Module-Registry.md +1 -1
  159. package/templates/walkthrough/walkthrough-template.md +2 -2
  160. package/templates-zh-CN/AGENTS.md.template +26 -26
  161. package/templates-zh-CN/CLAUDE.md.template +1 -1
  162. package/templates-zh-CN/architecture/README.md +4 -4
  163. package/templates-zh-CN/architecture/service-catalog.md +2 -2
  164. package/templates-zh-CN/architecture/services/service-template.md +1 -1
  165. package/templates-zh-CN/development/README.md +10 -10
  166. package/templates-zh-CN/development/cross-repo-debugging.md +3 -3
  167. package/templates-zh-CN/development/external-context/service-template.md +2 -2
  168. package/templates-zh-CN/development/external-source-packs/README.md +4 -4
  169. package/templates-zh-CN/integrations/README.md +4 -4
  170. package/templates-zh-CN/integrations/api-contract.md +2 -2
  171. package/templates-zh-CN/integrations/event-contract.md +2 -2
  172. package/templates-zh-CN/integrations/third-party/vendor-template.md +2 -2
  173. package/templates-zh-CN/integrations/webhook-contract.md +2 -2
  174. package/templates-zh-CN/ledger/Harness-Ledger.md +1 -1
  175. package/templates-zh-CN/lessons/lesson-arch-process-change.md +1 -1
  176. package/templates-zh-CN/lessons/lesson-new-doc.md +3 -3
  177. package/templates-zh-CN/lessons/lesson-ref-change.md +4 -4
  178. package/templates-zh-CN/planning/module_session_prompt.md +11 -11
  179. package/templates-zh-CN/planning/walkthrough.md +47 -0
  180. package/templates-zh-CN/reference/adversarial-review-standard.md +2 -2
  181. package/templates-zh-CN/reference/delivery-operating-model-standard.md +3 -3
  182. package/templates-zh-CN/reference/docs-library-standard.md +28 -28
  183. package/templates-zh-CN/reference/execution-workflow-standard.md +1 -1
  184. package/templates-zh-CN/reference/external-source-intake-standard.md +16 -16
  185. package/templates-zh-CN/reference/harness-ledger-standard.md +6 -6
  186. package/templates-zh-CN/reference/regression-ssot-governance.md +2 -2
  187. package/templates-zh-CN/reference/repo-governance-standard.md +1 -1
  188. package/templates-zh-CN/reference/review-routing-standard.md +1 -1
  189. package/templates-zh-CN/reference/walkthrough-standard.md +7 -7
  190. package/templates-zh-CN/reference/worktree-standard.md +1 -1
  191. package/templates-zh-CN/regression/Cadence-Ledger.md +2 -2
  192. package/templates-zh-CN/ssot/Delivery-SSoT.md +3 -3
  193. package/templates-zh-CN/ssot/Module-Registry.md +3 -3
  194. package/templates-zh-CN/ssot/Regression-SSoT.md +2 -2
  195. package/templates-zh-CN/walkthrough/walkthrough-template.md +5 -5
  196. package/tsconfig.dist.json +16 -0
  197. package/tsconfig.json +25 -0
  198. package/tsconfig.runtime.json +24 -0
  199. package/examples/minimal-project/.harness-capabilities.json +0 -8
  200. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/progress.md +0 -11
  201. package/scripts/check-harness.mjs +0 -508
  202. package/scripts/commands/dashboard-command.mjs +0 -67
  203. package/scripts/commands/migration-command.mjs +0 -126
  204. package/scripts/commands/preset-command.mjs +0 -73
  205. package/scripts/commands/task-command.mjs +0 -328
  206. package/scripts/harness.mjs +0 -291
  207. package/scripts/lib/capability-registry.mjs +0 -587
  208. package/scripts/lib/check-module-parallel.mjs +0 -230
  209. package/scripts/lib/check-profiles.mjs +0 -372
  210. package/scripts/lib/check-task-contracts.mjs +0 -55
  211. package/scripts/lib/core-shared.mjs +0 -249
  212. package/scripts/lib/dashboard-data.mjs +0 -520
  213. package/scripts/lib/dashboard-workbench.mjs +0 -336
  214. package/scripts/lib/dashboard-writer.mjs +0 -202
  215. package/scripts/lib/git-status-summary.mjs +0 -46
  216. package/scripts/lib/governance-index-generator.mjs +0 -174
  217. package/scripts/lib/governance-sync.mjs +0 -611
  218. package/scripts/lib/governance-table-boundary.mjs +0 -175
  219. package/scripts/lib/lesson-maintenance.mjs +0 -152
  220. package/scripts/lib/markdown-utils.mjs +0 -191
  221. package/scripts/lib/migration-planner.mjs +0 -476
  222. package/scripts/lib/migration-support.mjs +0 -312
  223. package/scripts/lib/phase-kind.mjs +0 -50
  224. package/scripts/lib/preset-audit-contracts.mjs +0 -37
  225. package/scripts/lib/preset-engine.mjs +0 -494
  226. package/scripts/lib/preset-registry.mjs +0 -776
  227. package/scripts/lib/preset-resource-contracts.mjs +0 -83
  228. package/scripts/lib/review-confirm-git-gate.mjs +0 -248
  229. package/scripts/lib/status-builder.mjs +0 -88
  230. package/scripts/lib/subagent-authorization-audit.mjs +0 -196
  231. package/scripts/lib/task-audit-metadata.mjs +0 -385
  232. package/scripts/lib/task-audit-migration.mjs +0 -350
  233. package/scripts/lib/task-completion-consistency.mjs +0 -26
  234. package/scripts/lib/task-index.mjs +0 -93
  235. package/scripts/lib/task-lesson-candidates.mjs +0 -242
  236. package/scripts/lib/task-lesson-sedimentation.mjs +0 -326
  237. package/scripts/lib/task-lifecycle/create-task-helpers.mjs +0 -67
  238. package/scripts/lib/task-lifecycle/phase-sync.mjs +0 -88
  239. package/scripts/lib/task-lifecycle/review-confirm.mjs +0 -112
  240. package/scripts/lib/task-lifecycle/review-gates.mjs +0 -73
  241. package/scripts/lib/task-lifecycle/review-submission.mjs +0 -63
  242. package/scripts/lib/task-lifecycle/scaffold-provenance.mjs +0 -49
  243. package/scripts/lib/task-lifecycle/template-files.mjs +0 -53
  244. package/scripts/lib/task-lifecycle/text-utils.mjs +0 -24
  245. package/scripts/lib/task-lifecycle.mjs +0 -616
  246. package/scripts/lib/task-metadata.mjs +0 -118
  247. package/scripts/lib/task-review-model.mjs +0 -455
  248. package/scripts/lib/task-scanner.mjs +0 -503
  249. package/scripts/lib/task-tombstone-commands.mjs +0 -140
  250. package/scripts/postinstall.mjs +0 -14
  251. package/templates/walkthrough/Closeout-SSoT.md +0 -43
  252. package/templates-zh-CN/walkthrough/Closeout-SSoT.md +0 -42
  253. /package/examples/minimal-project/{docs → coding-agent-harness/governance/generated}/Harness-Ledger.md +0 -0
  254. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/INDEX.md +0 -0
  255. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/brief.md +0 -0
  256. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/execution_strategy.md +0 -0
  257. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/findings.md +0 -0
  258. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/lesson_candidates.md +0 -0
  259. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/task_plan.md +0 -0
  260. /package/examples/minimal-project/{docs/09-PLANNING/TASKS → coding-agent-harness/planning/tasks}/demo-task/visual_map.md +0 -0
package/CONTRIBUTING.md CHANGED
@@ -40,7 +40,7 @@ docs row. For larger PRs or when you are unsure, run the full root suite.
40
40
  | --- | --- |
41
41
  | Docs only | `git diff --check` |
42
42
  | CLI/runtime | `npm test`, `npm run check`, `git diff --check` |
43
- | Templates or examples | `npm test`, `node scripts/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
43
+ | Templates or examples | `npm test`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
44
44
  | Dashboard | `npm test`, `npm run smoke:dashboard`, `git diff --check` |
45
45
  | Package surface | `npm test`, `npm run pack:dry-run`, `git diff --check` |
46
46
  | GUI submodule | `cd harness-gui && npm ci && npm run typecheck && npm test && npm run build` |
@@ -52,7 +52,7 @@ npm install
52
52
  npm test
53
53
  npm run smoke:dashboard
54
54
  npm run check
55
- node scripts/harness.mjs check --profile target-project examples/minimal-project
55
+ node dist/harness.mjs check --profile target-project examples/minimal-project
56
56
  npm run pack:dry-run
57
57
  git diff --check
58
58
  ```
package/README.md CHANGED
@@ -84,9 +84,18 @@ context in every prompt, put it in a preset and create each task with
84
84
 
85
85
  Harness ships bundled presets, `harness init` seeds them into the target project,
86
86
  and teams can add project-local presets under `.coding-agent-harness/presets/`.
87
+ This dotdir is a preset overlay exception: operational task state lives under
88
+ `coding-agent-harness/`, while preset packages keep their existing overlay root
89
+ so user and project preset precedence remains stable across upgrades.
87
90
  The `preset-creator` Skill is for authoring these preset packages; the Harness
88
91
  CLI is what checks, installs, lists, and applies them.
89
92
 
93
+ Default task and module templates come from the installed npm package at command
94
+ runtime. Target projects should not treat `planning/**/_task-template` or
95
+ `planning/**/_module-template` directories as active state; v2 structure
96
+ migration removes those generated legacy template directories when it finds
97
+ them.
98
+
90
99
  ### Safe Migration For Existing Projects
91
100
 
92
101
  Legacy project migration starts with a scan, a migration plan, a recommended migration mode, and user confirmation. Only then should the agent write files. Final status is proven with a dashboard and checks.
@@ -160,9 +169,47 @@ The npm install seeds bundled presets into `~/.coding-agent-harness/presets/`.
160
169
  `harness init` also seeds those presets into the target project at
161
170
  `.coding-agent-harness/presets/`, so agents can discover stable task methods
162
171
  with `harness preset list --json`.
172
+ The `.coding-agent-harness/presets/` location is intentionally retained for
173
+ preset overlays; it is not a legacy task-state directory.
163
174
 
164
175
  Agents must not silently run a global install. They may run `npm install -g coding-agent-harness` only after the user explicitly approves changing the global npm environment. Without that approval, keep using `npx --yes coding-agent-harness ...`.
165
176
 
177
+ ### Harness State Location
178
+
179
+ By default, `harness init` and `harness migrate-structure --apply` write active
180
+ Harness state under `coding-agent-harness/` in the target project:
181
+
182
+ ```text
183
+ coding-agent-harness/harness.yaml
184
+ coding-agent-harness/planning/tasks/
185
+ coding-agent-harness/governance/
186
+ ```
187
+
188
+ Checks and dashboards are not tied to that exact folder name. A project can keep
189
+ Harness state in a custom project-relative directory by placing `harness.yaml`
190
+ there and declaring the same path in `structure.harnessRoot`. For example:
191
+
192
+ ```yaml
193
+ version: 2
194
+ locale: zh-CN
195
+ capabilities:
196
+ - core
197
+ - dashboard
198
+ structure:
199
+ harnessRoot: .project-control/harness-state
200
+ planningRoot: .project-control/harness-state/planning
201
+ tasksRoot: .project-control/harness-state/planning/tasks
202
+ governanceRoot: .project-control/harness-state/governance
203
+ generatedRoot: .project-control/harness-state/governance/generated
204
+ ```
205
+
206
+ After that, these are equivalent when the manifest is unique under the project:
207
+
208
+ ```bash
209
+ npx --yes coding-agent-harness status --json /path/to/project
210
+ npx --yes coding-agent-harness status --json /path/to/project/.project-control/harness-state
211
+ ```
212
+
166
213
  ### Commands For Humans
167
214
 
168
215
  Initialize a Chinese Harness:
@@ -222,7 +269,7 @@ Use Chinese templates by default. If the project is clearly an English team or E
222
269
 
223
270
  First diagnose the project structure, then give me an initialization plan.
224
271
  If this is a microservice, multi-repo, split frontend/backend, or externally integrated project, proactively ask me whether I have external architecture docs, API docs, diagrams, meeting notes, links, source paths, or exported packets.
225
- If the external material is large, create an external-source-packs index and digests first, then project stable conclusions into 03-ARCHITECTURE / 04-DEVELOPMENT / 06-INTEGRATIONS.
272
+ If the external material is large, create an external-source-packs index and digests first, then project stable conclusions into coding-agent-harness/context/{architecture,development,integrations}.
226
273
  After confirmation, execute Diagnose → Decide → Scaffold → Configure → Verify → Deliver.
227
274
  When initializing, run:
228
275
  npx --yes coding-agent-harness init --locale zh-CN --capabilities core,dashboard .
@@ -263,7 +310,7 @@ This project already has an older Harness. Do not edit files yet.
263
310
 
264
311
  First run a detailed scan and give me a migration plan:
265
312
  1. Check git status, Harness status, task count, brief coverage, visual_map coverage, warnings/actions/residuals, strict status, and dashboard usability.
266
- 2. If this is a microservice, multi-repo, split frontend/backend, or externally integrated project, proactively ask me for external source material; when the material is large, create an external-source-packs index and digests before projecting facts into 03/04/06.
313
+ 2. If this is a microservice, multi-repo, split frontend/backend, or externally integrated project, proactively ask me for external source material; when the material is large, create an external-source-packs index and digests before projecting facts into context/{architecture,development,integrations}.
267
314
  3. Recommend the migration mode from project evidence:
268
315
  - baseline-preserve: safe adoption first; only add necessary structure and visibility.
269
316
  - status-aware-rewrite: rewrite current or reopened tasks from SSoT, Ledger, progress, review, and git evidence.
@@ -274,6 +321,19 @@ First run a detailed scan and give me a migration plan:
274
321
  During the scan phase, run at least:
275
322
  npx --yes coding-agent-harness status --json .
276
323
  npx --yes coding-agent-harness migrate-plan --json --limit 1000 .
324
+ npx --yes coding-agent-harness migrate-structure --plan --json .
325
+
326
+ After I confirm the migration mode, first migrate the directory structure to the
327
+ v2 manifest layout, then run the migration rail and verify it:
328
+ npx --yes coding-agent-harness migrate-structure --apply --json .
329
+ npx --yes coding-agent-harness check --profile target-project .
330
+ npx --yes coding-agent-harness migrate-run --locale zh-CN --session-dir /tmp/cah-migration-project --out-dir /tmp/cah-migration-project/dashboard .
331
+ npx --yes coding-agent-harness migrate-verify /tmp/cah-migration-project/session.json
332
+
333
+ Then create the controlled migration task with the bundled preset:
334
+ npx --yes coding-agent-harness new-task --budget complex --preset legacy-migration --from-session /tmp/cah-migration-project/session.json .
335
+
336
+ Do not skip the `legacy-migration` preset task. It records the migration session, evidence bundle, preset audit, and follow-up work queue in the project Harness. It does not automatically rewrite historical task bodies.
277
337
 
278
338
  When the migration is complete, report the dynamic workbench URL or static dashboard HTML, session.json, normal/strict checks, migrate-plan summary, and whether full-cutover verification passes. If human review confirmation is required, expose that action in the local web workbench; static dashboards are read-only evidence snapshots.
279
339
  ```
@@ -291,7 +351,7 @@ Start from the latest main branch and create a new feature branch. Read README.m
291
351
 
292
352
  Keep the change scoped. Use only public repository files and do not rely on maintainer-local state, hidden workflows, credentials, generated dashboards, temporary files, or ignored local-only files.
293
353
 
294
- Run the checks that match the change. For docs-only changes, run git diff --check. For root package changes, run npm install, npm test, npm run smoke:dashboard, npm run check, node scripts/harness.mjs check --profile target-project examples/minimal-project, npm run pack:dry-run, and git diff --check as relevant. If the change touches harness-gui, also run cd harness-gui && npm ci && npm run typecheck && npm test && npm run build.
354
+ Run the checks that match the change. For docs-only changes, run git diff --check. For root package changes, run npm install, npm test, npm run smoke:dashboard, npm run check, node dist/harness.mjs check --profile target-project examples/minimal-project, npm run pack:dry-run, and git diff --check as relevant. If the change touches harness-gui, also run cd harness-gui && npm ci && npm run typecheck && npm test && npm run build.
295
355
 
296
356
  When done, summarize what changed, list verification results, call out any skipped checks with reasons, and prepare the PR using the repository template.
297
357
  ```
package/README.zh-CN.md CHANGED
@@ -83,6 +83,9 @@ Harness 自带内置 Preset,`harness init` 会把它们 seed 到目标项目
83
83
  `.coding-agent-harness/presets/` 下维护项目级 Preset。`preset-creator` Skill 用来制作
84
84
  这些 Preset 包;真正检查、安装、列出和应用 Preset 的是 Harness CLI。
85
85
 
86
+ 默认任务模板和模块模板来自当前安装的 npm 包,在命令运行时读取。目标项目不应该把
87
+ `planning/**/_task-template` 或 `planning/**/_module-template` 当作活跃状态;v2 结构迁移发现这些旧生成模板目录时会直接清理。
88
+
86
89
  ### 旧项目也能迁移
87
90
 
88
91
  旧项目迁移不是直接套模板。标准流程是:先扫描项目,生成迁移计划,推荐迁移模式,向用户提问确认,再执行迁移,最后用 Dashboard 和检查结果证明迁移状态。
@@ -158,6 +161,40 @@ npm 安装会把内置 Preset seed 到 `~/.coding-agent-harness/presets/`。
158
161
 
159
162
  Agent 不应静默执行全局安装。只有用户明确同意修改全局 npm 环境后,Agent 才能运行 `npm install -g coding-agent-harness`;否则继续使用 `npx --yes coding-agent-harness ...`。
160
163
 
164
+ ### Harness 状态目录
165
+
166
+ 默认情况下,`harness init` 和 `harness migrate-structure --apply` 会把活跃
167
+ Harness 状态写到目标项目里的 `coding-agent-harness/`:
168
+
169
+ ```text
170
+ coding-agent-harness/harness.yaml
171
+ coding-agent-harness/planning/tasks/
172
+ coding-agent-harness/governance/
173
+ ```
174
+
175
+ 检查和 Dashboard 不绑定这个固定目录名。项目可以把 Harness 状态放在自定义的项目相对目录里,只要在那个目录放 `harness.yaml`,并在 `structure.harnessRoot` 里声明同一个路径。例如:
176
+
177
+ ```yaml
178
+ version: 2
179
+ locale: zh-CN
180
+ capabilities:
181
+ - core
182
+ - dashboard
183
+ structure:
184
+ harnessRoot: .project-control/harness-state
185
+ planningRoot: .project-control/harness-state/planning
186
+ tasksRoot: .project-control/harness-state/planning/tasks
187
+ governanceRoot: .project-control/harness-state/governance
188
+ generatedRoot: .project-control/harness-state/governance/generated
189
+ ```
190
+
191
+ 只要项目里只有一个这样的 manifest,下面两种写法等价:
192
+
193
+ ```bash
194
+ npx --yes coding-agent-harness status --json /path/to/project
195
+ npx --yes coding-agent-harness status --json /path/to/project/.project-control/harness-state
196
+ ```
197
+
161
198
  ### 人看的常用命令
162
199
 
163
200
  初始化一个中文 Harness:
@@ -213,7 +250,7 @@ npx --yes coding-agent-harness <command>
213
250
 
214
251
  请先诊断项目结构,再给出初始化计划。
215
252
  如果项目是微服务、多仓、前后端分仓,或依赖外部系统,请主动询问我是否有外部架构文档、接口文档、流程图、会议纪要、链接或导出包。
216
- 外部资料很多时,请先建立 external-source-packs 索引和摘要,再把稳定结论投影到 03-ARCHITECTURE / 04-DEVELOPMENT / 06-INTEGRATIONS
253
+ 外部资料很多时,请先建立 external-source-packs 索引和摘要,再把稳定结论投影到 coding-agent-harness/context/{architecture,development,integrations}
217
254
  确认后,按照 Diagnose → Decide → Scaffold → Configure → Verify → Deliver 六阶段执行。
218
255
  执行初始化时使用:
219
256
  npx --yes coding-agent-harness init --locale zh-CN --capabilities core,dashboard .
@@ -254,7 +291,7 @@ npx --yes coding-agent-harness <command>
254
291
 
255
292
  请先执行详尽扫描,并给我一个迁移计划:
256
293
  1. 检查当前 git 状态、Harness 状态、任务数量、brief 覆盖、visual_map 覆盖、warning/action/residual、strict 状态和 dashboard 可用性。
257
- 2. 如果项目是微服务、多仓、前后端分仓,或依赖外部系统,主动询问我是否有外部资料;资料很多时先建立 external-source-packs 索引和摘要,再投影到 03/04/06
294
+ 2. 如果项目是微服务、多仓、前后端分仓,或依赖外部系统,主动询问我是否有外部资料;资料很多时先建立 external-source-packs 索引和摘要,再投影到 context/{architecture,development,integrations}
258
295
  3. 根据项目证据主动推荐迁移模式:
259
296
  - baseline-preserve:先安全接入,只补必要结构和可见性。
260
297
  - status-aware-rewrite:按 SSoT、Ledger、progress、review、git 证据重写当前或重新打开的任务。
@@ -265,6 +302,18 @@ npx --yes coding-agent-harness <command>
265
302
  扫描阶段至少运行:
266
303
  npx --yes coding-agent-harness status --json .
267
304
  npx --yes coding-agent-harness migrate-plan --json --limit 1000 .
305
+ npx --yes coding-agent-harness migrate-structure --plan --json .
306
+
307
+ 等我确认迁移模式后,先把目录结构迁到 v2 manifest 布局,再执行迁移轨道并验证:
308
+ npx --yes coding-agent-harness migrate-structure --apply --json .
309
+ npx --yes coding-agent-harness check --profile target-project .
310
+ npx --yes coding-agent-harness migrate-run --locale zh-CN --session-dir /tmp/cah-migration-project --out-dir /tmp/cah-migration-project/dashboard .
311
+ npx --yes coding-agent-harness migrate-verify /tmp/cah-migration-project/session.json
312
+
313
+ 然后用内置 preset 创建受控迁移任务:
314
+ npx --yes coding-agent-harness new-task --budget complex --preset legacy-migration --from-session /tmp/cah-migration-project/session.json .
315
+
316
+ 不要跳过 `legacy-migration` preset 任务。它会把 migration session、证据包、preset audit 和后续 work queue 记录进项目 Harness;它不会自动重写历史任务正文。
268
317
 
269
318
  最终迁移完成时,必须给出动态 workbench 入口或静态 dashboard HTML、session.json、normal/strict check、migrate-plan summary,以及 full-cutover 验证是否通过。需要人工确认审查时,必须通过本地网页 workbench 暴露确认操作;静态 dashboard 只作为只读证据快照。
270
319
  ```
@@ -282,7 +331,7 @@ npx --yes coding-agent-harness migrate-plan --json --limit 1000 .
282
331
 
283
332
  改动要保持聚焦。只使用公开仓库文件;不要依赖维护者本地状态、隐藏工作流、凭据、生成的 Dashboard、临时文件或被 ignore 的本地专用文件。
284
333
 
285
- 根据改动范围运行检查。仅文档改动至少运行 git diff --check。根包相关改动按需运行 npm install、npm test、npm run smoke:dashboard、npm run check、node scripts/harness.mjs check --profile target-project examples/minimal-project、npm run pack:dry-run 和 git diff --check。如果改到 harness-gui,还要运行 cd harness-gui && npm ci && npm run typecheck && npm test && npm run build。
334
+ 根据改动范围运行检查。仅文档改动至少运行 git diff --check。根包相关改动按需运行 npm install、npm test、npm run smoke:dashboard、npm run check、node dist/harness.mjs check --profile target-project examples/minimal-project、npm run pack:dry-run 和 git diff --check。如果改到 harness-gui,还要运行 cd harness-gui && npm ci && npm run typecheck && npm test && npm run build。
286
335
 
287
336
  完成后,请总结改了什么,列出验证结果,说明任何未运行检查及原因,并按仓库 PR 模板准备 PR。
288
337
  ```
package/SKILL.md CHANGED
@@ -3,9 +3,9 @@ name: coding-agent-harness
3
3
  description: >
4
4
  Coding Agent Harness 工程方法论。为使用 Coding Agent(Codex、Claude Code、Gemini CLI 等)
5
5
  做长程项目开发的团队,在用户的项目上构建一套完整的 harness 工程体系。
6
- 包括:项目诊断、AGENTS.md + CLAUDE.md 入口文件生成、docs/ 目录搭建、Planning Loop、SSoT 治理、
6
+ 包括:项目诊断、AGENTS.md + CLAUDE.md 入口文件生成、coding-agent-harness/ 目录搭建、Planning Loop、SSoT 治理、
7
7
  Delivery Operating Model、Repository Governance、CI/CD、Long-Running Task Protocol、Adversarial Review Report、Review Routing、Worktree 并行开发、
8
- Regression SSoT 与 Evidence Depth 分级回归、Walkthrough / Closeout SSoT 收口、Cadence Ledger、任务本地 lesson 候选与 promoted lesson 详情文档、
8
+ Regression SSoT 与 Evidence Depth 分级回归、Walkthrough / Closeout Index 收口、Cadence Ledger、任务本地 lesson 候选与 promoted lesson 详情文档、
9
9
  Harness Ledger 全局上下文回写总账。
10
10
  当用户要求设置 coding agent 的开发流程、建立回归测试体系、设计 AGENTS.md / CLAUDE.md、
11
11
  规划长程 agent 任务的执行框架、子代理审查循环、对抗性 review 报告、搭建 harness、或者提到 harness engineering 时,使用此技能。
@@ -24,7 +24,7 @@ description: >
24
24
  - **单元测试只是底线,不是保障。** 真正的保障需要多层证据(Evidence Depth)。
25
25
  - **先识别交付组织,再设计 harness。** 一人多 agent、多人团队、前后端分仓、program 多仓、敏捷/瀑布,对应的 SSoT 和冲突治理不同。
26
26
  - **Repo 护栏是地基。** CI/CD、PR policy、branch protection、required checks、worktree concurrency 必须项目级定制,不能停留在模板。
27
- - **外部资料先摄取,再投影。** 微服务或多仓项目的外部文档不能直接塞进执行文档;先建 source pack、digest、验证,再投影到 `03/04/06`。
27
+ - **外部资料先摄取,再投影。** 微服务或多仓项目的外部文档不能直接塞进执行文档;先建 source pack、digest、验证,再投影到 `context/{architecture,development,integrations}`。
28
28
  - **长程任务先设计合同,再开放执行。** 连续跑数小时的前提是 Goal、Scope、Review Loop、Evidence、Stop Condition 都清楚。
29
29
  - **审查必须落盘。** 对抗性 review 是独立交付物,不应只留在对话、progress 或 walkthrough 里;reviewer 必须用 Confidence Challenge 反复挑战方案,直到没有 open material finding。
30
30
  - **Worker handoff 必须 commit-backed。** 可写 subagent 不是 reviewer;它必须在独立 worktree / branch 内实现、验证并提交,再由 coordinator 集成。
@@ -39,7 +39,7 @@ description: >
39
39
  coding-agent-harness",不要重新 bootstrap 覆盖整个项目。先执行增量更新流程:
40
40
 
41
41
  1. 读取本 Skill 的最新版 `SKILL.md`、相关 `references/`、`templates/`。
42
- 2. 扫描目标项目现有 `AGENTS.md`、`CLAUDE.md`、`docs/` 和 SSoT / Ledger 文件。
42
+ 2. 扫描目标项目现有 `AGENTS.md`、`CLAUDE.md`、`coding-agent-harness/` 和 SSoT / Ledger 文件。
43
43
  3. 输出 delta plan:哪些 harness 骨架、reference、template、SSoT、Ledger 项缺失或过期。
44
44
  4. 只补齐新增标准和缺失结构;不得用模板覆盖已有业务事实、历史 walkthrough、
45
45
  task progress、generated ledger、Regression SSoT 或 lesson detail docs。
@@ -48,8 +48,8 @@ coding-agent-harness",不要重新 bootstrap 覆盖整个项目。先执行增
48
48
  7. 收口时写 walkthrough,必须包含 Lessons Reflection;新任务先写并审查
49
49
  `lesson_candidates.md`。如人工标记值得沉淀,默认先用 dry-run 或后续
50
50
  lesson sedimentation 任务完成分类、冲突检查和建议 diff;只有人工明确批准后,
51
- 维护命令才写 `docs/01-GOVERNANCE/lessons/` 详情文档;最后在
52
- `docs/Harness-Ledger.md` 与 `docs/10-WALKTHROUGH/Closeout-SSoT.md` 记录本次 harness update 的 delta 和 Lessons Check。
51
+ 维护命令才写 `coding-agent-harness/governance/lessons/` 详情文档;最后在
52
+ `coding-agent-harness/governance/generated/Harness-Ledger.md` 与 `coding-agent-harness/governance/generated/Closeout-Index.md` 记录本次 harness update 的 delta 和 Lessons Check。
53
53
 
54
54
  一句话:harness update 是 delta merge,不是重新搭一遍。
55
55
 
@@ -64,7 +64,7 @@ CLI 示例默认使用目标项目可调用的 `harness` 命令。执行前先
64
64
  `command -v harness`;如果没有,不要静默全局安装,按安装指南询问用户是否
65
65
  允许 `npm install -g coding-agent-harness`。未获明确同意时,用
66
66
  `npx --yes coding-agent-harness <command>` 执行同一条命令。只有维护本源码
67
- checkout 时,才把 `harness` 替换为 `node scripts/harness.mjs`。
67
+ checkout 时,才把 `harness` 替换为 `node dist/harness.mjs`。
68
68
 
69
69
  ### Agent 安装合同
70
70
 
@@ -78,7 +78,7 @@ checkout 时,才把 `harness` 替换为 `node scripts/harness.mjs`。
78
78
  明确配置中推断 locale,并显式传 `--locale`。如果无法判断,先暂停询问。
79
79
  - 中文用户或中文项目默认选择 `zh-CN`;英文团队、英文代码库或用户明确要求英文时选择
80
80
  `en-US`。
81
- - scaffold 后必须检查 `.harness-capabilities.json` 的 `locale`,并确认 dashboard、
81
+ - scaffold 后必须检查 `coding-agent-harness/harness.yaml` 的 `locale`,并确认 dashboard、
82
82
  task template、review template 来自同一套模板树。
83
83
  - `templates/` 和 `templates-zh-CN/` 是两套完整模板树。不要在目标项目里混拷两套模板;
84
84
  只允许保留 schema 字段、文件名、状态枚举、命令和跨工具协议 token 的英文。
@@ -105,9 +105,10 @@ SDK、API gateway、message queue、webhook、contract、schema、mock,必须
105
105
  split-repo-contract、program-multi-repo、waterfall-stage-gate 或
106
106
  kanban-continuous。
107
107
  3. Capability Packs:core 必装;按需选择 module-parallel、subagent-worker、
108
- adversarial-review、long-running-task、dashboard、safe-adoption。
108
+ adversarial-review、long-running-task、dashboard。旧项目先用
109
+ `migrate-structure --plan/--apply` 迁到 v2,不再通过兼容 capability 长期运行。
109
110
  4. External Source Intake:如果外部资料超过 5 份、跨多个主题或会持续增长,
110
- 决定是否创建 `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`。
111
+ 决定是否创建 `coding-agent-harness/context/development/external-source-packs/<source-key>/`。
111
112
 
112
113
  Capability 选择规则必须按表执行,不得凭感觉多装:
113
114
 
@@ -115,7 +116,6 @@ Capability 选择规则必须按表执行,不得凭感觉多装:
115
116
  | --- | --- |
116
117
  | `core` | 永远安装。它是任务计划、回归、walkthrough、Lessons 和 Harness Ledger 的最小内核。 |
117
118
  | `dashboard` | 用户或 agent 需要本地只读状态页时安装。它不写目标项目文件。 |
118
- | `safe-adoption` | 只在已有旧 harness 项目接入 v1.0、且需要保留历史文档时安装。新项目默认不装。 |
119
119
  | `adversarial-review` | 发布、架构、安全、数据、策略风险需要独立 review artifact 时安装。 |
120
120
  | `long-running-task` | 用户允许 agent 多轮连续执行、不能每步都询问时安装。 |
121
121
  | `module-parallel` | 项目有 2 个以上可独立演进模块,且需要模块 owner / registry / 同步规则时安装。 |
@@ -127,7 +127,7 @@ Capability 选择规则必须按表执行,不得凭感觉多装:
127
127
 
128
128
  运行或模拟 `harness init --locale zh-CN|en-US --capabilities ...`。面向 agent 的安装
129
129
  必须显式传 `--locale`;只有人直接在终端运行且未传 `--locale` 时,CLI 才交互询问。CLI 只创建
130
- 目录、模板、空表、索引和 `.harness-capabilities.json`,不得把项目级 reference
130
+ 目录、模板、空表、索引和 `coding-agent-harness/harness.yaml`,不得把项目级 reference
131
131
  伪装成已经定制完成的标准。
132
132
 
133
133
  CLI 会在 JSON 输出中返回 `report`。Agent 必须读取这份 report,并把其中的
@@ -144,8 +144,8 @@ worktree/subagent handoff 规则。已有项目事实只能 merge/append/residua
144
144
  如果用户提供了外部资料,Configure 阶段必须按
145
145
  `external-source-intake-standard.md` 执行:Inventory、Classify、Sanitize、Digest、
146
146
  Project、Verify、Residual。`external-source-packs/` 只保存资料索引、摘要和投影状态;
147
- 稳定事实必须回写到 `03-ARCHITECTURE`、`04-DEVELOPMENT/external-context` 或
148
- `06-INTEGRATIONS`。
147
+ 稳定事实必须回写到 `coding-agent-harness/context/architecture`、`coding-agent-harness/context/development/external-context` 或
148
+ `coding-agent-harness/context/integrations`。
149
149
 
150
150
  ### Phase 4b: Task Lifecycle / 任务生命周期
151
151
 
@@ -171,7 +171,7 @@ harness task-list --json /path/to/project
171
171
  - 状态推进只写 `progress.md`,不得重写历史 `task_plan.md`。
172
172
  - `simple` 任务可以直接 `in_progress -> done`;`standard` / `complex` 必须 `in_progress -> review -> done`,不能跳过 `task-review`。
173
173
  - `task-review` 只表示 Agent Review Submission:agent/coordinator 认为材料包已准备好并提交待审。它不是人工确认。
174
- - `review-confirm` 是唯一的 Human Review Confirmation 门禁。它只确认人工 review evidence / findings,不代表 closeout;closeout 仍走 walkthrough / Closeout SSoT
174
+ - `review-confirm` 是唯一的 Human Review Confirmation 门禁。它只确认人工 review evidence / findings,不代表 closeout;closeout 仍走 walkthrough / Closeout Index
175
175
  - Review queue 只收录已提交 review packet、材料齐全、无 blocker、等待人工确认的任务。
176
176
  - 缺文件、缺章节、缺证据、缺 lesson decision 或未执行 `task-review` 的任务进入 Missing Materials 队列,不进入 Review queue。
177
177
  - open blocking finding、状态矛盾、审计失败或需要 human waiver 的任务进入 Blocked 队列,不进入 Review queue。
@@ -193,8 +193,8 @@ harness status --json /path/to/project
193
193
 
194
194
  | 回归路径 | 必须证明 |
195
195
  | --- | --- |
196
- | 新项目初始化 | 空项目 `init --locale zh-CN|en-US --capabilities core,...` 后,模板语言一致、registry 正确、`status --json` 不误报 `safe-adoption`。 |
197
- | 老项目迁移 | 已有旧 harness 文档的项目 `add-capability safe-adoption --locale ...` 后,旧 `AGENTS.md`、`CLAUDE.md`、`Harness-Ledger` 和历史 task 不被覆盖;缺失 v1.0 模板被补齐;普通检查只给 `adoption-needed` warning;`--strict` 仍可阻塞历史合同缺口。 |
196
+ | 新项目初始化 | 空项目 `init --locale zh-CN|en-US --capabilities core,...` 后,模板语言一致、v2 manifest 正确、`status --json` 通过。 |
197
+ | 老项目迁移 | 已有旧 harness 文档的项目先 `migrate-structure --plan`,再 `migrate-structure --apply`;旧 `coding-agent-harness/` legacy registry active root 移走或归档;迁移后 `status/check/dashboard` 只读 v2 路径。 |
198
198
 
199
199
  检查失败时不能声称 harness complete;必须修复或记录 owner/action/status 明确的
200
200
  residual。
@@ -237,33 +237,33 @@ harness bootstrap 完成后,项目中至少应存在以下文件:
237
237
 
238
238
  - [ ] `AGENTS.md`,默认 80-160 行,宪章 + 阅读矩阵,不承载安装教程
239
239
  - [ ] `CLAUDE.md`,Claude Code 兼容 shim,指向 `AGENTS.md`(不复制完整规范)
240
- - [ ] `docs/11-REFERENCE/` 下至少 3 个标准文件
241
- - [ ] `docs/09-PLANNING/TASKS/_task-template/` 包含 task plan / findings / progress / review 模板
242
- - [ ] `docs/11-REFERENCE/delivery-operating-model-standard.md`
243
- - [ ] `docs/11-REFERENCE/repo-governance-standard.md`
244
- - [ ] `docs/11-REFERENCE/ci-cd-standard.md`
245
- - [ ] `docs/11-REFERENCE/long-running-task-standard.md`
246
- - [ ] `docs/11-REFERENCE/adversarial-review-standard.md`
247
- - [ ] `docs/11-REFERENCE/review-routing-standard.md`
248
- - [ ] `docs/09-PLANNING/TASKS/_task-template/long-running-task-contract.md`
249
- - [ ] `docs/09-PLANNING/TASKS/_task-template/review.md`
250
- - [ ] `docs/05-TEST-QA/Regression-SSoT.md`
251
- - [ ] `docs/05-TEST-QA/Cadence-Ledger.md`
252
- - [ ] `docs/10-WALKTHROUGH/_walkthrough-template.md`
253
- - [ ] `docs/10-WALKTHROUGH/Closeout-SSoT.md`
254
- - [ ] `docs/01-GOVERNANCE/lessons/`(空目录 + .gitkeep)
255
- - [ ] `docs/01-GOVERNANCE/_archive/`(空目录 + .gitkeep)
256
- - [ ] `docs/Harness-Ledger.md`
257
- - [ ] `docs/11-REFERENCE/external-source-intake-standard.md`
258
- - [ ] `docs/11-REFERENCE/harness-ledger-standard.md`
240
+ - [ ] `coding-agent-harness/governance/standards/` 下至少 3 个标准文件
241
+ - [ ] `coding-agent-harness/planning/tasks/_task-template/` 包含 task plan / findings / progress / review 模板
242
+ - [ ] `coding-agent-harness/governance/standards/delivery-operating-model-standard.md`
243
+ - [ ] `coding-agent-harness/governance/standards/repo-governance-standard.md`
244
+ - [ ] `coding-agent-harness/governance/standards/ci-cd-standard.md`
245
+ - [ ] `coding-agent-harness/governance/standards/long-running-task-standard.md`
246
+ - [ ] `coding-agent-harness/governance/standards/adversarial-review-standard.md`
247
+ - [ ] `coding-agent-harness/governance/standards/review-routing-standard.md`
248
+ - [ ] `coding-agent-harness/planning/tasks/_task-template/long-running-task-contract.md`
249
+ - [ ] `coding-agent-harness/planning/tasks/_task-template/review.md`
250
+ - [ ] `coding-agent-harness/governance/regression/Regression-SSoT.md`
251
+ - [ ] `coding-agent-harness/governance/regression/Cadence-Ledger.md`
252
+ - [ ] `coding-agent-harness/governance/standards/walkthrough-template.md`
253
+ - [ ] `coding-agent-harness/governance/generated/Closeout-Index.md`
254
+ - [ ] `coding-agent-harness/governance/lessons/`(空目录 + .gitkeep)
255
+ - [ ] `coding-agent-harness/governance/_archive/`(空目录 + .gitkeep)
256
+ - [ ] `coding-agent-harness/governance/generated/Harness-Ledger.md`
257
+ - [ ] `coding-agent-harness/governance/standards/external-source-intake-standard.md`
258
+ - [ ] `coding-agent-harness/governance/standards/harness-ledger-standard.md`
259
259
  - [ ] `.github/pull_request_template.md` 或 platform-specific PR template / residual
260
260
  - [ ] CI workflow 或 `ci-cd-standard.md` 中的 blocked-with-owner residual
261
261
  - [ ] Branch protection plan 和 required checks 状态
262
262
  - [ ] Worktree concurrency policy
263
- - [ ] Delivery operating model 已选择;多人/多仓模式下有 `docs/09-PLANNING/Delivery-SSoT.md`
264
- - [ ] 如启用模块并行:`docs/09-PLANNING/Module-Registry.md`
265
- - [ ] 如启用模块并行:`docs/09-PLANNING/MODULES/Session-Prompt-Pack.md` 或每模块 `session_prompt.md`
266
- - [ ] 如启用模块并行:每个 active module 有 `docs/09-PLANNING/MODULES/<key>/module_plan.md`
263
+ - [ ] Delivery operating model 已选择;多人/多仓模式下有 `coding-agent-harness/planning/Delivery-SSoT.md`
264
+ - [ ] 如启用模块并行:`coding-agent-harness/planning/modules/Module-Registry.md`
265
+ - [ ] 如启用模块并行:`coding-agent-harness/planning/modules/Session-Prompt-Pack.md` 或每模块 `session_prompt.md`
266
+ - [ ] 如启用模块并行:每个 active module 有 `coding-agent-harness/planning/modules/<key>/module_plan.md`
267
267
  - [ ] 如启用模块并行:模块 task template / shared lock / dependency readiness 规则已落地
268
268
  - [ ] Harness checker 已通过,或 residual 写明 owner/action/status
269
269
  - [ ] Bootstrap Summary 已输出给用户
@@ -286,7 +286,7 @@ harness 搭建完成后,每个 feature 从想法到代码的标准流程:
286
286
  10. **Review Routing** — planned task 收口前自动触发 subagent / reviewer 审查,或记录 skip reason;Review queue 只等待 Human Review Confirmation,缺材料和 blocker 分别进入 Missing Materials / Blocked 队列
287
287
  11. **Merge + 自动回归** — Cadence Ledger 触发对应回归面;coordinator 只集成 worker commit,不混合多个 worker 的未提交改动
288
288
  12. **Walkthrough 收口** — 写收口记录并引用 review report
289
- 13. **Closeout SSoT 回写** — 每个 closed 任务必须记录 walkthrough 路径或受控 skip reason
289
+ 13. **Closeout Index 回写** — 每个 closed 任务必须记录 walkthrough 路径或受控 skip reason
290
290
  14. **Lessons Reflection** — 写 walkthrough 时主动反思共性/反复问题;新任务用 `lesson_candidates.md` 承载人工判定,`queued-promotion` 进入 Lessons 队列;默认先 dry-run 或创建沉淀任务,不直接写共享 Lessons 表;`checked-created` 必须有 promoted lesson 详情文档,旧任务兼容的 `checked-none` 必须写明原因
291
291
  15. **Generated Ledger 刷新** — 由 lifecycle CLI 或 `harness governance rebuild` 生成任务生命周期总索引
292
292
  16. **Worktree 清理** — 删除已 merge 的 worktree
@@ -316,7 +316,7 @@ harness 搭建完成后,每个 feature 从想法到代码的标准流程:
316
316
  | Harness Ledger | `references/harness-ledger.md` | 理解 generated task lifecycle ledger 与非任务治理表边界时 |
317
317
  | Regression | `references/regression-system.md` | 设计或更新回归面、evidence depth 和 gate 时 |
318
318
  | Cadence Ledger | `references/cadence-ledger.md` | 根据改动类型触发回归批次时 |
319
- | Walkthrough | `references/walkthrough-closeout.md` | 收口、Closeout SSoT 和交付说明时 |
319
+ | Walkthrough | `references/walkthrough-closeout.md` | 收口、Closeout Index 和交付说明时 |
320
320
  | Worktree | `references/worktree-parallel.md` | 并行开发、worker handoff 或隔离分支时 |
321
321
 
322
322
  ## Template 索引
@@ -339,7 +339,7 @@ harness 搭建完成后,每个 feature 从想法到代码的标准流程:
339
339
  | Long-Running Task Contract | `templates/planning/long-running-task-contract.md` | 长程任务授权、review loop 和停止条件 |
340
340
  | Module Session Prompt | `templates/planning/module_session_prompt.md` | 模块并行开发会话冷启动 |
341
341
  | Walkthrough | `templates/walkthrough/walkthrough-template.md` | 任务收口记录 |
342
- | Closeout SSoT | `templates/walkthrough/Closeout-SSoT.md` | closed task 索引和收口证据 |
342
+ | Closeout Index | `templates/walkthrough/walkthrough-template.md` | closed task 索引和收口证据 |
343
343
  | Testing Standard | `templates/reference/testing-standard.md` | 测试、冒烟和回归规范 |
344
344
  | Execution Workflow | `templates/reference/execution-workflow-standard.md` | 执行、提交、PR 和证据记录 |
345
345
  | Delivery Operating Model Standard | `templates/reference/delivery-operating-model-standard.md` | 交付组织模型选择 |
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+ import fs from "node:fs";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { spawnSync } from "node:child_process";
7
+ import { fileURLToPath } from "node:url";
8
+ const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
9
+ const typescriptVersion = "5.9.3";
10
+ export function buildRuntimeDist({ projectRoot = repoRoot, configPath = path.join(projectRoot, "tsconfig.dist.json"), outDir = path.join(projectRoot, "dist"), } = {}) {
11
+ const absoluteProjectRoot = path.resolve(projectRoot);
12
+ const absoluteConfig = path.resolve(configPath);
13
+ const absoluteOutDir = path.resolve(outDir);
14
+ const defaultDist = path.join(absoluteProjectRoot, "dist");
15
+ const buildOutDir = absoluteOutDir === defaultDist
16
+ ? fs.mkdtempSync(path.join(os.tmpdir(), "coding-agent-harness-dist-build-"))
17
+ : absoluteOutDir;
18
+ if (!fs.existsSync(absoluteConfig)) {
19
+ return {
20
+ ok: false,
21
+ error: `dist build config not found: ${absoluteConfig}`,
22
+ };
23
+ }
24
+ if (isDangerousOutDir({ projectRoot: absoluteProjectRoot, outDir: absoluteOutDir })) {
25
+ return {
26
+ ok: false,
27
+ error: `refusing to clean unsafe dist output directory: ${absoluteOutDir}`,
28
+ };
29
+ }
30
+ fs.rmSync(buildOutDir, { recursive: true, force: true });
31
+ const emit = spawnSync("npm", ["exec", "--yes", "--package", `typescript@${typescriptVersion}`, "--", "tsc", "-p", absoluteConfig, "--outDir", buildOutDir, "--noCheck"], {
32
+ cwd: absoluteProjectRoot,
33
+ encoding: "utf8",
34
+ });
35
+ if (emit.status !== 0) {
36
+ return {
37
+ ok: false,
38
+ error: `TypeScript dist build failed\nSTDOUT:\n${emit.stdout}\nSTDERR:\n${emit.stderr}`,
39
+ status: emit.status,
40
+ };
41
+ }
42
+ if (buildOutDir !== absoluteOutDir) {
43
+ syncDirectory(buildOutDir, absoluteOutDir);
44
+ fs.rmSync(buildOutDir, { recursive: true, force: true });
45
+ }
46
+ const files = collectFiles(absoluteOutDir).filter((file) => file.endsWith(".mjs")).sort();
47
+ const relativeFiles = files.map((file) => toPosix(path.relative(absoluteOutDir, file)));
48
+ const requiredFiles = [
49
+ "harness.mjs",
50
+ "postinstall.mjs",
51
+ "lib/harness-core.mjs",
52
+ "commands/task-command.mjs",
53
+ ];
54
+ const missingFiles = requiredFiles.filter((file) => !relativeFiles.includes(file));
55
+ if (missingFiles.length > 0) {
56
+ return {
57
+ ok: false,
58
+ error: `dist build missing required runtime files: ${missingFiles.join(", ")}`,
59
+ outDir: absoluteOutDir,
60
+ files: relativeFiles,
61
+ };
62
+ }
63
+ return {
64
+ ok: true,
65
+ outDir: absoluteOutDir,
66
+ files: relativeFiles,
67
+ };
68
+ }
69
+ function isDangerousOutDir({ projectRoot, outDir }) {
70
+ const parsed = path.parse(outDir);
71
+ if (outDir === parsed.root)
72
+ return true;
73
+ if (outDir === projectRoot)
74
+ return true;
75
+ const defaultDist = path.join(projectRoot, "dist");
76
+ if (outDir === defaultDist || outDir.startsWith(`${defaultDist}${path.sep}`))
77
+ return false;
78
+ const relativeToProject = path.relative(projectRoot, outDir);
79
+ if (relativeToProject && !relativeToProject.startsWith("..") && !path.isAbsolute(relativeToProject))
80
+ return true;
81
+ const tempRoot = fs.realpathSync.native(os.tmpdir());
82
+ const outputParent = fs.existsSync(path.dirname(outDir)) ? fs.realpathSync.native(path.dirname(outDir)) : path.resolve(path.dirname(outDir));
83
+ if (outputParent === tempRoot || outputParent.startsWith(`${tempRoot}${path.sep}`))
84
+ return false;
85
+ return true;
86
+ }
87
+ function collectFiles(directory) {
88
+ const files = [];
89
+ if (fs.existsSync(directory))
90
+ walk(directory, files);
91
+ return files;
92
+ }
93
+ function walk(current, files) {
94
+ const stat = fs.lstatSync(current);
95
+ if (stat.isSymbolicLink())
96
+ return;
97
+ if (stat.isDirectory()) {
98
+ for (const entry of fs.readdirSync(current))
99
+ walk(path.join(current, entry), files);
100
+ return;
101
+ }
102
+ if (stat.isFile())
103
+ files.push(current);
104
+ }
105
+ function syncDirectory(sourceDir, targetDir) {
106
+ fs.mkdirSync(targetDir, { recursive: true });
107
+ const sourceEntries = new Set(fs.readdirSync(sourceDir));
108
+ for (const entry of sourceEntries) {
109
+ const source = path.join(sourceDir, entry);
110
+ const target = path.join(targetDir, entry);
111
+ const stat = fs.lstatSync(source);
112
+ if (stat.isDirectory()) {
113
+ syncDirectory(source, target);
114
+ }
115
+ else if (stat.isFile()) {
116
+ const tempTarget = `${target}.tmp-${process.pid}`;
117
+ fs.copyFileSync(source, tempTarget);
118
+ fs.renameSync(tempTarget, target);
119
+ }
120
+ }
121
+ for (const entry of fs.readdirSync(targetDir)) {
122
+ if (sourceEntries.has(entry))
123
+ continue;
124
+ if (entry.includes(".tmp-"))
125
+ continue;
126
+ fs.rmSync(path.join(targetDir, entry), { recursive: true, force: true });
127
+ }
128
+ }
129
+ function toPosix(value) {
130
+ return value.split(path.sep).join("/");
131
+ }
132
+ function parseArgs(argv) {
133
+ const options = {
134
+ projectRoot: repoRoot,
135
+ configPath: path.join(repoRoot, "tsconfig.dist.json"),
136
+ outDir: path.join(repoRoot, "dist"),
137
+ json: false,
138
+ quiet: false,
139
+ };
140
+ for (let index = 0; index < argv.length; index += 1) {
141
+ const arg = argv[index];
142
+ if (arg === "--json") {
143
+ options.json = true;
144
+ }
145
+ else if (arg === "--quiet") {
146
+ options.quiet = true;
147
+ }
148
+ else if (arg === "--out-dir") {
149
+ options.outDir = path.resolve(options.projectRoot, requireValue(argv, index, arg));
150
+ index += 1;
151
+ }
152
+ else if (arg === "--config") {
153
+ options.configPath = path.resolve(options.projectRoot, requireValue(argv, index, arg));
154
+ index += 1;
155
+ }
156
+ else {
157
+ throw new Error(`Unknown build-dist option: ${arg}`);
158
+ }
159
+ }
160
+ return options;
161
+ }
162
+ function requireValue(argv, index, option) {
163
+ const value = argv[index + 1];
164
+ if (!value)
165
+ throw new Error(`${option} requires a value`);
166
+ return value;
167
+ }
168
+ if (import.meta.url === `file://${process.argv[1]}`) {
169
+ let options;
170
+ try {
171
+ options = parseArgs(process.argv.slice(2));
172
+ }
173
+ catch (error) {
174
+ console.error(error.message);
175
+ process.exit(1);
176
+ }
177
+ const result = buildRuntimeDist(options);
178
+ if (options.json) {
179
+ console.log(JSON.stringify(result, null, 2));
180
+ }
181
+ else if (result.ok && !options.quiet) {
182
+ console.log(`Runtime dist build completed: ${path.relative(repoRoot, result.outDir) || "."} (${result.files.length} files)`);
183
+ }
184
+ else if (!result.ok) {
185
+ console.error(result.error);
186
+ }
187
+ if (!result.ok)
188
+ process.exit(result.status || 1);
189
+ }