harness-everything 1.3.0 → 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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +6 -0
- package/ci/archive/325-prep/README.md +9 -2
- package/ci/archive/325-prep/doc-reconciliation-red.js +34 -8
- package/ci/fixtures/553-t2a/body-edit/base/.agents/harness-everything/project-docs.json +11 -0
- package/ci/fixtures/553-t2a/body-edit/base/docs/a.md +6 -0
- package/ci/fixtures/553-t2a/body-edit/base/docs/b.md +1 -0
- package/ci/fixtures/553-t2a/body-edit/candidate/docs/a.md +6 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/adr/EVID-001-verify-all-evidence.md +11 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/governed-index.md +19 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/adr/EVID-001-verify-all-evidence.md +11 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/governed-index.md +19 -0
- package/ci/fixtures/553-t2c/derived-regenerate-must/config.json +17 -0
- package/ci/fixtures/doc-obligations/derive/regression-pins.json +153 -0
- package/ci/fixtures/state-persist-post-tool-use/harness.js +206 -0
- package/ci/fixtures/state-persist-post-tool-use/off-handoff-golden.json +16 -0
- package/ci/fixtures/state-persist-post-tool-use/payload-post-tool-use-success.json +13 -0
- package/ci/fixtures/stop/fail-session-writes.js +109 -0
- package/ci/fixtures/workflow-contract/cases.json +3355 -0
- package/ci/fixtures/workflow-contract/wiring-cases.json +560 -0
- package/ci/lib/doc-reconciliation-prep-fixtures.js +4 -9
- package/ci/mechanism-2an-workflow-replay.test.js +324 -0
- package/ci/mechanism-2ax-doc-lifecycle.test.js +132 -0
- package/ci/mechanism-325-3a-doc-evidence.test.js +73 -0
- package/ci/mechanism-325-3a-doc-obligations.test.js +61 -0
- package/ci/mechanism-325-3b-preparation.test.js +208 -49
- package/ci/mechanism-325-3b-s1-review.test.js +20 -828
- package/ci/mechanism-325-3b-s3-providers.test.js +59 -0
- package/ci/mechanism-325-f3-derived-views.test.js +140 -0
- package/ci/mechanism-341-opencode-lane.test.js +164 -284
- package/ci/mechanism-35-verification-contract.test.js +246 -0
- package/ci/mechanism-365-step-edit-accounting.test.js +5 -6
- package/ci/mechanism-383-doc-glob-line-terminators.test.js +0 -30
- package/ci/mechanism-397-opencode-observations.test.js +151 -18
- package/ci/mechanism-553-e1-unhook-credit.test.js +328 -0
- package/ci/mechanism-553-p2a-claude-hooks.test.js +98 -0
- package/ci/mechanism-553-p3-plan-start.test.js +212 -0
- package/ci/mechanism-553-state-persist-post-tool-use.test.js +307 -0
- package/ci/mechanism-553-stop.test.js +427 -0
- package/ci/mechanism-553-t2a-derive.test.js +110 -0
- package/ci/mechanism-553-t2c-derive.test.js +94 -0
- package/ci/mechanism-e1-derived-regenerate.test.js +45 -206
- package/ci/mechanism-outline-sanitizer.test.js +0 -8
- package/ci/mechanism-pr-a-conflict-check.test.js +38 -305
- package/ci/mechanism-prb-outline-review.test.js +101 -3283
- package/docs/adr/DOCS-006-reconciliation-pilot.md +4 -2
- package/docs/adr/DOCS-008-obligation-abstraction-bounded-consumer.md +3 -3
- package/docs/doc-workflow-reconciliation.md +17 -2
- package/docs/document-lifecycle.md +6 -2
- package/docs/platform-capabilities.md +35 -5
- package/hooks/hooks.json +0 -46
- package/hooks/scripts/lib/workflow-obligations.js +0 -55
- package/hooks/scripts/state-persist.js +7 -95
- package/hooks/scripts/workflow-disposition.js +0 -2
- package/hooks/scripts/workflow-stop-gate.js +17 -30
- package/opencode-plugin/index.mjs +6 -70
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/lib/workflow-obligations.js +0 -55
- package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -95
- package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +0 -2
- package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +17 -30
- package/plugins/harness-everything/plugin.json +1 -1
- package/sbom.cdx.json +7 -7
- package/ci/fixtures/doc-obligations/reconciliation-s1/cases.json +0 -6854
- package/ci/fixtures/doc-obligations/reconciliation-s1/fail-session-writes.js +0 -116
- package/ci/fixtures/doc-obligations/reconciliation-s2a/harness.js +0 -507
- package/ci/fixtures/doc-obligations/reconciliation-s2a/run13-workflow-requirements.json +0 -42
- package/ci/fixtures/doc-obligations/reconciliation-s2a/vectors.json +0 -617
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/harness.js +0 -415
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-post-tool-use-success-minimal.json +0 -9
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-start.json +0 -7
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-freetext-reject.json +0 -11
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-reject.json +0 -11
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop.json +0 -11
- package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-task-result.json +0 -19
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-capture-only.json +0 -99
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-legacy.json +0 -67
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-concurrent-writers.json +0 -62
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-lookalikes-runtime-mutations.json +0 -67
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-malformed.json +0 -85
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-normal-session.json +0 -74
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-runtime-drift-later-npm-test.json +0 -58
- package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-valid-direct-quoted-review.json +0 -85
- package/ci/fixtures/doc-obligations/reconciliation-s2b/f4/cases.json +0 -2267
- package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/cases.json +0 -1110
- package/ci/lib/doc-reconciliation-file-spy.js +0 -23
- package/ci/lib/doc-reconciliation-qualification-preload.js +0 -37
- package/ci/lib/doc-reconciliation-replay.js +0 -104
- package/ci/lib/doc-reconciliation-staged-tree.js +0 -102
- package/ci/mechanism-325-3b-h1-qualification.test.js +0 -206
- package/ci/mechanism-325-3b-s1.test.js +0 -188
- package/ci/mechanism-325-3b-s2a-core.test.js +0 -840
- package/ci/mechanism-325-3b-s2a-producer.test.js +0 -564
- package/ci/mechanism-325-3b-s2b-capture.test.js +0 -566
- package/ci/mechanism-325-3b-s2b-wiring.test.js +0 -679
- package/ci/mechanism-325-f4-invariants.test.js +0 -606
- package/ci/mechanism-325-f4-projections.test.js +0 -392
- package/ci/mechanism-325-f4-qualification.test.js +0 -228
- package/ci/mechanism-325-f4-trust-boundary.test.js +0 -880
- package/ci/mechanism-e1-dependency-artifact-scope.test.js +0 -657
- package/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
- package/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
- package/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
- package/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
- package/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
- package/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
- package/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
- package/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
- package/hooks/scripts/w6-state-operations.js +0 -239
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
- package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
- package/plugins/harness-everything/hooks/scripts/w6-state-operations.js +0 -239
- package/scripts/system-one-eval-laya.js +0 -112
- /package/ci/fixtures/{doc-obligations/reconciliation-s2b/capture → state-persist-post-tool-use}/payload-post-tool-use-failure.json +0 -0
- /package/ci/fixtures/{doc-obligations/reconciliation-s2b/wiring → workflow-contract}/legacy-off-golden.json +0 -0
|
@@ -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](
|
|
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](
|
|
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
|
-
-
|
|
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](
|
|
24
|
-
- Consumer tests (exercise `doc-reconciliation-core.js` consuming `deriveDocObligations`): [mechanism-325-3b-s2a-core.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
|
-
**
|
|
9
|
-
|
|
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 | **
|
|
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
|
|
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
|
|
|
@@ -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
|
-
|
|
306
|
-
|
|
307
|
-
PR-B
|
|
308
|
-
|
|
309
|
-
W3/W6
|
|
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
|
|
package/hooks/hooks.json
CHANGED
|
@@ -36,17 +36,6 @@
|
|
|
36
36
|
}
|
|
37
37
|
],
|
|
38
38
|
"PreToolUse": [
|
|
39
|
-
{
|
|
40
|
-
"matcher": "Bash|PowerShell|Task|Agent|Write|Edit|apply_patch",
|
|
41
|
-
"hooks": [
|
|
42
|
-
{
|
|
43
|
-
"type": "command",
|
|
44
|
-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-persist.js\""
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"description": "Pilot-only doc-reconciliation launch capture (HARNESS_DOC_RECONCILIATION_PILOT exactly 1): capture-only, fail-open, write-free when OFF, never blocks a tool",
|
|
48
|
-
"id": "harness:pre:pilot-capture"
|
|
49
|
-
},
|
|
50
39
|
{
|
|
51
40
|
"matcher": "Bash|PowerShell|Edit|Write|apply_patch",
|
|
52
41
|
"hooks": [
|
|
@@ -189,17 +178,6 @@
|
|
|
189
178
|
}
|
|
190
179
|
],
|
|
191
180
|
"PostToolUse": [
|
|
192
|
-
{
|
|
193
|
-
"matcher": "Task|Agent",
|
|
194
|
-
"hooks": [
|
|
195
|
-
{
|
|
196
|
-
"type": "command",
|
|
197
|
-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-persist.js\""
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
"description": "Pilot-only doc-reconciliation Task/Agent result capture (HARNESS_DOC_RECONCILIATION_PILOT exactly 1): capture-only, fail-open, write-free when OFF",
|
|
201
|
-
"id": "harness:post-task:pilot-capture"
|
|
202
|
-
},
|
|
203
181
|
{
|
|
204
182
|
"matcher": "Bash|PowerShell|mcp__.*",
|
|
205
183
|
"hooks": [
|
|
@@ -332,30 +310,6 @@
|
|
|
332
310
|
"description": "Inject a matched workspace ledger lesson after a failed Bash tool",
|
|
333
311
|
"id": "harness:post-failure:ledger-lesson"
|
|
334
312
|
}
|
|
335
|
-
],
|
|
336
|
-
"SubagentStart": [
|
|
337
|
-
{
|
|
338
|
-
"hooks": [
|
|
339
|
-
{
|
|
340
|
-
"type": "command",
|
|
341
|
-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-persist.js\""
|
|
342
|
-
}
|
|
343
|
-
],
|
|
344
|
-
"description": "Pilot-only doc-reconciliation capture (HARNESS_DOC_RECONCILIATION_PILOT exactly 1): record host-issued subagent identity and parent session correlation at launch; fail-open, silent, and write-free when OFF",
|
|
345
|
-
"id": "harness:subagent:start-capture"
|
|
346
|
-
}
|
|
347
|
-
],
|
|
348
|
-
"SubagentStop": [
|
|
349
|
-
{
|
|
350
|
-
"hooks": [
|
|
351
|
-
{
|
|
352
|
-
"type": "command",
|
|
353
|
-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-persist.js\""
|
|
354
|
-
}
|
|
355
|
-
],
|
|
356
|
-
"description": "Pilot-only doc-reconciliation capture (HARNESS_DOC_RECONCILIATION_PILOT exactly 1): record the reviewer principal and bound final review artifact digest at subagent completion; fail-open, silent, and write-free when OFF",
|
|
357
|
-
"id": "harness:subagent:stop-capture"
|
|
358
|
-
}
|
|
359
313
|
]
|
|
360
314
|
}
|
|
361
315
|
}
|
|
@@ -510,33 +510,6 @@ function planningUnresolved(context, plan = context.workflow?.pendingPlan || con
|
|
|
510
510
|
return [...new Set(unresolved)];
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
function withholdPilotVerification(context, set) {
|
|
514
|
-
// PR #351 review P2 (persistence failure): the credit decision is applied in memory first —
|
|
515
|
-
// aggregate verify becomes pending and a satisfied workflow becomes running — and only then is
|
|
516
|
-
// that state persisted best-effort. A failed obligations-file write records the
|
|
517
|
-
// withhold-persist-failed diagnostic and a reminder; it never escapes, never leaves the decision
|
|
518
|
-
// unapplied, and never changes the callers' refusal contract (exit 2 / step:<verify>:pending).
|
|
519
|
-
// PR #351 re-review P2a (scope of the recovery): this run made an actual ON, supported,
|
|
520
|
-
// withheld pilot decision. The marker is transient and per-run — it lives on the in-memory
|
|
521
|
-
// context object itself (saveWorkflow persists only context.workflow) and is never written
|
|
522
|
-
// to disk; Stop's pending-path persistence recovery is scoped by it.
|
|
523
|
-
context.docReconciliationWithheldRun = true;
|
|
524
|
-
const verify = set.obligations.find(item => item.id === 'verify');
|
|
525
|
-
if (verify) verify.status = 'pending';
|
|
526
|
-
if (context.workflow.state === 'satisfied') context.workflow.state = 'running';
|
|
527
|
-
try {
|
|
528
|
-
atomicWriteJson(obligationPath(context.sessionDir), set);
|
|
529
|
-
} catch {
|
|
530
|
-
if (!Array.isArray(context.workflow.docReconciliationDiagnostics)) {
|
|
531
|
-
context.workflow.docReconciliationDiagnostics = [];
|
|
532
|
-
}
|
|
533
|
-
if (!context.workflow.docReconciliationDiagnostics.includes('withhold-persist-failed')) {
|
|
534
|
-
context.workflow.docReconciliationDiagnostics.push('withhold-persist-failed');
|
|
535
|
-
}
|
|
536
|
-
console.error('[Workflow Reminder] Document verification withheld in memory; persisting the obligations state failed (withhold-persist-failed). No document verification credit.');
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
513
|
function updateObligation(context, obligationId, disposition, options = {}) {
|
|
541
514
|
if (!SAFE_ID.test(obligationId || '')) throw new Error('--obligation-id must be a stable obligation id');
|
|
542
515
|
if (!['pass', 'escaped', 'blocked'].includes(disposition)) throw new Error('--disposition must be pass, escaped, or blocked');
|
|
@@ -556,12 +529,6 @@ function updateObligation(context, obligationId, disposition, options = {}) {
|
|
|
556
529
|
if (!scope) throw new Error('--scope is required when escaping an obligation');
|
|
557
530
|
}
|
|
558
531
|
if (disposition === 'blocked' && !reasonCode) throw new Error('--reason-code is required when blocking an obligation');
|
|
559
|
-
if (disposition === 'pass' && ['execute', 'verify'].includes(obligationId)
|
|
560
|
-
&& require('./doc-reconciliation-pilot').assess(context, loaded.set).withhold) {
|
|
561
|
-
obligation.status = 'pending';
|
|
562
|
-
withholdPilotVerification(context, loaded.set);
|
|
563
|
-
throw new Error('document verification pending: S1 grants no document credit');
|
|
564
|
-
}
|
|
565
532
|
obligation.status = disposition;
|
|
566
533
|
obligation.evidence = evidence;
|
|
567
534
|
obligation.reasonCode = reasonCode;
|
|
@@ -668,22 +635,6 @@ function updateStep(context, stepId, disposition, options = {}) {
|
|
|
668
635
|
throw new Error('resolve active-step bindings before passing the step: ' + ids.join(', '));
|
|
669
636
|
}
|
|
670
637
|
}
|
|
671
|
-
if (disposition === 'pass' && step.stepType === 'verification') {
|
|
672
|
-
const inFlightW6ToolUseId = require('./doc-reconciliation-provider').pendingW6VerificationInvocation(context);
|
|
673
|
-
const assessment = require('./doc-reconciliation-pilot').assess(context, loaded.set,
|
|
674
|
-
inFlightW6ToolUseId ? { allowInFlightW6ToolUseId: inFlightW6ToolUseId } : {});
|
|
675
|
-
if (assessment.withhold) {
|
|
676
|
-
withholdPilotVerification(context, loaded.set);
|
|
677
|
-
throw new Error('document verification pending: S1 grants no document credit');
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
// Review-mode refusal (pilot ON only): a self-authored or non-independent review PASS stays pending.
|
|
681
|
-
if (disposition === 'pass' && step.stepType === 'review') {
|
|
682
|
-
const pilot = require('./doc-reconciliation-pilot');
|
|
683
|
-
if (pilot.reviewRequired(loaded.set) && !pilot.independentReviewAccepted(context)) {
|
|
684
|
-
throw new Error('review pending: a self-authored or non-independent review cannot pass this step; an independent host quality review is required');
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
638
|
step.status = disposition;
|
|
688
639
|
step.evidence = evidence;
|
|
689
640
|
step.reasonCode = reasonCode;
|
|
@@ -700,12 +651,6 @@ function unresolvedObligations(context) {
|
|
|
700
651
|
const unresolved = planningUnresolved(context, plan);
|
|
701
652
|
const loaded = loadObligationSet(context, plan);
|
|
702
653
|
if (!loaded.set) return unresolved;
|
|
703
|
-
if (!unresolved.length && require('./doc-reconciliation-pilot').assess(context, loaded.set).withhold) {
|
|
704
|
-
withholdPilotVerification(context, loaded.set);
|
|
705
|
-
for (const step of loaded.set.requirements.filter(item => item.stepType === 'verification')) {
|
|
706
|
-
unresolved.push('step:' + step.id + ':pending');
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
654
|
if (!['running', 'satisfied', 'blocked', 'failed'].includes(context.workflow.state)) {
|
|
710
655
|
unresolved.push('execution:not-started');
|
|
711
656
|
}
|
|
@@ -61,14 +61,8 @@ function isSuccessfulMetadataStep(command, cwd) {
|
|
|
61
61
|
&& (disposition === 'pass' ? reason === undefined : /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(unquote(reason)));
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
// contract"): pilot-only, fail-open to the host, and gated on the exact
|
|
67
|
-
// switch value `1` before any collector logic runs. OFF must return to the
|
|
68
|
-
// existing legacy path before pilot collection; capture never executes a
|
|
69
|
-
// command, verifier or generator and never blocks a tool or Stop.
|
|
70
|
-
const PILOT_CAPTURE_EVENT_NAMES = ['PreToolUse', 'PostToolUse', 'PostToolUseFailure', 'SubagentStart', 'SubagentStop'];
|
|
71
|
-
// Task/Agent results were never routed here before S2b, so they stay capture-only: the legacy handoff path does not run for them.
|
|
64
|
+
// Old Claude manifests may still route retired E1 capture callbacks here.
|
|
65
|
+
// Ignore them before state resolution or any provider work.
|
|
72
66
|
const CAPTURE_ONLY_TOOLS = ['Task', 'Agent'];
|
|
73
67
|
let inputData = '';
|
|
74
68
|
const timeout = setTimeout(() => processState(null), 200);
|
|
@@ -82,25 +76,11 @@ function processState(payload) {
|
|
|
82
76
|
const captureOnly = captureEventName === 'SubagentStart' || captureEventName === 'SubagentStop'
|
|
83
77
|
|| captureEventName === 'PreToolUse'
|
|
84
78
|
|| (captureEventName === 'PostToolUse' && CAPTURE_ONLY_TOOLS.indexOf(captureToolName) !== -1);
|
|
85
|
-
if (captureOnly
|
|
79
|
+
if (captureOnly) {
|
|
86
80
|
process.exit(0);
|
|
87
81
|
return;
|
|
88
82
|
}
|
|
89
83
|
const root = getWorkspaceRoot(payload);
|
|
90
|
-
// SubagentStart/SubagentStop were never routed to this script before S2b.
|
|
91
|
-
// They are capture-only events: the legacy handoff state path stays
|
|
92
|
-
// untouched for them, so wiring them while OFF adds no writes at all.
|
|
93
|
-
if (captureEventName === 'SubagentStart' || captureEventName === 'SubagentStop') {
|
|
94
|
-
persistPilotCapture(payload, captureEventName, sessionId, root);
|
|
95
|
-
process.exit(0);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
// Pre-tool launch capture and Task/Agent result capture: capture-only, no legacy handoff state is written.
|
|
99
|
-
if (captureEventName === 'PreToolUse' || (captureEventName === 'PostToolUse' && CAPTURE_ONLY_TOOLS.indexOf(captureToolName) !== -1)) {
|
|
100
|
-
persistPilotCapture(payload, captureEventName, sessionId, root);
|
|
101
|
-
process.exit(0);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
84
|
const stateFile = path.join(getSessionDir(root, sessionId), 'handoff-state.json');
|
|
105
85
|
let state = { status: 'idle', timestamp: new Date().toISOString() };
|
|
106
86
|
if (fs.existsSync(stateFile)) { try { state = JSON.parse(fs.readFileSync(stateFile, 'utf8')); } catch (_) {} }
|
|
@@ -127,8 +107,6 @@ function processState(payload) {
|
|
|
127
107
|
: agy ? (!isFailed && exitCode === 0)
|
|
128
108
|
: !isFailed && (isSuccessEvent || exitCode === 0);
|
|
129
109
|
const toolName = payload.tool_name || payload.tool || 'command';
|
|
130
|
-
let editAfterCapture = false;
|
|
131
|
-
let stateOnlyCandidate = false;
|
|
132
110
|
if (isFailed) {
|
|
133
111
|
let output = (stderrSignal ? stderr : stdout) || (typeof payload.output === 'string' ? payload.output : '');
|
|
134
112
|
if (output.length > 500) output = '...' + output.slice(-500);
|
|
@@ -155,92 +133,26 @@ function processState(payload) {
|
|
|
155
133
|
command === '$PSVersionTable.PSVersion; Get-Command pwsh -ErrorAction SilentlyContinue'
|
|
156
134
|
|| /^git grep (?:-n )?(?:"[\w][\w.-]*"|'[\w][\w.-]*'|[\w][\w.-]*)(?: --(?: [\w.][\w./-]*)+)?$/.test(command)
|
|
157
135
|
);
|
|
158
|
-
const
|
|
159
|
-
const docCheck = pilotEnabled ? require('./lib/doc-reconciliation-provider') : null;
|
|
160
|
-
stateOnlyCandidate = Boolean(docCheck && typeof payload.cwd === 'string' && payload.cwd
|
|
161
|
-
&& docCheck.isW6StateCommand(command, payload.cwd, root,
|
|
162
|
-
{ toolName, sessionId, agentId: payload.agent_id }));
|
|
163
|
-
const metadataStep = !stateOnlyCandidate && verifiedSuccess
|
|
136
|
+
const metadataStep = verifiedSuccess
|
|
164
137
|
&& isSuccessfulMetadataStep(command, cwdOf(payload, root));
|
|
165
138
|
// The host-specific outcome must confirm success before verification advances.
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
const installedCheck = docCheck && docCheck.registeredInstalledCheck(command, cwdOf(payload, root));
|
|
169
|
-
const docCheckCandidate = installedCheck && installedCheck.kind !== 'not-candidate';
|
|
170
|
-
const pinCheckable = installedCheck && installedCheck.installed
|
|
171
|
-
&& (installedCheck.kind === 'accepted' || installedCheck.reason === 'implementation-pin-mismatch');
|
|
172
|
-
// A non-candidate that is compound or names the checker is not generic verification (trustRisk); the scanner miss does not clear it.
|
|
173
|
-
const verifies = stateOnlyCandidate ? false : docCheckCandidate
|
|
174
|
-
? Boolean(pinCheckable) && docCheck.fileDigest(installedCheck.installed) === docCheck.SHIPPED_DOC_CHECK_DIGEST
|
|
175
|
-
: !(pilotEnabled && docCheck.trustRisk(command)) && isVerificationShell(command, { cwd: cwdOf(payload, root), root });
|
|
139
|
+
// Retired document-check evidence no longer changes generic handoff verification.
|
|
140
|
+
const verifies = isVerificationShell(command, { cwd: cwdOf(payload, root), root });
|
|
176
141
|
// On AGY hosts that omit shell error/exitCode, an unconfirmed verification-only command must not advance lastEditAt
|
|
177
142
|
// and defeat agy-stop.js's bounded continuation fingerprint.
|
|
178
143
|
const agyUnknownOutcomeVerify = agy && !verifiedSuccess && !isFailed && verifies;
|
|
179
144
|
if (!metadataStep && !agyUnknownOutcomeVerify && !agyReadOnlyProbe && commandClass !== 'read-only' && commandClass !== 'worktree-setup') {
|
|
180
|
-
|
|
181
|
-
else state.lastEditAt = Date.now();
|
|
145
|
+
state.lastEditAt = Date.now();
|
|
182
146
|
}
|
|
183
147
|
if (verifiedSuccess && verifies) {
|
|
184
148
|
const verifiedAt = Date.now();
|
|
185
149
|
const verifiedExitCode = exitCode ?? null;
|
|
186
150
|
state.lastVerifyAt = verifiedAt;
|
|
187
151
|
state.lastVerifyExitCode = verifiedExitCode;
|
|
188
|
-
if (pilotEnabled) {
|
|
189
|
-
const source = docCheckCandidate ? 'Doc' : 'Generic';
|
|
190
|
-
state[`last${source}VerifyAt`] = verifiedAt;
|
|
191
|
-
state[`last${source}VerifyExitCode`] = verifiedExitCode;
|
|
192
|
-
}
|
|
193
152
|
}
|
|
194
153
|
}
|
|
195
154
|
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2), 'utf8');
|
|
196
155
|
observeTool(payload);
|
|
197
|
-
persistPilotCapture(payload, captureEventName, sessionId, root);
|
|
198
|
-
if (editAfterCapture) {
|
|
199
|
-
const pilotEnabled = process.env.HARNESS_DOC_RECONCILIATION_PILOT === '1';
|
|
200
|
-
const docCheck = pilotEnabled ? require('./lib/doc-reconciliation-provider') : null;
|
|
201
|
-
const captures = docCheck && docCheck.readCaptureView(getSessionDir(root, sessionId));
|
|
202
|
-
const verifiedStateOnly = stateOnlyCandidate && docCheck && captures && !captures.tampered
|
|
203
|
-
&& docCheck.isVerifiedW6StateOperation(captures.records, getSessionDir(root, sessionId), payload.tool_use_id);
|
|
204
|
-
if (!verifiedStateOnly) {
|
|
205
|
-
state.lastEditAt = Date.now();
|
|
206
|
-
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2), 'utf8');
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
156
|
} catch (_) {}
|
|
210
157
|
process.exit(0);
|
|
211
158
|
}
|
|
212
|
-
|
|
213
|
-
// Pilot-only capture journaling. Every guard is placed before any collector
|
|
214
|
-
// work; any failure is swallowed (fail-open), and the hook output/exit is
|
|
215
|
-
// never changed by capture.
|
|
216
|
-
function persistPilotCapture(payload, eventName, sessionId, root) {
|
|
217
|
-
try {
|
|
218
|
-
if (!payload || process.env.HARNESS_DOC_RECONCILIATION_PILOT !== '1') return;
|
|
219
|
-
if (PILOT_CAPTURE_EVENT_NAMES.indexOf(eventName) === -1) return;
|
|
220
|
-
const provider = require('./lib/doc-reconciliation-provider');
|
|
221
|
-
const sessionDir = getSessionDir(root, sessionId);
|
|
222
|
-
const entry = provider.buildCaptureRecord(payload, eventName, root, { sessionDir });
|
|
223
|
-
if (!entry) return;
|
|
224
|
-
// Observation-time identity: the workflow and pin in force when the host event was captured.
|
|
225
|
-
const observed = provider.observedIdentityFor(sessionDir);
|
|
226
|
-
if (observed) entry.observedIdentity = observed;
|
|
227
|
-
// #341 step 1: O's identity is taken at launch records, so a reviewer's identity predates its review.
|
|
228
|
-
if (eventName === 'SubagentStart') {
|
|
229
|
-
const outlineIdentity = provider.captureOutlineStartIdentity({ sessionDir });
|
|
230
|
-
if (outlineIdentity) entry.outlineIdentity = outlineIdentity;
|
|
231
|
-
}
|
|
232
|
-
if (eventName === 'PreToolUse' && (entry.tool_name === 'Agent' || entry.tool_name === 'Task')) {
|
|
233
|
-
try {
|
|
234
|
-
const existing = provider.readCaptureView(sessionDir);
|
|
235
|
-
entry.outlineDispatch = existing.tampered
|
|
236
|
-
? { schema: 'harness.outline-dispatch.v1', state: 'unresolved', reasons: ['capture-view-tampered'] }
|
|
237
|
-
: provider.captureOutlineDispatch({ payload, capture: entry, sessionDir, workspaceRoot: root, captures: existing.records });
|
|
238
|
-
} catch {
|
|
239
|
-
entry.outlineDispatch = { schema: 'harness.outline-dispatch.v1', state: 'unresolved', reasons: ['dispatch-capture-failed'] };
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
// Each capture is one exclusively created event file; the compatibility journal is rebuilt from them (not tamper-proof).
|
|
243
|
-
provider.writeImmutableEvent(sessionDir, entry);
|
|
244
|
-
provider.rebuildJournalView(sessionDir);
|
|
245
|
-
} catch (_) { /* fail-open: capture failures never reach the host */ }
|
|
246
|
-
}
|
|
@@ -173,7 +173,6 @@ function main() {
|
|
|
173
173
|
if (!['pending', 'active'].includes(workflow.state)) throw new Error('requirements/workflow composition belongs before execution starts');
|
|
174
174
|
const selectedPlan = recomposePlan(workflow, args.strategy);
|
|
175
175
|
const result = recordPlanning(context, args.requirementsJson, selectedPlan, args.strategy, args.evidence);
|
|
176
|
-
require('./lib/doc-reconciliation-pilot').captureBaseline(context);
|
|
177
176
|
saveWorkflow(context);
|
|
178
177
|
process.stdout.write(JSON.stringify({
|
|
179
178
|
state: workflow.state,
|
|
@@ -193,7 +192,6 @@ function main() {
|
|
|
193
192
|
const unresolvedPlanning = planningUnresolved(context, plan);
|
|
194
193
|
if (unresolvedPlanning.length) throw new Error('resolve requirement decomposition/workflow selection first: ' + unresolvedPlanning.join(', '));
|
|
195
194
|
|
|
196
|
-
require('./lib/doc-reconciliation-pilot').captureBaseline(context);
|
|
197
195
|
if (!String(plan.strategy || '').startsWith('fable-')) {
|
|
198
196
|
activatePlan(workflow, plan);
|
|
199
197
|
workflow.revision++;
|
|
@@ -9,6 +9,14 @@ const STEP_TYPE_REGISTRY_UNAVAILABLE = 'STEP_TYPE_REGISTRY_UNAVAILABLE';
|
|
|
9
9
|
|
|
10
10
|
function warn(message) { console.error('[Workflow Reminder] ' + message); }
|
|
11
11
|
|
|
12
|
+
function lastGenericVerificationAt(handoff) {
|
|
13
|
+
if (!Number.isFinite(handoff?.lastDocVerifyAt)) return handoff?.lastVerifyAt || 0;
|
|
14
|
+
const genericAt = Number.isFinite(handoff.lastGenericVerifyAt) ? handoff.lastGenericVerifyAt : 0;
|
|
15
|
+
const newerAggregateAt = Number.isFinite(handoff.lastVerifyAt) && handoff.lastVerifyAt > handoff.lastDocVerifyAt
|
|
16
|
+
? handoff.lastVerifyAt : 0;
|
|
17
|
+
return Math.max(genericAt, newerAggregateAt);
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
function decide(payload) {
|
|
13
21
|
if (!payload) return;
|
|
14
22
|
try {
|
|
@@ -18,7 +26,7 @@ function decide(payload) {
|
|
|
18
26
|
const { workflow, sessionDir } = context;
|
|
19
27
|
if (!workflow || workflow.state === 'deferred') return;
|
|
20
28
|
const handoffFile = path.join(sessionDir, 'handoff-state.json');
|
|
21
|
-
|
|
29
|
+
const handoff = readJson(handoffFile);
|
|
22
30
|
const unresolved = [];
|
|
23
31
|
const diagnostics = [];
|
|
24
32
|
let requiredFault = false;
|
|
@@ -38,17 +46,18 @@ function decide(payload) {
|
|
|
38
46
|
|
|
39
47
|
required(() => planningUnresolved(context));
|
|
40
48
|
if (String(workflow.strategy || '').startsWith('fable-')) {
|
|
41
|
-
if (!unresolved.length) {
|
|
42
|
-
require('./lib/doc-reconciliation-pilot').assess(context, null);
|
|
43
|
-
}
|
|
44
49
|
const match = matchingRun(context);
|
|
45
50
|
unresolved.push(...(match ? unresolvedStages(match, workflow, handoff?.lastEditAt || 0) : ['correlated-run-missing']));
|
|
46
51
|
} else {
|
|
47
52
|
required(() => unresolvedObligations(context));
|
|
48
|
-
// Assessment can withdraw stale document verification; read the current aggregate afterward.
|
|
49
|
-
handoff = readJson(handoffFile);
|
|
50
53
|
const lastEdit = Math.max(workflow.lastMutationAt || 0, handoff?.lastEditAt || 0);
|
|
51
|
-
if (lastEdit && (handoff
|
|
54
|
+
if (lastEdit && lastGenericVerificationAt(handoff) < lastEdit) {
|
|
55
|
+
unresolved.push('verification-after-edit-missing');
|
|
56
|
+
if (Number.isFinite(handoff?.lastDocVerifyAt) && workflow.state === 'satisfied') {
|
|
57
|
+
workflow.state = 'running';
|
|
58
|
+
delete workflow.resolvedAt;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
const pending = [...new Set(unresolved)];
|
|
@@ -59,29 +68,7 @@ function decide(payload) {
|
|
|
59
68
|
// A failed required validation leaves the workflow file as recorded; it is never marked satisfied.
|
|
60
69
|
if (!requiredFault) {
|
|
61
70
|
workflow.unresolved = pending;
|
|
62
|
-
|
|
63
|
-
// best-effort. A failing saveWorkflow() must not swallow the decision or leak exception
|
|
64
|
-
// text: record the withhold-persist-failed diagnostic on the shared context diagnostics
|
|
65
|
-
// (also when the earlier obligations write already failed) and still emit the reminder
|
|
66
|
-
// below. Stop stays non-blocking: exit 0, no retry loop, no lock.
|
|
67
|
-
// Scope of the recovery (PR #351 re-review): the local recovery and the
|
|
68
|
-
// withhold-persist-failed diagnostic apply only when this Stop run made an actual ON,
|
|
69
|
-
// supported, withheld pilot decision (`withholdPilotVerification` sets the transient
|
|
70
|
-
// per-run marker on the context). On switch-OFF, Fable and persisted-untyped paths the
|
|
71
|
-
// marker is never set, so the error is rethrown and reaches Stop's outer handler exactly
|
|
72
|
-
// as the pre-S1 legacy reference: same stderr, same exit 0, no pilot diagnostic.
|
|
73
|
-
try {
|
|
74
|
-
saveWorkflow(context);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
if (context.docReconciliationWithheldRun !== true) throw error;
|
|
77
|
-
if (!Array.isArray(context.workflow.docReconciliationDiagnostics)) {
|
|
78
|
-
context.workflow.docReconciliationDiagnostics = [];
|
|
79
|
-
}
|
|
80
|
-
if (!context.workflow.docReconciliationDiagnostics.includes('withhold-persist-failed')) {
|
|
81
|
-
context.workflow.docReconciliationDiagnostics.push('withhold-persist-failed');
|
|
82
|
-
}
|
|
83
|
-
warn('Pending-workflow persistence failed (withhold-persist-failed); the unresolved evidence below is still binding.');
|
|
84
|
-
}
|
|
71
|
+
saveWorkflow(context);
|
|
85
72
|
}
|
|
86
73
|
warn('Unresolved workflow evidence: ' + pending.join(', ') + '. Resolve/verify before claiming completion.');
|
|
87
74
|
return;
|