repo-harness 0.22.1 → 0.23.1

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 (502) hide show
  1. package/AGENTS.md +31 -10
  2. package/CLAUDE.md +31 -10
  3. package/README.es.md +16 -617
  4. package/README.fr.md +16 -613
  5. package/README.ja.md +16 -613
  6. package/README.md +89 -219
  7. package/README.zh-CN.md +16 -575
  8. package/SKILL.md +5 -4
  9. package/agents/engineers/profiles/verification-evals-checks.json +0 -1
  10. package/agents/engineers/profiles/workflow-engine-contract-assets.json +0 -1
  11. package/agents/engineers/sops/verification-evals-checks.md +1 -1
  12. package/agents/engineers/sops/workflow-engine-contract-assets.md +1 -1
  13. package/agents/fleet/gatekeeper.md +3 -1
  14. package/agents/fleet/harness-evaluator.md +1 -1
  15. package/assets/reference-configs/agentic-development-flow.md +78 -5
  16. package/assets/reference-configs/development-protocol.md +2 -4
  17. package/assets/reference-configs/external-tooling.md +165 -106
  18. package/assets/reference-configs/global-working-rules.md +5 -4
  19. package/assets/reference-configs/harness-overview.md +65 -44
  20. package/assets/reference-configs/heartbeat-triage.md +2 -0
  21. package/assets/reference-configs/herdr-notify.md +29 -1
  22. package/assets/reference-configs/hook-operations.md +193 -116
  23. package/assets/reference-configs/host-invariants.md +9 -12
  24. package/assets/reference-configs/issue-pipeline.md +61 -0
  25. package/assets/reference-configs/minimal-change-hooks.md +25 -111
  26. package/assets/reference-configs/release-deploy.md +8 -5
  27. package/assets/reference-configs/sprint-contracts.md +25 -1
  28. package/assets/skill-commands/AGENTS.md +0 -7
  29. package/assets/skill-commands/CLAUDE.md +0 -7
  30. package/assets/skill-commands/manifest.json +12 -14
  31. package/assets/skill-commands/repo-harness-architecture/SKILL.md +1 -0
  32. package/assets/skill-commands/repo-harness-architecture/agents/openai.yaml +2 -0
  33. package/assets/skill-commands/repo-harness-architecture/references/worker.md +98 -24
  34. package/assets/skill-commands/repo-harness-check/SKILL.md +5 -0
  35. package/assets/skill-commands/repo-harness-check/references/architecture-evidence.md +46 -15
  36. package/assets/skill-commands/repo-harness-check/references/deploy-readiness.md +0 -2
  37. package/assets/skill-commands/repo-harness-check/references/pr-verification.md +96 -0
  38. package/assets/skill-commands/repo-harness-check/references/review-comment-triage.md +65 -0
  39. package/assets/skill-commands/repo-harness-check/references/review.md +0 -2
  40. package/assets/skill-commands/repo-harness-ship/SKILL.md +6 -0
  41. package/assets/skill-commands/repo-harness-ship/references/worker.md +3 -1
  42. package/assets/skill-version.json +2 -2
  43. package/assets/skills/repo-harness-chatgpt/SKILL.md +1 -1
  44. package/assets/skills/repo-harness-chatgpt/references/bridge.md +0 -8
  45. package/assets/skills/repo-harness-cross-review/SKILL.md +1 -2
  46. package/assets/skills/repo-harness-cross-review/references/generic-review.md +7 -45
  47. package/assets/skills/repo-harness-product/SKILL.md +12 -3
  48. package/assets/skills/repo-harness-product/references/goal.md +57 -34
  49. package/assets/skills/repo-harness-product/references/prd.md +7 -6
  50. package/assets/skills/repo-harness-product/references/sprint.md +31 -49
  51. package/assets/skills/repo-harness-setup/references/capability.md +7 -2
  52. package/assets/skills/repo-harness-setup/references/init.md +0 -2
  53. package/assets/skills/repo-harness-setup/references/migrate.md +0 -5
  54. package/assets/skills/repo-harness-setup/references/repair.md +0 -2
  55. package/assets/skills/repo-harness-setup/references/scaffold.md +0 -2
  56. package/assets/skills/repo-harness-setup/references/upgrade.md +0 -2
  57. package/assets/skills/repo-harness-test/references/authoring.md +12 -4
  58. package/assets/skills/repo-harness-test/references/running.md +77 -28
  59. package/assets/skills/repo-harness-test/references/verification-plan.md +15 -13
  60. package/assets/templates/helpers/capability-resolver.ts +198 -334
  61. package/assets/templates/runtime.gitignore +5 -7
  62. package/assets/tool-catalog.v1.json +89 -0
  63. package/assets/workflow-contract.v1.json +18 -21
  64. package/dist/hook-entry.js +7911 -17731
  65. package/dist/oar-coding-host.js +193 -11
  66. package/dist/oar-review-host.js +197 -8
  67. package/dist/operator-ui/assets/ArchitectureWorkspace-DYg_H3WQ.js +1 -0
  68. package/dist/operator-ui/assets/index-DY7Cw9qc.css +2 -0
  69. package/dist/operator-ui/assets/index-aOt5ob6i.js +18 -0
  70. package/dist/operator-ui/index.html +2 -2
  71. package/package.json +9 -32
  72. package/references/bot-control.md +21 -25
  73. package/references/pm-boundary.md +33 -59
  74. package/scripts/archive-workflow.sh +10 -16
  75. package/scripts/axr5-archctx-clean-room.ts +7 -3
  76. package/scripts/capability-resolver.ts +63 -88
  77. package/scripts/check-agent-tooling.sh +77 -16
  78. package/scripts/check-ci.sh +139 -39
  79. package/scripts/check-context-map.ts +15 -29
  80. package/scripts/check-npm-release.sh +6 -6
  81. package/scripts/check-release-published.sh +1 -2
  82. package/scripts/check-state-boundaries.ts +0 -3
  83. package/scripts/check-tarball-install-smoke.sh +13 -25
  84. package/scripts/ci-documentation-consumers.ts +31 -78
  85. package/scripts/ci-edge-audit.ts +141 -0
  86. package/scripts/ci-path-consumers.ts +186 -0
  87. package/scripts/codex-handoff-resume.sh +3 -5
  88. package/scripts/contract-worktree-runtime.ts +18 -0
  89. package/scripts/contract-worktree.sh +39 -104
  90. package/scripts/create-project-dirs.sh +2 -13
  91. package/scripts/decision-trail.ts +157 -0
  92. package/scripts/evidence-gc.ts +103 -18
  93. package/scripts/init-project.sh +6 -16
  94. package/scripts/install-agent-fleet.sh +2 -2
  95. package/scripts/lib/ci-run-tests.sh +10 -0
  96. package/scripts/lib/path-values.ts +149 -0
  97. package/scripts/lib/project-init-lib.sh +44 -151
  98. package/scripts/prepare-codex-handoff.sh +3 -3
  99. package/scripts/prepare-handoff.sh +14 -21
  100. package/scripts/recovery-view-cli.ts +45 -758
  101. package/scripts/replay-ci-coverage.ts +160 -23
  102. package/scripts/report-ci.ts +97 -9
  103. package/scripts/run-harness-profile-benchmark.ts +62 -40
  104. package/scripts/run-skill-evals.ts +1 -1
  105. package/scripts/runtime-evidence-receipt.ts +6 -23
  106. package/scripts/select-agent-context-blocks.sh +72 -4
  107. package/scripts/select-ci-coverage.ts +170 -34
  108. package/scripts/select-test-suite.ts +16 -1
  109. package/scripts/ship-worktrees.sh +11 -209
  110. package/scripts/sprint-backlog.sh +28 -905
  111. package/scripts/summarize-failures.sh +16 -48
  112. package/scripts/sync-helper-sources.ts +5 -61
  113. package/scripts/sync-reference-configs.ts +44 -4
  114. package/scripts/test-file-durations.json +1 -86
  115. package/scripts/workflow-contract.ts +1 -1
  116. package/scripts/workstream-sync.sh +5 -2
  117. package/scripts/worktree-merge-lib.sh +9 -9
  118. package/src/cli/chatgpt-browser/file-policy.ts +3 -6
  119. package/src/cli/commands/architecture-debt.ts +143 -0
  120. package/src/cli/commands/architecture-projection.ts +15 -12
  121. package/src/cli/commands/brain.ts +165 -2
  122. package/src/cli/commands/capability-context.ts +76 -38
  123. package/src/cli/commands/catch-up.ts +45 -0
  124. package/src/cli/commands/docs.ts +0 -2
  125. package/src/cli/commands/doctor.ts +57 -27
  126. package/src/cli/commands/fleet.ts +0 -86
  127. package/src/cli/commands/global-runtime.ts +62 -12
  128. package/src/cli/commands/init-hook.ts +23 -4
  129. package/src/cli/commands/init.ts +4 -3
  130. package/src/cli/commands/install.ts +18 -28
  131. package/src/cli/commands/mcp.ts +2 -33
  132. package/src/cli/commands/module.ts +22 -6
  133. package/src/cli/commands/refactor.ts +46 -19
  134. package/src/cli/commands/retention.ts +53 -0
  135. package/src/cli/commands/review.ts +1 -1
  136. package/src/cli/commands/run.ts +14 -5
  137. package/src/cli/commands/security.ts +1 -1
  138. package/src/cli/commands/sprint.ts +6 -150
  139. package/src/cli/commands/state.ts +0 -13
  140. package/src/cli/commands/status.ts +4 -3
  141. package/src/cli/commands/validators.ts +1 -1
  142. package/src/cli/hook/AGENTS.md +33 -0
  143. package/src/cli/hook/CLAUDE.md +33 -0
  144. package/src/cli/hook/board-slice-context.ts +12 -19
  145. package/src/cli/hook/circuit-breaker.ts +14 -36
  146. package/src/cli/hook/event-telemetry.ts +51 -387
  147. package/src/cli/hook/handler-contract.ts +26 -121
  148. package/src/cli/hook/handler-registry.ts +57 -160
  149. package/src/cli/hook/hook-input.ts +50 -206
  150. package/src/cli/hook/hook-protocol.ts +61 -0
  151. package/src/cli/hook/mutation-guard.ts +123 -823
  152. package/src/cli/hook/return-channel.ts +73 -0
  153. package/src/cli/hook/route-registry.ts +18 -72
  154. package/src/cli/hook/runtime.ts +126 -453
  155. package/src/cli/hook/session-context-budget.ts +30 -437
  156. package/src/cli/hook/session-context.ts +115 -1486
  157. package/src/cli/hook/standing-orders-context.ts +38 -0
  158. package/src/cli/hook/stop-handler.ts +82 -421
  159. package/src/cli/hook/subagent-context.ts +476 -0
  160. package/src/cli/hook-entry.ts +21 -103
  161. package/src/cli/index.ts +25 -58
  162. package/src/cli/installer/configuration-ownership.ts +5 -1
  163. package/src/cli/installer/install-profile.ts +9 -8
  164. package/src/cli/installer/managed-entries.ts +8 -13
  165. package/src/cli/installer/targets/claude.ts +16 -28
  166. package/src/cli/installer/targets/codex.ts +16 -36
  167. package/src/cli/installer/types.ts +2 -7
  168. package/src/cli/installer/uninstall.ts +2 -2
  169. package/src/cli/mcp/auth.ts +0 -12
  170. package/src/cli/mcp/fleet-tools.ts +4 -88
  171. package/src/cli/mcp/instructions.ts +1 -10
  172. package/src/cli/mcp/oauth.ts +3 -22
  173. package/src/cli/mcp/policy.ts +8 -38
  174. package/src/cli/mcp/server.ts +5 -64
  175. package/src/cli/mcp/setup.ts +11 -74
  176. package/src/cli/mcp/state-tools.ts +0 -10
  177. package/src/cli/mcp/tools.ts +4 -158
  178. package/src/cli/mcp/transports/http.ts +23 -58
  179. package/src/cli/mcp/transports/stdio.ts +0 -5
  180. package/src/cli/mcp/types.ts +1 -7
  181. package/src/core/adoption/managed-hook-config.ts +21 -16
  182. package/src/core/adoption/minimum-harness-version.ts +90 -0
  183. package/src/core/adoption/standard-plan.ts +30 -5
  184. package/src/core/adoption/workflow-contract-asset.ts +8 -2
  185. package/src/core/architecture/module-view.ts +46 -18
  186. package/src/core/architecture/projection.ts +109 -6
  187. package/src/core/capabilities/ownership-blocker.ts +69 -0
  188. package/src/core/capabilities/registry.ts +137 -247
  189. package/src/core/dev-activity/brief.ts +95 -0
  190. package/src/core/dev-activity/decode.ts +11 -40
  191. package/src/core/dev-activity/projection.ts +7 -147
  192. package/src/core/dev-activity/types.ts +9 -37
  193. package/src/core/engineers/agent-runtime-effect.ts +5 -22
  194. package/src/core/engineers/engineering-overlay.ts +8 -32
  195. package/src/core/engineers/principal-claim.ts +1 -123
  196. package/src/core/engineers/profile-binding.ts +4 -9
  197. package/src/core/engineers/scheduling.ts +24 -5
  198. package/src/core/evidence/checkpoint.ts +100 -3
  199. package/src/core/evidence/payload-cap.ts +2 -4
  200. package/src/core/fleet/task-offer.ts +0 -28
  201. package/src/core/fleet/task-reply.ts +0 -21
  202. package/src/core/operator/architecture.ts +13 -9
  203. package/src/core/operator/organization-snapshot.ts +8 -12
  204. package/src/core/operator/planning-snapshot.ts +2 -2
  205. package/src/core/operator/repository-snapshot.ts +12 -0
  206. package/src/core/refactor/provider-contract.ts +6 -2
  207. package/src/core/release/runtime-evidence.ts +5 -98
  208. package/src/core/review/module-review-prompt.ts +21 -3
  209. package/src/core/setup/projection.ts +2 -2
  210. package/src/core/setup/types.ts +4 -4
  211. package/src/core/skill-surface/catalog.ts +4 -7
  212. package/src/core/state/coordination-identity.ts +2 -103
  213. package/src/core/state/project-board.ts +4 -24
  214. package/src/core/state/project-continuation-envelope.ts +6 -115
  215. package/src/core/state/project-effective-state.ts +13 -185
  216. package/src/core/state/project-state-snapshot.ts +2 -1
  217. package/src/core/state/types.ts +31 -44
  218. package/src/core/tools/catalog.ts +101 -0
  219. package/src/core/upgrade/legacy-inventory.ts +6 -6
  220. package/src/effects/architecture/archctx-provider.ts +467 -181
  221. package/src/effects/architecture/model-reader.ts +265 -164
  222. package/src/effects/architecture/projection-apply.ts +18 -61
  223. package/src/effects/artifact-retention.ts +314 -0
  224. package/src/effects/capabilities/archcontext-owners.ts +86 -14
  225. package/src/effects/dev-activity/collector.ts +12 -125
  226. package/src/effects/engineers/agent-runtime-effect-store.ts +4 -34
  227. package/src/effects/engineers/binding-store.ts +3 -390
  228. package/src/effects/engineers/claim-actor-store.ts +2 -78
  229. package/src/effects/engineers/dependency-authority.ts +5 -6
  230. package/src/effects/engineers/engineering-overlay.ts +6 -21
  231. package/src/effects/engineers/profile-store.ts +16 -36
  232. package/src/effects/engineers/scheduling.ts +6 -223
  233. package/src/effects/evidence/checkpoint-store.ts +34 -15
  234. package/src/effects/evidence/recovery-materializer.ts +84 -86
  235. package/src/effects/fleet/acquire.ts +7 -787
  236. package/src/effects/fleet/task-inbox.ts +46 -378
  237. package/src/effects/locking/exclusive-directory-lock.ts +158 -99
  238. package/src/effects/loop/state-input-collector.ts +29 -118
  239. package/src/effects/operator/architecture.ts +3 -1
  240. package/src/effects/operator/docs-graph.ts +33 -18
  241. package/src/effects/operator/repository-snapshot-worker.ts +55 -0
  242. package/src/effects/operator/{collaboration.ts → repository-snapshot.ts} +40 -58
  243. package/src/effects/operator/runtime-service.ts +8 -59
  244. package/src/effects/operator/server.ts +150 -172
  245. package/src/effects/process-group-launcher.ts +7 -1
  246. package/src/effects/publication/feedback-store.ts +108 -58
  247. package/src/effects/publication/publication-receipt.ts +45 -0
  248. package/src/effects/refactor/archctx-provider.ts +14 -24
  249. package/src/effects/refactor/recommendations.ts +47 -26
  250. package/src/effects/release/runtime-evidence.ts +14 -53
  251. package/src/effects/review/diff-fingerprint.ts +22 -18
  252. package/src/effects/review/generic-review.ts +12 -9
  253. package/src/effects/review/oar-review-host.ts +16 -8
  254. package/src/effects/run-summary-retention.ts +44 -88
  255. package/src/effects/runtime/helper-runner.ts +2 -20
  256. package/src/effects/state/collect-board-inputs.ts +1 -2
  257. package/src/effects/state/coordination-claim-token.ts +12 -205
  258. package/src/effects/state/coordination-lease-store.ts +3 -51
  259. package/src/effects/state/coordination-sprint.ts +4 -399
  260. package/src/effects/state/coordination-worktree-topology.ts +65 -45
  261. package/src/effects/state/owed-capabilities.ts +159 -0
  262. package/src/effects/state/resolve-continuation-envelope.ts +0 -8
  263. package/src/effects/state/resolve-effective-state.ts +298 -310
  264. package/src/effects/state/worktree-trash.ts +12 -4
  265. package/src/effects/terminal/coding-session.ts +3 -3
  266. package/src/effects/terminal/oar-coding-host.ts +10 -7
  267. package/src/effects/terminal/task-role-profiles.ts +14 -28
  268. package/src/effects/terminal/task-runtime-observation.ts +183 -0
  269. package/src/effects/terminal/task-session.ts +68 -107
  270. package/src/operator-web/App.tsx +39 -50
  271. package/src/operator-web/Board.tsx +10 -42
  272. package/src/operator-web/ItemDrawer.tsx +10 -41
  273. package/src/operator-web/ModuleGraph.tsx +6 -6
  274. package/src/operator-web/OrganizationSummary.tsx +2 -36
  275. package/src/operator-web/PlanningView.tsx +2 -2
  276. package/src/operator-web/RepositoryWorkspace.tsx +11 -237
  277. package/src/operator-web/RuntimeBadges.tsx +7 -60
  278. package/src/operator-web/SetupPages.tsx +1 -2
  279. package/src/operator-web/SystemPage.tsx +4 -8
  280. package/src/operator-web/ToolsPage.tsx +136 -0
  281. package/src/operator-web/app.css +11 -23
  282. package/src/operator-web/dev-activity.ts +13 -26
  283. package/src/operator-web/fixture.ts +5 -206
  284. package/src/operator-web/fixtures/dev-activity.ts +13 -33
  285. package/src/operator-web/fixtures/index.ts +5 -26
  286. package/src/operator-web/fixtures/setup.ts +17 -30
  287. package/src/operator-web/fleet-api.ts +19 -23
  288. package/src/operator-web/i18n.ts +90 -470
  289. package/src/operator-web/labels.ts +0 -9
  290. package/src/operator-web/types.ts +28 -206
  291. package/src/operator-web/workspace-location.ts +13 -2
  292. package/assets/hermes/README.md +0 -88
  293. package/assets/hermes/repo-harness-pm/__init__.py +0 -81
  294. package/assets/hermes/repo-harness-pm/plugin.yaml +0 -9
  295. package/assets/hermes/setup.py +0 -154
  296. package/assets/hermes/test_adapter.py +0 -63
  297. package/assets/hermes/verify.py +0 -116
  298. package/assets/hooks/AGENTS.md +0 -41
  299. package/assets/hooks/CLAUDE.md +0 -41
  300. package/assets/hooks/lib/workflow-state.sh +0 -1599
  301. package/assets/hooks/projection.json +0 -9
  302. package/assets/initializer-question-pack.v4.json +0 -556
  303. package/assets/initializer-question-pack.v4.schema.json +0 -169
  304. package/assets/partials/01-header.partial.md +0 -10
  305. package/assets/partials/02-iron-rules.partial.md +0 -30
  306. package/assets/partials/03-philosophy.partial.md +0 -53
  307. package/assets/partials/04-project-structure.partial.md +0 -56
  308. package/assets/partials/05-workflow.partial.md +0 -79
  309. package/assets/partials/06-cloudflare.partial.md +0 -20
  310. package/assets/partials/07-footer.partial.md +0 -38
  311. package/assets/partials/08-orchestration.partial.md +0 -54
  312. package/assets/partials/09-compact-instructions.partial.md +0 -11
  313. package/assets/partials/_assembly-order.md +0 -40
  314. package/assets/partials-agents/01-header.partial.md +0 -8
  315. package/assets/partials-agents/02-operating-mode.partial.md +0 -43
  316. package/assets/partials-agents/03-orchestration.partial.md +0 -47
  317. package/assets/partials-agents/04-task-protocol.partial.md +0 -67
  318. package/assets/partials-agents/05-coding-constraints.partial.md +0 -20
  319. package/assets/partials-agents/06-quality-safety.partial.md +0 -24
  320. package/assets/partials-agents/07-cloudflare.partial.md +0 -9
  321. package/assets/partials-agents/08-deep-docs.partial.md +0 -32
  322. package/assets/reference-configs/AGENTS.md +0 -13
  323. package/assets/reference-configs/CLAUDE.md +0 -13
  324. package/assets/skills/repo-harness-cross-review/references/codex-mode.md +0 -18
  325. package/assets/templates/helpers/acceptance-receipt.ts +0 -1994
  326. package/assets/templates/helpers/archive-workflow.sh +0 -944
  327. package/assets/templates/helpers/capability-config.ts +0 -367
  328. package/assets/templates/helpers/capture-plan.sh +0 -29
  329. package/assets/templates/helpers/change-assessment.ts +0 -241
  330. package/assets/templates/helpers/check-agent-tooling.sh +0 -2098
  331. package/assets/templates/helpers/check-brain-manifest.sh +0 -244
  332. package/assets/templates/helpers/check-context-files.sh +0 -50
  333. package/assets/templates/helpers/check-deploy-sql-order.sh +0 -393
  334. package/assets/templates/helpers/check-skill-version.ts +0 -185
  335. package/assets/templates/helpers/check-task-sync.sh +0 -24
  336. package/assets/templates/helpers/check-task-workflow.sh +0 -25
  337. package/assets/templates/helpers/classify-historical-plans.ts +0 -254
  338. package/assets/templates/helpers/codex-handoff-resume.sh +0 -67
  339. package/assets/templates/helpers/contract-run.ts +0 -1010
  340. package/assets/templates/helpers/contract-worktree-runtime.ts +0 -100
  341. package/assets/templates/helpers/contract-worktree.sh +0 -2207
  342. package/assets/templates/helpers/cutover-closure.ts +0 -196
  343. package/assets/templates/helpers/ensure-task-workflow.sh +0 -11
  344. package/assets/templates/helpers/evidence-gc.ts +0 -198
  345. package/assets/templates/helpers/factor-lab-check.sh +0 -77
  346. package/assets/templates/helpers/factor-lab-new.sh +0 -100
  347. package/assets/templates/helpers/factor-lab-promote.sh +0 -90
  348. package/assets/templates/helpers/factor-lab-reject.sh +0 -72
  349. package/assets/templates/helpers/harness-trace-grade.sh +0 -153
  350. package/assets/templates/helpers/heartbeat-triage.sh +0 -337
  351. package/assets/templates/helpers/inspect-project-state.ts +0 -290
  352. package/assets/templates/helpers/install-agent-fleet.sh +0 -370
  353. package/assets/templates/helpers/maintenance-triage.sh +0 -167
  354. package/assets/templates/helpers/merge-gate.ts +0 -306
  355. package/assets/templates/helpers/migrate-verification-plan.ts +0 -221
  356. package/assets/templates/helpers/new-plan.sh +0 -192
  357. package/assets/templates/helpers/new-spec.sh +0 -50
  358. package/assets/templates/helpers/new-sprint.sh +0 -50
  359. package/assets/templates/helpers/plan-to-todo.sh +0 -17
  360. package/assets/templates/helpers/prepare-codex-handoff.sh +0 -58
  361. package/assets/templates/helpers/prepare-handoff.sh +0 -64
  362. package/assets/templates/helpers/recovery-view-cli.ts +0 -858
  363. package/assets/templates/helpers/refresh-current-status.sh +0 -548
  364. package/assets/templates/helpers/run-bounded-verifier-command.ts +0 -243
  365. package/assets/templates/helpers/runtime-evidence-receipt.ts +0 -77
  366. package/assets/templates/helpers/select-agent-context-blocks.sh +0 -73
  367. package/assets/templates/helpers/ship-worktrees.sh +0 -1646
  368. package/assets/templates/helpers/sprint-backlog.sh +0 -1229
  369. package/assets/templates/helpers/summarize-failures.sh +0 -125
  370. package/assets/templates/helpers/switch-plan.sh +0 -150
  371. package/assets/templates/helpers/sync-brain-docs.sh +0 -381
  372. package/assets/templates/helpers/validate-harness-profile-benchmark.ts +0 -39
  373. package/assets/templates/helpers/verification-plan.ts +0 -99
  374. package/assets/templates/helpers/verify-contract.sh +0 -40
  375. package/assets/templates/helpers/verify-sprint.sh +0 -40
  376. package/assets/templates/helpers/workflow-contract.ts +0 -304
  377. package/assets/templates/helpers/workstream-sync.sh +0 -297
  378. package/assets/templates/helpers/worktree-merge-lib.sh +0 -106
  379. package/dist/operator-ui/assets/ArchitectureWorkspace-D4OUgv7P.js +0 -1
  380. package/dist/operator-ui/assets/index-DAePh_VG.css +0 -2
  381. package/dist/operator-ui/assets/index-y71_oLs9.js +0 -18
  382. package/references/dot-pm-control.md +0 -140
  383. package/references/pm-operations.md +0 -111
  384. package/scripts/assemble-template.ts +0 -1146
  385. package/scripts/c9-collaboration-dispatch-runner.ts +0 -27
  386. package/scripts/check-brain-manifest.sh +0 -244
  387. package/scripts/check-pi-package-smoke.ts +0 -59
  388. package/scripts/contract-run.ts +0 -1010
  389. package/scripts/initializer-question-pack.ts +0 -177
  390. package/scripts/me2b-runtime-admission-canary.ts +0 -376
  391. package/scripts/new-sprint.sh +0 -50
  392. package/scripts/sync-brain-docs.sh +0 -381
  393. package/scripts/sync-hook-sources.ts +0 -277
  394. package/scripts/sync-pi-package.ts +0 -27
  395. package/src/cli/commands/collaboration.ts +0 -297
  396. package/src/cli/commands/delegation.ts +0 -241
  397. package/src/cli/commands/engineer.ts +0 -831
  398. package/src/cli/commands/hook.ts +0 -44
  399. package/src/cli/commands/interface-change.ts +0 -139
  400. package/src/cli/commands/pipeline.ts +0 -46
  401. package/src/cli/commands/pm.ts +0 -35
  402. package/src/cli/commands/prompt-guard-decision.ts +0 -240
  403. package/src/cli/commands/task-agent.ts +0 -66
  404. package/src/cli/commands/verified-context.ts +0 -141
  405. package/src/cli/hook/command-observed.ts +0 -289
  406. package/src/cli/hook/delegation-state.ts +0 -315
  407. package/src/cli/hook/minimal-change-cli.ts +0 -130
  408. package/src/cli/hook/minimal-change-context.ts +0 -60
  409. package/src/cli/hook/minimal-change-policy.ts +0 -192
  410. package/src/cli/hook/minimal-change-signals.ts +0 -637
  411. package/src/cli/hook/mutation-observed.ts +0 -731
  412. package/src/cli/hook/prompt-guard-decision.ts +0 -248
  413. package/src/cli/hook/prompt-handler.ts +0 -41
  414. package/src/cli/hook/prompt-intents.ts +0 -580
  415. package/src/cli/hook/prompt-router.ts +0 -75
  416. package/src/cli/hook/review-rubric.ts +0 -78
  417. package/src/cli/hook/review-subject.ts +0 -45
  418. package/src/cli/hook/run-identity.ts +0 -173
  419. package/src/cli/hook/subagent-handler.ts +0 -909
  420. package/src/cli/hook/task-inbox-handler.ts +0 -137
  421. package/src/cli/hook/trace-observer.ts +0 -209
  422. package/src/cli/mcp/collaboration-tools.ts +0 -333
  423. package/src/cli/mcp/engineer-tools.ts +0 -789
  424. package/src/cli/mcp/pm-server.ts +0 -168
  425. package/src/core/collaboration/admission.ts +0 -245
  426. package/src/core/collaboration/adoption.ts +0 -154
  427. package/src/core/collaboration/common.ts +0 -396
  428. package/src/core/collaboration/context-packet.ts +0 -601
  429. package/src/core/collaboration/contribution.ts +0 -444
  430. package/src/core/collaboration/handoff.ts +0 -376
  431. package/src/core/collaboration/hotspot.ts +0 -146
  432. package/src/core/collaboration/run-binding.ts +0 -263
  433. package/src/core/collaboration/signal.ts +0 -174
  434. package/src/core/collaboration/thread-projection.ts +0 -390
  435. package/src/core/collaboration/work-exchange.ts +0 -531
  436. package/src/core/engineers/automation-attempt.ts +0 -93
  437. package/src/core/engineers/delegation.ts +0 -761
  438. package/src/core/engineers/interface-change.ts +0 -578
  439. package/src/core/engineers/module-message.ts +0 -522
  440. package/src/core/engineers/task-freeze.ts +0 -235
  441. package/src/core/engineers/verified-context.ts +0 -722
  442. package/src/core/engineers/work-demand.ts +0 -393
  443. package/src/core/hook-work-budget.ts +0 -3
  444. package/src/core/loop/loop-event-protocol.ts +0 -248
  445. package/src/core/operator/collaboration-snapshot.ts +0 -304
  446. package/src/core/operator/decision-inventory.ts +0 -96
  447. package/src/core/pipeline/board.ts +0 -43
  448. package/src/core/pipeline/gates.ts +0 -32
  449. package/src/core/pipeline/health.ts +0 -53
  450. package/src/core/pipeline/projection.ts +0 -63
  451. package/src/core/pipeline/stage-machine.ts +0 -47
  452. package/src/core/pipeline/types.ts +0 -108
  453. package/src/core/pm/protocol.ts +0 -96
  454. package/src/core/state/sprint-schema-migration.ts +0 -249
  455. package/src/core/workflow/artifact-requirement-policy.ts +0 -182
  456. package/src/core/workflow/operation-readiness.ts +0 -289
  457. package/src/effects/collaboration/actor.ts +0 -167
  458. package/src/effects/collaboration/admission-bridge.ts +0 -410
  459. package/src/effects/collaboration/adoption-store.ts +0 -271
  460. package/src/effects/collaboration/agent-surface.ts +0 -547
  461. package/src/effects/collaboration/context-delivery.ts +0 -449
  462. package/src/effects/collaboration/contribution-collector.ts +0 -483
  463. package/src/effects/collaboration/contribution-store.ts +0 -118
  464. package/src/effects/collaboration/feature-flag.ts +0 -64
  465. package/src/effects/collaboration/handoff-store.ts +0 -260
  466. package/src/effects/collaboration/provider-output-adapter.ts +0 -281
  467. package/src/effects/collaboration/record-store.ts +0 -488
  468. package/src/effects/collaboration/signal-store.ts +0 -241
  469. package/src/effects/collaboration/succession.ts +0 -409
  470. package/src/effects/collaboration/work-exchange.ts +0 -410
  471. package/src/effects/engineers/acquire.ts +0 -222
  472. package/src/effects/engineers/automation-attempt-store.ts +0 -48
  473. package/src/effects/engineers/bound-task-rotation.ts +0 -30
  474. package/src/effects/engineers/delegated-run-store.ts +0 -1034
  475. package/src/effects/engineers/interface-change-store.ts +0 -487
  476. package/src/effects/engineers/module-inbox.ts +0 -770
  477. package/src/effects/engineers/principal-store.ts +0 -170
  478. package/src/effects/engineers/principal.ts +0 -76
  479. package/src/effects/engineers/scheduling-acquire-next.ts +0 -506
  480. package/src/effects/engineers/scheduling-acquire.ts +0 -181
  481. package/src/effects/engineers/task-freeze-store.ts +0 -429
  482. package/src/effects/engineers/task-inbox.ts +0 -65
  483. package/src/effects/engineers/verified-context-store.ts +0 -580
  484. package/src/effects/engineers/work-demand-materialization.ts +0 -62
  485. package/src/effects/engineers/work-demand-store.ts +0 -114
  486. package/src/effects/evidence/post-bash-importer.ts +0 -362
  487. package/src/effects/operator/collaboration-worker.ts +0 -59
  488. package/src/effects/operator/pipeline-status.ts +0 -15
  489. package/src/effects/pipeline/authority.ts +0 -141
  490. package/src/effects/pipeline/ingest.ts +0 -91
  491. package/src/effects/pipeline/ledger.ts +0 -179
  492. package/src/effects/pipeline/read.ts +0 -93
  493. package/src/effects/pipeline/store.ts +0 -292
  494. package/src/effects/pm/host.ts +0 -48
  495. package/src/effects/pm/operations.ts +0 -209
  496. package/src/effects/state/coordination-lease-reclaim.ts +0 -60
  497. package/src/effects/state/sprint-schema-migration.ts +0 -469
  498. package/src/effects/terminal/task-request-readback.ts +0 -79
  499. package/src/operator-web/PipelineBoard.tsx +0 -380
  500. package/src/pi/extension.ts +0 -214
  501. package/src/pi/hook-bridge.ts +0 -121
  502. package/src/pi/hook-protocol.ts +0 -37
