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
@@ -8,9 +8,9 @@ This guide is written for coding agents that install or upgrade Harness inside a
8
8
 
9
9
  The main operator for this CLI is usually an agent inside the target project, not the end user. The agent should not ask the user to study command flags, template folders, or capability choices. Those decisions must happen during Diagnose / Decide and be explained in the delivery summary.
10
10
 
11
- Commands in this guide are written with an installed `harness` command. The agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace the same command with `node scripts/harness.mjs`.
11
+ Commands in this guide are written with an installed `harness` command. The agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace the same command with `node dist/harness.mjs`.
12
12
 
13
- `harness init` does not add this npm package to the target project's dependencies. It only writes Harness docs, templates, and the registry. Delivery summaries must not imply that the target project now has an npm dependency installed. The first `npx` run downloads the package into npm cache; it is not a project dependency or a global command install. When CLI access is needed, keep using `npx --yes coding-agent-harness ...`, a user-approved global `harness`, or `node scripts/harness.mjs` from the source checkout.
13
+ `harness init` does not add this npm package to the target project's dependencies. It only writes Harness docs, templates, and the registry. Delivery summaries must not imply that the target project now has an npm dependency installed. The first `npx` run downloads the package into npm cache; it is not a project dependency or a global command install. When CLI access is needed, keep using `npx --yes coding-agent-harness ...`, a user-approved global `harness`, or `node dist/harness.mjs` from the source checkout.
14
14
 
15
15
  `npx skills add FairladyZ625/coding-agent-harness --skill coding-agent-harness`
16
16
  is not a zero-write operation. It copies the Skill into `.agents/skills/coding-agent-harness/`
@@ -41,7 +41,7 @@ Use the v1.0 six-phase flow:
41
41
  5. Verify: run CLI checks and native project evidence.
42
42
  6. Deliver: report residuals, owners, and next actions.
43
43
 
44
- If Diagnose finds a microservice, multi-repo, split frontend/backend, or platform subsystem, or the code references external services, SDKs, API gateways, message queues, webhooks, contracts, schemas, or mocks, the agent must ask the user whether external source material exists. Small source sets can be linked from `Source Evidence`; large source sets use `docs/11-REFERENCE/external-source-intake-standard.md` and `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`, then project stable conclusions into `03/04/06`.
44
+ If Diagnose finds a microservice, multi-repo, split frontend/backend, or platform subsystem, or the code references external services, SDKs, API gateways, message queues, webhooks, contracts, schemas, or mocks, the agent must ask the user whether external source material exists. Small source sets can be linked from `Source Evidence`; large source sets use `coding-agent-harness/governance/standards/external-source-intake-standard.md` and `coding-agent-harness/context/development/external-source-packs/<source-key>/`, then project stable conclusions into `context/{architecture,development,integrations}`.
45
45
 
46
46
  ## Locale Rules
47
47
 
@@ -77,7 +77,6 @@ Choose capabilities conservatively:
77
77
  | --- | --- | --- |
78
78
  | `core` | Yes | Always install. This is the document kernel. |
79
79
  | `dashboard` | No | A user or agent needs a local status page, static evidence snapshot, or localhost dynamic workbench. |
80
- | `safe-adoption` | No | A legacy Harness project adopts v1.0 while preserving history. |
81
80
  | `adversarial-review` | No | Release, architecture, security, data, or policy risk needs independent review artifacts. |
82
81
  | `long-running-task` | No | An agent needs to execute across many turns without asking the user at every step. |
83
82
  | `module-parallel` | No | Two or more independent modules need owners, a registry, and synchronization rules. |
@@ -98,7 +97,7 @@ The JSON output from `init` includes a `report`. The delivery summary must inclu
98
97
 
99
98
  ## External Source Intake
100
99
 
101
- When a project depends on external microservices, repositories, or external-team documents, agents should not drop those materials directly into `03-ARCHITECTURE`, `04-DEVELOPMENT`, or `06-INTEGRATIONS`. Use this order:
100
+ When a project depends on external microservices, repositories, or external-team documents, agents should not drop those materials directly into `context/architecture`, `context/development`, or `context/integrations`. Use this order:
102
101
 
103
102
  ```text
104
103
  Inventory -> Classify -> Sanitize -> Digest -> Project -> Verify -> Residual
@@ -108,9 +107,9 @@ Rules:
108
107
 
109
108
  - Ask the user for external architecture docs, API docs, diagrams, meeting notes, links, source paths, or exported packets.
110
109
  - Confirm whether the material may be copied into the repository; non-committable material is represented by path, URL, owner, access condition, and digest only.
111
- - If there are more than 5 external documents, multiple topics, or continuing growth, create `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`.
110
+ - If there are more than 5 external documents, multiple topics, or continuing growth, create `coding-agent-harness/context/development/external-source-packs/<source-key>/`.
112
111
  - `external-source-packs/` stores source indexes, digests, and projection status only.
113
- - Stable facts must be written back to `03-ARCHITECTURE/services/<service-key>.md`, `04-DEVELOPMENT/external-context/<service-key>.md`, or `06-INTEGRATIONS/<contract>.md`.
112
+ - Stable facts must be written back to `coding-agent-harness/context/architecture/services/<service-key>.md`, `coding-agent-harness/context/development/external-context/<service-key>.md`, or `coding-agent-harness/context/integrations/<contract>.md`.
114
113
  - Unconfirmed or conflicting material stays in the source pack or `Do Not Assume`.
115
114
 
116
115
  ## User-Level Registration
@@ -164,11 +163,17 @@ harness migrate-run \
164
163
 
165
164
  harness migrate-verify \
166
165
  /tmp/cah-migration-project/session.json
166
+
167
+ harness new-task \
168
+ --budget complex \
169
+ --preset legacy-migration \
170
+ --from-session /tmp/cah-migration-project/session.json \
171
+ /path/to/old-project
167
172
  ```
