coding-agent-harness 1.0.1 → 1.0.4

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 (262) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/CONTRIBUTING.md +98 -0
  3. package/README.en-US.md +14 -0
  4. package/README.md +230 -80
  5. package/README.zh-CN.md +290 -0
  6. package/SKILL.md +132 -198
  7. package/docs-release/README.md +80 -9
  8. package/docs-release/architecture/overview.md +298 -28
  9. package/docs-release/architecture/overview.zh-CN.md +292 -0
  10. package/docs-release/assets/dashboard-overview.png +0 -0
  11. package/docs-release/assets/harness-architecture.svg +163 -0
  12. package/docs-release/assets/harness-workflow.svg +64 -0
  13. package/docs-release/guides/agent-installation.en-US.md +237 -0
  14. package/docs-release/guides/agent-installation.md +149 -27
  15. package/docs-release/guides/contributing.md +100 -0
  16. package/docs-release/guides/contributing.zh-CN.md +99 -0
  17. package/docs-release/guides/document-audience-and-surfaces.en-US.md +113 -0
  18. package/docs-release/guides/document-audience-and-surfaces.md +113 -0
  19. package/docs-release/guides/full-legacy-migration-subagent-strategy.md +334 -0
  20. package/docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md +334 -0
  21. package/docs-release/guides/legacy-migration-agent-prompt.md +373 -0
  22. package/docs-release/guides/legacy-migration-agent-prompt.zh-CN.md +350 -0
  23. package/docs-release/guides/migration-playbook.en-US.md +324 -0
  24. package/docs-release/guides/migration-playbook.md +328 -0
  25. package/docs-release/guides/parent-control-repository-pattern.en-US.md +254 -0
  26. package/docs-release/guides/parent-control-repository-pattern.md +254 -0
  27. package/docs-release/guides/preset-development.md +214 -0
  28. package/docs-release/guides/repository-operating-models.en-US.md +197 -0
  29. package/docs-release/guides/repository-operating-models.md +197 -0
  30. package/docs-release/guides/task-state-machine.en-US.md +207 -0
  31. package/docs-release/guides/task-state-machine.md +214 -0
  32. package/docs-release/intl/README.md +15 -0
  33. package/docs-release/intl/de-DE.md +18 -0
  34. package/docs-release/intl/en-US.md +18 -0
  35. package/docs-release/intl/es-ES.md +18 -0
  36. package/docs-release/intl/fr-FR.md +18 -0
  37. package/docs-release/intl/ja-JP.md +18 -0
  38. package/docs-release/intl/ko-KR.md +18 -0
  39. package/docs-release/intl/zh-CN.md +18 -0
  40. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/brief.md +13 -0
  41. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/findings.md +7 -0
  42. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/lesson_candidates.md +24 -0
  43. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/progress.md +1 -1
  44. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/task_plan.md +4 -2
  45. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/{visual_roadmap.md → visual_map.md} +9 -1
  46. package/package.json +10 -3
  47. package/presets/legacy-migration/checks/preset-check.mjs +3 -0
  48. package/presets/legacy-migration/preset.yaml +134 -0
  49. package/presets/legacy-migration/scripts/plan-work-queue.mjs +4 -0
  50. package/presets/legacy-migration/scripts/scaffold-task-contracts.mjs +4 -0
  51. package/presets/legacy-migration/templates/execution_strategy.append.md +18 -0
  52. package/presets/legacy-migration/templates/findings.seed.md +17 -0
  53. package/presets/legacy-migration/templates/review.seed.md +12 -0
  54. package/presets/legacy-migration/templates/task_plan.append.md +9 -0
  55. package/presets/legacy-migration/templates/visual_map.append.md +12 -0
  56. package/presets/legacy-migration/workbench/dashboard-panels.yaml +2 -0
  57. package/presets/legacy-migration/workbench/migration-queue.schema.json +23 -0
  58. package/presets/lesson-sedimentation/preset.yaml +23 -0
  59. package/presets/lesson-sedimentation/templates/prompt.md +23 -0
  60. package/presets/module/preset.yaml +25 -0
  61. package/presets/module/templates/execution_strategy.append.md +8 -0
  62. package/presets/module/templates/task_plan.append.md +17 -0
  63. package/presets/standard-task/preset.yaml +31 -0
  64. package/presets/standard-task/templates/task_plan.append.md +7 -0
  65. package/references/adversarial-review-standard.md +2 -2
  66. package/references/agents-md-pattern.md +5 -5
  67. package/references/delivery-operating-model-standard.md +3 -3
  68. package/references/docs-directory-standard.md +53 -10
  69. package/references/external-source-intake-standard.md +75 -0
  70. package/references/harness-ledger.md +53 -94
  71. package/references/legacy-12-phase-bootstrap.md +41 -0
  72. package/references/lessons-governance.md +100 -88
  73. package/references/module-parallel-standard.md +14 -14
  74. package/references/planning-loop.md +51 -7
  75. package/references/project-onboarding-audit.md +10 -0
  76. package/references/pull-request-standard.md +118 -0
  77. package/references/repo-governance-standard.md +12 -1
  78. package/references/review-routing-standard.md +7 -1
  79. package/references/ssot-governance.md +67 -59
  80. package/references/taskr-gap-analysis.md +600 -0
  81. package/references/testing-standard.md +50 -0
  82. package/references/walkthrough-closeout.md +10 -9
  83. package/scripts/check-harness.mjs +111 -331
  84. package/scripts/commands/dashboard-command.mjs +67 -0
  85. package/scripts/commands/migration-command.mjs +96 -0
  86. package/scripts/commands/preset-command.mjs +73 -0
  87. package/scripts/commands/task-command.mjs +327 -0
  88. package/scripts/harness.mjs +106 -20
  89. package/scripts/lib/capability-registry.mjs +591 -0
  90. package/scripts/lib/check-module-parallel.mjs +237 -0
  91. package/scripts/lib/check-profiles.mjs +418 -0
  92. package/scripts/lib/check-task-contracts.mjs +47 -0
  93. package/scripts/lib/core-shared.mjs +196 -0
  94. package/scripts/lib/dashboard-data.mjs +412 -0
  95. package/scripts/lib/dashboard-workbench.mjs +257 -0
  96. package/scripts/lib/dashboard-writer.mjs +107 -4
  97. package/scripts/lib/git-status-summary.mjs +46 -0
  98. package/scripts/lib/governance-index-generator.mjs +174 -0
  99. package/scripts/lib/governance-sync.mjs +514 -0
  100. package/scripts/lib/governance-table-boundary.mjs +175 -0
  101. package/scripts/lib/harness-core.mjs +15 -1318
  102. package/scripts/lib/lesson-maintenance.mjs +152 -0
  103. package/scripts/lib/markdown-utils.mjs +158 -0
  104. package/scripts/lib/migration-planner.mjs +478 -0
  105. package/scripts/lib/migration-support.mjs +312 -0
  106. package/scripts/lib/preset-audit-contracts.mjs +37 -0
  107. package/scripts/lib/preset-engine.mjs +497 -0
  108. package/scripts/lib/preset-registry.mjs +627 -0
  109. package/scripts/lib/preset-resource-contracts.mjs +83 -0
  110. package/scripts/lib/review-confirm-git-gate.mjs +248 -0
  111. package/scripts/lib/status-dashboard-renderer.mjs +102 -0
  112. package/scripts/lib/subagent-authorization-audit.mjs +196 -0
  113. package/scripts/lib/task-completion-consistency.mjs +16 -0
  114. package/scripts/lib/task-index.mjs +93 -0
  115. package/scripts/lib/task-lesson-candidates.mjs +242 -0
  116. package/scripts/lib/task-lesson-sedimentation.mjs +326 -0
  117. package/scripts/lib/task-lifecycle/review-confirm.mjs +101 -0
  118. package/scripts/lib/task-lifecycle/review-gates.mjs +70 -0
  119. package/scripts/lib/task-lifecycle/text-utils.mjs +24 -0
  120. package/scripts/lib/task-lifecycle.mjs +649 -0
  121. package/scripts/lib/task-review-model.mjs +469 -0
  122. package/scripts/lib/task-scanner.mjs +576 -0
  123. package/scripts/lib/task-tombstone-commands.mjs +140 -0
  124. package/scripts/postinstall.mjs +14 -0
  125. package/skills/preset-creator/SKILL.md +179 -0
  126. package/skills/preset-creator/references/complex-task-skeleton/README.md +31 -0
  127. package/skills/preset-creator/references/complex-task-skeleton/artifacts/INDEX.md +12 -0
  128. package/skills/preset-creator/references/complex-task-skeleton/brief.md +32 -0
  129. package/skills/preset-creator/references/complex-task-skeleton/execution_strategy.md +71 -0
  130. package/skills/preset-creator/references/complex-task-skeleton/findings.md +24 -0
  131. package/skills/preset-creator/references/complex-task-skeleton/lesson_candidates.md +70 -0
  132. package/skills/preset-creator/references/complex-task-skeleton/long-running-task-contract.md +76 -0
  133. package/skills/preset-creator/references/complex-task-skeleton/progress.md +33 -0
  134. package/skills/preset-creator/references/complex-task-skeleton/references/INDEX.md +13 -0
  135. package/skills/preset-creator/references/complex-task-skeleton/review.md +107 -0
  136. package/skills/preset-creator/references/complex-task-skeleton/task_plan.md +111 -0
  137. package/{templates/planning/visual_roadmap.md → skills/preset-creator/references/complex-task-skeleton/visual_map.md} +24 -2
  138. package/skills/preset-creator/references/preset-package-skeleton.md +296 -0
  139. package/templates/AGENTS.md.template +51 -36
  140. package/templates/architecture/Architecture-SSoT.md +21 -0
  141. package/templates/architecture/README.md +49 -0
  142. package/templates/architecture/critical-flows.md +22 -0
  143. package/templates/architecture/local-repo-context.md +20 -0
  144. package/templates/architecture/service-catalog.md +17 -0
  145. package/templates/architecture/services/service-template.md +31 -0
  146. package/templates/architecture/system-map.md +22 -0
  147. package/templates/dashboard/assets/app-src/00-state.js +42 -0
  148. package/templates/dashboard/assets/app-src/10-router.js +77 -0
  149. package/templates/dashboard/assets/app-src/20-overview.js +241 -0
  150. package/templates/dashboard/assets/app-src/30-tasks.js +409 -0
  151. package/templates/dashboard/assets/app-src/35-task-detail.js +246 -0
  152. package/templates/dashboard/assets/app-src/40-modules.js +58 -0
  153. package/templates/dashboard/assets/app-src/45-review.js +347 -0
  154. package/templates/dashboard/assets/app-src/50-migration.js +183 -0
  155. package/templates/dashboard/assets/app-src/60-shared.js +61 -0
  156. package/templates/dashboard/assets/app-src/90-bindings.js +524 -0
  157. package/templates/dashboard/assets/app.css +3107 -300
  158. package/templates/dashboard/assets/app.css.manifest.json +9 -0
  159. package/templates/dashboard/assets/app.js +2068 -306
  160. package/templates/dashboard/assets/app.manifest.json +12 -0
  161. package/templates/dashboard/assets/css-src/00-foundation.css +342 -0
  162. package/templates/dashboard/assets/css-src/10-panels-flow.css +236 -0
  163. package/templates/dashboard/assets/css-src/20-briefs-controls.css +398 -0
  164. package/templates/dashboard/assets/css-src/30-task-index.css +739 -0
  165. package/templates/dashboard/assets/css-src/35-review-workspace.css +507 -0
  166. package/templates/dashboard/assets/css-src/40-detail-modules-migration.css +427 -0
  167. package/templates/dashboard/assets/css-src/50-responsive-overrides.css +551 -0
  168. package/templates/dashboard/assets/i18n.js +531 -44
  169. package/templates/dashboard/assets/mermaid-renderer.js +58 -8
  170. package/templates/development/README.md +52 -0
  171. package/templates/development/codebase-map.md +11 -0
  172. package/templates/development/cross-repo-debugging.md +18 -0
  173. package/templates/development/external-context/service-template.md +33 -0
  174. package/templates/development/external-source-packs/README.md +24 -0
  175. package/templates/development/external-source-packs/digest-template.md +28 -0
  176. package/templates/development/local-setup.md +16 -0
  177. package/templates/development/stubs-and-mocks.md +11 -0
  178. package/templates/integrations/README.md +40 -0
  179. package/templates/integrations/api-contract.md +42 -0
  180. package/templates/integrations/event-contract.md +46 -0
  181. package/templates/integrations/third-party/vendor-template.md +42 -0
  182. package/templates/integrations/webhook-contract.md +41 -0
  183. package/templates/ledger/Harness-Ledger.md +13 -25
  184. package/templates/lessons/lesson-arch-process-change.md +1 -1
  185. package/templates/lessons/lesson-new-doc.md +1 -1
  186. package/templates/lessons/lesson-ref-change.md +1 -1
  187. package/templates/planning/brief.md +32 -0
  188. package/templates/planning/execution_strategy.md +31 -0
  189. package/templates/planning/lesson_candidates.md +70 -0
  190. package/templates/planning/long-running-task-contract.md +7 -0
  191. package/templates/planning/module_brief.md +25 -0
  192. package/templates/planning/module_session_prompt.md +6 -0
  193. package/templates/planning/optional/artifacts/INDEX.md +3 -3
  194. package/templates/planning/optional/references/INDEX.md +3 -3
  195. package/templates/planning/review.md +59 -0
  196. package/templates/planning/task_plan.md +40 -15
  197. package/templates/planning/visual_map.md +50 -0
  198. package/templates/reference/docs-library-standard.md +31 -0
  199. package/templates/reference/execution-workflow-standard.md +5 -2
  200. package/templates/reference/external-source-intake-standard.md +82 -0
  201. package/templates/reference/harness-ledger-standard.md +1 -0
  202. package/templates/reference/pull-request-standard.md +80 -0
  203. package/templates/reference/repo-governance-standard.md +8 -5
  204. package/templates/reference/review-routing-standard.md +6 -0
  205. package/templates/reference/walkthrough-standard.md +3 -1
  206. package/templates/verifier/verifier-output.md +1 -1
  207. package/templates/walkthrough/walkthrough-template.md +2 -2
  208. package/templates-zh-CN/AGENTS.md.template +73 -70
  209. package/templates-zh-CN/architecture/Architecture-SSoT.md +21 -0
  210. package/templates-zh-CN/architecture/README.md +51 -0
  211. package/templates-zh-CN/architecture/critical-flows.md +24 -0
  212. package/templates-zh-CN/architecture/local-repo-context.md +20 -0
  213. package/templates-zh-CN/architecture/service-catalog.md +17 -0
  214. package/templates-zh-CN/architecture/services/service-template.md +31 -0
  215. package/templates-zh-CN/architecture/system-map.md +22 -0
  216. package/templates-zh-CN/development/README.md +54 -0
  217. package/templates-zh-CN/development/codebase-map.md +11 -0
  218. package/templates-zh-CN/development/cross-repo-debugging.md +18 -0
  219. package/templates-zh-CN/development/external-context/service-template.md +33 -0
  220. package/templates-zh-CN/development/external-source-packs/README.md +24 -0
  221. package/templates-zh-CN/development/external-source-packs/digest-template.md +28 -0
  222. package/templates-zh-CN/development/local-setup.md +16 -0
  223. package/templates-zh-CN/development/stubs-and-mocks.md +11 -0
  224. package/templates-zh-CN/integrations/README.md +42 -0
  225. package/templates-zh-CN/integrations/api-contract.md +42 -0
  226. package/templates-zh-CN/integrations/event-contract.md +46 -0
  227. package/templates-zh-CN/integrations/third-party/vendor-template.md +42 -0
  228. package/templates-zh-CN/integrations/webhook-contract.md +41 -0
  229. package/templates-zh-CN/ledger/Harness-Ledger.md +17 -40
  230. package/templates-zh-CN/planning/brief.md +32 -0
  231. package/templates-zh-CN/planning/execution_strategy.md +30 -0
  232. package/templates-zh-CN/planning/lesson_candidates.md +70 -0
  233. package/templates-zh-CN/planning/long-running-task-contract.md +1 -1
  234. package/templates-zh-CN/planning/module_brief.md +25 -0
  235. package/templates-zh-CN/planning/module_plan.md +2 -2
  236. package/templates-zh-CN/planning/module_session_prompt.md +4 -3
  237. package/templates-zh-CN/planning/review.md +59 -1
  238. package/templates-zh-CN/planning/task_plan.md +37 -11
  239. package/templates-zh-CN/planning/{visual_roadmap.md → visual_map.md} +21 -2
  240. package/templates-zh-CN/reference/adversarial-review-standard.md +1 -1
  241. package/templates-zh-CN/reference/docs-library-standard.md +36 -1
  242. package/templates-zh-CN/reference/execution-workflow-standard.md +10 -2
  243. package/templates-zh-CN/reference/external-source-intake-standard.md +82 -0
  244. package/templates-zh-CN/reference/harness-ledger-standard.md +7 -4
  245. package/templates-zh-CN/reference/pull-request-standard.md +106 -0
  246. package/templates-zh-CN/reference/repo-governance-standard.md +4 -1
  247. package/templates-zh-CN/reference/review-routing-standard.md +8 -1
  248. package/templates-zh-CN/reference/walkthrough-standard.md +6 -5
  249. package/templates-zh-CN/walkthrough/Closeout-SSoT.md +2 -2
  250. package/templates-zh-CN/walkthrough/walkthrough-template.md +2 -2
  251. package/scripts/smoke-dashboard.mjs +0 -70
  252. package/scripts/test-harness.mjs +0 -483
  253. package/templates/ssot/Feature-SSoT.md +0 -43
  254. package/templates/ssot/Lessons-SSoT.md +0 -44
  255. package/templates-zh-CN/dashboard/assets/app.css +0 -399
  256. package/templates-zh-CN/dashboard/assets/app.js +0 -435
  257. package/templates-zh-CN/dashboard/assets/i18n.js +0 -47
  258. package/templates-zh-CN/dashboard/assets/markdown-reader.js +0 -116
  259. package/templates-zh-CN/dashboard/assets/mermaid-renderer.js +0 -59
  260. package/templates-zh-CN/dashboard/index.html +0 -18
  261. package/templates-zh-CN/ssot/Feature-SSoT.md +0 -49
  262. package/templates-zh-CN/ssot/Lessons-SSoT.md +0 -49
