repo-harness 0.19.4 → 0.20.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 (403) hide show
  1. package/AGENTS.md +55 -118
  2. package/CLAUDE.md +54 -118
  3. package/README.es.md +40 -66
  4. package/README.fr.md +39 -65
  5. package/README.ja.md +40 -64
  6. package/README.md +100 -80
  7. package/README.zh-CN.md +41 -58
  8. package/SKILL.md +19 -23
  9. package/agents/fleet/explorer.md +2 -2
  10. package/agents/fleet/fast-worker.md +3 -3
  11. package/agents/fleet/gatekeeper.md +13 -10
  12. package/agents/fleet/harness-evaluator.md +2 -2
  13. package/agents/fleet/root-cause-prover.md +17 -11
  14. package/assets/AGENTS.md +0 -54
  15. package/assets/CLAUDE.md +0 -54
  16. package/assets/herdr/webhook-notify/herdr-plugin.toml +10 -0
  17. package/assets/herdr/webhook-notify/notify.mjs +103 -0
  18. package/assets/hooks/AGENTS.md +1 -39
  19. package/assets/hooks/CLAUDE.md +1 -39
  20. package/assets/hooks/lib/workflow-state.sh +22 -340
  21. package/assets/partials/03-philosophy.partial.md +1 -1
  22. package/assets/partials/04-project-structure.partial.md +1 -1
  23. package/assets/partials/05-workflow.partial.md +5 -6
  24. package/assets/partials/07-footer.partial.md +2 -2
  25. package/assets/partials/08-orchestration.partial.md +14 -16
  26. package/assets/partials-agents/02-operating-mode.partial.md +5 -6
  27. package/assets/partials-agents/03-orchestration.partial.md +11 -10
  28. package/assets/partials-agents/04-task-protocol.partial.md +11 -12
  29. package/assets/partials-agents/06-quality-safety.partial.md +3 -3
  30. package/assets/partials-agents/08-deep-docs.partial.md +1 -1
  31. package/assets/pipeline-record.v2.schema.json +1216 -0
  32. package/assets/reference-configs/agentic-development-flow.md +19 -115
  33. package/assets/reference-configs/evaluator-rubric.md +1 -1
  34. package/assets/reference-configs/external-tooling.md +108 -32
  35. package/assets/reference-configs/global-working-rules.md +4 -1
  36. package/assets/reference-configs/handoff-protocol.md +6 -36
  37. package/assets/reference-configs/harness-overview.md +18 -15
  38. package/assets/reference-configs/heartbeat-triage.md +1 -1
  39. package/assets/reference-configs/herdr-notify.md +119 -0
  40. package/assets/reference-configs/hook-operations.md +3 -4
  41. package/assets/reference-configs/host-invariants.md +72 -0
  42. package/assets/reference-configs/minimal-change-hooks.md +10 -6
  43. package/assets/reference-configs/sprint-contracts.md +19 -503
  44. package/assets/skill-commands/manifest.json +270 -104
  45. package/assets/skill-commands/repo-harness-architecture/SKILL.md +10 -87
  46. package/assets/skill-commands/repo-harness-architecture/references/worker.md +86 -0
  47. package/assets/skill-commands/repo-harness-check/SKILL.md +20 -36
  48. package/assets/skill-commands/repo-harness-check/references/create.md +17 -0
  49. package/assets/skill-commands/repo-harness-check/references/review.md +13 -0
  50. package/assets/skill-commands/repo-harness-ship/SKILL.md +14 -30
  51. package/assets/skill-commands/repo-harness-ship/agents/openai.yaml +2 -0
  52. package/assets/skill-commands/repo-harness-ship/references/worker.md +17 -0
  53. package/assets/skill-version.json +6 -2
  54. package/assets/skills/obsidian-memory/SKILL.md +19 -86
  55. package/assets/skills/obsidian-memory/agents/openai.yaml +2 -0
  56. package/assets/skills/obsidian-memory/references/worker.md +44 -0
  57. package/assets/skills/repo-harness-chatgpt/SKILL.md +3 -6
  58. package/assets/skills/repo-harness-chatgpt/references/bridge.md +12 -13
  59. package/assets/skills/repo-harness-chatgpt/references/continue.md +1 -1
  60. package/assets/skills/repo-harness-cross-review/SKILL.md +16 -26
  61. package/assets/skills/repo-harness-cross-review/references/codex-mode.md +15 -37
  62. package/assets/skills/repo-harness-cross-review/references/generic-review.md +93 -0
  63. package/assets/skills/repo-harness-product/SKILL.md +10 -17
  64. package/assets/skills/repo-harness-product/references/prd.md +2 -2
  65. package/assets/skills/repo-harness-product/references/sprint.md +5 -5
  66. package/assets/skills/repo-harness-setup/SKILL.md +7 -6
  67. package/assets/skills/repo-harness-setup/references/init.md +1 -1
  68. package/assets/skills/repo-harness-test/SKILL.md +11 -20
  69. package/assets/skills/repo-harness-test/references/authoring.md +10 -24
  70. package/assets/skills/repo-harness-test/references/running.md +9 -9
  71. package/assets/templates/contract.template.md +4 -5
  72. package/assets/templates/helpers/acceptance-receipt.ts +308 -207
  73. package/assets/templates/helpers/architecture-event.ts +3 -3
  74. package/assets/templates/helpers/architecture-queue.sh +1 -1
  75. package/assets/templates/helpers/archive-workflow.sh +63 -29
  76. package/assets/templates/helpers/capability-config.ts +0 -32
  77. package/assets/templates/helpers/capture-plan.sh +23 -481
  78. package/assets/templates/helpers/check-agent-tooling.sh +1 -156
  79. package/assets/templates/helpers/check-task-sync.sh +16 -385
  80. package/assets/templates/helpers/check-task-workflow.sh +19 -1427
  81. package/assets/templates/helpers/classify-historical-plans.ts +2 -2
  82. package/assets/templates/helpers/contract-run.ts +23 -162
  83. package/assets/templates/helpers/contract-worktree-runtime.ts +20 -0
  84. package/assets/templates/helpers/contract-worktree.sh +96 -387
  85. package/assets/templates/helpers/ensure-task-workflow.sh +8 -1443
  86. package/assets/templates/helpers/harness-trace-grade.sh +1 -1
  87. package/assets/templates/helpers/heartbeat-triage.sh +3 -3
  88. package/assets/templates/helpers/install-agent-fleet.sh +19 -142
  89. package/assets/templates/helpers/merge-gate.ts +76 -387
  90. package/assets/templates/helpers/new-plan.sh +2 -6
  91. package/assets/templates/helpers/plan-to-todo.sh +15 -986
  92. package/assets/templates/helpers/prepare-handoff.sh +0 -2
  93. package/assets/templates/helpers/recovery-view-cli.ts +2 -7
  94. package/assets/templates/helpers/refresh-current-status.sh +9 -13
  95. package/assets/templates/helpers/ship-worktrees.sh +173 -200
  96. package/assets/templates/helpers/sprint-backlog.sh +87 -158
  97. package/assets/templates/helpers/verification-plan.ts +1 -1
  98. package/assets/templates/helpers/verify-contract.sh +35 -1288
  99. package/assets/templates/helpers/verify-sprint.sh +28 -1518
  100. package/assets/templates/helpers/workflow-contract.ts +1 -1
  101. package/assets/templates/helpers/workstream-sync.sh +1 -16
  102. package/assets/templates/implementation-notes.template.md +1 -1
  103. package/assets/templates/plan.template.md +2 -6
  104. package/assets/templates/review.template.md +1 -1
  105. package/assets/templates/runtime.gitignore +1 -1
  106. package/assets/workflow-contract.v1.json +1977 -19
  107. package/dist/hook-entry.js +15047 -15890
  108. package/dist/oar-review-host.js +322 -0
  109. package/dist/operator-ui/assets/index-DfN4Jl7j.js +9 -0
  110. package/dist/operator-ui/assets/{index-BtBBFakS.css → index-DgLzv92A.css} +1 -1
  111. package/dist/operator-ui/index.html +2 -2
  112. package/docs/repo-harness-chatgpt-browser-engine.md +0 -4
  113. package/package.json +25 -21
  114. package/references/handoff.md +3 -2
  115. package/references/workflow-packaging-rubric.md +3 -6
  116. package/scripts/AGENTS.md +1 -47
  117. package/scripts/CLAUDE.md +1 -47
  118. package/scripts/acceptance-receipt.ts +308 -207
  119. package/scripts/architecture-event.ts +3 -3
  120. package/scripts/architecture-queue.sh +1 -1
  121. package/scripts/archive-workflow.sh +63 -29
  122. package/scripts/assemble-template.ts +1 -27
  123. package/scripts/axr5-archctx-clean-room.ts +1 -1
  124. package/scripts/capability-config.ts +0 -32
  125. package/scripts/capture-plan.sh +23 -481
  126. package/scripts/check-agent-tooling.sh +1 -156
  127. package/scripts/check-ci.sh +42 -20
  128. package/scripts/check-npm-release.sh +1 -1
  129. package/scripts/check-tarball-install-smoke.sh +16 -2
  130. package/scripts/check-task-sync.sh +16 -385
  131. package/scripts/check-task-workflow.sh +19 -1427
  132. package/scripts/ci-documentation-consumers.ts +4 -10
  133. package/scripts/classify-historical-plans.ts +2 -2
  134. package/scripts/contract-run.ts +23 -162
  135. package/scripts/contract-worktree-runtime.ts +20 -0
  136. package/scripts/contract-worktree.sh +96 -387
  137. package/scripts/create-project-dirs.sh +0 -1
  138. package/scripts/ensure-task-workflow.sh +8 -1443
  139. package/scripts/harness-trace-grade.sh +1 -1
  140. package/scripts/heartbeat-triage.sh +3 -3
  141. package/scripts/init-project.sh +0 -22
  142. package/scripts/initializer-question-pack.ts +3 -25
  143. package/scripts/install-agent-fleet.sh +19 -142
  144. package/scripts/lib/ci-run-tests.sh +78 -10
  145. package/scripts/lib/project-init-lib.sh +21 -31
  146. package/scripts/lib/test-home-isolation.d.mts +7 -0
  147. package/scripts/lib/test-home-isolation.mjs +105 -0
  148. package/scripts/me2b-runtime-admission-canary.ts +6 -4
  149. package/scripts/merge-gate.ts +76 -387
  150. package/scripts/new-plan.sh +2 -6
  151. package/scripts/plan-to-todo.sh +15 -986
  152. package/scripts/prepare-handoff.sh +0 -2
  153. package/scripts/recovery-view-cli.ts +2 -7
  154. package/scripts/refresh-current-status.sh +9 -13
  155. package/scripts/report-ci.ts +242 -0
  156. package/scripts/run-harness-profile-benchmark.ts +5 -3
  157. package/scripts/run-skill-evals.ts +46 -98
  158. package/scripts/run-skill-routing-eval.ts +7 -7
  159. package/scripts/select-ci-coverage.ts +121 -53
  160. package/scripts/select-test-suite.ts +49 -0
  161. package/scripts/ship-worktrees.sh +173 -200
  162. package/scripts/skill-surface-select.ts +19 -2
  163. package/scripts/sprint-backlog.sh +87 -158
  164. package/scripts/sync-codex-installed-copies.sh +44 -40
  165. package/scripts/test-file-durations.json +398 -0
  166. package/scripts/verification-plan.ts +1 -1
  167. package/scripts/verify-contract.sh +35 -1288
  168. package/scripts/verify-sprint.sh +28 -1518
  169. package/scripts/workflow-contract.ts +1 -1
  170. package/scripts/workstream-sync.sh +1 -16
  171. package/src/cli/commands/automation.ts +7 -7
  172. package/src/cli/commands/engineer.ts +15 -11
  173. package/src/cli/commands/fleet.ts +0 -2
  174. package/src/cli/commands/global-runtime.ts +65 -11
  175. package/src/cli/commands/herdr.ts +200 -0
  176. package/src/cli/commands/init-hook.ts +7 -0
  177. package/src/cli/commands/init.ts +4 -80
  178. package/src/cli/commands/mcp.ts +7 -7
  179. package/src/cli/commands/pipeline.ts +45 -0
  180. package/src/cli/commands/prompt-guard-decision.ts +1 -1
  181. package/src/cli/commands/publication.ts +0 -5
  182. package/src/cli/commands/refactor.ts +1 -1
  183. package/src/cli/commands/review.ts +43 -0
  184. package/src/cli/commands/run.ts +2 -2
  185. package/src/cli/commands/state.ts +9 -25
  186. package/src/cli/commands/task-agent.ts +59 -0
  187. package/src/cli/commands/upgrade.ts +421 -0
  188. package/src/cli/commands/validators.ts +1 -17
  189. package/src/cli/hook/circuit-breaker.ts +3 -3
  190. package/src/cli/hook/command-observed.ts +2 -2
  191. package/src/cli/hook/event-telemetry.ts +79 -5
  192. package/src/cli/hook/mutation-guard.ts +16 -470
  193. package/src/cli/hook/mutation-observed.ts +25 -242
  194. package/src/cli/hook/prompt-guard-decision.ts +1 -0
  195. package/src/cli/hook/prompt-handler.ts +25 -764
  196. package/src/cli/hook/prompt-intents.ts +2 -2
  197. package/src/cli/hook/session-context.ts +0 -3
  198. package/src/cli/hook/stop-handler.ts +44 -433
  199. package/src/cli/hook/subagent-handler.ts +25 -35
  200. package/src/cli/index.ts +38 -148
  201. package/src/cli/installer/install-profile.ts +160 -13
  202. package/src/cli/installer/shared.ts +7 -3
  203. package/src/cli/mcp/coding-workspaces.ts +26 -3
  204. package/src/cli/mcp/engineer-tools.ts +16 -3
  205. package/src/cli/mcp/fleet-tools.ts +0 -2
  206. package/src/cli/mcp/instructions.ts +2 -2
  207. package/src/cli/mcp/policy.ts +8 -11
  208. package/src/cli/mcp/server.ts +0 -2
  209. package/src/cli/mcp/setup.ts +37 -18
  210. package/src/cli/mcp/tools.ts +93 -59
  211. package/src/core/adoption/managed-hook-config.ts +7 -2
  212. package/src/core/adoption/standard-plan.ts +39 -127
  213. package/src/core/architecture/projection.ts +3 -3
  214. package/src/core/automation/budget.ts +35 -472
  215. package/src/core/automation/projection.ts +3 -17
  216. package/src/core/engineers/AGENTS.md +1 -43
  217. package/src/core/engineers/CLAUDE.md +1 -43
  218. package/src/core/engineers/agent-runtime-effect.ts +2 -2
  219. package/src/core/engineers/principal-claim.ts +2 -2
  220. package/src/core/evidence/checkpoint.ts +4 -4
  221. package/src/core/evidence/redaction.ts +16 -2
  222. package/src/core/evidence/verification-plan.ts +4 -1
  223. package/src/core/operator/automation-summary.ts +4 -19
  224. package/src/core/operator/notify-status.ts +57 -0
  225. package/src/core/pipeline/board.ts +43 -0
  226. package/src/core/pipeline/gates.ts +27 -0
  227. package/src/core/pipeline/projection.ts +63 -0
  228. package/src/core/pipeline/stage-machine.ts +46 -0
  229. package/src/core/pipeline/types.ts +108 -0
  230. package/src/core/publication/merge-readiness.ts +50 -53
  231. package/src/core/publication/publication-lifecycle.ts +3 -3
  232. package/src/core/publication/publication-receipt.ts +30 -29
  233. package/src/core/refactor/policy.ts +1 -1
  234. package/src/core/review/change-assessment.ts +1 -1
  235. package/src/core/review/generic-review.ts +52 -0
  236. package/src/core/skill-surface/catalog.ts +35 -1
  237. package/src/core/state/artifact-parsers.ts +14 -2
  238. package/src/core/state/project-continuation-envelope.ts +0 -11
  239. package/src/core/state/project-effective-state.ts +29 -104
  240. package/src/core/state/types.ts +2 -2
  241. package/src/core/upgrade/legacy-inventory.ts +578 -0
  242. package/src/core/workflow/artifact-requirement-policy.ts +14 -71
  243. package/src/core/workflow/operation-readiness.ts +6 -46
  244. package/src/core/workflow/profile.ts +19 -29
  245. package/src/effects/architecture/archctx-provider.ts +44 -2
  246. package/src/effects/architecture/refresh-consumer.ts +5 -58
  247. package/src/effects/automation/budget-store.ts +31 -1124
  248. package/src/effects/automation/clock.ts +1 -1
  249. package/src/effects/automation/grant-store.ts +31 -20
  250. package/src/effects/collaboration/handoff-store.ts +3 -3
  251. package/src/effects/collaboration/signal-store.ts +3 -3
  252. package/src/effects/engineers/agent-runtime-effect-store.ts +2 -86
  253. package/src/effects/engineers/agent-runtime-feature.ts +3 -6
  254. package/src/effects/engineers/dependency-authority.ts +4 -4
  255. package/src/effects/engineers/principal.ts +1 -1
  256. package/src/effects/engineers/scheduling-acquire-next.ts +417 -106
  257. package/src/effects/engineers/task-freeze-store.ts +23 -31
  258. package/src/effects/evidence/attested-import.ts +7 -6
  259. package/src/effects/evidence/post-bash-importer.ts +6 -5
  260. package/src/effects/evidence/recovery-materializer.ts +4 -9
  261. package/src/effects/evidence/verification-execution.ts +129 -30
  262. package/src/effects/expensive-run-lock.ts +101 -5
  263. package/src/effects/fleet/acquire.ts +12 -50
  264. package/src/effects/fs-transaction.ts +1 -1
  265. package/src/effects/locking/exclusive-directory-lock.ts +24 -14
  266. package/src/effects/operator/automation-summary.ts +4 -55
  267. package/src/effects/operator/notify-status.ts +153 -0
  268. package/src/effects/operator/pipeline-status.ts +18 -0
  269. package/src/effects/operator/server.ts +43 -620
  270. package/src/effects/pipeline/authority.ts +140 -0
  271. package/src/effects/pipeline/ingest.ts +82 -0
  272. package/src/effects/pipeline/ledger.ts +177 -0
  273. package/src/effects/pipeline/read.ts +40 -0
  274. package/src/effects/pipeline/store.ts +187 -0
  275. package/src/effects/process-supervisor.ts +27 -16
  276. package/src/effects/publication/feedback.ts +15 -18
  277. package/src/effects/publication/merge-readiness.ts +192 -211
  278. package/src/effects/publication/publication-lifecycle.ts +72 -78
  279. package/src/effects/publication/publication-receipt.ts +61 -35
  280. package/src/effects/review/change-assessment.ts +2 -2
  281. package/src/effects/review/generic-review.ts +343 -0
  282. package/src/effects/review/oar-review-host.ts +183 -0
  283. package/src/effects/review/review-isolation.ts +177 -0
  284. package/src/effects/run-summary-retention.ts +2 -2
  285. package/src/effects/runtime/helper-runner.ts +3 -1
  286. package/src/effects/skill-tree-integrity.ts +54 -1
  287. package/src/effects/state/resolve-effective-state.ts +85 -27
  288. package/src/effects/terminal/herdr.ts +42 -5
  289. package/src/effects/terminal/task-role-profiles.ts +115 -0
  290. package/src/effects/terminal/task-session.ts +863 -0
  291. package/src/effects/terminal/task-worktree.ts +25 -0
  292. package/src/operator-web/App.tsx +16 -574
  293. package/src/operator-web/AutomationSummary.tsx +0 -21
  294. package/src/operator-web/NotifyStatus.tsx +72 -0
  295. package/src/operator-web/PipelineBoard.tsx +357 -0
  296. package/src/operator-web/fixture.ts +1 -8
  297. package/src/operator-web/i18n.ts +276 -20
  298. package/src/operator-web/styles.css +26 -29
  299. package/src/operator-web/types.ts +2 -1
  300. package/assets/initializer-question-pack.v1.json +0 -132
  301. package/assets/initializer-question-pack.v1.schema.json +0 -46
  302. package/assets/initializer-question-pack.v2.json +0 -174
  303. package/assets/initializer-question-pack.v3.json +0 -206
  304. package/assets/initializer-question-pack.v3.schema.json +0 -92
  305. package/assets/skill-hooks.json +0 -41
  306. package/assets/skills/auto-campaign/SKILL.md +0 -75
  307. package/assets/skills/auto-campaign/references/execution.md +0 -93
  308. package/assets/skills/auto-campaign/references/standard.json +0 -36
  309. package/assets/skills/auto-campaign/scripts/prepare-grant.ts +0 -39
  310. package/assets/skills/claude-plan/SKILL.md +0 -271
  311. package/assets/skills/repo-harness-chatgpt/references/campaign-issues.md +0 -24
  312. package/assets/skills/repo-harness-cross-review/references/claude-mode.md +0 -56
  313. package/assets/skills/repo-harness-cross-review/references/codex-plugin-mode.md +0 -55
  314. package/assets/skills/repo-harness-plan/SKILL.md +0 -26
  315. package/assets/skills/repo-harness-plan/references/create.md +0 -35
  316. package/assets/skills/repo-harness-plan/references/review.md +0 -30
  317. package/assets/templates/helpers/context-contract-sync.sh +0 -540
  318. package/dist/operator-ui/assets/index-f7BlYVSB.js +0 -9
  319. package/scripts/akn00-native-execution-admission.ts +0 -196
  320. package/scripts/axr6-stop-host-cycle.ts +0 -331
  321. package/scripts/axr7-build-flow-repair-proposal.ts +0 -44
  322. package/scripts/axr7-build-model-proposal.ts +0 -150
  323. package/scripts/axr7-build-selector-repair-proposal.ts +0 -50
  324. package/scripts/axr7-consumer-e2e.ts +0 -334
  325. package/scripts/benchmark-general-repo-reader.ts +0 -259
  326. package/scripts/build-campaign-image.sh +0 -15
  327. package/scripts/c9-collaboration-canary.ts +0 -683
  328. package/scripts/canary-global-hook.sh +0 -263
  329. package/scripts/cleanup-campaign-container.ts +0 -13
  330. package/scripts/context-contract-sync.sh +0 -540
  331. package/scripts/emit-verify-evidence.ts +0 -159
  332. package/scripts/hook-dispatch-diet-report.ts +0 -480
  333. package/scripts/lib/AGENTS.md +0 -13
  334. package/scripts/lib/CLAUDE.md +0 -13
  335. package/scripts/loop-engine-cutover-gate.ts +0 -324
  336. package/scripts/mcp-observability-report.ts +0 -460
  337. package/scripts/route-nl-vs-ts-eval.ts +0 -1098
  338. package/scripts/run-bdd2-evals.ts +0 -1368
  339. package/scripts/run-campaign-preflight.ts +0 -38
  340. package/scripts/run-debug-ground-truth-eval.ts +0 -633
  341. package/scripts/run-skill-hook.ts +0 -259
  342. package/scripts/session-context-packet-panel.ts +0 -560
  343. package/scripts/setup-plugins.sh +0 -43
  344. package/src/cli/commands/campaign.ts +0 -387
  345. package/src/cli/commands/claude-review.ts +0 -44
  346. package/src/cli/commands/cross-review.ts +0 -185
  347. package/src/cli/hook/legacy-active-plan-migration.ts +0 -88
  348. package/src/core/adoption/workflow-contract-plan.ts +0 -31
  349. package/src/core/automation/campaign-authoring-budget.ts +0 -154
  350. package/src/core/automation/campaign-browser-session.ts +0 -118
  351. package/src/core/automation/campaign-closeout.ts +0 -138
  352. package/src/core/automation/campaign-containment.ts +0 -161
  353. package/src/core/automation/campaign-fresh-audit.ts +0 -223
  354. package/src/core/automation/campaign-planning.ts +0 -98
  355. package/src/core/automation/campaign-revision-evidence.ts +0 -140
  356. package/src/core/automation/campaign-revision-observation.ts +0 -80
  357. package/src/core/automation/campaign-runtime.ts +0 -97
  358. package/src/core/automation/connector-challenge.ts +0 -74
  359. package/src/core/automation/development-campaign.ts +0 -211
  360. package/src/core/automation/issue-batch-adoption.ts +0 -107
  361. package/src/core/automation/issue-batch-reconcile.ts +0 -251
  362. package/src/core/automation/issue-batch.ts +0 -222
  363. package/src/core/review/claude-review.ts +0 -105
  364. package/src/core/review/cross-review.ts +0 -212
  365. package/src/core/state/artifact-repair.ts +0 -40
  366. package/src/effects/automation/campaign-acquisition.ts +0 -147
  367. package/src/effects/automation/campaign-authoring-resume.ts +0 -299
  368. package/src/effects/automation/campaign-capability-registry.ts +0 -39
  369. package/src/effects/automation/campaign-capacity.ts +0 -55
  370. package/src/effects/automation/campaign-closeout-provider.ts +0 -216
  371. package/src/effects/automation/campaign-closeout.ts +0 -197
  372. package/src/effects/automation/campaign-container.ts +0 -362
  373. package/src/effects/automation/campaign-fresh-audit.ts +0 -385
  374. package/src/effects/automation/campaign-not-planned.ts +0 -100
  375. package/src/effects/automation/campaign-planning-proof.ts +0 -163
  376. package/src/effects/automation/campaign-planning-store.ts +0 -84
  377. package/src/effects/automation/campaign-planning.ts +0 -178
  378. package/src/effects/automation/campaign-protection.ts +0 -37
  379. package/src/effects/automation/campaign-provider-execution.ts +0 -48
  380. package/src/effects/automation/campaign-recovery.ts +0 -230
  381. package/src/effects/automation/campaign-revision-admission.ts +0 -53
  382. package/src/effects/automation/campaign-revision-observation.ts +0 -116
  383. package/src/effects/automation/campaign-runtime.ts +0 -195
  384. package/src/effects/automation/campaign-step.ts +0 -584
  385. package/src/effects/automation/campaign-worker.ts +0 -535
  386. package/src/effects/automation/development-campaign-policy.ts +0 -121
  387. package/src/effects/automation/development-campaign-store.ts +0 -427
  388. package/src/effects/automation/gpt-pro-issue-authoring.ts +0 -362
  389. package/src/effects/automation/issue-batch-adoption.ts +0 -308
  390. package/src/effects/automation/issue-batch-observer.ts +0 -191
  391. package/src/effects/automation/issue-batch-publication.ts +0 -133
  392. package/src/effects/automation/issue-batch-shadow-adoption.ts +0 -77
  393. package/src/effects/automation/issue-batch-store.ts +0 -249
  394. package/src/effects/engineers/agent-runtime-adapters/codex-app-thread.ts +0 -21
  395. package/src/effects/evidence/checks-materializer.ts +0 -287
  396. package/src/effects/evidence/verify-producer.ts +0 -361
  397. package/src/effects/fleet/task-message-request.ts +0 -230
  398. package/src/effects/operator/task-message-process.ts +0 -56
  399. package/src/effects/review/claude-review-host.ts +0 -165
  400. package/src/effects/review/claude-review-session.ts +0 -423
  401. package/src/effects/review/codex-plugin-provider.ts +0 -406
  402. package/src/effects/review/cross-review-runner.ts +0 -386
  403. package/src/effects/state/artifact-repair-store.ts +0 -46