168
173
 
169
174
  Rules:
170
175
 
171
- - Do not overwrite existing `AGENTS.md`, `CLAUDE.md`, `docs/Harness-Ledger.md`, SSoTs, walkthroughs, task progress, or historical task plans.
176
+ - Do not overwrite existing `AGENTS.md`, `CLAUDE.md`, `coding-agent-harness/governance/generated/Harness-Ledger.md`, SSoTs, walkthroughs, task progress, or historical task plans.
172
177
  - When the old project mixes Chinese and English, explicitly pass `--locale zh-CN` or `--locale en-US`.
173
178
  - Only add the missing v1.0 templates and capability registry.
174
179
  - Existing project facts may be merged, appended, or recorded as residuals. They must not be replaced with generic templates.
@@ -176,6 +181,7 @@ Rules:
176
181
  - `--strict` must still fail on legacy checker failures or unresolved historical contract gaps.
177
182
  - Archive old global tables and module indexes first, then regenerate them with `harness governance rebuild --archive --apply`; those tables are agent indexes, while humans should use the Dashboard for status.
178
183
  - `migrate-verify` must pass before the migration output is reported as usable, and the dashboard path must be HTML.
184
+ - The `legacy-migration` preset task must be created from the verified `session.json`. It records the migration session, evidence bundle, preset audit, and follow-up work queue; it does not automatically rewrite historical task bodies.
179
185
  - For detailed migration strategy, read `docs-release/guides/migration-playbook.md` or `docs-release/guides/migration-playbook.en-US.md`. If the user requires proof that the old project is fully migrated, also read `docs-release/guides/full-legacy-migration-subagent-strategy.md` or `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`.
180
186
 
181
187
  The agent must read `session.json` and `migrate-plan.json`, then migrate active tasks, current reviews, and truly adopted capabilities step by step. Subagent review must prove dashboard brief coverage, strict check, and final session all pass.
@@ -15,13 +15,13 @@ English mirror: `docs-release/guides/agent-installation.en-US.md`
15
15
  如果目标环境没有 `harness` 命令,不得静默全局安装;先询问用户是否允许运行
16
16
  `npm install -g coding-agent-harness`。只有用户明确同意后才能修改全局 npm 环境。
17
17
  用户不同意或未回复时,用 `npx --yes coding-agent-harness <command>` 运行同一条 CLI。
18
- 维护者在本源码仓调试时,可以把同一命令替换为 `node scripts/harness.mjs`。
18
+ 维护者在本源码仓调试时,可以把同一命令替换为 `node dist/harness.mjs`。
19
19
 
20
20
  `harness init` 不会把 npm 包写进目标项目依赖;它只写 Harness 文档、模板和 registry。
21
21
  因此 agent 交付时不能暗示目标项目已经安装了 npm dependency。`npx` 第一次运行会把包
22
22
  下载到 npm 缓存;这不是项目依赖,也不是全局命令安装。需要 CLI 时继续用
23
23
  `npx --yes coding-agent-harness ...`、用户批准后的全局 `harness`,或源码仓的
24
- `node scripts/harness.mjs`。
24
+ `node dist/harness.mjs`。
25
25
 
26
26
  `npx skills add FairladyZ625/coding-agent-harness --skill coding-agent-harness`
27
27
  不是零写入操作。它会把 Skill 拷贝到目标项目的 `.agents/skills/coding-agent-harness/`
@@ -51,7 +51,7 @@ npx skills add FairladyZ625/coding-agent-harness --skill preset-creator --full-d
51
51
  5. Verify:运行 CLI 检查和项目原生证据。
52
52
  6. Deliver:输出 residual、owner 和下一步。
53
53
 
54
- 如果 Diagnose 阶段发现项目属于微服务、多仓、前后端分仓、平台子系统,或代码里有外部服务、SDK、API gateway、message queue、webhook、contract、schema、mock,Agent 必须询问用户是否有外部资料。资料少时作为 `Source Evidence` 链接;资料多时按 `docs/11-REFERENCE/external-source-intake-standard.md` 建立 `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`,再把稳定结论投影到 `03/04/06`。
54
+ 如果 Diagnose 阶段发现项目属于微服务、多仓、前后端分仓、平台子系统,或代码里有外部服务、SDK、API gateway、message queue、webhook、contract、schema、mock,Agent 必须询问用户是否有外部资料。资料少时作为 `Source Evidence` 链接;资料多时按 `coding-agent-harness/governance/standards/external-source-intake-standard.md` 建立 `coding-agent-harness/context/development/external-source-packs/<source-key>/`,再把稳定结论投影到 `context/{architecture,development,integrations}`。
55
55
 
