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,113 @@
1
+ # 文档受众与表面边界
2
+
3
+ English mirror: `docs-release/guides/document-audience-and-surfaces.en-US.md`
4
+
5
+ Coding Agent Harness 的文档不是一类东西。它同时服务三种读者:
6
+
7
+ - 人:需要理解产品、架构、迁移方式和项目状态。
8
+ - Agent:需要可执行的入口、规则、任务合同和证据路径。
9
+ - 发布系统:需要知道哪些文件可以进入公开包,哪些文件只是本地运行状态。
10
+
11
+ 如果不区分受众,文档会变成一堆 Markdown。人看不出重点,Agent 也不知道应该信哪一份。
12
+
13
+ ## 总原则
14
+
15
+ 人读的文档解释意图和判断。
16
+
17
+ Agent 读的文档定义事实、路径、门禁和下一步动作。
18
+
19
+ 发布文档说明方法论和产品能力,不携带某个团队的私有运行台账。
20
+
21
+ ## 文档表面
22
+
23
+ | 表面 | 主要读者 | 放什么 | 不放什么 |
24
+ | --- | --- | --- | --- |
25
+ | `README.md` | 人 | 项目是什么、如何开始、关键链接 | 长任务状态、私有 ledger |
26
+ | `docs-release/` | 人和评估者 | 公开架构、指南、模式说明、迁移教程 | 私有任务计划、内部 review、客户现场状态 |
27
+ | `references/` | Agent 和维护者 | 可复用标准,例如 testing、workflow、review、worktree | 某个项目的当前排期 |
28
+ | `templates/` | CLI 和 Agent | 初始化目标项目时生成的文件 | 已经执行过的任务证据 |
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 | 收口证据、残留项、人工确认 | 未验证的计划 |
33
+
34
+ ## 人读文档
35
+
36
+ 人读文档要回答:
37
+
38
+ - 这套方法解决什么问题?
39
+ - 我应该选择哪种仓库组织方式?
40
+ - 迁移旧项目时风险在哪里?
41
+ - 什么证据能让我相信 Agent 没有跑偏?
42
+
43
+ 典型文件:
44
+
45
+ - `docs-release/architecture/overview.zh-CN.md`
46
+ - `docs-release/guides/repository-operating-models.md`
47
+ - `docs-release/guides/parent-control-repository-pattern.md`
48
+ - `docs-release/guides/migration-playbook.md`
49
+
50
+ 人读文档可以讲取舍、例子和判断过程,但不能成为唯一事实源。真正的项目状态必须落到 SSoT、task、review、walkthrough 和 regression 文件里。
51
+
52
+ ## Agent 读文档
53
+
54
+ Agent 读文档要回答:
55
+
56
+ - 我从哪里开始读?
57
+ - 哪些文件是事实源?
58
+ - 我可以改哪些路径?
59
+ - 改完要跑哪些检查?
60
+ - 什么条件下必须停下来问人?
61
+
62
+ 典型文件:
63
+
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`
72
+
73
+ Agent 文档应该具体、短路径、可检查。不要把它写成文章,也不要让 Agent 从长篇叙事里猜执行合同。
74
+
75
+ ## 发布文档
76
+
77
+ 发布文档要解释 Coding Agent Harness 的公开能力,而不是记录维护者自己的开发过程。
78
+
79
+ 可以发布:
80
+
81
+ - 架构总览。
82
+ - 安装和迁移指南。
83
+ - 单仓、多仓、主控仓库模式的选择指南。
84
+ - 给 Agent 使用的公开迁移 prompt。
85
+ - 可复用的工程方法论。
86
+
87
+ 不应发布:
88
+
89
+ - 某个私有任务的进行中结论。
90
+ - 私有 review 草稿。
91
+ - 只对某台机器有效的路径。
92
+ - 客户或团队内部状态。
93
+ - 还没有脱敏的 ledger、handoff、walkthrough。
94
+
95
+ ## 写作规则
96
+
97
+ 1. 先判断读者,再写文件。
98
+ 2. 人读文档负责解释为什么;Agent 文档负责定义怎么做。
99
+ 3. 公开文档可以引用模式和结构,不要引用私有运行状态。
100
+ 4. 任务状态只写在 SSoT、task、review、walkthrough 和 ledger 里。
101
+ 5. 如果一个文档既要给人读又要给 Agent 执行,把它拆成两份:公开说明和执行合同。
102
+
103
+ ## 一个判断问题
104
+
105
+ 写文档前问一句:
106
+
107
+ > 这个文件被谁在什么时刻读取,并且读取后要做什么动作?
108
+
109
+ 如果答案是“人用来理解”,放在公开指南或架构文档里。
110
+
111
+ 如果答案是“Agent 用来执行”,放在目标项目的入口、任务、标准或回归文件里。
112
+
113
+ 如果答案是“维护者记录当前仓库如何运转”,它不是公开发布文档。
@@ -0,0 +1,334 @@
1
+ # Full Legacy Migration Subagent Strategy
2
+
3
+ Chinese mirror: `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`
4
+
5
+ This guide is for agents migrating a large pre-v1 Harness project all the way to a readable v1 cutover.
6
+
7
+ Use it when the user needs proof that another agent can migrate an old project, not just a baseline safe-adoption report.
8
+
9
+ ## Definition of Done
10
+
11
+ A legacy migration is complete only when all of these are true:
12
+
13
+ - `migrate-plan` reports `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` passes.
18
+ - `harness check --profile target-project --strict` passes.
19
+ - `migrate-verify <session.json>` passes on a fresh final session.
20
+ - The dashboard opens as HTML and the task index is usable.
21
+ - Dashboard status data reports `summary.briefCoverage.ready == total` and `missing == 0`.
22
+ - Every task has a readable standalone `brief.md`, not just a legacy `task_plan.md` fallback.
23
+ - Final adversarial reviews pass after any fixes.
24
+
25
+ If any item above is not true, report the migration as `baseline` or `strict deferred`, not complete.
26
+
27
+ ## Agent-Recommend Migration Depth
28
+
29
+ Full migration does not begin by asking the user to pick a mode. The target-project agent must run a read-only scan first, recommend a migration depth from evidence, and wait for user confirmation before writing files.
30
+
31
+ | Mode | Purpose | Accepts residuals | Completion claim |
32
+ | --- | --- | --- | --- |
33
+ | `baseline-preserve` | Preserve history, create registry, produce first dashboard, expose warning queue. | Yes | "usable baseline" |
34
+ | `status-aware-rewrite` | Use SSoT / Ledger / progress / review / git evidence to rewrite current, reopened, or current-evidence tasks; historical tasks become readable index cards or residuals. | Allowed, but must be explained. | "migration usable" or proceed to full cutover |
35
+ | `full-semantic-rewrite` | Prove the old project can be rebuilt as a readable v1 project, with all tasks dashboard-readable and CLI strict-clean. | No, unless explicitly accepted by user. | "migration complete" |
36
+
37
+ Baseline mode may leave historical tasks in legacy format. Status-aware rewrite may rewrite existing briefs, execution strategies, and visual maps, but only when evidence requires it. Full semantic rewrite may not leave missing briefs, unresolved warnings, or strict failures.
38
+
39
+ ## Coordinator Contract
40
+
41
+ The coordinator owns orchestration and verification. Subagents own bounded migration slices.
42
+
43
+ Coordinator rules:
44
+
45
+ - Do not fix target files manually unless a subagent is blocked and the user accepts coordinator intervention.
46
+ - Give each worker a disjoint write scope.
47
+ - Tell every worker that other agents are active and that they must not revert or overwrite other work.
48
+ - Use subagents for execution and separate subagents for adversarial review.
49
+ - Treat subagent reports as claims until the coordinator reruns checks.
50
+ - Regenerate the final `migrate-run` session after all cleanup. A baseline session is not final evidence.
51
+ - Keep the target git index unstaged unless the user asks to stage.
52
+ - The first pass is read-only scan and recommendation. Do not start write workers before the user confirms migration depth.
53
+
54
+ ## Phase 0: Read-Only Scan and User Confirmation
55
+
56
+ Run:
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
+ Decide locale explicitly:
65
+
66
+ - Use `zh-CN` for Chinese users, Chinese operating docs, or Chinese project context.
67
+ - Use `en-US` for English teams or English-facing project docs.
68
+ - If mixed-language signals conflict, stop and ask the user.
69
+
70
+ Turn the scan into a migration plan. It must include task count, brief coverage, canonical `visual_map.md` coverage, warning/action/residual counts, strict status, dirty file explanation, recommended mode, estimated write scope, token/time cost, subagent split, and questions for user confirmation.
71
+
72
+ After the user confirms migration depth, run the 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
+ If the target is already dirty, use `--allow-dirty` only after recording why the dirty files belong to this migration.
83
+
84
+ Then run:
85
+
86
+ ```bash
87
+ harness migrate-verify /tmp/cah-migration-baseline/session.json
88
+ ```
89
+
90
+ This proves the migration rail works. It does not prove full migration unless all completion gates are already zero.
91
+
92
+ ## Phase 1: Work Queue
93
+
94
+ Read:
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
+ - current task `progress.md`, `review.md`, `findings.md`
102
+ - git history when task status is unclear
103
+
104
+ Build the queue in this order:
105
+
106
+ 1. Capability registry and locale.
107
+ 2. Task contracts: `brief.md`, `execution_strategy.md`, `visual_map.md`.
108
+ 3. Review schema.
109
+ 4. Legacy governance and reference checker failures.
110
+ 5. Dashboard readability briefs for every task.
111
+ 6. Quality repair for weak briefs or stale dashboard data.
112
+
113
+ Do not move to final verification while any queue has open items.
114
+
115
+ ## Phase 2: Execution Subagents
116
+
117
+ Use small, bounded worker roles. These roles can run sequentially or in parallel when write scopes do not overlap.
118
+
119
+ | Worker | Write scope | Goal |
120
+ | --- | --- | --- |
121
+ | Task Contract Worker | `docs/09-PLANNING/TASKS/**/brief.md`, `execution_strategy.md`, `visual_map.md`, optional same-task `progress.md` log | Remove task contract failures; in a confirmed rewrite mode, rewrite weak old surfaces. |
122
+ | Review/Capability Worker | `.harness-capabilities.json`, current strict review files | Declare real capabilities and normalize release-blocking review schema. |
123
+ | Legacy Governance Worker | `AGENTS.md`, PR template or residual, `docs/11-REFERENCE/**`, Ledger, Closeout SSoT, lesson candidates/detail docs, walkthrough template | Clear legacy checker failures. |
124
+ | Brief Coverage Workers | disjoint task-date or module ranges, missing or explicitly weak `brief.md` files | Reach dashboard brief coverage 100 percent and remove empty templates. |
125
+ | Quality Repair Worker | only files named by reviewer | Remove weak brief patterns and stale dashboard assumptions. |
126
+
127
+ Worker prompt requirements:
128
+
129
+ - State the exact target path.
130
+ - State the exact allowed write scope.
131
+ - Tell the worker not to submit git changes.
132
+ - Tell the worker not to overwrite existing user or other-agent changes.
133
+ - Require local evidence, not generic templates; existing files may be rewritten only under user-confirmed rewrite scope and evidence.
134
+ - Require a final self-check command or scan.
135
+ - Ask for changed path summary and residuals.
136
+
137
+ Example 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 requires declared-capability mode.
149
+
150
+ Sequentially add capabilities. Do not run `add-capability` in parallel against the same target registry.
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
+ Declare optional capabilities only when project facts justify them. If legacy artifacts prove the capability exists and strict migration adopts the corresponding standards, declare it.
160
+
161
+ Verify:
162
+
163
+ ```bash
164
+ harness migrate-plan --json --limit 1000 /path/to/project
165
+ ```
166
+
167
+ Expected:
168
+
169
+ - `mode=declared-capability`
170
+ - `recommendedCapabilities=[]`
171
+
172
+ ## Phase 4: Task Contracts
173
+
174
+ For every task that must be readable in the dashboard:
175
+
176
+ - `brief.md` answers what the task is, why it matters, what a human should inspect first, current state, risks, residuals, and evidence sources.
177
+ - `execution_strategy.md` explains how an agent should resume or verify the task.
178
+ - `visual_map.md` is a diagram collection: include phase flow, sequence, architecture, data-flow, state, topology, or decision maps only when they help a human understand the task. Do not require every diagram type, and do not generate empty diagrams.
179
+
180
+ Full readable cutover requires every task to have a standalone `brief.md`. This is stricter than baseline safe-adoption.
181
+
182
+ Brief minimum structure:
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
+ For `zh-CN`, use Chinese headings:
201
+
202
+ ```markdown
203
+ # Brief
204
+
205
+ ## 任务目标
206
+
207
+ ## 迁移后的第一眼
208
+
209
+ ## 执行/证据流
210
+
211
+ ## 当前状态判断
212
+
213
+ ## 风险与残余
214
+
215
+ ## 证据来源
216
+ ```
217
+
218
+ Unacceptable brief content:
219
+
220
+ - Empty template text.
221
+ - Parser failure text such as `若干`, `未能解析`, `unknown`, `not parsed`.
222
+ - Claims of completion without evidence.
223
+ - A summary that does not cite local files.
224
+ - English stub headings in a Chinese migration.
225
+
226
+ ## Phase 5: Legacy Governance
227
+
228
+ Strict cutover may still fail after task/review cleanup because old checker rules require governance surfaces.
229
+
230
+ Fix or route:
231
+
232
+ - `AGENTS.md` routes to all adopted standards and SSoTs.
233
+ - `repo-governance-standard.md` includes repo platform profile, PR policy, and branch protection.
234
+ - `delivery-operating-model-standard.md` defines operating model profile, agent visibility, and delivery SSoT.
235
+ - PR template exists or an explicit blocked-with-owner residual exists.
236
+ - `Harness-Ledger.md` includes repo governance / CI-CD and Lessons Check columns.
237
+ - `Closeout-SSoT.md` includes walkthrough, Lessons Check, and closeout status.
238
+ - Promoted lessons live in `docs/01-GOVERNANCE/lessons/*.md`; task-local candidates stay in `lesson_candidates.md`.
239
+ - `_walkthrough-template.md` includes Lessons Reflection.
240
+
241
+ Do not overwrite business facts. Merge missing columns or append a migration section when possible.
242
+
243
+ ## Phase 6: Dashboard Smoke
244
+
245
+ Generate a fresh final dashboard after all fixes:
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
+ Then verify:
258
+
259
+ ```bash
260
+ harness migrate-verify /tmp/cah-migration-final/session.json
261
+ ```
262
+
263
+ Serve the dashboard when `file://` cannot be opened:
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 must check:
271
+
272
+ - First screen says status passed.
273
+ - Brief coverage is `total/total`.
274
+ - Warning count is 0.
275
+ - Strict cutover count is 0.
276
+ - Task index opens.
277
+ - Task index shows `total / total`.
278
+ - Search, status filter, and grouping controls render.
279
+ - At least one task detail opens.
280
+
281
+ Data smoke must check:
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
+ Expected:
293
+
294
+ - `ready == total`
295
+ - `missing == 0`
296
+ - no task without `briefPath`
297
+
298
+ ## Phase 7: Adversarial Review
299
+
300
+ Run at least three independent review lanes after the coordinator believes migration is done.
301
+
302
+ | Reviewer | Checks | Failure examples |
303
+ | --- | --- | --- |
304
+ | CLI/session reviewer | `migrate-plan`, normal, strict, `migrate-verify`, session fields, dashboard data. | `legacy-compat`, stale session, strict deferred, no brief coverage summary. |
305
+ | Brief quality reviewer | Missing brief scan and sampled brief quality across time ranges/modules. | Empty templates, parser-failure text, no evidence sources, wrong language. |
306
+ | Boundary reviewer | Source repo cleanliness, private/public boundary, target dirty whitelist, staged files. | Private docs staged publicly, target staged files, unexpected target paths. |
307
+ | External source reviewer (when applicable) | External material is in source packs, digests are projected into `03/04/06`, and sensitive raw material is not committed. | Raw external documents dumped into execution dirs, digest has no projection, possible secrets or customer data committed. |
308
+
309
+ If any reviewer says FAIL:
310
+
311
+ 1. Treat it as valid until disproven with evidence.
312
+ 2. Fix the target or the harness data contract.
313
+ 3. Regenerate final session and dashboard.
314
+ 4. Re-run only the failed review plus the coordinator's full smoke.
315
+
316
+ Do not end with a known FAIL review.
317
+
318
+ ## Final Report Template
319
+
320
+ Report:
321
+
322
+ - Target path.
323
+ - Final dashboard URL/path.
324
+ - Capability registry.
325
+ - `migrate-plan` zero counts.
326
+ - normal and strict check results.
327
+ - `migrate-verify` result.
328
+ - Dashboard brief coverage.
329
+ - Subagent worker roles used.
330
+ - Final adversarial review outcomes.
331
+ - Target git status: staged count and dirty path categories.
332
+ - Any accepted residuals. If none, say none.
333
+
334
+ Do not say "complete" unless all Definition of Done gates pass.