package/AGENTS.md CHANGED
@@ -4,23 +4,33 @@
4
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
5
  - Keep root CLAUDE.md and AGENTS.md as standalone regular files; repeat shared rules in both and keep host-specific guidance separate.
6
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.
7
+ - Read `tasks/lessons.md` at session start and apply its active lessons. Current repo state and evidence override a lesson.
8
+ - Finish the main task first. Fix a small problem found on the way directly. For a large problem, open a GitHub issue before you work on it.
8
9
  - 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
10
  - Keep four hard boundaries: main publication, deletion, credentials/permissions, and release/production operations.
10
11
  - 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. Record authorized publication, the provider-confirmed merge SHA and parent SHA, `git revert <squash-commit>`, and the daily report. Do not create rollback tags.
11
- - Default task worktrees use `/tmp/<repo>-wt-<slug>` on POSIX. Native Windows uses `os.tmpdir()` as the root. Stored downstream templates stay unchanged. Commit or push work before a reboot or age-based tmp cleanup, such as `systemd-tmpfiles`. These cleaners can remove checkouts. Missing entries are pruned. The sweep saves missing registration identities before global prune. Later batches finish deferred branch cleanup. Unmerged branches remain.
12
- - Closeout removes a merged, clean checkout and its branch. It releases only that checkout's own canonical marker after merge proof under the topology lock. The sweep keeps dirty, locked, marked or leased worktrees. It keeps branch reflogs without a commit-creation message and missing or unreadable reflogs. Fast-forward, target-only automatic merges, reset and rebase-finish messages do not count. Dispatch must establish an unmerged commit or keep the worktree dirty, marked or leased. A merged, clean, unowned branch with its own commits can be swept.
13
- - `start` recovers only a real target directory registered by this clone on the expected branch, under the topology lock, with no lock or other owner. Recovery requires a current-user-owned checkout directory without group or other write access, a regular owned Git pointer, its matching admin backpointer, and the original directory identity saved by start. Git metadata can be group-writable but must not be other-writable. Start still creates a checkout when uid is unavailable; recovery then refuses. Exact removal retires the identity after Git readback. Missing identity or a replacement directory blocks recovery. Files, symlinks, unregistered paths and other branches are refused. Cleanup refuses a registered worktree whose branch is missing. MCP cleanup also refuses active markers and retained native verification evidence. Sweep reports name processed paths. Deferred entries are reported as counts. `kept` excludes deferred entries. A command timeout sends SIGTERM to the direct child only. A grandchild can briefly extend the deadline. No detached cleanup process starts. Herdr notifications accept registered default task worktrees and paths inside them. Other temporary paths and `rh-herdr-` labels stay filtered.
12
+ - Default worktrees are at `/tmp/<repo>-wt-<slug>` (Windows: `os.tmpdir()`). Commit or push before a reboot or a tmp cleanup.
13
+ - Closeout and sweep remove only merged, clean and unowned worktrees. To keep one, give it an unmerged commit, keep it dirty, or mark or lease it. Details: [agentic-development-flow](docs/reference-configs/agentic-development-flow.md).
14
14
  - 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.