56
56
  ## 语言规则
57
57
 
@@ -89,7 +89,6 @@ Capability 要保守选择:
89
89
  | --- | --- | --- |
90
90
  | `core` | 是 | 永远安装。这是 document kernel。 |
91
91
  | `dashboard` | 否 | 用户或 agent 需要本地状态页、静态证据快照,或本机动态 workbench。 |
92
- | `safe-adoption` | 否 | 旧 harness 项目接入 v1.0,需要保留历史文档。 |
93
92
  | `adversarial-review` | 否 | 发布、架构、安全、数据或策略风险需要独立 review artifact。 |
94
93
  | `long-running-task` | 否 | Agent 需要连续多轮执行,不能每步都询问用户。 |
95
94
  | `module-parallel` | 否 | 两个以上独立模块需要 owner、registry 和同步规则。 |
@@ -112,7 +111,7 @@ Capability 要保守选择:
112
111
 
113
112
  ## 外部资料摄取
114
113
 
115
- 当项目依赖外部微服务、外部仓库或外部团队文档时,Agent 不应该把外部资料直接塞进 `03-ARCHITECTURE`、`04-DEVELOPMENT` 或 `06-INTEGRATIONS`。正确顺序是:
114
+ 当项目依赖外部微服务、外部仓库或外部团队文档时,Agent 不应该把外部资料直接塞进 `context/architecture`、`context/development` 或 `context/integrations`。正确顺序是:
116
115
 
117
116
  ```text
118
117
  Inventory -> Classify -> Sanitize -> Digest -> Project -> Verify -> Residual
@@ -122,9 +121,9 @@ Inventory -> Classify -> Sanitize -> Digest -> Project -> Verify -> Residual
122
121
 
123
122
  - 询问用户是否有外部架构文档、接口文档、流程图、会议纪要、链接或导出包。
124
123
  - 确认资料是否能复制进仓;不能入仓的只保留路径、URL、owner、访问条件和 digest。
125
- - 外部资料超过 5 份、跨多个主题或会持续增长时,创建 `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`。
124
+ - 外部资料超过 5 份、跨多个主题或会持续增长时,创建 `coding-agent-harness/context/development/external-source-packs/<source-key>/`。
126
125
  - `external-source-packs/` 只保存资料索引、digest 和投影状态。
127
- - 稳定事实必须回写到 `03-ARCHITECTURE/services/<service-key>.md`、`04-DEVELOPMENT/external-context/<service-key>.md` 或 `06-INTEGRATIONS/<contract>.md`。
126
+ - 稳定事实必须回写到 `coding-agent-harness/context/architecture/services/<service-key>.md`、`coding-agent-harness/context/development/external-context/<service-key>.md` 或 `coding-agent-harness/context/integrations/<contract>.md`。
128
127
  - 未确认或冲突的内容只能留在 source pack 或 `Do Not Assume`。
129
128
 
130
129
  ## 用户级注册
@@ -179,11 +178,17 @@ harness migrate-run \
179
178
 
180
179
  harness migrate-verify \
181
180
  /tmp/cah-migration-project/session.json
181
+
182
+ harness new-task \
183
+ --budget complex \
184
+ --preset legacy-migration \
185
+ --from-session /tmp/cah-migration-project/session.json \
186
+ /path/to/old-project
182
187
  ```
183
188
 
184
189
  规则:
185
190
 
186
- - 不覆盖已有 `AGENTS.md`、`CLAUDE.md`、`docs/Harness-Ledger.md`、SSoT、
191
+ - 不覆盖已有 `AGENTS.md`、`CLAUDE.md`、`coding-agent-harness/governance/generated/Harness-Ledger.md`、SSoT、
187
192
  walkthrough、task progress 和历史 task plan。
188
193
  - 旧项目中英文混杂时,必须显式传 `--locale zh-CN` 或 `--locale en-US`。
189
194
  - 只补齐缺失的 v1.0 模板和 capability registry。
@@ -192,6 +197,7 @@ harness migrate-verify \
192
197
  - `--strict` 必须仍然能因为旧 checker 失败或历史合同缺口而失败。
193
198
  - 旧全局表和模块索引先归档,再用 `harness governance rebuild --archive --apply` 重新生成;这些表是 Agent 索引,人看状态优先用 Dashboard。
194
199
  - `migrate-verify` 必须通过,才能报告迁移输出可用;dashboard 路径必须是 HTML。
200
+ - 必须基于验证通过的 `session.json` 创建 `legacy-migration` preset 任务。它记录 migration session、证据包、preset audit 和后续 work queue;不会自动重写历史任务正文。
195
201
  - 详细迁移策略见 `docs-release/guides/migration-playbook.md` 或英文镜像
196
202
  `docs-release/guides/migration-playbook.en-US.md`。如果用户要求证明旧项目已经完整迁移,
197
203
  还必须读取 `docs-release/guides/full-legacy-migration-subagent-strategy.md` 或中文镜像
@@ -18,7 +18,7 @@ Keep pull requests focused on one change family when possible. Documentation, CL
18
18
 