package/AGENTS.md CHANGED
@@ -1,120 +1,57 @@
1
- # repo-harness AGENTS.md
2
-
3
- This repository self-hosts the `repo-harness` contract; the former `repo-harness-skill` and `project-initializer` names have been fully removed and are no longer recognized by any tooling. Claude and Codex should follow the same repo-local workflow surface.
4
-
5
- ## Canonical Workflow Files
6
-
7
- - `tasks/current.md` for the ignored local current-status read model derived from workflow artifacts
8
- - `tasks/todos.md` for deferred medium/long-term goals, not active execution checklists
9
- - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `repo-harness run sprint-backlog`; task contracts stay the execution slices
10
- - `.archcontext/model/nodes/*.yaml` for the capability nodes and longest-prefix context boundaries, selected by `.ai/harness/policy.json#context.capability_source`
11
- - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
12
- - `tasks/lessons.md` for correction-derived rules
13
- - `docs/researches/` for deep repo knowledge
14
- - `tasks/notes/` for task-local implementation decisions, deviations, tradeoffs, and open questions
15
- - `plans/` for timestamped plans, with `plans/archive/` for history
16
- - `.ai/harness/workflow-contract.json` for the installed workflow contract manifest
17
- - `.ai/harness/policy.json` for the machine-readable workflow contract
18
- - `.ai/context/context-map.json` for progressive context loading
19
- - `docs/architecture/index.md` for umbrella architecture status, drift requests, snapshots, and diagram links
20
- - `docs/reference-configs/agentic-development-flow.md` for parent-agent/Waza routing and P1/P2/P3 rules
21
-
22
- ## Operating Rules
23
-
24
- - Sync `tasks/` whenever substantive repo changes are made.
25
- - Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
26
- - Treat hook execution as typed and user-level: `~/.claude/settings.json` and `~/.codex/hooks.json` invoke `repo-harness-hook`, whose route registry selects exactly one in-process handler. `.ai/hooks/lib/workflow-state.sh` is an operator-helper library, never a host-event dispatcher.
27
- - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todos.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
28
- - Treat `.archcontext/model/nodes/*.yaml` as the source of truth for capability prefixes under `capability_source: "archcontext"`; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
29
- - Keep architecture drift handling split: `architecture-queue.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
30
- - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
31
- - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
32
- - Treat Codex auto-compact as a fallback only; use `.ai/harness/handoff/current.md` and `.ai/harness/handoff/resume.md` for long-task rollover.
33
- - Treat `.ai/harness/checks/*.latest.{json,md}` and `.ai/harness/runs/` as ignored runtime evidence cache; commit durable conclusions in `tasks/reviews/`, `tasks/contracts/`, `tasks/notes/`, or `docs/researches/` instead.
34
- - Treat architecture/spec/research docs as the human reading entrypoint. Before closing a workflow, promote durable conclusions into `docs/architecture/`, `docs/researches/`, `docs/spec.md`, or `tasks/lessons.md`; then archive fulfilled plan/contract/review/notes/todo artifacts so root workflow surfaces represent active work only. When a brain root is configured, a durable conclusion worth reusing across projects may additionally be projected into the vault through an explicit `obsidian-memory` persist call; the vault layer is optional and never a prerequisite for closing a workflow. `.rgignore` hides archived workflow artifacts and runtime evidence from default `rg` searches; use explicit paths or `rg -uu` for audits.
35
- - Treat `_ref/` as an occasional ignored external reference checkout cache, not a commit surface or daily workflow. Agents may read or refresh it for comparison; when it influences a decision, cite the source repo plus commit/tag and path in `tasks/notes/` or `docs/researches/`.
36
- - Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files, and env examples; follow `.ai/harness/policy.json#operations.deploy_sql` for configured SQL roots and naming modes, otherwise keep SQL directly under `deploy/sql/` with 4-digit ascending prefixes.
37
- - Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
38
- - Treat contract-level task execution as worktree-first: `repo-harness run plan-to-todo --plan <approved-plan>` starts `repo-harness run contract-worktree start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `repo-harness run contract-worktree finish`.
39
- - Treat the EXECUTION_BOUNDARY anti-extras clause as mandatory exactly once in each delegated runner's final rendered task packet: absent requirements are forbidden design space, not permission to improve, and unrequested extras fail closed. Each runner path names one injection owner and no other surface on that path may carry the clause — the Codex native-child path is owned by `SubagentStart.context` (contract- and writability-aware; generated personas and the delegation advisor carry none), the standalone contract worker path by its worker prompt, and the MCP path by the `codex-goal` document. Composed-path tests verify the count.
40
- - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `repo-harness run capture-plan --artifact-level work-package --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute --promotion-reason <merge_boundary|rollback_boundary|verification_boundary|risk_boundary|human_decision_boundary|worktree_boundary>` or run `repo-harness run plan-to-todo --plan <active-plan>`.
41
- - Promote work into a top-level `plans/plan-*.md` only when `Artifact Level: work-package` is justified by a merge/PR unit, rollback surface, independent verification boundary, review/acceptance boundary, high-risk surface, or otherwise cannot remain a checklist item in the current active plan or sprint backlog. Inline sprint rows and checklist rows stay in the sprint backlog or active plan `## Task Breakdown`; contract rows may expand into plan -> contract -> review -> notes only through the work-package gate.
42
- - If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
43
- - Route product discovery and complex/design planning to the parent agent: use `geju` for pre-contract framing, complete P1/P2/P3 with the parent agent's own capabilities, and freeze the accepted direction into the plan and contract. Route daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`. Route a proactive multi-direction visual/UX choice mid-task to the design-options convention (`repo-harness docs show design-options`).
44
- - Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `mermaid` from `~/.codex/skills`.
45
- - Keep durable repo knowledge in `docs/researches/`, `tasks/lessons.md`, and the canonical workflow artifacts.
46
- - Treat `.ai/harness/brain-manifest.json` and `repo-harness run sync-brain-docs` as explicit operator-invoked export surfaces only; hooks and workflow checks must not read, write, or gate on external brain-vault state.
47
- - Treat Waza as Codex-first: `~/.codex/skills` is the Codex runtime source; `~/.agents/skills` is skills CLI staging/cache only. The managed skills are `think`, `hunt`, `check`, and `health`; stage upstream Waza, copy their complete skill directories and shared rules into Codex, and verify with `diff`/`cmp` as described in `docs/reference-configs/external-tooling.md`.
48
- - Use `docs/reference-configs/external-tooling.md` and `bash scripts/check-agent-tooling.sh --host both --check-updates` for environment checks; this self-host repo vendors CodeGraph as a dev dependency while generated downstream repos keep the global MCP default unless local policy opts in.
49
- - When changing adoption planner or transaction code, verify `repo-harness init --repo . --dry-run` and a fixture apply use the same TS operation model.
50
- - Treat repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters as retired legacy config; migration may back them up locally, but they are not product deliverables.
1
+ # repo-harness
2
+
3
+ ## Workflow
4
+ - For non-trivial work, follow the global Progressive Due Diligence rule (P1 map, P2 trace, P3 decision) before design decisions or code edits.
5
+ - Keep root CLAUDE.md and AGENTS.md as standalone regular files; repeat shared rules in both and keep host-specific guidance separate.
6
+ - Read the current request and repo-local agent context, work on a branch, make bounded commits, verify once, then report the PR outcome.
7
+ - Write output text (docs, PR descriptions, commit messages, reports) in ASD-STE100 Simplified Technical English: short sentences, one idea per sentence, active voice, approved-dictionary words; write Chinese output the same way, with short sentences and one idea per sentence.
8
+ - Ordinary tasks use the PR description: goal, scope, changes, verification, risk and rollback. No mandatory plan/contract/review/notes chain; notes are only for non-obvious decisions.
9
+ - Keep four hard boundaries: main publication, deletion, credentials/permissions, and release/production operations.
10
+ - Only when the current task explicitly authorizes main publication may a model squash-merge after automated checks pass and GitHub has no outstanding change requests or unresolved review threads; an explicit no-merge instruction always wins. Push/tag still require task authorization; credentials/permissions, other deletion and release/production retain their separate approval boundaries. Tag authorized publication and record `git revert <squash-commit>` plus the daily report.
11
+ - Automatically delete only merged, clean worktrees/branches; ask the user for every other deletion. Credentials/permissions (including confirmation bypass) and release/production operations require user approval.
12
+ - Use gatekeeper/cross-model review for large changes, security/permissions, or unresolved model uncertainty; ordinary steps record diagnostics without approval loops.
13
+ - Model division and cross-model dispatch/review follow [Herdr Dispatch](docs/reference-configs/external-tooling.md#herdr-dispatch).
14
+ - GitHub operations (PRs, reviews, merges, labels, releases, comments) go only through the gh/git CLI or the GitHub API. Never use simulated browser clicks on github.com: the account can be banned.
15
+ - When one PR changes both test assertions and implementation code, run one read-only review focused on tests bent to fit a bug (on-demand, not a restored gate; dispatch per the herdr guide).
16
+ - `.archcontext/model/` owns architecture boundaries; read `docs/architecture/` on demand and update only real responsibility changes. Architecture diagnostics do not block work or author nested agent instructions.
17
+ - Preserve `agents/fleet/`, release checklists and downstream `assets/templates` / `assets/partials*`. Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` aligned.
18
+ - `_ops/` is ignored private operations state: never commit or agent-edit it. `_ref/` is an ignored reference cache; cite influential revisions. Follow deploy SQL policy, otherwise use ascending 4-digit files under `deploy/sql/`.
51
19
 
52
20
  ## Code Optimization Principles
53
-
54
- - Reason from first principles: identify observable conditions, controllable inputs, the invariant, and the actual pressure point before changing structure.
55
- - Keep one source of truth for each datum; every other representation must be a deterministic projection with a drift check.
56
- - Do not add steady-state compatibility code, dual authority, semantic fallbacks, aliases, or shadow parsers. Explicit one-shot migrations must fail closed and remove the retired path in the same work-package.
57
- - Create shared components only for observed reuse or a cross-module invariant. Prefer an existing monorepo workspace only when independently meaningful consumers need the shared package; do not convert this single-package repo without that boundary.
58
-
59
- ## Required Checks
60
-
61
- Follow [Testing Policy and Artifact Standards](docs/reference-configs/sprint-contracts.md#testing-policy-and-artifact-standards)
62
- for test selection, new test/file admission, full-suite justification, evidence
63
- reuse and test-document creation. The contract's JSON `Verification Plan` is
64
- its sole executable authority; `exit_criteria` owns artifact requirements.
65
-
66
- The following repository-integrity checks remain required for substantive
67
- repository changes. Projection checks protect the authoring sources in
68
- `scripts/`, `assets/hooks/` and `assets/reference-configs/`:
69
-
70
- ```bash
71
- bun run check:hooks
72
- bun run check:helpers
73
- bun run check:reference-configs
74
- bash scripts/check-deploy-sql-order.sh
75
- bash scripts/check-architecture-sync.sh
76
- bash scripts/check-task-sync.sh
77
- bash scripts/check-task-workflow.sh --strict
78
- bun scripts/inspect-project-state.ts --repo . --format text
79
- bun src/cli/index.ts init --repo . --dry-run
80
- ```
81
-
82
- Run focused coverage for changed behavior. Existing CI/release gates retain
83
- their checks. Apply the linked policy before declaring an expensive/full run
84
- or a new test document; reviewers consume canonical evidence rather than
85
- independently repeating it.
86
-
87
- <!-- BEGIN ARCHITECTURE CONTRACT -->
88
- ## Architecture Contract
89
-
90
- - Functional block: `src/effects/automation`
91
- - Capability ID: `runtime-harness-automation-budget`
92
- - Matched prefix: `src/effects/automation`
93
- - Architecture domain: `runtime-harness`
94
- - Architecture capability: `automation-budget`
95
- - Architecture module: `docs/architecture/modules/runtime-harness/automation-budget.md`
96
- - Last architecture event: 2026-09-08T05:10:12+0800
97
- - Last changed path: `src/effects/automation/campaign-capability-registry.ts`
98
- - Severity: low
99
- - Change type: source-change
100
- - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
101
- - Entrypoints: `src/effects/automation`
102
- - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
103
- - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
104
- - Runtime path: `src/effects/automation`
105
- - LSP/tooling profile: `typescript-lsp`
106
- - Verification: Use root required checks plus local commands recorded in this capability contract.
107
- - Latest snapshot: `(none yet)`
108
- - Semantic diagram source: `docs/architecture/modules/runtime-harness/automation-budget.md`
109
- - Pending architecture request: `(none)`
110
-
111
- ## Active Workstreams
112
-
113
- - (none yet)
114
-
115
- ## Current Session Projection
116
-
117
- - Durable progress lives under `tasks/workstreams/runtime-harness/automation-budget`.
118
- - `tasks/current.md` is the ignored local derived status read model; it is not a live lock or task source.
119
- - `tasks/todos.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
120
- <!-- END ARCHITECTURE CONTRACT -->
21
+ - Identify observable conditions, controllable inputs, the invariant and the actual pressure point before changing structure.
22
+ - Keep one source of truth for each datum; other representations are deterministic projections with drift checks.
23
+ - Do not add steady-state compatibility code, dual authority, semantic fallbacks, aliases or shadow parsers; one-shot migrations fail closed and remove the retired path.
24
+ - Share components only for observed reuse or a cross-module invariant. Use an existing workspace only for independently meaningful consumers; do not convert this single-package repo without that boundary.
25
+ - Prefer platform/standard-library features, then installed dependencies, and the smallest direct implementation; shrink obsolete code before adding layers.
26
+ - Never satisfy a requirement with a substitute that only looks compliant (mocks, hard-coded values, images posing as the real thing); say what cannot be done and flag the deviation in the PR.
27
+ - Self-review before committing: remove dead code, empty branches and debug leftovers, and split functions by responsibility instead of one large block.
28
+
29
+ ## Testing
30
+ - Run `bun run check:type` plus tests covering the changed behavior once after the implementation is stable.
31
+ - Use `bun run test:files <affected tests> --timeout 60000 --max-concurrency 1`; extend existing coverage before creating a new test file.
32
+ - Select tests by observable risk and owning runtime boundary, including error/recovery paths when affected.
33
+ - Mechanical prose changes need link/scope validation, not new product tests; do not test incidental formatting.
34
+ - Reviewers consume the recorded command, result, revision and environment; they do not rerun passing checks to claim ownership.
35
+ - Changed inputs or a new uncovered failure justify affected delta checks; an old pass is only historical evidence for its old subject.
36
+ - Run the full suite daily; a failure opens an automatic repair task and appears in the daily report.
37
+ - Isolate mutable HOME, repositories and process state; use real synchronization signals and preserve complete failure output.
38
+ - Report failed, timed-out, incomplete or omitted coverage explicitly; do not manufacture receipts, waiver files or pre-fix logs.
39
+ - Never modify or delete test assertions just to make tests pass; justify every necessary test change item by item in the PR description.
40
+
41
+ ## Handoff
42
+ - Create a checkpoint only when context/session rollover or unresolved work needs it; ordinary completion stays in the PR description.
43
+ - Read files named in the current request before recovery context.
44
+ - Record the goal, branch/worktree/HEAD, decisions, touched files, verification results, blockers and one exact next command.
45
+ - Keep temporary checkpoints under ignored `.ai/harness/handoff/`; historical snapshots are not current execution authority.
46
+ - Include evidence paths and actual command outcomes; distinguish observed state from inference.
47
+ - Never include secrets, tokens or real environment files in handoff text.
48
+ - On resume, verify the live checkout and source artifacts before reusing a result; `tasks/current.md` is an optional local read model.
49
+ - Preserve dirty work and other workers' edits; hand back an ownership conflict instead of discarding their changes.
50
+
51
+ ## Codex
52
+ - Own backend implementation and testing; Claude owns frontend implementation and interaction, and the parent coordinates scope and integration.
53
+ - User-level `~/.codex/hooks.json` hooks invoke `repo-harness-hook`; its typed route registry selects one in-process handler. Repo-local hook adapters are retired; `.ai/hooks/lib/workflow-state.sh` is an operator helper.
54
+ - Use `~/.codex/skills` as the runtime skill source; `~/.agents/skills` is staging/cache only. Keep `think`, `hunt`, `check` and `health` updates verified before runtime use.
55
+ - The Codex automation profile requires runtime-provided `health`, `check` and `mermaid`; do not vendor their bodies.
56
+ - Treat auto-compact as a fallback; prepare ignored `.ai/harness/handoff/current.md` and `resume.md` when long-task rollover is needed.
57
+ - Keep this file short; load [development flow](docs/reference-configs/agentic-development-flow.md) and [external tooling](docs/reference-configs/external-tooling.md) only when needed.
package/CLAUDE.md CHANGED
@@ -1,120 +1,56 @@
1
- # repo-harness AGENTS.md
2
-
3
- This repository self-hosts the `repo-harness` contract; the former `repo-harness-skill` and `project-initializer` names have been fully removed and are no longer recognized by any tooling. Claude and Codex should follow the same repo-local workflow surface.
4
-
5
- ## Canonical Workflow Files
6
-
7
- - `tasks/current.md` for the ignored local current-status read model derived from workflow artifacts
8
- - `tasks/todos.md` for deferred medium/long-term goals, not active execution checklists
9
- - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `repo-harness run sprint-backlog`; task contracts stay the execution slices
10
- - `.archcontext/model/nodes/*.yaml` for the capability nodes and longest-prefix context boundaries, selected by `.ai/harness/policy.json#context.capability_source`
11
- - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
12
- - `tasks/lessons.md` for correction-derived rules
13
- - `docs/researches/` for deep repo knowledge
14
- - `tasks/notes/` for task-local implementation decisions, deviations, tradeoffs, and open questions
15
- - `plans/` for timestamped plans, with `plans/archive/` for history
16
- - `.ai/harness/workflow-contract.json` for the installed workflow contract manifest
17
- - `.ai/harness/policy.json` for the machine-readable workflow contract
18
- - `.ai/context/context-map.json` for progressive context loading
19
- - `docs/architecture/index.md` for umbrella architecture status, drift requests, snapshots, and diagram links
20
- - `docs/reference-configs/agentic-development-flow.md` for parent-agent/Waza routing and P1/P2/P3 rules
21
-
22
- ## Operating Rules
23
-
24
- - Sync `tasks/` whenever substantive repo changes are made.
25
- - Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
26
- - Treat hook execution as typed and user-level: `~/.claude/settings.json` and `~/.codex/hooks.json` invoke `repo-harness-hook`, whose route registry selects exactly one in-process handler. `.ai/hooks/lib/workflow-state.sh` is an operator-helper library, never a host-event dispatcher.
27
- - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todos.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
28
- - Treat `.archcontext/model/nodes/*.yaml` as the source of truth for capability prefixes under `capability_source: "archcontext"`; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
29
- - Keep architecture drift handling split: `architecture-queue.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
30
- - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
31
- - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
32
- - Treat Codex auto-compact as a fallback only; use `.ai/harness/handoff/current.md` and `.ai/harness/handoff/resume.md` for long-task rollover.
33
- - Treat `.ai/harness/checks/*.latest.{json,md}` and `.ai/harness/runs/` as ignored runtime evidence cache; commit durable conclusions in `tasks/reviews/`, `tasks/contracts/`, `tasks/notes/`, or `docs/researches/` instead.
34
- - Treat architecture/spec/research docs as the human reading entrypoint. Before closing a workflow, promote durable conclusions into `docs/architecture/`, `docs/researches/`, `docs/spec.md`, or `tasks/lessons.md`; then archive fulfilled plan/contract/review/notes/todo artifacts so root workflow surfaces represent active work only. When a brain root is configured, a durable conclusion worth reusing across projects may additionally be projected into the vault through an explicit `obsidian-memory` persist call; the vault layer is optional and never a prerequisite for closing a workflow. `.rgignore` hides archived workflow artifacts and runtime evidence from default `rg` searches; use explicit paths or `rg -uu` for audits.
35
- - Treat `_ref/` as an occasional ignored external reference checkout cache, not a commit surface or daily workflow. Agents may read or refresh it for comparison; when it influences a decision, cite the source repo plus commit/tag and path in `tasks/notes/` or `docs/researches/`.
36
- - Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files, and env examples; follow `.ai/harness/policy.json#operations.deploy_sql` for configured SQL roots and naming modes, otherwise keep SQL directly under `deploy/sql/` with 4-digit ascending prefixes.
37
- - Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
38
- - Treat contract-level task execution as worktree-first: `repo-harness run plan-to-todo --plan <approved-plan>` starts `repo-harness run contract-worktree start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `repo-harness run contract-worktree finish`.
39
- - Treat the EXECUTION_BOUNDARY anti-extras clause as mandatory exactly once in each delegated runner's final rendered task packet: absent requirements are forbidden design space, not permission to improve, and unrequested extras fail closed. Each runner path names one injection owner and no other surface on that path may carry the clause — the Codex native-child path is owned by `SubagentStart.context` (contract- and writability-aware; generated personas and the delegation advisor carry none), the standalone contract worker path by its worker prompt, and the MCP path by the `codex-goal` document. Composed-path tests verify the count.
40
- - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `repo-harness run capture-plan --artifact-level work-package --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute --promotion-reason <merge_boundary|rollback_boundary|verification_boundary|risk_boundary|human_decision_boundary|worktree_boundary>` or run `repo-harness run plan-to-todo --plan <active-plan>`.
41
- - Promote work into a top-level `plans/plan-*.md` only when `Artifact Level: work-package` is justified by a merge/PR unit, rollback surface, independent verification boundary, review/acceptance boundary, high-risk surface, or otherwise cannot remain a checklist item in the current active plan or sprint backlog. Inline sprint rows and checklist rows stay in the sprint backlog or active plan `## Task Breakdown`; contract rows may expand into plan -> contract -> review -> notes only through the work-package gate.
42
- - If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
43
- - Route product discovery and complex/design planning to the parent agent: use `geju` for pre-contract framing, complete P1/P2/P3 with the parent agent's own capabilities, and freeze the accepted direction into the plan and contract. Route daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`. Route a proactive multi-direction visual/UX choice mid-task to the design-options convention (`repo-harness docs show design-options`).
44
- - Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `mermaid` from `~/.codex/skills`.
45
- - Keep durable repo knowledge in `docs/researches/`, `tasks/lessons.md`, and the canonical workflow artifacts.
46
- - Treat `.ai/harness/brain-manifest.json` and `repo-harness run sync-brain-docs` as explicit operator-invoked export surfaces only; hooks and workflow checks must not read, write, or gate on external brain-vault state.
47
- - Treat Waza as Codex-first: `~/.codex/skills` is the Codex runtime source; `~/.agents/skills` is skills CLI staging/cache only. The managed skills are `think`, `hunt`, `check`, and `health`; stage upstream Waza, copy their complete skill directories and shared rules into Codex, and verify with `diff`/`cmp` as described in `docs/reference-configs/external-tooling.md`.
48
- - Use `docs/reference-configs/external-tooling.md` and `bash scripts/check-agent-tooling.sh --host both --check-updates` for environment checks; this self-host repo vendors CodeGraph as a dev dependency while generated downstream repos keep the global MCP default unless local policy opts in.
49
- - When changing adoption planner or transaction code, verify `repo-harness init --repo . --dry-run` and a fixture apply use the same TS operation model.
50
- - Treat repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters as retired legacy config; migration may back them up locally, but they are not product deliverables.
1
+ # repo-harness
2
+
3
+ ## Workflow
4
+ - For non-trivial work, follow the global Progressive Due Diligence rule (P1 map, P2 trace, P3 decision) before design decisions or code edits.
5
+ - Keep root CLAUDE.md and AGENTS.md as standalone regular files; repeat shared rules in both and keep host-specific guidance separate.
6
+ - Read the current request and repo-local agent context, work on a branch, make bounded commits, verify once, then report the PR outcome.
7
+ - Write output text (docs, PR descriptions, commit messages, reports) in ASD-STE100 Simplified Technical English: short sentences, one idea per sentence, active voice, approved-dictionary words; write Chinese output the same way, with short sentences and one idea per sentence.
8
+ - Ordinary tasks use the PR description: goal, scope, changes, verification, risk and rollback. No mandatory plan/contract/review/notes chain; notes are only for non-obvious decisions.
9
+ - Keep four hard boundaries: main publication, deletion, credentials/permissions, and release/production operations.
10
+ - Only when the current task explicitly authorizes main publication may a model squash-merge after automated checks pass and GitHub has no outstanding change requests or unresolved review threads; an explicit no-merge instruction always wins. Push/tag still require task authorization; credentials/permissions, other deletion and release/production retain their separate approval boundaries. Tag authorized publication and record `git revert <squash-commit>` plus the daily report.
11
+ - Automatically delete only merged, clean worktrees/branches; ask the user for every other deletion. Credentials/permissions (including confirmation bypass) and release/production operations require user approval.
12
+ - Use gatekeeper/cross-model review for large changes, security/permissions, or unresolved model uncertainty; ordinary steps record diagnostics without approval loops.
13
+ - Model division and cross-model dispatch/review follow [Herdr Dispatch](docs/reference-configs/external-tooling.md#herdr-dispatch).
14
+ - GitHub operations (PRs, reviews, merges, labels, releases, comments) go only through the gh/git CLI or the GitHub API. Never use simulated browser clicks on github.com: the account can be banned.
15
+ - When one PR changes both test assertions and implementation code, run one read-only review focused on tests bent to fit a bug (on-demand, not a restored gate; dispatch per the herdr guide).
16
+ - `.archcontext/model/` owns architecture boundaries; read `docs/architecture/` on demand and update only real responsibility changes. Architecture diagnostics do not block work or author nested agent instructions.
17
+ - Preserve `agents/fleet/`, release checklists and downstream `assets/templates` / `assets/partials*`. Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` aligned.
18
+ - `_ops/` is ignored private operations state: never commit or agent-edit it. `_ref/` is an ignored reference cache; cite influential revisions. Follow deploy SQL policy, otherwise use ascending 4-digit files under `deploy/sql/`.
51
19
 
52
20
  ## Code Optimization Principles
53
-
54
- - Reason from first principles: identify observable conditions, controllable inputs, the invariant, and the actual pressure point before changing structure.
55
- - Keep one source of truth for each datum; every other representation must be a deterministic projection with a drift check.
56
- - Do not add steady-state compatibility code, dual authority, semantic fallbacks, aliases, or shadow parsers. Explicit one-shot migrations must fail closed and remove the retired path in the same work-package.
57
- - Create shared components only for observed reuse or a cross-module invariant. Prefer an existing monorepo workspace only when independently meaningful consumers need the shared package; do not convert this single-package repo without that boundary.
58
-
59
- ## Required Checks
60
-
61
- Follow [Testing Policy and Artifact Standards](docs/reference-configs/sprint-contracts.md#testing-policy-and-artifact-standards)
62
- for test selection, new test/file admission, full-suite justification, evidence
63
- reuse and test-document creation. The contract's JSON `Verification Plan` is
64
- its sole executable authority; `exit_criteria` owns artifact requirements.
65
-
66
- The following repository-integrity checks remain required for substantive
67
- repository changes. Projection checks protect the authoring sources in
68
- `scripts/`, `assets/hooks/` and `assets/reference-configs/`:
69
-
70
- ```bash
71
- bun run check:hooks
72
- bun run check:helpers
73
- bun run check:reference-configs
74
- bash scripts/check-deploy-sql-order.sh
75
- bash scripts/check-architecture-sync.sh
76
- bash scripts/check-task-sync.sh
77
- bash scripts/check-task-workflow.sh --strict
78
- bun scripts/inspect-project-state.ts --repo . --format text
79
- bun src/cli/index.ts init --repo . --dry-run
80
- ```
81
-
82
- Run focused coverage for changed behavior. Existing CI/release gates retain
83
- their checks. Apply the linked policy before declaring an expensive/full run
84
- or a new test document; reviewers consume canonical evidence rather than
85
- independently repeating it.
86
-
87
- <!-- BEGIN ARCHITECTURE CONTRACT -->
88
- ## Architecture Contract
89
-
90
- - Functional block: `src/effects/automation`
91
- - Capability ID: `runtime-harness-automation-budget`
92
- - Matched prefix: `src/effects/automation`
93
- - Architecture domain: `runtime-harness`
94
- - Architecture capability: `automation-budget`
95
- - Architecture module: `docs/architecture/modules/runtime-harness/automation-budget.md`
96
- - Last architecture event: 2026-09-08T05:10:12+0800
97
- - Last changed path: `src/effects/automation/campaign-capability-registry.ts`
98
- - Severity: low
99
- - Change type: source-change
100
- - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
101
- - Entrypoints: `src/effects/automation`
102
- - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
103
- - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
104
- - Runtime path: `src/effects/automation`
105
- - LSP/tooling profile: `typescript-lsp`
106
- - Verification: Use root required checks plus local commands recorded in this capability contract.
107
- - Latest snapshot: `(none yet)`
108
- - Semantic diagram source: `docs/architecture/modules/runtime-harness/automation-budget.md`
109
- - Pending architecture request: `(none)`
110
-
111
- ## Active Workstreams
112
-
113
- - (none yet)
114
-
115
- ## Current Session Projection
116
-
117
- - Durable progress lives under `tasks/workstreams/runtime-harness/automation-budget`.
118
- - `tasks/current.md` is the ignored local derived status read model; it is not a live lock or task source.
119
- - `tasks/todos.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
120
- <!-- END ARCHITECTURE CONTRACT -->
21
+ - Identify observable conditions, controllable inputs, the invariant and the actual pressure point before changing structure.
22
+ - Keep one source of truth for each datum; other representations are deterministic projections with drift checks.
23
+ - Do not add steady-state compatibility code, dual authority, semantic fallbacks, aliases or shadow parsers; one-shot migrations fail closed and remove the retired path.
24
+ - Share components only for observed reuse or a cross-module invariant. Use an existing workspace only for independently meaningful consumers; do not convert this single-package repo without that boundary.
25
+ - Prefer platform/standard-library features, then installed dependencies, and the smallest direct implementation; shrink obsolete code before adding layers.
26
+ - Never satisfy a requirement with a substitute that only looks compliant (mocks, hard-coded values, images posing as the real thing); say what cannot be done and flag the deviation in the PR.
27
+ - Self-review before committing: remove dead code, empty branches and debug leftovers, and split functions by responsibility instead of one large block.
28
+
29
+ ## Testing
30
+ - Run `bun run check:type` plus tests covering the changed behavior once after the implementation is stable.
31
+ - Use `bun run test:files <affected tests> --timeout 60000 --max-concurrency 1`; extend existing coverage before creating a new test file.
32
+ - Select tests by observable risk and owning runtime boundary, including error/recovery paths when affected.
33
+ - Mechanical prose changes need link/scope validation, not new product tests; do not test incidental formatting.
34
+ - Reviewers consume the recorded command, result, revision and environment; they do not rerun passing checks to claim ownership.
35
+ - Changed inputs or a new uncovered failure justify affected delta checks; an old pass is only historical evidence for its old subject.
36
+ - Run the full suite daily; a failure opens an automatic repair task and appears in the daily report.
37
+ - Isolate mutable HOME, repositories and process state; use real synchronization signals and preserve complete failure output.
38
+ - Report failed, timed-out, incomplete or omitted coverage explicitly; do not manufacture receipts, waiver files or pre-fix logs.
39
+ - Never modify or delete test assertions just to make tests pass; justify every necessary test change item by item in the PR description.
40
+
41
+ ## Handoff
42
+ - Create a checkpoint only when context/session rollover or unresolved work needs it; ordinary completion stays in the PR description.
43
+ - Read files named in the current request before recovery context.
44
+ - Record the goal, branch/worktree/HEAD, decisions, touched files, verification results, blockers and one exact next command.
45
+ - Keep temporary checkpoints under ignored `.ai/harness/handoff/`; historical snapshots are not current execution authority.
46
+ - Include evidence paths and actual command outcomes; distinguish observed state from inference.
47
+ - Never include secrets, tokens or real environment files in handoff text.
48
+ - On resume, verify the live checkout and source artifacts before reusing a result; `tasks/current.md` is an optional local read model.
49
+ - Preserve dirty work and other workers' edits; hand back an ownership conflict instead of discarding their changes.
50
+
51
+ ## Claude Code
52
+ - Own frontend implementation and interaction; Codex owns backend implementation and testing, and the parent coordinates scope and integration.
53
+ - Use Claude Code's available tools within granted permissions; changes to tool grants, hooks or confirmation bypass require approval of the exact change.
54
+ - User-level `~/.claude/settings.json` hooks invoke `repo-harness-hook`; its typed route registry selects one in-process handler. Repo-local hook adapters are retired; `.ai/hooks/lib/workflow-state.sh` is an operator helper.
55
+ - Write comments, commits and PR text from the final diff; comments explain non-obvious reasons, and PRs describe final behavior and material rationale.
56
+ - Keep this file short; load [development flow](docs/reference-configs/agentic-development-flow.md) and [external tooling](docs/reference-configs/external-tooling.md) only when needed.