harness-everything 1.2.2 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +29 -0
  4. package/ci/archive/325-prep/README.md +9 -2
  5. package/ci/archive/325-prep/doc-reconciliation-red.js +34 -8
  6. package/ci/fixtures/468-dispatch/agy-quota-PROVENANCE.md +19 -0
  7. package/ci/fixtures/468-dispatch/agy-quota-direct-individual.stderr +2 -0
  8. package/ci/fixtures/468-dispatch/agy-quota-direct-third-party.stderr +2 -0
  9. package/ci/fixtures/468-dispatch/agy-quota-exec-individual.log +3 -0
  10. package/ci/fixtures/553-t2a/body-edit/base/.agents/harness-everything/project-docs.json +11 -0
  11. package/ci/fixtures/553-t2a/body-edit/base/docs/a.md +6 -0
  12. package/ci/fixtures/553-t2a/body-edit/base/docs/b.md +1 -0
  13. package/ci/fixtures/553-t2a/body-edit/candidate/docs/a.md +6 -0
  14. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  15. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/governed-index.md +19 -0
  16. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  17. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/governed-index.md +19 -0
  18. package/ci/fixtures/553-t2c/derived-regenerate-must/config.json +17 -0
  19. package/ci/fixtures/doc-obligations/derive/regression-pins.json +153 -0
  20. package/ci/fixtures/state-persist-post-tool-use/harness.js +206 -0
  21. package/ci/fixtures/state-persist-post-tool-use/off-handoff-golden.json +16 -0
  22. package/ci/fixtures/state-persist-post-tool-use/payload-post-tool-use-success.json +13 -0
  23. package/ci/fixtures/stop/fail-session-writes.js +109 -0
  24. package/ci/fixtures/workflow-contract/cases.json +3355 -0
  25. package/ci/fixtures/workflow-contract/wiring-cases.json +560 -0
  26. package/ci/lib/doc-reconciliation-prep-fixtures.js +4 -9
  27. package/ci/mechanism-2an-workflow-replay.test.js +324 -0
  28. package/ci/mechanism-2ax-doc-lifecycle.test.js +132 -0
  29. package/ci/mechanism-325-3a-doc-evidence.test.js +73 -0
  30. package/ci/mechanism-325-3a-doc-obligations.test.js +61 -0
  31. package/ci/mechanism-325-3b-preparation.test.js +208 -49
  32. package/ci/mechanism-325-3b-s1-review.test.js +20 -828
  33. package/ci/mechanism-325-3b-s3-providers.test.js +59 -0
  34. package/ci/mechanism-325-f3-derived-views.test.js +140 -0
  35. package/ci/mechanism-341-opencode-lane.test.js +164 -284
  36. package/ci/mechanism-35-verification-contract.test.js +246 -0
  37. package/ci/mechanism-365-step-edit-accounting.test.js +5 -6
  38. package/ci/mechanism-383-doc-glob-line-terminators.test.js +0 -30
  39. package/ci/mechanism-397-opencode-observations.test.js +151 -18
  40. package/ci/mechanism-468-dispatch-cli.test.js +1496 -4
  41. package/ci/mechanism-548-bigint-identity.test.js +531 -0
  42. package/ci/mechanism-553-e1-unhook-credit.test.js +328 -0
  43. package/ci/mechanism-553-p2a-claude-hooks.test.js +98 -0
  44. package/ci/mechanism-553-p3-plan-start.test.js +212 -0
  45. package/ci/mechanism-553-state-persist-post-tool-use.test.js +307 -0
  46. package/ci/mechanism-553-stop.test.js +427 -0
  47. package/ci/mechanism-553-t2a-derive.test.js +110 -0
  48. package/ci/mechanism-553-t2c-derive.test.js +94 -0
  49. package/ci/mechanism-e1-derived-regenerate.test.js +45 -206
  50. package/ci/mechanism-error-ledger-oracle.test.js +786 -3
  51. package/ci/mechanism-error-ledger-scan.test.js +981 -0
  52. package/ci/mechanism-outline-sanitizer.test.js +0 -8
  53. package/ci/mechanism-pr-a-conflict-check.test.js +38 -305
  54. package/ci/mechanism-prb-outline-review.test.js +101 -3283
  55. package/ci/mechanism-report-writer.test.js +45 -0
  56. package/docs/adr/DOCS-006-reconciliation-pilot.md +4 -2
  57. package/docs/adr/DOCS-008-obligation-abstraction-bounded-consumer.md +3 -3
  58. package/docs/doc-workflow-reconciliation.md +17 -2
  59. package/docs/document-lifecycle.md +6 -2
  60. package/docs/error-handling/details/c8-dispatch-cli.md +109 -13
  61. package/docs/platform-capabilities.md +35 -5
  62. package/error-ledger-bootstrap/SKILL.md +1 -1
  63. package/error-ledger-bootstrap/references/workflow.md +42 -7
  64. package/error-ledger-bootstrap/scripts/promote.js +8 -6
  65. package/error-ledger-bootstrap/scripts/scan.js +525 -12
  66. package/hooks/hooks.json +0 -46
  67. package/hooks/scripts/lib/workflow-obligations.js +0 -55
  68. package/hooks/scripts/state-persist.js +7 -95
  69. package/hooks/scripts/workflow-disposition.js +0 -2
  70. package/hooks/scripts/workflow-stop-gate.js +17 -30
  71. package/opencode-plugin/index.mjs +6 -70
  72. package/opencode-plugin/plugin.json +1 -1
  73. package/package.json +1 -1
  74. package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
  75. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  76. package/plugins/harness-everything/hooks/scripts/lib/workflow-obligations.js +0 -55
  77. package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -95
  78. package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +0 -2
  79. package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +17 -30
  80. package/plugins/harness-everything/plugin.json +1 -1
  81. package/plugins/harness-everything/skills/error-ledger-bootstrap/SKILL.md +1 -1
  82. package/plugins/harness-everything/skills/error-ledger-bootstrap/references/workflow.md +42 -7
  83. package/plugins/harness-everything/skills/error-ledger-bootstrap/scripts/promote.js +8 -6
  84. package/plugins/harness-everything/skills/error-ledger-bootstrap/scripts/scan.js +525 -12
  85. package/sbom.cdx.json +7 -7
  86. package/scripts/dispatch.js +499 -87
  87. package/scripts/error-ledger-oracle.js +521 -27
  88. package/scripts/errors-sync.js +4 -3
  89. package/scripts/report-writer.js +4 -3
  90. package/ci/fixtures/doc-obligations/reconciliation-s1/cases.json +0 -6854
  91. package/ci/fixtures/doc-obligations/reconciliation-s1/fail-session-writes.js +0 -116
  92. package/ci/fixtures/doc-obligations/reconciliation-s2a/harness.js +0 -507
  93. package/ci/fixtures/doc-obligations/reconciliation-s2a/run13-workflow-requirements.json +0 -42
  94. package/ci/fixtures/doc-obligations/reconciliation-s2a/vectors.json +0 -617
  95. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/harness.js +0 -415
  96. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-post-tool-use-success-minimal.json +0 -9
  97. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-start.json +0 -7
  98. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-freetext-reject.json +0 -11
  99. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-reject.json +0 -11
  100. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop.json +0 -11
  101. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-task-result.json +0 -19
  102. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-capture-only.json +0 -99
  103. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-legacy.json +0 -67
  104. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-concurrent-writers.json +0 -62
  105. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-lookalikes-runtime-mutations.json +0 -67
  106. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-malformed.json +0 -85
  107. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-normal-session.json +0 -74
  108. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-runtime-drift-later-npm-test.json +0 -58
  109. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-valid-direct-quoted-review.json +0 -85
  110. package/ci/fixtures/doc-obligations/reconciliation-s2b/f4/cases.json +0 -2267
  111. package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/cases.json +0 -1110
  112. package/ci/lib/doc-reconciliation-file-spy.js +0 -23
  113. package/ci/lib/doc-reconciliation-qualification-preload.js +0 -37
  114. package/ci/lib/doc-reconciliation-replay.js +0 -104
  115. package/ci/lib/doc-reconciliation-staged-tree.js +0 -102
  116. package/ci/mechanism-325-3b-h1-qualification.test.js +0 -206
  117. package/ci/mechanism-325-3b-s1.test.js +0 -188
  118. package/ci/mechanism-325-3b-s2a-core.test.js +0 -840
  119. package/ci/mechanism-325-3b-s2a-producer.test.js +0 -564
  120. package/ci/mechanism-325-3b-s2b-capture.test.js +0 -566
  121. package/ci/mechanism-325-3b-s2b-wiring.test.js +0 -679
  122. package/ci/mechanism-325-f4-invariants.test.js +0 -606
  123. package/ci/mechanism-325-f4-projections.test.js +0 -392
  124. package/ci/mechanism-325-f4-qualification.test.js +0 -228
  125. package/ci/mechanism-325-f4-trust-boundary.test.js +0 -880
  126. package/ci/mechanism-e1-dependency-artifact-scope.test.js +0 -657
  127. package/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  128. package/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  129. package/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  130. package/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  131. package/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  132. package/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  133. package/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  134. package/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  135. package/hooks/scripts/w6-state-operations.js +0 -239
  136. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  137. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  138. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  139. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  140. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  141. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  142. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  143. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  144. package/plugins/harness-everything/hooks/scripts/w6-state-operations.js +0 -239
  145. package/scripts/system-one-eval-laya.js +0 -112
  146. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/capture → state-persist-post-tool-use}/payload-post-tool-use-failure.json +0 -0
  147. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/wiring → workflow-contract}/legacy-off-golden.json +0 -0