19
19
  ## Local Setup
20
20
 
21
- Use Node.js 18 or newer. CI runs Node.js 20.
21
+ Use Node.js 24 or newer. CI should run on the minimum supported LTS line.
22
22
 
23
23
  ```bash
24
24
  npm install
@@ -40,7 +40,7 @@ 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` |
@@ -51,7 +51,7 @@ Full root suite:
51
51
  npm test
52
52
  npm run smoke:dashboard
53
53
  npm run check
54
- node scripts/harness.mjs check --profile target-project examples/minimal-project
54
+ node dist/harness.mjs check --profile target-project examples/minimal-project
55
55
  npm run pack:dry-run
56
56
  git diff --check
57
57
  ```
@@ -18,7 +18,7 @@ PR 尽量聚焦在一类改动上。文档、CLI 行为、目标项目模板、p
18
18
 
19
19
  ## 本地准备
20
20
 
21
- 使用 Node.js 18 或更高版本。CI 当前使用 Node.js 20。
21
+ 使用 Node.js 24 或更高版本。CI 应覆盖最低支持的 LTS 版本。
22
22
 
23
23
  ```bash
24
24
  npm install
@@ -39,7 +39,7 @@ npm ci
39
39
  | --- | --- |
40
40
  | 仅文档 | `git diff --check` |
41
41
  | CLI / runtime | `npm test`, `npm run check`, `git diff --check` |
42
- | 模板或示例 | `npm test`, `node scripts/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
42
+ | 模板或示例 | `npm test`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
43
43
  | Dashboard | `npm test`, `npm run smoke:dashboard`, `git diff --check` |
44
44
  | Package surface | `npm test`, `npm run pack:dry-run`, `git diff --check` |
45
45
  | GUI 子模块 | `cd harness-gui && npm ci && npm run typecheck && npm test && npm run build` |
@@ -50,7 +50,7 @@ npm ci
50
50
  npm test
51
51
  npm run smoke:dashboard
52
52
  npm run check
53
- node scripts/harness.mjs check --profile target-project examples/minimal-project
53
+ node dist/harness.mjs check --profile target-project examples/minimal-project
54
54
  npm run pack:dry-run
55
55
  git diff --check
56
56
  ```
@@ -27,9 +27,9 @@ Release docs explain public methodology and product capability. They do not carr
27
27
  | `references/` | Agents and maintainers | Reusable standards such as testing, workflow, review, worktree rules | A project's current schedule |
28
28
  | `templates/` | CLI and agents | Files generated into target projects | Evidence from completed work |
29
29
  | Target `AGENTS.md` | Agents | Entrypoint, routing, hard rules, reading matrix | Long background essays |
30
- | Target `docs/09-PLANNING/` and `docs/Harness-Ledger.md` | Agents and project owners | Task plans, generated task lifecycle index, current state | Generic marketing material |
31
- | Target `docs/05-TEST-QA/` | Agents, QA, human reviewers | Regression SSoT, Cadence Ledger, quality gates | Requirement brainstorm drafts |
32
- | Target `docs/10-WALKTHROUGH/` | Reviewers and handoff agents | Closeout evidence, residuals, human confirmation | Unverified plans |
30
+ | Target `coding-agent-harness/planning/` and `coding-agent-harness/governance/generated/Harness-Ledger.md` | Agents and project owners | Task plans, generated task lifecycle index, current state | Generic marketing material |
31
+ | Target `coding-agent-harness/governance/regression/` | Agents, QA, human reviewers | Regression SSoT, Cadence Ledger, quality gates | Requirement brainstorm drafts |
32
+ | Target `coding-agent-harness/planning/tasks/<task>/` | Reviewers and handoff agents | Closeout evidence, residuals, human confirmation | Unverified plans |
33
33
 
34
34
  ## Human-Facing Docs
35
35
 
@@ -62,13 +62,13 @@ Agent-facing docs answer:
62
62
  Typical files:
63
63
 
64
64
  - `AGENTS.md`
65
- - `docs/Harness-Ledger.md`
66
- - `docs/09-PLANNING/TASKS/<task>/task_plan.md`
67
- - `docs/09-PLANNING/TASKS/<task>/task_plan.md`
68
- - `docs/09-PLANNING/TASKS/<task>/progress.md`
69
- - `docs/05-TEST-QA/Regression-SSoT.md`
70
- - `docs/10-WALKTHROUGH/<date>-<task>.md`
71
- - `docs/11-REFERENCE/*.md`
65
+ - `coding-agent-harness/governance/generated/Harness-Ledger.md`
66
+ - `coding-agent-harness/planning/tasks/<task>/task_plan.md`
67
+ - `coding-agent-harness/planning/tasks/<task>/task_plan.md`
68
+ - `coding-agent-harness/planning/tasks/<task>/progress.md`
69
+ - `coding-agent-harness/governance/regression/Regression-SSoT.md`
70
+ - `coding-agent-harness/planning/tasks/<task>/walkthrough.md`
71
+ - `coding-agent-harness/governance/standards/*.md`
72
72
 
73
73
  Agent-facing docs should be concrete, path-oriented, and checkable. Do not turn them into essays, and do not make agents infer execution contracts from narrative prose.
74
74
 
