coding-agent-harness 1.0.7 → 1.1.0

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 (238) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/CONTRIBUTING.md +9 -5
  3. package/README.md +12 -2
  4. package/README.zh-CN.md +10 -2
  5. package/SKILL.md +14 -3
  6. package/dist/build-dist.mjs +32 -6
  7. package/dist/check-dist-observation.mjs +73 -28
  8. package/dist/check-harness.mjs +0 -1
  9. package/dist/check-import-graph.mjs +44 -27
  10. package/dist/check-lite-forbidden-surfaces.mjs +121 -0
  11. package/dist/check-no-ts-nocheck.mjs +88 -0
  12. package/dist/check-runtime-emit.mjs +10 -3
  13. package/dist/check-type-boundaries.mjs +67 -8
  14. package/dist/commands/dashboard-command.mjs +52 -14
  15. package/dist/commands/migration-command.mjs +18 -8
  16. package/dist/commands/module-command.mjs +142 -0
  17. package/dist/commands/preset-command.mjs +65 -4
  18. package/dist/commands/registry.mjs +483 -0
  19. package/dist/commands/task-command.mjs +111 -53
  20. package/dist/harness.mjs +6 -303
  21. package/dist/lib/capability-registry.mjs +229 -53
  22. package/dist/lib/check-module-parallel.mjs +1 -6
  23. package/dist/lib/check-profiles.mjs +39 -46
  24. package/dist/lib/check-task-contracts.mjs +6 -4
  25. package/dist/lib/command-registry.mjs +248 -0
  26. package/dist/lib/core-shared.mjs +78 -3
  27. package/dist/lib/dashboard-data.mjs +203 -22
  28. package/dist/lib/dashboard-workbench.mjs +245 -21
  29. package/dist/lib/dashboard-writer.mjs +4 -1
  30. package/dist/lib/git-status-summary.mjs +0 -1
  31. package/dist/lib/governance-index-generator.mjs +7 -5
  32. package/dist/lib/governance-sync.mjs +46 -121
  33. package/dist/lib/governance-table-boundary.mjs +1 -14
  34. package/dist/lib/harness-core.mjs +5 -1
  35. package/dist/lib/harness-paths.mjs +115 -1
  36. package/dist/lib/impact-classifier.mjs +420 -0
  37. package/dist/lib/lesson-maintenance.mjs +1 -2
  38. package/dist/lib/markdown-utils.mjs +50 -1
  39. package/dist/lib/migration-planner.mjs +31 -16
  40. package/dist/lib/migration-support.mjs +5 -4
  41. package/dist/lib/module-registry.mjs +296 -0
  42. package/dist/lib/preset-audit-contracts.mjs +24 -1
  43. package/dist/lib/preset-engine.mjs +68 -29
  44. package/dist/lib/preset-registry.mjs +374 -72
  45. package/dist/lib/preset-runner.mjs +560 -0
  46. package/dist/lib/review-confirm-git-gate.mjs +73 -19
  47. package/dist/lib/status-builder.mjs +23 -8
  48. package/dist/lib/structure-migration.mjs +6 -4
  49. package/dist/lib/subagent-authorization-audit.mjs +8 -2
  50. package/dist/lib/task-archive-eligibility.mjs +65 -0
  51. package/dist/lib/task-audit-metadata.mjs +25 -11
  52. package/dist/lib/task-audit-migration.mjs +21 -14
  53. package/dist/lib/task-discovery-contract.mjs +32 -0
  54. package/dist/lib/task-index.mjs +4 -2
  55. package/dist/lib/task-lesson-candidates.mjs +1 -2
  56. package/dist/lib/task-lesson-sedimentation.mjs +310 -9
  57. package/dist/lib/task-lifecycle/create-task-helpers.mjs +6 -3
  58. package/dist/lib/task-lifecycle/phase-sync.mjs +0 -1
  59. package/dist/lib/task-lifecycle/preset-interop.mjs +16 -0
  60. package/dist/lib/task-lifecycle/review-confirm.mjs +34 -2
  61. package/dist/lib/task-lifecycle/review-gates.mjs +12 -5
  62. package/dist/lib/task-lifecycle/review-submission.mjs +1 -2
  63. package/dist/lib/task-lifecycle/scaffold-provenance.mjs +0 -1
  64. package/dist/lib/task-lifecycle/template-files.mjs +2 -5
  65. package/dist/lib/task-lifecycle.mjs +117 -159
  66. package/dist/lib/task-metadata.mjs +10 -5
  67. package/dist/lib/task-preset-contract-drift.mjs +45 -0
  68. package/dist/lib/task-repository.mjs +192 -0
  69. package/dist/lib/task-review-model.mjs +38 -17
  70. package/dist/lib/task-scanner.mjs +75 -23
  71. package/dist/lib/task-template-materials.mjs +131 -0
  72. package/dist/lib/task-tombstone-commands.mjs +187 -18
  73. package/dist/lib/types/check-profiles.js +1 -0
  74. package/dist/lib/types/impact.js +1 -0
  75. package/dist/lib/types/preset.js +1 -0
  76. package/dist/lib/types/task-lifecycle.js +1 -0
  77. package/dist/lib/types/task-scanner.js +1 -0
  78. package/dist/postinstall.mjs +2 -2
  79. package/dist/run-built-tests.mjs +10 -3
  80. package/docs-release/README.md +2 -1
  81. package/docs-release/architecture/document-contract-kernel/README.md +150 -0
  82. package/docs-release/architecture/document-contract-kernel/products/full-skill-overlay.md +29 -0
  83. package/docs-release/architecture/document-contract-kernel/products/lite-forbidden-surfaces.txt +26 -0
  84. package/docs-release/architecture/document-contract-kernel/products/lite-skill-overlay.md +37 -0
  85. package/docs-release/architecture/overview.md +2 -2
  86. package/docs-release/architecture/overview.zh-CN.md +2 -2
  87. package/docs-release/architecture/system-explainer/01-system-overview.md +11 -7
  88. package/docs-release/architecture/system-explainer/02-module-dependency.md +4 -4
  89. package/docs-release/architecture/system-explainer/03-task-lifecycle.md +17 -12
  90. package/docs-release/architecture/system-explainer/05-data-flow.md +6 -6
  91. package/docs-release/architecture/system-explainer/06-preset-and-migration.md +2 -2
  92. package/docs-release/architecture/system-explainer/README.md +1 -1
  93. package/docs-release/architecture/system-explainer/en-US/01-system-overview.md +12 -8
  94. package/docs-release/architecture/system-explainer/en-US/02-module-dependency.md +5 -5
  95. package/docs-release/architecture/system-explainer/en-US/03-task-lifecycle.md +19 -11
  96. package/docs-release/architecture/system-explainer/en-US/05-data-flow.md +5 -5
  97. package/docs-release/architecture/system-explainer/en-US/06-preset-and-migration.md +2 -2
  98. package/docs-release/architecture/system-explainer/en-US/README.md +1 -1
  99. package/docs-release/guides/agent-installation.en-US.md +4 -6
  100. package/docs-release/guides/agent-installation.md +11 -8
  101. package/docs-release/guides/contributing.md +10 -3
  102. package/docs-release/guides/contributing.zh-CN.md +10 -3
  103. package/docs-release/guides/legacy-migration-agent-prompt.md +1 -1
  104. package/docs-release/guides/legacy-migration-agent-prompt.zh-CN.md +1 -1
  105. package/docs-release/guides/migration-playbook.en-US.md +9 -6
  106. package/docs-release/guides/migration-playbook.md +9 -6
  107. package/docs-release/guides/preset-development.md +68 -2
  108. package/docs-release/guides/task-state-machine.en-US.md +8 -8
  109. package/docs-release/guides/task-state-machine.md +7 -7
  110. package/docs-release/guides/typescript-runtime-migration-closeout.md +17 -13
  111. package/package.json +19 -11
  112. package/postinstall.mjs +37 -0
  113. package/presets/legacy-migration/preset.yaml +5 -5
  114. package/presets/legacy-migration/templates/execution_strategy.append.md +1 -1
  115. package/presets/lesson-sedimentation/preset.yaml +3 -3
  116. package/presets/module/preset.yaml +2 -2
  117. package/presets/module/templates/execution_strategy.append.md +1 -1
  118. package/presets/module/templates/task_plan.append.md +3 -3
  119. package/presets/release-closeout/checks/check-release-package.mjs +29 -0
  120. package/presets/release-closeout/preset.yaml +100 -0
  121. package/presets/release-closeout/scripts/generate-release-package.mjs +572 -0
  122. package/presets/release-closeout/templates/execution_strategy.append.md +7 -0
  123. package/presets/release-closeout/templates/findings.seed.md +5 -0
  124. package/presets/release-closeout/templates/review.seed.md +3 -0
  125. package/presets/release-closeout/templates/task_plan.append.md +24 -0
  126. package/presets/standard-task/preset.yaml +2 -2
  127. package/references/agents-md-pattern.md +23 -17
  128. package/references/lessons-governance.md +2 -2
  129. package/references/module-parallel-standard.md +3 -6
  130. package/references/pull-request-standard.md +2 -2
  131. package/references/ssot-governance.md +2 -2
  132. package/references/taskr-gap-analysis.md +3 -3
  133. package/run-dist.mjs +34 -0
  134. package/skills/preset-creator/SKILL.md +40 -8
  135. package/skills/preset-creator/references/complex-task-skeleton/brief.md +32 -8
  136. package/skills/preset-creator/references/preset-package-skeleton.md +15 -5
  137. package/skills/preset-creator/references/structure-aware-paths.md +112 -0
  138. package/templates/AGENTS.md.template +28 -26
  139. package/templates/architecture/README.md +2 -2
  140. package/templates/architecture/service-catalog.md +2 -2
  141. package/templates/architecture/services/service-template.md +1 -1
  142. package/templates/dashboard/assets/app-src/00-state.js +5 -1
  143. package/templates/dashboard/assets/app-src/10-router.js +7 -0
  144. package/templates/dashboard/assets/app-src/20-overview.js +8 -8
  145. package/templates/dashboard/assets/app-src/30-tasks.js +132 -40
  146. package/templates/dashboard/assets/app-src/32-task-swimlane.js +314 -0
  147. package/templates/dashboard/assets/app-src/35-task-detail.js +35 -5
  148. package/templates/dashboard/assets/app-src/40-modules.js +257 -41
  149. package/templates/dashboard/assets/app-src/45-review.js +127 -1
  150. package/templates/dashboard/assets/app-src/90-bindings.js +185 -2
  151. package/templates/dashboard/assets/app.css +928 -53
  152. package/templates/dashboard/assets/app.css.manifest.json +2 -0
  153. package/templates/dashboard/assets/app.js +1071 -98
  154. package/templates/dashboard/assets/app.manifest.json +1 -0
  155. package/templates/dashboard/assets/css-src/00-foundation.css +12 -6
  156. package/templates/dashboard/assets/css-src/10-panels-flow.css +2 -2
  157. package/templates/dashboard/assets/css-src/30-task-index.css +21 -13
  158. package/templates/dashboard/assets/css-src/31-archive.css +94 -0
  159. package/templates/dashboard/assets/css-src/32-task-swimlane.css +487 -0
  160. package/templates/dashboard/assets/css-src/35-review-workspace.css +78 -0
  161. package/templates/dashboard/assets/css-src/40-detail-modules-migration.css +191 -14
  162. package/templates/dashboard/assets/css-src/50-responsive-overrides.css +23 -0
  163. package/templates/dashboard/assets/i18n.js +166 -2
  164. package/templates/development/README.md +9 -9
  165. package/templates/development/cross-repo-debugging.md +3 -3
  166. package/templates/development/external-context/service-template.md +1 -1
  167. package/templates/development/external-source-packs/README.md +2 -2
  168. package/templates/integrations/README.md +4 -4
  169. package/templates/integrations/api-contract.md +1 -1
  170. package/templates/integrations/event-contract.md +1 -1
  171. package/templates/integrations/third-party/vendor-template.md +1 -1
  172. package/templates/integrations/webhook-contract.md +1 -1
  173. package/templates/ledger/Harness-Ledger.md +1 -1
  174. package/templates/modules/module_brief.md +50 -0
  175. package/templates/modules/module_plan.md +49 -0
  176. package/templates/modules/registry_view.md +9 -0
  177. package/templates/modules/session_prompt_pack.md +55 -0
  178. package/templates/planning/brief.md +32 -8
  179. package/templates/planning/module_brief.md +28 -3
  180. package/templates/planning/module_plan.md +26 -11
  181. package/templates/planning/module_session_prompt.md +11 -2
  182. package/templates/planning/optional/slices/_slice-template/brief.md +28 -0
  183. package/templates/planning/review.md +1 -1
  184. package/templates/planning/visual_map.md +1 -1
  185. package/templates/reference/docs-library-standard.md +7 -7
  186. package/templates/reference/execution-workflow-standard.md +13 -0
  187. package/templates/reference/external-source-intake-standard.md +10 -10
  188. package/templates/reference/pull-request-standard.md +2 -2
  189. package/templates/reference/repo-governance-standard.md +1 -1
  190. package/templates/reference/review-routing-standard.md +4 -0
  191. package/templates/ssot/Module-Registry.md +4 -38
  192. package/templates/walkthrough/walkthrough-template.md +1 -1
  193. package/templates-zh-CN/AGENTS.md.template +27 -25
  194. package/templates-zh-CN/CLAUDE.md.template +1 -1
  195. package/templates-zh-CN/architecture/README.md +2 -2
  196. package/templates-zh-CN/architecture/service-catalog.md +2 -2
  197. package/templates-zh-CN/architecture/services/service-template.md +1 -1
  198. package/templates-zh-CN/development/README.md +9 -9
  199. package/templates-zh-CN/development/cross-repo-debugging.md +3 -3
  200. package/templates-zh-CN/development/external-context/service-template.md +1 -1
  201. package/templates-zh-CN/development/external-source-packs/README.md +2 -2
  202. package/templates-zh-CN/integrations/README.md +4 -4
  203. package/templates-zh-CN/integrations/api-contract.md +1 -1
  204. package/templates-zh-CN/integrations/event-contract.md +1 -1
  205. package/templates-zh-CN/integrations/third-party/vendor-template.md +1 -1
  206. package/templates-zh-CN/integrations/webhook-contract.md +1 -1
  207. package/templates-zh-CN/ledger/Harness-Ledger.md +1 -1
  208. package/templates-zh-CN/lessons/lesson-arch-process-change.md +1 -1
  209. package/templates-zh-CN/lessons/lesson-new-doc.md +3 -3
  210. package/templates-zh-CN/lessons/lesson-ref-change.md +4 -4
  211. package/templates-zh-CN/modules/module_brief.md +47 -0
  212. package/templates-zh-CN/modules/module_plan.md +48 -0
  213. package/templates-zh-CN/modules/registry_view.md +9 -0
  214. package/templates-zh-CN/modules/session_prompt_pack.md +50 -0
  215. package/templates-zh-CN/planning/INDEX.md +1 -0
  216. package/templates-zh-CN/planning/brief.md +26 -7
  217. package/templates-zh-CN/planning/module_brief.md +24 -2
  218. package/templates-zh-CN/planning/module_plan.md +35 -29
  219. package/templates-zh-CN/planning/module_session_prompt.md +15 -11
  220. package/templates-zh-CN/planning/optional/slices/_slice-template/brief.md +28 -11
  221. package/templates-zh-CN/planning/review.md +1 -1
  222. package/templates-zh-CN/reference/adversarial-review-standard.md +1 -1
  223. package/templates-zh-CN/reference/delivery-operating-model-standard.md +3 -3
  224. package/templates-zh-CN/reference/docs-library-standard.md +27 -27
  225. package/templates-zh-CN/reference/execution-workflow-standard.md +12 -2
  226. package/templates-zh-CN/reference/external-source-intake-standard.md +10 -10
  227. package/templates-zh-CN/reference/harness-ledger-standard.md +3 -3
  228. package/templates-zh-CN/reference/pull-request-standard.md +1 -1
  229. package/templates-zh-CN/reference/regression-ssot-governance.md +2 -2
  230. package/templates-zh-CN/reference/repo-governance-standard.md +1 -1
  231. package/templates-zh-CN/reference/review-routing-standard.md +3 -0
  232. package/templates-zh-CN/reference/walkthrough-standard.md +2 -2
  233. package/templates-zh-CN/reference/worktree-standard.md +1 -1
  234. package/templates-zh-CN/regression/Cadence-Ledger.md +2 -2
  235. package/templates-zh-CN/ssot/Delivery-SSoT.md +2 -2
  236. package/templates-zh-CN/ssot/Module-Registry.md +5 -44
  237. package/templates-zh-CN/ssot/Regression-SSoT.md +2 -2
  238. package/templates-zh-CN/walkthrough/walkthrough-template.md +4 -4
