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,254 @@
1
+ # Parent-Control Repository Pattern
2
+
3
+ Chinese mirror: `docs-release/guides/parent-control-repository-pattern.md`
4
+
5
+ The parent-control repository pattern is a repository organization model for multi-repo Coding Agent Harness projects.
6
+
7
+ Its core rule is:
8
+
9
+ > Business code may be distributed across many repositories, but the agent operating contract must not be distributed.
10
+
11
+ The parent repository owns the harness. Child repositories own implementation facts.
12
+
13
+ ## Why This Pattern Exists
14
+
15
+ Multi-repo projects often run into these failures:
16
+
17
+ - Frontend, backend, SDK, and services each have their own plans, and no one can tell where the global release is blocked.
18
+ - An agent starts inside a child repository, reads only local `AGENTS.md`, and misses cross-repo architecture constraints.
19
+ - Each repository maintains its own handwritten task lifecycle table, and the states conflict.
20
+ - Review evidence, test evidence, and walkthroughs are scattered across repositories, making it hard to prove that a cross-repo task is complete.
21
+
22
+ The parent-control pattern solves a control-plane problem. It does not force code back into a monorepo. It moves the harness source of truth into one place.
23
+
24
+ ## Basic Topology
25
+
26
+ ```text
27
+ product-control-repo/
28
+ AGENTS.md
29
+ README.md
30
+ docs/
31
+ 01-GOVERNANCE/
32
+ 02-PRODUCT/
33
+ 03-ARCHITECTURE/
34
+ 04-DEVELOPMENT/
35
+ 05-TEST-QA/
36
+ 06-INTEGRATIONS/
37
+ 09-PLANNING/
38
+ 10-WALKTHROUGH/
39
+ 11-REFERENCE/
40
+ tools/
41
+ check-harness.mjs
42
+ internal-ci.mjs
43
+ frontend/ -> child repository
44
+ backend/ -> child repository
45
+ sdk/ -> child repository
46
+ services/auth/ -> child repository
47
+ services/bill/ -> child repository
48
+ ```
49
+
50
+ Child repositories can be git submodules, git subtrees, workspace checkouts, fixed local paths, or entries in an internal repo registry. The technical mechanism matters less than ownership of facts:
51
+
52
+ - The parent repository records global plans and evidence.
53
+ - Child repositories record code and local verification.
54
+
55
+ ## Parent Repository Responsibilities
56
+
57
+ The parent repository is the control plane.
58
+
59
+ It should contain:
60
+
61
+ - `AGENTS.md`: the single agent startup entrypoint and reading matrix.
62
+ - `docs/03-ARCHITECTURE/repository-topology.md`: repository topology, owners, boundaries, dependency direction.
63
+ - `docs/04-DEVELOPMENT/local-development.md`: cross-repo local startup, integration workflow, dependency setup.
64
+ - `docs/06-INTEGRATIONS/`: cross-service APIs, events, SDKs, databases, permissions, and external contracts.
65
+ - `docs/Harness-Ledger.md`: generated global task lifecycle index from task files.
66
+ - `docs/09-PLANNING/Delivery-SSoT.md`: cross-repo feature blocks, dependencies, and release orchestration.
67
+ - `docs/09-PLANNING/TASKS/`: cross-repo task contracts.
68
+ - `docs/05-TEST-QA/Regression-SSoT.md`: cross-repo regression gates.
69
+ - `docs/05-TEST-QA/Cadence-Ledger.md`: which changes trigger which checks.
70
+ - `docs/10-WALKTHROUGH/`: cross-repo closeout and human confirmation.
71
+ - `docs/11-REFERENCE/`: local standards for using Harness in this project.
72
+
73
+ The parent repository should also provide a check command, for example:
74
+
75
+ ```bash
76
+ node tools/check-harness.mjs
77
+ ```
78
+
79
+ At minimum, that command should verify:
80
+
81
+ - Required harness files exist.
82
+ - `AGENTS.md` contains repo topology and child repo routing.
83
+ - Current tasks have planning, progress, review, or closeout state.
84
+ - Cross-repo regression gates have owners and evidence.
85
+ - Child repo pointers, branches, commits, or release versions are recorded.
86
+
87
+ ## Child Repository Responsibilities
88
+
89
+ Child repositories are the execution plane.
90
+
91
+ They should contain:
92
+
93
+ - Local `AGENTS.md`: repository rules, commands, stack, and test workflow.
94
+ - Code, dependencies, lockfiles, and CI.
95
+ - Repository-local reviews or pull requests.
96
+ - Repository-local test evidence.
97
+
98
+ Child repositories should not independently maintain global task lifecycle tables, and they should not decide whether a cross-repo release is complete.
99
+
100
+ A child repository `AGENTS.md` can be short:
101
+
102
+ ````md
103
+ # Backend Agent Guide
104
+
105
+ This child repository owns the backend implementation.
106
+ Parent-level planning, architecture, and cross-repo closeout live in `../docs/`.
107
+
108
+ ## Rules
109
+
110
+ 1. Keep API contracts aligned with the parent task plan.
111
+ 2. Do not change frontend or SDK assumptions without updating the parent integration docs.
112
+ 3. Run `npm run typecheck` after TypeScript changes.
113
+
114
+ ## Commands
115
+
116
+ ```bash
117
+ npm install
118
+ npm run typecheck
119
+ npm test
120
+ ```
121
+ ````
122
+
123
+ ## Agent Startup Rule
124
+
125
+ In the parent-control model, the default rule is:
126
+
127
+ 1. The agent starts from the parent repository.
128
+ 2. The agent reads the parent `AGENTS.md`.
129
+ 3. The agent reads parent architecture, development, integration, planning, and regression docs based on the task type.
130
+ 4. The agent enters one or more child repositories to make code changes.
131
+ 5. The agent runs local checks inside child repositories.
132
+ 6. The agent returns to the parent repository to record global evidence, review, walkthrough, and residuals.
133
+
134
+ Do not let agents start cross-repo tasks from random child repositories. They will naturally miss global context.
135
+
136
+ ## Cross-Repo Task Contract
137
+
138
+ Cross-repo tasks should be created in the parent repository:
139
+
140
+ ```text
141
+ docs/09-PLANNING/TASKS/2026-05-22-example-cross-repo-feature/
142
+ brief.md
143
+ task_plan.md
144
+ execution_strategy.md
145
+ visual_map.md
146
+ progress.md
147
+ review.md
148
+ ```
149
+
150
+ The task plan should state:
151
+
152
+ - Which child repositories will be modified.
153
+ - The write scope for each child repository.
154
+ - Where shared contracts live, such as API schema, SDK types, or event format.
155
+ - Which local checks each child repository must run.
156
+ - The final cross-repo regression gate.
157
+ - Who updates the parent global SSoT and walkthrough.
158
+
159
+ A child repository commit is not the end of the task. It is evidence for the parent task.
160
+
161
+ ## What To Put In Architecture / Development / Integration
162
+
163
+ In the parent-control model, the parent repository must document more external context than a single-repo project.
164
+
165
+ ### Architecture
166
+
167
+ `docs/03-ARCHITECTURE/` explains how the system is split across repositories:
168
+
169
+ - Repo topology.
170
+ - Service boundaries.
171
+ - Data flow.
172
+ - Dependency direction.
173
+ - Which repositories are product code and which are upstream references.
174
+ - Which interfaces must not be called across boundaries directly.
175
+
176
+ ### Development
177
+
178
+ `docs/04-DEVELOPMENT/` explains cross-repo development:
179
+
180
+ - How to clone or initialize all child repositories.
181
+ - How to install dependencies.
182
+ - How to start the local integration environment.
183
+ - Which ports, environment variables, accounts, or fixtures are shared.
184
+ - How to validate the overall contract when only one child repository changed.
185
+
186
+ ### Integration
187
+
188
+ `docs/06-INTEGRATIONS/` explains how repositories connect:
189
+
190
+ - API contract.
191
+ - SDK contract.
192
+ - Event contract.
193
+ - Database ownership.
194
+ - Auth boundary.
195
+ - Queue or topic ownership.
196
+ - External vendor integration.
197
+ - Breaking change policy.
198
+
199
+ If these external facts are missing, the parent repository becomes only a bigger task list, not a real control plane.
200
+
201
+ ## Regression Strategy
202
+
203
+ The parent `Regression-SSoT.md` should not duplicate every child repository test. It should define layered gates:
204
+
205
+ | Gate | Location | Purpose |
206
+ | --- | --- | --- |
207
+ | Repo-local gate | Child repository | Prove local code did not break |
208
+ | Contract gate | Parent repo or shared package | Prove cross-repo interfaces did not drift |
209
+ | Integration gate | Parent tools or CI | Prove multiple child repositories can run together |
210
+ | Release gate | Parent repository | Prove the current feature or release can close |
211
+
212
+ Child repositories may run `npm test`, `pytest`, or `go test`. The parent repository projects those results into evidence that a release can understand.
213
+
214
+ ## Many Microservices
215
+
216
+ If there are dozens or hundreds of repositories, do not hand-write long documentation for each one. The parent repository should maintain a repo registry:
217
+
218
+ ```md
219
+ | Repo | Role | Owner | Local checks | Integration surface | Release critical |
220
+ | --- | --- | --- | --- | --- | --- |
221
+ | `services/auth` | auth service | platform | `go test ./...` | JWT, user session events | yes |
222
+ | `services/bill` | billing service | revenue | `npm test` | invoice events, payment API | yes |
223
+ | `frontend` | product shell | product | `npm run typecheck` | backend API, SDK client | yes |
224
+ ```
225
+
226
+ The agent does not need to read all docs in 100 repositories at startup. It reads the parent task first, then enters only the repositories relevant to the current task.
227
+
228
+ ## Anti-Patterns
229
+
230
+ Avoid:
231
+
232
+ - Each child repository maintaining its own global task lifecycle table.
233
+ - A parent repository with only a README and no task, regression, or closeout surface.
234
+ - Child `AGENTS.md` files copying large sections from the parent, causing drift.
235
+ - Starting cross-repo tasks from a child repository and backfilling parent records at the end.
236
+ - Putting all business code directly in the parent repository and losing independent release ability.
237
+ - Recording only child repository test passes without contract and release gates.
238
+
239
+ ## Minimum Adoption Checklist
240
+
241
+ To adopt the parent-control model, start with:
242
+
243
+ - Parent `AGENTS.md` states that this is the control repository.
244
+ - `docs/03-ARCHITECTURE/repository-topology.md` lists all child repositories.
245
+ - `docs/Harness-Ledger.md` is generated from task files as the global task lifecycle index.
246
+ - `docs/09-PLANNING/Delivery-SSoT.md` is maintained only when cross-repo release or block orchestration is needed.
247
+ - `docs/05-TEST-QA/Regression-SSoT.md` defines local, contract, integration, and release gates.
248
+ - Each child repository has only a short local `AGENTS.md`.
249
+ - New cross-repo tasks are created only in the parent repository.
250
+ - Child commits, PRs, and test output are recorded as parent task evidence.
251
+
252
+ ## One Sentence
253
+
254
+ The parent-control repository pattern does not add a repository for its own sake. It gives a multi-repo product one harness brain.
@@ -0,0 +1,254 @@
1
+ # 主控仓库模式
2
+
3
+ English mirror: `docs-release/guides/parent-control-repository-pattern.en-US.md`
4
+
5
+ 主控仓库模式是一种多仓库 Coding Agent Harness 组织方式。
6
+
7
+ 它的核心判断是:
8
+
9
+ > 业务代码可以分散在很多仓库,但 Agent 的运行合同不能分散。
10
+
11
+ 父仓库管理 Harness。子仓库管理代码执行事实。
12
+
13
+ ## 为什么需要这个模式
14
+
15
+ 多仓项目里,经常出现这些问题:
16
+
17
+ - 前端、后端、SDK、微服务各有自己的计划,没人知道全局 release 到底卡在哪里。
18
+ - Agent 从某个子仓库启动,只看到局部 `AGENTS.md`,忽略了跨仓架构约束。
19
+ - 每个仓库各自维护手写任务生命周期表,状态互相冲突。
20
+ - Review 证据、测试证据、walkthrough 分散在不同仓库,最后无法证明一个跨仓任务真正完成。
21
+
22
+ 主控仓库模式解决的是控制面问题。它不是要求把代码放回单仓,而是把 Harness 的事实源收回一个地方。
23
+
24
+ ## 基本拓扑
25
+
26
+ ```text
27
+ product-control-repo/
28
+ AGENTS.md
29
+ README.md
30
+ docs/
31
+ 01-GOVERNANCE/
32
+ 02-PRODUCT/
33
+ 03-ARCHITECTURE/
34
+ 04-DEVELOPMENT/
35
+ 05-TEST-QA/
36
+ 06-INTEGRATIONS/
37
+ 09-PLANNING/
38
+ 10-WALKTHROUGH/
39
+ 11-REFERENCE/
40
+ tools/
41
+ check-harness.mjs
42
+ internal-ci.mjs
43
+ frontend/ -> child repository
44
+ backend/ -> child repository
45
+ sdk/ -> child repository
46
+ services/auth/ -> child repository
47
+ services/bill/ -> child repository
48
+ ```
49
+
50
+ 子仓库可以是 git submodule、git subtree、workspace checkout、固定路径约定,或由内部工具解析的 repo registry。关键不是技术形式,而是事实归属:
51
+
52
+ - 父仓库记录全局计划和证据。
53
+ - 子仓库记录代码和局部验证。
54
+
55
+ ## 父仓库职责
56
+
57
+ 父仓库是 control plane。
58
+
59
+ 它应该包含:
60
+
61
+ - `AGENTS.md`:Agent 的唯一启动入口和读文件矩阵。
62
+ - `docs/03-ARCHITECTURE/repository-topology.md`:仓库拓扑、owner、边界、依赖方向。
63
+ - `docs/04-DEVELOPMENT/local-development.md`:跨仓本地启动、联调、依赖安装。
64
+ - `docs/06-INTEGRATIONS/`:跨服务 API、事件、SDK、数据库、权限、外部系统契约。
65
+ - `docs/Harness-Ledger.md`:由任务文件生成的全局任务生命周期索引。
66
+ - `docs/09-PLANNING/Delivery-SSoT.md`:跨仓 feature block、依赖和 release 编排。
67
+ - `docs/09-PLANNING/TASKS/`:跨仓任务合同。
68
+ - `docs/05-TEST-QA/Regression-SSoT.md`:跨仓 regression gates。
69
+ - `docs/05-TEST-QA/Cadence-Ledger.md`:哪些变更触发哪些检查。
70
+ - `docs/10-WALKTHROUGH/`:跨仓 closeout 和人工确认。
71
+ - `docs/11-REFERENCE/`:本项目使用 Harness 的本地标准。
72
+
73
+ 父仓库还应该有一个检查命令,例如:
74
+
75
+ ```bash
76
+ node tools/check-harness.mjs
77
+ ```
78
+
79
+ 这个命令至少检查:
80
+
81
+ - 必需 Harness 文件存在。
82
+ - `AGENTS.md` 含有 repo topology 和子仓库路由。
83
+ - 当前任务有计划、进度、review 或 closeout 状态。
84
+ - 跨仓 regression gate 有 owner 和 evidence。
85
+ - 子仓库 pointer、branch、commit 或 release version 已记录。
86
+
87
+ ## 子仓库职责
88
+
89
+ 子仓库是 execution plane。
90
+
91
+ 它应该包含:
92
+
93
+ - 局部 `AGENTS.md`:本仓库规则、命令、技术栈、测试方式。
94
+ - 代码、依赖、lockfile、CI。
95
+ - 本仓库局部 review 或 PR。
96
+ - 本仓库局部测试证据。
97
+
98
+ 子仓库不应该单独维护全局任务生命周期表,也不应该自己决定跨仓 release 是否完成。
99
+
100
+ 一个子仓库 `AGENTS.md` 可以很短:
101
+
102
+ ````md
103
+ # Backend Agent Guide
104
+
105
+ This child repository owns the backend implementation.
106
+ Parent-level planning, architecture, and cross-repo closeout live in `../docs/`.
107
+
108
+ ## Rules
109
+
110
+ 1. Keep API contracts aligned with the parent task plan.
111
+ 2. Do not change frontend or SDK assumptions without updating the parent integration docs.
112
+ 3. Run `npm run typecheck` after TypeScript changes.
113
+
114
+ ## Commands
115
+
116
+ ```bash
117
+ npm install
118
+ npm run typecheck
119
+ npm test
120
+ ```
121
+ ````
122
+
123
+ ## Agent 启动规则
124
+
125
+ 主控仓库模式下,默认规则是:
126
+
127
+ 1. Agent 从父仓库启动。
128
+ 2. Agent 先读父仓库 `AGENTS.md`。
129
+ 3. Agent 根据任务类型读取父仓库的 architecture、development、integration、planning、regression 文档。
130
+ 4. Agent 进入一个或多个子仓库执行代码变更。
131
+ 5. Agent 在子仓库跑局部检查。
132
+ 6. Agent 回到父仓库记录全局证据、review、walkthrough、residual。
133
+
134
+ 不要让 Agent 直接从随机子仓库启动跨仓任务。那样它会天然缺少全局上下文。
135
+
136
+ ## 跨仓任务合同
137
+
138
+ 跨仓任务应该在父仓库创建:
139
+
140
+ ```text
141
+ docs/09-PLANNING/TASKS/2026-05-22-example-cross-repo-feature/
142
+ brief.md
143
+ task_plan.md
144
+ execution_strategy.md
145
+ visual_map.md
146
+ progress.md
147
+ review.md
148
+ ```
149
+
150
+ 任务计划至少说明:
151
+
152
+ - 哪些子仓库会被修改。
153
+ - 每个子仓库的 write scope。
154
+ - 共享契约在哪里,例如 API schema、SDK type、事件格式。
155
+ - 每个子仓库要跑哪些局部检查。
156
+ - 最终跨仓 regression gate 是什么。
157
+ - 谁负责更新父仓库的全局 SSoT 和 walkthrough。
158
+
159
+ 子仓库提交不是独立任务的终点,而是父任务的 evidence。
160
+
161
+ ## Architecture / Development / Integration 要写什么
162
+
163
+ 主控仓库模式下,父仓库必须比单仓项目多写三类外围事实。
164
+
165
+ ### Architecture
166
+
167
+ `docs/03-ARCHITECTURE/` 说明系统如何被拆成多个仓库:
168
+
169
+ - repo topology。
170
+ - 服务边界。
171
+ - 数据流。
172
+ - 依赖方向。
173
+ - 哪些仓库是产品代码,哪些是 upstream reference。
174
+ - 哪些接口不能跨边界直接调用。
175
+
176
+ ### Development
177
+
178
+ `docs/04-DEVELOPMENT/` 说明如何跨仓工作:
179
+
180
+ - 如何 clone 或初始化所有子仓库。
181
+ - 如何安装依赖。
182
+ - 如何启动本地联调环境。
183
+ - 哪些端口、环境变量、账号或 fixture 是共享的。
184
+ - 如何在只改一个子仓库时仍然验证整体契约。
185
+
186
+ ### Integration
187
+
188
+ `docs/06-INTEGRATIONS/` 说明仓库之间如何对接:
189
+
190
+ - API contract。
191
+ - SDK contract。
192
+ - event contract。
193
+ - database ownership。
194
+ - auth boundary。
195
+ - queue/topic ownership。
196
+ - external vendor integration。
197
+ - breaking change policy。
198
+
199
+ 如果这些外围事实不写,主控仓库只会变成一个更大的任务列表,而不会真正控制多仓协作。
200
+
201
+ ## 回归策略
202
+
203
+ 父仓库的 `Regression-SSoT.md` 不应该复制所有子仓库测试。它应该定义分层 gate:
204
+
205
+ | Gate | 位置 | 目的 |
206
+ | --- | --- | --- |
207
+ | Repo-local gate | 子仓库 | 证明局部代码没有坏 |
208
+ | Contract gate | 父仓库或共享包 | 证明跨仓接口没有漂移 |
209
+ | Integration gate | 父仓库工具或 CI | 证明多个子仓库可以一起运行 |
210
+ | Release gate | 父仓库 | 证明当前 feature/release 可以收口 |
211
+
212
+ 子仓库可以自己跑 `npm test`、`pytest`、`go test`。父仓库负责把这些结果投影成 release 能看懂的证据。
213
+
214
+ ## 微服务很多时怎么做
215
+
216
+ 如果有几十个或上百个仓库,不要给每个仓库手写大段文档。父仓库应该维护 repo registry:
217
+
218
+ ```md
219
+ | Repo | Role | Owner | Local checks | Integration surface | Release critical |
220
+ | --- | --- | --- | --- | --- | --- |
221
+ | `services/auth` | auth service | platform | `go test ./...` | JWT, user session events | yes |
222
+ | `services/bill` | billing service | revenue | `npm test` | invoice events, payment API | yes |
223
+ | `frontend` | product shell | product | `npm run typecheck` | backend API, SDK client | yes |
224
+ ```
225
+
226
+ Agent 不需要在启动时读 100 个仓库的所有文档。它先读父任务,再按 repo registry 进入本次相关的几个仓库。
227
+
228
+ ## 反模式
229
+
230
+ 避免这些做法:
231
+
232
+ - 每个子仓库各自维护全局任务生命周期表。
233
+ - 父仓库只有 README,没有任务、回归和 closeout。
234
+ - 子仓库 `AGENTS.md` 复制父仓库大段内容,导致漂移。
235
+ - 跨仓任务从子仓库启动,最后再补父仓库记录。
236
+ - 父仓库直接承载所有业务代码,失去子仓库独立发布能力。
237
+ - 只记录子仓库测试通过,不记录跨仓 contract 和 release gate。
238
+
239
+ ## 最小落地清单
240
+
241
+ 采用主控仓库模式时,先做到这些:
242
+
243
+ - 父仓库 `AGENTS.md` 写清楚它是 control repo。
244
+ - `docs/03-ARCHITECTURE/repository-topology.md` 列出所有子仓库。
245
+ - `docs/Harness-Ledger.md` 由任务文件生成全局任务生命周期索引。
246
+ - `docs/09-PLANNING/Delivery-SSoT.md` 只在需要跨仓 release / block 编排时维护。
247
+ - `docs/05-TEST-QA/Regression-SSoT.md` 定义局部、契约、集成、发布 gate。
248
+ - 每个子仓库只有短的局部 `AGENTS.md`。
249
+ - 新跨仓任务只在父仓库创建。
250
+ - 子仓库 commit、PR、test output 都作为父任务 evidence。
251
+
252
+ ## 一句话
253
+
254
+ 主控仓库模式不是为了多建一个仓库,而是为了让多仓项目只有一个 Harness 大脑。