@@ -27,9 +27,9 @@ Agent 读的文档定义事实、路径、门禁和下一步动作。
27
27
  | `references/` | Agent 和维护者 | 可复用标准,例如 testing、workflow、review、worktree | 某个项目的当前排期 |
28
28
  | `templates/` | CLI 和 Agent | 初始化目标项目时生成的文件 | 已经执行过的任务证据 |
29
29
  | 目标项目 `AGENTS.md` | Agent | 入口、路由、硬规则、读文件矩阵 | 大段背景叙事 |
30
- | 目标项目 `docs/09-PLANNING/` 与 `docs/Harness-Ledger.md` | Agent 和项目负责人 | 任务计划、生成的任务生命周期索引、当前状态 | 通用营销材料 |
31
- | 目标项目 `docs/05-TEST-QA/` | Agent、QA、人审 | Regression SSoT、Cadence Ledger、质量门禁 | 需求讨论草稿 |
32
- | 目标项目 `docs/10-WALKTHROUGH/` | 人审、接手 Agent | 收口证据、残留项、人工确认 | 未验证的计划 |
30
+ | 目标项目 `coding-agent-harness/planning/` 与 `coding-agent-harness/governance/generated/Harness-Ledger.md` | Agent 和项目负责人 | 任务计划、生成的任务生命周期索引、当前状态 | 通用营销材料 |
31
+ | 目标项目 `coding-agent-harness/governance/regression/` | Agent、QA、人审 | Regression SSoT、Cadence Ledger、质量门禁 | 需求讨论草稿 |
32
+ | 目标项目 `coding-agent-harness/planning/tasks/<task>/` | 人审、接手 Agent | 收口证据、残留项、人工确认 | 未验证的计划 |
33
33
 
34
34
  ## 人读文档
35
35
 
@@ -62,13 +62,13 @@ Agent 读文档要回答:
62
62
  典型文件:
63
63
 
64
64
  - `AGENTS.md`
65
- - `docs/Harness-Ledger.md`
66
- - `docs/09-PLANNING/TASKS/<task>/task_plan.md`
67
- - `docs/09-PLANNING/TASKS/<task>/task_plan.md`
68
- - `docs/09-PLANNING/TASKS/<task>/progress.md`
69
- - `docs/05-TEST-QA/Regression-SSoT.md`
70
- - `docs/10-WALKTHROUGH/<date>-<task>.md`
71
- - `docs/11-REFERENCE/*.md`
65
+ - `coding-agent-harness/governance/generated/Harness-Ledger.md`
66
+ - `coding-agent-harness/planning/tasks/<task>/task_plan.md`
67
+ - `coding-agent-harness/planning/tasks/<task>/task_plan.md`
68
+ - `coding-agent-harness/planning/tasks/<task>/progress.md`
69
+ - `coding-agent-harness/governance/regression/Regression-SSoT.md`
70
+ - `coding-agent-harness/planning/tasks/<task>/walkthrough.md`
71
+ - `coding-agent-harness/governance/standards/*.md`
72
72
 
73
73
  Agent 文档应该具体、短路径、可检查。不要把它写成文章,也不要让 Agent 从长篇叙事里猜执行合同。
74
74
 
@@ -44,6 +44,7 @@ Scan first. Do not write files:
44
44
  git -C /path/to/project status --short --branch
45
45
  harness status --json /path/to/project > /tmp/harness-status.json
46
46
  harness migrate-plan --json --limit 1000 /path/to/project > /tmp/harness-migrate-plan.json
47
+ harness migrate-structure --plan --json /path/to/project > /tmp/harness-migrate-structure-plan.json
47
48
  ```
48
49
 
49
50
  Then return a short migration plan and ask for confirmation. The plan must include:
@@ -51,6 +52,7 @@ Then return a short migration plan and ask for confirmation. The plan must inclu
51
52
  - task count, brief coverage, and canonical `visual_map.md` coverage;
52
53
  - `migrate-plan.summary` warnings, taskActions, reviewSchemaGaps, legacyReferenceGaps, legacyResiduals, and fullCutoverEligible;
53
54
  - dirty / untracked file explanation;
55
+ - v2 structure plan, including whether the active Harness root is the default `coding-agent-harness/` or a custom `structure.harnessRoot`;
54
56
  - whether the project is a microservice, multi-repo, split frontend/backend, or externally integrated project, and whether the user has been asked for external source material;
55
57
  - recommended migration mode and rationale;
56
58
  - estimated write scope, token / time cost, and whether subagents are needed;
@@ -81,7 +83,7 @@ If the user provides external source material, first use `docs/11-REFERENCE/exte
81
83
 
82
84
  ## Step 1: Baseline
83
85
 
84
- First check whether the target environment has the `harness` command. If it does not, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, use `npx --yes coding-agent-harness <command>` for Harness CLI calls. If you are debugging from the source checkout, replace `harness` with `node scripts/harness.mjs`.
86
+ First check whether the target environment has the `harness` command. If it does not, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, use `npx --yes coding-agent-harness <command>` for Harness CLI calls. If you are debugging from the source checkout, replace `harness` with `node dist/harness.mjs`.
85
87
 
86
88
  After user confirmation, run or reuse:
87
89
 