@@ -221,7 +221,7 @@ must be satisfied to pass.
221
221
  flowchart TD
222
222
  Core["core\n(required, foundation for all other capabilities)"]
223
223
 
224
- Core --> ModParallel["module-parallel\nModule registry + parallel work"]
224
+ Core --> ModParallel["module-parallel\nYAML module registry + parallel work"]
225
225
  Core --> AdvReview["adversarial-review\nAdversarial review reports\n(alias: review-contract)"]
226
226
  Core --> LongRunning["long-running-task\nLong-running task contracts"]
227
227
  Core --> Dashboard["dashboard\nLocal HTML Dashboard"]
@@ -233,7 +233,7 @@ flowchart TD
233
233
  | Capability | When to enable |
234
234
  | --- | --- |
235
235
  | `core` | Always — this is the required foundation |
236
- | `module-parallel` | When the project has 2+ independent modules needing parallel ownership |
236
+ | `module-parallel` | When the project has 2+ independent modules and needs `harness.yaml modules.items` to maintain owner, scope, dependencies, and sync rules |
237
237
  | `subagent-worker` | When code-change subagents need to work in isolated worktrees and commit handoffs |
238
238
  | `adversarial-review` | When release, architecture, security, data, or policy risks require independent review artifacts |
239
239
  | `long-running-task` | When Agents may run across multiple loops without per-step user confirmation |