@@ -0,0 +1,324 @@
1
+ # Legacy Harness Smooth Migration Playbook
2
+
3
+ Chinese source: `docs-release/guides/migration-playbook.md`
4
+
5
+ This playbook is written for agents working inside a target project. The goal is not to mechanically rewrite all historical docs. The goal is to move an old project into the v1.0 checkable contract gradually.
6
+
7
+ If another agent will execute the migration, first give it:
8
+
9
+ - `docs-release/guides/legacy-migration-agent-prompt.md`
10
+ - `docs-release/guides/legacy-migration-agent-prompt.zh-CN.md`
11
+ - `docs-release/guides/full-legacy-migration-subagent-strategy.md`
12
+ - `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`
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`.
15
+
16
+ ## Migration Principles
17
+
18
+ - Protect history first, then add the new contract. Do not overwrite `AGENTS.md`, `CLAUDE.md`, historical tasks, walkthroughs, SSoTs, or ledgers.
19
+ - Migrate active tasks before historical tasks. Long-closed tasks may remain legacy evidence in baseline mode.
20
+ - Declare real capabilities before adding corresponding references. A template file does not prove a capability is adopted.
21
+ - Normal checks expose migration backlog. `--strict` is the final cutover gate.
22
+ - For single-line legacy projects, identify the engineering operating model before adopting `module-parallel`.
23
+ - Separate baseline adoption from full readable cutover. Baseline may keep residuals. Full cutover requires dashboard and CLI zero counts.
24
+ - The migration agent must do a read-only scan first, recommend a rewrite depth, and ask the user for confirmation. Do not write files before confirmation, and do not expect the user to understand the modes upfront.
25
+
26
+ ## Scan, Recommend, Then Confirm
27
+
28
+ After receiving the migration prompt, the target-project agent starts with read-only diagnosis, not file repair:
29
+
30
+ ```bash
31
+ git -C /path/to/project status --short --branch
32
+ harness status --json /path/to/project
33
+ harness migrate-plan --json --limit 1000 /path/to/project
34
+ ```
35
+
36
+ Then the agent must give the user a migration plan and actively recommend a migration depth:
37
+
38
+ | Mode | Recommend when | Write strategy |
39
+ | --- | --- | --- |
40
+ | `baseline-preserve` | The user only needs safe v1.0 adoption and has many historical tasks, without strict-clean as the immediate goal. | Do not rewrite historical tasks; add registry, dashboard, active tasks, required metadata, and warning queue only. |
41
+ | `status-aware-rewrite` | The user wants real current work migrated and wants rewrite depth decided by task state. | Rewrite current, reopened, or current-evidence tasks from SSoT / Ledger / progress / review / git evidence; historical tasks become readable index cards or residuals. |
42
+ | `full-semantic-rewrite` | The user wants proof that the old project can be rebuilt as a fully readable v1.0 Harness. | Rewrite every task into the v1.0 readable contract; rewrite existing briefs, execution strategies, and visual maps when they are too thin or old-format. |
43
+
44
+ The plan must include task count, brief coverage, canonical `visual_map.md` coverage, warning/action/residual counts, strict status, dirty file explanation, recommendation rationale, estimated write scope, token/time cost, whether subagents are needed, and questions for user confirmation.
45
+
46
+ Before the user confirms, the agent may only report the plan. It must not run migration commands that write files. After confirmation, continue with the standard flow below.
47
+
48
+ ## Standard Flow
49
+
50
+ 1. Read current state, decide locale, and confirm migration depth:
51
+
52
+ ```bash
53
+ harness status --json /path/to/project
54
+ harness migrate-plan --json /path/to/project
55
+ ```
56
+
57
+ If the project mixes Chinese and English, the agent must not guess template language. Choose explicitly:
58
+
59
+ - Chinese user, Chinese project context, or Chinese-facing docs: `--locale zh-CN`
60
+ - English team or English-facing docs: `--locale en-US`
61
+
62
+ The agent must record concrete evidence for the decision, such as `AGENTS.md`, `CLAUDE.md`, `README.md`, `docs/Harness-Ledger.md`, active task docs, or product-facing docs. If signals conflict, stop and ask the user.
63
+
64
+ If this run does not yet have a user-confirmed migration depth, stop here and do not write files.
65
+
66
+ 2. Run the migration rail:
67
+
68
+ ```bash
69
+ harness migrate-run \
70
+ --locale zh-CN \
71
+ --session-dir /tmp/cah-migration-project \
72
+ --out-dir /tmp/cah-migration-project/dashboard \
73
+ /path/to/project
74
+ ```
75
+
76
+ `migrate-run` creates the compatibility layer declaration, dashboard, normal/strict check snapshots, and session record. It does not stage files. It stops on a dirty target by default; use `--allow-dirty` only after the dirty files are accepted as part of the migration context.
77
+
78
+ The output directory must contain:
79
+
80
+ - `session.json`
81
+ - `report.md`
82
+ - `migrate-plan.json`
83
+ - `status-normal.json`
84
+ - `status-strict.json`
85
+ - `dashboard/index.html`
86
+
87
+ 3. Verify the migration rail:
88
+
89
+ ```bash
90
+ harness migrate-verify /tmp/cah-migration-project/session.json
91
+ ```
92
+
93
+ `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
+
95
+ 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
+
97
+ `migrate-verify` passing does not mean the full migration is complete. Full migration also requires:
98
+
99
+ - `migrate-plan` is `declared-capability`.
100
+ - `warnings=0`, `taskActions=0`, `reviewSchemaGaps=0`, `legacyReferenceGaps=0`, `legacyResiduals=0`, and `recommendedCapabilities=[]`.
101
+ - Normal and strict checks pass.
102
+ - Dashboard status has `summary.briefCoverage.ready == total` and `missing == 0`.
103
+ - Canonical task diagrams use `visual_map.md`. Legacy `visual_roadmap.md` is rewrite input only and does not count as full cutover coverage.
104
+ - The task index opens and shows all tasks.
105
+ - At least one adversarial subagent review round passes.
106
+
107
+ 4. Continue cleanup from the plan:
108
+
109
+ - `MP-01`: confirm compatibility layer and locale; verify historical docs were not overwritten.
110
+ - `MP-02`: choose capabilities; only declare capabilities that project facts support.
111
+ - `MP-03`: add `brief.md`, `execution_strategy.md`, and `visual_map.md` to active tasks.
112
+ - `MP-04`: adopt `module-parallel` only if the project already has multiple independent domains.
113
+ - `MP-05`: upgrade current release/architecture/security/data reviews; do not rewrite every historical review.
114
+ - `MP-06`: only use strict as a gate after normal warnings have owner/action/status.
115
+
116
+ 5. Normal migration verification:
117
+
118
+ ```bash
119
+ harness check --profile target-project /path/to/project
120
+ harness dashboard --out-dir /tmp/harness-dashboard /path/to/project
121
+ ```
122
+
123
+ 6. Strict cutover verification:
124
+
125
+ ```bash
126
+ harness check --profile target-project --strict /path/to/project
127
+ ```
128
+
129
+ `--strict` passing means strict cutover is complete. If the user accepts remaining historical residuals, report `strict deferred` with owner, trigger, and next action. Do not call it complete.
130
+
131
+ ## Historical Task Migration Strategy
132
+
133
+ Legacy migration must read SSoT before warnings. A warning means "the v1 checker cannot understand this," not "the task is unfinished."
134
+
135
+ There are three different goals:
136
+
137
+ - Baseline safe-adoption: long-closed tasks may remain legacy evidence.
138
+ - Status-aware rewrite: use SSoT / Ledger / progress / review / git evidence to classify each task as current, reopened, closed, residual, or superseded; rewrite only the task surfaces that actually need migration.
139
+ - Full semantic rewrite: every task must be readable in the dashboard, so every task needs a standalone `brief.md`, and dashboard brief coverage must be `total/total`.
140
+
141
+ Do not use baseline strategy as full cutover strategy, and do not default to full rewrite without user confirmation.
142
+
143
+ Evidence reading order:
144
+
145
+ 1. `docs/Harness-Ledger.md`: whether the task was closed and whether residuals remain.
146
+ 2. `docs/10-WALKTHROUGH/Closeout-SSoT.md`: walkthrough, Lessons Check, and closeout status.
147
+ 3. `docs/05-TEST-QA/Regression-SSoT.md` and legacy regression SSoTs: whether the related surface passed and whether yellow lights remain.
148
+ 4. The task's own `progress.md`, `review.md`, `findings.md`, and walkthrough.
149
+ 5. Git history, PRs, and commits: whether code or docs landed or were superseded.
150
+
151
+ Subagents should review this evidence chain, not merely list files:
152
+
153
+ | Role | Task | Output |
154
+ | --- | --- | --- |
155
+ | SSoT reviewer | Read Ledger / Closeout / Regression SSoT | Classify the task as `current-active`, `closed-with-evidence`, `closed-with-residual`, `superseded`, or `unknown-history`. |
156
+ | Evidence reviewer | Read task progress / review / walkthrough | Find completion evidence, blockers, or residual evidence. |
157
+ | History reviewer | Read git log / diff / PR clues | Decide whether the task is proven by commits or superseded by later work. |
158
+
159
+ In baseline mode, only `current-active` tasks or tasks still referenced by SSoT as current evidence receive `brief.md`, `execution_strategy.md`, and `visual_map.md`. Other historical tasks should be routed as residuals instead of receiving fake completion templates.
160
+
161
+ In status-aware rewrite mode, an existing `brief.md`, `execution_strategy.md`, or `visual_map.md` is not automatically preserved. If evidence shows it is an old template, parser residue, wrong language, or too weak for a human to judge current state, rewrite it. Historical tasks may become readable index cards or residuals, but that decision must be evidence-backed.
162
+
163
+ Global table and module index migration is not manual refilling. Current Harness versions generate task lifecycle summaries into `Harness-Ledger.md` only; legacy `Feature-SSoT.md` and `Private-Feature-SSoT.md` files are archived during cutover and are not regenerated. Module `module_plan.md` Steps tables and module `visual_map.md` topology tables are still generated from module task files. Humans should inspect current state through the Dashboard; agents can use `task-list` / `task-index` queries for fast lookup. Before cutting over an older project, archive the legacy lifecycle tables and rebuild current indexes from task files:
164
+
165
+ ```bash
166
+ harness governance rebuild --dry-run --archive /path/to/project
167
+ harness governance rebuild --archive --apply /path/to/project
168
+ harness task-list --json --search "keyword" /path/to/project
169
+ ```
170
+
171
+ The archive directory preserves old lifecycle table snapshots. After the Dashboard, `task-list` / `task-index`, and generated Ledger all reflect current tasks, the project owner may decide whether to delete the old archive. Migration agents should not delete historical table evidence directly. Delivery, Regression, Cadence, Closeout, and Module Registry governance tables are not deleted by this step unless a later version provides equivalent scanner and generator support.
172
+
173
+ In full semantic rewrite mode, every task needs a standalone `brief.md`, but the brief must not be an empty template. A historical task brief is a readable index card: task goal, first human read, evidence sources, status judgment, and residuals. `visual_map.md` is a diagram collection, not a roadmap template; include phase flow, sequence, architecture, data-flow, state, topology, or decision maps only when they improve understanding. Do not generate empty diagrams to satisfy a checker.
174
+
175
+ If the legacy project is a microservice, multi-repo, split frontend/backend, or externally integrated project, the migration plan must also ask the user whether external source material exists. Do not migrate dozens of external-team documents directly into `03/04/06`. First use `external-source-intake-standard.md` to create `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`, complete the source index and digests, then project stable facts into service profiles, external contexts, and integration contracts.
176
+
177
+ | Legacy state | Handling |
178
+ | --- | --- |
179
+ | Closed, historical evidence only | Baseline may keep legacy. Full cutover still adds readable `brief.md`, without faking current execution. |
180
+ | Active task with only `task_plan.md` | Add `brief.md`, `execution_strategy.md`, `visual_map.md`, and log migration evidence with `task-log`. |
181
+ | Reopened legacy task | Migrate as active. In a user-confirmed rewrite mode, rewrite old v1 surfaces when needed to carry current facts. |
182
+ | Review exists but is not a current gate | Preserve it and record historical review gap in the migration plan. |
183
+ | Current release-blocking review | Upgrade to v1 `review.md` schema with Evidence Checked and Final Confidence Basis. |
184
+
185
+ ## From Single-Line Tasks to Module Parallel
186
+
187
+ Do not turn many historical tasks into modules automatically. Adopt `module-parallel` only when:
188
+
189
+ - the project has two or more independently evolving product or engineering domains;
190
+ - every module has an owner, write scope, dependency model, and integration rule;
191
+ - shared files are owned by the coordinator and worker changes flow through handoff;
192
+ - `Module-Registry.md` and each `module_plan.md` can be maintained after migration.
193
+
194
+ If the project merely has many historical tasks without stable module boundaries, keep `safe-adoption`, use `migrate-plan` as the action list, and add module capability later.
195
+
196
+ ## Warnings and Actions
197
+
198
+ `migrate-plan --json` converts warnings into four action buckets:
199
+
200
+ - `taskActions`: active tasks missing v1 task contract files.
201
+ - `reviewActions`: current or historical reviews missing v1 review schema.
202
+ - `legacyActions`: older checker gaps for references or governance files.
203
+ - `legacyResiduals`: historical tasks or status-uncertain tasks still missing files. This is counted by missing files, not by tasks, and should not be mechanically migrated.
204
+
205
+ Agents should assign owner/action/status for these actions rather than rewriting the entire repository in one pass. For `legacyResiduals`, first decide whether the task is reopened or still current evidence. Historical content that is not migrated must have a residual reason in closeout.
206
+
207
+ ## Migration Session Contract
208
+
209
+ `migrate-run` writes an auditable `session.json`. A later agent should read the session before relying on a verbal summary:
210
+
211
+ | Field | Meaning |
212
+ | --- | --- |
213
+ | `localeDecision` | Selected `zh-CN` or `en-US`, plus detected language signals. |
214
+ | `capabilities` | Declared capabilities. Legacy projects should at least have `core`, `safe-adoption`, and `dashboard`. |
215
+ | `dashboard.indexPath` | Must point to an existing HTML dashboard. |
216
+ | `checks.normal` | Normal migration check for usability. |
217
+ | `checks.strict` | Final cutover gate; early legacy migration may fail. |
218
+ | `strictDeferred` | Required when strict fails; must include owner, trigger, next action, and failure count. |
219
+ | `git.after.staged` | Must be empty. The migration rail must not stage files. |
220
+
221
+ If the session points the dashboard to Markdown, lacks `strictDeferred`, has locale/registry mismatch, or contains staged files, fix the rail before polishing the report.
222
+
223
+ ## Dashboard Migration Workbench
224
+
225
+ When human confirmation, review completion, or other web actions are needed, use the dynamic local entry point:
226
+
227
+ ```bash
228
+ harness dev /path/to/project
229
+ ```
230
+
231
+ Static dashboards remain useful for CI, migration delivery, and offline evidence snapshots. They must not host write actions such as review confirmation.
232
+
233
+ Large projects should not use a task-level Mermaid chain as the first view. When task count is high or topology edges are sparse, the dashboard should switch to an aggregate migration runway:
234
+
235
+ 1. Baseline snapshot: current historical tasks, capability declarations, and check status.
236
+ 2. Warning triage: warnings as a queue, not a one-time error list.
237
+ 3. Active task contracts: upgrade active or reopened task contracts first.
238
+ 4. Module classification: group by real product/engineering domains; use inferred modules only for browsing when no module is explicit.
239
+ 5. Strict cutover: after current work and gate reviews are migrated, strict check becomes blocking.
240
+
241
+ Each dashboard warning must carry:
242
+
243
+ | Field | Use |
244
+ | --- | --- |
245
+ | `type` | Stable issue type such as missing-brief, review-schema-gap, or legacy-reference-gap. |
246
+ | `scope` | Affected scope: task, module, review, reference, capability, or project. |
247
+ | `priority` | Cleanup priority. Handle P1/P2 first; P3 may stay migration backlog. |
248
+ | `phase` | Suggested migration phase. |
249
+ | `fixability` | Fix mode: template, guided, human-evidence, decision, or manual. |
250
+ | `status` | Queue status: open by default; after cleanup use done/deferred/accepted-residual. |
251
+ | `confidence` | Classification confidence; low confidence needs human confirmation. |
252
+ | `affected` | Primary affected path for list display. |
253
+ | `affectedPaths` | Related file paths for agent or human review. |
254
+ | `requiredAction` | Next action text; dispatch prompts must cite it. |
255
+ | `detail` | Original warning summary for classification review. |
256
+
257
+ For 400+ task projects, use the dashboard this way:
258
+
259
+ - Use paginated Task Index instead of rendering every task in one screen.
260
+ - First group by migration bucket to separate active/current work, brief-ready tasks, and historical month buckets; then narrow by module or month.
261
+ - In baseline mode, do not automatically template historical tasks missing briefs. In status-aware rewrite mode, rewrite only current/reopened/current-evidence tasks with evidence. In full semantic rewrite mode, split all briefs that need readable cutover by date range or module across subagents.
262
+ - Fix warnings by category/type batch, regenerate the dashboard, and compare counts.
263
+
264
+ Full cutover dashboard smoke must verify:
265
+
266
+ - first screen `Brief Coverage` is `total/total`;
267
+ - warning triage is `0 warnings`;
268
+ - active task contract count is `0`;
269
+ - strict cutover count is `0`;
270
+ - Task Index shows `total / total`;
271
+ - `dashboard/data/status.json` includes `summary.briefCoverage` with `missing=0`;
272
+ - every task has `briefPath` and `briefSource=standalone`.
273
+
274
+ If dashboard data lacks these fields, fix the Harness data contract or regenerate the dashboard. Do not make review agents guess field meanings.
275
+
276
+ ## Subagent Orchestration
277
+
278
+ Full migration should not let one agent edit everything from start to finish. Use at least these workers:
279
+
280
+ | Worker | Write scope | Goal |
281
+ | --- | --- | --- |
282
+ | Task Contract Worker | `docs/09-PLANNING/TASKS/**/brief.md`, `execution_strategy.md`, `visual_map.md`, same-task `progress.md` append | Clear task contract gaps; in a confirmed rewrite mode, rewrite weak old surfaces. |
283
+ | Review/Capability Worker | `.harness-capabilities.json`, current strict review files | Declare real capabilities and repair release-blocking review schema. |
284
+ | Legacy Governance Worker | `AGENTS.md`, PR template, `docs/11-REFERENCE/**`, Ledger, Closeout SSoT, lesson candidates/detail docs, walkthrough template | Clear legacy checker aggregate failures. |
285
+ | Brief Coverage Workers | date or module slices, missing or explicitly weak `brief.md` files | Bring dashboard brief coverage to 100 percent and remove empty templates. |
286
+ | Quality Repair Worker | only files named by reviewers | Remove parser residue, empty templates, language mismatch, and weak evidence. |
287
+
288
+ Every worker prompt must state:
289
+
290
+ - target path;
291
+ - only allowed write scope;
292
+ - no git commit;
293
+ - no overwriting existing briefs outside authorized rewrite scope, and no overwriting other workers' changes;
294
+ - derive content from task `task_plan.md` / `progress.md` / `findings.md` / `review.md` / walkthrough / SSoT;
295
+ - final report must include changed count, residuals, and verification command.
296
+
297
+ Only one worker should sequentially update capability registry. Do not run concurrent `add-capability` commands against the same target.
298
+
299
+ ## Adversarial Review
300
+
301
+ Full migration needs at least three read-only review lanes:
302
+
303
+ 1. CLI/session reviewer: rerun `migrate-plan`, normal, strict, `migrate-verify`; check final session/dashboard consistency.
304
+ 2. Brief quality reviewer: scan all missing briefs and sample multiple dates/modules for empty templates, parser-failure text, missing evidence sources, or wrong language.
305
+ 3. Boundary reviewer: confirm source repo, private Harness, and target legacy project boundaries and git states; no staged files and no private content in public repo.
306
+
307
+ Treat any FAIL as valid until disproven with evidence. After fixing, regenerate final session/dashboard and have the failed area reviewed again.
308
+
309
+ ## Module Classification Decision
310
+
311
+ Module classification has three levels and must not skip levels:
312
+
313
+ 1. `explicit module`: tasks already live under `docs/09-PLANNING/MODULES/<module>/`, or a maintained `Module-Registry.md` exists.
314
+ 2. `inferred module`: dashboard temporary grouping from task path/title/ID keywords, for browsing and triage only. It does not mean the project adopted `module-parallel`.
315
+ 3. `legacy-unclassified`: historical tasks that cannot be classified reliably. Preserve history and do not batch-rewrite them.
316
+
317
+ Before creating `Module-Registry.md`, produce a classification summary:
318
+
319
+ - candidate module name;
320
+ - why this is a product/engineering domain rather than a folder or date range;
321
+ - owner / write scope / shared-file coordinator rule;
322
+ - which tasks remain `legacy-unclassified`.
323
+
324
+ If these facts are not true, use dashboard inferred grouping only for cleanup and do not declare `module-parallel`.
@@ -0,0 +1,328 @@
1
+ # 旧 Harness 平滑迁移 Playbook
2
+
3
+ English mirror: `docs-release/guides/migration-playbook.en-US.md`
4
+
5
+ 这份 playbook 写给目标项目里的 agent。目标不是把历史文档全部机械改写,而是让旧项目逐步进入 v1.0 的可检查合同。
6
+
7
+ 如果要把迁移任务交给另一个 agent 执行,先给它读:
8
+
9
+ - `docs-release/guides/legacy-migration-agent-prompt.md`
10
+ - `docs-release/guides/legacy-migration-agent-prompt.zh-CN.md`
11
+ - `docs-release/guides/full-legacy-migration-subagent-strategy.md`
12
+ - `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`
13
+
14
+ 本文默认使用已安装的 `harness` 命令。执行 agent 必须先检查 `command -v harness`。
15
+ 如果目标环境没有 `harness`,不得静默全局安装;先询问用户是否允许运行
16
+ `npm install -g coding-agent-harness`。用户明确同意后才能安装。用户不同意或未回复时,
17
+ 用 `npx --yes coding-agent-harness <command>` 运行同一条 CLI。维护者在本源码仓调试时,
18
+ 可以把同一命令替换为 `node scripts/harness.mjs`。
19
+
20
+ ## 迁移原则
21
+
22
+ - 先保护历史,再补新合同。不要覆盖 `AGENTS.md`、`CLAUDE.md`、历史 task、walkthrough、SSoT 或 ledger。
23
+ - 先迁移活跃任务,再处理历史任务。关闭很久的任务可以继续作为 legacy evidence。
24
+ - 先声明真实 capability,再补对应 reference。不要因为模板存在就声明能力已采用。
25
+ - 普通检查用于发现迁移 backlog;`--strict` 是最终 cutover gate。
26
+ - 单线旧项目要先识别工程组织形态,再决定是否升级为 `module-parallel`。
27
+ - 区分 baseline adoption 和 full readable cutover。baseline 可以保留历史 residual;full cutover 必须让 dashboard 和 CLI 都归零。
28
+ - 迁移 agent 必须先只读扫描、主动推荐迁移深度并询问用户;用户确认前不要写文件,也不要要求用户预先理解这些模式。
29
+
30
+ ## 先扫描、再推荐、再确认
31
+
32
+ 目标项目里的 agent 拿到迁移 prompt 后,第一步不是补文件,而是做只读诊断:
33
+
34
+ ```bash
35
+ git -C /path/to/project status --short --branch
36
+ harness status --json /path/to/project
37
+ harness migrate-plan --json --limit 1000 /path/to/project
38
+ ```
39
+
40
+ 然后 agent 必须给用户一份迁移计划,并主动推荐迁移深度:
41
+
42
+ | 模式 | 何时推荐 | 写入策略 |
43
+ | --- | --- | --- |
44
+ | `baseline-preserve` | 用户只需要先安全接入 v1.0,历史任务很多且暂不追求 strict-clean。 | 不重写历史任务;只补 registry、dashboard、活跃任务、必要 metadata 和 warning 队列。 |
45
+ | `status-aware-rewrite` | 用户要迁移真实当前工作,且希望根据任务状态决定重写深度。 | 根据 SSoT / Ledger / progress / review / git 证据重写当前、重新打开、当前证据任务;历史任务写可读索引或 residual。 |
46
+ | `full-semantic-rewrite` | 用户要证明旧项目整体能重构成 v1.0 可读项目。 | 每个任务都重写为 v1.0 可读合同;已有 brief、execution strategy、visual map 如果不够清楚也要重写。 |
47
+
48
+ 迁移计划必须说明任务总数、brief 覆盖、canonical `visual_map.md` 覆盖、warning/action/residual 计数、strict 状态、dirty 文件解释、推荐原因、预计写入范围、预计 token/时间成本、是否需要 subagent,以及需要用户确认的问题。
49
+
50
+ 用户确认前,agent 只能报告计划,不能运行会写文件的迁移命令。用户确认后,才进入下面的标准流程。
51
+
52
+ ## 标准流程
53
+
54
+ 1. 读取现状、判断语言,并确认迁移深度:
55
+
56
+ ```bash
57
+ harness status --json /path/to/project
58
+ harness migrate-plan --json /path/to/project
59
+ ```
60
+
61
+ 如果项目中英文混杂,不要让 agent 猜模板语言。必须显式选择:
62
+
63
+ - 中文用户、中文项目上下文、中文对外文档:`--locale zh-CN`
64
+ - 英文团队、英文对外文档:`--locale en-US`
65
+
66
+ Agent 必须记录具体判断证据,例如 `AGENTS.md`、`CLAUDE.md`、`README.md`、`docs/Harness-Ledger.md`、活跃任务文档或产品对外文档。信号冲突时停止,让用户选择语言。
67
+
68
+ 如果本轮还没有用户确认的迁移深度,停在这里,不要写文件。
69
+
70
+ 2. 运行迁移轨道:
71
+
72
+ ```bash
73
+ harness migrate-run \
74
+ --locale zh-CN \
75
+ --session-dir /tmp/cah-migration-project \
76
+ --out-dir /tmp/cah-migration-project/dashboard \
77
+ /path/to/project
78
+ ```
79
+
80
+ `migrate-run` 会一次性完成兼容层声明、dashboard 生成、normal/strict 检查快照和 session 记录。它不会 stage 文件。目标仓库 dirty 时默认停止;只有确认 dirty 文件属于本次迁移上下文,才使用 `--allow-dirty`。
81
+
82
+ 输出目录里必须有:
83
+
84
+ - `session.json`
85
+ - `report.md`
86
+ - `migrate-plan.json`
87
+ - `status-normal.json`
88
+ - `status-strict.json`
89
+ - `dashboard/index.html`
90
+
91
+ 3. 验证迁移轨道:
92
+
93
+ ```bash
94
+ harness migrate-verify /tmp/cah-migration-project/session.json
95
+ ```
96
+
97
+ `migrate-verify` 会检查 capability registry、locale、dashboard HTML 路径、普通检查、strict deferred 元数据和 git index。它通过以后,才可以说迁移输出“可用”。
98
+
99
+ 如果后续继续清理 warning 或补活跃任务合同,第一次 session 只能作为 baseline。最终交付前要重新运行 `migrate-run` 生成新 session/dashboard,或者明确列出 baseline session 与最终检查证据的差异。
100
+
101
+ `migrate-verify` 通过不等于 full migration complete。完整迁移还必须满足:
102
+
103
+ - `migrate-plan` 是 `declared-capability`。
104
+ - `warnings=0`、`taskActions=0`、`reviewSchemaGaps=0`、`legacyReferenceGaps=0`、`legacyResiduals=0`、`recommendedCapabilities=[]`。
105
+ - normal 和 strict check 都通过。
106
+ - dashboard status 里 `summary.briefCoverage.ready == total` 且 `missing == 0`。
107
+ - 任务图表 canonical 文件是 `visual_map.md`。旧 `visual_roadmap.md` 只能作为重写输入,不算 full cutover 覆盖。
108
+ - 任务索引页面能打开并显示全量任务。
109
+ - 至少一轮 subagent 对抗审查 PASS。
110
+
111
+ 4. 按计划继续人工/agent 清理:
112
+
113
+ - `MP-01`:确认兼容层和 locale,保证历史文档没有被覆盖。
114
+ - `MP-02`:选择 capability,只声明项目事实已经支持的能力。
115
+ - `MP-03`:给活跃任务补 `brief.md`、`execution_strategy.md`、`visual_map.md`。
116
+ - `MP-04`:如果项目已经有多个独立功能域,再引入 `module-parallel`。
117
+ - `MP-05`:升级当前 release/architecture/security/data review,不重写所有历史 review。
118
+ - `MP-06`:普通检查 warning 都有 owner/action/status 后,再使用 strict 作为门禁。
119
+
120
+ 5. 普通迁移验证:
121
+
122
+ ```bash
123
+ harness check --profile target-project /path/to/project
124
+ harness dashboard --out-dir /tmp/harness-dashboard /path/to/project
125
+ ```
126
+
127
+ 6. 严格切换验证:
128
+
129
+ ```bash
130
+ harness check --profile target-project --strict /path/to/project
131
+ ```
132
+
133
+ `--strict` 通过才表示 strict cutover complete。如果用户接受剩余历史 residual,只能报告 `strict deferred`,并列出 owner、触发条件、下一步动作;不能说严格迁移完成。
134
+
135
+ ## 旧任务迁移策略
136
+
137
+ 旧项目迁移必须先看 SSoT,再看 warning。warning 只说明“v1 checker 看不懂”,不等于任务没有完成。
138
+
139
+ 这里有三个不同目标:
140
+
141
+ - Baseline safe-adoption:允许关闭很久的任务继续作为 legacy evidence。
142
+ - Status-aware rewrite:根据 SSoT / Ledger / progress / review / git 证据判断每个任务是当前、重开、已关闭、有残余还是被后续任务覆盖;只重写真正需要迁移的任务表面。
143
+ - Full semantic rewrite:每个任务都必须能被 dashboard 给人读懂,因此每个任务都需要 standalone `brief.md`,并且 dashboard brief coverage 必须是 `total/total`。
144
+
145
+ 不要把 baseline 策略误用成 full cutover 策略,也不要在没有用户确认时默认全量重写。
146
+
147
+ 证据读取顺序:
148
+
149
+ 1. `docs/Harness-Ledger.md`:任务是否已经收口、是否有 residual。
150
+ 2. `docs/10-WALKTHROUGH/Closeout-SSoT.md`:是否有 walkthrough、Lessons Check 和 closeout status。
151
+ 3. `docs/05-TEST-QA/Regression-SSoT.md` 及项目历史 regression SSoT:对应 surface 是否验证通过、是否仍有黄灯。
152
+ 4. 任务自己的 `progress.md`、`review.md`、`findings.md`、walkthrough。
153
+ 5. git history / PR / commit:代码或文档事实是否已经落地。
154
+
155
+ Subagent 应该围绕这个证据链互审:
156
+
157
+ | 角色 | 任务 | 输出 |
158
+ | --- | --- | --- |
159
+ | SSoT reviewer | 读 Ledger / Closeout / Regression SSoT | 判断任务是 current-active、closed-with-evidence、closed-with-residual、superseded 还是 unknown-history |
160
+ | Evidence reviewer | 读 task progress / review / walkthrough | 找到完成证据、阻塞证据或 residual 证据 |
161
+ | History reviewer | 读 git log / diff / PR 线索 | 判断任务是否已被提交历史或后续任务覆盖 |
162
+
163
+ Baseline 模式下,只有 `current-active` 或 “仍被 SSoT 引用为当前证据”的任务,才补 `brief.md`、`execution_strategy.md`、`visual_map.md`。其他历史任务要写 residual 路由,不要批量补模板制造假完成。
164
+
165
+ Status-aware rewrite 模式下,已有 `brief.md`、`execution_strategy.md`、`visual_map.md` 不是自动保留;如果证据显示它们只是旧模板、解析残留、语言错误或不能让人判断当前状态,就重写。历史任务可以只写可读索引卡或 residual,但这个判断必须有证据。
166
+
167
+ 全局表和模块索引迁移不是人工重填。新版本只把任务生命周期汇总生成到 `Harness-Ledger.md`;旧的 `Feature-SSoT.md` 和 `Private-Feature-SSoT.md` 是 legacy 生命周期投影,切换时应先归档,不再重建。模块 `module_plan.md` 的 Steps 表和模块 `visual_map.md` 的拓扑表仍由模块任务文件生成。人看当前状态应优先看 Dashboard,Agent 需要快速定位时用 `task-list` / `task-index` 查询。旧项目切换前,先把旧生命周期表归档,再用生成器从任务文件重建当前索引:
168
+
169
+ ```bash
170
+ harness governance rebuild --dry-run --archive /path/to/project
171
+ harness governance rebuild --archive --apply /path/to/project
172
+ harness task-list --json --search "keyword" /path/to/project
173
+ ```
174
+
175
+ 归档目录会保留旧生命周期表快照。确认 Dashboard、`task-list` / `task-index` 查询和新生成 Ledger 都能反映当前任务后,再由项目 owner 决定是否删除旧归档;迁移 agent 不应直接删除历史表证据。Delivery、Regression、Cadence、Closeout、Module Registry 等非任务生命周期治理表不是本步骤的删除对象,除非后续版本提供等价 scanner 和生成器。
176
+
177
+ Full semantic rewrite 模式下,所有任务都需要 standalone `brief.md`,但不能写空模板。历史任务的 brief 应该是“可读索引卡”:说明任务目标、第一眼应该看什么、证据来自哪里、状态判断和 residual。`visual_map.md` 是图表集合,不是路线图模板;只画能提高理解速度的 phase flow、sequence、architecture、data-flow、state、topology 或 decision map,不能为了过检查生成空图。
178
+
179
+ 如果旧项目属于微服务、多仓、前后端分仓或依赖外部系统,迁移计划还必须询问用户是否有外部资料。不要把外部团队给的几十份文档直接迁入 `03/04/06`。先按 `external-source-intake-standard.md` 建立 `docs/04-DEVELOPMENT/external-source-packs/<source-key>/`,完成 source index 和 digest,再把稳定事实投影到 service profile、external context 和 integration contract。
180
+
181
+ | 旧状态 | 处理方式 |
182
+ | --- | --- |
183
+ | 已关闭、只作历史证据 | Baseline 可保持 legacy;full cutover 仍需补可读 `brief.md`,但不伪造当前执行状态。 |
184
+ | 活跃任务但只有 `task_plan.md` | 添加 `brief.md`、`execution_strategy.md`、`visual_map.md`,用 `task-log` 记录迁移证据。 |
185
+ | 重新打开的旧任务 | 当作活跃任务迁移;在用户确认的 rewrite 模式下,可以重写旧 v1 表面来承接当前事实。 |
186
+ | 有 review 但不是当前门禁 | 保留原样,迁移计划中记录为历史 review gap。 |
187
+ | 当前 release-blocking review | 升级到 v1 `review.md` schema,补 Evidence Checked 和 Final Confidence Basis。 |
188
+
189
+ ## 从单线任务到模块并行
190
+
191
+ 不要把大量历史 task 自动变成模块。只有满足这些条件才采用 `module-parallel`:
192
+
193
+ - 项目存在两个以上可独立演进的产品或工程域。
194
+ - 每个模块有 owner、write scope、依赖关系和集成规则。
195
+ - 共享文件由 coordinator 维护,worker 通过 handoff 请求更新。
196
+ - `Module-Registry.md` 和每个 `module_plan.md` 能被持续维护。
197
+
198
+ 如果只是历史 task 很多,但没有稳定模块边界,先保持 `safe-adoption`,用 `migrate-plan` 输出 action list,等模块边界明确后再加 capability。
199
+
200
+ ## 报错与行动
201
+
202
+ `migrate-plan --json` 会把 warning 转成四类行动:
203
+
204
+ - `taskActions`:活跃任务缺少 v1 task contract 文件。
205
+ - `reviewActions`:当前或历史 review 缺少 v1 review schema。
206
+ - `legacyActions`:旧 checker 要求的 reference 或治理文件缺口。
207
+ - `legacyResiduals`:历史任务或当前状态无法确认的任务仍缺文件;这是按“缺口文件”计数,不是按任务计数,不应机械迁移。
208
+
209
+ Agent 应该把这些行动分配 owner/action/status,而不是一次性改完整个仓库。对于 `legacyResiduals`,先判断任务是否重新打开或仍是当前证据;不迁移的历史内容要在 closeout 中写明 residual 原因。
210
+
211
+ ## 迁移 Session 合同
212
+
213
+ `migrate-run` 的 `session.json` 是旧项目迁移的可审计交付物。后续 agent 不应该只凭口头总结接手,而应先读取 session:
214
+
215
+ | 字段 | 含义 |
216
+ | --- | --- |
217
+ | `localeDecision` | 本次选择的 `zh-CN` 或 `en-US`,以及中英文探测信号。 |
218
+ | `capabilities` | 已声明 capability,旧项目至少应有 `core`、`safe-adoption`、`dashboard`。 |
219
+ | `dashboard.indexPath` | 必须指向存在的 HTML dashboard。 |
220
+ | `checks.normal` | 普通迁移检查,用来判断当前输出是否可用。 |
221
+ | `checks.strict` | 最终切换门禁,旧项目早期可以失败。 |
222
+ | `strictDeferred` | strict 失败时必须存在 owner、trigger、nextAction 和 failureCount。 |
223
+ | `git.after.staged` | 必须为空,迁移轨道不能替用户 stage 文件。 |
224
+
225
+ 如果 session 里 dashboard 指向 Markdown、缺少 `strictDeferred`、locale 和 registry 不一致,或者有 staged 文件,必须先修轨道,不要继续包装报告。
226
+
227
+ ## Dashboard 迁移工作台
228
+
229
+ 需要人工确认、审查完成标记或其他网页操作时,使用动态本地入口:
230
+
231
+ ```bash
232
+ harness dev /path/to/project
233
+ ```
234
+
235
+ 静态 dashboard 仍用于 CI、迁移交付和离线证据快照;它不能承载 review confirm 之类的写入动作。
236
+
237
+ 大项目不要用任务级 Mermaid 链路作为第一眼视图。任务数量很大或拓扑边不足时,dashboard 会切到聚合迁移跑道:
238
+
239
+ 1. Baseline snapshot:确认当前历史任务、能力声明和检查状态。
240
+ 2. Warning triage:把 warning 当成可分诊队列,而不是一次性报错列表。
241
+ 3. Active task contracts:只先升级活跃或重新打开的任务合同。
242
+ 4. Module classification:按真实产品/工程域分类;没有明确模块时使用 inferred module,不能伪造并行模块。
243
+ 5. Strict cutover:当当前工作和门禁 review 都迁移后,再把 strict check 作为阻塞门禁。
244
+
245
+ Dashboard warning 每条都带这些字段:
246
+
247
+ | 字段 | 用途 |
248
+ | --- | --- |
249
+ | `type` | 稳定问题类型,例如 missing-brief、review-schema-gap、legacy-reference-gap。 |
250
+ | `scope` | 影响面:task、module、review、reference、capability、project。 |
251
+ | `priority` | 清理优先级。P1/P2 先处理,P3 可作为迁移 backlog。 |
252
+ | `phase` | 建议在哪个迁移阶段处理。 |
253
+ | `fixability` | 修复方式:template、guided、human-evidence、decision、manual。 |
254
+ | `status` | 当前队列状态,默认 open;清理后应转成 done/deferred/accepted-residual。 |
255
+ | `confidence` | 分类置信度,低置信度项需要人工确认。 |
256
+ | `affected` | 首要受影响路径,便于列表展示。 |
257
+ | `affectedPaths` | 相关文件路径,用于派发给 agent 或人工复核。 |
258
+ | `requiredAction` | 下一步动作文本,agent 派工时必须引用。 |
259
+ | `detail` | 原始 warning 摘要,用于复核分类是否正确。 |
260
+
261
+ 对 400+ 历史任务的项目,正确的工作方式是:
262
+
263
+ - 用任务索引分页查看,不在一屏渲染全部任务。
264
+ - 先按 dashboard 的迁移分组找活跃任务、已有 brief 的任务和历史月份桶,再按 module 或 month 缩小范围。
265
+ - Baseline 模式下,对缺少 brief 的历史任务不自动补模板;status-aware rewrite 模式下只改写有证据支持的当前/重开/当前证据任务;full semantic rewrite 模式下,按日期段或模块分配 subagent 补齐或重写所有需要可读化的 brief。
266
+ - 对 warning 队列按 category/type 分批修,修完一类再重新生成 dashboard。
267
+
268
+ Full cutover 的 dashboard smoke 必须验证:
269
+
270
+ - 第一屏 `Brief 覆盖` 是 `total/total`。
271
+ - `警告分诊` 是 `0 警告`。
272
+ - `活跃任务合同` 是 `0 项`。
273
+ - `严格切换` 是 `0 项`。
274
+ - 任务索引显示 `total / total`。
275
+ - `dashboard/data/status.json` 包含 `summary.briefCoverage`,且 `missing=0`。
276
+ - 每个 task 有 `briefPath` 且 `briefSource=standalone`。
277
+
278
+ 如果 dashboard 数据缺少这些字段,先修 harness 数据契约或重新生成 dashboard,不要让审查 agent 猜字段语义。
279
+
280
+ ## Subagent 编排
281
+
282
+ 完整迁移不要让一个 agent 从头改到尾。推荐至少拆成这些 worker:
283
+
284
+ | Worker | 写入范围 | 目标 |
285
+ | --- | --- | --- |
286
+ | Task Contract Worker | `docs/09-PLANNING/TASKS/**/brief.md`、`execution_strategy.md`、`visual_map.md`、同任务 `progress.md` 追加 | 清掉 task contract 缺口;在已确认 rewrite 模式下重写薄弱旧表面。 |
287
+ | Review/Capability Worker | `.harness-capabilities.json`、当前 strict review 文件 | 声明真实 capability,修 release-blocking review schema。 |
288
+ | Legacy Governance Worker | `AGENTS.md`、PR template、`docs/11-REFERENCE/**`、Ledger、Closeout SSoT、lesson candidates/detail docs、walkthrough template | 清掉 legacy checker 聚合错误。 |
289
+ | Brief Coverage Workers | 按日期段或模块划分,写缺失或被点名薄弱的 `brief.md` | 把 dashboard brief coverage 变成 100%,并移除空模板。 |
290
+ | Quality Repair Worker | 只写 reviewer 点名的问题文件 | 修掉自动解析痕迹、空模板、语言不一致和证据薄弱。 |
291
+
292
+ 所有 worker prompt 必须写清:
293
+
294
+ - 目标路径。
295
+ - 唯一允许写入范围。
296
+ - 不能提交 git。
297
+ - 不能在未授权 rewrite scope 下覆盖已有 brief,也不能覆盖其他 worker 的改动。
298
+ - 必须从本任务 `task_plan.md` / `progress.md` / `findings.md` / `review.md` / walkthrough / SSoT 提炼。
299
+ - 结束时必须报告修改数量、残余、验证命令。
300
+
301
+ Capability registry 必须由一个 worker 顺序写,不能多个 worker 并发运行 `add-capability`。
302
+
303
+ ## 对抗审查
304
+
305
+ 完整迁移至少需要三类只读审查:
306
+
307
+ 1. CLI/session reviewer:复跑 `migrate-plan`、normal、strict、`migrate-verify`,检查 final session/dashboard 数据是否一致。
308
+ 2. Brief quality reviewer:全量扫描缺失 brief,抽样多日期、多模块 brief,找空模板、解析失败文本、无证据来源、语言不一致。
309
+ 3. Boundary reviewer:确认公开源仓库、私有 harness、目标旧项目的边界和 git 状态,没有 staged 文件,没有私有内容污染公开仓库。
310
+
311
+ 任一 reviewer 给 FAIL,都要先当成有效信号处理。修复后重新生成 final session/dashboard,并让失败项复审通过。
312
+
313
+ ## 模块分类决策
314
+
315
+ 模块分类有三个层级,不能跳级:
316
+
317
+ 1. `explicit module`:任务已经在 `docs/09-PLANNING/MODULES/<module>/` 下,或已有明确 `Module-Registry.md` 维护。
318
+ 2. `inferred module`:dashboard 根据任务路径、标题、ID 关键字临时分组,仅用于浏览和分诊,不代表项目已经采用 `module-parallel`。
319
+ 3. `legacy-unclassified`:无法稳定归类的历史任务,保持历史状态,不要批量改写。
320
+
321
+ 创建 `Module-Registry.md` 前,必须先输出分类摘要:
322
+
323
+ - 候选模块名。
324
+ - 为什么这是产品/工程域,而不是文件夹或时间段。
325
+ - owner / write scope / shared-file coordinator 规则。
326
+ - 哪些任务仍保持 `legacy-unclassified`。
327
+
328
+ 如果这些事实不成立,只使用 dashboard 的 inferred grouping 辅助清理,不声明 `module-parallel`。