@@ -101,7 +103,14 @@ Before writing files:
101
103
  - `--locale zh-CN` for Chinese users, Chinese project operating context, or Chinese-facing docs.
102
104
  - `--locale en-US` for English teams or English-facing docs.
103
105
  - Record concrete locale evidence from entry files or product-facing docs, such as `AGENTS.md`, `CLAUDE.md`, `README.md`, `docs/Harness-Ledger.md`, and active task docs. Stop and ask for a locale decision if those signals conflict.
104
- - Run the migration rail:
106
+ - Run the v2 directory-structure migration, then the migration rail:
107
+
108
+ ```bash
109
+ harness migrate-structure --apply --json /path/to/project
110
+ harness check --profile target-project /path/to/project
111
+ ```
112
+
113
+ Then create the migration session:
105
114
 
106
115
  ```bash
107
116
  harness migrate-run \
@@ -122,6 +131,20 @@ The command writes:
122
131
  - `status-strict.json`
123
132
  - `dashboard/index.html`
124
133
 
134
+ After `migrate-run`, verify the session and create the controlled migration task:
135
+
136
+ ```bash
137
+ harness migrate-verify /tmp/cah-migration-project/session.json
138
+
139
+ harness new-task \
140
+ --budget complex \
141
+ --preset legacy-migration \
142
+ --from-session /tmp/cah-migration-project/session.json \
143
+ /path/to/project
144
+ ```
145
+
146
+ Do not skip the `legacy-migration` preset task. It creates a Complex Task that records the session, evidence bundle, preset manifest audit, write scope, and migration follow-up queue. It does not automatically rewrite historical task bodies. If `harness new-task --preset legacy-migration` fails, stop and report that the migration task was not created instead of continuing from a verbal summary.
147
+
125
148
  Classify the output:
126
149
 
127
150
  | Output | Meaning | Action |
@@ -44,6 +44,7 @@ English source: `docs-release/guides/legacy-migration-agent-prompt.md`
44
44
  git -C /path/to/project status --short --branch
45
45
  harness status --json /path/to/project > /tmp/harness-status.json
46
46
  harness migrate-plan --json --limit 1000 /path/to/project > /tmp/harness-migrate-plan.json
47
+ harness migrate-structure --plan --json /path/to/project > /tmp/harness-migrate-structure-plan.json
47
48
  ```
48
49
 
49
50
  然后给用户一个简短迁移计划,并主动提问。计划必须包含:
@@ -51,6 +52,7 @@ harness migrate-plan --json --limit 1000 /path/to/project > /tmp/harness-migrate
51
52
  - 任务总数、brief 覆盖、canonical `visual_map.md` 覆盖。
52
53
  - `migrate-plan.summary` 中的 warnings、taskActions、reviewSchemaGaps、legacyReferenceGaps、legacyResiduals、fullCutoverEligible。
53
54
  - dirty / untracked 文件解释。
55
+ - v2 目录结构计划,包括活跃 Harness 根目录是默认的 `coding-agent-harness/`,还是自定义的 `structure.harnessRoot`。
54
56
  - 是否属于微服务、多仓、前后端分仓或外部集成项目;如果是,是否已询问用户外部资料。
55
57
  - 推荐迁移模式和原因。
56
58
  - 预计改动范围、token / 时间成本、是否需要 subagent。
@@ -81,7 +83,7 @@ Agent 应推荐下面三种模式之一,而不是让用户自己先懂这些
81
83
 
82
84
  ## Step 1: Baseline
83
85
 
84
- 先检查目标环境是否有 `harness` 命令。如果没有,不要静默全局安装。先询问用户是否允许运行 `npm install -g coding-agent-harness`。只有用户明确同意后才执行全局安装。用户不同意或未回复时,Harness CLI 都用 `npx --yes coding-agent-harness <command>` 临时执行。如果你在源码仓调试,把 `harness` 替换为 `node scripts/harness.mjs`。
86
+ 先检查目标环境是否有 `harness` 命令。如果没有,不要静默全局安装。先询问用户是否允许运行 `npm install -g coding-agent-harness`。只有用户明确同意后才执行全局安装。用户不同意或未回复时,Harness CLI 都用 `npx --yes coding-agent-harness <command>` 临时执行。如果你在源码仓调试,把 `harness` 替换为 `node dist/harness.mjs`。
85
87
 
86
88
  用户确认迁移模式后再运行或复用:
87
89
 
@@ -102,7 +104,14 @@ harness migrate-plan --json --limit 50 /path/to/project > /tmp/harness-migrate-p
102
104
  - 英文团队或英文对外文档使用 `--locale en-US`。
103
105
  - 从入口文件或产品文档记录具体语言证据,例如 `AGENTS.md`、`CLAUDE.md`、`README.md`、`docs/Harness-Ledger.md` 和活跃任务文档。信号冲突时停止并让用户决定语言。
104
106
 
105
- 运行迁移轨道:
107
+ 先运行 v2 目录结构迁移,再运行迁移轨道:
108
+
109
+ ```bash
110
+ harness migrate-structure --apply --json /path/to/project
111
+ harness check --profile target-project /path/to/project
112
+ ```
113
+
114
+ 然后创建 migration session:
106
115
 