@@ -19,7 +19,7 @@ For example:
19
19
  - Why is state stored in Markdown files instead of a database?
20
20
  - Why are there three check profiles instead of one?
21
21
  - What's the difference between `governance-sync` and `governance rebuild`, and why are they separate?
22
- - Why must `review-confirm` be a manual operation why can't it be automated?
22
+ - Why must human confirmation go through the local Workbench instead of a regular CLI command?
23
23
 
24
24
  The answers to these questions are scattered across design decisions, historical evolution,
25
25
  and operating standards. These docs bring them together so you can understand the system's
@@ -8,7 +8,7 @@ This guide is written for coding agents that install or upgrade Harness inside a
8
8
 
9
9
  The main operator for this CLI is usually an agent inside the target project, not the end user. The agent should not ask the user to study command flags, template folders, or capability choices. Those decisions must happen during Diagnose / Decide and be explained in the delivery summary.
10
10
 
11
- Commands in this guide are written with an installed `harness` command. The agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace the same command with `node dist/harness.mjs`.
11
+ Commands in this guide are written with an installed `harness` command. The agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace the same command with `node dist/harness.mjs` after `npm install` or `npm run build:runtime` has generated `dist/`.
12
12
 
13
13
  `harness init` does not add this npm package to the target project's dependencies. It only writes Harness docs, templates, and the registry. Delivery summaries must not imply that the target project now has an npm dependency installed. The first `npx` run downloads the package into npm cache; it is not a project dependency or a global command install. When CLI access is needed, keep using `npx --yes coding-agent-harness ...`, a user-approved global `harness`, or `node dist/harness.mjs` from the source checkout.
14
14
 
@@ -205,10 +205,8 @@ harness task-log <task-id-from-new-task-output> \
205
205
  --evidence "command:TARGET:npm-test:passed" \
206
206
  /path/to/project
207
207
 
208
- harness review-confirm <task-id-from-new-task-output> \
209
- --reviewer "Human Reviewer" \
210
- --confirm <task-id-from-new-task-output> \
211
- /path/to/project
208
+ # Human confirmation is only available from the local Dashboard workbench:
209
+ harness dev /path/to/project
212
210
 
213
211
  harness task-complete <task-id-from-new-task-output> \
214
212
  --message "Verification loop completed" \
@@ -225,7 +223,7 @@ Rules:
225
223
  - Existing task directories are not overwritten. Renaming or continuing old tasks is a coordinator decision.
226
224
  - `task-start`, `task-block`, and `task-complete` only update lifecycle status and logs in `progress.md`.
227
225
  - `task-log` only appends execution records. Evidence uses `type:PATH:summary`, for example `command:TARGET:npm-test:passed`.
228
- - `review-confirm` writes human review confirmation audit fields to the task `INDEX.md` through gated commits. It must reject open P0/P1/P2 findings marked `Open: yes` or `Blocks Release: yes`.
226
+ - Dashboard workbench writes human review confirmation audit fields to the task `INDEX.md` through gated commits. It must reject open P0/P1/P2 findings marked `Open: yes` or `Blocks Release: yes`. The regular CLI does not expose a human confirmation command.
229
227
  - CLI-owned lifecycle and lesson commands auto-commit allowlisted writes in a clean Git root. Dirty state appears in `status` / dashboard warnings and blocks those mechanical commits. Agent-owned manual edits still need proactive commits; deferred commits must record the no-commit reason, owner, and next step.
230
228
  - `status --json` keeps old `task.state` for compatibility and adds `lifecycleState`, `reviewStatus`, `closeoutStatus`, and `stateConflicts`. `done` means implementation finished; it does not mean `closed`.
231
229
  - For human operation, start the local HTML workbench with `harness dev /path/to/project`. It binds to `127.0.0.1`, chooses a port automatically, opens the browser, and refreshes when docs change. In headless or CI contexts, use `harness dev --no-open /path/to/project`.
@@ -15,7 +15,8 @@ English mirror: `docs-release/guides/agent-installation.en-US.md`
15
15
  如果目标环境没有 `harness` 命令,不得静默全局安装;先询问用户是否允许运行
16
16
  `npm install -g coding-agent-harness`。只有用户明确同意后才能修改全局 npm 环境。
17
17
  用户不同意或未回复时,用 `npx --yes coding-agent-harness <command>` 运行同一条 CLI。
18
- 维护者在本源码仓调试时,可以把同一命令替换为 `node dist/harness.mjs`。
18
+ 维护者在本源码仓调试时,可以在 `npm install` 或 `npm run build:runtime`
19
+ 生成 `dist/` 后,把同一命令替换为 `node dist/harness.mjs`。
19
20
 
20
21
  `harness init` 不会把 npm 包写进目标项目依赖;它只写 Harness 文档、模板和 registry。
21
22
  因此 agent 交付时不能暗示目标项目已经安装了 npm dependency。`npx` 第一次运行会把包
@@ -91,7 +92,7 @@ Capability 要保守选择:
91
92
  | `dashboard` | 否 | 用户或 agent 需要本地状态页、静态证据快照,或本机动态 workbench。 |
92
93
  | `adversarial-review` | 否 | 发布、架构、安全、数据或策略风险需要独立 review artifact。 |
93
94
  | `long-running-task` | 否 | Agent 需要连续多轮执行,不能每步都询问用户。 |
94
- | `module-parallel` | 否 | 两个以上独立模块需要 owner、registry 和同步规则。 |
95
+ | `module-parallel` | 否 | 两个以上独立模块需要 YAML 注册、owner、scope、依赖和同步规则。 |
95
96
  | `subagent-worker` | 否 | 会改代码的 subagent 需要独立 worktree 和 commit-backed handoff;依赖 `module-parallel`。 |
96
97
 
97
98
  `init` 的 JSON 输出会包含 `report`。交付 summary 必须包含:
@@ -195,7 +196,7 @@ harness new-task \
195
196
  - 已有项目事实只能 merge、append 或记录 residual;不能用泛化模板替换。
196
197
  - 历史合同缺口在普通模式下进入 `adoption-needed` warning。
197
198
  - `--strict` 必须仍然能因为旧 checker 失败或历史合同缺口而失败。
198
- - 旧全局表和模块索引先归档,再用 `harness governance rebuild --archive --apply` 重新生成;这些表是 Agent 索引,人看状态优先用 Dashboard
199
+ - 旧全局表和模块索引先归档,再用 `harness governance rebuild --archive --apply` 重新生成;这些表是 Agent 索引,人看状态优先用 Dashboard。模块注册表以根 `harness.yaml` 的 `modules.items` 为准,`Module-Registry.md` 是生成视图。
199
200
  - `migrate-verify` 必须通过,才能报告迁移输出可用;dashboard 路径必须是 HTML。
200
201
  - 必须基于验证通过的 `session.json` 创建 `legacy-migration` preset 任务。它记录 migration session、证据包、preset audit 和后续 work queue;不会自动重写历史任务正文。
201
202
  - 详细迁移策略见 `docs-release/guides/migration-playbook.md` 或英文镜像
@@ -224,10 +225,8 @@ harness task-log <new-task 输出的 task-id> \
224
225
  --evidence "command:TARGET:npm-test:passed" \
225
226
  /path/to/project
226
227
 
227
- harness review-confirm <new-task 输出的 task-id> \
228
- --reviewer "Human Reviewer" \
229
- --confirm <new-task 输出的 task-id> \
230
- /path/to/project
228
+ # 人工确认只能在本地 Dashboard workbench 中点击完成:
229
+ harness dev /path/to/project
231
230
 
232
231
  harness task-complete <new-task 输出的 task-id> \
233
232
  --message "验证闭环完成" \
@@ -246,11 +245,15 @@ harness task-complete <new-task 输出的 task-id> \
246
245
  `execution_strategy.md`、`findings.md`、`lesson_candidates.md` 和 `review.md`。
247
246
  - `new-task --budget complex` 创建 standard 文件,并额外创建
248
247
  `references/INDEX.md` 和 `artifacts/INDEX.md`。
248
+ - `module register` 只创建模块根 `brief.md`、`module_plan.md`,并把模块登记到
249
+ `harness.yaml modules.items`;`module scaffold` 只修复这两个模块根文档。
250
+ - `new-task --module <key>` 在 `planning/modules/<key>/tasks/<task-id>/` 下创建任务,
251
+ 任务目录内才包含 `execution_strategy.md`、`visual_map.md` 等执行合同。
249
252
  - 已存在的任务目录不会被覆盖;需要改名或继续旧任务时,由 coordinator 决定。
250
253
  - `task-start`、`task-block`、`task-complete` 只更新 `progress.md` 的生命周期状态和日志。
251
254
  - `task-log` 只追加执行记录;证据使用 `type:PATH:summary`,例如
252
255
  `command:TARGET:npm-test:passed`。
253
- - `review-confirm` 会通过受控提交把人工确认审计字段写入任务 `INDEX.md`;如果存在 `Open: yes` 或 `Blocks Release: yes` 的开放 P0/P1/P2 finding,必须拒绝确认。
256
+ - Dashboard workbench 会通过受控提交把人工确认审计字段写入任务 `INDEX.md`;如果存在 `Open: yes` 或 `Blocks Release: yes` 的开放 P0/P1/P2 finding,必须拒绝确认。普通 CLI 不暴露人工确认命令。
254
257
  - CLI-owned lifecycle 和 lesson 命令会在干净 Git root 中自动提交 allowlisted 写入;dirty 状态会出现在 `status` / dashboard 的警告里,并阻塞这些机械化提交。Agent 手工改动仍要主动提交,不能提交时记录 no-commit reason、owner 和下一步。
255
258
  - `status --json` 保留旧 `task.state` 用于兼容,并新增 `lifecycleState`、`reviewStatus`、`closeoutStatus` 和 `stateConflicts`。`done` 只表示实现完成,不等于 `closed`。
256
259
  - 人工操作入口使用本地 HTML workbench:`harness dev /path/to/project`。它会启动只绑定 `127.0.0.1` 的动态页面、自动选择端口、打开浏览器并随 docs 变更刷新。无 GUI 或 CI 场景使用 `harness dev --no-open /path/to/project`。
@@ -24,6 +24,10 @@ Use Node.js 24 or newer. CI should run on the minimum supported LTS line.
24
24
  npm install
25
25
  ```
26
26
 
27
+ The source repository ignores `dist/`. `npm install`, Git/source `prepare`,
28
+ `prepack`, and the root npm scripts regenerate it when needed. The npm package
29
+ still publishes `dist/` and excludes `scripts/` and `tests/`.
30
+
27
31
  If your change touches the GUI submodule:
28
32
 
29
33
  ```bash
@@ -39,8 +43,8 @@ the full root suite.
39
43
  | Change type | Minimum local checks |
40
44
  | --- | --- |
41
45
  | Docs only | `git diff --check` |
42
- | CLI/runtime | `npm test`, `npm run check`, `git diff --check` |
43
- | Templates or examples | `npm test`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
46
+ | CLI/runtime | `npm run typecheck`, `npm run typecheck:guards`, `npm test`, `npm run check`, `git diff --check` |
47
+ | Templates or examples | `npm test`, `npm run build:runtime`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
44
48
  | Dashboard | `npm test`, `npm run smoke:dashboard`, `git diff --check` |
45
49
  | Package surface | `npm test`, `npm run pack:dry-run`, `git diff --check` |
46
50
  | GUI submodule | `cd harness-gui && npm ci && npm run typecheck && npm test && npm run build` |
@@ -48,6 +52,9 @@ the full root suite.
48
52
  Full root suite:
49
53
 
50
54
  ```bash
55
+ npm run build:runtime
56
+ npm run typecheck
57
+ npm run typecheck:guards
51
58
  npm test
52
59
  npm run smoke:dashboard
53
60
  npm run check
@@ -97,4 +104,4 @@ GitHub Actions runs the same broad gates contributors should run locally:
97
104
  - npm package dry run
98
105
  - GUI submodule typecheck, tests, and build
99
106
 
100
- Repository owners manage branch protection and required checks in GitHub. Contributors only need to keep their PRs focused, documented, and verified.
107
+ Repository owners manage branch protection and required checks in GitHub. The root CI includes the enforced TypeScript integrity gate: `npm run typecheck` plus `npm run typecheck:guards`, including the no-`@ts-nocheck` regression check. Contributors only need to keep their PRs focused, documented, and verified.
@@ -24,6 +24,10 @@ PR 尽量聚焦在一类改动上。文档、CLI 行为、目标项目模板、p
24
24
  npm install
25
25
  ```
26
26
 
27
+ 源码仓忽略 `dist/`。`npm install`、Git/source `prepare`、`prepack` 和根仓
28
+ npm scripts 会按需重新生成它。npm 包仍然发布 `dist/`,并排除 `scripts/` 和
29
+ `tests/`。
30
+
27
31
  如果改动涉及 GUI 子模块:
28
32
 
29
33
  ```bash
@@ -38,8 +42,8 @@ npm ci
38
42
  | 改动类型 | 最小本地检查 |
39
43
  | --- | --- |
40
44
  | 仅文档 | `git diff --check` |
41
- | CLI / runtime | `npm test`, `npm run check`, `git diff --check` |
42
- | 模板或示例 | `npm test`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
45
+ | CLI / runtime | `npm run typecheck`, `npm run typecheck:guards`, `npm test`, `npm run check`, `git diff --check` |
46
+ | 模板或示例 | `npm test`, `npm run build:runtime`, `node dist/harness.mjs check --profile target-project examples/minimal-project`, `git diff --check` |
43
47
  | Dashboard | `npm test`, `npm run smoke:dashboard`, `git diff --check` |
44
48
  | Package surface | `npm test`, `npm run pack:dry-run`, `git diff --check` |
45
49
  | GUI 子模块 | `cd harness-gui && npm ci && npm run typecheck && npm test && npm run build` |
@@ -47,6 +51,9 @@ npm ci
47
51
  完整根仓检查:
48
52
 
49
53
  ```bash
54
+ npm run build:runtime
55
+ npm run typecheck
56
+ npm run typecheck:guards
50
57
  npm test
51
58
  npm run smoke:dashboard
