repo-harness 0.29.2 → 0.31.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 (331) hide show
  1. package/AGENTS.md +2 -2
  2. package/CLAUDE.md +2 -2
  3. package/README.md +1 -1
  4. package/assets/herdr/github-events/filter.mjs +2 -1
  5. package/assets/reference-configs/agentic-development-flow.md +2 -3
  6. package/assets/reference-configs/design-options.md +3 -1
  7. package/assets/reference-configs/document-generation.md +2 -2
  8. package/assets/reference-configs/external-tooling.md +11 -10
  9. package/assets/reference-configs/global-working-rules.md +7 -1
  10. package/assets/reference-configs/heartbeat-triage.md +2 -3
  11. package/assets/reference-configs/herdr-notify.md +13 -8
  12. package/assets/reference-configs/hook-operations.md +7 -8
  13. package/assets/reference-configs/host-invariants.md +15 -15
  14. package/assets/reference-configs/minimal-change-hooks.md +3 -6
  15. package/assets/reference-configs/release-deploy.md +95 -29
  16. package/assets/reference-configs/ux-feature-guard.md +3 -1
  17. package/assets/review-high-list.v1.json +1 -1
  18. package/assets/skill-commands/manifest.json +57 -0
  19. package/assets/skill-commands/repo-harness-architecture/references/worker.md +1 -1
  20. package/assets/skill-commands/repo-harness-ship/references/worker.md +2 -2
  21. package/assets/skill-version.json +2 -2
  22. package/assets/skills/repo-harness-advisor/SKILL.md +77 -0
  23. package/assets/skills/repo-harness-archimap/SKILL.md +4 -2
  24. package/assets/skills/repo-harness-archimap/references/visual-language.md +21 -0
  25. package/assets/skills/repo-harness-archimap/scripts/measure.ts +215 -0
  26. package/assets/skills/repo-harness-issue-flow/SKILL.md +37 -11
  27. package/assets/skills/repo-harness-issue-flow/references/acceptor.md +21 -33
  28. package/assets/skills/repo-harness-issue-flow/references/advisor.md +114 -0
  29. package/assets/skills/repo-harness-issue-flow/references/board.md +24 -29
  30. package/assets/skills/repo-harness-issue-flow/references/events.md +5 -1
  31. package/assets/skills/repo-harness-issue-flow/references/orchestrator.md +171 -129
  32. package/assets/skills/repo-harness-issue-flow/references/replan.md +4 -6
  33. package/assets/skills/repo-harness-issue-flow/references/templates.md +34 -78
  34. package/assets/skills/repo-harness-issue-flow/references/worker.md +11 -5
  35. package/assets/skills/repo-harness-orchestrator/SKILL.md +61 -0
  36. package/assets/skills/repo-harness-product/references/prd.md +4 -3
  37. package/assets/skills/repo-harness-seat-handoff/SKILL.md +25 -0
  38. package/assets/skills/repo-harness-test/references/authoring.md +10 -10
  39. package/assets/skills/repo-harness-test/references/refactor-evidence.md +1 -1
  40. package/assets/skills/repo-harness-test/references/running.md +3 -3
  41. package/assets/skills/repo-harness-test/references/verification-plan.md +1 -1
  42. package/assets/templates/helpers/capability-resolver.ts +451 -43
  43. package/assets/templates/runtime-state.gitignore +37 -0
  44. package/assets/templates/runtime.gitignore +1 -37
  45. package/assets/workflow-contract.v1.json +50 -13
  46. package/dist/hook-entry.js +652 -450
  47. package/dist/oar-review-host.js +206 -68
  48. package/package.json +3 -4
  49. package/scripts/capability-config.ts +5 -23
  50. package/scripts/check-ci.sh +51 -12
  51. package/scripts/check-state-boundaries.ts +0 -4
  52. package/scripts/check-tarball-install-smoke.sh +1 -1
  53. package/scripts/ci-documentation-consumers.ts +1 -1
  54. package/scripts/contract-worktree-runtime.ts +3 -3
  55. package/scripts/contract-worktree.sh +4 -5
  56. package/scripts/cutover-closure.ts +0 -1
  57. package/scripts/inspect-project-state.ts +0 -21
  58. package/scripts/new-spec.sh +4 -24
  59. package/scripts/release-owner-steps.sh +44 -11
  60. package/scripts/replay-ci-coverage.ts +2 -1
  61. package/scripts/report-ci.ts +29 -61
  62. package/scripts/run-skill-routing-eval.ts +3 -4
  63. package/scripts/select-ci-coverage.ts +56 -29
  64. package/scripts/select-test-suite.ts +83 -20
  65. package/scripts/sync-helper-sources.ts +8 -0
  66. package/src/cli/commands/adoption-plan.ts +1 -4
  67. package/src/cli/commands/board.ts +14 -16
  68. package/src/cli/commands/brain.ts +14 -17
  69. package/src/cli/commands/candidate-reconciliation.ts +6 -17
  70. package/src/cli/commands/capability-context.ts +10 -33
  71. package/src/cli/commands/docs.ts +13 -7
  72. package/src/cli/commands/global-runtime.ts +50 -9
  73. package/src/cli/commands/herdr-skill.ts +4 -8
  74. package/src/cli/commands/init-hook.ts +2 -5
  75. package/src/cli/commands/init.ts +0 -8
  76. package/src/cli/commands/operator.ts +0 -2
  77. package/src/cli/commands/publication.ts +3 -19
  78. package/src/cli/commands/quota.ts +3 -2
  79. package/src/cli/commands/review.ts +2 -1
  80. package/src/cli/commands/seats.ts +109 -33
  81. package/src/cli/commands/security.ts +20 -22
  82. package/src/cli/commands/status.ts +2 -10
  83. package/src/cli/commands/upgrade-registered.ts +12 -11
  84. package/src/cli/commands/upgrade.ts +3 -28
  85. package/src/cli/hook/agent-notice.ts +21 -11
  86. package/src/cli/hook/handler-registry.ts +2 -2
  87. package/src/cli/index.ts +10 -7
  88. package/src/cli/installer/global-context.ts +2 -4
  89. package/src/cli/installer/install-profile.ts +21 -24
  90. package/src/cli/installer/install-state.ts +1 -4
  91. package/src/cli/installer/managed-entries.ts +3 -5
  92. package/src/cli/installer/uninstall.ts +16 -1
  93. package/src/cli/installer/waza-rules.ts +1 -1
  94. package/src/cli/mcp/audit.ts +2 -2
  95. package/src/cli/mcp/auth.ts +8 -10
  96. package/src/cli/mcp/doctor.ts +2 -6
  97. package/src/cli/mcp/fleet-tools.ts +5 -33
  98. package/src/cli/mcp/general-repo-access/authority.ts +7 -29
  99. package/src/cli/mcp/general-repo-access.ts +59 -85
  100. package/src/cli/mcp/guarded-write.ts +4 -6
  101. package/src/cli/mcp/local-config-check.ts +30 -0
  102. package/src/cli/mcp/paths.ts +17 -9
  103. package/src/cli/mcp/reader-tools.ts +12 -54
  104. package/src/cli/mcp/repo.ts +2 -5
  105. package/src/cli/mcp/result.ts +27 -0
  106. package/src/cli/mcp/server.ts +1 -3
  107. package/src/cli/mcp/tools.ts +20 -54
  108. package/src/cli/mcp/workspaces.ts +6 -12
  109. package/src/cli/tools/codegraph-reader.ts +3 -11
  110. package/src/cli/tools/codegraph.ts +0 -4
  111. package/src/core/adoption/modes.ts +0 -4
  112. package/src/core/adoption/render.ts +3 -7
  113. package/src/core/architecture/projection.ts +19 -1
  114. package/src/core/board/attention-delivery.ts +54 -11
  115. package/src/core/board/attention.ts +296 -32
  116. package/src/core/board/board.ts +210 -80
  117. package/src/core/board/dependency-migration.ts +2 -2
  118. package/src/core/board/desk.ts +1 -19
  119. package/src/core/board/dispatch.ts +10 -20
  120. package/src/core/board/hazards.ts +2 -5
  121. package/src/core/board/merge.ts +13 -4
  122. package/src/core/board/parents.ts +52 -40
  123. package/src/core/board/plan-block.ts +7 -20
  124. package/src/core/board/quota.ts +3 -1
  125. package/src/core/board/review.ts +28 -9
  126. package/src/core/board/seat-launch.ts +11 -11
  127. package/src/core/board/seat-reset.ts +15 -3
  128. package/src/core/board/seat-routing.ts +48 -10
  129. package/src/core/board/seats-settings.ts +15 -6
  130. package/src/core/board/source.ts +282 -58
  131. package/src/core/capabilities/resolver.ts +2 -9
  132. package/src/core/ci/documentation-path.ts +33 -0
  133. package/src/core/dev-activity/decode.ts +2 -10
  134. package/src/core/evidence/byte-compare.ts +7 -0
  135. package/src/core/evidence/canonical-json.ts +23 -19
  136. package/src/core/evidence/checkpoint.ts +1 -5
  137. package/src/core/evidence/decode-readers.ts +31 -0
  138. package/src/core/evidence/error-message.ts +7 -0
  139. package/src/core/evidence/fold.ts +3 -5
  140. package/src/core/evidence/idempotency.ts +2 -3
  141. package/src/core/evidence/is-record.ts +8 -0
  142. package/src/core/evidence/record-validators.ts +36 -0
  143. package/src/core/evidence/redaction.ts +2 -2
  144. package/src/core/evidence/required-check-evidence.ts +6 -35
  145. package/src/core/evidence/sha256-pattern.ts +6 -0
  146. package/src/core/evidence/sha256.ts +15 -0
  147. package/src/core/evidence/test-execution-evidence.ts +0 -5
  148. package/src/core/evidence/types.ts +0 -8
  149. package/src/core/evidence/verification-plan.ts +9 -18
  150. package/src/core/fleet/admitted-task-message.ts +29 -59
  151. package/src/core/fleet/task-inbox-layout.ts +0 -1
  152. package/src/core/fleet/task-message.ts +52 -85
  153. package/src/core/messages/mechanics.ts +21 -14
  154. package/src/core/messages/task-message-claim.ts +2 -2
  155. package/src/core/operator/agent-config.ts +2 -252
  156. package/src/core/operator/architecture-map.ts +7 -6
  157. package/src/core/operator/board-read.ts +2 -2
  158. package/src/core/operator/bot-access.ts +6 -6
  159. package/src/core/operator/notify-status.ts +0 -2
  160. package/src/core/operator/runtime-capture.ts +0 -1
  161. package/src/core/operator/slack-review.ts +2 -7
  162. package/src/core/operator/tests.ts +4 -2
  163. package/src/core/operator/worktree-cleanup-observation.ts +15 -0
  164. package/src/core/operator/worktree-cleanup-plan.ts +3 -5
  165. package/src/core/publication/acceptance-merge-policy.ts +1 -1
  166. package/src/core/publication/feedback.ts +6 -8
  167. package/src/core/publication/generated-artifacts.ts +2 -13
  168. package/src/core/publication/merge-readiness.ts +45 -71
  169. package/src/core/publication/publication-receipt.ts +3 -13
  170. package/src/core/publication/required-check-coverage.ts +2 -31
  171. package/src/core/review/acceptance-receipt.ts +18 -51
  172. package/src/core/review/authority-context.ts +7 -7
  173. package/src/core/review/change-assessment.ts +20 -28
  174. package/src/core/review/check-records.ts +4 -2
  175. package/src/core/review/control-delegation.ts +3 -11
  176. package/src/core/review/model-family.ts +17 -0
  177. package/src/core/review/module-review-prompt.ts +3 -4
  178. package/src/core/review/review-publish.ts +8 -8
  179. package/src/core/setup/cli-inventory.ts +3 -18
  180. package/src/core/setup/decode.ts +2 -12
  181. package/src/core/shell-quote.ts +4 -0
  182. package/src/core/skill-surface/catalog.ts +4 -8
  183. package/src/core/state/project-continuation-envelope.ts +2 -2
  184. package/src/core/state/project-effective-state.ts +3 -3
  185. package/src/core/terminal/herdr-core-pin.json +11 -11
  186. package/src/core/tools/catalog.ts +2 -10
  187. package/src/core/workflow/policy-schema.ts +163 -0
  188. package/src/core/worktree-location.d.mts +0 -1
  189. package/src/core/worktree-location.mjs +1 -1
  190. package/src/effects/admission/admission-store.ts +10 -11
  191. package/src/effects/admission/issue-goal.ts +3 -13
  192. package/src/effects/adoption/gitignore-plan.ts +67 -1
  193. package/src/effects/adoption/standard-plan.ts +32 -233
  194. package/src/effects/architecture/archcontext-owners.ts +1 -4
  195. package/src/effects/architecture/archcontext-resolve-cache.ts +2 -1
  196. package/src/effects/architecture/archctx-provider.ts +9 -6
  197. package/src/effects/architecture/architecture-read.ts +1 -4
  198. package/src/effects/architecture/capability-resolver.ts +18 -7
  199. package/src/effects/architecture/model-reader.ts +8 -7
  200. package/src/effects/artifact-retention.ts +16 -18
  201. package/src/effects/atomic-append.ts +43 -5
  202. package/src/effects/board/attention-watch.ts +48 -15
  203. package/src/effects/board/collect.ts +263 -53
  204. package/src/effects/board/dispatch.ts +2 -13
  205. package/src/effects/board/keyed-sources.ts +147 -0
  206. package/src/effects/board/parents.ts +5 -12
  207. package/src/effects/board/pi-fleet-roles.ts +2 -2
  208. package/src/effects/board/pi-shell.ts +70 -0
  209. package/src/effects/board/review.ts +19 -24
  210. package/src/effects/board/seat-reset.ts +57 -8
  211. package/src/effects/board/seats-configuration.ts +1 -0
  212. package/src/effects/board/seats.ts +3 -19
  213. package/src/effects/configuration/global-configuration.ts +2 -2
  214. package/src/effects/dev-activity/collector.ts +19 -27
  215. package/src/effects/evidence/attested-import.ts +1 -5
  216. package/src/effects/evidence/blob-store.ts +3 -33
  217. package/src/effects/evidence/checkpoint-store.ts +6 -9
  218. package/src/effects/evidence/eval-catalog.ts +4 -7
  219. package/src/effects/evidence/event-writer.ts +1 -5
  220. package/src/effects/evidence/verification-execution.ts +26 -49
  221. package/src/effects/fleet/provider-feedback.ts +5 -3
  222. package/src/effects/fleet/task-inbox-layout-migration.ts +16 -16
  223. package/src/effects/fleet/task-inbox-layout.ts +1 -8
  224. package/src/effects/fleet/task-inbox.ts +5 -32
  225. package/src/effects/fs-transaction.ts +3 -6
  226. package/src/effects/git/managed-worktree.ts +2 -10
  227. package/src/effects/git/repository-identity.ts +1 -5
  228. package/src/effects/git/run-git.ts +6 -3
  229. package/src/effects/git/runner.ts +242 -28
  230. package/src/effects/git/worktree-record.ts +3 -2
  231. package/src/effects/github/policy.ts +10 -8
  232. package/src/effects/locking/exclusive-directory-lock.ts +34 -15
  233. package/src/effects/locking/host-test-queue.ts +3 -11
  234. package/src/effects/locking/process-start-time.ts +58 -18
  235. package/src/effects/locking/runtime-transaction-lock.ts +5 -18
  236. package/src/effects/observation-loop.ts +194 -0
  237. package/src/effects/operator/architecture-map-collector.ts +40 -46
  238. package/src/effects/operator/architecture-map-worker.ts +13 -5
  239. package/src/effects/operator/board-observer-worker.ts +92 -0
  240. package/src/effects/operator/board-observer.ts +603 -0
  241. package/src/effects/operator/board-read.ts +6 -49
  242. package/src/effects/operator/bot-access.ts +17 -27
  243. package/src/effects/operator/docs-collector.ts +23 -36
  244. package/src/effects/operator/docs-reader.ts +3 -7
  245. package/src/effects/operator/execution-collector.ts +24 -42
  246. package/src/effects/operator/execution-state.ts +2 -2
  247. package/src/effects/operator/notify-collector.ts +18 -24
  248. package/src/effects/operator/runtime-source.ts +1 -4
  249. package/src/effects/operator/server.ts +52 -155
  250. package/src/effects/operator/slack-review-collector.ts +27 -33
  251. package/src/effects/operator/task-read-process.ts +1 -19
  252. package/src/effects/operator/tests-collector.ts +21 -38
  253. package/src/effects/operator/worktree-cleanup-archive.ts +11 -13
  254. package/src/effects/operator/worktree-cleanup-investigation.ts +3 -2
  255. package/src/effects/operator/worktree-cleanup-observation.ts +56 -9
  256. package/src/effects/operator/worktree-cleanup-plan.ts +5 -7
  257. package/src/effects/operator/worktree-cleanup-publish.ts +64 -2
  258. package/src/effects/operator/worktree-cleanup-removal.ts +2 -2
  259. package/src/effects/operator/worktree-cleanup-route.ts +4 -4
  260. package/src/effects/operator/worktree-cleanup-store.ts +3 -5
  261. package/src/effects/operator/worktree-cleanup.ts +2 -2
  262. package/src/effects/operator/worktree-collector.ts +21 -16
  263. package/src/effects/operator/write-run.ts +3 -3
  264. package/src/effects/path-containment.ts +11 -0
  265. package/src/effects/process-group-registry.ts +2 -11
  266. package/src/effects/process-group-termination.ts +3 -10
  267. package/src/effects/process-supervisor.ts +14 -12
  268. package/src/effects/publication/draft-pull-request.ts +3 -2
  269. package/src/effects/publication/feedback-store.ts +8 -37
  270. package/src/effects/publication/generated-artifacts.ts +1 -4
  271. package/src/effects/publication/merge-executor.ts +214 -154
  272. package/src/effects/publication/merge-readiness.ts +76 -59
  273. package/src/effects/repo-registry.ts +32 -51
  274. package/src/effects/review/acceptance-receipt.ts +17 -22
  275. package/src/effects/review/diff-fingerprint.ts +11 -177
  276. package/src/effects/review/generic-review.ts +1 -1
  277. package/src/effects/review/review-isolation.ts +2 -2
  278. package/src/effects/review/review-publish.ts +39 -8
  279. package/src/effects/review-runner/task-oar-host.ts +4 -3
  280. package/src/effects/review-runner/task-pre-prompt-inbox-consumer.ts +2 -2
  281. package/src/effects/runtime/helper-runner.ts +1 -1
  282. package/src/effects/runtime/protected-helper-platform.ts +1 -4
  283. package/src/effects/setup/cli-inventory.ts +25 -38
  284. package/src/effects/setup/collector.ts +30 -44
  285. package/src/effects/skill-tree-integrity.ts +2 -1
  286. package/src/effects/state/collect-state-inputs.ts +3 -7
  287. package/src/effects/state/coordination-worktree-topology.ts +17 -14
  288. package/src/effects/state/policy-file.ts +27 -0
  289. package/src/effects/state/pruned-worktree-intents.ts +3 -7
  290. package/src/effects/state/resolve-effective-state.ts +58 -88
  291. package/src/effects/state/worktree-trash.ts +4 -3
  292. package/src/effects/strategy/context.ts +2 -2
  293. package/src/effects/terminal/herdr-core.ts +56 -32
  294. package/src/effects/terminal/native-task-session.ts +2 -2
  295. package/src/effects/terminal/task-session-admission.ts +2 -2
  296. package/src/effects/terminal/task-session-record.ts +3 -2
  297. package/src/effects/terminal/task-session.ts +3 -6
  298. package/src/effects/upgrade/legacy-inventory.ts +20 -24
  299. package/src/effects/upgrade/operator-decisions.ts +2 -2
  300. package/src/pi/hook-bridge.ts +0 -2
  301. package/scripts/test-file-durations.json +0 -208
  302. package/src/cli/commands/doc-sessions-actions.ts +0 -89
  303. package/src/cli/commands/doc-sessions.ts +0 -36
  304. package/src/cli/tty-prompt.ts +0 -25
  305. package/src/core/board/summary.ts +0 -157
  306. package/src/core/operator/doc-citation.ts +0 -105
  307. package/src/core/operator/doc-session-agent-record.ts +0 -26
  308. package/src/core/operator/doc-session-changes.ts +0 -191
  309. package/src/core/operator/doc-session-events.ts +0 -197
  310. package/src/core/operator/doc-session-finalization-view.ts +0 -44
  311. package/src/core/operator/doc-session-finalize.ts +0 -42
  312. package/src/core/operator/doc-session-record.ts +0 -58
  313. package/src/core/operator/doc-session-views.ts +0 -99
  314. package/src/core/sessions/session-selector.ts +0 -5
  315. package/src/effects/board/merge-only-sync.ts +0 -118
  316. package/src/effects/operator/board-summary.ts +0 -51
  317. package/src/effects/operator/doc-session-changes.ts +0 -431
  318. package/src/effects/operator/doc-session-events.ts +0 -198
  319. package/src/effects/operator/doc-session-finalization-view.ts +0 -12
  320. package/src/effects/operator/doc-session-finalize-github.ts +0 -70
  321. package/src/effects/operator/doc-session-finalize-scope.ts +0 -40
  322. package/src/effects/operator/doc-session-finalize.ts +0 -400
  323. package/src/effects/operator/doc-session-views.ts +0 -131
  324. package/src/effects/operator/doc-session.ts +0 -277
  325. package/src/effects/operator/task-diff.ts +0 -23
  326. package/src/effects/publication/batch-build.ts +0 -478
  327. package/src/effects/review/docs-host-isolation.ts +0 -312
  328. package/src/effects/review/docs-host-proxy.ts +0 -162
  329. package/src/effects/sessions/admitted-source.ts +0 -22
  330. package/src/effects/state/canonical-target.ts +0 -36
  331. package/src/effects/upgrade/worktree-template-migration.ts +0 -141
package/AGENTS.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ## Workflow
4
4
  - Multi-agent work follows `repo-harness-issue-flow` (`assets/skills/repo-harness-issue-flow/SKILL.md`): roles, claims, handoff, dispatch, acceptance and merge.
5
5
  - `docs/architecture/archimap.html` is the single architecture entry. It links each module to its archctx-projected capability doc in `docs/architecture/modules/`. Change boundaries only through `repo-harness-architecture`; do not hand-write other architecture docs.
6
- - The owner keeps every security decision (owner, 2026-11-09, #2008): credentials, tokens and secrets, and each change that reads, moves or exposes them; permissions (seat tool grants, network access, sandbox settings, hooks, confirmation bypass); the safety net (branch protection, `publication.acceptance_merge`, force push to main, the `Required / CI` definition); deletion that git cannot restore (unpushed commits, dirty worktrees, owner files outside a repository such as `~/.repo-harness`, `~/.claude` or `~/.codex` without a backup); and production: `npm publish` (owner npm 2FA), the release tag, the GitHub Release and each production deployment. A production deployment needs an explicit owner authorization for that deployment; no standing GO and no joint decision covers it. The life cycle goes as far as the release PR (prep, version and CHANGELOG commits, push, checks, merge by rule 2). A staging or test deployment (scratch-HOME tarball install, release dry run, prerelease environment, Windows test box) is a joint decision.
6
+ - The owner keeps every security decision (owner, 2026-11-09, #2008): credentials, tokens and secrets, and each change that reads, moves or exposes them; permissions (seat tool grants, network access, sandbox settings, hooks (changes to hook behavior or hook configuration; a change under `src/cli/hook/**` that changes neither takes the High review rule: two PASS rows, one different-family), confirmation bypass); the safety net (branch protection, `publication.acceptance_merge`, force push to main, the `Required / CI` definition); deletion that git cannot restore (unpushed commits, dirty worktrees, owner files outside a repository such as `~/.repo-harness`, `~/.claude` or `~/.codex` without a backup); and production: the owner's approval of the `release` environment run of `release.yml` (it publishes to npm), the release tag, the GitHub Release and each production deployment. A production deployment needs an explicit owner authorization for that deployment; no standing GO and no joint decision covers it. The life cycle goes as far as the release PR (prep, version and CHANGELOG commits, push, checks, merge by rule 2). A staging or test deployment (scratch-HOME tarball install, release dry run, prerelease environment, Windows test box) is a joint decision.
7
7
  - Main publication is allowed only when `publication.acceptance_merge` is `on` in the policy on the PR base, and the current task explicitly authorizes main publication, or rule 2 or rule 3 applies; the skill defines who merges. Push needs task authorization. An explicit no-merge instruction that reaches a seat locally (task or pane) always wins; a no-merge comment is a reference under rule (8). Life-cycle rules (owner, 2026-11-09, #2008): (1) A fix loop continues after round 3 without the owner while each round has fewer blocking findings (P0-P2) than the round before and the scope does not grow. A grown scope is a joint decision. A new P0 finding, or a new P1 finding about security, secrets, data or authentication, stops the loop at the owner; any other new P1 finding does not stop it. Round 5 is the hard stop. (2) In an owner-approved batch, a Medium or High PR merges when its acceptance record is PASS for the head, `Required / CI` passed and each review-bot comment has a response; a High PR also needs its cross-model review PASS; a Low PR that meets the Low accept-seat skip merges on `Required / CI` and its verification evidence, with no acceptance record; each PR body keeps its rollback line (a `git revert` of the squash commit unless it states another). (3) The rolling projection PR (`archctx/projection`) merges on green CI; its merge is its acceptance. (4) An owner decision that the receiving seat posts on the issue or PR authorizes the other seats, with no second confirmation in another pane. A comment is a record: a local seat writes it, and a locally run command may read it as data; it never starts an action. (5) After the owner approves a batch parent and its plan comment, the plan's issues dispatch in plan order; a new issue or a changed order goes to the owner or to rule 7. (6) The GitHub setting "Automatically delete head branches" deletes merged head branches only. (7) The orchestrator and the advisor make a decision that otherwise goes to the owner when both agree, unless it touches security; before the action they post it on the owning issue or PR as `Joint decision (orchestrator + advisor)` with the reason. Both seats run the same model family, so a joint decision never replaces the High-tier cross-model review. (8) Any participant, the owner account included, may post "stop" or "no" on the issue or PR. It is a reference: the orchestrator and the advisor weigh it, decide locally by joint decision and record the decision. The owner's own authorization reaches a seat locally.
8
8
  - The diff's [Review by risk](docs/reference-configs/agentic-development-flow.md#review-by-risk) tier selects independent review; the skill defines the reviewers and their model families. Changing implementation and test assertions together does not raise the tier.
9
9
  - Create task worktrees only at `/tmp/<repo>-wt-<slug>` (Windows: `os.tmpdir()`) with `repo-harness run contract-worktree start --issue <number>`, or `git worktree add` with that path. Never create one beside the main checkout (`../`). Commit or push before a reboot or a tmp cleanup. Closeout and sweep remove only merged, clean and unowned worktrees; to keep one, give it an unmerged commit, keep it dirty, or mark or lock it.
@@ -20,7 +20,7 @@
20
20
  - Keep one source of truth for each datum; other representations are deterministic projections with drift checks.
21
21
  - 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.
22
22
  - 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.
23
- - Prefer platform/standard-library features, then installed dependencies, and the smallest direct implementation; shrink obsolete code before adding layers.
23
+ - Prefer platform/standard-library features, then installed dependencies, and the smallest direct implementation; shrink obsolete code before adding layers. The repository is yours by default: refactor duplication, blocking structure and older model-written code instead of adding to it; keep behavior unless the task changes it, state the refactor in the PR, and route a refactor into another seat's files through the orchestrator.
24
24
  - 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.
25
25
  - Self-review before committing: remove dead code, empty branches and debug leftovers, and split functions by responsibility instead of one large block.
26
26
 
package/CLAUDE.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ## Workflow
4
4
  - Multi-agent work follows `repo-harness-issue-flow` (`assets/skills/repo-harness-issue-flow/SKILL.md`): roles, claims, handoff, dispatch, acceptance and merge.
5
5
  - `docs/architecture/archimap.html` is the single architecture entry. It links each module to its archctx-projected capability doc in `docs/architecture/modules/`. Change boundaries only through `repo-harness-architecture`; do not hand-write other architecture docs.
6
- - The owner keeps every security decision (owner, 2026-11-09, #2008): credentials, tokens and secrets, and each change that reads, moves or exposes them; permissions (seat tool grants, network access, sandbox settings, hooks, confirmation bypass); the safety net (branch protection, `publication.acceptance_merge`, force push to main, the `Required / CI` definition); deletion that git cannot restore (unpushed commits, dirty worktrees, owner files outside a repository such as `~/.repo-harness`, `~/.claude` or `~/.codex` without a backup); and production: `npm publish` (owner npm 2FA), the release tag, the GitHub Release and each production deployment. A production deployment needs an explicit owner authorization for that deployment; no standing GO and no joint decision covers it. The life cycle goes as far as the release PR (prep, version and CHANGELOG commits, push, checks, merge by rule 2). A staging or test deployment (scratch-HOME tarball install, release dry run, prerelease environment, Windows test box) is a joint decision.
6
+ - The owner keeps every security decision (owner, 2026-11-09, #2008): credentials, tokens and secrets, and each change that reads, moves or exposes them; permissions (seat tool grants, network access, sandbox settings, hooks (changes to hook behavior or hook configuration; a change under `src/cli/hook/**` that changes neither takes the High review rule: two PASS rows, one different-family), confirmation bypass); the safety net (branch protection, `publication.acceptance_merge`, force push to main, the `Required / CI` definition); deletion that git cannot restore (unpushed commits, dirty worktrees, owner files outside a repository such as `~/.repo-harness`, `~/.claude` or `~/.codex` without a backup); and production: the owner's approval of the `release` environment run of `release.yml` (it publishes to npm), the release tag, the GitHub Release and each production deployment. A production deployment needs an explicit owner authorization for that deployment; no standing GO and no joint decision covers it. The life cycle goes as far as the release PR (prep, version and CHANGELOG commits, push, checks, merge by rule 2). A staging or test deployment (scratch-HOME tarball install, release dry run, prerelease environment, Windows test box) is a joint decision.
7
7
  - Main publication is allowed only when `publication.acceptance_merge` is `on` in the policy on the PR base, and the current task explicitly authorizes main publication, or rule 2 or rule 3 applies; the skill defines who merges. Push needs task authorization. An explicit no-merge instruction that reaches a seat locally (task or pane) always wins; a no-merge comment is a reference under rule (8). Life-cycle rules (owner, 2026-11-09, #2008): (1) A fix loop continues after round 3 without the owner while each round has fewer blocking findings (P0-P2) than the round before and the scope does not grow. A grown scope is a joint decision. A new P0 finding, or a new P1 finding about security, secrets, data or authentication, stops the loop at the owner; any other new P1 finding does not stop it. Round 5 is the hard stop. (2) In an owner-approved batch, a Medium or High PR merges when its acceptance record is PASS for the head, `Required / CI` passed and each review-bot comment has a response; a High PR also needs its cross-model review PASS; a Low PR that meets the Low accept-seat skip merges on `Required / CI` and its verification evidence, with no acceptance record; each PR body keeps its rollback line (a `git revert` of the squash commit unless it states another). (3) The rolling projection PR (`archctx/projection`) merges on green CI; its merge is its acceptance. (4) An owner decision that the receiving seat posts on the issue or PR authorizes the other seats, with no second confirmation in another pane. A comment is a record: a local seat writes it, and a locally run command may read it as data; it never starts an action. (5) After the owner approves a batch parent and its plan comment, the plan's issues dispatch in plan order; a new issue or a changed order goes to the owner or to rule 7. (6) The GitHub setting "Automatically delete head branches" deletes merged head branches only. (7) The orchestrator and the advisor make a decision that otherwise goes to the owner when both agree, unless it touches security; before the action they post it on the owning issue or PR as `Joint decision (orchestrator + advisor)` with the reason. Both seats run the same model family, so a joint decision never replaces the High-tier cross-model review. (8) Any participant, the owner account included, may post "stop" or "no" on the issue or PR. It is a reference: the orchestrator and the advisor weigh it, decide locally by joint decision and record the decision. The owner's own authorization reaches a seat locally.
8
8
  - The diff's [Review by risk](docs/reference-configs/agentic-development-flow.md#review-by-risk) tier selects independent review; the skill defines the reviewers and their model families. Changing implementation and test assertions together does not raise the tier.
9
9
  - Create task worktrees only at `/tmp/<repo>-wt-<slug>` (Windows: `os.tmpdir()`) with `repo-harness run contract-worktree start --issue <number>`, or `git worktree add` with that path. Never create one beside the main checkout (`../`). Commit or push before a reboot or a tmp cleanup. Closeout and sweep remove only merged, clean and unowned worktrees; to keep one, give it an unmerged commit, keep it dirty, or mark or lock it.
@@ -20,7 +20,7 @@
20
20
  - Keep one source of truth for each datum; other representations are deterministic projections with drift checks.
21
21
  - 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.
22
22
  - 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.
23
- - Prefer platform/standard-library features, then installed dependencies, and the smallest direct implementation; shrink obsolete code before adding layers.
23
+ - Prefer platform/standard-library features, then installed dependencies, and the smallest direct implementation; shrink obsolete code before adding layers. The repository is yours by default: refactor duplication, blocking structure and older model-written code instead of adding to it; keep behavior unless the task changes it, state the refactor in the PR, and route a refactor into another seat's files through the orchestrator.
24
24
  - 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.
25
25
  - Self-review before committing: remove dead code, empty branches and debug leftovers, and split functions by responsibility instead of one large block.
26
26
 
package/README.md CHANGED
@@ -331,6 +331,6 @@ None of these are bundled dependencies; see
331
331
 
332
332
  ## Release & license
333
333
 
334
- - npm: `repo-harness@0.29.2` · workflow stamp `repo-harness@0.29.2+template@0.29.2`
334
+ - npm: `repo-harness@0.31.0` · workflow stamp `repo-harness@0.31.0+template@0.31.0`
335
335
  - History: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
336
336
  - License: MIT — see [`LICENSE`](LICENSE)
@@ -5,7 +5,8 @@
5
5
  export const PROTOCOL_HEADERS = [
6
6
  'repo-harness issue claim', 'repo-harness issue claim status', 'repo-harness boundary question',
7
7
  'repo-harness scope change', 'repo-harness decision', 'repo-harness plan', 'repo-harness handoff',
8
- 'repo-harness acceptance claim', 'repo-harness acceptance record', 'repo-harness review reply',
8
+ 'repo-harness acceptance claim', 'repo-harness acceptance record',
9
+ 'repo-harness acceptance disposition', 'repo-harness review reply',
9
10
  'repo-harness unblocked', 'repo-harness integration status', 'repo-harness merge hold',
10
11
  'repo-harness merge hold released',
11
12
  ];
@@ -19,7 +19,7 @@ Size PR CI by the diff, the same as step 4. A full suite on each small PR spends
19
19
  - Triggers: run PR checks on `pull_request`. Do not also trigger `push` on feature branches; that runs each commit twice. A `push` to the default branch runs only the selection job in report mode, with no tests.
20
20
  - Superseded runs: set `concurrency` to one group per PR number with `cancel-in-progress: true` for `pull_request` events only. Do not cancel scheduled runs.
21
21
  - Selection: a first job reads the diff against the PR base and outputs a mode. Later jobs read the mode in a job-level `if:`.
22
- - A docs-only diff runs only the tests that name a changed document, including a deleted one. With no such test, it skips build and test jobs, and the required aggregate check still reports. One function names the documentation paths; in the repo-harness source repository it is `isDocumentationPath` in `scripts/select-ci-coverage.ts`. Keep link, format and advisory document checks. A document that is program input, such as a projected copy, a parsed contract or a generated region, is outside the documentation rule or has a test that names it, so a change to it runs its consumer tests.
22
+ - A docs-only diff runs only the tests that name a changed document, including a deleted one. With no such test, it skips build and test jobs, and the required aggregate check still reports. One function names the documentation paths; in the repo-harness source repository it is `isDocumentationPath` in `src/core/ci/documentation-path.ts`. Keep link, format and advisory document checks. A document that is program input, such as a projected copy, a parsed contract or a generated region, is outside the documentation rule or has a test that names it, so a change to it runs its consumer tests.
23
23
  - A code diff runs typecheck plus the tests that the diff affects. Use the runner's change detection (`vitest --changed`, `jest --changedSince`, `nx affected`, `turbo run --filter=...[<base>]`, `pytest --testmon`) or an import-graph selector.
24
24
  - A change to a shared input (lockfile, root build or test config, CI workflow, a test helper with no mapped consumer) runs the full suite on that PR. A selector that cannot map a changed file widens the run; it never shrinks it.
25
25
  - Required checks: skip a job with a job-level `if:`, not with workflow-level `paths` or `paths-ignore`. GitHub counts a skipped job as passing for a required check. A workflow that never starts leaves its required check pending and blocks the merge.
@@ -157,7 +157,7 @@ The board rule R5 reads only the rows with `path_visible: true`: a changed path
157
157
  | Reads, moves or exposes credentials, tokens or secrets. | `src/core/security/**` |
158
158
  | Changes a path that deletes files, worktrees, branches or seats. | `src/effects/board/closeout.ts`, `src/cli/installer/uninstall.ts`, `scripts/ship-worktrees.sh`, `scripts/worktree-merge-lib.sh` |
159
159
  | Changes release, publish or deploy, including `deploy/sql/`. | `deploy/sql/**`, `src/core/release/**`, `src/effects/release/**`, `scripts/check-npm-release.sh`, `scripts/check-release-published.sh` |
160
- | Changes a merge or push path: the publication executor, branch protection or force push. | `src/core/publication/acceptance-merge-policy.ts`, `src/core/publication/merge-readiness.ts`, `src/effects/publication/batch-build.ts`, `src/effects/publication/merge-executor.ts`, `src/effects/publication/merge-readiness.ts`, `src/effects/publication/new-remote-ref-push.ts`, `scripts/merge-gate.ts` |
160
+ | Changes a merge or push path: the publication executor, branch protection or force push. | `src/core/publication/acceptance-merge-policy.ts`, `src/core/publication/merge-readiness.ts`, `src/effects/publication/merge-executor.ts`, `src/effects/publication/merge-readiness.ts`, `src/effects/publication/new-remote-ref-push.ts`, `scripts/merge-gate.ts` |
161
161
  <!-- review-high-list:list:end -->
162
162
 
163
163
  Review follows the `repo-harness-issue-flow` skill, [references/acceptor.md](../../assets/skills/repo-harness-issue-flow/references/acceptor.md). The tier selects the depth: no independent review for Low, one fresh-context review from a model family different from the writer's for Medium, and the gatekeeper plus one review for High, at least one of the two from a model family different from the writer's. The round rules (who reviews each round, the claims of a round, the round-2 scope and the convergence rule) are only in [references/acceptor.md §2.2](../../assets/skills/repo-harness-issue-flow/references/acceptor.md#22-rounds). The Acceptor SOP owns the round, findings and publish steps.
@@ -173,7 +173,6 @@ Rules for every tier:
173
173
  - A low tier adds no review. A new test file or a rebase does not raise the tier.
174
174
  - Changing implementation and test assertions together does not raise the tier. Within the tier's existing review, check whether assertions preserve the intended behavior and whether removed or weakened coverage has a valid requirement-based reason. At Low, the author performs this check in self-review. Record the reason for each assertion change in the PR; never change assertions only to make a test pass. Do not dispatch a separate test-review gate.
175
175
  - A parent, coordinator or merge session reuses recorded acceptance when the reviewed diff, relevant base context, verification inputs and environment still match, and the review meets the current tier. The PR records the reviewed revision or diff, commands, results and finding dispositions. A change of session or reviewer is not a reason to repeat acceptance.
176
- - A batch integration PR (`repo-harness-issue-flow`, [references/orchestrator.md](../../assets/skills/repo-harness-issue-flow/references/orchestrator.md) §9.3) reuses the acceptance record of each member when every member merged without conflict and the batch adds no commit of its own. It needs no new review round. A Low member has no acceptance record to reuse. Required checks on the batch head still apply.
177
176
  - After a change, verify the affected behavior. The review scope of each round after a change is in [references/acceptor.md §2.2](../../assets/skills/repo-harness-issue-flow/references/acceptor.md#22-rounds). Retain valid evidence for unchanged scope; add only missing tier coverage. A rebase alone does not require a new full review, but changed base behavior or conflict resolution can invalidate affected evidence. Reuse never substitutes for required checks on the current head or the current-main merge requirement.
178
177
  - A downstream repository maps its own release surfaces, for example public API, wire format, DDL/SQL and permissions, to the High tier.
179
178
 
@@ -171,7 +171,9 @@ not limited to the two named above.
171
171
 
172
172
  ## Design-Brief Hand-off
173
173
 
174
- The chosen direction feeds the existing `design-brief.template.md` /
174
+ The chosen direction feeds the design-brief template (the repository's own
175
+ `.claude/templates/design-brief.template.md` when present, otherwise
176
+ `repo-harness docs path design-brief.template`) /
175
177
  frontend `task_profile` gate as its decided direction — this convention does
176
178
  not duplicate that checklist.
177
179
 
@@ -18,8 +18,8 @@ Create these only when the agent has concrete repo evidence or the user asks:
18
18
  - `docs/decisions.md`: accepted architecture decisions with trade-offs.
19
19
  - Mermaid fenced blocks in `docs/architecture/modules/**.md`: semantic diagram source for agents and review diffs.
20
20
  - `docs/packages.md`: package inventory for real multi-package repos.
21
- - `docs/prds/*.prd.md`: upper-layer PRDs generated through `repo-harness-product`'s PRD mode from `docs/prds/prd.template.md`.
22
- - `docs/prds/DESIGN-*.md`: optional design briefs generated from `.claude/templates/design-brief.template.md` when the task requests design work.
21
+ - `docs/prds/*.prd.md`: upper-layer PRDs generated through `repo-harness-product`'s PRD mode from the repository's own `docs/prds/prd.template.md` when present, otherwise from `repo-harness docs path prd.template`.
22
+ - `docs/prds/DESIGN-*.md`: optional design briefs generated from the repository's own `.claude/templates/design-brief.template.md` when present, otherwise from `repo-harness docs path design-brief.template`, when the task requests design work.
23
23
 
24
24
  ## Rules
25
25
 
@@ -140,8 +140,7 @@ repo-harness upgrade --registered --apply --expected-revision sha256:REPLACE_WIT
140
140
 
141
141
  A changed registry refuses the whole apply with exit 2. Apply checks each repo
142
142
  again just before its first write. It then runs the `init` refresh transaction,
143
- `upgrade --scope project --apply` (with `--migrate-worktree-template` only when
144
- given) and the managed worktree sweep. A failed repo does not stop or roll back
143
+ `upgrade --scope project --apply` and the managed worktree sweep. A failed repo does not stop or roll back
145
144
  the other repos. The `init` refresh updates the repo's registry row, so preview
146
145
  again before the next apply. The command never commits, pushes or opens a PR.
147
146
  `--json` prints one object with `revision`, `apply`, `exitCode` and `repos`.
@@ -761,9 +760,7 @@ head SHA, full binary diff fingerprint, installed helper fingerprint, and PR
761
760
  number. The seal has no receipt field. It never owns provider credentials or
762
761
  starts a reviewer.
763
762
 
764
- The exact target base commit enables the local gate in
765
- `.ai/harness/policy.json#merge_gate`; the candidate cannot disable that base
766
- requirement. Runtime setup installs no merge-gate skill, agent, or provider
763
+ Runtime setup installs no merge-gate skill, agent, or provider
767
764
  runtime. Caller `HOME`, helper-source, and runner environment overrides are ignored for
768
765
  the protected ship/gate helpers. The official runner pins Bash, Git, and Bun;
769
766
  where a fixed trusted host `gh` is present it pins that executable too, and it
@@ -1083,11 +1080,15 @@ for the checked commit. It fetches before its first render and again in its
1083
1080
  internal retry loop. A main move after the writer's check, before either fetch,
1084
1081
  can render one newer commit with the older writer. The rolling PR's CI does not
1085
1082
  compare renders. The Daily architecture freshness lane runs render equivalence
1086
- on main and fails when the published output differs from what current main
1087
- renders. A version mismatch that renders the same output is harmless. The next
1088
- main move renders again with the new writer. The upstream fix is
1089
- Ancienttwo/arch-context#504 (`--base-sha`). Stale projections then also fail the
1090
- daily architecture freshness check on main, which opens a CI repair issue. A
1083
+ on main. When the published output differs from what current main renders, the
1084
+ lane warns while the oldest unpublished main commit is younger than 3 h, and
1085
+ fails after that. The oldest unpublished commit is the first first-parent commit
1086
+ after the newest commit that changes the projection manifest, else that commit.
1087
+ A version mismatch that renders the same output is harmless. The next main move
1088
+ renders again with the new writer. The upstream fix is
1089
+ Ancienttwo/arch-context#504 (`--base-sha`). A projection that stays stale for
1090
+ 3 h then fails the daily architecture freshness check on main, which opens a CI
1091
+ repair issue. A
1091
1092
  local commit or a dirty file that blocks the fast-forward needs an operator
1092
1093
  repair. The installed package is not used for `follow`: releases lag main, and
1093
1094
  a long-running process does not reload a `repo-harness update`. The operator supplies
@@ -20,7 +20,7 @@ Generality: These are general working rules. Do not tailor behavior to any speci
20
20
  - Address status questions, cost concerns, and redirection before resuming prior work.
21
21
  - Before a step expected to exceed 10 minutes, state its expected cost and necessity. Reuse valid evidence after checking subject hash, fingerprint, and freshness; produce expensive final evidence once after freezing code and merging or pinning the target base.
22
22
  - Cap fail -> fix -> reverify loops at three rounds per issue; then stop and report findings.
23
- - Report out-of-scope faults without fixing them. At most one directly blocking out-of-scope fix is allowed per task. A second out-of-scope discovery is a hard stop: report and wait for instruction.
23
+ - Report unrelated faults (defects outside the task) without fixing them. At most one directly blocking unrelated fix is allowed per task. A second unrelated discovery is a hard stop: report and wait for instruction. Refactoring follows Code Ownership.
24
24
  - Use the cheapest sufficient verification for trivial or mechanical tasks; preserve required checks and behavior-specific evidence.
25
25
 
26
26
  ## Progressive Due Diligence
@@ -39,6 +39,12 @@ Before non-trivial design or edits, complete P1/P2/P3:
39
39
  - Validate an unknown value once, at the boundary that owns it, and pass the typed value inward. Do not check again a value that a schema, constructor or internal type already guarantees.
40
40
  - Before you add complexity for a speculative or very unlikely race, security or failure case, or a test for it, tell the user the concrete failure mode, its likelihood and the complexity cost, and get their approval. Do not expand scope silently for theoretical robustness.
41
41
 
42
+ ## Code Ownership
43
+
44
+ - By default, the repository is yours. You decide its shape, and you maintain it later. A repository's own rules or the user can say otherwise, for example for an upstream project that the user only contributes to.
45
+ - Refactor when it makes the code better: remove duplication, replace a structure that blocks the change, and rewrite older model-written code instead of adding to it. Do not copy a duplicate or add a layer on top of messy code.
46
+ - A refactor keeps behavior unless the task changes it, and the PR states what it refactored. In multi-seat work, a refactor that reaches files that another seat owns goes through the orchestrator first (one writer per file).
47
+
42
48
  ## No Compatibility Fallbacks in Product Code
43
49
 
44
50
  - Forbid steady-state compatibility behavior: no dual authorities, dual reads/writes, aliases, shape translators, shadow parsers, or semantic fallbacks.
@@ -13,9 +13,8 @@ repo-harness run heartbeat-triage run --source scheduled
13
13
  ```
14
14
 
15
15
  The command appends a run section to `.ai/harness/triage/inbox.md` and writes a
16
- JSON snapshot under `.ai/harness/runs/`. Each run records:
17
-
18
- - `workflow-check`: `repo-harness run check-task-workflow`
16
+ JSON snapshot under `.ai/harness/runs/`. Each run records the run id, its
17
+ source, the snapshot path and the adoption review date.
19
18
 
20
19
  ## cron
21
20
 
@@ -27,9 +27,9 @@ This topology applies to issue-flow work (`repo-harness-issue-flow`) on herdr-co
27
27
  - Tab 1 holds two panes: the orchestrator on the left and its advisor on the right. Tab 1 may take one worker as its third pane.
28
28
  - The orchestrator holds the issue-flow coordinator and integrator seats. It only dispatches, accepts and merges. It does not implement a child issue.
29
29
  - The advisor serves only the orchestrator. It does research and writes proposals. It may edit files for its proposals. It does not commit or write to GitHub. It collects evidence through the sub-agents of its seat (`seats.advisor.fleet`) and keeps judgment, synthesis and the proposal. The orchestrator asks it for a board replan by [Replan](https://github.com/aimpact-inc/repo-harness/blob/main/assets/skills/repo-harness-issue-flow/references/replan.md).
30
- - Owner decisions and seat authority (owner, 2026-11-09, #2008): the root `CLAUDE.md` and `AGENTS.md` hold the life-cycle rules and the owner list. The orchestrator dispatches an owner-approved batch plan in order, merges by rule 2 at every tier and runs fix rounds up to round 5 by rule 1. A seat that receives an owner decision in its pane posts it on the issue or PR; that comment authorizes the other seats. A comment is a record: a local seat writes it, and a locally run command may read it as data; it never starts an action. The orchestrator and the advisor make a non-security decision together when both agree, and the orchestrator posts it first as `Joint decision (orchestrator + advisor)` with the reason. The advisor makes no GitHub write. A "stop" or "no" comment from any participant, the owner account included, is a reference that the orchestrator and the advisor weigh by joint decision.
30
+ - Owner decisions and seat authority (owner, 2026-11-09, #2008): the root `CLAUDE.md` and `AGENTS.md` hold the life-cycle rules and the owner list. The orchestrator dispatches an owner-approved batch plan in order, merges by rule 2 at every tier and runs fix rounds up to round 5 by rule 1. A seat that receives an owner decision in its pane posts it on the issue or PR; that comment authorizes the other seats. A seat message carries pointers, not content: it names the issue, the PR, the comment URL or the sha, and the content lives in GitHub. The message still wakes the receiving seat; it does not replace the record. The advisor sends the orchestrator only a mismatch between a seat report and the GitHub state, not a confirmation. A comment is a record: a local seat writes it, and a locally run command may read it as data; it never starts an action. The orchestrator and the advisor make a non-security decision together when both agree, and the orchestrator posts it first as `Joint decision (orchestrator + advisor)` with the reason. The advisor makes no GitHub write. A "stop" or "no" comment from any participant, the owner account included, is a reference that the orchestrator and the advisor weigh by joint decision.
31
31
  - One PR has one pane and one worker agent. Each further worker gets its own pane, as the right split of a tab that is not full or in a new tab. The worker may use the agent-fleet sub-agents (`agents/fleet/`) inside its own pane.
32
- - Recommended models for a Claude-only setup: the orchestrator runs Opus at high effort, and the advisor runs Opus at max effort. This is a recommendation, not a requirement. No seat requires a specific model (issue-flow D7).
32
+ - Recommended models for a Claude-only setup: the orchestrator runs Opus at high effort, and the advisor runs Fable at high effort. This is a recommendation, not a requirement. No seat requires a specific model (issue-flow D7).
33
33
  - Cleanup: after a PR merges, the orchestrator runs `repo-harness board closeout --pr <n>` in the primary checkout. It first proves the merge and the worktree: merge commit in the fetched `origin/main`, PR head worktree at the PR head sha, not locked, clean, and no owner marker but its own. A missing proof stops before any pane closes. It then closes each seat terminal bound to the PR (its `pr` label, or the `issue` label of a closing issue in this repository, or a cwd in the PR head worktree on the PR head branch when the seat has an `issue` label that the PR body names after `Refs`; a cwd in the primary checkout never binds; a binding without the PR's `pr` label next to another PR's `pr` label is a conflict) whose checkout belongs to this repository, is clean and has no commit outside `origin/<branch>`. When every bound pane is closed and no process runs in the worktree, it removes the worktree and the local branch through the exact closeout path of `contract-worktree cleanup`, which drops only the worktree's own active-worktree marker. A dirty, unpushed, conflicting, locked, other-owner or unmerged pane or worktree stays; the JSON names the reason, and the board rule A9 reports each live seat of a merged PR. The remote branch is left to GitHub.
34
34
  - Before a worker reports DONE, it stops the background programs it started (a dev server, a daemon started with `nohup` or `setsid`). On Linux and macOS, herdr-core 0.1.19 keeps a deliberately detached program running after its terminal closes, and Windows ends it.
35
35
 
@@ -52,6 +52,8 @@ Commands for the topology steps:
52
52
  | Wait for a worker | `hc wait <t>` |
53
53
  | Close a worker pane | `herdr-app do pane.close --pane <pane>` |
54
54
 
55
+ The board of a parent selects a worker, gatekeeper or reviewer seat by its `issue` label (an item of the parent) or its `pr` label (a pull request of the board). `--parent` is optional for that. It names the worker tab `#<n>` (`other` without it), so the worker rows keep it.
56
+
55
57
  A Codex worker seat in a linked contract worktree edits files and runs checks only. It runs no `git fetch`, `git commit` or `git push`. Its last message gives the commit subject and body, the PR title and body, and the check results. The orchestrator commits the worktree diff with that message and explicit paths only, pushes the branch and opens the PR. The orchestrator is the head owner of record and pushes each fix round; no other agent pushes to that PR. The Codex seat remains the content author and answers review threads through the orchestrator. A seat with the `net` tool group can use the network. A writable Codex seat with `net` can reach loopback services, including the Operator console and herdr-core socket (#1961).
56
58
 
57
59
  `repo-harness seats argv <seat>` prints the argv of the seat from the `seats` section of `~/.repo-harness/config.json`, or from the seat defaults when the section is absent. The argv holds the model, the effort, the tool limits and the seat brief. Its stderr names the source and each limit. A limit marked `instructions_only` is written into the launch instructions only; the host does not enforce it. Without `--argv`, the pane opens a shell.
@@ -66,15 +68,18 @@ Before each dispatch wave, run `repo-harness quota`. Launch each task with `repo
66
68
  | `worker-important-fast` | Claude, `sonnet`, medium |
67
69
  | `worker-light` | Pi, `magpie/cursor/deepseek-v41-flash-1017`, no effort and no account; worker tool groups; no fleet. A Pi seat on `magpie/codex/<model>` ("pi-gpt") is a user-selected alternative to a Codex seat: it runs the same GPT models, takes an effort (`--thinking`) and counts against the `chatgpt` account |
68
70
  | `gatekeeper` | Codex, `gpt-6.1-terra`, high; read, shell and network |
71
+ | `gatekeeper-fallback` | `null` (not configured); when configured, the gatekeeper ranges: read, shell and network, no fleet |
69
72
  | `reviewer` | Claude, `opus`, high; read, shell and network |
70
73
 
71
74
  All worker seats use worker briefs, labels and pane names. `gatekeeper` and `reviewer` need `--pr <n>`; their pane names are `<prefix>-gk-<pr>` and `<prefix>-rv-<pr>`. They report a read-only verdict first and do not edit, commit, push or write to GitHub.
72
75
 
76
+ `gatekeeper-fallback` is optional and is no launch target: `seats argv gatekeeper-fallback` returns `seat_unknown`. While the gatekeeper account is exhausted and the fallback account is not, the route line names the fallback, for example `gatekeeper: gatekeeper-fallback (pi magpie/cursor/deepseek-v41-flash-1017; gatekeeper: chatgpt exhausted)`, and `seats argv gatekeeper --pr <n>` prints the fallback argv with the gatekeeper label, pane name and brief. A tight, unknown or reserved gatekeeper keeps its own rule; with no usable fallback the line stays `gatekeeper: none (...)`. `repo-harness board review` starts a gatekeeper only when this effective gatekeeper has a known model family, and not `anthropic` when the head needs a non-Claude gatekeeper. Its family must differ from the writer's only where it gives the different-family row: a Medium head, or a High head that needs no Claude review. A High head with a Claude review may use a gatekeeper of the writer's family; else it skips the PR with `review_family_unavailable` and the route line. A stored section without the key needs `repo-harness update`, which sets it to `null`.
77
+
73
78
  On Pi, review seats pass `--exclude-tools edit,write`. Direct edit/write tools are off. The edit limit is `common_commands` because the shell stays available; shell writes remain prohibited by the brief. Codex review seats use the read-only sandbox.
74
79
 
75
80
  `seats.routing` holds ordered lists for `important_deep`, `important_fast`, `simple_deep`, `simple_fast` and `frontend`. Lists are non-empty and distinct. The first four accept configured worker seats only; a list cannot name a null seat. `frontend` accepts only `worker-important` and `worker-important-fast`, and both must run Claude when selected in that list. Defaults are `[worker-important, worker-deep]`, `[worker-important-fast, worker]`, `[worker-deep, worker-important]`, `[worker]` and `[worker-important, worker-important-fast]`, in that order. `worker-light` defaults to the Pi seat above. A stored `null` stays null during migration; its argv returns `seat_not_configured`. Each configured seat must use an enabled runtime when saved. The default Pi seat prevents a Seats page save until Pi is enabled or `worker-light` is set to `null`.
76
81
 
77
- Routing selects the first eligible seat with a known account state, or a Pi seat without an account (the DeepSeek `worker-light`). A Pi seat on `magpie/codex/` has the `chatgpt` account. It selects an unknown account only when no such seat is eligible. Exhausted accounts are excluded. Claude in saving mode or exhausted stays reserved for the advisor and orchestrator. Important non-frontend work then uses a configured Pi `worker-light`; a null or non-Pi seat gives a `none` route. Frontend waits for Claude. `tight` is a display state only. When Claude is reserved, the explorer line uses `routing.low_quota_explorer` (default `haiku` high). Pass its model when you call the explorer. Otherwise the line says `default`.
82
+ Routing selects the first eligible seat with a known account state, or a Pi seat without an account (the DeepSeek `worker-light`). A Pi seat on `magpie/codex/` has the `chatgpt` account. It selects an unknown account only when no such seat is eligible. Exhausted accounts are excluded; only the explicit `--spend-credits` of `repo-harness quota` and `repo-harness seats argv` admits a ChatGPT account that still has credits, and only while an owner authorization for credits is recorded. Claude in saving mode or exhausted stays reserved for the advisor and orchestrator. Important non-frontend work then uses a configured Pi `worker-light`; a null or non-Pi seat gives a `none` route. Frontend waits for Claude. `tight` is a display state only. When Claude is reserved, the explorer line uses `routing.low_quota_explorer` (default `haiku` high). Pass its model when you call the explorer. Otherwise the line says `default`.
78
83
 
79
84
  `routing.claude_saving_below_remaining` defaults to 20. Claude saving mode applies when weekly remaining quota is below that percent; otherwise its mode is normal. `routing.codex_hyper_at_or_above_remaining` defaults to 50. Codex hyper mode applies when weekly remaining quota is at or above that percent; otherwise its mode is normal. A missing weekly reading gives an unknown mode. Modes are derived, never stored. Codex hyper uses the code constant `gpt-6-astra` high for Codex seats. Reserved Claude advisor and orchestrator seats use `opus` high. There is no Codex advisor fallback. A Pi seat on `magpie/codex/` gets the Codex hyper model as `magpie/codex/gpt-6-astra` with the hyper effort. Other Pi seats, tools, fleet and class lists stay as configured. An absent seats section uses defaults. Run `repo-harness update` for the one-shot migration of stored sections. The decoder refuses old keys before and after migration; a POST writes the full section.
80
85
 
@@ -115,7 +120,7 @@ The pane name is `<prefix>-<role>[-<item>][-<qualifier>]`: at most 32 characters
115
120
  | `item` | worker: the issue number (`--issue`) or `rel<digits>` for release prep (`--release`); reviewer: the PR number. None for `orch` and `adv` | the dispatch |
116
121
  | `qualifier` | worker: a slice word when one issue has two live worker panes (`--qualifier`); reviewer: the review runtime id (`claude`, `codex`) | the dispatch |
117
122
 
118
- - Set `panePrefix` by hand in the entry of the repository in `registered-repos.json`. Every registry writer keeps it. The registry read refuses a malformed or duplicate prefix.
123
+ - Set `panePrefix` with `repo-harness seats prefix --repo <path> --pane-prefix <p>`. Every registry writer keeps it. The registry read refuses a malformed or duplicate prefix.
119
124
  - `seats argv` reads the entry of the primary checkout of the current directory; a linked worktree resolves to its primary checkout. No entry, or an entry without `panePrefix`, fails with `pane_name_invalid`. A name over 32 characters fails the same way.
120
125
  - One pane serves one item. Do not reuse a pane for another issue: close it and start a new one. Only `hc run --name` sets an hc terminal name, and hc refuses a second live terminal with that name.
121
126
  - The name carries no state (round, status, PR state). The board reads those from GitHub and the labels.
@@ -132,10 +137,10 @@ A new pane goes into the first tab of its kind with fewer than 3 panes. When eve
132
137
 
133
138
  ### Test and Review Rules
134
139
 
135
- - The merge gate is typecheck plus affected tests. Run `bash scripts/check-ci.sh affected --base origin/main` locally.
136
- - Run the full suite for dependency manifests, shared test/runtime foundations, releases, the daily run, or a named integration invariant that focused checks cannot cover.
137
- - When full coverage is required, run `bun run test:full` once on the final rebased head.
138
- - `test:core` excludes the slow integration files. `test:integration` runs those files. `test:full` runs their complete union.
140
+ - A writer runs `bun run check:type`, `bun run check:helpers` and at most 3 test files that own the change. `Required / CI` on the head is the affected-gate evidence.
141
+ - `bash scripts/check-ci.sh <lane>` on the host only reproduces a CI failure.
142
+ - A reviewer runs no test that CI passed.
143
+ - The full suite runs in the daily run and for a release.
139
144
  - Test commands take the host test queue themselves: `bash scripts/check-ci.sh <lane>`, `bun run test:files` and the `test:*` suites wait their turn, run alone and release. Release checks go first, then FIFO. Do not wait for a coordinator message to start them. `bun scripts/host-test-queue.ts status` shows the holder and the waiters.
140
145
  - Full runs use eight isolated file workers. Run files with shared ports or shared HOME writes in the serial tail.
141
146
  - Tests with port 0 and an isolated HOME can run in parallel.
@@ -129,8 +129,7 @@ spawn an LLM or a long-running worker.
129
129
 
130
130
  ## Host and Adoption Operations
131
131
 
132
- `repo-harness init` writes the workflow contract and package helper guidance
133
- in `.ai/hooks/README.md`. It does not install user-level adapters;
132
+ `repo-harness init` writes the workflow contract. It does not install user-level adapters;
134
133
  `repo-harness install` and `repo-harness update` own them.
135
134
  It does not copy the operator library into consumer repositories.
136
135
  It removes retired generated hook entry scripts by exact manifest ownership and
@@ -316,7 +315,6 @@ or `repair`). The error names the one-shot cleanup. Run
316
315
  Hooks do not record architecture drift. They keep no queue and no drift cursor,
317
316
  and they run no projection or LLM work. Architecture updates are explicit:
318
317
 
319
- - `repo-harness run workstream-sync` maintains durable capability workstreams.
320
318
  - Agents read architecture documents on demand, fix debt, and update the model and human prose. The archctx rolling writer publishes generated regions and the manifest.
321
319
 
322
320
  `repo-harness state resolve --json` reports `capability_ownership`. It is a
@@ -393,8 +391,8 @@ Git-ignored` line and one human `systemMessage`. This line takes the place of
393
391
  the notice text, because no marker can deduplicate that text. Claude Stop and
394
392
  Codex UserPromptSubmit keep only the stderr diagnostic of a failed marker write.
395
393
  Without a marker, the line would repeat at each turn, and each Claude Stop line
396
- starts one more turn. Add `.ai/harness/state/` to `.gitignore`; the
397
- `repo-harness init` ignore block has it.
394
+ starts one more turn. Run `repo-harness update`; it writes the runtime-state
395
+ block to the user-level Git excludes file.
398
396
 
399
397
  | Point | Hosts | When |
400
398
  | --- | --- | --- |
@@ -484,7 +482,8 @@ After handler or workflow-contract changes, run:
484
482
 
485
483
  ```bash
486
484
  bun test
487
- repo-harness run check-task-sync
488
- repo-harness run check-task-workflow
489
- repo-harness init --repo . --dry-run
485
+ bash scripts/check-ci.sh governance
490
486
  ```
487
+
488
+ That lane also runs the state boundary check, the helper projection check and
489
+ `repo-harness init --repo . --dry-run` (`scripts/check-ci.sh#governance`).
@@ -18,24 +18,24 @@ The grades describe repository boundaries. The delegation rows use evidence from
18
18
 
19
19
  | Requirement | Level | Current boundary and evidence | Source of truth |
20
20
  |---|---|---|---|
21
- | Assign a single writer per directory; never give concurrent agents overlapping write ownership. | **G** | The root agent instructions ask for one worktree per parallel writer (`CLAUDE.md:17`, `AGENTS.md:17`). No hook renders this rule, and no code acquires a directory-wide edit lease. | Root agent instructions; the active task's allowed paths and ownership brief. |
22
- | Run parallel writers only in separate worktrees from a clean source. Never silently drop isolation when worktree creation fails. | **G** | This is the upstream host requirement. The inspected start helper creates a Git worktree and rejects residual state with `--fresh`, but has no source-clean check in its start path (`scripts/contract-worktree.sh:523`, `scripts/contract-worktree.sh:556`, `scripts/contract-worktree.sh:588`). Do not describe the complete requirement as enforced. | Active contract's worktree boundary; `docs/researches/20260930-pi-harness-packages-extraction.md`, section 6.4. |
23
- | Refuse reuse when the caller requests a fresh contract worktree. | **E** | `--fresh` refuses an already-linked tree and existing metadata, path, worktree, or branch; it is an explicit option, not the default (`scripts/contract-worktree.sh:533`, `scripts/contract-worktree.sh:556`). | `contract-worktree start --fresh`. |
24
- | Child agents default to fresh task context and do not spawn further children. | **G** | The Codex install guidance asks for `fork_turns="none"` (`docs/reference-configs/install-profiles.md:417`). No hook or policy key sets spawn depth or validates the child's inherited transcript. `SubagentStart` records the native role observation and refuses no spawn (`src/cli/hook/subagent-context.ts:428`). | Host-native spawn configuration. |
25
- | Accept the exact subject with its evidence, rather than treating exit code zero as acceptance. | **E** | Acceptance parsing refuses stale subject/contract evidence before checking command success; `verify-sprint` invokes receipt verification and fails that gate when verification fails (`scripts/acceptance-receipt.ts:415`, `scripts/acceptance-receipt.ts:434`, `scripts/verify-sprint.sh:1211`). Scope: the receipt-backed completion gate. | Acceptance Policy in the active contract; the `repo-harness-issue-flow` skill (`references/acceptor.md`); AcceptanceReceipt and prepared verification evidence. |
26
- | After an interrupted managed push/PR/merge, recover explicitly with `recover reconcile`; never automatically replay the external effect. | **E** | Managed finish/ship refuse unfinished closeout re-entry. Reconcile requires an already-landed merge/push and completes missing phases without merging/pushing again (`scripts/contract-worktree.sh:1028`, `scripts/contract-worktree.sh:1426`, `scripts/ship-worktrees.sh:611`, `scripts/ship-worktrees.sh:1539`). Normal first execution may perform the effect; before it lands, recovery uses `abort`. | `long-run-continuation.md`, Crash Recovery; the worktree-scoped closeout journal. |
21
+ | Assign a single writer per directory; never give concurrent agents overlapping write ownership. | **G** | The root agent instructions give each task its own worktree at `/tmp/<repo>-wt-<slug>` and forbid one beside the main checkout (`CLAUDE.md#worktrees`, `AGENTS.md#worktrees`). No hook renders a single-writer rule, and no code acquires a directory-wide edit lease. | Root agent instructions; the active task's allowed paths and ownership brief. |
22
+ | Run parallel writers only in separate worktrees from a clean source. Never silently drop isolation when worktree creation fails. | **G** | This is the upstream host requirement. The inspected start helper creates a Git worktree and rejects residual state with `--fresh`, but has no source-clean check in its start path (`scripts/contract-worktree.sh#start_worktree`). Do not describe the complete requirement as enforced. | Active contract's worktree boundary; `docs/researches/20260930-pi-harness-packages-extraction.md`, section 6.4. |
23
+ | Refuse reuse when the caller requests a fresh contract worktree. | **E** | `--fresh` refuses an already-linked tree and existing metadata, path, worktree, or branch; it is an explicit option, not the default (`scripts/contract-worktree.sh#require_fresh`). | `contract-worktree start --fresh`. |
24
+ | Child agents default to fresh task context and do not spawn further children. | **G** | The Codex install guidance asks for `fork_turns="none"` (`docs/reference-configs/install-profiles.md#fork_turns`). No hook or policy key sets spawn depth or validates the child's inherited transcript. `SubagentStart` records the native role observation and refuses no spawn (`src/cli/hook/subagent-context.ts#persistNativeRoleRoutingEvidence`). | Host-native spawn configuration. |
25
+ | Accept the exact subject with its evidence, rather than treating exit code zero as acceptance. | **E** | Acceptance parsing refuses stale subject and contract evidence on its own: `validateAcceptanceReceiptAgainstPolicy` refuses a stale repository root, campaign, admission or goal, and `inspectAcceptanceCurrentBinding` refuses a stale semantic subject, verification evidence or observation (`src/effects/review/acceptance-receipt.ts#validateAcceptanceReceiptAgainstPolicy`, `src/effects/review/acceptance-receipt.ts#inspectAcceptanceCurrentBinding`). Scope: the receipt-backed completion gate. | Acceptance Policy in the active contract; the `repo-harness-issue-flow` skill (`references/acceptor.md`); AcceptanceReceipt and prepared verification evidence. |
26
+ | After an interrupted managed push/PR/merge, recover explicitly with `recover reconcile`; never automatically replay the external effect. | **E** | Managed ship refuses unfinished closeout re-entry (`scripts/ship-worktrees.sh#closeout_journal_guard_reentry`). Reconcile requires an already-landed push and completes the missing phases without pushing again (`scripts/ship-worktrees.sh#recover_ship`). Normal first execution may perform the effect; before it lands, recovery uses `abort`. | `long-run-continuation.md`, Crash Recovery; the worktree-scoped closeout journal. |
27
27
  | Apply the same explicit-recovery discipline to external effects outside managed closeout. | **G** | The inspected closeout helpers do not intercept arbitrary host shell commands. A host must not replace the managed recovery protocol with its own retry loop. | `long-run-continuation.md`, Crash Recovery; the operation's authorization. |
28
28
  | Missing metadata means unknown; absence alone never authorizes destructive cleanup. | **G** | This is a host-wide rule, not a universal metadata gate (`docs/researches/20260930-pi-harness-packages-extraction.md`, section 6.4). Resolve authoritative Git/store state and ownership before cleanup. | Host guidance; the operation's cleanup/recovery authority. |
29
- | Refuse managed worktree cleanup when merge proof or readable, clean, unlocked worktree state is unavailable. | **E** | Cleanup requires merge proof and refuses unreadable status, a locked worktree, or dirty content. Runtime metadata absence does not replace these checks (`scripts/contract-worktree.sh:2365`, `scripts/contract-worktree.sh:2383`, `scripts/contract-worktree.sh:2394`). Scope: real cleanup, not a dry-run preview. | `contract-worktree cleanup`; Git topology, merge proof, and worktree status. |
30
- | Enforce MCP write authorization/admission independently of tool exposure. | **E** | Coding/engineer startup requires an enabled profile, explicit read-write grant, and current authorization revision; fleet mutations additionally check the target and return a revision fence (`src/cli/mcp/server.ts:187-197`, `src/cli/mcp/fleet-tools.ts:280`). Workflow-artifact writes separately use their policy path guard (`src/cli/mcp/tools.ts:656`). These are distinct write paths, not one universal grant. | MCP policy and registered-repository authorization; each owner handler. |
29
+ | Refuse managed worktree cleanup when merge proof or readable, clean, unlocked worktree state is unavailable. | **E** | Cleanup requires merge proof and refuses unreadable status, a locked worktree, or dirty content. Runtime metadata absence does not replace these checks (`scripts/contract-worktree.sh#cleanup_worktree`). Scope: real cleanup, not a dry-run preview. | `contract-worktree cleanup`; Git topology, merge proof, and worktree status. |
30
+ | Enforce MCP write authorization/admission independently of tool exposure. | **E** | MCP startup resolves one profile with its own read and write globs (`src/cli/mcp/policy.ts#getMcpPolicy`, `src/cli/mcp/server.ts#createMcpToolContext`). A repository mutation refuses a `read_only` registry entry (`src/cli/mcp/general-repo-access/authority.ts#assertRepoWriteEnabled`), and a fleet tool refuses a target outside the adopted registry (`src/cli/mcp/fleet-tools.ts#targetFromArgs`). Workflow-artifact writes separately use their policy path guard (`src/cli/mcp/tools.ts#writeMarkdownArtifact`). These are distinct write paths, not one universal grant. | MCP policy and registered-repository authorization; each owner handler. |
31
31
  | Keep MCP writes bounded, inspect each result, and retain operation evidence even when an enclosing script fails. | **G** | No inspected exposure setting or audit helper enforces this complete requirement. The audit is best-effort; the narrower write protections and durable-record example below are **E** only within their own paths. | MCP usage guidance below; each tool's structured result and canonical store. |
32
32
 
33
33
  ## Host Landing
34
34
 
35
35
  | Host | Native execution and repo-harness landing | Enforcement boundary |
36
36
  |---|---|---|
37
- | Claude Code | Use the host's native subagent surface. The shared route registry attaches `PreToolUse` edit and subagent routes; the `Task`/`Agent` handler appends a return contract to the prompt (`src/cli/hook/route-registry.ts:76`, `src/cli/hook/route-registry.ts:84`, `src/cli/hook/return-channel.ts:36`). | **E** for installed typed-hook behavior and invoked CLI/MCP gates only. Appended instructions do not make writer ownership, fresh context, or spawn depth mechanically enforced. The Codex-only `SubagentStart.context` route does not run here. |
38
- | Codex | Use native `spawn_agent` with the installed role and a self-contained task packet. The registry selects the Codex-only `SubagentStart.context` route; the handler emits the child scope context (`src/cli/hook/route-registry.ts:100`, `src/cli/hook/subagent-context.ts:428`). | **E** for the installed route's handling. SubagentStart records the native role observation and refuses no spawn. Fresh-context and depth requirements remain **G**; scope text is guidance, not a filesystem lock. |
37
+ | Claude Code | Use the host's native subagent surface. The shared route registry attaches `PreToolUse` edit and subagent routes; the `Task`/`Agent` handler appends a return contract to the prompt (`src/cli/hook/route-registry.ts#ROUTES`, `src/cli/hook/return-channel.ts#runReturnChannel`). | **E** for installed typed-hook behavior and invoked CLI/MCP gates only. Appended instructions do not make writer ownership, fresh context, or spawn depth mechanically enforced. The Codex-only `SubagentStart.context` route does not run here. |
38
+ | Codex | Use native `spawn_agent` with the installed role and a self-contained task packet. The registry selects the Codex-only `SubagentStart.context` route; the handler emits the child scope context (`src/cli/hook/route-registry.ts#ROUTES`, `src/cli/hook/subagent-context.ts#runSubagentContext`). | **E** for the installed route's handling. SubagentStart records the native role observation and refuses no spawn. Fresh-context and depth requirements remain **G**; scope text is guidance, not a filesystem lock. |
39
39
  | Pi | Load `src/pi/extension.ts` through the package's `pi.extensions` entry. Map native edit, write and bash calls, including codemode nested calls, to the typed guards. Pi has no built-in subagent route. | **E** within the extension's `tool_call` path. A failed capability probe blocks these tools in an opted-in repository. Other write paths remain outside this boundary. |
40
40
 
41
41
  Install and trust the user-level hook adapters before relying on their routes. Read the active contract for scope; use the receipt-backed gate for acceptance and the journal-backed helper for closeout. Native process/session state is an observation, not permission to change workflow authority.
@@ -62,17 +62,17 @@ If using Pi MCP, keep ordinary discovery in `codemode` and set `hidden` only for
62
62
 
63
63
  Write safety has three parts:
64
64
 
65
- 1. **Usage constraint (G).** Do not batch writes inside codemode scripts. Dispatch a bounded mutation, inspect its result and authoritative state, then decide the next action. A failed outer script does not undo completed effects. Inspect `isError` and `structuredContent.error` where provided: Pi resolves MCP error results rather than rejecting them (`docs/researches/20260930-pi-codemode-lazy-loading.md:15`). Workflow-tool errors also require inspecting their error payload: `tools.ts` does not set `isError` in its `errorResult` (`src/cli/mcp/tools.ts:120`).
65
+ 1. **Usage constraint (G).** Do not batch writes inside codemode scripts. Dispatch a bounded mutation, inspect its result and authoritative state, then decide the next action. A failed outer script does not undo completed effects. Inspect `isError` and `structuredContent.error` where provided: Pi resolves MCP error results rather than rejecting them (`docs/researches/20260930-pi-codemode-lazy-loading.md#isError`). Workflow-tool errors also require inspecting their error payload: `errorResult` does not set `isError` (`src/cli/mcp/tools.ts#errorResult`).
66
66
  2. **Server authorization and admission (E, path-specific).** Retain profile, repository/path authorization, revision preconditions, and owner fences. Do not derive authorization from discovery, exposure, or `readOnlyHint`. A hidden tool in one host is not a revoked server-side grant.
67
- 3. **Audit and evidence (G for complete coverage).** Request and retain each operation's canonical evidence. MCP audit writes go to `.ai/harness/mcp/audit.log`, but `tryWriteMcpAuditEntry` returns `false` on storage failure and callers ignore it (`src/cli/mcp/audit.ts:11`, `src/cli/mcp/audit.ts:25`, `src/cli/mcp/tools.ts:124`). A successful mutation can therefore lack an audit entry. Host nested-call records do not upgrade this server-side behavior.
67
+ 3. **Audit and evidence (G for complete coverage).** Request and retain each operation's canonical evidence. MCP audit writes go to `.ai/harness/mcp/audit.log`, but `tryWriteMcpAuditEntry` returns `false` on storage failure and its callers ignore the result (`src/core/public-projections/mcp-audit-log.ts#MCP_AUDIT_LOG_RELATIVE_PATH`, `src/cli/mcp/audit.ts#tryWriteMcpAuditEntry`, `src/cli/mcp/tools.ts#audit`). A successful mutation can therefore lack an audit entry. Host nested-call records do not upgrade this server-side behavior.
68
68
 
69
69
  ### Inspected Write Paths
70
70
 
71
71
  | Path | Level and actual protection | Evidence limit |
72
72
  |---|---|---|
73
- | Workflow artifacts: `writeMarkdownArtifact` → `guardedWriteFile` → audit → result | **E**: policy path guard, target-type/revision refusal, exclusive per-file lock, file fsync and rename (`src/cli/mcp/tools.ts:656`, `src/cli/mcp/guarded-write.ts:103`, `src/cli/mcp/guarded-write.ts:133`, `src/cli/mcp/guarded-write.ts:163`, `src/cli/mcp/guarded-write.ts:209`). | The returned hash describes the artifact; it is not a persisted audit receipt. Audit happens after commit and its failure does not block success (`src/cli/mcp/tools.ts:666`). Directory fsync is best-effort. No fail-closed audit-evidence path was found here. |
74
- | General repository mutations: `write_file` and shared dispatch | **E**: read-write admission, path locks and revision/absence conditions in the inspected file-write path (`src/cli/mcp/general-repo-access.ts:2042`). | Shared dispatch audits after the operation; audit and metric/trace appends swallow storage failure (`src/cli/mcp/general-repo-access.ts:221`, `src/cli/mcp/general-repo-access.ts:444`, `src/cli/mcp/general-repo-access.ts:2893`). No universal evidence-before-mutation gate was found. |
75
- | Fleet and Engineer adapters | **E** for the inspected fleet authorization checks; no complete-audit grade. | The adapters call the same best-effort audit helper (`src/cli/mcp/fleet-tools.ts:144`, `src/cli/mcp/engineer-tools.ts:423`). Domain records are separate from audit; their existence must be verified in their owner path. |
73
+ | Workflow artifacts: `writeMarkdownArtifact` → `guardedWriteFile` → audit → result | **E**: policy path guard, target-type/revision refusal, exclusive per-file lock, file fsync and rename (`src/cli/mcp/tools.ts#writeMarkdownArtifact`, `src/cli/mcp/guarded-write.ts#guardedWriteFileUnderLock`). | The returned hash describes the artifact; it is not a persisted audit receipt. Audit happens after the write and its failure does not block success (`src/cli/mcp/tools.ts#audit`). Directory fsync is best-effort. No fail-closed audit-evidence path was found here. |
74
+ | General repository mutations: `write_file` and shared dispatch | **E**: read-write admission, path locks and revision/absence conditions in the inspected file-write path (`src/cli/mcp/general-repo-access.ts#writeFileTool`, `src/cli/mcp/general-repo-access.ts#withMutationLocks`, `src/cli/mcp/general-repo-access.ts#readExpectedExistingWriteTarget`, `src/cli/mcp/general-repo-access.ts#assertWriteTargetAbsent`). | Shared dispatch audits after the operation; audit and metric/trace appends swallow storage failure (`src/cli/mcp/general-repo-access.ts#audit`, `src/cli/mcp/general-repo-access.ts#tryAppendJsonLine`). No universal evidence-before-mutation gate was found. |
75
+ | Fleet adapter | **E** for the inspected fleet authorization checks; no complete-audit grade. | The adapter calls the same best-effort audit helper (`src/cli/mcp/fleet-tools.ts#audit`). Domain records are separate from audit; their existence must be verified in their owner path. |
76
76
 
77
77
  The inspected paths do not establish equivalent semantics for every MCP write. Keep artifact persistence, operation evidence, diagnostic audit, and semantic acceptance distinct. If required evidence is unavailable, stop and report the gap rather than infer acceptance from a returned status.
78
78
 
@@ -11,12 +11,9 @@ that used it (#692, #695):
11
11
 
12
12
  ## Policy Status
13
13
 
14
- The only key of the block is `mode`. Policy validation accepts `off` and
15
- `advice`. Any other value, such as the retired `enforce`, fails policy
16
- validation. State resolution then fails until the operator sets `advice` or
17
- `off`. Stop never blocks on a minimal-change finding. This repository sets
18
- `mode: "advice"`. `repo-harness init` writes `{ "mode": "advice" }`. No code
19
- reads the value after validation.
14
+ No code reads or validates `minimal_change`. The key is outside the policy
15
+ schema, so `repo-harness init` removes it and names it in the
16
+ `unknown-policy-keys` warning. Stop never blocks on a minimal-change finding.
20
17
 
21
18
  `.ai/harness/checks/minimal-change.latest.json` and
22
19
  `.ai/harness/checks/minimal-change-audit.latest.json` have no writer and no