107
116
  ```bash
108
117
  harness migrate-run \
@@ -123,6 +132,20 @@ harness migrate-run \
123
132
  - `status-strict.json`
124
133
  - `dashboard/index.html`
125
134
 
135
+ `migrate-run` 之后,先验证 session,再创建受控迁移任务:
136
+
137
+ ```bash
138
+ harness migrate-verify /tmp/cah-migration-project/session.json
139
+
140
+ harness new-task \
141
+ --budget complex \
142
+ --preset legacy-migration \
143
+ --from-session /tmp/cah-migration-project/session.json \
144
+ /path/to/project
145
+ ```
146
+
147
+ 不要跳过 `legacy-migration` preset 任务。它会创建一个 Complex Task,把 session、证据包、preset manifest audit、write scope 和 migration follow-up queue 记录下来;它不会自动重写历史任务正文。如果 `harness new-task --preset legacy-migration` 失败,停止并报告迁移任务没有创建,不要只靠口头总结继续。
148
+
126
149
  输出分类:
127
150
 
128
151
  | Output | 含义 | 动作 |
@@ -11,7 +11,40 @@ If another agent will execute the migration, first give it:
11
11
  - `docs-release/guides/full-legacy-migration-subagent-strategy.md`
12
12
  - `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`
13
13
 
14
- This guide assumes the installed `harness` command. The executing agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Install globally only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace it with `node scripts/harness.mjs`.
14
+ This guide assumes the installed `harness` command. The executing agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Install globally only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace it with `node dist/harness.mjs`.
15
+
16
+ ## Target Path And v2 Structure
17
+
18
+ The default active v2 directory is `coding-agent-harness/` inside the target
19
+ project, with `coding-agent-harness/harness.yaml` as the entry file. Checks do
20
+ not require that exact folder name. If a project keeps Harness state in a custom
21
+ project-relative directory, such as `.project-control/harness-state/`, declare it
22
+ in that directory's `harness.yaml`:
23
+
24
+ ```yaml
25
+ structure:
26
+ harnessRoot: .project-control/harness-state
27
+ planningRoot: .project-control/harness-state/planning
28
+ tasksRoot: .project-control/harness-state/planning/tasks
29
+ governanceRoot: .project-control/harness-state/governance
30
+ generatedRoot: .project-control/harness-state/governance/generated
31
+ ```
32
+
33
+ Then commands can run from the project root:
34
+
35
+ ```bash
36
+ harness status --json /path/to/project
37
+ harness check --profile target-project /path/to/project
38
+ ```
39
+
40
+ They can also point directly at the Harness root:
41
+
42
+ ```bash
43
+ harness status --json /path/to/project/.project-control/harness-state
44
+ ```
45
+
46
+ If a project contains multiple `harness.yaml` files, the agent must not guess.
47
+ Pass the intended Harness root explicitly.
15
48
 
16
49
  ## Migration Principles
17
50
 
@@ -31,6 +64,7 @@ After receiving the migration prompt, the target-project agent starts with read-
31
64
  git -C /path/to/project status --short --branch
32
65
  harness status --json /path/to/project
33
66
  harness migrate-plan --json --limit 1000 /path/to/project
67
+ harness migrate-structure --plan --json /path/to/project
34
68
  ```
35
69
 
36
70
  Then the agent must give the user a migration plan and actively recommend a migration depth:
@@ -65,6 +99,22 @@ If this run does not yet have a user-confirmed migration depth, stop here and do
65
99
 
66
100
  2. Run the migration rail:
67
101
 