@@ -182,6 +182,40 @@ test('497 accepts the live codex -o shape: STATUS, one blank line, then the EOF
182
182
  assertOk(run(['check', '--file', output]));
183
183
  });
184
184
 
185
+ test('441-A accepts trailing ASCII spaces or tabs on raw Codex STATUS and writes canonical report bytes', t => {
186
+ const dir = tempDir(t);
187
+ const raw = path.join(dir, 'raw.txt');
188
+ const output = path.join(dir, 'report.md');
189
+
190
+ // P498-F shape: raw STATUS: BLOCKED: <reason> followed by two trailing ASCII spaces.
191
+ const blockedRaw = Buffer.from('Summary\nSTATUS: BLOCKED: verification unavailable \n');
192
+ fs.writeFileSync(raw, blockedRaw);
193
+ const blockedResult = run(writeArgs(output, 'BLOCKED', ['--from-codex-output', raw], '--reason', 'verification unavailable'));
194
+ assertOk(blockedResult);
195
+ assert.deepEqual(fs.readFileSync(raw), blockedRaw);
196
+ assert.deepEqual(fs.readFileSync(output), Buffer.from('Summary\nSTATUS: BLOCKED: verification unavailable\n'));
197
+ assertOk(run(['check', '--file', output]));
198
+
199
+ // Padded STATUS: DONE with a trailing ASCII tab.
200
+ const doneTabRaw = Buffer.from('Summary\nSTATUS: DONE\t\n');
201
+ fs.writeFileSync(raw, doneTabRaw);
202
+ const doneTabResult = run(writeArgs(output, 'DONE', ['--from-codex-output', raw]));
203
+ assertOk(doneTabResult);
204
+ assert.deepEqual(fs.readFileSync(raw), doneTabRaw);
205
+ assert.deepEqual(fs.readFileSync(output), Buffer.from('Summary\nSTATUS: DONE\n'));
206
+ assertOk(run(['check', '--file', output]));
207
+
208
+ // Padded STATUS: BLOCKED followed by a blank line and an EOF host label.
209
+ const labeledRaw = Buffer.from(`Summary\nSTATUS: BLOCKED: verification unavailable \t\n\n${VALID_LABEL}\n`);
210
+ fs.writeFileSync(raw, labeledRaw);
211
+ const labeledResult = run(writeArgs(output, 'BLOCKED', ['--from-codex-output', raw], '--reason', 'verification unavailable'));
212
+ assertOk(labeledResult);
213
+ assert.match(labeledResult.stderr, /stripped.*host label/i);
214
+ assert.deepEqual(fs.readFileSync(raw), labeledRaw);
215
+ assert.deepEqual(fs.readFileSync(output), Buffer.from('Summary\nSTATUS: BLOCKED: verification unavailable\n'));
216
+ assertOk(run(['check', '--file', output]));
217
+ });
218
+
185
219
  test('rejects embedded STATUS in body without changing an existing target', t => {
186
220
  const dir = tempDir(t);
187
221
  const output = path.join(dir, 'report.md');
@@ -266,11 +300,20 @@ test('rejects mismatched, malformed, duplicate, or trailing Codex controls and p
266
300
  const invalidRaw = [
267
301
  ['Summary\nSTATUS: BLOCKED: wrong reason\n', 'DONE'],
268
302
  ['Summary\nSTATUS: BLOCKED: wrong reason\n', 'BLOCKED', '--reason', 'expected reason'],
303
+ ['Summary\nSTATUS: BLOCKED: wrong reason \n', 'BLOCKED', '--reason', 'expected reason'],
304
+ ['Summary\nSTATUS: BLOCKED: expected reason \n', 'BLOCKED', '--reason', 'expected reason'],
305
+ ['Summary\nSTATUS: DONE\u00a0\n', 'DONE'],
306
+ ['Summary\nSTATUS: BLOCKED: expected reason\u00a0\n', 'BLOCKED', '--reason', 'expected reason'],
307
+ ['Summary\nSTATUS: DONE \n', 'DONE'],
269
308
  ['Summary\nSTATUS: FINISHED\n', 'DONE'],
270
309
  ['Summary\nSTATUS: malformed\nSTATUS: DONE\n', 'DONE'],
310
+ ['Summary\nSTATUS: DONE \nSTATUS: DONE\n', 'DONE'],
271
311
  ['Summary\nSTATUS: DONE\nSTATUS: DONE\n', 'DONE'],
312
+ ['Summary\nSTATUS: DONE \n\n', 'DONE'],
272
313
  ['Summary\nSTATUS: DONE\n\n', 'DONE'],
314
+ ['Summary\nSTATUS: DONE \ntext after status\n', 'DONE'],
273
315
  ['Summary\nSTATUS: DONE\ntext after status\n', 'DONE'],
316
+ [`Summary\nSTATUS: DONE ${VALID_LABEL}`, 'DONE'],
274
317
  [`Summary\nSTATUS: DONE\ntext\n${VALID_LABEL}`, 'DONE'],
275
318
  [`Summary\nSTATUS: DONE\n${VALID_LABEL}\n${VALID_LABEL}\n`, 'DONE'],
276
319
  [`Summary\nSTATUS: DONE\n${VALID_LABEL}\ntrailing text`, 'DONE'],
@@ -327,6 +370,8 @@ test('check accepts one terminal status with LF or CRLF and rejects other contro
327
370
  }
328
371
  for (const invalid of [
329
372
  'Summary',
373
+ 'Summary\nSTATUS: DONE ',
374
+ 'Summary\n STATUS: DONE',
330
375
  'Summary\nSTATUS: DONE\n\n',
331
376
  'Summary\nSTATUS: DONE\ntrailing',
332
377
  'Summary\nSTATUS: DONE\nSTATUS: DONE',
@@ -5,6 +5,8 @@ status: accepted
5
5
 
6
6
  # DOCS-006 — Doc reconciliation pilot (S1 default-OFF, F4 limited credit)
7
7
 
8
+ > **Historical note ([#553](https://github.com/dyphn1/Harness-everything/issues/553)):** This decision records the previous release's E1 reconciliation pilot, which #553 retired; current releases ignore every `HARNESS_DOC_RECONCILIATION_PILOT` value (see [E1 pilot retirement and retained document controls](../platform-capabilities.md#e1-pilot-retirement-and-retained-document-controls-553) and the [historical reconciliation guide](../doc-workflow-reconciliation.md)).
9
+
8
10
  ## Decision
9
11
 
10
12
  - The S1 runtime is default OFF. It runs only when `HARNESS_DOC_RECONCILIATION_PILOT=1`.
@@ -39,9 +41,9 @@ flowchart LR
39
41
 
40
42
  ## Evidence
41
43
 
42
- - Implementation: [doc-reconciliation-pilot.js](../../hooks/scripts/lib/doc-reconciliation-pilot.js) (env gate at line 8; `doc-lint` / `link-check` credit at line 246; `quality-review` collection from `SubagentStop` at lines 244 and 254; `conflict-check` collection at lines 251–252), [doc-check.js](../../harness-everything/scripts/doc-check.js) (flag parse at lines 86–88; `--base` required at line 102; `--all` lint at line 108; assessment at lines 468–498; credit at line 501), [doc-reconciliation-provider.js](../../hooks/scripts/lib/doc-reconciliation-provider.js) (corpus binding check at lines 763–785), [doc-reconciliation-core.js](../../hooks/scripts/lib/doc-reconciliation-core.js), [doc-reconciliation-producer.js](../../hooks/scripts/lib/doc-reconciliation-producer.js), [doc-reconciliation-events.js](../../hooks/scripts/lib/doc-reconciliation-events.js).
44
+ - Implementation: [doc-reconciliation-pilot.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/hooks/scripts/lib/doc-reconciliation-pilot.js) (env gate at line 8; `doc-lint` / `link-check` credit at line 246; `quality-review` collection from `SubagentStop` at lines 244 and 254; `conflict-check` collection at lines 251–252), [doc-check.js](../../harness-everything/scripts/doc-check.js) (flag parse at lines 86–88; `--base` required at line 102; `--all` lint at line 108; assessment at lines 468–498; credit at line 501), [doc-reconciliation-provider.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/hooks/scripts/lib/doc-reconciliation-provider.js) (corpus binding check at lines 763–785), [doc-reconciliation-core.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/hooks/scripts/lib/doc-reconciliation-core.js), [doc-reconciliation-producer.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/hooks/scripts/lib/doc-reconciliation-producer.js), [doc-reconciliation-events.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/hooks/scripts/lib/doc-reconciliation-events.js).
43
45
  - F4 contract: [doc-workflow-reconciliation.md § F4](../doc-workflow-reconciliation.md#f4-credited-reconciliation-claude-only-pilot-on). `conflict-check` row: [doc-workflow-reconciliation.md](../doc-workflow-reconciliation.md) line 1174.
44
- - Tests: [mechanism-pr-a-conflict-check.test.js](../../ci/mechanism-pr-a-conflict-check.test.js) (17/17 PASS at this SHA; mechanism only, no live-host run), [mechanism-325-3b-preparation.test.js](../../ci/mechanism-325-3b-preparation.test.js), [mechanism-325-3b-s1-review.test.js](../../ci/mechanism-325-3b-s1-review.test.js), [mechanism-325-3b-s2a-core.test.js](../../ci/mechanism-325-3b-s2a-core.test.js), [mechanism-325-3b-s2b-wiring.test.js](../../ci/mechanism-325-3b-s2b-wiring.test.js), [mechanism-341-opencode-lane.test.js](../../ci/mechanism-341-opencode-lane.test.js).
46
+ - Tests: [mechanism-pr-a-conflict-check.test.js](../../ci/mechanism-pr-a-conflict-check.test.js) (17/17 PASS at this SHA; mechanism only, no live-host run), [mechanism-325-3b-preparation.test.js](../../ci/mechanism-325-3b-preparation.test.js), [mechanism-325-3b-s1-review.test.js](../../ci/mechanism-325-3b-s1-review.test.js), [mechanism-325-3b-s2a-core.test.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/ci/mechanism-325-3b-s2a-core.test.js), [mechanism-325-3b-s2b-wiring.test.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/ci/mechanism-325-3b-s2b-wiring.test.js), [mechanism-341-opencode-lane.test.js](../../ci/mechanism-341-opencode-lane.test.js).
45
47
 
46
48
  ## Open gates
47
49
 
@@ -7,7 +7,7 @@ status: accepted
7
7
 
8
8
  ## Decision
9
9
 
10
- - The doc workflow reconciliation consumes the workflow obligation abstraction in a bounded way: the documentation path only, under the DOCS-006 gate.
10
+ - In the previous release, the doc workflow reconciliation consumed the workflow obligation abstraction in a bounded way: the documentation path only, under the [DOCS-006](DOCS-006-reconciliation-pilot.md) gate. That E1 reconciliation pilot has since been retired ([#553](https://github.com/dyphn1/Harness-everything/issues/553); see the historical note in [DOCS-006](DOCS-006-reconciliation-pilot.md)).
11
11
  - Broad promotion of the abstraction to generic workflow use is not approved. It is gated on the Phase 3c H1–H4 paired-task evidence and owner sign-off.
12
12
 
13
13
  ## Context
@@ -20,8 +20,8 @@ status: accepted
20
20
 
21
21
  ## Evidence
22
22
 
23
- - Implementation: [doc-reconciliation-core.js](../../hooks/scripts/lib/doc-reconciliation-core.js), [doc-obligations.js](../../harness-everything/scripts/doc-obligations.js) (the obligation table consumed by the doc path).
24
- - Consumer tests (exercise `doc-reconciliation-core.js` consuming `deriveDocObligations`): [mechanism-325-3b-s2a-core.test.js](../../ci/mechanism-325-3b-s2a-core.test.js), [mechanism-325-3b-s2b-wiring.test.js](../../ci/mechanism-325-3b-s2b-wiring.test.js).
23
+ - Implementation: [doc-reconciliation-core.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/hooks/scripts/lib/doc-reconciliation-core.js), [doc-obligations.js](../../harness-everything/scripts/doc-obligations.js) (the obligation table consumed by the doc path).
24
+ - Consumer tests (exercise `doc-reconciliation-core.js` consuming `deriveDocObligations`): [mechanism-325-3b-s2a-core.test.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/ci/mechanism-325-3b-s2a-core.test.js), [mechanism-325-3b-s2b-wiring.test.js](https://github.com/dyphn1/Harness-everything/blob/fa73c41aa6a611ff1f7eea573c80e87d23f756fe/ci/mechanism-325-3b-s2b-wiring.test.js).
25
25
  - Fail-closed controls (not evidence of the consumer): [mechanism-325-3b-preparation.test.js](../../ci/mechanism-325-3b-preparation.test.js), [mechanism-325-3b-s1-review.test.js](../../ci/mechanism-325-3b-s1-review.test.js), [mechanism-341-opencode-lane.test.js](../../ci/mechanism-341-opencode-lane.test.js).
26
26
 
27
27
  ## Open gates
@@ -5,8 +5,23 @@ status: active
5
5
 
6
6
  # Document workflow reconciliation — Phase 3b S1 runtime
7
7
 
8
- **Status: the runtime ships default OFF; opt in with `HARNESS_DOC_RECONCILIATION_PILOT=1`.
9
- With the pilot ON, F4 ([#358](https://github.com/dyphn1/Harness-everything/pull/358)) grants limited positive credit for exactly `doc-lint` and `link-check`, from a host-captured run of the installed doc-check on Claude Code 2.1.309 (live runs 4–5). S3 provider integration is pending; E1 remains OPEN with insufficient qualifying exposure. The recorded OpenCode [D1/D2 attempts](../benchmarks/results/live-host/opencode-d1-d2-2026-10-25/README.md) do not qualify as E1 cycles.**
8
+ > **Historical document — E1 pilot retired (#553).** This page was the operation guide for the
9
+ > retired E1 reconciliation pilot (S1/S2/S3/F4/W6). It records the design and preparation
10
+ > baselines of the previous release — source-traced at `dba4708`, `5f9726c` and `8903435`, plus
11
+ > the captured Claude Code 2.1.308/2.1.312 field-availability runs — and is not a description of
12
+ > the current entrypoints. **Current entrypoints** are the ordinary workflow/handoff and OpenCode
13
+ > V2 paths: workflow credit and Stop no longer load the E1 provider, and the E1 runtime modules and
14
+ > W6 `inventory`/`seal` CLI (`hooks/scripts/w6-state-operations.js`) have been removed (#553). Under
15
+ > the retirement contract every `HARNESS_DOC_RECONCILIATION_PILOT` value is ignored and normal hooks
16
+ > print no flag warning.
17
+ > Finish in-flight E1 work on the previous release, or end it and open a new session to redo
18
+ > review/verify on the current path; recorded journals, reports and outline artifacts stay in
19
+ > place. Issues [#325](https://github.com/dyphn1/Harness-everything/issues/325) and
20
+ > [#350](https://github.com/dyphn1/Harness-everything/issues/350) **remain open failure markers**;
21
+ > retirement does not close them.
22
+
23
+ **Historical status (the retired pilot shipped default OFF and previously opted in with `HARNESS_DOC_RECONCILIATION_PILOT=1`).
24
+ With the pilot ON, F4 ([#358](https://github.com/dyphn1/Harness-everything/pull/358)) granted limited positive credit for exactly `doc-lint` and `link-check`, from a host-captured run of the installed doc-check on Claude Code 2.1.309 (live runs 4–5). S3 provider integration remained pending; E1 remains OPEN with insufficient qualifying exposure. The recorded OpenCode [D1/D2 attempts](../benchmarks/results/live-host/opencode-d1-d2-2026-10-25/README.md) did not qualify as E1 cycles.**
10
25
  This document refines the [document lifecycle contract](document-lifecycle.md#phase-3b--narrow-integration-contract-s1-default-off-f4-limited-credit).
11
26
  The [accepted E0](https://github.com/dyphn1/Harness-everything/issues/341#issuecomment-6308604128)
12
27
  permits this limited, reversible consumer under the
@@ -34,7 +34,7 @@ This table distinguishes merged mechanism code from end-to-end workflow integrat
34
34
  | 2 — roles, IDs, aliases, legacy, supersession, index, D6.9 PRD revisions | **Merged** in #327; do not rebuild this lifecycle logic for Phase 3 |
35
35
  | Step-type prerequisite (#326) | **Complete:** PR #328 merged; Harness-owned `doc-change` is explicitly declared, has no implicit TDD binding, and is not auto-inserted by router/System One |
36
36
  | 3a — document facts, obligations and evidence producer | **Merged** in #334: `harness-everything/scripts/doc-obligations.js` and `doc-evidence.js`. H3/H4 have *partial deterministic mechanism* coverage, not integrated workflow evidence. Known limitations: caller-attested envelope; `configDigest` presence-only; `candidateDigest` restricted to `docs/prd/`; missing independent task-scope binding. Deleted and old rename paths are bound to trusted per-path baseline evidence ([doc-evidence-baseline-binding.md](doc-evidence-baseline-binding.md), #335 fixed by #342), with workflow-disposition reconciliation left out of scope |
37
- | 3b — pilot-local provider suggestions and workflow evidence reconciliation | **S1 runtime ships default OFF** (opt in with `HARNESS_DOC_RECONCILIATION_PILOT=1`), with trusted scope assessment and fail-closed withholding. **F4 (#358) adds limited positive credit** for exactly `doc-lint` and `link-check` from a host-captured run of the installed doc-check (Claude Code only; live runs on 2.1.309). See [S1 switch, trusted scope and no-credit contract](doc-workflow-reconciliation.md#s1--switch-trusted-scope-and-fail-closed-no-credit-gate). S3 pure advisory provider suggestions shipped in 0.37.0 (not wired); E1 remains OPEN with insufficient qualifying exposure, and D1/D2 are non-qualifying. Accepted #341 E0 permits this limited reversible consumer; the live runs are not E1 GO; preserve existing required-binding compatibility |
37
+ | 3b — pilot-local provider suggestions and workflow evidence reconciliation | **E1 pilot retired ([#553](https://github.com/dyphn1/Harness-everything/issues/553)); every `HARNESS_DOC_RECONCILIATION_PILOT` value is ignored** (normal hooks print no flag warning; workflow credit and Stop no longer load the E1 provider; the E1 runtime modules and W6 `inventory`/`seal` CLI have been removed). Previously, the S1 runtime shipped default OFF with trusted scope assessment and fail-closed withholding, and F4 (#358) added limited positive credit for `doc-lint` and `link-check` from a host-captured run of the installed doc-check (Claude Code only; live runs on 2.1.309) — see the [historical reconciliation guide](doc-workflow-reconciliation.md) and [S1 switch, trusted scope and no-credit contract](doc-workflow-reconciliation.md#s1--switch-trusted-scope-and-fail-closed-no-credit-gate). S3 pure advisory provider suggestions shipped in 0.37.0 (not wired); E1 remained OPEN with insufficient qualifying exposure, and D1/D2 were non-qualifying. Accepted #341 E0 permitted that limited reversible consumer; the live runs were not E1 GO; [#325](https://github.com/dyphn1/Harness-everything/issues/325) and [#350](https://github.com/dyphn1/Harness-everything/issues/350) remain open failure markers; preserve existing required-binding compatibility |
38
38
  | 3c — H1–H4 and paired-task evaluation | **H1 preparation only** in [#373](https://github.com/dyphn1/Harness-everything/pull/373) ([retained evidence](../benchmarks/results/h1-provider-independence-qualification/README.md)); full H1–H4 and paired-task evaluation remain pending. Mechanism tests alone are insufficient for architecture promotion; compare frozen baseline and treatment on real bounded tasks, success/failure first, then conditional cost and latency |
39
39
  | 1b — shared documentation craft and family metadata | **Shared craft delivered** in F2 (#356): shared references with thin skill consumers. Family metadata is not established. A small optional logical-family metadata seam may be piloted; physical skill directory moves remain blocked on #320 identity/path separation |
40
40
  | 4 — derived-view generators and `describes:` drift | **Regenerate-equals delivered** in F3 (#357) for authorized generators; `describes:` drift reminders and broader maintenance are not established. Preserve generator authorization, deterministic regenerate-equals and scoped reminder semantics |
@@ -43,6 +43,8 @@ This table distinguishes merged mechanism code from end-to-end workflow integrat
43
43
 
44
44
  ### Phase 3b — narrow integration contract (S1 default OFF; F4 limited credit)
45
45
 
46
+ > **Historical applicability (E1 pilot retired in [#553](https://github.com/dyphn1/Harness-everything/issues/553)):** This subsection records the narrow integration contract, default-OFF gate, F4 limited credit, and prior #341 E0/E1 activation thresholds of the retired E1 reconciliation pilot from the previous release. Under #553, every `HARNESS_DOC_RECONCILIATION_PILOT` value is ignored, workflow credit and Stop no longer load the E1 provider, and the E1 runtime modules and W6 `inventory`/`seal` CLI have been removed; see the [historical reconciliation guide](doc-workflow-reconciliation.md) and [E1 pilot retirement and retained document controls](platform-capabilities.md#e1-pilot-retirement-and-retained-document-controls-553). The S3 pure advisory provider suggestion API (`suggestDocProviders`) remains shipped (not wired), and issues [#325](https://github.com/dyphn1/Harness-everything/issues/325) and [#350](https://github.com/dyphn1/Harness-everything/issues/350) remain open failure markers.
47
+
46
48
  The preparation design, test-only provider/trust contracts, and qualified RED replay are complete:
47
49
  [Document workflow reconciliation](doc-workflow-reconciliation.md),
48
50
  [case corpus](../ci/fixtures/doc-obligations/reconciliation-prep/cases.json),
@@ -72,6 +74,8 @@ default-OFF gate, and F4 (#358) adds limited positive credit for `doc-lint` and
72
74
 
73
75
  ### Phase 3b minimum trust boundary and Phase 3c H3 validation (planned, not shipped)
74
76
 
77
+ > **Historical pilot context ([#553](https://github.com/dyphn1/Harness-everything/issues/553)):** The Phase 3b pilot-local adapter details below reflect the design background of the retired E1 pilot; the H3 trust-boundary criteria and the #320 functional/architectural promotion gates below remain in force, and [#325](https://github.com/dyphn1/Harness-everything/issues/325) and [#350](https://github.com/dyphn1/Harness-everything/issues/350) remain open failure markers.
78
+
75
79
  Phase 3b delivers the minimum producer and identity/scope binding needed for a trustworthy PASS; Phase 3c extends the same seam with adversarial H3 validation and paired architectural evaluation.
76
80
 
77
81
  - **Trusted producer, not the checker:** a pilot-local adapter is a **3b deliverable**; it derives the VCS baseline and candidate identity, active task scope, project-docs config identity (parsed config bytes, not presence) and execution/review provenance from host state. `checkDocObligations()` proves only that records agree with those caller-supplied values; matching a caller-provided digest is not independent validation of the input.
@@ -93,7 +97,7 @@ Phase 3b delivers the minimum producer and identity/scope binding needed for a t
93
97
 
94
98
  Two *separate* gates apply. The **functional gate** requires contract tests, negative cases, source/package parity, host/platform compatibility and an all-green applicable CI baseline. The **architectural gate** additionally requires H1–H4 and independently reviewed paired real-task outcomes. Freeze task fixtures, acceptance rubrics, model/effort, host permissions, comparison order and thresholds **after baseline measurement but before treatment outcomes**. Compare task correctness and failures first; report successful-task token/time/tool cost and failed-run overhead separately, with uncertainty. A small inconclusive sample is not approval. Broader #320 CDG/registry compilation and physical skill moves need **explicit owner sign-off on each specific validated interface**; retain the legacy path until then.
95
99
 
96
- **Cross-contract acceptance assertion:** the #341 E0/E1 gates in the Phase 3b entry-gates bullet above, [#341](https://github.com/dyphn1/Harness-everything/issues/341) and #325's phase table must stay mutually consistent: a change to one gate's semantics updates the other two records, replays affected #341 fixtures first, and only then re-collects affected 3b observations. E0 enables only the bounded, reversible, doc-only runtime consumer; E1 gates expansion beyond the limited pilot; neither approves generic #320 CDG/registry promotion, which additionally requires the H1–H4 paired real-task evidence and explicit owner sign-off above.
100
+ **Cross-contract acceptance assertion:** the #341 E0/E1 gates in the Phase 3b entry-gates bullet above, [#341](https://github.com/dyphn1/Harness-everything/issues/341) and #325's phase table must stay mutually consistent: a change to one gate's semantics updates the other two records, replays affected #341 fixtures first, and only then re-collects affected 3b observations. E0 enabled only the bounded, reversible, doc-only runtime consumer (now retired by [#553](https://github.com/dyphn1/Harness-everything/issues/553) before reaching E1 GO, leaving [#325](https://github.com/dyphn1/Harness-everything/issues/325) and [#350](https://github.com/dyphn1/Harness-everything/issues/350) open); E1 gated expansion beyond the limited pilot; neither approves generic #320 CDG/registry promotion, which additionally requires the H1–H4 paired real-task evidence and explicit owner sign-off above.
97
101
 
98
102
  ## Configuration (D5)
99
103
 
@@ -5,27 +5,30 @@ This detail implements the C8 action map for one coordinator-selected runner att
5
5
  ## Invocation
6
6
 
7
7
  ```sh
8
- npm run --silent dispatch -- --runner <codex|opencode> --model <id> \
8
+ npm run --silent dispatch -- --runner <codex|opencode|agy> --model <id> \
9
9
  --packet <path> --worktree <git-root> --scratch <absolute-external-path> \
10
- --report <path> [--effort <low|medium|high|xhigh>] [--dry-run] [--json]
10
+ --report <path> [--effort <low|medium|high|xhigh>] [--assignment <path>] \
11
+ [--admission-policy <path>] [--dry-run] [--json]
11
12
  ```
12
13
 
13
- `node scripts/dispatch.js` accepts the same options. `--help` prints this short synopsis. The coordinator supplies every value; packet and report paths may be relative to the worktree or absolute. The worktree must be an existing Git root. Scratch must be absolute and outside every Git repository/worktree. A pre-existing report path is rejected as invalid input.
14
+ `node scripts/dispatch.js` accepts the same options. `--help` prints this short synopsis. The coordinator supplies every value; packet and report paths may be relative to the worktree or absolute (for `agy`, both must resolve inside `--worktree` so the prompt passes cwd-relative worker paths only). The worktree must be an existing Git root. Scratch must be absolute and outside every Git repository/worktree. A pre-existing report path is rejected as invalid input.
14
15
 
15
16
  | Option | Meaning |
16
17
  | --- | --- |
17
- | `--runner` | Required explicit selection: `codex` or `opencode`. |
18
+ | `--runner` | Required explicit selection: `codex`, `opencode`, or `agy`. |
18
19
  | `--model` | Required model id for that runner. |
19
- | `--packet` | Required existing packet file, resolved from the worktree when relative. |
20
+ | `--packet` | Required existing packet file, resolved from the worktree when relative (must resolve inside `--worktree` for `agy`). |
20
21
  | `--worktree` | Required existing Git repository or worktree root; child cwd. |
21
- | `--scratch` | Required absolute path outside all Git repository/worktree roots; child `TMPDIR`. |
22
- | `--report` | Required fresh report path, resolved from the worktree when relative. |
23
- | `--effort` | Optional Codex reasoning effort: `low`, `medium`, `high`, or `xhigh`. It passes a Codex `-c model_reasoning_effort="…"` override; omission leaves Codex configuration unchanged. Rejected for OpenCode. |
22
+ | `--scratch` | Required absolute path outside all Git repository/worktree roots; child `TMPDIR` (in managed mode: the external root of per-attempt directories, see [Managed scratch](#managed-scratch-and-lifecycle-466-d-scratch)). |
23
+ | `--report` | Required fresh report path, resolved from the worktree when relative (must resolve inside `--worktree` for `agy`). |
24
+ | `--effort` | Optional Codex reasoning effort: `low`, `medium`, `high`, or `xhigh`. It passes a Codex `-c model_reasoning_effort="…"` override; omission leaves Codex configuration unchanged. Rejected for OpenCode and `agy`. |
25
+ | `--assignment` | Optional managed-mode gate assignment sidecar JSON; see [Managed mode](#managed-mode-and-gate-assignment-466-d-gate). |
26
+ | `--admission-policy` | Required in managed mode (`--assignment`); host-level per-pool reservation policy JSON, see [Managed admission](#managed-per-pool-admission-466-d-admission). Rejected in unmanaged mode (`10 INVALID_INPUT`). |
24
27
  | `--dry-run` | Validate inputs and return planned argv/cwd; no child or filesystem writes. |
25
28
  | `--json` | Return one JSON object on stdout, including refusals. |
26
29
  | `--help` | Return the short usage synopsis with exit 0. |
27
30
 
28
- In JSON mode the common shape is `{ok, code, phase, message}` with resolved `runner`, `model`, and existing `evidence` paths when available. A validated requested Codex `--effort` is also returned as `effort`; it records the request and does not claim the provider applied it. Dry run also returns `argv` and `cwd`; Codex's generated raw-output argument uses a `<run-id>` placeholder. Human-mode refusals go to stderr. Child logs and raw output stay in evidence files, not in the JSON result.
31
+ In JSON mode the common shape is `{ok, code, phase, message}` with resolved `runner`, `model`, and existing `evidence` paths when available. A validated requested Codex `--effort` is also returned as `effort`; it records the request and does not claim the provider applied it. For `agy`, JSON also returns `sandbox: "requested"`; it records the requested `--sandbox` flag only and does not claim proven isolation (scope any isolation claim to separately executed evidence). Dry run also returns `argv` and `cwd`; Codex's generated raw-output argument uses a `<run-id>` placeholder. Human-mode refusals go to stderr. Child logs and raw output stay in evidence files, not in the JSON result.
29
32
 
30
33
  ## Exit and JSON codes
31
34
 
@@ -34,7 +37,7 @@ In JSON mode the common shape is `{ok, code, phase, message}` with resolved `run
34
37
  | `0` | `HELP`, `DRY_RUN_OK`, `DONE` | Help, validated dry run, or a fresh validated DONE report. |
35
38
  | `1` | `INTERNAL_ERROR` | Unexpected application failure outside a named phase result. |
36
39
  | `10` | `INVALID_INPUT` | Bad/missing/duplicate option, unsupported or runner-incompatible effort, runner/model, packet/worktree, or a report path that already exists. |
37
- | `11` | `UNSAFE_SCRATCH` | Scratch is relative, an existing scratch path is not a directory, or it is inside a Git repository/worktree. |
40
+ | `11` | `UNSAFE_SCRATCH` | Scratch is relative, an existing scratch path is not a directory, it crosses a dangling symlink or unresolved symlink chain, or it resolves inside a Git repository/worktree. |
38
41
  | `12` | `NOT_READY` | Selected executable is missing or readiness failed, timed out, or omitted `READY`. No run starts. |
39
42
  | `13` | `RUNNER_RATE_LIMITED` | The selected runner's failed readiness stderr has a recognized provider throttling diagnostic. No run starts. |
40
43
  | `13` | `RUNNER_QUOTA` | The selected runner's failed readiness stderr has an explicit usage/quota exhaustion diagnostic. No run starts. |
@@ -60,20 +63,113 @@ Classification requires a full runner-specific diagnostic line on the failed rea
60
63
  | OpenCode usage/quota exhaustion | `Error: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go` | The stderr envelope is live-traced; the cause is from the retained OpenCode log. |
61
64
  | Codex provider rate limit | `ERROR: Provider request failed with HTTP 429: {"status":429,"title":"Too Many Requests"}` | Fixture-only; no retained live Codex 429 trace. |
62
65
  | Codex usage/quota exhaustion | `ERROR: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go` | Fixture-only; no retained live Codex usage-limit trace. |
66
+ | `agy` usage/quota exhaustion | One normal exit `3` (no signal, no spawn error, no timeout, no report) whose ANSI-stripped stderr has exactly one full line `error: <Third-party\|Individual> quota reached. … Resets in <duration>.` **and** exactly one `AGY_ERROR: <json>` line whose parsed object has `status: "RESOURCE_EXHAUSTED"` and numeric `error_code: 429` and whose `short_error` names the same pool. Advice text, reset value and redacted identifier are not pinned. | Live-backed stderr shape from the sanitized captures in `ci/fixtures/468-dispatch/agy-quota-*` (see `agy-quota-PROVENANCE.md`); the managed wrappers and the execution exit status are fixtures. One recognizer serves readiness and execution. Duplicate, contradictory, partial, malformed, generic/quoted, wrong/split-stream, stdout-only or retired-single-line diagnostics, unsupported pools, other exit shapes, and runs that wrote a report are not classified as quota. |
63
67
 
64
68
  Each invocation uses one selected runner and one readiness attempt. A `12` or `13` refusal starts no execution, report writer, fallback, or retry; available child evidence remains available to the coordinator.
65
69
 
66
- Codex writes raw output with `codex exec -o`; it must contain an explicit terminal DONE or BLOCKED status. `report-writer --from-codex-output` strips an optional valid terminal host label (blank lines between STATUS and the label are allowed; live codex output has one), writes the final report, and `report-writer check` validates it. OpenCode is asked to write the report path directly; the path must remain absent through readiness and the resulting file must pass `report-writer check`. A valid BLOCKED report returns 17. Failed execution returns 15 and preserves its logs/raw output; it may have changed the worktree.
70
+ Codex writes raw output with `codex exec -o`; it must contain an explicit terminal DONE or BLOCKED status. `report-writer --from-codex-output` strips an optional valid terminal host label (blank lines between STATUS and the label are allowed; live codex output has one), writes the final report, and `report-writer check` validates it. OpenCode and `agy` follow the direct-delivery contract: the worker writes the report path directly, the path must remain absent through readiness (pre-existing returns `10 INVALID_INPUT`, populated during readiness returns `16 REPORT_INVALID`), exit 0 without a fresh regular report file fails delivery (`16 REPORT_INVALID`) with logs retained, and the resulting file must pass `report-writer check`. A valid BLOCKED report returns 17. Failed execution returns 15 and preserves its logs/raw output (for `agy`, an execution exit `3` with no report and the validated diagnostic pair above returns `13 RUNNER_QUOTA` with `phase: "execution"` and logs retained); a failed execution may have changed the worktree. The execution-pair fixture is derived from a live Individual stderr shape plus a fixture exit status: the captured managed result was `15 RUN_FAILED` and did not preserve its original exit status, so the `13 RUNNER_QUOTA` execution row is a fixture outcome, not a live reclassification (see `ci/fixtures/468-dispatch/agy-quota-PROVENANCE.md`).
71
+
72
+ ## `agy` headless runner adapter (#466 D-agy)
73
+
74
+ `agy` is invoked with the pinned headless argv, `cwd` set to `--worktree`, closed stdin (`stdio: ['ignore', 'pipe', 'pipe']`), and child execution bounded by C8 (`120s` readiness, `2700s` execution) in addition to `--print-timeout`:
75
+
76
+ ```sh
77
+ agy -p "<prompt>" --model <id> --mode accept-edits --sandbox \
78
+ --settings '{"permissions":{"allow":["command(*)","read_file(*)"]}}' --print-timeout <N>s
79
+ ```
80
+
81
+ - **Cwd-relative worker paths:** `--packet` and `--report` must resolve inside `--worktree` (otherwise `10 INVALID_INPUT`), and the execution prompt points only at cwd-relative paths (`<packet-rel>`, `<report-rel>`).
82
+ - **Readiness:** runs the same pinned argv with `Reply with the single word READY` and `--print-timeout 120s`; accepts `READY` or `READY.` after dropping an optional trailing Harness host label. A failed readiness check starts no execution.
83
+ - **Sandbox configuration:** `--sandbox` is recorded as requested configuration (`sandbox: "requested"` in JSON). No isolation is claimed; scope any isolation claim to separately executed evidence.
84
+ - **Gate profile:** `runnerProfile('agy')` returns `{ sandboxed: true }` conservatively because `agy` requests `--sandbox` and is not treated as an unsandboxed loopback-capable profile. Assigning `verify:all` or `verify:all --fast` to the worker returns `18 GATE_REFUSED` ("assign it to the coordinator").
85
+ - **Evidence:** fixture rows A1–A10 in `ci/mechanism-468-dispatch-cli.test.js` (real Node entry, stubbed `agy` fixture). Live `agy` runs remain out of scope here until admission is in place.
67
86
 
68
87
  ## Evidence boundary
69
88
 
70
89
  | Layer | What it establishes | What it does not establish |
71
90
  | --- | --- | --- |
72
- | Fixture | The real Node entry with stubbed child runners exercises argv, cwd, closed stdin, readiness, quota, timeout, fresh delivery, report writing/checking, and exit/JSON outcomes. | No real provider behavior or live host behavior. |
91
+ | Fixture | The real Node entry with stubbed child runners exercises argv, cwd, closed stdin, readiness, quota, timeout, fresh delivery, report writing/checking, and exit/JSON outcomes. Captured `agy` quota-pair rows replay sanitized live stderr through that entry. | No real provider behavior or live host behavior. The managed exit status is a fixture; only the direct calls establish a live normal exit 3. |
73
92
  | Checkout/package entry | The npm script invokes the checked-in entry, and documented options work through that entry; named repository gates validate local consistency and portability. | No installed npm tarball or distributed plugin integration. |
74
93
  | Live dispatch (2026-11-21, #497) | One full `npm run --silent dispatch` per runner on this Mac: OpenCode `opencode/hy4-flash-free` and Codex `gpt-6-luna --effort medium`, a two-line probe packet, both `0 DONE` with a validated report. The readiness replies carried a trailing host label; the Codex raw output had a blank line before it. | Effort is recorded as requested; provider-side application of the effort is not observed. One run each, not a reliability claim. |
75
94
  | Live (channel probe only) | `opencode run --auto -m <model>`, the exact C8 OpenCode readiness argv, against failing nvidia models on OpenCode 2.1.4 (2026-11-21): provider errors reach stderr as one ANSI `Error: <message>` line, exit 1, empty stdout. | Not a C8 dispatch: no live 429 or quota reproduction (the 429 and quota bodies come from the retained OpenCode log), no Codex provider call, no host dispatch or live report delivery. |
76
95
 
96
+ ## Managed mode and gate assignment (#466 D-gate)
97
+
98
+ Managed mode is entered only by `--assignment <path>` (resolved from the worktree when relative): a sidecar JSON file next to the packet. Without the option, behavior, output, and JSON shape are unchanged. A sidecar was chosen over packet frontmatter so the C6 packet format stays untouched and C8 reads one strict, machine-checkable file; packet metadata owns which actor runs each gate, C8 owns admission.
99
+
100
+ ```json
101
+ { "schemaVersion": 1, "gates": [ { "id": "verify:all", "actor": "coordinator" }, { "id": "npm run test:consistency", "actor": "worker" } ] }
102
+ ```
103
+
104
+ Validation is strict: the root has exactly `schemaVersion` (`1`) and `gates`; each gate has exactly `id` and `actor` (`worker` or `coordinator`); ids are unique and must be in the registry. Any unknown key, value, shape, unreadable file, or unknown id returns `19 GATE_ASSIGNMENT_INVALID`.
105
+
106
+ | Gate id | Requirement for a worker |
107
+ | --- | --- |
108
+ | `verify:all`, `verify:all --fast` | Unsandboxed, loopback-capable profile |
109
+ | `npm run test:consistency`, `npm run test:references`, `npm run test:portability`, `node --test <repo-relative .js file>` | Any profile (focused) |
110
+
111
+ One decision function maps the selected runner to a profile: `codex` runs `-s workspace-write` and `agy` requests `--sandbox` (not treated as an unsandboxed loopback-capable profile), so both are conservatively `sandboxed: true`; `opencode` is not. A sandboxed profile with a worker assignment of either full or fast `verify:all` returns `18 GATE_REFUSED` ("assign it to the coordinator"). Both refusals happen after input validation and before readiness or any file creation, so no child starts and no scratch, report, or evidence exists; `--dry-run` applies the same refusals. An accepted managed run returns `gates: {worker: [...], coordinator: [...]}` in JSON (also on dry run). C8 never runs a gate itself: coordinator gates are only recorded, and the attempt is the same single readiness plus execution.
112
+
113
+ | Exit | JSON `code` | Meaning |
114
+ | --- | --- | --- |
115
+ | `18` | `GATE_REFUSED` | Managed worker gate needs a profile the selected runner does not provide. |
116
+ | `19` | `GATE_ASSIGNMENT_INVALID` | Managed assignment is missing, malformed, or names an unknown gate. |
117
+
118
+ Evidence: fixture rows G1–G7 in `ci/mechanism-468-dispatch-cli.test.js` (real entry, stubbed runners). The registry is a v1 list of gates C8 can assess; gates outside it are refused rather than assumed.
119
+
120
+ ## Managed scratch and lifecycle (#466 D-scratch)
121
+
122
+ This is #466 policy within C8, entered only with `--assignment`. In managed mode `--scratch` names the canonical external **root**, not the child `TMPDIR`. Unmanaged invocations (no `--assignment`) are unchanged: `--scratch` is used directly and nothing is removed.
123
+
124
+ | Step | Behavior |
125
+ | --- | --- |
126
+ | Root check | Same `UNSAFE_SCRATCH` (`11`) validation as before, on the canonical path: a root inside any repository or linked worktree, including through a symlink or a symlinked ancestor, or crossing a dangling symlink or unresolved symlink chain at the root or any ancestor, is refused before any slot, directory, report, or child exists. |
127
+ | Attempt dir | After validation and admission, C8 creates `<root>/attempt-<random>` with `mkdtemp` (distinct for concurrent attempts, even on one root). It is re-resolved after creation; one that lands inside a repository is removed and refused. It is the child `TMPDIR` and holds readiness/run/report-writer logs and Codex raw output. |
128
+ | Checked DONE | Report validated and not BLOCKED: the logs and raw output are copied to `<root>/retained/<attempt>/` (outside the run dir), each copy is size-verified, and only then this attempt's own directory is removed. The JSON `evidence` paths point at the retained copies. Other attempt dirs are never touched. The report stays at `--report`. |
129
+ | BLOCKED (`17`), failure (`12`/`13`/`15`/`16`) | The attempt dir and all available evidence are kept. |
130
+ | Retention failure | Returns `20 EVIDENCE_RETENTION_FAILED` (phase `retention`) although the report was valid; the attempt dir and evidence are kept, and `evidence` points at them. |
131
+ | `--dry-run` | Creates no root, attempt dir, or child. |
132
+
133
+ | Exit | JSON `code` | Meaning |
134
+ | --- | --- | --- |
135
+ | `20` | `EVIDENCE_RETENTION_FAILED` | Managed DONE could not copy and verify its evidence outside the run dir; nothing was deleted. |
136
+
137
+ Scratch and evidence have different lifetimes: scratch is disposable only after a checked DONE has usable retained evidence. Evidence: fixture rows S1–S8 in `ci/mechanism-468-dispatch-cli.test.js`.
138
+
139
+ ## Managed per-pool admission (#466 D-admission)
140
+
141
+ In managed mode (`--assignment`), C8 requires `--admission-policy <path>` (resolved from the worktree when relative) and atomically reserves one slot for the selected credential or shared quota pool before readiness. Without `--assignment`, unmanaged invocations are unchanged and take no reservation (`--admission-policy` without `--assignment` returns `10 INVALID_INPUT`).
142
+
143
+ ```json
144
+ {
145
+ "schemaVersion": 1,
146
+ "dir": "/abs/external/admission-dir",
147
+ "pools": {
148
+ "opencode-pilot-key": { "cap": 2 },
149
+ "agy-shared-pool": { "cap": 1 }
150
+ },
151
+ "routes": [
152
+ { "runner": "opencode", "model": "fixture/opencode-model", "pool": "opencode-pilot-key" },
153
+ { "runner": "opencode", "model": "fixture/opencode-alias", "pool": "opencode-pilot-key" },
154
+ { "runner": "agy", "model": "gemini-4-neon-medium", "pool": "agy-shared-pool" }
155
+ ]
156
+ }
157
+ ```
158
+
159
+ - **Strict validation (`21 ADMISSION_POLICY_INVALID`, phase `admission`):** exact root keys (`schemaVersion: 1`, `dir`, `pools`, `routes`); `dir` must be an absolute directory outside every Git repository/worktree (reusing the canonical path check from D-scratch) and disjoint from `--scratch`; `pools` maps opaque pool ids (`^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$`) to `{ "cap": <integer >= 1> }`; `routes` maps unique `(runner, model)` pairs to defined pools; the selected `(runner, model)` must have a route. Missing, malformed, or unknown policies refuse before spawn.
160
+ - **Opaque identity, no credentials:** pool ids are operator-supplied opaque names. C8 never derives identity from environment secrets and never emits credential values in JSON, slot files, or evidence. Aliases sharing a pool consume the same cap even across different scratch roots.
161
+ - **Atomic bounded slots:** `<dir>/<pool>/slot-<0..cap-1>.json` created with `O_EXCL` (`wx`). Each slot records `{ schemaVersion: 1, pool, slot, holderPid, childPid, startedAt }`, updating `childPid` when a child spawns and clearing it after the child exits.
162
+ - **Over-cap refusal (`22 ADMISSION_CAP_REACHED`, phase `admission`):** no queueing. If all `cap` slots are occupied (including live, abandoned, corrupt, or indeterminate slot files), the excess attempt refuses before spawn and creates no scratch attempt dir; independent pools remain eligible.
163
+ - **Release and coordinator manual slot recovery:** DONE, BLOCKED, readiness failure, runner failure, timeout, and report/retention errors release the owned slot in `finally` after the child has ended (verifying ownership before unlink). Automatic stale-slot reclamation is disabled for the pilot: any existing slot file — including an abandoned, corrupt, or indeterminate reservation — is treated as occupied and is never displaced by contenders. To recover an abandoned slot, the coordinator must first quiesce admission for that pool, confirm that the recorded `holderPid` and any `childPid` (and any spawned child process) have ended and are absent, and only then remove the stale `slot-<k>.json` file before resuming admission.
164
+ - **`--dry-run`:** validates the policy and route and returns `admission: { pool, cap }` without creating `dir` or taking any reservation.
165
+
166
+ | Exit | JSON `code` | Meaning |
167
+ | --- | --- | --- |
168
+ | `21` | `ADMISSION_POLICY_INVALID` | Managed admission policy is missing, malformed, unsafe, or has no route for the selected runner/model. |
169
+ | `22` | `ADMISSION_CAP_REACHED` | Selected admission pool is at cap; excess attempt refused before spawn (no queueing). |
170
+
171
+ Admission bounds concurrency; a provider can still return quota exhaustion at concurrency one. Evidence: fixture rows R1–R10 in `ci/mechanism-468-dispatch-cli.test.js`.
172
+
77
173
  ## #466 boundary
78
174
 
79
- #466 owns automatic `TMPDIR` selection and lifecycle, enforcement across launch paths, per-key admission/reservation, and refusing packets that declare worker `gh`/network needs. This CLI accepts coordinator-supplied inputs for one attempt and cannot certify those launcher guarantees. It also does not add a distributed plugin command or run a live provider.
175
+ #466 still owns enforcement across launch paths, refusing packets that declare worker `gh`/network needs (no network capability is assessed here), and any live `agy` pilot. Managed gate assignment, managed scratch, the `agy` headless runner adapter, and managed per-pool admission above are the #466 policy implemented in C8. This CLI otherwise accepts coordinator-supplied inputs for one attempt and cannot certify launcher guarantees outside C8. It also does not add a distributed plugin command or run a live provider.
@@ -302,11 +302,41 @@ The editorial doc check (`harness-everything/scripts/doc-check.js`, F1) is reach
302
302
 
303
303
  `compare-derived` (`harness-everything/scripts/doc-check.js`, F3) compares a caller-captured generator output with a declared derived view, byte for byte. It runs no generator and writes no files. Its evidence is package and mechanism only: the generation status is caller-reported, and the output is ordinary command evidence. It is not trusted credit, and it makes no live-host claim.
304
304
 
305
- Credited reconciliation for F4 (Claude Code only, pilot ON) is **implemented, with mechanism and package evidence and one live field-availability capture**. Credit works for `doc-lint` and `link-check` through a registered `doc-check` run, and for an independent `quality-review` with bound path digests. The capture under `benchmarks/results/live-host/claude-325-3b-s2b/` proves field availability on Claude Code 2.1.308 for one session. It is not live-host credit, and no live-host credit run exists yet. Deterministic mechanism tests (replay through the real hook entry points, with a CI-only qualification preloader) prove the chain.
306
-
307
- PR-B adds a dedicated `outline-confirmation` evidence lane for Claude captures with separate B/O/D checks, a coordinator-sealed pre-dispatch handoff, pinned-inventory row binding, and an independent exact-O review. A separate sanitized capture now qualifies the **observed Claude Code 2.1.312 run8 profile**, recorded at main baseline `1bd0f805031c5577a6e7f72a9bc5b41618b71fc1`. This is retained field-mapping evidence, not runtime version enforcement or an E1 qualifying cycle. OpenCode, Codex and other Claude Code versions receive no outline qualification. Missing or ambiguous capture stays unresolved and host tools remain fail-open. The outline result does not replace the aggregate B→D MUST result or the existing exact-D `quality-review` contract.
308
-
309
- W3/W6 adds only the closed workflow-state operations named in [the reconciliation contract](doc-workflow-reconciliation.md#writer-policy-phase-aware): plan/start and inventory before O, one seal after the approved O review, then three ordered dispositions after worker closure and final review. The installed producer exposes only `inventory` and `seal`; the real Pre/Post hook journal and provider validate invocation identity, phase, exact destinations, schema and transition. `state-persist` uses that same decision so verified state-only calls do not appear as task edits or verification evidence. The outline mechanism suite exercises source and packaged paths; this is deterministic mechanism/package evidence only. No live W6 host cycle or E1 qualification is claimed.
305
+ **Historical (retired E1 pilot):** credited reconciliation for F4 (Claude Code only, pilot ON) was **implemented, with mechanism and package evidence and one live field-availability capture**. Credit works for `doc-lint` and `link-check` through a registered `doc-check` run, and for an independent `quality-review` with bound path digests. The capture under `benchmarks/results/live-host/claude-325-3b-s2b/` proves field availability on Claude Code 2.1.308 for one session. It is not live-host credit, and no live-host credit run exists yet. Deterministic mechanism tests (replay through the real hook entry points, with a CI-only qualification preloader) prove the chain.
306
+
307
+ **Historical (retired E1 pilot):** PR-B added a dedicated `outline-confirmation` evidence lane for Claude captures with separate B/O/D checks, a coordinator-sealed pre-dispatch handoff, pinned-inventory row binding, and an independent exact-O review. A separate sanitized capture qualified the **observed Claude Code 2.1.312 run8 profile**, recorded at main baseline `1bd0f805031c5577a6e7f72a9bc5b41618b71fc1`. This remains retained field-mapping evidence, not runtime version enforcement or an E1 qualifying cycle. OpenCode, Codex and other Claude Code versions received no outline qualification. Missing or ambiguous capture stayed unresolved and host tools remained fail-open. The outline result did not replace the aggregate B→D MUST result or the existing exact-D `quality-review` contract.
308
+
309
+ **Historical (retired E1 pilot):** W3/W6 added only the closed workflow-state operations named in [the reconciliation contract](doc-workflow-reconciliation.md#writer-policy-phase-aware): plan/start and inventory before O, one seal after the approved O review, then three ordered dispositions after worker closure and final review. The installed producer exposed only `inventory` and `seal`, which have since been removed under #553 (see below); previously, the real Pre/Post hook journal and provider validated invocation identity, phase, exact destinations, schema and transition, and `state-persist` used that same decision so verified state-only calls did not appear as task edits or verification evidence. The outline mechanism suite exercised source and packaged paths; this is deterministic mechanism/package evidence only. No live W6 host cycle or E1 qualification is claimed.
310
+
311
+ ### E1 pilot retirement and retained document controls (#553)
312
+
313
+ The E1 reconciliation pilot is retired, and its runtime modules and W6 `inventory`/`seal` CLI
314
+ (`hooks/scripts/w6-state-operations.js`) have been removed (#553). Under the retirement contract
315
+ every `HARNESS_DOC_RECONCILIATION_PILOT` value is ignored, ordinary hooks print no flag warning,
316
+ and workflow credit and Stop no longer load the E1 provider (#553); generic verification, required
317
+ bindings and Fable correlation are unchanged, and a legacy doc-only verification no longer
318
+ satisfies Stop. In-flight E1 work belongs to the previous release; after upgrading, end the old
319
+ session and open a new one to redo review/verify. Recorded journals, reports and outline artifacts
320
+ stay in place. Issues
321
+ [#325](https://github.com/dyphn1/Harness-everything/issues/325) and
322
+ [#350](https://github.com/dyphn1/Harness-everything/issues/350) remain open failure markers.
323
+
324
+ The document controls below remain available and are unchanged by this retirement. Each is
325
+ package/mechanism evidence only, grants no E1 credit and makes no live-host claim:
326
+
327
+ - `doc-check` editorial check (F1, `harness-everything/scripts/doc-check.js`): instruction-only,
328
+ no `doc-change` step binding, no host enforcement and no Stop lock; a non-empty
329
+ `coverage.unsupported` marks it partial.
330
+ - `compare-derived` (F3): byte-for-byte comparison of a caller-captured generator output with a
331
+ declared derived view; runs no generator and writes no files. The generation status is
332
+ caller-reported.
333
+ - `doc-check check --conflict-assessment`: full governed/legacy corpus conflict check that
334
+ requires `--base` as an exact commit SHA; accepts recorded and structural conflicts only,
335
+ leaves prose contradictions to independent `quality-review`, and remains refused on OpenCode.
336
+ - `doc-governance` CI guard (PR #376): on `pull_request` it extracts
337
+ `scripts/doc-governance-guard.js` from the event base and runs those bytes against the exact
338
+ base/head SHAs, never the candidate copy; nonzero exits fail that job independently of the other
339
+ CI jobs. Its trust-surface and decision classes are unchanged.
310
340
 
311
341
  ### Own-repository governance guard (PR #376)
312
342
 
@@ -4,7 +4,7 @@ description: "Bootstrap a local error ledger for an existing repository by inven
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 1.2.0
7
+ version: 1.3.0
8
8
  ---
9
9
 
10
10
  # Error Ledger Bootstrap
@@ -14,13 +14,26 @@ Bug/regression/flake labels or `fix`/`bug` title prefixes qualify; reports keep
14
14
  - `--hide-ledger` excludes existing error-ledger files from the scan.
15
15
  - `--home <dir>` changes the local home used to resolve automatic memory.
16
16
 
17
+ - **Redaction scope:** the opaque-ref/no-excerpt rules below apply only to fields derived from local-store rows. Git, doc and tracker fields in the same report keep their own sanitization (repo-existing sites, issue reference only); local-store redaction does not rewrite them. The whole combined report still follows the privacy rules below and stays local.
18
+
17
19
  ## Optional local error store
18
20
 
19
- Local observations are opt-in: `--source local-store --destination harness|project`. With no `--source` option, the scanner keeps the legacy report bytes and source set. `--destination` is required with this source and accepts only `harness` or `project`; it is the operator's declaration for the canonical Git `--root`.
21
+ Local observations are opt-in: `--source local-store --destination <harness-or-project>`. With no `--source` option, the scanner keeps the legacy report bytes and source set. `--destination` is required with this source and accepts exactly one of `harness` or `project` (the `harness|project` notation is not a literal value); it is the operator's declaration for the canonical Git `--root`, not a router to another repository.
22
+
23
+ The scanner derives the workspace key from that root, calls the supported reader as `listRecords({ workspaceRoot, workspaceKey })`, and accepts only returned rows carrying that key. A bound host workspace that disagrees fails closed. The report binds the resolved destination to an opaque `workspaceRef`; each record ref is `p-local-<sha256>` over the workspace key and validated stored provisional ID. Raw provisional IDs are never reported.
20
24
 
21
- The scanner derives the workspace key from that root, calls the supported reader as `listRecords({ workspaceRoot, workspaceKey })`, and accepts only returned rows carrying that key. A bound host workspace that disagrees fails closed. The report binds the resolved destination to an opaque `workspaceRef`; each record ref is `p-local-<sha256>` over the workspace key and validated stored provisional ID. Raw provisional IDs are never reported. If the reader contract is absent (including the packaged Skills-only copy), the scan succeeds with source status `unavailable` and reason `reader-unavailable`.
25
+ | Reader condition | Source status / reason | Recovery |
26
+ | --- | --- | --- |
27
+ | Reader module missing (the packaged Skills-only copy has no `hooks/scripts/lib/local-errors.js`) | `unavailable` / `reader-unavailable` | Re-scan from a trusted full Harness checkout with the command below. |
28
+ | Reader module present but its contract/API is incomplete (for example a missing `DESTINATIONS` export) | `unavailable` / `reader-contract-incomplete` | Repair that checkout's reader, then re-scan. |
22
29
 
23
- The `local-store` source status is `used`, `missing`, `unverified`, or `unavailable`. Missing indexes use `index-missing`; unreadable or corrupt input uses a sanitized reason such as `store-unreadable`, `store-corrupt`, or `store-unsupported`. An empty reader result is `unverified` (`empty-reader-result`) because the reader returns an empty array for both an empty workspace and several read failures. Invalid rows are skipped and counted as `malformed`; they are never quoted. The report separately counts valid rows assigned to another destination and rows whose destination is `unknown`.
30
+ Both conditions yield zero local leads, keep the other sources, and fail closed; neither implies routing to another repository. Full-checkout recovery command (choose one destination value, not the literal `harness|project`):
31
+
32
+ ```sh
33
+ node "<Harness checkout>/error-ledger-bootstrap/scripts/scan.js" --root "<target>" --no-memory --source local-store --destination harness --out "<private dir outside target>" --json
34
+ ```
35
+
36
+ The `local-store` source status is `used`, `missing`, `unverified`, or `unavailable`. Missing local-store indexes use `index-missing`; unreadable or corrupt input uses a sanitized reason such as `store-unreadable`, `store-corrupt`, or `store-unsupported`. A missing destination ledger directory or `index.jsonl` reports `ledgerStatus: unverified` / `ledgerReason: ledger-missing`; unreadable or corrupt ledger uses `ledger-unreadable` / `ledger-corrupt`. An empty reader result is `unverified` (`empty-reader-result`) because the reader returns an empty array for both an empty workspace and several read failures. Invalid rows are skipped and counted as `malformed`; they are never quoted. The report separately counts valid rows assigned to another destination and rows whose destination is `unknown`.
24
37
 
25
38
  Each valid destination-matched provisional lesson yields one neutral local lead. Occurrences are grouped by exact signature and suppressed when a selected lesson covers that signature. JSON and Markdown contain only opaque refs, validated destination/kind/command-class metadata, signatures, counts, and dedupe/evidence results. They never include excerpts, cues, lesson text, issue URLs, paths, session IDs, or tool-use IDs. Keep the reports local; the local store and destination ledger are read-only during scan.
26
39
 
@@ -38,9 +51,9 @@ Obtain explicit owner approval for each candidate. Bind the approval to the exac
38
51
 
39
52
  The top-level approval JSON has `schemaVersion: 1`, a 20-character hexadecimal `candidateId`, a 64-character hexadecimal `reportSha256` of the exact report bytes, an absolute canonical `targetRoot` matching `--target`, a non-empty `approvedBy`, and a parseable `approvedAt` timestamp. Its `record` object has a kebab-case `signature`; non-empty `class`, `title`, `violates`, and `sourcesNote`; `scope` of `in`, `out`, or `unresolved`; `status` of `open`, `lesson`, or `mechanism`; and `sites`, an array of existing target-repository files named by relative paths without absolute paths or `.` or `..` components. Do not put absolute paths in `approvedBy`, `approvedAt`, or the record text fields. The approved candidate must occur exactly once in the report, and the selected and approved site files must exist in the target.
40
53
 
41
- For a candidate with a `local-store` source, also include top-level `destination: harness` or `destination: project` in the approval. Promotion requires one `used` workspace binding whose opaque ref resolves to canonical `--target` through the trusted Harness checkout's local-store reader; every candidate ref must still resolve to a row for that workspace and destination. The report's exact-dedupe result must be eligible, and the candidate must carry a verified Git or documentation commit source that exists in the target repository on that same candidate. Promotion rechecks exact signature and whole-rule dedupe against the current destination ledger while holding the promotion lock. Missing, unknown, mismatched, stale, or unreadable local bindings fail closed before ledger changes. Legacy reports without a local-store source keep their existing approval shape. A stored issue URL is only a local lead and never satisfies the durable-source requirement.
54
+ For a candidate with a `local-store` source, also include exactly one top-level `destination: harness` or `destination: project` in the approval, matching the report's `--destination`. Promotion requires one `used` workspace binding whose opaque ref resolves to canonical `--target` through the trusted Harness checkout's local-store reader; every candidate ref must still resolve to a row for that workspace and destination. The report's exact-dedupe result must be eligible, and the candidate must carry a verified Git or documentation commit source that exists in the target repository on that same candidate. Promotion rechecks exact signature and whole-rule dedupe against the current destination ledger while holding the promotion lock. Missing, unknown, mismatched, stale, or unreadable local bindings fail closed before ledger changes. Legacy reports without a local-store source keep their existing approval shape. A stored issue URL is only a local lead and never satisfies the durable-source requirement.
42
55
 
43
- Use this complete example as the approval file structure, replacing the sample candidate ID and digest with the exact report values, `targetRoot` with the target's absolute canonical path, and the approver, timestamp, and reviewed record content with the owner's approval:
56
+ Use this example as the approval structure, replacing the sample candidate ID and digest with the exact report values, `targetRoot` with the target's absolute canonical path, and the approver, timestamp, and reviewed record content with the owner's approval. A local-store approval includes the top-level `destination` shown here; a legacy approval omits that field.
44
57
 
45
58
  ```json
46
59
  {
@@ -48,6 +61,7 @@ Use this complete example as the approval file structure, replacing the sample c
48
61
  "candidateId": "0123456789abcdef0123",
49
62
  "reportSha256": "0000000000000000000000000000000000000000000000000000000000000000",
50
63
  "targetRoot": "/absolute/path/to/target",
64
+ "destination": "harness",
51
65
  "approvedBy": "Owner Name",
52
66
  "approvedAt": "2026-11-20T00:00:00.000Z",
53
67
  "record": {
@@ -65,13 +79,34 @@ Use this complete example as the approval file structure, replacing the sample c
65
79
 
66
80
  Do not promote an unapproved, changed, or stale candidate. Keep full candidate reports and private inputs out of E-records, PRs, shared logs, and uploads.
67
81
 
68
- Promotion requires the target to already contain `.agents/harness-everything/errors/`. Before the first promotion, create that directory once:
82
+ Promotion requires the target to already contain `.agents/harness-everything/errors/`; it refuses when the directory is absent. Create that directory once:
83
+
84
+ ```sh
85
+ mkdir -p "<target repo>/.agents/harness-everything/errors"
86
+ ```
87
+
88
+ | Candidate source | Index precondition before scan and approval |
89
+ | --- | --- |
90
+ | Legacy (no `local-store` source) | No index file needed beforehand; the first promotion creates it through the sync command below. |
91
+ | `local-store` | `index.jsonl` must already exist and be current in the target. Create/refresh it from the trusted checkout with `node "<Harness checkout>/scripts/errors-sync.js" --root "<target repo>"`. A missing index leaves scan dedupe `unverified` (`ledger-missing`). Scan does not detect a stale index; promotion rechecks it under lock and fails closed (`destination ledger index is stale or unavailable`). Never bypass either; refresh, rescan and reapprove. |
92
+
93
+ Copyable first-promotion sequence for a `local-store` lead:
69
94
 
70
95
  ```sh
96
+ # 1. Target ledger directory and index (an empty ledger is fine)
71
97
  mkdir -p "<target repo>/.agents/harness-everything/errors"
98
+ node "<Harness checkout>/scripts/errors-sync.js" --root "<target repo>"
99
+
100
+ # 2. Scan from the trusted full checkout, not the packaged Skills-only copy
101
+ node "<Harness checkout>/error-ledger-bootstrap/scripts/scan.js" \
102
+ --root "<target repo>" --no-memory --source local-store --destination harness \
103
+ --out "<private dir outside target>" --json
104
+
105
+ # 3. Classify locally; obtain fresh per-item approval bound to the exact report bytes
106
+ # 4. Promote with the packaged script below
72
107
  ```
73
108
 
74
- Promotion refuses when the directory is absent. No index file is needed beforehand; successful promotion updates the index through the sync command below.
109
+ If the index was missing or stale, re-run step 1 **before** step 2, then rescan and reapprove the new `reportSha256`; an approval bound to earlier report bytes is stale.
75
110
 
76
111
  Before promotion, resolve a trusted local Harness checkout containing `scripts/errors-sync.js` and verify its Node dependencies are installed. Local-store candidates also require `hooks/scripts/lib/local-errors.js` in that checkout. The current sync script requires `js-yaml`; a read-only preflight is:
77
112