coding-agent-harness 1.0.2 → 1.0.5

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 (219) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/CONTRIBUTING.md +98 -0
  3. package/LICENSE +661 -21
  4. package/LICENSE-EXCEPTION.md +37 -0
  5. package/README.md +244 -87
  6. package/README.zh-CN.md +77 -35
  7. package/SKILL.md +32 -24
  8. package/docs-release/README.md +9 -5
  9. package/docs-release/architecture/overview.md +17 -5
  10. package/docs-release/architecture/overview.zh-CN.md +9 -5
  11. package/docs-release/architecture/system-explainer/01-system-overview.md +217 -0
  12. package/docs-release/architecture/system-explainer/02-module-dependency.md +257 -0
  13. package/docs-release/architecture/system-explainer/03-task-lifecycle.md +304 -0
  14. package/docs-release/architecture/system-explainer/04-check-and-governance.md +239 -0
  15. package/docs-release/architecture/system-explainer/05-data-flow.md +276 -0
  16. package/docs-release/architecture/system-explainer/06-preset-and-migration.md +303 -0
  17. package/docs-release/architecture/system-explainer/README.md +67 -0
  18. package/docs-release/architecture/system-explainer/en-US/01-system-overview.md +226 -0
  19. package/docs-release/architecture/system-explainer/en-US/02-module-dependency.md +263 -0
  20. package/docs-release/architecture/system-explainer/en-US/03-task-lifecycle.md +319 -0
  21. package/docs-release/architecture/system-explainer/en-US/04-check-and-governance.md +250 -0
  22. package/docs-release/architecture/system-explainer/en-US/05-data-flow.md +290 -0
  23. package/docs-release/architecture/system-explainer/en-US/06-preset-and-migration.md +323 -0
  24. package/docs-release/architecture/system-explainer/en-US/README.md +70 -0
  25. package/docs-release/assets/dashboard-overview.png +0 -0
  26. package/docs-release/guides/agent-installation.en-US.md +39 -15
  27. package/docs-release/guides/agent-installation.md +43 -16
  28. package/docs-release/guides/contributing.md +100 -0
  29. package/docs-release/guides/contributing.zh-CN.md +99 -0
  30. package/docs-release/guides/document-audience-and-surfaces.en-US.md +3 -2
  31. package/docs-release/guides/document-audience-and-surfaces.md +3 -2
  32. package/docs-release/guides/full-legacy-migration-subagent-strategy.md +2 -2
  33. package/docs-release/guides/full-legacy-migration-subagent-strategy.zh-CN.md +2 -2
  34. package/docs-release/guides/legacy-migration-agent-prompt.md +0 -11
  35. package/docs-release/guides/legacy-migration-agent-prompt.zh-CN.md +0 -11
  36. package/docs-release/guides/migration-playbook.en-US.md +14 -15
  37. package/docs-release/guides/migration-playbook.md +14 -15
  38. package/docs-release/guides/parent-control-repository-pattern.en-US.md +7 -5
  39. package/docs-release/guides/parent-control-repository-pattern.md +7 -5
  40. package/docs-release/guides/preset-development.md +238 -0
  41. package/docs-release/guides/repository-operating-models.en-US.md +5 -4
  42. package/docs-release/guides/repository-operating-models.md +5 -4
  43. package/docs-release/guides/task-state-machine.en-US.md +224 -0
  44. package/docs-release/guides/task-state-machine.md +231 -0
  45. package/docs-release/intl/en-US.md +1 -1
  46. package/docs-release/intl/zh-CN.md +1 -1
  47. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/INDEX.md +60 -0
  48. package/examples/minimal-project/docs/09-PLANNING/TASKS/demo-task/findings.md +7 -0
  49. package/package.json +10 -4
  50. package/presets/legacy-migration/checks/preset-check.mjs +3 -0
  51. package/presets/legacy-migration/preset.yaml +134 -0
  52. package/presets/legacy-migration/scripts/plan-work-queue.mjs +4 -0
  53. package/presets/legacy-migration/scripts/scaffold-task-contracts.mjs +4 -0
  54. package/presets/legacy-migration/templates/execution_strategy.append.md +18 -0
  55. package/presets/legacy-migration/templates/findings.seed.md +17 -0
  56. package/presets/legacy-migration/templates/review.seed.md +12 -0
  57. package/presets/legacy-migration/templates/task_plan.append.md +9 -0
  58. package/presets/legacy-migration/templates/visual_map.append.md +12 -0
  59. package/presets/legacy-migration/workbench/dashboard-panels.yaml +2 -0
  60. package/presets/legacy-migration/workbench/migration-queue.schema.json +23 -0
  61. package/presets/lesson-sedimentation/preset.yaml +23 -0
  62. package/presets/lesson-sedimentation/templates/prompt.md +23 -0
  63. package/presets/module/preset.yaml +25 -0
  64. package/presets/module/templates/execution_strategy.append.md +8 -0
  65. package/presets/module/templates/task_plan.append.md +17 -0
  66. package/presets/standard-task/preset.yaml +31 -0
  67. package/presets/standard-task/templates/task_plan.append.md +7 -0
  68. package/references/adversarial-review-standard.md +2 -2
  69. package/references/agents-md-pattern.md +2 -2
  70. package/references/delivery-operating-model-standard.md +3 -3
  71. package/references/docs-directory-standard.md +6 -7
  72. package/references/harness-ledger.md +53 -96
  73. package/references/lessons-governance.md +88 -93
  74. package/references/module-parallel-standard.md +14 -14
  75. package/references/planning-loop.md +12 -6
  76. package/references/pull-request-standard.md +118 -0
  77. package/references/repo-governance-standard.md +11 -2
  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/walkthrough-closeout.md +7 -7
  82. package/scripts/check-harness.mjs +40 -301
  83. package/scripts/commands/dashboard-command.mjs +67 -0
  84. package/scripts/commands/migration-command.mjs +126 -0
  85. package/scripts/commands/preset-command.mjs +73 -0
  86. package/scripts/commands/task-command.mjs +328 -0
  87. package/scripts/harness.mjs +59 -260
  88. package/scripts/lib/capability-registry.mjs +82 -28
  89. package/scripts/lib/check-module-parallel.mjs +230 -0
  90. package/scripts/lib/check-profiles.mjs +90 -228
  91. package/scripts/lib/check-task-contracts.mjs +55 -0
  92. package/scripts/lib/core-shared.mjs +65 -2
  93. package/scripts/lib/dashboard-data.mjs +155 -24
  94. package/scripts/lib/dashboard-workbench.mjs +131 -12
  95. package/scripts/lib/dashboard-writer.mjs +20 -4
  96. package/scripts/lib/git-status-summary.mjs +46 -0
  97. package/scripts/lib/governance-index-generator.mjs +174 -0
  98. package/scripts/lib/governance-sync.mjs +611 -0
  99. package/scripts/lib/governance-table-boundary.mjs +175 -0
  100. package/scripts/lib/harness-core.mjs +6 -0
  101. package/scripts/lib/lesson-maintenance.mjs +36 -29
  102. package/scripts/lib/markdown-utils.mjs +33 -0
  103. package/scripts/lib/migration-planner.mjs +4 -6
  104. package/scripts/lib/migration-support.mjs +1 -1
  105. package/scripts/lib/phase-kind.mjs +50 -0
  106. package/scripts/lib/preset-audit-contracts.mjs +37 -0
  107. package/scripts/lib/preset-engine.mjs +494 -0
  108. package/scripts/lib/preset-registry.mjs +776 -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-builder.mjs +88 -0
  112. package/scripts/lib/status-dashboard-renderer.mjs +105 -0
  113. package/scripts/lib/subagent-authorization-audit.mjs +196 -0
  114. package/scripts/lib/task-audit-metadata.mjs +385 -0
  115. package/scripts/lib/task-audit-migration.mjs +350 -0
  116. package/scripts/lib/task-completion-consistency.mjs +26 -0
  117. package/scripts/lib/task-index.mjs +93 -0
  118. package/scripts/lib/task-lesson-candidates.mjs +242 -0
  119. package/scripts/lib/task-lesson-sedimentation.mjs +326 -0
  120. package/scripts/lib/task-lifecycle/create-task-helpers.mjs +67 -0
  121. package/scripts/lib/task-lifecycle/phase-sync.mjs +88 -0
  122. package/scripts/lib/task-lifecycle/review-confirm.mjs +112 -0
  123. package/scripts/lib/task-lifecycle/review-gates.mjs +73 -0
  124. package/scripts/lib/task-lifecycle/review-submission.mjs +63 -0
  125. package/scripts/lib/task-lifecycle/scaffold-provenance.mjs +49 -0
  126. package/scripts/lib/task-lifecycle/template-files.mjs +53 -0
  127. package/scripts/lib/task-lifecycle/text-utils.mjs +24 -0
  128. package/scripts/lib/task-lifecycle.mjs +338 -477
  129. package/scripts/lib/task-metadata.mjs +118 -0
  130. package/scripts/lib/task-review-model.mjs +455 -0
  131. package/scripts/lib/task-scanner.mjs +193 -372
  132. package/scripts/lib/task-tombstone-commands.mjs +140 -0
  133. package/scripts/postinstall.mjs +14 -0
  134. package/skills/preset-creator/SKILL.md +179 -0
  135. package/skills/preset-creator/references/complex-task-skeleton/README.md +31 -0
  136. package/skills/preset-creator/references/complex-task-skeleton/artifacts/INDEX.md +12 -0
  137. package/skills/preset-creator/references/complex-task-skeleton/brief.md +43 -0
  138. package/skills/preset-creator/references/complex-task-skeleton/execution_strategy.md +71 -0
  139. package/skills/preset-creator/references/complex-task-skeleton/findings.md +24 -0
  140. package/skills/preset-creator/references/complex-task-skeleton/lesson_candidates.md +70 -0
  141. package/skills/preset-creator/references/complex-task-skeleton/long-running-task-contract.md +76 -0
  142. package/skills/preset-creator/references/complex-task-skeleton/progress.md +33 -0
  143. package/skills/preset-creator/references/complex-task-skeleton/references/INDEX.md +13 -0
  144. package/skills/preset-creator/references/complex-task-skeleton/review.md +107 -0
  145. package/skills/preset-creator/references/complex-task-skeleton/task_plan.md +111 -0
  146. package/skills/preset-creator/references/complex-task-skeleton/visual_map.md +50 -0
  147. package/skills/preset-creator/references/preset-package-skeleton.md +296 -0
  148. package/templates/AGENTS.md.template +24 -18
  149. package/templates/dashboard/assets/app-src/00-state.js +13 -0
  150. package/templates/dashboard/assets/app-src/10-router.js +5 -1
  151. package/templates/dashboard/assets/app-src/20-overview.js +18 -8
  152. package/templates/dashboard/assets/app-src/30-tasks.js +92 -246
  153. package/templates/dashboard/assets/app-src/35-task-detail.js +286 -0
  154. package/templates/dashboard/assets/app-src/45-review.js +241 -22
  155. package/templates/dashboard/assets/app-src/50-migration.js +24 -10
  156. package/templates/dashboard/assets/app-src/55-presets.js +375 -0
  157. package/templates/dashboard/assets/app-src/60-shared.js +3 -1
  158. package/templates/dashboard/assets/app-src/90-bindings.js +302 -29
  159. package/templates/dashboard/assets/app.css +1501 -376
  160. package/templates/dashboard/assets/app.css.manifest.json +10 -0
  161. package/templates/dashboard/assets/app.js +1240 -101
  162. package/templates/dashboard/assets/app.manifest.json +2 -0
  163. package/templates/dashboard/assets/css-src/00-foundation.css +346 -0
  164. package/templates/dashboard/assets/css-src/10-panels-flow.css +236 -0
  165. package/templates/dashboard/assets/css-src/20-briefs-controls.css +398 -0
  166. package/templates/dashboard/assets/css-src/30-task-index.css +739 -0
  167. package/templates/dashboard/assets/css-src/35-review-workspace.css +507 -0
  168. package/templates/dashboard/assets/css-src/40-detail-modules-migration.css +489 -0
  169. package/templates/dashboard/assets/css-src/45-presets.css +516 -0
  170. package/templates/dashboard/assets/css-src/50-responsive-overrides.css +551 -0
  171. package/templates/dashboard/assets/i18n.js +263 -23
  172. package/templates/ledger/Harness-Ledger.md +13 -25
  173. package/templates/lessons/lesson-arch-process-change.md +1 -1
  174. package/templates/lessons/lesson-new-doc.md +1 -1
  175. package/templates/lessons/lesson-ref-change.md +1 -1
  176. package/templates/planning/INDEX.md +87 -0
  177. package/templates/planning/brief.md +1 -1
  178. package/templates/planning/execution_strategy.md +31 -0
  179. package/templates/planning/lesson_candidates.md +18 -6
  180. package/templates/planning/module_session_prompt.md +1 -0
  181. package/templates/planning/optional/artifacts/INDEX.md +3 -3
  182. package/templates/planning/optional/references/INDEX.md +3 -3
  183. package/templates/planning/review.md +41 -0
  184. package/templates/planning/task_plan.md +5 -21
  185. package/templates/planning/visual_map.md +13 -9
  186. package/templates/planning/visual_map.simple.md +52 -0
  187. package/templates/reference/execution-workflow-standard.md +31 -3
  188. package/templates/reference/pull-request-standard.md +80 -0
  189. package/templates/reference/repo-governance-standard.md +7 -6
  190. package/templates/reference/review-routing-standard.md +6 -0
  191. package/templates/reference/walkthrough-standard.md +2 -1
  192. package/templates/verifier/verifier-output.md +1 -1
  193. package/templates-zh-CN/AGENTS.md.template +25 -19
  194. package/templates-zh-CN/ledger/Harness-Ledger.md +17 -40
  195. package/templates-zh-CN/planning/INDEX.md +87 -0
  196. package/templates-zh-CN/planning/brief.md +1 -1
  197. package/templates-zh-CN/planning/execution_strategy.md +30 -0
  198. package/templates-zh-CN/planning/lesson_candidates.md +18 -6
  199. package/templates-zh-CN/planning/module_session_prompt.md +1 -0
  200. package/templates-zh-CN/planning/review.md +41 -1
  201. package/templates-zh-CN/planning/task_plan.md +4 -44
  202. package/templates-zh-CN/planning/visual_map.md +14 -7
  203. package/templates-zh-CN/planning/visual_map.simple.md +48 -0
  204. package/templates-zh-CN/reference/adversarial-review-standard.md +1 -1
  205. package/templates-zh-CN/reference/docs-library-standard.md +1 -1
  206. package/templates-zh-CN/reference/execution-workflow-standard.md +33 -7
  207. package/templates-zh-CN/reference/harness-ledger-standard.md +2 -2
  208. package/templates-zh-CN/reference/pull-request-standard.md +106 -0
  209. package/templates-zh-CN/reference/repo-governance-standard.md +4 -3
  210. package/templates-zh-CN/reference/review-routing-standard.md +8 -1
  211. package/templates-zh-CN/reference/walkthrough-standard.md +3 -2
  212. package/templates-zh-CN/walkthrough/Closeout-SSoT.md +1 -1
  213. package/docs-release/assets/dashboard-overview-en.png +0 -0
  214. package/scripts/smoke-dashboard.mjs +0 -92
  215. package/scripts/test-harness.mjs +0 -1395
  216. package/templates/ssot/Feature-SSoT.md +0 -43
  217. package/templates/ssot/Lessons-SSoT.md +0 -44
  218. package/templates-zh-CN/ssot/Feature-SSoT.md +0 -49
  219. package/templates-zh-CN/ssot/Lessons-SSoT.md +0 -49
@@ -0,0 +1,140 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import {
4
+ normalizeTarget,
5
+ nowTimestamp,
6
+ readFileSafe,
7
+ toPosix,
8
+ datePrefix,
9
+ } from "./core-shared.mjs";
10
+ import { collectTasks } from "./task-scanner.mjs";
11
+ import {
12
+ beginGovernanceSync,
13
+ commitGovernanceSync,
14
+ releaseGovernanceSync,
15
+ } from "./governance-sync.mjs";
16
+
17
+ export function supersedeTask(targetInput, oldRef, { by = "", reason = "" } = {}) {
18
+ if (!by) throw new Error("task-supersede requires --by <new-task-id>");
19
+ const target = normalizeTarget(targetInput);
20
+ const oldTask = resolveTask(target, oldRef);
21
+ const newTask = resolveTask(target, by);
22
+ const governanceContext = beginGovernanceSync(target, { operation: `task-supersede ${oldTask.id}` });
23
+ try {
24
+ writeTombstone(target, oldTask, {
25
+ State: "superseded",
26
+ "Superseded By": newTask.id,
27
+ Reason: reason || "superseded",
28
+ Operator: "coordinator",
29
+ Timestamp: nowTimestamp(),
30
+ "Reopen Eligible": "yes",
31
+ "Archive Eligible": "no",
32
+ });
33
+ appendProgress(target, oldTask, `task-supersede: superseded by ${newTask.id}`, reason || "superseded");
34
+ appendSupersedes(target, newTask, oldTask.id);
35
+ const commit = commitGovernanceSync(contextFor(target, governanceContext), taskPaths(target, oldTask, newTask), {
36
+ message: `chore(harness): supersede task ${oldTask.id}`,
37
+ });
38
+ return { taskId: oldTask.id, supersededBy: newTask.id, reason: reason || "superseded", governance: { commit } };
39
+ } finally {
40
+ releaseGovernanceSync(governanceContext);
41
+ }
42
+ }
43
+
44
+ export function softDeleteTask(targetInput, taskRef, { reason = "" } = {}) {
45
+ const target = normalizeTarget(targetInput);
46
+ const task = resolveTask(target, taskRef);
47
+ return writeDeletionState(target, task, "soft-deleted", reason || "soft-delete", "task-delete --soft");
48
+ }
49
+
50
+ export function archiveTask(targetInput, taskRef, { reason = "" } = {}) {
51
+ const target = normalizeTarget(targetInput);
52
+ const task = resolveTask(target, taskRef);
53
+ return writeDeletionState(target, task, "archived", reason || "archive", "task-archive");
54
+ }
55
+
56
+ export function reopenTask(targetInput, taskRef, { reason = "" } = {}) {
57
+ const target = normalizeTarget(targetInput);
58
+ const task = resolveTask(target, taskRef);
59
+ const governanceContext = beginGovernanceSync(target, { operation: `task-reopen ${task.id}` });
60
+ try {
61
+ const taskPlanPath = path.join(target.projectRoot, task.taskPlanPath.replace(/^TARGET:/, ""));
62
+ const content = readFileSafe(taskPlanPath);
63
+ const next = content.replace(/\n##\s*(?:Task Tombstone|任务墓碑)\s*$[\s\S]*?(?=^##\s+|(?![\s\S]))/im, "");
64
+ fs.writeFileSync(taskPlanPath, next.endsWith("\n") ? next : `${next}\n`);
65
+ appendProgress(target, task, "task-reopen", reason || "reopened");
66
+ const commit = commitGovernanceSync(governanceContext, taskPaths(target, task), {
67
+ message: `chore(harness): reopen task ${task.id}`,
68
+ });
69
+ return { taskId: task.id, deletionState: "active", reason: reason || "reopened", governance: { commit } };
70
+ } finally {
71
+ releaseGovernanceSync(governanceContext);
72
+ }
73
+ }
74
+
75
+ function writeDeletionState(target, task, deletionState, reason, action) {
76
+ const governanceContext = beginGovernanceSync(target, { operation: `${action} ${task.id}` });
77
+ try {
78
+ writeTombstone(target, task, {
79
+ State: deletionState,
80
+ Reason: reason,
81
+ Operator: "coordinator",
82
+ Timestamp: nowTimestamp(),
83
+ "Reopen Eligible": "yes",
84
+ "Archive Eligible": deletionState === "archived" ? "yes" : "no",
85
+ });
86
+ appendProgress(target, task, action, reason);
87
+ const commit = commitGovernanceSync(governanceContext, taskPaths(target, task), {
88
+ message: `chore(harness): ${action.replace(/\s+/g, " ")} ${task.id}`,
89
+ });
90
+ return { taskId: task.id, deletionState, reason, governance: { commit } };
91
+ } finally {
92
+ releaseGovernanceSync(governanceContext);
93
+ }
94
+ }
95
+
96
+ function taskPaths(target, ...tasks) {
97
+ return [...new Set(tasks.flatMap((task) => [task.taskPlanPath, task.progressPath]).filter(Boolean).map((item) => toPosix(item.replace(/^TARGET:/, ""))))];
98
+ }
99
+
100
+ function contextFor(_target, context) {
101
+ return context;
102
+ }
103
+
104
+ function resolveTask(target, ref) {
105
+ const normalized = String(ref || "").trim();
106
+ const matches = collectTasks(target).filter((task) => {
107
+ const bare = datePrefix.test(task.shortId) ? task.shortId.replace(datePrefix, "") : task.shortId;
108
+ return task.id === normalized || task.shortId === normalized || task.id.endsWith(`/${normalized}`) || bare === normalized;
109
+ });
110
+ if (matches.length === 1) return matches[0];
111
+ if (matches.length > 1) throw new Error(`Ambiguous task reference: ${ref}`);
112
+ throw new Error(`Task not found: ${ref}`);
113
+ }
114
+
115
+ function writeTombstone(target, task, fields) {
116
+ const taskPlanPath = path.join(target.projectRoot, task.taskPlanPath.replace(/^TARGET:/, ""));
117
+ const content = readFileSafe(taskPlanPath).replace(/\n##\s*(?:Task Tombstone|任务墓碑)\s*$[\s\S]*?(?=^##\s+|(?![\s\S]))/im, "");
118
+ const block = ["", "## Task Tombstone", "", "| Field | Value |", "| --- | --- |", ...Object.entries(fields).map(([key, value]) => `| ${key} | ${escapeCell(value)} |`), ""].join("\n");
119
+ fs.writeFileSync(taskPlanPath, `${content.trimEnd()}\n${block}`);
120
+ }
121
+
122
+ function appendSupersedes(target, task, oldId) {
123
+ const taskPlanPath = path.join(target.projectRoot, task.taskPlanPath.replace(/^TARGET:/, ""));
124
+ const content = readFileSafe(taskPlanPath);
125
+ if (/^Supersedes\s*[::]/im.test(content)) {
126
+ fs.writeFileSync(taskPlanPath, content.replace(/^Supersedes\s*[::]\s*(.*)$/im, (_m, current) => `Supersedes: ${[current, oldId].filter(Boolean).join(", ")}`));
127
+ return;
128
+ }
129
+ fs.writeFileSync(taskPlanPath, `${content.trimEnd()}\nSupersedes: ${oldId}\n`);
130
+ }
131
+
132
+ function appendProgress(target, task, action, reason) {
133
+ const progressPath = path.join(target.projectRoot, task.progressPath.replace(/^TARGET:/, ""));
134
+ const relative = toPosix(path.relative(target.projectRoot, progressPath));
135
+ fs.appendFileSync(progressPath, `\n\n## Tombstone Log\n\n- ${nowTimestamp()} ${action}: ${escapeCell(reason)} (${relative})\n`);
136
+ }
137
+
138
+ function escapeCell(value) {
139
+ return String(value || "").replace(/\r?\n/g, " ").replaceAll("|", "\\|").trim();
140
+ }
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { seedBundledPresets } from "./lib/harness-core.mjs";
4
+
5
+ if (process.env.CODING_AGENT_HARNESS_SKIP_POSTINSTALL === "1") process.exit(0);
6
+
7
+ try {
8
+ const result = seedBundledPresets({ scope: "user" });
9
+ const changed = result.created + result.overwritten;
10
+ const summary = changed > 0 ? `${changed} bundled presets installed` : `${result.skipped} bundled presets already present`;
11
+ console.log(`coding-agent-harness postinstall: ${summary} at ${result.target}`);
12
+ } catch (error) {
13
+ console.warn(`coding-agent-harness postinstall: preset seed skipped (${error.message})`);
14
+ }
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: preset-creator
3
+ description: Use when creating, reviewing, improving, or installing Coding Agent Harness preset packages for repeatable task families.
4
+ ---
5
+
6
+ # Preset Creator
7
+
8
+ Use this skill when a user wants to create, review, improve, or install a Harness preset.
9
+
10
+ A good preset is not just a folder template. It is a reusable task method package: it captures when a class of tasks should exist, what inputs the agent must ask for, what task metadata must be visible, what shared references must be read, what evidence must be produced, and how the created task proves it is using the preset correctly.
11
+
12
+ This skill is standalone. Do not assume the agent already knows Harness task contracts. Before creating a preset for complex tasks, read the included complex task skeleton reference and design the preset as an overlay on that skeleton.
13
+
14
+ ## Preset Methodology
15
+
16
+ Create a preset when at least two future tasks should share the same method or context. Good examples:
17
+
18
+ - A group of API tasks all depend on the same upstream microservice contract.
19
+ - Migration tasks all need the same baseline session evidence and cutover rules.
20
+ - Review tasks all need the same reviewer input packet and required evidence.
21
+ - Repeated lesson-sedimentation tasks need the same prompt, metadata, and audit trail.
22
+
23
+ Do not create a preset for a one-off task. Do not use a preset to hide vague requirements. If the task family is not repeatable yet, write a normal task first and extract the preset after the second or third repetition.
24
+
25
+ ## Design Questions
26
+
27
+ Before writing files, answer these in the task notes or your response:
28
+
29
+ 1. What family of tasks will this preset create?
30
+ 2. What task budget is required: `standard` or `complex`?
31
+ 3. What `task.kind` should downstream scanners see?
32
+ 4. What inputs must the user or agent provide as CLI flags?
33
+ 5. What metadata lines must appear in `task_plan.md`?
34
+ 6. What templates should be appended to task files?
35
+ 7. What evidence or audit files should be generated?
36
+ 8. What shared references should every preset-created task read first?
37
+ 9. What write scopes are strictly necessary?
38
+ 10. How will you prove a task created by this preset is recognized by `status --json` and `task-index --json`?
39
+
40
+ ## Package Layout
41
+
42
+ Use the bundled references before writing files:
43
+
44
+ - `references/complex-task-skeleton/`
45
+ - `references/preset-package-skeleton.md`
46
+
47
+ The complex task skeleton reference contains the base `brief.md`, `task_plan.md`, `execution_strategy.md`, `visual_map.md`, `findings.md`, `lesson_candidates.md`, `progress.md`, `review.md`, `references/INDEX.md`, and `artifacts/INDEX.md` contracts. The preset package skeleton contains a copyable package tree, a complete `preset.yaml`, starter Markdown resources, and the verification checklist. Keep this `SKILL.md` focused on method and judgment; use the references when the task has moved from design to file creation.
48
+
49
+ Use a simple package:
50
+
51
+ ```text
52
+ my-preset/
53
+ preset.yaml
54
+ templates/
55
+ task_plan.append.md
56
+ references/
57
+ upstream-contract.md
58
+ resources/
59
+ service-runbook.md
60
+ artifacts/
61
+ input-packet.md
62
+ ```
63
+
64
+ ## Required Manifest Sections
65
+
66
+ - `id`: lowercase letters, numbers, and hyphens.
67
+ - `version`: integer; increment when generated task behavior changes.
68
+ - `purpose`: one sentence explaining the repeatable method.
69
+ - `compatibleBudgets`: usually `[complex]` when the preset creates references or artifacts.
70
+ - `task.kind`: stable scanner-facing task kind.
71
+ - `entrypoints.newTask`: always declarative for task creation.
72
+ - `inputs`: CLI flags when the preset needs user-provided values.
73
+ - `templateValues`: values used by templates.
74
+ - `metadata`: first-class `Label: value` lines in `task_plan.md`.
75
+ - `resources.references`: shared task-local reference files, when tasks share context.
76
+ - `resources.artifacts`: preset-provided fixtures or input packets, when needed.
77
+ - `context.requiredReads`: reference IDs the agent must read before implementation.
78
+ - `evidence.bundleDir`: task-local directory for preset audit/evidence files, usually `artifacts/preset`.
79
+ - `evidence.files`: optional custom generated files inside the evidence bundle.
80
+ - `audit.manifestRequired`: must be `true`.
81
+ - `audit.evidenceFiles`: built-in audit files to generate, usually `preset-audit.json`, `preset-manifest.json`, and `write-scope.json`.
82
+ - `writeScopes`: narrow paths the preset may write.
83
+
84
+ ## Manifest Format
85
+
86
+ Use the Harness manifest subset only: nested mappings, scalar strings/numbers/booleans, and inline arrays such as `[standard, complex]`. Do not use block strings or dash-list YAML forms.
87
+
88
+ `templateValues` and `metadata` may use literal `value`, `default`, or dot-path `from` references such as `inputs.subject` or `task.title`. Do not use expressions or inline code.
89
+
90
+ Templates and resource index summaries can use `{{valueName}}` placeholders from `templateValues`.
91
+
92
+ Supported input types are `text`, `flag`, and `json-file`. Resource `index.type`, `usedBy`, and `producedBy` are labels for readers; use stable simple words such as `code`, `runbook`, `doc`, `fixture`, `preset`, `worker`, `reviewer`, and `coordinator`.
93
+
94
+ Every value in `entrypoints.newTask.writes` must exactly match one `writeScopes.*.path` entry. Do not rely on partial overlap.
95
+
96
+ ## Reference Bundle Pattern
97
+
98
+ Use `resources.references` when the preset should preload common context for a group of tasks.
99
+
100
+ ```yaml
101
+ resources:
102
+ references:
103
+ upstreamContract:
104
+ path: references/upstream-contract.md
105
+ template: templates/references/upstream-contract.md
106
+ index:
107
+ id: REF-001
108
+ type: code
109
+ summary: Shared upstream {{service}} contract for every task created by this preset.
110
+ usedBy: coordinator,worker,reviewer
111
+ serviceRunbook:
112
+ path: references/service-runbook.md
113
+ source: resources/service-runbook.md
114
+ index:
115
+ id: REF-002
116
+ type: runbook
117
+ summary: Local verification notes for the shared upstream service.
118
+ usedBy: worker
119
+ context:
120
+ requiredReads: [REF-001, REF-002]
121
+ ```
122
+
123
+ Use `template` for Markdown that needs substitution. Use `source` for static files copied from the preset package. The created task should read like this: `task_plan.md` tells the agent which `REF-*` entries to read, `references/INDEX.md` explains why each file matters, and the actual `references/*.md` files contain the context.
124
+
125
+ When `context.requiredReads` is set, Harness appends a `## Preset Required Reads` table to `task_plan.md`. Each row must resolve to the reference ID and exact `TARGET:<task-relative-reference-path>` that also appears in `references/INDEX.md`.
126
+
127
+ ## Artifact Bundle Pattern
128
+
129
+ Use `resources.artifacts` for preset-provided support material that is not a source reference:
130
+
131
+ ```yaml
132
+ resources:
133
+ artifacts:
134
+ inputPacket:
135
+ path: artifacts/input-packet.md
136
+ source: resources/artifacts/input-packet.md
137
+ index:
138
+ id: ART-001
139
+ type: fixture
140
+ summary: Shared fixture packet copied by the preset.
141
+ producedBy: preset
142
+ ```
143
+
144
+ Do not confuse artifacts with evidence. Artifacts can be input packets or fixtures. Evidence proves what happened, such as `preset-audit.json`, `preset-manifest.json`, command output, or verification results.
145
+
146
+ ## Safety Rules
147
+
148
+ - `writeScopes` must be as narrow as possible.
149
+ - Generated files must stay under the created task directory.
150
+ - A preset must not mutate source code, Git state, or global governance tables during `new-task`.
151
+ - Do not add JavaScript for `new-task` behavior.
152
+ - If behavior needs code, identify the missing reusable built-in processor and stop for design review.
153
+ - Reference bundles are task-local snapshots. Do not silently mutate historical tasks when a preset package changes.
154
+ - User-installed presets live in `~/.coding-agent-harness/presets/<preset-id>/`.
155
+
156
+ ## Creation Workflow
157
+
158
+ 1. Ask or infer the preset purpose, task family, target budget, task kind, required inputs, shared references, and evidence needs.
159
+ 2. For complex presets, open `references/complex-task-skeleton/README.md` and inspect the base task files the preset will overlay.
160
+ 3. Open `references/preset-package-skeleton.md` and copy only the files the preset actually needs.
161
+ 4. Create the preset directory with `preset.yaml`, templates, and resources.
162
+ 5. Keep task creation declarative: manifest inputs, `templateValues`, `metadata`, Markdown templates, `resources`, evidence declarations, and `writeScopes`.
163
+ 6. Run `harness preset check <path>`.
164
+ 7. Install with `harness preset install <path> --force` in a disposable or user-approved environment.
165
+ 8. Smoke test with `harness new-task <id> --budget <budget> --preset <preset-id> ... <target>`.
166
+ 9. For reference-bundle presets, create two different tasks from the same preset and verify both contain the same shared references but independent audit/evidence bundles.
167
+ 10. Run `harness status --json <target>`, `harness task-index --json <target>`, and `harness check --profile target-project <target>`.
168
+ 11. Inspect the generated `task_plan.md`, `references/INDEX.md`, and `artifacts/INDEX.md` manually before declaring success.
169
+
170
+ ## Quality Checklist
171
+
172
+ - The preset name describes a task method, not a single task.
173
+ - The generated task can be understood from files alone, without the original chat.
174
+ - `task_plan.md` contains enough context for the next agent to know what to read first.
175
+ - Every required read points to a real `REF-*` row.
176
+ - Every `REF-*` row explains why that reference matters.
177
+ - Every generated artifact has an `ART-*` row when artifacts are used.
178
+ - The preset passes `preset check`, task creation, `status --json`, `task-index --json`, and target check.
179
+ - A downstream agent can create a valid preset from this skill without editing Harness source.
@@ -0,0 +1,31 @@
1
+ # Complex Task Skeleton Reference
2
+
3
+ This folder is a standalone copy of the Harness complex task contract skeleton. Use it when designing a preset so the preset author can see the base files that `harness new-task --budget complex` creates before the preset overlay is applied.
4
+
5
+ ## Required Complex Task Files
6
+
7
+ | File | Purpose |
8
+ | --- | --- |
9
+ | `brief.md` | Human-readable task summary and current context packet. |
10
+ | `task_plan.md` | Goal, scope, budget, required files, acceptance criteria, and operating decisions. |
11
+ | `execution_strategy.md` | Operating model, allocation, conflict control, evidence strategy, and subagent decisions. |
12
+ | `visual_map.md` | Phase map, optional diagrams, completion state, evidence state, and blocking risk. |
13
+ | `findings.md` | Findings, research notes, and unresolved risks. |
14
+ | `lesson_candidates.md` | Task-local lesson candidate queue. |
15
+ | `progress.md` | Execution log, decisions, handoff, and residuals. |
16
+ | `review.md` | Agent review submission, adversarial review, evidence checked, and residual risk. |
17
+ | `references/INDEX.md` | Complex task source/reference index. |
18
+ | `artifacts/INDEX.md` | Complex task generated artifact/evidence index. |
19
+ | `long-running-task-contract.md` | Optional add-on when the task is explicitly long-running. |
20
+
21
+ ## How A Preset Uses This Skeleton
22
+
23
+ A preset should usually not replace these files. Harness creates the base task skeleton first. The preset then overlays method-specific content by:
24
+
25
+ - appending task-plan guidance with `entrypoints.newTask.templates.taskPlanAppend`;
26
+ - adding `metadata` lines that make scanner-visible context first-class;
27
+ - writing `resources.references` and `resources.artifacts` into the task-local folders;
28
+ - adding `context.requiredReads` so the next agent reads the right references before implementation;
29
+ - generating audit/evidence files under a task-local `artifacts/preset` bundle.
30
+
31
+ If a preset needs to change the structure of the complex task skeleton itself, do not hide that inside the preset. Update the Harness task templates or checker instead.
@@ -0,0 +1,12 @@
1
+ # Artifacts Index
2
+
3
+ Use this index for generated outputs that support the task but are not the source of truth.
4
+
5
+ | ID | Type | Path | Summary | Produced By |
6
+ | --- | --- | --- | --- | --- |
7
+ | [artifact-id] | command / diff / fixture / screenshot / review / report | TARGET:path or URL:https://example.com | [why it exists] | coordinator |
8
+
9
+ ## Retention Notes
10
+
11
+ - Keep artifacts that are needed to reproduce evidence or review decisions.
12
+ - Remove or ignore temporary artifacts once their result is captured in `progress.md`.
@@ -0,0 +1,43 @@
1
+ # {{TASK_TITLE}}
2
+
3
+ ## Brief
4
+
5
+ ## Task ID
6
+
7
+ `{{TASK_ID}}`
8
+
9
+ ## Created
10
+
11
+ {{DATE}}
12
+
13
+ ## Outcome
14
+
15
+ State the user-visible or project-visible result this task must deliver.
16
+
17
+ ## Boundaries
18
+
19
+ - In scope: files, behavior, documentation, or verification this task may change.
20
+ - Out of scope: work that must not be folded into this task.
21
+ - Stop conditions: uncertainty, risk, or missing access that requires coordinator or user review.
22
+
23
+ ## Execution Contract
24
+
25
+ - Owner: coordinator
26
+ - Lifecycle state: not_started
27
+ - Required files: `task_plan.md`, `execution_strategy.md`, `visual_map.md`, `progress.md`, `findings.md`, `review.md`
28
+ - Required closeout: verification evidence recorded in `progress.md`
29
+
30
+ ## First Next Step
31
+
32
+ Replace this line with the first concrete action before implementation starts.
33
+
34
+ ## Scaffold Provenance
35
+
36
+ | Field | Value |
37
+ | --- | --- |
38
+ | Created By | {{SCAFFOLD_CREATED_BY}} |
39
+ | Command Shape | {{SCAFFOLD_COMMAND}} |
40
+ | Created At | {{SCAFFOLD_CREATED_AT}} |
41
+ | Budget | {{SCAFFOLD_BUDGET}} |
42
+ | Template Source | {{SCAFFOLD_TEMPLATE_SOURCE}} |
43
+ | Exception Reason | {{SCAFFOLD_EXCEPTION_REASON}} |
@@ -0,0 +1,71 @@
1
+ # [Task Name] - Execution Strategy
2
+
3
+ ## Strategy Summary
4
+
5
+ [Describe the execution approach, including why this operating model fits the risk and scope.]
6
+
7
+ ## Subagent Authorization
8
+
9
+ Read this section at the start of the task and report the current authorization state before delegating.
10
+ This is an audit record, not an execution sandbox.
11
+
12
+ | Role | Status | Permission | Authorized By | Authorized At | Scope | Worktree / Branch | Reuse |
13
+ | --- | --- | --- | --- | --- | --- | --- | --- |
14
+ | reviewer subagent | allowed by default | read-only | harness task policy | task creation | current task review | n/a | allowed within this task |
15
+ | worker subagent | not authorized | write only after user approval | pending | pending | pending | pending | allowed only within approved task/scope |
16
+
17
+ ## Subagent Delegation Decision
18
+
19
+ At task start, the coordinator must make this decision from the user's goal, even if the user never mentions subagents.
20
+ Do not expect the user to know what a subagent or worker is. If delegation would help, explain the benefit in plain language and ask for permission once.
21
+ It is fine to say "subagent" or "worker" to the user; the important rule is that the agent must not wait for the user to ask for them.
22
+ If the task is clearly split into independent slices, decide `ask-user` before implementation. If exact file paths are still unknown, first identify the paths, then immediately ask for the independent execution helper authorization.
23
+
24
+ | Question | Decision | Reason | Next Action |
25
+ | --- | --- | --- | --- |
26
+ | Should a reviewer subagent be used? | yes / no | [why reviewer review helps or is unnecessary] | If yes, call a read-only reviewer without asking for extra permission. |
27
+ | Would a worker subagent materially help? | no / ask-user / already-authorized | [parallel slice, independent implementation, focused investigation, or not useful] | If ask-user, ask directly: "This task is suitable for a worker subagent. Do you authorize me to assign one worker subagent to modify only [scope] in [worktree/branch] while I coordinate and review the result?" |
28
+
29
+ ## User Authorization Decision
30
+
31
+ If the worker decision above is `ask-user`, implementation is blocked until this table records the user's answer.
32
+ Allowed resolved states are `authorized`, `denied`, or `not-needed`. Do not leave this as `pending` after choosing `ask-user`.
33
+
34
+ | Gate | State | Decided By | Decided At | Scope | Worktree / Branch | Notes |
35
+ | --- | --- | --- | --- | --- | --- | --- |
36
+ | worker subagent | pending | pending | pending | pending | pending | Fill only after directly asking the user. |
37
+
38
+ ## Operating Model
39
+
40
+ - Model: solo / team / split-repo / program / waterfall / kanban / module-parallel
41
+ - Primary executor: coordinator / worker / human
42
+ - Shared sync owner: coordinator
43
+ - Worktree required: yes / no
44
+ - Review required: yes / no
45
+
46
+ ## Work Allocation
47
+
48
+ | Role | Input Package | Write Scope | Handoff Required | Owner |
49
+ | --- | --- | --- | --- | --- |
50
+ | coordinator | task plan, strategy, roadmap | shared ledgers and integration | yes | [owner] |
51
+ | worker | assigned slice | assigned files only | yes | [owner] |
52
+
53
+ ## Coordination Rules
54
+
55
+ 1. Shared files are coordinator-owned unless a lock is explicitly assigned.
56
+ 2. Workers update only assigned files and route shared-table changes through handoff.
57
+ 3. Parallel work must use non-overlapping write scopes.
58
+ 4. Integration runs final checks after worker commits are merged or applied.
59
+
60
+ ## Verification Strategy
61
+
62
+ | Check | Command or Evidence | Required | Owner |
63
+ | --- | --- | --- | --- |
64
+ | Static check | [command or path] | yes / no | [owner] |
65
+ | Unit test | [command or path] | yes / no | [owner] |
66
+ | Integration or smoke | [command, URL, or log] | yes / no | [owner] |
67
+ | Review | `review.md` / verifier output / n/a | yes / no | [owner] |
68
+
69
+ ## Closeout Rule
70
+
71
+ Do not mark the task complete until required evidence is present, material findings are closed or accepted, and shared updates are either completed or assigned to the coordinator.
@@ -0,0 +1,24 @@
1
+ # [Task Name] - Findings
2
+
3
+ Use this file for defects, risks, unclear requirements, research notes, and review follow-up that may affect delivery.
4
+
5
+ ## Open Findings
6
+
7
+ | ID | Severity | Finding | Evidence | Owner | Required Action | Status |
8
+ | --- | --- | --- | --- | --- | --- | --- |
9
+
10
+ Do not keep sample findings. Add rows only for real findings discovered during the task.
11
+
12
+ ## Resolved Findings
13
+
14
+ | ID | Resolution | Evidence | Date |
15
+ | --- | --- | --- | --- |
16
+
17
+ Add rows only after a real finding is resolved or accepted with owner-routed risk.
18
+
19
+ ## Severity Guide
20
+
21
+ - P0: Blocks release or risks data loss, security exposure, or production outage.
22
+ - P1: Blocks the task goal or a required workflow.
23
+ - P2: Material quality, maintainability, or evidence gap.
24
+ - P3: Follow-up improvement that does not block closeout.
@@ -0,0 +1,70 @@
1
+ # {{TASK_TITLE}} - Lesson Candidates
2
+
3
+ This file is the task-local lesson candidate queue. Human review decides whether any candidate should stay task-local, be rejected, enter dry-run promotion, become a promoted lesson detail doc, or become a separate sedimentation task.
4
+
5
+ ## Candidate Status
6
+
7
+ | Field | Value |
8
+ | --- | --- |
9
+ | Schema version | lesson-candidate-v1 |
10
+ | Task-level status | pending-review |
11
+ | Review gate | candidate-file-present |
12
+ | Review decision | pending-human-review |
13
+ | Promotion state | not-promoted |
14
+ | Closeout token | pending |
15
+ | Source task | {{TASK_ID}} |
16
+ | Owner | coordinator |
17
+ | Last updated | {{DATE}} |
18
+
19
+ ## Schema
20
+
21
+ Allowed task-level status:
22
+
23
+ - `missing`: candidate file is absent.
24
+ - `pending-review`: candidate file exists, but human decision is not complete.
25
+ - `no-candidate-accepted`: human accepted the agent's no-candidate reason.
26
+ - `needs-promotion`: at least one candidate is queued for governance promotion.
27
+ - `promoted`: all accepted candidates were promoted to the agreed governance target.
28
+ - `rejected`: all candidates were rejected or archived with reasons.
29
+
30
+ Allowed row status:
31
+
32
+ - `ready-for-review`: agent believes this candidate may matter.
33
+ - `needs-promotion`: human marked the candidate worth preserving through dry-run promotion or a follow-up sedimentation task.
34
+ - `promoted`: maintenance CLI or an approved follow-up task promoted the candidate to the agreed governance target.
35
+ - `rejected`: human rejected the candidate with a reason.
36
+
37
+ Aggregation rule:
38
+
39
+ - Any `ready-for-review` row keeps task-level status `pending-review`.
40
+ - Any `needs-promotion` row sets task-level status `needs-promotion` unless another row is still `ready-for-review`.
41
+ - All rows `promoted` sets task-level status `promoted`.
42
+ - All rows `rejected` sets task-level status `rejected`.
43
+ - A no-candidate task must use task-level status `no-candidate-accepted` and fill `No-Candidate Reason`.
44
+
45
+ ## Candidates
46
+
47
+ | ID | Row Status | Title | Scope | Module Key | Detail Artifact | Boundary Reason | Why It Might Matter | Review Decision | Promotion Target | Conflict Check | Required Standard Update | Follow-up Task |
48
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
49
+
50
+ ## No-Candidate Reason
51
+
52
+ Not decided yet. Fill this only when review accepts that the task produced no reusable lesson candidate.
53
+
54
+ ## Promotion Notes
55
+
56
+ - If human review decides a candidate is worth preserving, mark the row `needs-promotion` and record the target governance location.
57
+ - If a candidate is marked `needs-promotion`, write the full task-local detail artifact while the source task context is fresh, then link it in `Detail Artifact`.
58
+ - Use `Scope` values `task`, `module`, or `global`; module-scoped candidates must fill `Module Key`.
59
+ - If human review rejects a candidate, mark the row `rejected` and keep the reason in the review decision.
60
+ - `needs-promotion` does not block task closeout, but it must remain visible in the maintenance queue and closeout record.
61
+ - Default promotion behavior is dry-run or follow-up-task first. Do not write a shared Lessons table; accepted candidates become promoted lesson detail docs.
62
+ - A sedimentation task must classify scope, check conflicts against existing lessons and standards, propose the target change, and report verification before applying.
63
+
64
+ ## Queue Routing
65
+
66
+ | Queue | When this task enters it | Exit condition |
67
+ | --- | --- | --- |
68
+ | Lessons | Any candidate is `ready-for-review` or `needs-promotion`. | Human rejects it, keeps it task-local, creates a sedimentation task, or approves promotion. |
69
+ | Missing Materials | The file is absent, has invalid status, or lacks a required no-candidate reason. | Agent repairs the candidate file. |
70
+ | Confirmed / Finalized | Human review is confirmed but a candidate still has deferred governance work. | Follow-up task or dry-run decision is recorded. |
@@ -0,0 +1,76 @@
1
+ # [Task Name] - Long-Running Task Contract
2
+
3
+ ## Goal
4
+
5
+ [State the single main problem this loop must close.]
6
+
7
+ ## Scope
8
+
9
+ ### In Scope
10
+
11
+ - [Allowed directories, modules, or capability surfaces]
12
+
13
+ ### Out of Scope
14
+
15
+ - [Items explicitly excluded from this loop]
16
+
17
+ ### Shared Files and Conflict Risk
18
+
19
+ - [Shared files that may conflict with other work, or none]
20
+
21
+ ## Primary Caller / Entry
22
+
23
+ - Primary caller: [CLI / local agent / UI / API / automation / integration / other]
24
+ - Entries this task must support: [list]
25
+ - Entries explicitly not required: [list]
26
+
27
+ ## Permission Boundaries
28
+
29
+ - Continuous execution allowed: yes / no
30
+ - Automatic review/fix/test loop allowed: yes / no
31
+ - Reviewer or subagent allowed: yes / no
32
+ - Must pause before: [high-risk actions]
33
+
34
+ ## Required Loop
35
+
36
+ 1. Re-read the goal, scope, and current findings.
37
+ 2. Choose the smallest complete fix for the current finding or phase.
38
+ 3. Implement within the allowed write scope.
39
+ 4. Run required verification.
40
+ 5. Update `progress.md` and `findings.md`.
41
+ 6. Run review when required and update `review.md`.
42
+ 7. Continue, stop, or pause based on the stop and pause conditions below.
43
+
44
+ ## Reviewer / Subagent Contract
45
+
46
+ - Reviewer scope: [files / modules / problem domain]
47
+ - Reviewer output: `review.md`
48
+ - Worker allowed to edit code: yes / no
49
+ - If a worker may edit, handoff must include worktree path, branch, commit SHA, checks, files changed, and residual risks.
50
+
51
+ ## Evidence
52
+
53
+ - [ ] Static checks: [command]
54
+ - [ ] Unit tests: [command]
55
+ - [ ] Integration or smoke tests: [command]
56
+ - [ ] Runtime verification: [URL / command / log]
57
+ - [ ] Review report: `review.md` / n/a
58
+ - [ ] Residual risks recorded: yes / no
59
+ - [ ] Lesson candidate review recorded: `lesson_candidates.md` uses `no-candidate-accepted`, `needs-promotion`, `promoted`, or `rejected`
60
+
61
+ ## Stop Conditions
62
+
63
+ - [ ] Goal is met.
64
+ - [ ] Scope was not exceeded.
65
+ - [ ] Required tests and regression gates pass or have documented waivers.
66
+ - [ ] Runtime, console, and request errors are clear or classified as accepted-risk with owner rationale.
67
+ - [ ] Review has no open P0/P1 material findings.
68
+ - [ ] Residual risks are routed to an owner and do not block the goal.
69
+
70
+ ## Pause Conditions
71
+
72
+ - [ ] Goal or scope becomes invalid.
73
+ - [ ] High-risk product, architecture, security, or data decision is required.
74
+ - [ ] Unknown uncommitted changes conflict with this work.
75
+ - [ ] Environment, permission, quota, or external dependency blocks progress.
76
+ - [ ] Reviewer finding changes task direction.