102
+ First migrate the old `docs/` layout into the v2 manifest layout. `--plan` is a
103
+ read-only preview; run `--apply` only after user confirmation. The default
104
+ migration destination is `coding-agent-harness/`, and the old `docs/` root is
105
+ archived under `coding-agent-harness/governance/archive/legacy-docs/`. Legacy
106
+ `planning/**/_task-template` and `planning/**/_module-template` directories are
107
+ generated copies of npm-package templates, so migration removes them from the
108
+ target project when present:
109
+
110
+ ```bash
111
+ harness migrate-structure --plan --json /path/to/project
112
+ harness migrate-structure --apply --json /path/to/project
113
+ harness check --profile target-project /path/to/project
114
+ ```
115
+
116
+ After the directory migration passes, run the session migration rail:
117
+
68
118
  ```bash
69
119
  harness migrate-run \
70
120
  --locale zh-CN \
@@ -92,6 +142,18 @@ harness migrate-verify /tmp/cah-migration-project/session.json
92
142
 
93
143
  `migrate-verify` checks the capability registry, locale, dashboard HTML path, normal check, strict deferred metadata, and git index. Only after it passes may the agent say the migration output is usable.
94
144
 
145
+ 4. Create the migration task from the verified session:
146
+
147
+ ```bash
148
+ harness new-task \
149
+ --budget complex \
150
+ --preset legacy-migration \
151
+ --from-session /tmp/cah-migration-project/session.json \
152
+ /path/to/project
153
+ ```
154
+
155
+ The `legacy-migration` preset task is the auditable handoff point for later work. It records the session, evidence bundle, preset audit, write scope, and migration follow-up queue. It does not automatically rewrite historical task bodies.
156
+
95
157
  If later cleanup repairs warnings or active task contracts, the first session is only the baseline. Before final delivery, rerun `migrate-run` for a fresh session/dashboard or explicitly label the differences between baseline session and final evidence.
96
158
 
97
159
  `migrate-verify` passing does not mean the full migration is complete. Full migration also requires:
@@ -15,7 +15,38 @@ English mirror: `docs-release/guides/migration-playbook.en-US.md`
15
15
  如果目标环境没有 `harness`,不得静默全局安装;先询问用户是否允许运行
16
16
  `npm install -g coding-agent-harness`。用户明确同意后才能安装。用户不同意或未回复时,
17
17
  用 `npx --yes coding-agent-harness <command>` 运行同一条 CLI。维护者在本源码仓调试时,
18
- 可以把同一命令替换为 `node scripts/harness.mjs`。
18
+ 可以把同一命令替换为 `node dist/harness.mjs`。
19
+
20
+ ## 目标路径和 v2 结构
21
+
22
+ v2 的默认活跃目录是目标项目里的 `coding-agent-harness/`,入口文件是
23
+ `coding-agent-harness/harness.yaml`。但检查目标不要求这个目录一定在仓库根目录下使用固定名称。
24
+ 如果项目已经把 Harness 状态放在自定义目录,例如
25
+ `.project-control/harness-state/`,需要在该目录的 `harness.yaml` 中声明:
26
+
27
+ ```yaml
28
+ structure:
29
+ harnessRoot: .project-control/harness-state
30
+ planningRoot: .project-control/harness-state/planning
31
+ tasksRoot: .project-control/harness-state/planning/tasks
32
+ governanceRoot: .project-control/harness-state/governance
33
+ generatedRoot: .project-control/harness-state/governance/generated
34
+ ```
35
+
36
+ 之后可以从项目根运行:
37
+
38
+ ```bash
39
+ harness status --json /path/to/project
40
+ harness check --profile target-project /path/to/project
41
+ ```
42
+
43
+ 也可以直接指向 Harness 根目录:
44
+
45
+ ```bash
46
+ harness status --json /path/to/project/.project-control/harness-state
47
+ ```
48
+
49
+ 如果一个项目下存在多个 `harness.yaml`,不要让 agent 猜;必须把目标 Harness 根目录作为命令参数传入。
19
50
 
20
51
  ## 迁移原则
21
52
 
@@ -35,6 +66,7 @@ English mirror: `docs-release/guides/migration-playbook.en-US.md`
35
66
  git -C /path/to/project status --short --branch
36
67
  harness status --json /path/to/project
37
68
  harness migrate-plan --json --limit 1000 /path/to/project
69
+ harness migrate-structure --plan --json /path/to/project
38
70
  ```
39
71
 
40
72
  然后 agent 必须给用户一份迁移计划,并主动推荐迁移深度:
@@ -69,6 +101,20 @@ Agent 必须记录具体判断证据,例如 `AGENTS.md`、`CLAUDE.md`、`READM
69
101
 
70
102
  2. 运行迁移轨道:
71
103
 
104
+ 先把旧 `docs/` 布局迁到 v2 manifest 布局。`--plan` 是只读预览;用户确认后才运行
105
+ `--apply`。默认迁移目标是 `coding-agent-harness/`,并会把旧 `docs/` 归档到
106
+ `coding-agent-harness/governance/archive/legacy-docs/`。旧版本遗留的
107
+ `planning/**/_task-template` 和 `planning/**/_module-template` 是 npm 包内模板的生成副本,
108
+ 迁移时会从目标项目中移除:
109
+
110
+ ```bash
111
+ harness migrate-structure --plan --json /path/to/project
112
+ harness migrate-structure --apply --json /path/to/project
113
+ harness check --profile target-project /path/to/project
114
+ ```
115
+
116
+ 目录迁移通过后,再运行 session 迁移轨道:
117
+
72
118
  ```bash
73
119
  harness migrate-run \
74
120
  --locale zh-CN \
@@ -96,6 +142,18 @@ harness migrate-verify /tmp/cah-migration-project/session.json
96
142
 
97
143
  `migrate-verify` 会检查 capability registry、locale、dashboard HTML 路径、普通检查、strict deferred 元数据和 git index。它通过以后,才可以说迁移输出“可用”。
98
144
 
145
+ 4. 基于验证通过的 session 创建迁移任务:
146
+
147
+ ```bash
148
+ harness new-task \
149
+ --budget complex \
150
+ --preset legacy-migration \
151
+ --from-session /tmp/cah-migration-project/session.json \
152
+ /path/to/project
153
+ ```
154
+
155
+ `legacy-migration` preset 任务是后续迁移工作的可审计交接点。它会记录 session、证据包、preset audit、write scope 和 migration follow-up queue;不会自动重写历史任务正文。
156
+
99
157
  如果后续继续清理 warning 或补活跃任务合同,第一次 session 只能作为 baseline。最终交付前要重新运行 `migrate-run` 生成新 session/dashboard,或者明确列出 baseline session 与最终检查证据的差异。
100
158
 
101
159
  `migrate-verify` 通过不等于 full migration complete。完整迁移还必须满足: