repo-harness 0.35.0 → 0.35.2

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 (99) hide show
  1. package/README.md +1 -1
  2. package/assets/reference-configs/agentic-development-flow.md +3 -1
  3. package/assets/reference-configs/external-tooling.md +63 -10
  4. package/assets/released-managed-values.v1.json +6 -2
  5. package/assets/review-hazards.v1.json +7 -2
  6. package/assets/skill-version.json +2 -2
  7. package/assets/skills/repo-harness-issue-flow/references/acceptor.md +4 -3
  8. package/assets/skills/repo-harness-issue-flow/references/advisor.md +27 -1
  9. package/assets/skills/repo-harness-issue-flow/references/board.md +4 -3
  10. package/assets/skills/repo-harness-issue-flow/references/orchestrator.md +55 -15
  11. package/assets/skills/repo-harness-issue-flow/references/templates.md +14 -3
  12. package/assets/skills/repo-harness-issue-flow/references/worker.md +15 -0
  13. package/dist/hook-entry.js +464 -230
  14. package/dist/oar-review-host.js +28 -2
  15. package/install.ps1 +51 -2
  16. package/install.sh +44 -4
  17. package/package.json +1 -1
  18. package/scripts/check-ci.sh +1 -1
  19. package/scripts/check-tarball-install-smoke.sh +19 -3
  20. package/scripts/install-agent-fleet.sh +6 -3
  21. package/scripts/sync-reference-configs.ts +7 -0
  22. package/src/cli/candidate-runtime-reconciliation.ts +146 -0
  23. package/src/cli/commands/adoption-plan.ts +41 -17
  24. package/src/cli/commands/board.ts +173 -4
  25. package/src/cli/commands/candidate-reconciliation.ts +28 -3
  26. package/src/cli/commands/config.ts +151 -0
  27. package/src/cli/commands/global-runtime.ts +183 -228
  28. package/src/cli/commands/install.ts +114 -2
  29. package/src/cli/commands/publication.ts +5 -0
  30. package/src/cli/commands/seats.ts +23 -7
  31. package/src/cli/commands/status.ts +9 -2
  32. package/src/cli/commands/upgrade-registered.ts +7 -10
  33. package/src/cli/commands/upgrade.ts +35 -68
  34. package/src/cli/hook/mutation-guard.ts +3 -3
  35. package/src/cli/hook/route-registry.ts +2 -0
  36. package/src/cli/hook/runtime.ts +5 -5
  37. package/src/cli/hook/safety-hook.ts +11 -17
  38. package/src/cli/index.ts +46 -639
  39. package/src/cli/installer/architecture-selection.ts +7 -0
  40. package/src/cli/installer/install-profile.ts +56 -181
  41. package/src/cli/installer/install-state-migration.ts +34 -20
  42. package/src/cli/installer/install-state.ts +35 -15
  43. package/src/cli/installer/json-config-migration.ts +122 -28
  44. package/src/cli/installer/managed-entries.ts +21 -7
  45. package/src/cli/installer/pi-package.ts +126 -18
  46. package/src/cli/installer/repository-excludes.ts +83 -83
  47. package/src/cli/installer/skill-sync.ts +7 -5
  48. package/src/cli/installer/targets/claude.ts +21 -3
  49. package/src/cli/installer/types.ts +13 -6
  50. package/src/cli/installer/uninstall.ts +209 -99
  51. package/src/cli/runtime-transaction.ts +399 -0
  52. package/src/core/adoption/rollback.ts +4 -4
  53. package/src/core/board/attention.ts +14 -10
  54. package/src/core/board/board.ts +9 -3
  55. package/src/core/board/dispatch.ts +127 -38
  56. package/src/core/board/hazards.ts +81 -13
  57. package/src/core/board/merge.ts +17 -13
  58. package/src/core/board/plan-block.ts +35 -17
  59. package/src/core/board/post.ts +3 -3
  60. package/src/core/board/recommended-models.ts +56 -0
  61. package/src/core/board/retro.ts +208 -0
  62. package/src/core/board/review-rules.ts +24 -10
  63. package/src/core/board/review.ts +7 -3
  64. package/src/core/board/seat-routing.ts +18 -9
  65. package/src/core/board/seats-settings.ts +59 -26
  66. package/src/core/host-config/json-fragment.ts +5 -4
  67. package/src/core/host-config/marked-block.ts +25 -12
  68. package/src/core/host-config/override.ts +41 -0
  69. package/src/core/host-config/path-entry.ts +55 -0
  70. package/src/core/host-config/registry.ts +16 -2
  71. package/src/core/host-config/types.ts +86 -5
  72. package/src/core/publication/merge-readiness.ts +8 -0
  73. package/src/core/review/model-family.ts +1 -0
  74. package/src/effects/adoption/standard-plan.ts +9 -22
  75. package/src/effects/artifact-retention.ts +5 -2
  76. package/src/effects/board/closeout.ts +9 -1
  77. package/src/effects/board/collect.ts +54 -13
  78. package/src/effects/board/dispatch.ts +16 -9
  79. package/src/effects/board/lifecycle-index.ts +143 -0
  80. package/src/effects/board/pi-fleet-roles.ts +2 -1
  81. package/src/effects/board/seats-configuration.ts +14 -24
  82. package/src/effects/fs-transaction.ts +315 -513
  83. package/src/effects/git/repository-identity.ts +6 -0
  84. package/src/effects/host-config/delegated.ts +152 -0
  85. package/src/effects/host-config/gate.ts +875 -140
  86. package/src/effects/host-config/inspect.ts +239 -0
  87. package/src/effects/host-config/path-records.ts +62 -13
  88. package/src/effects/host-config/repository.ts +200 -0
  89. package/src/effects/host-config/store.ts +102 -24
  90. package/src/effects/host-config/tools.ts +314 -0
  91. package/src/effects/host-config/whole-path.ts +7 -7
  92. package/src/effects/operator/seats-settings-route.ts +1 -1
  93. package/src/effects/publication/merge-readiness.ts +38 -11
  94. package/src/effects/repo-harness-home.ts +9 -3
  95. package/src/effects/review/magpie-endpoint.ts +1 -1
  96. package/src/effects/self-ignoring-directory.ts +67 -0
  97. package/src/effects/skill-tree-integrity.ts +2 -126
  98. package/src/effects/terminal/task-role-profiles.ts +0 -13
  99. package/src/effects/upgrade/repository-hooks.ts +78 -0
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.35.0` · workflow stamp `repo-harness@0.35.0+template@0.35.0`
334
+ - npm: `repo-harness@0.35.2` · workflow stamp `repo-harness@0.35.2+template@0.35.2`
335
335
  - History: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
336
336
  - License: MIT — see [`LICENSE`](LICENSE)
@@ -133,9 +133,11 @@ The board rule R3 reads only the rows with `path_visible: true`: a changed path
133
133
 
134
134
  | Hazard | Paths that R3 reads |
135
135
  | --- | --- |
136
- | Changes a workflow or other CI configuration under `.github/` where it changes secrets or permissions. | `.github/**` |
136
+ | Changes a workflow or other CI configuration under `.github/`. | `.github/**` |
137
137
  | Changes a release, publish, update or install script, or a package script that runs at install or release. | None (`path_visible: false`) |
138
138
  | Reads credentials, such as tokens, keys, `~/.ssh`, `~/.npmrc` or credential environment variables. | None (`path_visible: false`) |
139
+
140
+ R3 and the tier skip a `ci-config` hit on a modified file that matches `.github/workflows/*.yml` or `.github/workflows/*.yaml` when every YAML key that the diff changes is on or under `jobs.*.timeout-minutes`, `jobs.*.steps.*.timeout-minutes`, `on.*.paths` or `on.*.paths-ignore` (`*` matches one key or list index). The board reads the file at the merge base and the head commit. A cleared edit is at least Medium. An added, removed or renamed file, another changed key, and a failed read or parse stay High.
139
141
  <!-- review-hazards:list:end -->
140
142
 
141
143
  ### Review by risk
@@ -47,12 +47,43 @@ is still as rh wrote it, and the other entries stay and are reported. Sibling ho
47
47
  configuration keys, user-edited surfaces and vault contents remain. It does not
48
48
  activate a runtime.
49
49
 
50
- Unproven old configuration, malformed configuration, changed owned surfaces and an
51
- edited managed block (the Global Working Rules block or the runtime-state ignore block)
52
- are reported as `unresolved`; the file stays unchanged, the command exits nonzero with
53
- `status: partial` and keeps remaining ownership evidence. Codex hook trust entries in
54
- `[hooks.state]` give a `note`: rh does not remove them, and they do not block
55
- completion. A preserved shared/pre-existing
50
+ Each item has one action. `restored`: the result was checked equal to the file
51
+ before rh (sha256, or absence). `reverted`: rh's changes went with no such proof;
52
+ for a file that an earlier rh version wrote, the reason says that equality with the
53
+ file before install cannot be proved. `kept`: rh leaves it. `note`: nothing to do,
54
+ for example a file that the user deleted. Unproven old configuration, malformed
55
+ configuration, changed owned surfaces and an edited managed block (the Global Working
56
+ Rules block or the runtime-state ignore block) are reported as `unresolved`; the file
57
+ stays unchanged, the command exits 1 with `status: partial` and keeps remaining
58
+ ownership evidence. `failed` (`host_config_restore_mismatch`): the reverted bytes
59
+ would not equal the known file before rh, so rh writes nothing, keeps the ledger
60
+ record and its vault copy, and exits 2 with `status: failed`. Codex hook trust
61
+ entries in `[hooks.state]` give a `note`: rh does not remove them, and they do not
62
+ block completion. `--remove-edited-block <path>` (repeatable) removes the Global
63
+ Working Rules block of that rules file also when you edited it: the whole file goes
64
+ to the vault first, and the item prints the copy's path; `rh config gc` never
65
+ deletes that copy.
66
+
67
+ `rh config status` prints the path, sha256 and state of each file, fragment and path
68
+ that the ledger records, `baseline unknown` for a file that an earlier rh version
69
+ wrote, and old `global-context-backups/*.bak` files as candidates that rh does not
70
+ use. `rh config diff <path>` prints rh's fragments of one file by hash;
71
+ `--show-values` adds only text that the ledger proves rh wrote, and prints any other
72
+ value as `<user value, N bytes, sha256:...>`. `rh config restore <path> [--owner
73
+ <id>]` reverts one file, or one owner's fragments, with the same actions and exit
74
+ codes as uninstall. `rh init` and `rh upgrade` strip retired rh hooks from a
75
+ repository's `.claude/settings.json` and `.codex/hooks.json` through a repository
76
+ ledger in `~/.repo-harness/config/repos/<key>/`, one per clone; it keeps the whole
77
+ file before the strip, and no copy goes into the working tree. `rh config restore
78
+ [<path>] --repo <dir>`, with `<dir>` the worktree root that holds `.git`, puts back
79
+ the recorded files of that worktree while each still holds the bytes that rh wrote. A
80
+ file below a link or below a nested checkout stays, with its reason. Copies of user
81
+ files wait in self-ignoring directories (a `.gitignore` with `*`), never beside the
82
+ target. With no record it stops with
83
+ `host_config_repository_unrecorded`. `rh uninstall` does not revert a repository
84
+ record. `rh config gc` deletes the vault copy of each finished revert in the user
85
+ ledger 30 days after it, while no record references it. Status and diff create no vault or lock;
86
+ on a ledger of an older protocol they name `rh update`. A preserved shared/pre-existing
56
87
  third-party installation is not claimed as repo-harness-owned.
57
88
 
58
89
  Standalone CodeGraph configuration and global install/update share one host lock.
@@ -62,6 +93,17 @@ archives and runtime history remain. Repository unadoption and package removal a
62
93
  separate operations; this command does not enumerate other repositories or remove
63
94
  third-party packages. Remove the CLI package only after configuration cleanup.
64
95
 
96
+ `rh install` and `rh update` take `--override <path>#<selector>` (repeatable):
97
+ rh writes its value at that fragment also over a value that it did not write,
98
+ and the gate keeps the file before the write in the vault. rh checks every
99
+ entry before any write and refuses one that no writer of the run can take; today
100
+ the Claude `settings.json` writers take a selection. A candidate package that
101
+ does not echo the selection in its receipt fails the update step.
102
+ `rh install --dry-run` and `rh update --dry-run` list each planned host-config
103
+ item as `add`, `refresh`, `override` or a skip code, with paths and selectors
104
+ only, and name the writers that they do not list yet. `rh update --dry-run`
105
+ starts no package install.
106
+
65
107
  `rh update` is a reconciliation command, not a best-effort package
66
108
  install. It verifies the installed package's exact `archctx` and
67
109
  `archctx-contracts` dependencies, package-local CodeGraph, compatible ArchContext
@@ -102,14 +144,14 @@ current content hash matches. A changed file is reported again as a stale
102
144
  decision. `keep` moves the item to `operatorKept`; it no longer counts as a
103
145
  leftover. `remove` is valid only for a regular file that is not a document with
104
146
  a retired-path reference. `upgrade --scope project --apply` then removes it
105
- through the project backup and rollback manifest. An invalid decision file
147
+ through the run's project backup. An invalid decision file
106
148
  fails the project upgrade.
107
149
 
108
150
  `upgrade --apply` backs up eligible targets and checks ownership again before
109
151
  removal. It keeps current global typed adapters, sibling user hooks, changed
110
152
  files, and files without proof. Apply exits 1 on failure and restores its target
111
- snapshots. Backup manifests list original paths. Project transactions use
112
- `rh init rollback`; global backups require manual target replacement from each snapshot.
153
+ snapshots. A completed run deletes its project copies. Global backup manifests
154
+ list original paths; a global backup needs manual target replacement from each snapshot.
113
155
  Do not overlay directory contents. Restore symlinks verbatim.
114
156
 
115
157
  Global upgrade backups stay in `~/.repo-harness/transactions/install-*`.
@@ -354,7 +396,18 @@ step edits no shell profile: it prints a hint when `~/.local/bin` is not on
354
396
  PATH, and `setup check` reports hc missing until the user adds it. On every
355
397
  platform, when the directory is not on the PATH of the run, the run puts it
356
398
  first on the PATH of its later steps, so the Herdr skill step reads the new hc.
357
- `rh uninstall` keeps hc and its PATH entry.
399
+ `rh uninstall` keeps hc and its PATH entry. `rh uninstall --with-tools` (only
400
+ with `--target both`) also removes each herdr-core file and link that is still
401
+ the object that rh wrote and holds the bytes that rh recorded, the empty
402
+ directories that rh created, and the PATH
403
+ entry while it is still the one recorded text in the recorded value kind; it
404
+ keeps every other entry of the value. A changed entry stays and is reported
405
+ `unresolved`. One ledger write releases every claim before the first removal,
406
+ so an entry that a failed removal leaves (on Windows, a running `hc.exe`) is no
407
+ longer rh's: stop hc and remove it by hand. rh does not remove the Windows
408
+ `conpty` directory: the run releases its record and reports it `kept`, and
409
+ the user removes it by hand. An hc that existed before the
410
+ install is never recorded and never removed. No command removes Bun.
358
411
 
359
412
  The step never overwrites an existing install file. A sha256 mismatch, a failed
360
413
  download, an archive without a complete hc (on Windows, `conpty\conpty.dll`), a
@@ -99,7 +99,9 @@
99
99
  "v0.33.0",
100
100
  "v0.33.1",
101
101
  "v0.33.2",
102
- "v0.34.0"
102
+ "v0.34.0",
103
+ "v0.35.0",
104
+ "v0.35.1"
103
105
  ],
104
106
  "packageScripts": {
105
107
  "check:architecture-sync": [
@@ -2315,6 +2317,7 @@
2315
2317
  "sha256:542332264af0204a934af7c5c4001738f21c14e2206b5f893478984885fc29a0",
2316
2318
  "sha256:7edc472a487ed8c2aa12193336bfcc6394c44b2fe4bdf8bac0754779713fbe4e",
2317
2319
  "sha256:7f2c692a1a6be999c9e6bf1e55dd7868174bbc23893cb25b65e04e16e658be8d",
2320
+ "sha256:83a5ab81faf34de117284042b375d67c08a6a9816d7cf94bbcbbfc7af990ec28",
2318
2321
  "sha256:9c788d8ab025ff2bdd7f6f915e4c99b39a09670bf5cf02ab9d7a86466ae5ebb0"
2319
2322
  ],
2320
2323
  "## Sub-agent Delegation": [
@@ -2330,7 +2333,8 @@
2330
2333
  "sha256:6f1c27796bb280cde59f09645b0c7aa0842d9962a6503497647d2a28d6582dfa"
2331
2334
  ],
2332
2335
  "## Test Budget": [
2333
- "sha256:b2a452142e34f036c6323777bd6ec1c3e879d1f7ee3d3ea4d80e4253cde01532"
2336
+ "sha256:b2a452142e34f036c6323777bd6ec1c3e879d1f7ee3d3ea4d80e4253cde01532",
2337
+ "sha256:f95b20ea8d6ccbf4e548482dc8cc625e766f77438a9ef0c765281e248c51338b"
2334
2338
  ]
2335
2339
  }
2336
2340
  },
@@ -3,7 +3,7 @@
3
3
  "hazards": [
4
4
  {
5
5
  "id": "ci-config",
6
- "text": "Changes a workflow or other CI configuration under `.github/` where it changes secrets or permissions.",
6
+ "text": "Changes a workflow or other CI configuration under `.github/`.",
7
7
  "path_visible": true,
8
8
  "paths": [".github/**"]
9
9
  },
@@ -17,5 +17,10 @@
17
17
  "text": "Reads credentials, such as tokens, keys, `~/.ssh`, `~/.npmrc` or credential environment variables.",
18
18
  "path_visible": false
19
19
  }
20
- ]
20
+ ],
21
+ "allowed_edits": {
22
+ "hazard": "ci-config",
23
+ "paths": [".github/workflows/*.yml", ".github/workflows/*.yaml"],
24
+ "keys": ["jobs.*.timeout-minutes", "jobs.*.steps.*.timeout-minutes", "on.*.paths", "on.*.paths-ignore"]
25
+ }
21
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.35.0",
3
- "templateVersion": "0.35.0",
2
+ "version": "0.35.2",
3
+ "templateVersion": "0.35.2",
4
4
  "skillName": "repo-harness",
5
5
  "contractId": "tasks-first-harness-v1",
6
6
  "compatibility": {
@@ -173,9 +173,10 @@ A bot finding that arrives after the merge is triaged once: `decline`, or,
173
173
  for a P0 or P1, `adopt` as a new issue under the batch parent. The merged PR is not
174
174
  reopened.
175
175
 
176
- The merge executor still refuses a PR with an unresolved thread
177
- (`unresolved_threads`). The change is who resolves a bot thread, not the
178
- gate.
176
+ The merge executor refuses a PR with a review-bot thread that is not
177
+ resolved and has no reply from an author that is not a bot
178
+ (`unanswered_bot_threads`). A reply is enough; the thread does not have to
179
+ be resolved.
179
180
 
180
181
  ## 3. Findings
181
182
 
@@ -117,8 +117,34 @@ shipped, when a batch parent closes, and when the owner asks.
117
117
  issues write one file. Two issues with one design are one issue: propose
118
118
  the fold.
119
119
  3. Put a train in the set when nothing outside the repository and no owner
120
- hold blocks it. List the other trains with their blocker.
120
+ hold blocks it. List the other trains with their blocker. Do not propose
121
+ a release while a train that changes a migration or a ledger path has an
122
+ open batch parent, except to ship a fix for a released I1 or I2 defect;
123
+ that proposal names the open train. Its merged work ships with the first
124
+ release after the parent closes.
121
125
  4. Name the critical path and what blocks it now. Name the seats that the
122
126
  scarce account must serve first.
123
127
  5. Give the table: train, result, order, tier and route, state. Give an
124
128
  estimate only with its basis, and mark it as an estimate.
129
+
130
+ ## 5. Retro
131
+
132
+ Run a retro when a batch parent closes and after a release ships. Run it
133
+ before the release set of §4, so the set can name the levers.
134
+
135
+ 1. Run `rh board retro --parent <n> --json` for the closed parent, or
136
+ `rh board retro --since <window> --json` for the release window (such as
137
+ `14d`). The command is read-only. It fails when the lifecycle index is
138
+ missing or holds a line that is not a sanitized event; report that
139
+ failure, do not estimate the numbers.
140
+ 2. Give each entry of `outliers` to one read-only `explorer` sub-agent: its
141
+ `transcript_path` values, its `run_ids` (job logs through `gh run view
142
+ <id> --log-failed`) and its `comment_ids`. Ask for the mechanism of the
143
+ delay or the failure, with evidence.
144
+ 3. Write a retrospective of 30 lines or fewer in your scratch space. Name
145
+ the top one to three bottlenecks. For each: the mechanism, the wasted
146
+ minutes or rounds from the retro numbers, and the exact lever (a seats
147
+ setting, a rule of the issue-flow skill, or a code path). Metrics with
148
+ `status: unavailable` are gaps, not zero.
149
+ 4. Tell the owner the retrospective path and the top bottleneck (§2 step
150
+ 5). The owner reviews it before anyone files a workflow change.
@@ -145,9 +145,10 @@ after each claim or status change.
145
145
  - **PR slots.** One issue can name several PRs in advance (PR-1a, PR-1b),
146
146
  each with its own scope. Each slot is claimed separately: the
147
147
  coordinator posts one `issue claim` per slot, with `Slot: PR-1b`.
148
- Without named slots, one bundle (one or more issues of one module and
149
- write scope) is one writer, under one bundle claim
150
- (`rh board dispatch --issues <a>,<b>,<c>`).
148
+ Without named slots, one plan unit (one issue, or a bundle of issues of
149
+ one module and write scope declared in the plan block `merge_order`) is
150
+ one writer, under one bundle claim (`rh board dispatch`, or
151
+ `--issues <a>,<b>,<c>` for one declared unit).
151
152
  - **PR dependencies** are base branches. A PR that needs another PR's
152
153
  unmerged code sets its base to that PR's branch. A PR to issue link is
153
154
  `Closes #<issue>` or `Refs #<issue>` in the PR body.
@@ -73,10 +73,17 @@ Make one child issue for each pair of module and observable outcome.
73
73
  - **Order.** Contract and types → core logic → effects and adapters →
74
74
  CLI or server → UI → docs and map. Deletion of the old path goes with
75
75
  the change that replaces it, never as "cleanup later".
76
- - **Bundles.** Fine child issues stay requirement units. At dispatch,
77
- group the open issues of one module and write scope into one bundle:
78
- one worker, one worktree, one PR, one CI run, one review. A P2 or P3
79
- review finding stays in the review record and gets no issue.
76
+ - **Bundles.** Fine child issues stay requirement units. In the plan,
77
+ group the open issues of one module and write scope into one bundle
78
+ unit, an array entry of `merge_order` (`templates.md`, plan): one
79
+ worker, one worktree, one PR, one CI run, one review. The plan block is
80
+ the only record of bundle membership. A `tier:high` issue never shares
81
+ a unit with a Low or Medium issue; Low and Medium may combine. A High
82
+ unit holds only issues of one file and one rule, two at most: in the
83
+ #2841 retro 30 of 38 High PRs failed round 1, a High PR can close after
84
+ round 2, and a larger High diff makes that close more probable and then
85
+ costs the whole unit. A P2 or P3 review finding stays in the review
86
+ record and gets no issue.
80
87
 
81
88
  ## 3. Write the boundaries
82
89
 
@@ -198,6 +205,28 @@ plan:
198
205
  | `SHELVE` | An owner roadmap item, or an item that a vendor or upstream blocks | Label `status:deferred` and keep it open, off the dispatch board. It closes only on the owner's word |
199
206
  | `CLOSE` | An agent-spawned P2 or P3 issue | Close it as not planned |
200
207
 
208
+ A defect of one rule in one file costs one PR, one CI run and one review.
209
+ Three rules keep it that way:
210
+
211
+ - **Same-rule sibling.** A writer sends `[rh-question] sibling <file:line>
212
+ <size>` before PUSHED (`worker.md` §3). Answer `CONSOLIDATE` when the
213
+ sibling is in the same file or function, has the same tier, and the
214
+ total stays inside the reviewable size (§2). The sibling then joins the
215
+ PR. Post one line on the issue, and add a `Closes` line only when an
216
+ issue for the sibling exists. Otherwise name the reason. A sibling in
217
+ another module follows the contract-first order (§2). Before the PR is
218
+ open, the call is yours. On an open PR it grows the scope, so it is a
219
+ joint decision.
220
+ - **Base defect in round 1.** A round-1 row can name a base defect of the
221
+ same rule and the same file. Decide it before the merge. It joins the
222
+ round-1 fix only when that fix already changes the same function.
223
+ Otherwise it is one issue, and its dispatch may start from the merged
224
+ branch state. Round 2 absorbs nothing: it checks only the round-1 fixes,
225
+ and a new P1 inside them ends the loop.
226
+ - **Standalone lane.** Two open standalone issues with one rule and one
227
+ file go to one seat as one brief with two `Closes` lines. Issues with
228
+ different write scopes keep one issue per brief.
229
+
201
230
  Before you file a new issue during a batch:
202
231
 
203
232
  1. Search the open issues and PRs for the same design and consolidate a
@@ -254,12 +283,20 @@ module is in the title so that a list view shows the write scopes.
254
283
  bundle decisions, so the worker asks no design question. The worker
255
284
  replies `DONE <PR> <head>` or `BLOCKED <one question>`.
256
285
  - Post the claim, then the packet. `rh board dispatch --parent <n>
257
- --space <id> --issues <a>,<b>,<c>` starts one seat, one worktree and one
258
- tab for the bundle and posts the bundle claim on each issue, with the
259
- required fields in `templates.md` § issue claim and the `Issues:` line.
260
- It starts only when every issue is ready, and starts nothing otherwise.
261
- The claim is the worker's identity on the board, and the worker never
262
- posts one. Dispatch only after the claim is on each issue of the bundle.
286
+ --space <id>` starts one seat, one worktree and one tab for each ready
287
+ unit of the plan, and posts the claim on each open issue of the unit,
288
+ with the required fields in `templates.md` § issue claim and, for a
289
+ bundle, the `Issues:` line. A unit starts only when every open issue of
290
+ it is ready, and starts nothing otherwise; a closed issue of a unit is
291
+ not work and does not stop it. A bundle unit needs one tier label on
292
+ each issue, never mixes `tier:high` with a lower tier, and never mixes
293
+ `route:frontend` with another route; its route is the join of the
294
+ member routes (one `important_*` makes it important, one `*_deep` makes
295
+ it deep). `--issues <a>,<b>,<c>` selects one declared unit by its exact
296
+ issue set; any other set is refused with `not a plan unit; post the
297
+ plan again with rh board post plan`. The claim is the worker's identity
298
+ on the board, and the worker never posts one. Dispatch only after the
299
+ claim is on each issue of the bundle.
263
300
  - Dispatch in parallel only when the write scopes are disjoint and each
264
301
  dependency is merged, or its contract is stable and the issue allows
265
302
  early start.
@@ -446,6 +483,9 @@ host's PR events or check when the worker reports.
446
483
  for: <paths>` is a map bug. The worker fixes the consumer edge
447
484
  (`scripts/ci-path-consumers.ts`) or the test import. Never widen to the
448
485
  full suite unless a real full-suite input changed.
486
+ - **Sibling question.** Answer a `[rh-question] sibling` before the
487
+ writer pushes, and decide a round-1 base defect before the merge. The
488
+ rules are in §4.2 (Same-rule sibling, Base defect in round 1).
449
489
  - **Boundary question.** Decide fast. Either amend the issue (edit the body
450
490
  and post a `scope change` comment that says what changed and why), or
451
491
  open a new issue for the extra work and keep the PR narrow. Never let the
@@ -686,11 +726,11 @@ are true:
686
726
  - The PR is open and not draft, and every issue that it closes or refs
687
727
  (the parent excluded) is an item of the parent.
688
728
  - No hold record is in force on the parent, on the PR's issues or on the PR.
689
- - The plan does not hold its issues, its issues are in `merge_order`, and
690
- every issue before each of them in `merge_order` is closed or is an
691
- issue of the PR's bundle claim: a claim on the PR's head branch whose
692
- `Issues:` line names exactly the items that the PR closes. A bundle PR
693
- closes every plan item that its bundle claim names.
729
+ - The plan does not hold its issues, its issues are in `merge_order`, its
730
+ open issues are in one plan unit, and every issue of each earlier unit
731
+ is closed. A PR whose open issues span two units is refused: split it.
732
+ The command checks unit boundaries only; closing every open issue of
733
+ the unit is the worker's bundle rule (§7).
694
734
  - An acceptance record has a PASS row for the head, at every tier. The
695
735
  provisional `tier_low` status is not enough: post the Low record after
696
736
  you check the verification evidence.
@@ -254,10 +254,11 @@ Every template below ends with the line `Seat: <seat id> <hc address>` when a se
254
254
 
255
255
  `issue claim` is seat-only. The coordinator posts it, including the
256
256
  claim of each agent it dispatches. A bundle claim
257
- (`rh board dispatch --issues <a>,<b>,<c>`) puts one claim with the same
258
- `Agent:`, `Branch:` and `Issues:` line on each issue of the bundle. The board
257
+ (`rh board dispatch` for a bundle unit of the plan) puts one claim with the same
258
+ `Agent:`, `Branch:` and `Issues:` line on each open issue of the unit. The board
259
259
  reads `Issues:` as one writer for the whole bundle (attention rules A4, A12
260
- and A13, and the merge order); a line that does not parse or omits its own
260
+ and A13, and the blocked-by merge order of a parent without a plan; with a
261
+ plan, the plan unit decides the merge order); a line that does not parse or omits its own
261
262
  issue makes the claim unknown. Such a claim names the agent in
262
263
  `Agent:` and the coordinator's own claim in `Coordinator:`. Any other
263
264
  agent's claim is a request, not a claim role. A claim is valid only from an
@@ -330,6 +331,16 @@ Supersedes: <previous plan URL> # omit on the first plan
330
331
  After the fields comes exactly one fenced `json` block: the plan block.
331
332
  `decodePlanBlock` in `src/core/board/plan-block.ts` of repo-harness defines
332
333
  its protocol and fields (merge order, holds, seat limit).
334
+
335
+ ```json
336
+ {"protocol": 3, "kind": "repo-harness.plan", "merge_order": [[101, 102], 103], "holds": [{"issue": 103, "reason": "waits for the owner"}], "seat_limits": {"worker": 4}}
337
+ ```
338
+
339
+ Each `merge_order` entry is one unit: an issue number, or an array of two
340
+ or more issue numbers that one worker takes as one bundle (one seat, one
341
+ worktree, one PR). An issue appears once in the whole order. The units
342
+ merge in this order; the issues of one unit merge together. A protocol 2
343
+ block is refused: post the plan again with `rh board post plan`.
333
344
  `rh board --parent <n>` decodes the newest plan and fails on an
334
345
  invalid block. The block holds no dependency, membership or tier: those are
335
346
  GitHub fields (Plan data, above).
@@ -87,6 +87,13 @@ reviewer will send it back.
87
87
  - **No drive-by changes.** Do not refactor, rename or reformat code that
88
88
  the issue does not name, even when it looks wrong. Name it in your PR
89
89
  body as a note; it opens no issue.
90
+ - **Same-rule siblings.** After the fix, search the files that the PR
91
+ changes for the same defect shape. For each sibling of the same rule and
92
+ the same tier in a file that the PR already changes, send
93
+ `[rh-question] sibling <file:line> <size>` to the coordinator before
94
+ PUSHED. Fix it in this PR only when the coordinator answers
95
+ `CONSOLIDATE` (`orchestrator.md` §4.2). A sibling in another file is a
96
+ note in the PR body.
90
97
  - **Tests prove the issue.** Add or extend the tests that `验收 /
91
98
  Acceptance` names, including its negative checks. Never weaken, skip or
92
99
  delete an existing assertion to pass. If an existing test is wrong
@@ -157,6 +164,14 @@ typecheck and the affected test files, and say so. This record and CI on
157
164
  the head are the review evidence. Reviewers read them and do not rerun a
158
165
  passing check (`acceptor.md` §2.1).
159
166
 
167
+ A High-tier change that can delete or overwrite a user file (I2) needs one
168
+ more step before PUSHED. For each step that removes, restores or overwrites
169
+ a path, check five user states of the target: absent; edited; recreated with
170
+ the same bytes; restored from a backup; replaced by a link. Give each state
171
+ one test case or one line that says why the step refuses. Put the table in
172
+ the PR body. Equal bytes do not prove that rh wrote a file; only an identity
173
+ recorded at write time does.
174
+
160
175
  ## 6. Open the PR
161
176
 
162
177
  - Title: `<type>(<scope>): <outcome> (#<issue>)`.