15
- - Use gatekeeper/cross-model review for large changes, security/permissions, or unresolved model uncertainty; ordinary steps record diagnostics without approval loops.
15
+ - Select independent review by the diff's [Review by risk](docs/reference-configs/agentic-development-flow.md#review-by-risk) tier: none for low, one fresh-context review for medium, gatekeeper plus cross-model review for high; ordinary steps record diagnostics without approval loops.
16
16
  - When you delegate, investigate first, then split work by write ownership. Give each parallel writer its own worktree from a clean source. Implementation sub-agents edit only their scope. They do not run build, typecheck or tests. They commit early in their own worktree and return early. In a shared checkout they do not commit; the parent commits. Evidence roles run the named check that is their task and do not commit. The parent agent owns task management, conflict resolution, build, typecheck, tests and integration. After integration, the parent removes each sub-agent worktree and branch whose commits are in the task branch and whose checkout is clean. It also removes the intermediate build output and temporary files that the work created. Other deletion still needs the user.
17
- - Model division and cross-model dispatch/review follow [Herdr Dispatch](docs/reference-configs/external-tooling.md#herdr-dispatch).
17
+ - Model division and cross-model dispatch/review follow [Herdr Dispatch](docs/reference-configs/herdr-notify.md#herdr-dispatch).
18
18
  - 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.
19
19
  - 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).
20
20
  - `.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.
21
- - Preserve `agents/fleet/`, release checklists and downstream `assets/templates` / `assets/partials*`. `.ai/harness/workflow-contract.json` is the opt-in marker. `assets/workflow-contract.v1.json` is the contract.
21
+ - When a branch changes a capability's responsibility, entrypoints, relations or flows, run `repo-harness architecture-projection check --json` before review and follow `repo-harness-architecture` (`assets/skill-commands/repo-harness-architecture/references/worker.md`).
22
+ - Preserve `agents/fleet/`, release checklists and downstream `assets/templates`. `.ai/harness/workflow-contract.json` is the opt-in marker. `assets/workflow-contract.v1.json` is the contract.
22
23
  - `_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/`.
23
24
 
25
+ ## GitHub Issue Claims
26
+ - Before an agent starts work on a GitHub issue, read its current state, assignees and all comments through `gh` or the GitHub API. Use pagination for comments. Check existing work claims, linked PRs and handoff notes.
27
+ - An active claim is an assignee other than the current task owner, an open PR that links the issue, or an active claim comment that no later status comment released. If another agent or person has an active claim, do not start duplicate work. Coordinate with that owner within the authorized task scope. Take over only after an explicit handoff or user instruction. Silence, an old timestamp or a disconnected session does not release a claim.
28
+ - When taking an unclaimed issue or an approved handoff, post a claim comment before edits, tests or worker dispatch. Use `gh issue comment <issue-url> --body-file <file>`. This rule authorizes claim and status comments for an issue within the user's task scope. It grants no other GitHub write authority.
29
+ - Start the comment with `repo-harness issue claim`. Include `Status: active`, the agent kind and unique session or task ID, the branch, the work scope and any prior claim comment URL for a handoff. Use this identity in later status comments. A shared GitHub login is not an agent identity. Do not include secrets or private host paths.
30
+ - Read the issue comments again after posting. Confirm the published comment URL and body. If a competing claim appeared, stop duplicate work and resolve ownership before continuing. For simultaneous claims without an explicit assignment or handoff, the earliest GitHub comment wins; break timestamp ties by comment ID. These comments coordinate agents; they are not an atomic lock and do not replace canonical task claims or leases.
31
+ - On resume, check the current claim before continuing. Reuse the same active claim instead of posting it again. If a read or post fails, or delivery is uncertain, stop and report the failure. Read back before retrying an uncertain post.
32
+ - Post a status comment that links the claim when the work is blocked, ready for review, complete or released. Keep a blocked or review-pending claim active. Include the PR or result when available. Release ownership explicitly on cancellation or handoff. Do not close the issue unless the task authorizes closure.
33
+
24
34
  ## Code Optimization Principles
25
35
  - Identify observable conditions, controllable inputs, the invariant and the actual pressure point before changing structure.
26
36
  - Keep one source of truth for each datum; other representations are deterministic projections with drift checks.
@@ -31,10 +41,12 @@
31
41
  - Self-review before committing: remove dead code, empty branches and debug leftovers, and split functions by responsibility instead of one large block.
32
42
 
33
43
  ## Testing
34
- - Run `bun run check:type` plus tests covering the changed behavior once after the implementation is stable.
44
+ - Run `bun run check:type` for code changes and tests covering the changed behavior once after the implementation is stable. Development-time debugging can run focused checks before that final verification.
45
+ - For a bug fix, prefer a focused failing regression before the fix. Run only the reproducer during RED. Record a reproduction gap when the environment cannot produce it; ordinary tasks do not require RED artifacts.
46
+ - A diff's size, a new test file, a new agent or a rebase does not by itself require a full run.
35
47
  - Use `bun run test:files <affected tests> --timeout 60000 --max-concurrency 1`; extend existing coverage before creating a new test file.
36
48
  - Select tests by observable risk and owning runtime boundary, including error/recovery paths when affected.
37
- - Mechanical prose changes need link/scope validation, not new product tests; do not test incidental formatting.
49
+ - Mechanical prose changes need link/scope validation, not new product tests; do not test incidental formatting or that deleted files stay deleted.
38
50
  - Reviewers consume the recorded command, result, revision and environment; they do not rerun passing checks to claim ownership.
39
51
  - Changed inputs or a new uncovered failure justify affected delta checks; an old pass is only historical evidence for its old subject.
40
52
  - Run the full suite daily; a failure opens an automatic repair task and appears in the daily report.
@@ -52,9 +64,18 @@
52
64
  - On resume, verify the live checkout and source artifacts before reusing a result; `tasks/current.md` is an optional local read model.
53
65
  - Preserve dirty work and other workers' edits; hand back an ownership conflict instead of discarding their changes.
54
66
 
67
+ ## Writing
68
+ - Write output text (docs, PR descriptions, commit messages, reports, research notes) in ASD-STE100 Simplified Technical English: short sentences, one idea per sentence, active voice, approved-dictionary words. Write Chinese output the same way.
69
+ - Prefer high information density: evidence first, mechanisms and business effect explained, complex reasoning allowed, no explanatory repetition. Lead with the main finding, key number or key mechanism. State known facts and supported conclusions directly, without lead-ins such as "note that", "this shows to some extent" or "it must be stressed". Put the evidence grade in the wording, not in a separate caveat.
70
+ - Give time, subject, action, size and source in one sentence. Keep only the qualifiers that change the fact, the statistics or the inference. Keep text that explains a cause or mechanism, separates confounded causes, or builds a new classification.
71
+ - Delete: comments on your own process or work; a second explanation of a fact that already states its source, scope and meaning; "do not read this as" warnings; repeated disclaimers; step-by-step tutorials and hypothetical teaching examples; prose that repeats a comparison table; repeated summaries and claims about the importance of the result.
72
+ - A conclusion must add a cause, mechanism, constraint, testable prediction or business effect. A restatement of earlier facts is not a conclusion.
73
+ - Prefer real companies, products, contracts, prices and user behavior as examples. Use a table for multi-object or multi-metric comparison. Split sections by question; drop introductions, transitions and summaries that exist only for completeness.
74
+ - Paragraph deletion test: if removing a paragraph leaves the reader's understanding of facts, numbers, mechanism, cause, conditions and conclusion unchanged, remove it. Check first the paragraphs that start with "this shows", "note that", "therefore", "however" or "it must be stressed".
75
+
55
76
  ## Codex
56
77
  - Own backend implementation and testing; Claude owns frontend implementation and interaction, and the parent coordinates scope and integration.
57
- - 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. Operator helpers use the package path from `repo-harness hook-lib path`. This source repo keeps `.ai/hooks/lib/workflow-state.sh` for self-hosting.
78
+ - User-level `~/.codex/hooks.json` hooks invoke `repo-harness-hook`; its typed route registry selects one in-process handler. Operator helpers run from the package through `repo-harness run <helper>`.
58
79
  - 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.
59
80
  - The Codex automation profile requires runtime-provided `health`, `check` and `mermaid`; do not vendor their bodies.
60
81
  - Treat auto-compact as a fallback; prepare ignored `.ai/harness/handoff/current.md` and `resume.md` when long-task rollover is needed.
package/CLAUDE.md CHANGED
@@ -4,23 +4,33 @@
4
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
5
  - Keep root CLAUDE.md and AGENTS.md as standalone regular files; repeat shared rules in both and keep host-specific guidance separate.
6
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.
7
+ - Read `tasks/lessons.md` at session start and apply its active lessons. Current repo state and evidence override a lesson.
8
+ - Finish the main task first. Fix a small problem found on the way directly. For a large problem, open a GitHub issue before you work on it.
8
9
  - 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
10
  - Keep four hard boundaries: main publication, deletion, credentials/permissions, and release/production operations.
10
11
  - 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. Record authorized publication, the provider-confirmed merge SHA and parent SHA, `git revert <squash-commit>`, and the daily report. Do not create rollback tags.
11
- - Default task worktrees use `/tmp/<repo>-wt-<slug>` on POSIX. Native Windows uses `os.tmpdir()` as the root. Stored downstream templates stay unchanged. Commit or push work before a reboot or age-based tmp cleanup, such as `systemd-tmpfiles`. These cleaners can remove checkouts. Missing entries are pruned. The sweep saves missing registration identities before global prune. Later batches finish deferred branch cleanup. Unmerged branches remain.
12
- - Closeout removes a merged, clean checkout and its branch. It releases only that checkout's own canonical marker after merge proof under the topology lock. The sweep keeps dirty, locked, marked or leased worktrees. It keeps branch reflogs without a commit-creation message and missing or unreadable reflogs. Fast-forward, target-only automatic merges, reset and rebase-finish messages do not count. Dispatch must establish an unmerged commit or keep the worktree dirty, marked or leased. A merged, clean, unowned branch with its own commits can be swept.
13
- - `start` recovers only a real target directory registered by this clone on the expected branch, under the topology lock, with no lock or other owner. Recovery requires a current-user-owned checkout directory without group or other write access, a regular owned Git pointer, its matching admin backpointer, and the original directory identity saved by start. Git metadata can be group-writable but must not be other-writable. Start still creates a checkout when uid is unavailable; recovery then refuses. Exact removal retires the identity after Git readback. Missing identity or a replacement directory blocks recovery. Files, symlinks, unregistered paths and other branches are refused. Cleanup refuses a registered worktree whose branch is missing. MCP cleanup also refuses active markers and retained native verification evidence. Sweep reports name processed paths. Deferred entries are reported as counts. `kept` excludes deferred entries. A command timeout sends SIGTERM to the direct child only. A grandchild can briefly extend the deadline. No detached cleanup process starts. Herdr notifications accept registered default task worktrees and paths inside them. Other temporary paths and `rh-herdr-` labels stay filtered.
12
+ - Default worktrees are at `/tmp/<repo>-wt-<slug>` (Windows: `os.tmpdir()`). Commit or push before a reboot or a tmp cleanup.
13
+ - Closeout and sweep remove only merged, clean and unowned worktrees. To keep one, give it an unmerged commit, keep it dirty, or mark or lease it. Details: [agentic-development-flow](docs/reference-configs/agentic-development-flow.md).
14
14
  - 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.
15
- - Use gatekeeper/cross-model review for large changes, security/permissions, or unresolved model uncertainty; ordinary steps record diagnostics without approval loops.
15
+ - Select independent review by the diff's [Review by risk](docs/reference-configs/agentic-development-flow.md#review-by-risk) tier: none for low, one fresh-context review for medium, gatekeeper plus cross-model review for high; ordinary steps record diagnostics without approval loops.
16
16
  - When you delegate, investigate first, then split work by write ownership. Give each parallel writer its own worktree from a clean source. Implementation sub-agents edit only their scope. They do not run build, typecheck or tests. They commit early in their own worktree and return early. In a shared checkout they do not commit; the parent commits. Evidence roles run the named check that is their task and do not commit. The parent agent owns task management, conflict resolution, build, typecheck, tests and integration. After integration, the parent removes each sub-agent worktree and branch whose commits are in the task branch and whose checkout is clean. It also removes the intermediate build output and temporary files that the work created. Other deletion still needs the user.
17
- - Model division and cross-model dispatch/review follow [Herdr Dispatch](docs/reference-configs/external-tooling.md#herdr-dispatch).
17
+ - Model division and cross-model dispatch/review follow [Herdr Dispatch](docs/reference-configs/herdr-notify.md#herdr-dispatch).
18
18
  - 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.
19
19
  - 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).
20
20
  - `.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.
21
- - Preserve `agents/fleet/`, release checklists and downstream `assets/templates` / `assets/partials*`. `.ai/harness/workflow-contract.json` is the opt-in marker. `assets/workflow-contract.v1.json` is the contract.
21
+ - When a branch changes a capability's responsibility, entrypoints, relations or flows, run `repo-harness architecture-projection check --json` before review and follow `repo-harness-architecture` (`assets/skill-commands/repo-harness-architecture/references/worker.md`).
22
+ - Preserve `agents/fleet/`, release checklists and downstream `assets/templates`. `.ai/harness/workflow-contract.json` is the opt-in marker. `assets/workflow-contract.v1.json` is the contract.
22
23
  - `_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/`.
23
24
 
25
+ ## GitHub Issue Claims
26
+ - Before an agent starts work on a GitHub issue, read its current state, assignees and all comments through `gh` or the GitHub API. Use pagination for comments. Check existing work claims, linked PRs and handoff notes.
27
+ - An active claim is an assignee other than the current task owner, an open PR that links the issue, or an active claim comment that no later status comment released. If another agent or person has an active claim, do not start duplicate work. Coordinate with that owner within the authorized task scope. Take over only after an explicit handoff or user instruction. Silence, an old timestamp or a disconnected session does not release a claim.
28
+ - When taking an unclaimed issue or an approved handoff, post a claim comment before edits, tests or worker dispatch. Use `gh issue comment <issue-url> --body-file <file>`. This rule authorizes claim and status comments for an issue within the user's task scope. It grants no other GitHub write authority.
29
+ - Start the comment with `repo-harness issue claim`. Include `Status: active`, the agent kind and unique session or task ID, the branch, the work scope and any prior claim comment URL for a handoff. Use this identity in later status comments. A shared GitHub login is not an agent identity. Do not include secrets or private host paths.
30
+ - Read the issue comments again after posting. Confirm the published comment URL and body. If a competing claim appeared, stop duplicate work and resolve ownership before continuing. For simultaneous claims without an explicit assignment or handoff, the earliest GitHub comment wins; break timestamp ties by comment ID. These comments coordinate agents; they are not an atomic lock and do not replace canonical task claims or leases.
31
+ - On resume, check the current claim before continuing. Reuse the same active claim instead of posting it again. If a read or post fails, or delivery is uncertain, stop and report the failure. Read back before retrying an uncertain post.
32
+ - Post a status comment that links the claim when the work is blocked, ready for review, complete or released. Keep a blocked or review-pending claim active. Include the PR or result when available. Release ownership explicitly on cancellation or handoff. Do not close the issue unless the task authorizes closure.
33
+
24
34
  ## Code Optimization Principles
25
35
  - Identify observable conditions, controllable inputs, the invariant and the actual pressure point before changing structure.
26
36
  - Keep one source of truth for each datum; other representations are deterministic projections with drift checks.
@@ -31,10 +41,12 @@
31
41
  - Self-review before committing: remove dead code, empty branches and debug leftovers, and split functions by responsibility instead of one large block.
32
42
 
33
43
  ## Testing
34
- - Run `bun run check:type` plus tests covering the changed behavior once after the implementation is stable.
44
+ - Run `bun run check:type` for code changes and tests covering the changed behavior once after the implementation is stable. Development-time debugging can run focused checks before that final verification.
45
+ - For a bug fix, prefer a focused failing regression before the fix. Run only the reproducer during RED. Record a reproduction gap when the environment cannot produce it; ordinary tasks do not require RED artifacts.
46
+ - A diff's size, a new test file, a new agent or a rebase does not by itself require a full run.
35
47
  - Use `bun run test:files <affected tests> --timeout 60000 --max-concurrency 1`; extend existing coverage before creating a new test file.
36
48
  - Select tests by observable risk and owning runtime boundary, including error/recovery paths when affected.
37
- - Mechanical prose changes need link/scope validation, not new product tests; do not test incidental formatting.
49
+ - Mechanical prose changes need link/scope validation, not new product tests; do not test incidental formatting or that deleted files stay deleted.
38
50
  - Reviewers consume the recorded command, result, revision and environment; they do not rerun passing checks to claim ownership.
39
51
  - Changed inputs or a new uncovered failure justify affected delta checks; an old pass is only historical evidence for its old subject.
40
52
  - Run the full suite daily; a failure opens an automatic repair task and appears in the daily report.
@@ -52,9 +64,18 @@
52
64
  - On resume, verify the live checkout and source artifacts before reusing a result; `tasks/current.md` is an optional local read model.
53
65
  - Preserve dirty work and other workers' edits; hand back an ownership conflict instead of discarding their changes.
54
66
 
67
+ ## Writing
68
+ - Write output text (docs, PR descriptions, commit messages, reports, research notes) in ASD-STE100 Simplified Technical English: short sentences, one idea per sentence, active voice, approved-dictionary words. Write Chinese output the same way.
69
+ - Prefer high information density: evidence first, mechanisms and business effect explained, complex reasoning allowed, no explanatory repetition. Lead with the main finding, key number or key mechanism. State known facts and supported conclusions directly, without lead-ins such as "note that", "this shows to some extent" or "it must be stressed". Put the evidence grade in the wording, not in a separate caveat.
70
+ - Give time, subject, action, size and source in one sentence. Keep only the qualifiers that change the fact, the statistics or the inference. Keep text that explains a cause or mechanism, separates confounded causes, or builds a new classification.
71
+ - Delete: comments on your own process or work; a second explanation of a fact that already states its source, scope and meaning; "do not read this as" warnings; repeated disclaimers; step-by-step tutorials and hypothetical teaching examples; prose that repeats a comparison table; repeated summaries and claims about the importance of the result.
72
+ - A conclusion must add a cause, mechanism, constraint, testable prediction or business effect. A restatement of earlier facts is not a conclusion.
73
+ - Prefer real companies, products, contracts, prices and user behavior as examples. Use a table for multi-object or multi-metric comparison. Split sections by question; drop introductions, transitions and summaries that exist only for completeness.
74
+ - Paragraph deletion test: if removing a paragraph leaves the reader's understanding of facts, numbers, mechanism, cause, conditions and conclusion unchanged, remove it. Check first the paragraphs that start with "this shows", "note that", "therefore", "however" or "it must be stressed".
75
+
55
76
  ## Claude Code
56
77
  - Own frontend implementation and interaction; Codex owns backend implementation and testing, and the parent coordinates scope and integration.
57
78
  - Use Claude Code's available tools within granted permissions; changes to tool grants, hooks or confirmation bypass require approval of the exact change.
58
- - 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. Operator helpers use the package path from `repo-harness hook-lib path`. This source repo keeps `.ai/hooks/lib/workflow-state.sh` for self-hosting.
79
+ - User-level `~/.claude/settings.json` hooks invoke `repo-harness-hook`; its typed route registry selects one in-process handler. Operator helpers run from the package through `repo-harness run <helper>`.
59
80
  - Write comments, commits and PR text from the final diff; comments explain non-obvious reasons, and PRs describe final behavior and material rationale.
60
81
  - 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.