52
59
  npm run check
@@ -96,4 +103,4 @@ GitHub Actions 会运行贡献者本地也应覆盖的主要 gate:
96
103
  - npm package dry run
97
104
  - GUI 子模块 typecheck、测试和 build
98
105
 
99
- GitHub branch protection 和 required checks 由仓库 owner 在 GitHub 上管理。贡献者只需要让 PR 聚焦、说明清楚并附上验证证据。
106
+ GitHub branch protection 和 required checks 由仓库 owner 在 GitHub 上管理。根仓 CI 已包含 enforced TypeScript integrity gate:`npm run typecheck` 和 `npm run typecheck:guards`,其中包括 no-`@ts-nocheck` 防回归检查。贡献者只需要让 PR 聚焦、说明清楚并附上验证证据。
@@ -83,7 +83,7 @@ If the user provides external source material, first use `docs/11-REFERENCE/exte
83
83
 
84
84
  ## Step 1: Baseline
85
85
 
86
- First check whether the target environment has the `harness` command. If it does not, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, use `npx --yes coding-agent-harness <command>` for Harness CLI calls. If you are debugging from the source checkout, replace `harness` with `node dist/harness.mjs`.
86
+ First check whether the target environment has the `harness` command. If it does not, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Run that global install only after explicit approval. If the user does not approve or does not respond, use `npx --yes coding-agent-harness <command>` for Harness CLI calls. If you are debugging from the source checkout, run `npm install` or `npm run build:runtime` first, then replace `harness` with `node dist/harness.mjs`.
87
87
 
88
88
  After user confirmation, run or reuse:
89
89
 
@@ -83,7 +83,7 @@ Agent 应推荐下面三种模式之一,而不是让用户自己先懂这些
83
83
 
84
84
  ## Step 1: Baseline
85
85
 
86
- 先检查目标环境是否有 `harness` 命令。如果没有,不要静默全局安装。先询问用户是否允许运行 `npm install -g coding-agent-harness`。只有用户明确同意后才执行全局安装。用户不同意或未回复时,Harness CLI 都用 `npx --yes coding-agent-harness <command>` 临时执行。如果你在源码仓调试,把 `harness` 替换为 `node dist/harness.mjs`。
86
+ 先检查目标环境是否有 `harness` 命令。如果没有,不要静默全局安装。先询问用户是否允许运行 `npm install -g coding-agent-harness`。只有用户明确同意后才执行全局安装。用户不同意或未回复时,Harness CLI 都用 `npx --yes coding-agent-harness <command>` 临时执行。如果你在源码仓调试,先运行 `npm install` 或 `npm run build:runtime` 生成 `dist/`,再把 `harness` 替换为 `node dist/harness.mjs`。
87
87
 
88
88
  用户确认迁移模式后再运行或复用:
89
89
 
@@ -11,7 +11,7 @@ If another agent will execute the migration, first give it:
11
11
  - `docs-release/guides/full-legacy-migration-subagent-strategy.md`
12
12
  - `docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md`
13
13
 
14
- This guide assumes the installed `harness` command. The executing agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Install globally only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace it with `node dist/harness.mjs`.
14
+ This guide assumes the installed `harness` command. The executing agent must first check `command -v harness`. If the target environment does not have `harness`, do not silently install globally. Ask the user whether `npm install -g coding-agent-harness` is allowed. Install globally only after explicit approval. If the user does not approve or does not respond, run the same CLI with `npx --yes coding-agent-harness <command>`. Maintainers debugging from the source checkout can replace it with `node dist/harness.mjs` after `npm install` or `npm run build:runtime` has generated `dist/`.
15
15
 
16
16
  ## Target Path And v2 Structure
17
17
 
@@ -105,7 +105,9 @@ migration destination is `coding-agent-harness/`, and the old `docs/` root is
105
105
  archived under `coding-agent-harness/governance/archive/legacy-docs/`. Legacy
106
106
  `planning/**/_task-template` and `planning/**/_module-template` directories are
107
107
  generated copies of npm-package templates, so migration removes them from the
108
- target project when present:
108
+ target project when present. New module templates live in bundled
109
+ `templates/modules/**`; target projects keep only real module documents and YAML
110
+ registration data:
109
111
 
110
112
  ```bash
111
113
  harness migrate-structure --plan --json /path/to/project
@@ -222,7 +224,7 @@ In baseline mode, only `current-active` tasks or tasks still referenced by SSoT
222
224
 
223
225
  In status-aware rewrite mode, an existing `brief.md`, `execution_strategy.md`, or `visual_map.md` is not automatically preserved. If evidence shows it is an old template, parser residue, wrong language, or too weak for a human to judge current state, rewrite it. Historical tasks may become readable index cards or residuals, but that decision must be evidence-backed.
224
226
 
225
- Global table and module index migration is not manual refilling. Current Harness versions generate task lifecycle summaries into `Harness-Ledger.md` only; legacy `Feature-SSoT.md` and `Private-Feature-SSoT.md` files are archived during cutover and are not regenerated. Module `module_plan.md` Steps tables and module `visual_map.md` topology tables are still generated from module task files. Humans should inspect current state through the Dashboard; agents can use `task-list` / `task-index` queries for fast lookup. Before cutting over an older project, archive the legacy lifecycle tables and rebuild current indexes from task files:
227
+ Global table and module index migration is not manual refilling. Current Harness versions generate task lifecycle summaries into `Harness-Ledger.md` only; legacy `Feature-SSoT.md` and `Private-Feature-SSoT.md` files are archived during cutover and are not regenerated. Module registration data lives in root `harness.yaml` `modules.items`; `Module-Registry.md` is a generated view. Module roots own only `brief.md` and `module_plan.md` by default; `execution_strategy.md`, `visual_map.md`, `review.md`, and `walkthrough.md` belong under concrete task directories. Humans should inspect current state through the Dashboard; agents can use `task-list` / `task-index` queries for fast lookup. Before cutting over an older project, archive the legacy lifecycle tables and rebuild current indexes from task files:
226
228
 
227
229
  ```bash
228
230
  harness governance rebuild --dry-run --archive /path/to/project
@@ -251,7 +253,8 @@ Do not turn many historical tasks into modules automatically. Adopt `module-para
251
253
  - the project has two or more independently evolving product or engineering domains;
252
254
  - every module has an owner, write scope, dependency model, and integration rule;
253
255
  - shared files are owned by the coordinator and worker changes flow through handoff;
254
- - `Module-Registry.md` and each `module_plan.md` can be maintained after migration.
256
+ - root `harness.yaml` `modules.items` can remain the maintained registry, with `Module-Registry.md` only as its generated reading view;
257
+ - each module root needs only real `brief.md` and `module_plan.md`; do not batch-create module-level task contract files just to enable modules.
255
258
 
256
259
  If the project merely has many historical tasks without stable module boundaries, keep `safe-adoption`, use `migrate-plan` as the action list, and add module capability later.
257
260
 
@@ -372,11 +375,11 @@ Treat any FAIL as valid until disproven with evidence. After fixing, regenerate
372
375
 
373
376
  Module classification has three levels and must not skip levels:
374
377
 
375
- 1. `explicit module`: tasks already live under `docs/09-PLANNING/MODULES/<module>/`, or a maintained `Module-Registry.md` exists.
378
+ 1. `explicit module`: tasks already live under v2 `planning/modules/<module>/tasks/`, or root `harness.yaml` `modules.items` registers the module.
376
379
  2. `inferred module`: dashboard temporary grouping from task path/title/ID keywords, for browsing and triage only. It does not mean the project adopted `module-parallel`.
377
380
  3. `legacy-unclassified`: historical tasks that cannot be classified reliably. Preserve history and do not batch-rewrite them.
378
381
 
379
- Before creating `Module-Registry.md`, produce a classification summary:
382
+ Before registering modules, produce a classification summary:
380
383
 
381
384
  - candidate module name;
382
385
  - why this is a product/engineering domain rather than a folder or date range;
@@ -15,7 +15,8 @@ English mirror: `docs-release/guides/migration-playbook.en-US.md`
15
15
  如果目标环境没有 `harness`,不得静默全局安装;先询问用户是否允许运行
16
16
  `npm install -g coding-agent-harness`。用户明确同意后才能安装。用户不同意或未回复时,
17
17
  用 `npx --yes coding-agent-harness <command>` 运行同一条 CLI。维护者在本源码仓调试时,
18
- 可以把同一命令替换为 `node dist/harness.mjs`。
18
+ 可以在 `npm install` 或 `npm run build:runtime` 生成 `dist/` 后,把同一命令替换为
19
+ `node dist/harness.mjs`。
19
20
 
20
21
  ## 目标路径和 v2 结构
21
22
 
@@ -105,7 +106,8 @@ Agent 必须记录具体判断证据,例如 `AGENTS.md`、`CLAUDE.md`、`READM
105
106
  `--apply`。默认迁移目标是 `coding-agent-harness/`,并会把旧 `docs/` 归档到
106
107
  `coding-agent-harness/governance/archive/legacy-docs/`。旧版本遗留的
107
108
  `planning/**/_task-template` 和 `planning/**/_module-template` 是 npm 包内模板的生成副本,
108
- 迁移时会从目标项目中移除:
109
+ 迁移时会从目标项目中移除。新模块模板来自 npm 包内的 `templates/modules/**`;
110
+ 目标项目只保留真实模块文档和 YAML 注册数据:
109
111
 
110
112
  ```bash
111
113
  harness migrate-structure --plan --json /path/to/project
@@ -222,7 +224,7 @@ Baseline 模式下,只有 `current-active` 或 “仍被 SSoT 引用为当前
222
224
 
223
225
  Status-aware rewrite 模式下,已有 `brief.md`、`execution_strategy.md`、`visual_map.md` 不是自动保留;如果证据显示它们只是旧模板、解析残留、语言错误或不能让人判断当前状态,就重写。历史任务可以只写可读索引卡或 residual,但这个判断必须有证据。
224
226
 
225
- 全局表和模块索引迁移不是人工重填。新版本只把任务生命周期汇总生成到 `Harness-Ledger.md`;旧的 `Feature-SSoT.md` 和 `Private-Feature-SSoT.md` 是 legacy 生命周期投影,切换时应先归档,不再重建。模块 `module_plan.md` 的 Steps 表和模块 `visual_map.md` 的拓扑表仍由模块任务文件生成。人看当前状态应优先看 Dashboard,Agent 需要快速定位时用 `task-list` / `task-index` 查询。旧项目切换前,先把旧生命周期表归档,再用生成器从任务文件重建当前索引:
227
+ 全局表和模块索引迁移不是人工重填。新版本只把任务生命周期汇总生成到 `Harness-Ledger.md`;旧的 `Feature-SSoT.md` 和 `Private-Feature-SSoT.md` 是 legacy 生命周期投影,切换时应先归档,不再重建。模块注册数据写在根 `harness.yaml` 的 `modules.items`,`Module-Registry.md` 是生成视图。模块根目录默认只维护 `brief.md` 和 `module_plan.md`;`execution_strategy.md`、`visual_map.md`、`review.md`、`walkthrough.md` 属于具体任务目录。人看当前状态应优先看 Dashboard,Agent 需要快速定位时用 `task-list` / `task-index` 查询。旧项目切换前,先把旧生命周期表归档,再用生成器从任务文件重建当前索引:
226
228
 
227
229
  ```bash
228
230
  harness governance rebuild --dry-run --archive /path/to/project
@@ -251,7 +253,8 @@ Full semantic rewrite 模式下,所有任务都需要 standalone `brief.md`,
251
253
  - 项目存在两个以上可独立演进的产品或工程域。
252
254
  - 每个模块有 owner、write scope、依赖关系和集成规则。
253
255
  - 共享文件由 coordinator 维护,worker 通过 handoff 请求更新。
254
- - `Module-Registry.md` 和每个 `module_plan.md` 能被持续维护。
256
+ - `harness.yaml` `modules.items` 能作为注册表持续维护,生成的 `Module-Registry.md` 只作为视图阅读。
257
+ - 每个模块根目录只需要真实的 `brief.md` 和 `module_plan.md`;不要为了启用模块而批量创建模块级任务合同文件。
255
258
 
256
259
  如果只是历史 task 很多,但没有稳定模块边界,先保持 `safe-adoption`,用 `migrate-plan` 输出 action list,等模块边界明确后再加 capability。
257
260
 
@@ -372,11 +375,11 @@ Capability registry 必须由一个 worker 顺序写,不能多个 worker 并
372
375
 
373
376
  模块分类有三个层级,不能跳级:
374
377
 
375
- 1. `explicit module`:任务已经在 `docs/09-PLANNING/MODULES/<module>/` 下,或已有明确 `Module-Registry.md` 维护。
378
+ 1. `explicit module`:任务已经在 v2 `planning/modules/<module>/tasks/` 下,或根 `harness.yaml` 的 `modules.items` 已注册该模块。
376
379
  2. `inferred module`:dashboard 根据任务路径、标题、ID 关键字临时分组,仅用于浏览和分诊,不代表项目已经采用 `module-parallel`。
377
380
  3. `legacy-unclassified`:无法稳定归类的历史任务,保持历史状态,不要批量改写。
378
381
 
379
- 创建 `Module-Registry.md` 前,必须先输出分类摘要:
382
+ 注册模块前,必须先输出分类摘要:
380
383
 
381
384
  - 候选模块名。
382
385
  - 为什么这是产品/工程域,而不是文件夹或时间段。
@@ -27,6 +27,24 @@ and `harness install-user` seed them into the user preset root, while
27
27
  `harness init` seeds them into the project preset root. Re-run
28
28
  `harness preset seed` for the user root or `harness preset seed --project <target>`
29
29
  for the project root when a preset root is missing or incomplete.
30
+ Use `harness preset audit --json` or `harness preset audit --project --json <target>`
31
+ to compare installed preset manifest hashes with bundled presets before deciding
32
+ whether to re-seed with `--force`.
33
+
34
+ ## Task Provenance Drift
35
+
36
+ Preset audit hashes on a task are creation-time provenance. After a task is
37
+ created, the task directory is an independent document record, so later changes
38
+ to the currently discovered preset do not invalidate historical tasks by
39
+ default. Target checks report manifest, version, and resource drift as
40
+ `preset-drift-warning` messages so maintainers can see that a task came from an
41
+ older preset shape without treating that history as a release-blocking failure.
42
+
43
+ Current preset execution remains stricter. `harness preset check`,
44
+ `harness preset install`, `harness new-task --preset`, and
45
+ `harness preset action` still validate the current preset package and require an
46
+ explicit current-preset opt-in for sensitive reruns when a task's stored audit
47
+ no longer matches the preset being executed.
30
48
 
31
49
  ## Dashboard Management
32
50
 
@@ -78,7 +96,7 @@ task:
78
96
  entrypoints:
79
97
  newTask:
80
98
  type: template
81
- writes: [coding-agent-harness/planning/tasks/**]
99
+ writes: [{{paths.tasksRoot}}/**]
82
100
  audit: true
83
101
  templates:
84
102
  taskPlanAppend: templates/task_plan.append.md
@@ -106,10 +124,47 @@ audit:
106
124
  evidenceFiles: [preset-audit.json, preset-manifest.json, write-scope.json]
107
125
  writeScopes:
108
126
  taskDocs:
109
- path: coding-agent-harness/planning/tasks/**
127
+ path: {{paths.tasksRoot}}/**
110
128
  access: write
111
129
  ```
112
130
 
131
+ ## Task Actions
132
+
133
+ Use `actions` when a preset needs task-level commands after task creation, such
134
+ as closing a workflow stage or generating a preset-owned artifact. Actions run
135
+ through the namespaced CLI entrypoint:
136
+
137
+ ```bash
138
+ harness preset action custom-review close-stage --task custom-review-task --stage PLAN /path/to/project
139
+ ```
140
+
141
+ Action scripts are trusted local Node.js code, not a sandbox. Non-bundled
142
+ script actions require explicit trust when installed:
143
+
144
+ ```bash
145
+ harness preset install ./custom-review --project --allow-scripts /path/to/project
146
+ ```
147
+
148
+ ```yaml
149
+ actions:
150
+ close-stage:
151
+ type: script
152
+ command: scripts/close-stage.mjs
153
+ taskRequired: true
154
+ inputs:
155
+ stage:
156
+ type: text
157
+ flag: --stage
158
+ required: true
159
+ reads: [{{task.paths.taskPlan}}, {{task.paths.artifacts}}/**]
160
+ writes: [{{task.paths.artifacts}}/stages/**, {{task.paths.progress}}]
161
+ audit: true
162
+ ```
163
+
164
+ Action commands must be package-local `.mjs` files. Inputs are schema-only
165
+ (`text`, `flag`, or `json-file`), and writes should use `{{task.paths.*}}`
166
+ tokens so the action stays scoped to the current task.
167
+
113
168
  ## Reference Bundles
114
169
 
115
170
  Use `resources.references` when a family of tasks shares the same outside context, such as another microservice, API contract, migration packet, reviewer input, or local verification runbook. Harness copies or renders these files into each created task directory, appends `references/INDEX.md` rows, and can add a required-read section to `task_plan.md`.
@@ -160,6 +215,12 @@ resources:
160
215
 
161
216
  Templates use `{{valueName}}` placeholders from `templateValues`. `templateValues` and `metadata` support literal `value`, `default`, and dot-path `from` references such as `inputs.subject` or `task.title`; they do not evaluate arbitrary expressions.
162
217
 
218
+ Runtime paths must use the structure-aware `{{paths.*}}` context instead of
219
+ hard-coded `coding-agent-harness/...` strings. Supported path fields include
220
+ `harnessRoot`, `planningRoot`, `tasksRoot`, `modulesRoot`, `externalRoot`,
221
+ `governanceRoot`, `generatedRoot`, `regressionRoot`, `ledgerPath`, and
222
+ `closeoutIndexPath`. Harness resolves them from the target `harness.yaml`.
223
+
163
224
  `metadata` entries render first-class task plan lines such as `Review Subject: API contracts`.
164
225
 
165
226
  ```md
@@ -212,6 +273,9 @@ harness preset install ./my-preset --project /path/to/project
212
273
  harness preset install legacy-migration --force
213
274
  harness preset seed
214
275
  harness preset seed --project /path/to/project
276
+ harness preset audit --json
277
+ harness templates audit --json /path/to/project
278
+ harness templates refresh --apply --json /path/to/project
215
279
  harness preset list --json /path/to/project
216
280
  harness preset inspect custom-review --json /path/to/project
217
281
  harness new-task --title "Custom review task" --preset custom-review --subject "API contracts" /path/to/project
@@ -233,6 +297,8 @@ For every preset, prove both the manifest and downstream task behavior:
233
297
 
234
298
  - Presets cannot write outside declared `writeScopes`.
235
299
  - Presets do not run arbitrary JavaScript during `new-task`.
300
+ - Preset actions may run trusted `.mjs` scripts, but only through
301
+ `harness preset action <preset> <action>` and task-local materialization.
236
302
  - Reference bundles are task-local snapshots. If the shared upstream context changes later, create a new preset version or a follow-up task rather than silently mutating historical tasks.
237
303
  - Script and check entrypoints may exist in bundled packages, but the task creation path is YAML + templates + built-in processors.
238
304
  - Use a new built-in processor only when multiple presets need the same capability and the behavior can be tested centrally.
@@ -28,12 +28,12 @@ stateDiagram-v2
28
28
  review_submitted --> missing_materials: returned for materials
29
29
  missing_materials --> in_progress: repair materials
30
30
  review_submitted --> blocked: blocking finding
31
- review_submitted --> human_confirmed: review-confirm
31
+ review_submitted --> human_confirmed: Dashboard workbench confirmation
32
32
  human_confirmed --> finalized: task-complete + closeout
33
33
  finalized --> [*]
34
34
  ```
35
35
 
36
- `task-review` means the agent submitted a review packet. It does not mean human approval. `review-confirm` is the human confirmation gate and writes its audit fields to `INDEX.md`. `task-complete` / closeout is not a substitute for review confirmation.
36
+ `task-review` means the agent submitted a review packet. It does not mean human approval. Dashboard workbench human confirmation is the human confirmation gate and writes its audit fields to `INDEX.md`. `task-complete` / closeout is not a substitute for review confirmation.
37
37
 
38
38
  ## Phase Kind Map
39
39
 
@@ -43,12 +43,12 @@ stateDiagram-v2
43
43
  | --- | --- | --- | --- |
44
44
  | `init` | Scope, context, budget, and execution strategy. | no | `harness task-start <task-id>` |
45
45
  | `execution` | Implementation, documentation, and verification slices. | yes | `harness task-phase <task-id> <phase-id> --state done --completion 100 --evidence present` |
46
- | `gate` | Agent review submission, human confirmation, lesson routing, walkthrough, and closeout. | no | `harness task-review`, `harness review-confirm`, or `harness task-complete` |
46
+ | `gate` | Agent review submission, human confirmation, lesson routing, walkthrough, and closeout. | no | `harness task-review`, Dashboard workbench human confirmation, or `harness task-complete` |
47
47
 
48
48
  Older phase tables without `Kind` remain valid and are treated as `execution`.
49
49
  The Dashboard implementation score uses non-skipped `execution` phases only.
50
50
  Gate phases explain the next lifecycle action and owner; they do not make a finished implementation look incomplete.
51
- Agents may run `Exit Command` values with `Actor: agent`. `Actor: human` gates, especially `review-confirm`, require explicit human action.
51
+ Agents may run `Exit Command` values with `Actor: agent`. `Actor: human` gates, especially Dashboard workbench human confirmation, require explicit human action.
52
52
 
53
53
  ## Derived State
54
54
 
@@ -91,7 +91,7 @@ flowchart TB
91
91
 
92
92
  | Condition | `lifecycleState` | Meaning |
93
93
  | --- | --- | --- |
94
- | Tombstone, superseded-by, archive, or abandoned marker exists | `soft-deleted-superseded` | Hidden by default, but preserved for audit and replacement tracing. |
94
+ | Tombstone, superseded-by, or archive marker exists | `soft-deleted-superseded` | Hidden by default, but preserved for audit, reason, and replacement tracing; abandoned, duplicate, and requirement-change semantics live in `Reason`. |
95
95
  | Open P0-P2 finding, invalid transition, audit failure, or failed human-review gate | `blocked` | Cannot enter human confirmation until the blocker is fixed or waived. |
96
96
  | Standard / complex task is missing required files, sections, evidence, lesson decision, or review submission | `missing-materials` | Needs agent repair; not part of the human review queue. |
97
97
  | `task-review` was submitted, materials are ready, and `INDEX.md` does not show human confirmation | `review-submitted` | Truly waiting for human review. |
@@ -111,7 +111,7 @@ flowchart TB
111
111
  | `blocked-open-findings` | There is an open P0-P2 finding or a finding that blocks release / confirmation. |
112
112
  | `confirmed` | `INDEX.md` Task Audit Metadata has `Human Review Status: confirmed` and committed audit fields. |
113
113
 
114
- Agent self-review, subagent review, and coordinator review can only move a task toward `submitted`. Only `review-confirm` or an explicit Dashboard Workbench human confirmation writes the confirmation audit fields in `INDEX.md`.
114
+ Agent self-review, subagent review, and coordinator review can only move a task toward `submitted`. Only an explicit Dashboard Workbench human confirmation writes the confirmation audit fields in `INDEX.md`.
115
115
 
116
116
  ## Lifecycle Queues
117
117
 
@@ -143,7 +143,7 @@ flowchart TD
143
143
  | Blocked | Blocking finding, state conflict, Git audit failure, completion gate failure, or human waiver required. | agent + human | Fixed, closed, or explicitly waived. |
144
144
  | Lessons | Lesson candidate needs decision, task-local retention, rejection, dry-run promotion, or a sedimentation task. | human + agent | Decision is complete, or a traceable sedimentation task exists. |
145
145
  | Confirmed / Finalized | Human-confirmed, or finalized and ready for read-only tracing. | coordinator | Closeout, ledger, and lesson routing are complete; then read-only. |
146
- | Soft-deleted / Superseded | Task was soft-deleted, replaced, merged, archived, or abandoned. | coordinator | Read-only tracing; reopen only when needed. |
146
+ | Soft-deleted / Superseded | Task was soft-deleted, replaced, merged, or archived; abandoned / duplicate / requirement-change semantics are tombstone reasons. | coordinator | Read-only tracing; reopen only when needed. |
147
147
 
148
148
  The Review queue only waits for human confirmation. Missing materials, blockers, lesson sedimentation, confirmed-but-not-finalized work, and historical superseded tasks must not masquerade as Review queue items.
149
149
 
@@ -195,7 +195,7 @@ sequenceDiagram
195
195
 
196
196
  Strict rule: an agent can prepare review evidence and submit the task for review, but the task is not human-confirmed until the task `INDEX.md` contains committed confirmation audit fields. Confirmation must use gated auto-commit: the CLI and Workbench reject dirty Git state, missing commit identity, hook/preflight failure, or writes outside the current task `INDEX.md` allowlist, and return recovery guidance.
197
197
 
198
- CLI-owned mechanical writes and agent-owned manual slices have different boundaries. `new-task`, `task-*`, `task-phase`, `module-step`, `review-confirm`, `lesson-sediment`, and `lesson-promote --apply` acquire a lock, restrict writes to an allowlist, and auto-commit in a clean Git root. When an agent manually edits code, templates, or task docs, it still needs to proactively commit after verification; if it cannot commit, it must record the no-commit reason, owner, and next step, and must not mix unrelated dirty changes into the task commit.
198
+ CLI-owned mechanical writes, Workbench human confirmation, and agent-owned manual slices have different boundaries. `new-task`, `task-*`, `task-phase`, `module-step`, `lesson-sediment`, and `lesson-promote --apply` acquire a lock, restrict writes to an allowlist, and auto-commit in a clean Git root; human confirmation runs only through the local Workbench. When an agent manually edits code, templates, or task docs, it still needs to proactively commit after verification; if it cannot commit, it must record the no-commit reason, owner, and next step, and must not mix unrelated dirty changes into the task commit.
199
199
 
200
200
  ## Lesson Sedimentation
201
201
 
@@ -28,12 +28,12 @@ stateDiagram-v2
28
28
  review_submitted --> missing_materials: returned for materials
29
29
  missing_materials --> in_progress: repair materials
30
30
  review_submitted --> blocked: blocking finding
31
- review_submitted --> human_confirmed: review-confirm
31
+ review_submitted --> human_confirmed: Dashboard workbench confirmation
32
32
  human_confirmed --> finalized: task-complete + closeout
33
33
  finalized --> [*]
34
34
  ```
35
35
 
36
- `task-review` 表示 Agent 提交审查材料包,不表示人工批准。`review-confirm` 才表示人工确认门禁,并把审计字段写入 `INDEX.md`。`task-complete` / closeout 也不是 review confirmation 的替代品。
36
+ `task-review` 表示 Agent 提交审查材料包,不表示人工批准。Dashboard workbench 人工确认才表示人工确认门禁,并把审计字段写入 `INDEX.md`。`task-complete` / closeout 也不是 review confirmation 的替代品。
37
37
 
38
38
  ## 阶段类型地图
39
39
 
@@ -43,12 +43,12 @@ stateDiagram-v2
43
43
  | --- | --- | --- | --- |
44
44
  | `init` | 范围、上下文、预算和执行策略。 | 否 | `harness task-start <task-id>` |
45
45
  | `execution` | 实现、文档和验证切片。 | 是 | `harness task-phase <task-id> <phase-id> --state done --completion 100 --evidence present` |
46
- | `gate` | Agent 提交审查、人工确认、lesson routing、walkthrough 和 closeout。 | 否 | `harness task-review`、`harness review-confirm` `harness task-complete` |
46
+ | `gate` | Agent 提交审查、人工确认、lesson routing、walkthrough 和 closeout。 | 否 | `harness task-review`、Dashboard workbench 人工确认,或 `harness task-complete` |
47
47
 
48
48
  旧阶段表没有 `Kind` 也继续有效,默认按 `execution` 处理。
49
49
  Dashboard 实现完成度只计算非 skipped 的 `execution` 阶段。
50
50
  Gate 阶段用于解释下一步生命周期动作和责任人,不会让已完成的实现看起来未完成。
51
- Agent 只能执行 `Actor: agent` 的 `Exit Command`。`Actor: human` 的 gate,尤其是 `review-confirm`,必须由人工明确执行。
51
+ Agent 只能执行 `Actor: agent` 的 `Exit Command`。`Actor: human` 的 gate,尤其是 Dashboard workbench 人工确认,必须由人工明确执行。
52
52
 
53
53
  ## 派生状态
54
54
 
@@ -91,7 +91,7 @@ flowchart TB
91
91
 
92
92
  | 条件 | `lifecycleState` | 含义 |
93
93
  | --- | --- | --- |
94
- | 有 tombstone、superseded-by、archiveabandoned 标记 | `soft-deleted-superseded` | 默认隐藏,但保留审计和替代链。 |
94
+ | 有 tombstone、superseded-by 或 archive 标记 | `soft-deleted-superseded` | 默认隐藏,但保留审计、原因和替代链;废弃、重复、需求变更写入 `Reason`。 |
95
95
  | 有 open P0-P2 finding、非法状态转换、审计失败或人审门禁失败 | `blocked` | 不能进入人工确认,必须先修 blocker 或记录 waiver。 |
96
96
  | 标准/复杂任务缺必需文件、章节、证据、lesson decision 或 review submission | `missing-materials` | 需要 Agent 补材料,不属于人审队列。 |
97
97
  | 已执行 `task-review`,材料齐全,且 `INDEX.md` 尚未显示人工确认 | `review-submitted` | 真正等待人审。 |
@@ -111,7 +111,7 @@ flowchart TB
111
111
  | `blocked-open-findings` | 有 open P0-P2 finding,或 finding 阻塞发布 / 确认。 |
112
112
  | `confirmed` | `INDEX.md` Task Audit Metadata 包含 `Human Review Status: confirmed` 和已提交审计字段。 |
113
113
 
114
- Agent 自查、subagent 审查和 coordinator 审查都只能让任务接近 `submitted`。只有 `review-confirm` 或 Workbench 的明确人工确认动作会把确认审计字段写入 `INDEX.md`。
114
+ Agent 自查、subagent 审查和 coordinator 审查都只能让任务接近 `submitted`。只有 Workbench 的明确人工确认动作会把确认审计字段写入 `INDEX.md`。
115
115
 
116
116
  ## 生命周期队列
117
117
 
@@ -202,7 +202,7 @@ sequenceDiagram
202
202
 
203
203
  严格规则:Agent 可以准备 review evidence,也可以提交审查;但任务只有在任务 `INDEX.md` 包含已提交的确认审计字段后,才算人工确认。确认动作必须通过 gated auto-commit:Git 状态不干净、提交身份缺失、hook/preflight 失败,或待写文件超出当前任务 `INDEX.md` 白名单时,CLI 和 Workbench 都会拒绝并返回恢复建议。
204
204
 
205
- CLI-owned 机械写入和 agent-owned 手工切片是两条边界。`new-task`、`task-*`、`task-phase`、`module-step`、`review-confirm`、`lesson-sediment` 和 `lesson-promote --apply` 会在干净 Git root 中加锁、限制写入范围并自动提交。Agent 手工编辑代码、模板或任务文档时仍要在验证后主动提交;无法提交时必须记录 no-commit reason、owner 和下一步,不能把 unrelated dirty changes 混入任务提交。
205
+ CLI-owned 机械写入、Workbench 人工确认和 agent-owned 手工切片是三条边界。`new-task`、`task-*`、`task-phase`、`module-step`、`lesson-sediment` 和 `lesson-promote --apply` 会在干净 Git root 中加锁、限制写入范围并自动提交;人工确认只通过本地 Workbench 执行。Agent 手工编辑代码、模板或任务文档时仍要在验证后主动提交;无法提交时必须记录 no-commit reason、owner 和下一步,不能把 unrelated dirty changes 混入任务提交。
206
206
 
207
207
  ## Lesson 沉淀
208
208