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,334 @@
1
+ # 完整旧 Harness 迁移 Subagent 策略
2
+
3
+ English source: `docs-release/guides/full-legacy-migration-subagent-strategy.md`
4
+
5
+ 这份指南用于把大型 pre-v1 Harness 项目完整迁移到可读的 v1 cutover。
6
+
7
+ 当用户需要证明“另一个 agent 能迁移旧项目”,而不只是拿到 baseline safe-adoption 报告时,使用这份指南。
8
+
9
+ ## 完成定义
10
+
11
+ 只有全部满足时,legacy migration 才算完成:
12
+
13
+ - `migrate-plan` 报告 `mode=declared-capability`。
14
+ - `migrate-plan.summary.warnings=0`。
15
+ - `taskActions=0`、`reviewSchemaGaps=0`、`legacyReferenceGaps=0`、`legacyResiduals=0`。
16
+ - `recommendedCapabilities=[]`。
17
+ - `harness check --profile target-project` 通过。
18
+ - `harness check --profile target-project --strict` 通过。
19
+ - 在全新 final session 上 `migrate-verify <session.json>` 通过。
20
+ - Dashboard 能作为 HTML 打开,并且任务索引可用。
21
+ - Dashboard status data 报告 `summary.briefCoverage.ready == total` 且 `missing == 0`。
22
+ - 每个 task 都有可读 standalone `brief.md`,不能只依赖 legacy `task_plan.md` fallback。
23
+ - 所有 final adversarial reviews 在修复后通过。
24
+
25
+ 任何一项不满足,只能报告 `baseline` 或 `strict deferred`,不能说 complete。
26
+
27
+ ## 迁移深度由 Agent 推荐
28
+
29
+ 完整迁移不是一上来就让用户填模式。目标项目里的 agent 必须先只读扫描,再根据证据推荐迁移深度,并等用户确认后才写文件。
30
+
31
+ | 模式 | 目的 | 是否接受 residual | 完成声明 |
32
+ | --- | --- | --- | --- |
33
+ | `baseline-preserve` | 保留历史、创建 registry、生成第一版 dashboard、暴露 warning 队列。 | 是 | "usable baseline" |
34
+ | `status-aware-rewrite` | 根据 SSoT / Ledger / progress / review / git 证据,重写当前、重开、当前证据任务;历史任务写可读索引或 residual。 | 可以,但必须解释。 | "migration usable" 或进入 full cutover |
35
+ | `full-semantic-rewrite` | 证明旧项目整体可以重构成 v1 可读项目,所有任务达到 dashboard 可读,CLI strict-clean。 | 否,除非用户明确接受。 | "migration complete" |
36
+
37
+ Baseline 可以保留历史任务的 legacy 格式。Status-aware rewrite 可以改写已有 brief / execution strategy / visual map,但必须由证据触发。Full semantic rewrite 不能留下 missing briefs、未解决 warnings 或 strict failures。
38
+
39
+ ## Coordinator 合同
40
+
41
+ Coordinator 负责编排和验证。Subagent 负责有边界的迁移切片。
42
+
43
+ Coordinator 规则:
44
+
45
+ - 不要手工修目标文件,除非 subagent 被阻塞且用户接受 coordinator intervention。
46
+ - 给每个 worker disjoint write scope。
47
+ - 告诉每个 worker:其他 agent 同时活跃,不得 revert 或覆盖其他人的工作。
48
+ - 执行用 subagent,独立对抗审查也用 subagent。
49
+ - Subagent 报告只是 claim,直到 coordinator 重新跑检查。
50
+ - 所有 cleanup 后重新生成 final `migrate-run` session。baseline session 不是 final evidence。
51
+ - 除非用户要求,目标 git index 保持 unstaged。
52
+ - 首轮只能做只读扫描和推荐,不要在用户确认迁移深度前启动写入 worker。
53
+
54
+ ## Phase 0: 只读扫描与用户确认
55
+
56
+ 运行:
57
+
58
+ ```bash
59
+ git -C /path/to/project status --short --branch
60
+ harness status --json /path/to/project > /tmp/cah-baseline-status.json
61
+ harness migrate-plan --json --limit 1000 /path/to/project > /tmp/cah-baseline-plan.json
62
+ ```
63
+
64
+ 明确决定 locale:
65
+
66
+ - 中文用户、中文运行文档或中文项目上下文使用 `zh-CN`。
67
+ - 英文团队或英文对外项目文档使用 `en-US`。
68
+ - 中英信号冲突时停止并询问用户。
69
+
70
+ 把扫描结果整理成迁移计划,至少包含任务总数、brief 覆盖、canonical `visual_map.md` 覆盖、warning/action/residual 计数、strict 状态、dirty 文件解释、推荐迁移模式、预计写入范围、预计 token/时间成本、subagent 拆分建议和需要用户确认的问题。
71
+
72
+ 用户确认迁移深度后,运行 baseline rail:
73
+
74
+ ```bash
75
+ harness migrate-run \
76
+ --locale zh-CN \
77
+ --session-dir /tmp/cah-migration-baseline \
78
+ --out-dir /tmp/cah-migration-baseline/dashboard \
79
+ /path/to/project
80
+ ```
81
+
82
+ 如果目标仓库已经 dirty,只有记录 dirty 文件为什么属于本次迁移后,才使用 `--allow-dirty`。
83
+
84
+ 然后运行:
85
+
86
+ ```bash
87
+ harness migrate-verify /tmp/cah-migration-baseline/session.json
88
+ ```
89
+
90
+ 这只能证明迁移轨道能跑通。除非所有完成门禁已经归零,否则不能证明 full migration。
91
+
92
+ ## Phase 1: Work Queue
93
+
94
+ 读取:
95
+
96
+ - `/tmp/cah-baseline-plan.json`
97
+ - `/tmp/cah-migration-baseline/session.json`
98
+ - `docs/Harness-Ledger.md`
99
+ - `docs/10-WALKTHROUGH/Closeout-SSoT.md`
100
+ - `docs/05-TEST-QA/Regression-SSoT.md`
101
+ - 当前 task 的 `progress.md`、`review.md`、`findings.md`
102
+ - 任务状态不清楚时读取 git history
103
+
104
+ 按这个顺序建立队列:
105
+
106
+ 1. Capability registry 和 locale。
107
+ 2. Task contracts:`brief.md`、`execution_strategy.md`、`visual_map.md`。
108
+ 3. Review schema。
109
+ 4. Legacy governance 和 reference checker failures。
110
+ 5. 每个 task 的 dashboard readability briefs。
111
+ 6. 弱 brief 或 stale dashboard data 的质量修复。
112
+
113
+ 任何队列还有 open item 时,不进入 final verification。
114
+
115
+ ## Phase 2: 执行 Subagents
116
+
117
+ 使用小而有边界的 worker role。写入范围不重叠时可以顺序或并行。
118
+
119
+ | Worker | 写入范围 | 目标 |
120
+ | --- | --- | --- |
121
+ | Task Contract Worker | `docs/09-PLANNING/TASKS/**/brief.md`、`execution_strategy.md`、`visual_map.md`、同任务 `progress.md` 可选追加 | 清掉 task contract failures;在已确认 rewrite 模式下重写薄弱旧表面。 |
122
+ | Review/Capability Worker | `.harness-capabilities.json`、当前 strict review 文件 | 声明真实能力并规范 release-blocking review schema。 |
123
+ | Legacy Governance Worker | `AGENTS.md`、PR template 或 residual、`docs/11-REFERENCE/**`、Ledger、Closeout SSoT、lesson candidates/detail docs、walkthrough template | 清掉 legacy checker failures。 |
124
+ | Brief Coverage Workers | 按 task 日期段或模块拆分,写缺失或被点名薄弱的 `brief.md` | 达到 dashboard brief coverage 100%,并移除空模板。 |
125
+ | Quality Repair Worker | 只写 reviewer 点名的文件 | 移除弱 brief、自动解析痕迹和 stale dashboard assumptions。 |
126
+
127
+ Worker prompt 必须包含:
128
+
129
+ - 准确目标路径。
130
+ - 准确允许写入范围。
131
+ - 明确不要提交 git。
132
+ - 明确不要覆盖已有用户改动或其他 agent 改动。
133
+ - 要求本地证据,不要通用模板;已有文件也只有在用户确认的 rewrite 模式和证据支持下才能改写。
134
+ - 要求 final self-check command 或 scan。
135
+ - 要求列出 changed path summary 和 residuals。
136
+
137
+ Brief worker prompt 示例:
138
+
139
+ ```text
140
+ Your write scope is only docs/09-PLANNING/TASKS/2026-03-11* through 2026-03-31*/brief.md.
141
+ Only create missing brief.md unless the coordinator explicitly assigned user-confirmed rewrite scope. Do not edit progress.md, task_plan.md, review.md, execution_strategy.md, or visual_map.md unless they are in your assigned write scope.
142
+ Every brief must be Chinese-first if locale is zh-CN and must cite this task's task_plan.md/progress.md/findings.md/review evidence.
143
+ Do not leave parser-failure phrases such as "unknown", "could not parse", "若干", "未能解析", "未提供 Current Focus", or "无明确 Roadmap Binding".
144
+ ```
145
+
146
+ ## Phase 3: Capability Registry
147
+
148
+ Full cutover 需要 declared-capability mode。
149
+
150
+ 顺序添加 capability。不要并发对同一个 target registry 运行 `add-capability`。
151
+
152
+ ```bash
153
+ harness add-capability safe-adoption --locale zh-CN /path/to/project
154
+ harness add-capability dashboard --locale zh-CN /path/to/project
155
+ harness add-capability long-running-task --locale zh-CN /path/to/project
156
+ harness add-capability adversarial-review --locale zh-CN /path/to/project
157
+ ```
158
+
159
+ 只有项目事实支持时,才声明 optional capabilities。如果 legacy artifacts 证明该能力存在,且 strict migration 采用了对应标准,才声明。
160
+
161
+ 验证:
162
+
163
+ ```bash
164
+ harness migrate-plan --json --limit 1000 /path/to/project
165
+ ```
166
+
167
+ 预期:
168
+
169
+ - `mode=declared-capability`
170
+ - `recommendedCapabilities=[]`
171
+
172
+ ## Phase 4: Task Contracts
173
+
174
+ 每个需要在 dashboard 中可读的任务:
175
+
176
+ - `brief.md` 回答任务是什么、为什么重要、人第一眼看什么、当前状态、风险、残余和证据来源。
177
+ - `execution_strategy.md` 说明 agent 如何恢复或验证任务。
178
+ - `visual_map.md` 是图表集合:只放能帮助人理解任务的 phase flow、sequence、architecture、data-flow、state、topology 或 decision map。不是所有任务都要画满所有图,也不能生成空图。
179
+
180
+ Full readable cutover 要求每个 task 都有 standalone `brief.md`。这比 baseline safe-adoption 严格。
181
+
182
+ Brief 最小结构:
183
+
184
+ ```markdown
185
+ # Brief
186
+
187
+ ## Task Goal
188
+
189
+ ## First Human Read
190
+
191
+ ## Execution and Evidence Flow
192
+
193
+ ## Current Status Judgment
194
+
195
+ ## Risks and Residuals
196
+
197
+ ## Evidence Sources
198
+ ```
199
+
200
+ `zh-CN` 使用中文标题:
201
+
202
+ ```markdown
203
+ # Brief
204
+
205
+ ## 任务目标
206
+
207
+ ## 迁移后的第一眼
208
+
209
+ ## 执行/证据流
210
+
211
+ ## 当前状态判断
212
+
213
+ ## 风险与残余
214
+
215
+ ## 证据来源
216
+ ```
217
+
218
+ 不可接受内容:
219
+
220
+ - 空模板文本。
221
+ - `若干`、`未能解析`、`unknown`、`not parsed` 等解析失败文本。
222
+ - 没有证据的完成声明。
223
+ - 不引用本地文件的摘要。
224
+ - 中文迁移里出现英文 stub headings。
225
+
226
+ ## Phase 5: Legacy Governance
227
+
228
+ Task/review cleanup 后,strict cutover 仍可能因为旧 checker 要求 governance surfaces 而失败。
229
+
230
+ 修复或路由:
231
+
232
+ - `AGENTS.md` 指向所有已采用 standards 和 SSoTs。
233
+ - `repo-governance-standard.md` 包含 repo platform profile、PR policy 和 branch protection。
234
+ - `delivery-operating-model-standard.md` 定义 operating model profile、agent visibility 和 delivery SSoT。
235
+ - PR template 存在,或有 explicit blocked-with-owner residual。
236
+ - `Harness-Ledger.md` 包含 repo governance / CI-CD 和 Lessons Check 列。
237
+ - `Closeout-SSoT.md` 包含 walkthrough、Lessons Check 和 closeout status。
238
+ - Promoted lessons 位于 `docs/01-GOVERNANCE/lessons/*.md`;任务本地候选保留在 `lesson_candidates.md`。
239
+ - `_walkthrough-template.md` 包含 Lessons Reflection。
240
+
241
+ 不要覆盖业务事实。尽量 merge 缺失列,或追加 migration section。
242
+
243
+ ## Phase 6: Dashboard Smoke
244
+
245
+ 所有修复后生成全新 final dashboard:
246
+
247
+ ```bash
248
+ rm -rf /tmp/cah-migration-final
249
+ harness migrate-run \
250
+ --allow-dirty \
251
+ --locale zh-CN \
252
+ --session-dir /tmp/cah-migration-final \
253
+ --out-dir /tmp/cah-migration-final/dashboard \
254
+ /path/to/project
255
+ ```
256
+
257
+ 然后验证:
258
+
259
+ ```bash
260
+ harness migrate-verify /tmp/cah-migration-final/session.json
261
+ ```
262
+
263
+ `file://` 无法打开时用本地服务:
264
+
265
+ ```bash
266
+ cd /tmp/cah-migration-final/dashboard
267
+ python3 -m http.server 55983 --bind 127.0.0.1
268
+ ```
269
+
270
+ Dashboard smoke 必须检查:
271
+
272
+ - 第一屏显示 status passed。
273
+ - Brief coverage 是 `total/total`。
274
+ - Warning count 是 0。
275
+ - Strict cutover count 是 0。
276
+ - Task index 能打开。
277
+ - Task index 显示 `total / total`。
278
+ - Search、status filter 和 grouping controls 能渲染。
279
+ - 至少一个 task detail 能打开。
280
+
281
+ Data smoke:
282
+
283
+ ```bash
284
+ node -e '
285
+ const fs = require("fs");
286
+ const status = JSON.parse(fs.readFileSync("/tmp/cah-migration-final/dashboard/data/status.json", "utf8"));
287
+ console.log(status.summary.briefCoverage);
288
+ console.log(status.tasks.filter((task) => task.briefSource !== "standalone" || !task.briefPath).slice(0, 5));
289
+ '
290
+ ```
291
+
292
+ 预期:
293
+
294
+ - `ready == total`
295
+ - `missing == 0`
296
+ - 没有 task 缺 `briefPath`
297
+
298
+ ## Phase 7: Adversarial Review
299
+
300
+ Coordinator 认为迁移完成后,至少跑三条独立 review lanes。
301
+
302
+ | Reviewer | 检查 | 失败例子 |
303
+ | --- | --- | --- |
304
+ | CLI/session reviewer | `migrate-plan`、normal、strict、`migrate-verify`、session fields、dashboard data。 | `legacy-compat`、stale session、strict deferred、无 brief coverage summary。 |
305
+ | Brief quality reviewer | 缺失 brief 扫描,跨时间段/模块抽样 brief 质量。 | 空模板、parser-failure text、无 evidence sources、语言错误。 |
306
+ | Boundary reviewer | 源仓 cleanliness、private/public boundary、target dirty whitelist、staged files。 | private docs 被 stage 到公开仓、target 有 staged files、意外 target paths。 |
307
+ | External source reviewer(如适用) | 外部资料是否进入 source pack,digest 是否投影到 `03/04/06`,敏感资料是否未入仓。 | 原始外部文档直接堆进执行目录、digest 没有 projection、疑似密钥或客户数据入仓。 |
308
+
309
+ 任何 reviewer 说 FAIL:
310
+
311
+ 1. 先当成有效,除非有证据推翻。
312
+ 2. 修目标文件或 harness data contract。
313
+ 3. 重新生成 final session 和 dashboard。
314
+ 4. 重新跑失败 review 和 coordinator full smoke。
315
+
316
+ 不要带着已知 FAIL 结束。
317
+
318
+ ## Final Report Template
319
+
320
+ 报告:
321
+
322
+ - Target path。
323
+ - Final dashboard URL/path。
324
+ - Capability registry。
325
+ - `migrate-plan` zero counts。
326
+ - normal 和 strict check 结果。
327
+ - `migrate-verify` 结果。
328
+ - Dashboard brief coverage。
329
+ - 使用过的 subagent worker roles。
330
+ - Final adversarial review outcomes。
331
+ - Target git status:staged count 和 dirty path categories。
332
+ - accepted residuals;如果没有,写 none。
333
+
334
+ 除非所有 Definition of Done gates 都通过,不要说 "complete"。