harness-everything 0.7.0 → 0.8.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 (75) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.github/workflows/ci.yml +12 -2
  4. package/AGENTS.md +36 -33
  5. package/CHANGELOG.md +23 -0
  6. package/README.md +9 -8
  7. package/benchmarks/results/reviews/pr142-verification.json +95 -0
  8. package/ci/action-gate.test.js +1 -1
  9. package/ci/doc-capability-consistency.test.js +3 -0
  10. package/ci/invariant-routing.test.js +105 -34
  11. package/ci/mechanism-2af-worktree-isolation.test.js +152 -0
  12. package/ci/mechanism-2ag-router-worktree-contract.test.js +44 -0
  13. package/ci/mechanism-2ah-workflow-lifecycle.test.js +140 -0
  14. package/ci/openai-plugin-package.test.js +14 -7
  15. package/ci/workflow-execution-contract.test.js +60 -0
  16. package/docs/architecture.md +112 -106
  17. package/docs/mechanism-first-skill-mesh.md +93 -99
  18. package/docs/openai-plugin.md +1 -1
  19. package/docs/philosophy.md +40 -30
  20. package/docs/platform-capabilities.md +10 -2
  21. package/docs/reviews/pr-142-issue-131.md +89 -0
  22. package/docs/routing.md +68 -103
  23. package/docs/workflow-runtime.md +109 -0
  24. package/fable-mode/CONTRACT-FORMAT.md +3 -1
  25. package/fable-mode/SKILL.md +1 -1
  26. package/fable-mode/execution-guardrails/SKILL.md +1 -1
  27. package/fable-mode/fable-haiku/SKILL.md +1 -1
  28. package/fable-mode/fable-opus/SKILL.md +1 -1
  29. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  30. package/fable-mode/scripts/workflow-plan-consumer.js +3 -1
  31. package/harness-everything/SKILL.md +17 -23
  32. package/harness-everything/references/triage-and-tiers.md +81 -98
  33. package/harness-everything/scripts/kernel-router-core.js +263 -0
  34. package/harness-everything/scripts/kernel-router.js +97 -212
  35. package/harness-everything/scripts/router-contract-core.js +612 -0
  36. package/harness-everything/scripts/router-contract.js +21 -581
  37. package/hooks/hooks.json +22 -1
  38. package/hooks/scripts/contract-test.js +24 -2
  39. package/hooks/scripts/lib/workflow-isolation.js +102 -0
  40. package/hooks/scripts/lib/workflow-runtime.js +102 -0
  41. package/hooks/scripts/state-persist.js +1 -0
  42. package/hooks/scripts/workflow-disposition.js +97 -0
  43. package/hooks/scripts/workflow-gate.js +53 -0
  44. package/hooks/scripts/workflow-stop-gate.js +44 -0
  45. package/opencode-plugin/plugin.json +1 -1
  46. package/package.json +2 -2
  47. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  48. package/plugins/harness-everything/hooks/hooks.json +20 -1
  49. package/plugins/harness-everything/hooks/scripts/contract-test.js +24 -2
  50. package/plugins/harness-everything/hooks/scripts/lib/workflow-isolation.js +102 -0
  51. package/plugins/harness-everything/hooks/scripts/lib/workflow-runtime.js +102 -0
  52. package/plugins/harness-everything/hooks/scripts/state-persist.js +1 -0
  53. package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +97 -0
  54. package/plugins/harness-everything/hooks/scripts/workflow-gate.js +53 -0
  55. package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +44 -0
  56. package/plugins/harness-everything/plugin.json +1 -1
  57. package/plugins/harness-everything/scripts/lib/advisory-text.js +53 -54
  58. package/plugins/harness-everything/skills/fable-mode/CONTRACT-FORMAT.md +3 -1
  59. package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
  60. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +1 -1
  61. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  62. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +1 -1
  63. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  64. package/plugins/harness-everything/skills/fable-mode/scripts/workflow-plan-consumer.js +3 -1
  65. package/plugins/harness-everything/skills/harness-everything/SKILL.md +17 -23
  66. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +81 -98
  67. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +263 -0
  68. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +97 -212
  69. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +612 -0
  70. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract.js +21 -581
  71. package/plugins/harness-everything/skills/using-git-worktrees/SKILL.md +14 -16
  72. package/plugins/harness-everything/skills/using-git-worktrees/references/workflow-details.md +44 -85
  73. package/scripts/lib/advisory-text.js +53 -54
  74. package/using-git-worktrees/SKILL.md +14 -16
  75. package/using-git-worktrees/references/workflow-details.md +44 -85
@@ -10,7 +10,7 @@
10
10
  "name": "harness-everything",
11
11
  "source": "./",
12
12
  "description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
13
- "version": "0.7.0",
13
+ "version": "0.8.1",
14
14
  "author": {
15
15
  "name": "Miya Daniel"
16
16
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harness-everything",
3
3
  "description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
4
- "version": "0.7.0",
4
+ "version": "0.8.1",
5
5
  "author": {
6
6
  "name": "Miya Daniel"
7
7
  },
@@ -70,8 +70,18 @@ jobs:
70
70
  - uses: actions/checkout@v7
71
71
  with:
72
72
  fetch-depth: 0
73
- - name: Install waza CLI
74
- run: curl -fsSL https://raw.githubusercontent.com/microsoft/waza/main/install.sh | bash
73
+ - name: Install pinned waza CLI
74
+ run: |
75
+ WAZA_VERSION=0.38.6
76
+ WAZA_SHA256=a799587795fd462411ca7c7af5faccee7e24f08e41d152c10738d31334d1c063
77
+ mkdir -p "$HOME/bin"
78
+ curl -fL --retry 3 --retry-all-errors \
79
+ -o "$HOME/bin/waza" \
80
+ "https://github.com/microsoft/waza/releases/download/v${WAZA_VERSION}/waza-linux-amd64"
81
+ echo "${WAZA_SHA256} $HOME/bin/waza" | sha256sum -c -
82
+ chmod +x "$HOME/bin/waza"
83
+ echo "$HOME/bin" >> "$GITHUB_PATH"
84
+ "$HOME/bin/waza" --version
75
85
  - name: Check every canonical SKILL.md passes waza readiness gates
76
86
  run: |
77
87
  fail=0
package/AGENTS.md CHANGED
@@ -4,20 +4,20 @@ description: Operating guide for AI agents working inside the Harness-everything
4
4
 
5
5
  # AGENTS.md — Working in This Repository
6
6
 
7
- You are modifying **Harness**: an orchestrated agent operating system (skills + hooks/plugins + routing) for AI coding agents. Changes here ship to real agent sessions; a vague `SKILL.md`, stale manifest, or contradictory platform claim can misroute other people's agents. Precision is the product.
7
+ You are modifying **Harness**: an orchestrated agent operating system (skills + hooks/plugins + routing) for AI coding agents. Changes here ship to real agent sessions; a vague `SKILL.md`, stale manifest, contradictory platform claim, or selected workflow that remains bypassable can misroute other people's agents. Precision is the product.
8
8
 
9
9
  ## Repository Layout
10
10
 
11
11
  | Path | What it is |
12
12
  |---|---|
13
13
  | `<skill-name>/SKILL.md` | One canonical skill per top-level directory. Frontmatter: `name`, `description`, `metadata.author`, `metadata.version`. |
14
- | `hooks/` | Claude Code lifecycle hook scripts and shared mechanisms such as circuit breaker, scope guard, and stop gate. Do not infer that every host packages every hook. |
15
- | `harness-everything/scripts/` | Runtime: kernel/tier routing, verification, bootstrap, self-heal. |
14
+ | `hooks/` | Claude Code lifecycle hook scripts and shared mechanisms such as circuit breaker, workflow/action/scope guards, and stop gates. Do not infer that every host packages every hook. |
15
+ | `harness-everything/scripts/` | Runtime: kernel/tier routing, workflow contract, verification, bootstrap, self-heal. |
16
16
  | `opencode-plugin/` | OpenCode native plugin implementation. Mechanism-tested, with partial live-host evidence for project-scope `.js` loading and edit/verification state on OpenCode 1.18.31 (macOS); see the evidence boundary below. |
17
17
  | `.agents/plugins/` + `plugins/harness-everything/` | Local OpenAI/Codex marketplace + `.codex-plugin` package with canonical skill copies and packaged session/prompt hooks. |
18
18
  | `submission/openai/` | Public OpenAI Skills-only listing/test inputs. The public artifact does not include local `.codex-plugin` lifecycle hooks. |
19
19
  | `evals/<skill>/` | Trigger/routing eval per skill (waza format). Required for every canonical routed skill. |
20
- | `behavioral-evals/` | LLM-behavior cases run via headless CLI sessions. They can be run on demand and are also structurally validated by the weekly `behavioral-evals.yml` workflow; live cases run there only when the Claude CLI is available. |
20
+ | `behavioral-evals/` | LLM-behavior cases run via headless CLI sessions and structurally validated by CI. |
21
21
  | `benchmarks/` | BENCHMARK_SOP fixtures and recorded results. Evidence lives here or nowhere. |
22
22
  | `.claude-plugin/` | Claude Code plugin distribution manifests. Must list exactly the on-disk canonical skills. |
23
23
  | `docs/platform-capabilities.md` | Canonical current platform/install/enforcement/evidence matrix. |
@@ -27,41 +27,44 @@ You are modifying **Harness**: an orchestrated agent operating system (skills +
27
27
 
28
28
  ## OpenCode evidence boundary
29
29
 
30
- The retained [OpenCode evidence](benchmarks/results/live-host/opencode-2026-09-16/README.md) supports only the scoped loading and state effects above. The final snapshot is post-reset (`hardLock: false`, `count: 1`). Hard lock is only an interactive observation with no retained blocked-tool trace; reflection was operator-seeded, then agent-rewritten. Agent-controlled state deletion resets the breaker, so do not claim durable hard enforcement or behavioral effectiveness. `.mjs` auto-discovery is broken on this host version. Global scope, npm-package installation, and other host versions remain unverified.
30
+ The retained [OpenCode evidence](benchmarks/results/live-host/opencode-2026-09-16/README.md) supports project-scope `.js` loading and edit/verification state on OpenCode 1.18.31 (macOS). The final snapshot is post-reset (`hardLock: false`, `count: 1`). Hard lock is only an interactive observation with no retained blocked-tool trace; reflection was operator-seeded, then agent-rewritten. Agent-controlled state deletion resets the breaker. Global scope, npm-package installation, and other OpenCode versions remain unverified.
31
31
 
32
32
  ## Non-Negotiable Change Rules
33
33
 
34
- 1. **Every canonical SKILL.md keeps ≤ 500 tokens** (hard CI gate) and must contain `## USE FOR:` and `## DO NOT USE FOR:` sections. Deep detail goes in the skill's `references/` or `guides/`.
35
- 2. **Descriptions are routing surfaces.** Two skills whose descriptions overlap enough that a router cannot distinguish them will fail `test:collision`. When adding a skill, differentiate its description from near neighbors deliberately.
36
- 3. **A new canonical skill ships with a routing eval** (`evals/<skill>/eval.yaml` + positive/negative tasks). The positive task's `description:` field must carry the skill's exact frontmatter description — waza's deterministic matcher requires it verbatim.
37
- 4. **Release version policy:** normal PRs do not manually bump package/plugin versions. `semantic-release` determines the next stable SemVer from Conventional Commits on `main`, and `scripts/sync-release-version.js` owns distribution-version synchronization. Skill frontmatter versions remain release metadata and must never exceed the package version's numeric base. Nested sub-skills (`<skill>/<sub>/SKILL.md`) inherit the parent skill's version and must always match it.
38
- 5. **Distribution manifests are generated facts, not opinions:** if you add/remove/rename a canonical skill, update/sync every distribution that copies or lists it. Run `npm run plugin:sync`, `npm run test:consistency`, and `npm run test:plugin:openai` rather than updating only `.claude-plugin/plugin.json`.
39
- 6. **Platform capability claims are tested contracts.** If host integration behavior changes, update `docs/platform-capabilities.md` and every affected current-state surface in the same change. Never turn package/mechanism evidence into a live-host claim, and never describe public Skills-only behavior as if it includes local lifecycle hooks.
40
- 7. **Runtime/workflow claims are generated facts.** `package.json`, `.nvmrc`, `Dockerfile`, and active `.github/workflows/*.yml` are parsed by `scripts/repository-contract.js`. After changing them, run `npm run docs:sync`; `test:repo-contract` rejects stale generated docs, unsupported action majors, Node runtimes below the support floor, or loss of the Node 22 compatibility lane.
41
- 8. **CHANGELOG.md keeps pending human-authored notes under `[Unreleased]`.** Do not create new alpha/beta/rc release headings; semantic-release owns stable release headings, tags, and release notes.
42
- 9. **Conventional Commit type is release input.** The final commit/squash title that lands on `main` must follow the convention. Breaking changes release major; `feat` releases minor; `fix`, `perf`, `refactor`, `build`, and `revert` release patch; `docs`, `test`, `ci`, `style`, and `chore` do not release by themselves.
34
+ 1. **Every canonical SKILL.md keeps ≤ 500 tokens** (hard CI gate) and must contain `## USE FOR:` and `## DO NOT USE FOR:`. Deep detail goes in references/guides.
35
+ 2. **Descriptions are routing surfaces.** Differentiate neighboring skills deliberately; `test:collision` guards overlap.
36
+ 3. **A new canonical skill ships with a routing eval.** Positive task `description:` must exactly match the skill frontmatter description.
37
+ 4. **Release version policy:** normal PRs do not manually bump package/plugin versions. `semantic-release` owns stable SemVer and `scripts/sync-release-version.js` owns distribution synchronization. Nested sub-skills inherit their parent skill version.
38
+ 5. **Distribution manifests are generated facts:** add/remove/rename changes must sync every copied/listed distribution. Run `npm run plugin:sync`, `npm run test:consistency`, and `npm run test:plugin:openai`.
39
+ 6. **Platform capability claims are tested contracts.** Update `docs/platform-capabilities.md` with integration behavior changes. Package/mechanism evidence is not live-host evidence, and public Skills-only behavior does not include local lifecycle hooks.
40
+ 7. **Runtime/workflow claims are generated facts.** `package.json`, `.nvmrc`, Dockerfile, and active workflows feed `scripts/repository-contract.js`; run `npm run docs:sync` after relevant changes.
41
+ 8. **CHANGELOG.md keeps pending human-authored notes under `[Unreleased]`.** Semantic-release owns stable headings/tags/release notes.
42
+ 9. **Conventional Commit type is release input.** Breaking→major; `feat`→minor; `fix`/`perf`/`refactor`/`build`/`revert`→patch; docs/test/ci/style/chore do not release by themselves.
43
+ 10. **Selected workflow is mandatory; reasoning inside it stays flexible.** Before omitting a suggested skill, read/evaluate its complete `SKILL.md` flow. Suggested skills may be `not-applicable` with a flow-grounded reason, but a selected topology must be executed to resolution. Do not bypass it because the task feels simple/routine/already clear. Escape is limited to genuinely uncovered workflow scope or host-capability loss and requires explicit scope + evidence. Do not turn this into one universal TODO/TDD/Fable sequence.
44
+ 11. **Major mutation requires Git worktree isolation.** Read-only discovery may stay in the bound repository. Tier 3 / Fable source and artifact changes must target a verified linked worktree belonging to that repository; creation failure means `blocked`. Worktree isolation is separate from durable multi-agent workspace state. Scoped escape never waives it. See [workflow-runtime.md](docs/workflow-runtime.md) for the tested boundary and limitations.
43
45
 
44
46
  ## Verification Before You Claim Done
45
47
 
46
- Run the local gates that cover the same contract categories as CI:
48
+ Run the gates that cover the same contract categories as CI:
47
49
 
48
50
  ```bash
49
- npm test # self-regression: syntax, routing, mechanisms
50
- npm run test:mutations # focused mutation checks
51
- npm run test:mechanism # mechanism suites alone
52
- npm run test:consistency # manifests, versions, docs links, eval coverage + repository contract
53
- npm run test:repo-contract # runtime/workflow/action/schedule drift gate
54
- npm run test:docs:capabilities # platform documentation drift gate
55
- npm run test:references # executable/deep-dive references
56
- npm run test:release # release catalog + semantic-release/version-sync contract
57
- npm run test:collision # description collision detection
58
- npm run test:routing:skills # every positive skill route reaches its target
59
- npm run test:plugin:openai # local OpenAI/Codex plugin package
60
- npm run test:plugin:submission # public Skills-only submission inputs/bundle parity
51
+ npm test
52
+ npm run test:mutations
53
+ npm run test:mechanism
54
+ npm run test:consistency
55
+ npm run test:repo-contract
56
+ npm run test:docs:capabilities
57
+ npm run test:references
58
+ npm run test:release
59
+ npm run test:collision
60
+ npm run test:routing:skills
61
+ npm run test:routing:invariants
62
+ npm run test:plugin:openai
63
+ npm run test:plugin:submission
61
64
  npm run test:platform:compatibility
62
65
  ```
63
66
 
64
- If waza is installed (`~/bin/waza`), also run what CI runs:
67
+ If waza is installed (`~/bin/waza`), also run:
65
68
 
66
69
  ```bash
67
70
  waza check <skill-dir>
@@ -69,16 +72,16 @@ waza spec verify <skill> evals/<skill>/eval.yaml --fail --threshold 1
69
72
  waza tokens check
70
73
  ```
71
74
 
72
- Node.js 24 is the primary CI runtime across Ubuntu, Windows, and macOS. A separate Ubuntu Node.js 22 lane protects the advertised minimum runtime. See [docs/repository-contract.md](docs/repository-contract.md) for the generated current state.
75
+ Node.js 24 is primary CI across Ubuntu/Windows/macOS; a Node.js 22 lane protects the supported minimum. See [docs/repository-contract.md](docs/repository-contract.md).
73
76
 
74
- Do not report "it works" from reading code. Record which evidence layer you actually proved: package, deterministic mechanism, live host, or behavior.
77
+ Do not report "it works" from code reading. State the evidence layer proved: package, deterministic mechanism, live host, or behavior.
75
78
 
76
79
  ## Behavioral & Benchmark Evidence
77
80
 
78
- Deterministic mechanism tests prove the tested hook/plugin contract; they do **not** prove a real host loaded it or that agents behave differently. For behavior:
81
+ Deterministic mechanism tests prove the tested hook/plugin contract; they do **not** prove a real host loaded it or that behavior improved. For behavior:
79
82
 
80
83
  - `node behavioral-evals/run.js run --engine opencode` (or `--engine claude`) — on-demand, token-costing.
81
- - The weekly `behavioral-evals.yml` workflow always validates case structure and runs live cases only when its runner has the Claude CLI.
84
+ - Weekly behavioral workflow validates case structure and runs live cases only when its runner has the required CLI.
82
85
  - `node benchmarks/run.js scaffold <scenario>` → run both variants → `record` with evidence logs.
83
86
 
84
- For a live-host enforcement claim, preserve a host/session artifact showing the mechanism was actually loaded and fired. Results are committed where the relevant evidence workflow requires it. A benchmark run without a recorded result is indistinguishable from one that never happened.
87
+ For a live-host enforcement claim, preserve a host/session artifact showing the mechanism loaded and fired. For an effectiveness claim, use the paired evidence discipline in #71 rather than inferring improvement from mechanism presence.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.8.1](https://github.com/dyphn1/Harness-everything/compare/v0.8.0...v0.8.1) (2026-09-17)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **router:** enforce selected workflow lifecycle ([9f3394a](https://github.com/dyphn1/Harness-everything/commit/9f3394a3ff59aaa08428e12a9a2784e7541368c4))
10
+ * **workflow:** Close lifecycle isolation gaps ([96b58e7](https://github.com/dyphn1/Harness-everything/commit/96b58e7ce2e52312880663e59380038e4bf5f985)), closes [#131](https://github.com/dyphn1/Harness-everything/issues/131)
11
+ * **workflow:** Normalize Windows worktree paths ([18ee645](https://github.com/dyphn1/Harness-everything/commit/18ee645a1a7165d01d60a964947082ad0108b93c)), closes [#131](https://github.com/dyphn1/Harness-everything/issues/131)
12
+ * **workflow:** require worktree isolation for major mutations ([9ba0098](https://github.com/dyphn1/Harness-everything/commit/9ba0098adc94fe141fca2c03f07d0883d9a56b9b))
13
+
14
+ ## [Unreleased]
15
+
16
+ ### Fixed
17
+
18
+ - Make selected workflows persist across follow-up prompts, bind Fable runs to workflow/session identities, and require correlated stage evidence before completion (#131, #142).
19
+ - Enforce major-workflow Git worktree isolation at supported mutation hooks, check direct/patch targets and explicit shell paths, and retain isolation across scoped escape and blocked states.
20
+ - Provide bounded run entry/replan and per-stage escape commands; expose unsupported hosts and shell-sandbox limits without upgrading live-host evidence.
21
+
22
+ ## [0.8.0](https://github.com/dyphn1/Harness-everything/compare/v0.7.0...v0.8.0) (2026-09-17)
23
+
24
+ ### Features
25
+
26
+ * **router:** require evaluation before skipping suggested skills ([#140](https://github.com/dyphn1/Harness-everything/issues/140)) ([b959cb9](https://github.com/dyphn1/Harness-everything/commit/b959cb94afff984c4e4507f0be7f6c62dfa89961)), closes [#131](https://github.com/dyphn1/Harness-everything/issues/131)
27
+
5
28
  ## [0.7.0](https://github.com/dyphn1/Harness-everything/compare/v0.6.1...v0.7.0) (2026-09-17)
6
29
 
7
30
  ### Features
package/README.md CHANGED
@@ -19,7 +19,7 @@ AI coding agents are highly capable, but they struggle with self-regulation, env
19
19
 
20
20
  Harness acts as an automated system supervisor. It remains completely silent and out of the way, intervening only when execution boundaries are violated or failures are detected.
21
21
 
22
- Harness deliberately follows a **minimal rails, maximum freedom** design: the runtime enforces only a few cross-cutting invariants — route before execution, verify before claim, and re-plan after repeated identical failure — while capable agents remain free to choose, combine, reorder, or skip domain skills according to the task.
22
+ Harness deliberately follows a **minimal rails, maximum freedom** design: the runtime enforces route-before-execution, verify-before-claim, and re-plan-after repeated identical failure. When routing emits skill suggestions, it adds one conditional rail: **evaluate before skip**. The agent must read each suggested skill's `SKILL.md` entry/basic flow before omitting it, but remains free to choose, combine, reorder, or skip execution after that evaluation.
23
23
 
24
24
  ### Comparison: Prompt vs. Skill vs. Harness
25
25
 
@@ -68,7 +68,7 @@ npx github:dyphn1/Harness-everything install
68
68
  1. **Use the selected surface's real mechanism:** Claude Code hooks, the local OpenAI plugin lifecycle hooks, OpenCode's plugin API, or advisory instructions depending on what you installed.
69
69
  2. **Preflight / session context where packaged:** Hook-capable surfaces can inject environment/session context automatically; advisory-only surfaces must not be described as if they do.
70
70
  3. **Verification boundary:** Completion claims require objective evidence; whether that boundary is mechanically invoked or explicitly called depends on the host surface.
71
- 4. **Agent Freedom Preserved:** Tier classification suggests useful skills, but does not impose a universal TODO/TDD/Fable sequence.
71
+ 4. **Mandatory applicable workflow:** Evaluate each suggested skill's complete `SKILL.md` before omission, then resolve the selected topology with objective evidence. Reasoning and implementation remain flexible; escape applies only to a declared uncovered stage with evidence. Tier 3 / Fable mutation requires a verified Git worktree. See the [workflow runtime contract](docs/workflow-runtime.md) for entry, completion, and host limits. Harness does not impose one universal TODO/TDD/Fable sequence.
72
72
 
73
73
  ### What Gets Installed (and How to Remove It)
74
74
 
@@ -119,9 +119,10 @@ flowchart TD
119
119
  flowchart TD
120
120
  U([User Request]) --> K[Harness Kernel<br/>classify scope + establish invariants]
121
121
  K --> T{Tier recommendation}
122
- T -->|Tier 1| A[Agent chooses smallest useful tactic / skill set]
123
- T -->|Tier 2| A
124
- T -->|Tier 3| A
122
+ T --> S{Suggested skills?}
123
+ S -->|Yes| R[Read each suggested SKILL.md<br/>evaluate flow + applicability]
124
+ S -->|No| A[Agent chooses smallest useful tactic / skill set]
125
+ R --> A
125
126
  A --> Exec[Execute Code / Run Commands]
126
127
  Exec --> Gate{Objective evidence supports completion?}
127
128
  Gate -->|No| Retry[Diagnose / iterate]
@@ -137,7 +138,7 @@ flowchart TD
137
138
  style Gate fill:#ffcdd2,stroke:#c62828,stroke-width:1px,color:#000000
138
139
  ```
139
140
 
140
- The Tier changes the **recommendations**, not the required order. Tier 2 may suggest `tdd`, `todo-driven-workflow`, or `verification-loop`; Tier 3 may suggest Fable or multi-agent capabilities. The model decides what actually helps.
141
+ The Tier changes the **recommendations**, not the required order. Tier 2 may suggest `tdd`, `todo-driven-workflow`, or `verification-loop`; Tier 3 may suggest Fable or multi-agent capabilities. Suggestions are **mandatory to evaluate and advisory to execute**: read each suggested skill's `SKILL.md` flow before omission, then let the model decide what actually helps.
141
142
 
142
143
  ---
143
144
 
@@ -145,7 +146,7 @@ The Tier changes the **recommendations**, not the required order. Tier 2 may sug
145
146
 
146
147
  Harness operates through six core cognitive concepts:
147
148
 
148
- 1. **Kernel Router (`kernel-router.js` + `tier-router.js`):** `tier-router.js` remains the classifier, dynamic-skill detector, and knowledge-guide matcher. `kernel-router.js` is the public runtime boundary: it preserves the classifier result, removes legacy fixed-pipeline instructions, injects the three mandatory invariants, and presents domain skills as advisory suggestions. This prevents host peer-skill selection from bypassing Harness while preserving agent autonomy. If nothing matches at all — including nothing already kept from the open skills ecosystem — `find-skills` checks `npx skills list` live and, if still nothing, searches `skills.sh`/`npx skills` with explicit approval before installation.
149
+ 1. **Kernel Router (`kernel-router.js` + `tier-router.js`):** `tier-router.js` remains the classifier, dynamic-skill detector, and knowledge-guide matcher. `kernel-router.js` is the public runtime boundary: it preserves the classifier result, removes legacy fixed-pipeline instructions, injects the baseline invariants, and adds `evaluate-suggestions-before-skip` whenever domain skills are suggested. Suggestions are mandatory to evaluate by reading their `SKILL.md` entry/basic flow, but advisory to execute after evaluation. This prevents host peer-skill selection or superficial routing summaries from bypassing Harness while preserving agent autonomy. If nothing matches at all — including nothing already kept from the open skills ecosystem — `find-skills` checks `npx skills list` live and, if still nothing, searches `skills.sh`/`npx skills` with explicit approval before installation.
149
150
  2. **Guard (`rule-of-3.js`):** The fail-safe circuit breaker. Tracks failure signatures across terminal runs on integration surfaces that package the required lifecycle hooks. If a test or command fails 3 times with the same signature, it locks mutating tools and forces a `zoom-out` reflection: re-verify every assumption with read-only tools, write a fact-checked report, then resume on a fresh diagnosis. A companion `Stop` gate (`stop-gate.js`) can bounce the end of a turn once per edit batch when edits were never followed by successful verification on hosts where that hook is installed.
150
151
  3. **Memory (`state-persist.js`):** Session transaction logging for stateful hook/plugin integrations. Static skills/instructions alone do not create WAL state.
151
152
  4. **Reflection (`self-evolve`):** Long-term workspace immunization. Upon task completion, the agent reflects on the root cause of resolved issues, then judges whether the lesson is a simple rule or a reusable, complex pattern: simple rules are appended to local workspace rules (`RULES.md`); genuinely reusable patterns are instead packaged as a dynamic skill (via `skill-creator`'s Dynamic Skill Generation Contract) and registered in `manifest.json` so the Router picks it up in future sessions. Either path is validated by a hermetic self-regression suite before it's persisted.
@@ -285,7 +286,7 @@ Mechanism tests prove individual packaged mechanisms; only real host/session evi
285
286
 
286
287
  ### Catalog hygiene
287
288
 
288
- `npm run test:consistency` keeps distribution manifests, docs links, skill frontmatter, routing-eval coverage, platform capability claims, and the generated repository runtime/workflow contract in lockstep with what is actually on disk. `npm run test:repo-contract` runs the runtime/workflow drift gate directly, while `npm run docs:sync` regenerates [docs/repository-contract.md](docs/repository-contract.md) after an intentional change. `npm run test:docs:capabilities` runs the platform-doc drift check directly. `npm run test:references` checks every executable/deep-dive path named by `SKILL.md`; `npm run test:release` compares release/catalog evidence; `npm run test:routing:skills` recursively classifies nested skills and executes the real router for every directly-routable skill's positive cases; `npm run test:routing:invariants` guards the invariant-first architecture; and `harness verify-install` detects stale installed versions or file trees. The installer E2E gate performs install → verify-install → uninstall against seeded user-owned files on Ubuntu, Windows, and macOS so path and ownership symmetry regressions fail CI. `npm run test:collision` fails CI when two skills' descriptions overlap enough to confuse the router.
289
+ `npm run test:consistency` keeps distribution manifests, docs links, skill frontmatter, routing-eval coverage, platform capability claims, and the generated repository runtime/workflow contract in lockstep with what is actually on disk. `npm run test:repo-contract` runs the runtime/workflow drift gate directly, while `npm run docs:sync` regenerates [docs/repository-contract.md](docs/repository-contract.md) after an intentional change. `npm run test:docs:capabilities` runs the platform-doc drift check directly. `npm run test:references` checks every executable/deep-dive path named by `SKILL.md`; `npm run test:release` compares release/catalog evidence; `npm run test:routing:skills` recursively classifies nested skills and executes the real router for every directly-routable skill's positive cases; `npm run test:routing:invariants` guards the invariant-first architecture including read-before-skip; and `harness verify-install` detects stale installed versions or file trees. The installer E2E gate performs install → verify-install → uninstall against seeded user-owned files on Ubuntu, Windows, and macOS so path and ownership symmetry regressions fail CI. `npm run test:collision` fails CI when two skills' descriptions overlap enough to confuse the router.
289
290
 
290
291
  ---
291
292
 
@@ -0,0 +1,95 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "baselineCommit": "8b99baec44745e171f078fe9eb3dac6fd812b5c8",
4
+ "reviewedRevision": "commit containing this report",
5
+ "evidenceLayer": "local deterministic mechanisms and packages",
6
+ "environment": {
7
+ "os": "win32",
8
+ "node": "v24.15.0",
9
+ "npm": "11.12.1"
10
+ },
11
+ "gates": [
12
+ {
13
+ "gate": "test",
14
+ "exitCode": 0,
15
+ "seconds": 76.007
16
+ },
17
+ {
18
+ "gate": "test:mutations",
19
+ "exitCode": 0,
20
+ "seconds": 5.309
21
+ },
22
+ {
23
+ "gate": "test:mechanism",
24
+ "exitCode": 0,
25
+ "seconds": 54.904
26
+ },
27
+ {
28
+ "gate": "test:consistency",
29
+ "exitCode": 0,
30
+ "seconds": 0.782
31
+ },
32
+ {
33
+ "gate": "test:repo-contract",
34
+ "exitCode": 0,
35
+ "seconds": 0.522
36
+ },
37
+ {
38
+ "gate": "test:docs:capabilities",
39
+ "exitCode": 0,
40
+ "seconds": 0.639
41
+ },
42
+ {
43
+ "gate": "test:references",
44
+ "exitCode": 0,
45
+ "seconds": 0.597
46
+ },
47
+ {
48
+ "gate": "test:release",
49
+ "exitCode": 0,
50
+ "seconds": 5.161
51
+ },
52
+ {
53
+ "gate": "test:collision",
54
+ "exitCode": 0,
55
+ "seconds": 0.481
56
+ },
57
+ {
58
+ "gate": "test:routing:skills",
59
+ "exitCode": 0,
60
+ "seconds": 2.926
61
+ },
62
+ {
63
+ "gate": "test:routing:invariants",
64
+ "exitCode": 0,
65
+ "seconds": 3.521
66
+ },
67
+ {
68
+ "gate": "test:plugin:openai",
69
+ "exitCode": 0,
70
+ "seconds": 4.225
71
+ },
72
+ {
73
+ "gate": "test:plugin:submission",
74
+ "exitCode": 0,
75
+ "seconds": 0.963
76
+ },
77
+ {
78
+ "gate": "test:platform:compatibility",
79
+ "exitCode": 0,
80
+ "seconds": 0.612
81
+ }
82
+ ],
83
+ "mechanismSuites": 44,
84
+ "lifecycleAssertions": {
85
+ "source": 50,
86
+ "openaiPackage": 50
87
+ },
88
+ "waza": {
89
+ "checks": 57,
90
+ "passed": 57
91
+ },
92
+ "liveHost": "not run for this change",
93
+ "behavioralEffectiveness": "not measured for this change",
94
+ "windowsPathRegression": "Native resolution equates Windows 8.3 and long path spellings; regression and final local self-regression passed."
95
+ }
@@ -237,7 +237,7 @@ try {
237
237
  check(canonicalHooks.hooks.Stop.some(group => group.id === 'harness:stop:action-gate-audit'), 'Claude hook manifest closes unresolved approvals on Stop');
238
238
 
239
239
  const pluginHooks = JSON.parse(fs.readFileSync(path.join(ROOT, 'plugins', 'harness-everything', 'hooks', 'hooks.json'), 'utf8'));
240
- const pluginPre = pluginHooks.hooks.PreToolUse.find(group => group.matcher === 'Bash|apply_patch');
240
+ const pluginPre = pluginHooks.hooks.PreToolUse.find(group => group.matcher === 'Bash|apply_patch' && group.hooks.some(hook => /codex-action-gate-pre\.js/.test(hook.command)));
241
241
  check(pluginPre && pluginPre.hooks.some(hook => /codex-action-gate-pre\.js/.test(hook.command)), 'OpenAI plugin wires the attribution-aware Codex action-gate adapter to Bash|apply_patch');
242
242
  check(!Object.prototype.hasOwnProperty.call(pluginHooks.hooks, 'PostToolUseFailure'), 'Codex plugin does not declare unsupported PostToolUseFailure lifecycle event');
243
243
  const pluginPost = pluginHooks.hooks.PostToolUse.find(group => group.matcher === 'Bash|apply_patch');
@@ -44,6 +44,7 @@ const CURRENT_SURFACES = [
44
44
  'docs/platform-capabilities.md',
45
45
  'docs/reflection.md',
46
46
  'docs/routing.md',
47
+ 'docs/workflow-runtime.md',
47
48
  'docs/troubleshooting.md',
48
49
  'docs/openai-plugin.md',
49
50
  'submission/openai/README.md',
@@ -59,6 +60,8 @@ const STALE_PATTERNS = [
59
60
  /Only possible on Claude Code \(the only platform with a hook\/exit-code execution system\)/i,
60
61
  /On platforms with no hook system at all \(Cursor, Copilot, Codex/i,
61
62
  /hooks[^\n]{0,100}Hard enforcement, Claude Code only/i,
63
+ /mandatory evaluation\s*[,/]\s*advisory execution/i,
64
+ /Tier-specific skills remain advisory/i,
62
65
  /Codex[^\n]{0,180}\.codex\/skills\//i,
63
66
  ];
64
67
 
@@ -7,19 +7,15 @@ const ROOT = path.resolve(__dirname, '..');
7
7
  let failed = 0;
8
8
 
9
9
  function check(condition, message) {
10
- if (condition) {
11
- console.log(` PASS ${message}`);
12
- } else {
13
- console.error(` FAIL ${message}`);
14
- failed++;
15
- }
10
+ if (condition) console.log(` PASS ${message}`);
11
+ else { console.error(` FAIL ${message}`); failed++; }
16
12
  }
17
13
 
18
14
  function read(rel) {
19
15
  return fs.readFileSync(path.join(ROOT, rel), 'utf8');
20
16
  }
21
17
 
22
- console.log('=== Invariant-First Routing Contract ===');
18
+ console.log('=== Mandatory Workflow Routing Contract ===');
23
19
 
24
20
  const kernel = path.join(ROOT, 'harness-everything', 'scripts', 'kernel-router.js');
25
21
  const tier2 = spawnSync(process.execPath, [kernel, 'add a login endpoint with tests and update the implementation'], {
@@ -35,18 +31,31 @@ check(tier2.stdout.includes('Route before execution'), 'route-before-execution i
35
31
  check(tier2.stdout.includes('Verify before claim'), 'verify-before-claim invariant is present');
36
32
  check(tier2.stdout.includes('after 3 same-signature failures'), 'failure escalation invariant is present');
37
33
  check(tier2.stdout.includes('loop-budget:'), 'iterative-single loop budget invariant is present');
38
- check(tier2.stdout.includes('SUGGESTED SKILLS (ADVISORY'), 'domain skills are explicitly advisory');
34
+ check(tier2.stdout.includes('evaluate-suggestions-before-skip'), 'non-empty suggestions inject evaluate-before-skip invariant');
35
+ check(tier2.stdout.includes('WORKFLOW SKILLS (EVALUATE APPLICABILITY'), 'domain suggestions remain applicability inputs');
36
+ check(tier2.stdout.includes('SELECTED WORKFLOW IS MANDATORY'), 'selected workflow execution is mandatory');
39
37
  check(tier2.stdout.includes('tdd:'), 'Tier 2 can still recommend TDD');
40
38
  check(!tier2.stdout.includes('BASE EXECUTION LOOP'), 'legacy fixed base-execution-loop output is suppressed');
41
- check(tier2.stdout.includes('Do not enforce workflow order'), 'self-orchestration policy is explicit');
39
+ check(tier2.stdout.includes('Mandatory applicable workflow'), 'orchestration policy requires selected applicable workflow');
40
+ check(tier2.stdout.includes('model controls HOW to satisfy it'), 'reasoning/implementation freedom remains inside workflow');
41
+ check(tier2.stdout.includes('WORKFLOW EXECUTION CONTRACT (MANDATORY WHEN SELECTED)'), 'kernel emits workflow execution contract');
42
+ check(tier2.stdout.includes('- State: unpersisted'), 'manual route without host session does not claim persisted lifecycle');
43
+ check(tier2.stdout.includes('Generic simple/routine/already-clear reasons cannot waive'), 'model confidence cannot bypass workflow');
44
+ check(tier2.stdout.includes('Escape is limited to workflow-uncovered-scope or host-capability-unavailable'), 'workflow escape is exception-only');
45
+ check(!tier2.stdout.includes('execution remains advisory after evaluation'), 'old advisory execution wording is absent');
46
+ check(!tier2.stdout.includes('isolated-worktree-before-mutation'), 'Tier 2 does not inherit the major-workflow worktree invariant');
42
47
 
43
48
  const tier2Checkpoints = tier2.stdout.match(/HARNESS ROUTING CHECKPOINT \(REQUIRED VISIBLE STATE\)/g) || [];
44
- check(tier2Checkpoints.length === 1, 'Tier 2 emits exactly one required routing checkpoint');
45
- check(tier2.stdout.includes('- Tier: Tier 2'), 'checkpoint exposes the human-readable Tier 2');
46
- check(tier2.stdout.includes('- Strategy: iterative-single'), 'checkpoint exposes the selected strategy');
49
+ check(tier2Checkpoints.length === 1, 'Tier 2 emits exactly one routing checkpoint');
50
+ check(tier2.stdout.includes('- Tier: Tier 2'), 'checkpoint exposes Tier 2');
51
+ check(tier2.stdout.includes('- Strategy: iterative-single'), 'checkpoint exposes selected strategy');
47
52
  check(/- Required invariants: .*verify-before-claim/.test(tier2.stdout), 'checkpoint exposes required invariants');
48
- check(/- Suggested skills: .*tdd/.test(tier2.stdout), 'checkpoint exposes deduplicated suggestions');
49
- check(tier2.stdout.includes('If all are skipped, state one brief reason'), 'non-empty suggestions carry an all-skipped rationale contract');
53
+ check(/- Suggested skills: .*tdd/.test(tier2.stdout), 'checkpoint exposes suggestions');
54
+ check(tier2.stdout.includes('Suggestion evaluation: MANDATORY'), 'checkpoint requires suggestion evaluation');
55
+ check(tier2.stdout.includes('read its complete SKILL.md entry'), 'checkpoint requires reading skill entry');
56
+ check(tier2.stdout.includes('name, description, router summary'), 'checkpoint rejects metadata-only omission');
57
+ check(tier2.stdout.includes('routine/common task'), 'checkpoint rejects routine-task omission shortcut');
58
+ check(tier2.stdout.includes('selected workflow is mandatory'), 'checkpoint distinguishes skill applicability from topology obligation');
50
59
 
51
60
  const tier3 = spawnSync(process.execPath, [kernel, 'audit the entire repository architecture and coordinate multiple modules'], {
52
61
  cwd: ROOT,
@@ -54,36 +63,98 @@ const tier3 = spawnSync(process.execPath, [kernel, 'audit the entire repository
54
63
  });
55
64
  check(tier3.status === 0, 'Tier 3 kernel routing exits successfully');
56
65
  check(/RECOMMENDED TIER:\s*Tier 3/i.test(tier3.stdout), 'macro task remains Tier 3');
57
- check(tier3.stdout.includes('"strategy":"fable-staged"'), 'Tier 3 dependent/unproven work selects fable-staged');
58
- check(tier3.stdout.includes('fable-mode / fable-discipline'), 'Tier 3 selected plan suggests Fable capabilities');
59
- check(tier3.stdout.includes('suggested skills remain advisory'), 'Tier 3 suggestions remain non-mandatory');
60
- check(tier3.stdout.includes('HARNESS ROUTING CHECKPOINT (REQUIRED VISIBLE STATE)'), 'Tier 3 also emits the required routing checkpoint');
66
+ check(tier3.stdout.includes('"strategy":"fable-staged"'), 'Tier 3 task selects fable-staged');
67
+ check(tier3.stdout.includes('fable-mode / fable-discipline'), 'Tier 3 plan exposes Fable capabilities');
68
+ check(tier3.stdout.includes('selected Fable topology must be entered and resolved before completion'), 'selected Fable topology is mandatory');
69
+ check(tier3.stdout.includes('WORKFLOW EXECUTION CONTRACT (MANDATORY WHEN SELECTED)'), 'Tier 3 emits execution contract');
70
+ check(tier3.stdout.includes('isolated-worktree-before-mutation'), 'Tier 3 structured plan carries the worktree isolation invariant');
71
+ check(tier3.stdout.includes('using-git-worktrees'), 'Tier 3 structured plan surfaces the worktree workflow skill');
72
+ check(tier3.stdout.includes('mutations require Git worktree isolation'), 'Tier 3 execution contract requires worktree isolation before mutation');
73
+ check(tier3.stdout.includes('unavailable isolation means BLOCKED'), 'Tier 3 worktree failure blocks instead of falling back in place');
61
74
 
62
75
  const harnessSkill = read('harness-everything/SKILL.md');
63
- check(!/Requests that already name a skill/i.test(harnessSkill), 'harness entrypoint no longer opts out when another skill is named');
64
- check(/including work that already names or strongly matches another skill/i.test(harnessSkill), 'named domain skills still pass through Harness routing');
65
- check(/not a fixed pipeline/i.test(harnessSkill), 'skill contract rejects fixed pipeline semantics');
66
- check(/Ensure the emitted \*\*Harness Routing Checkpoint\*\* is user-visible/.test(harnessSkill), 'skill contract requires checkpoint visibility');
67
- check(/If suggestions are non-empty and you use none, state one brief skip reason/.test(harnessSkill), 'skill contract requires rationale only when all suggestions are skipped');
76
+ check(/Work that names or matches another skill/i.test(harnessSkill), 'named domain skills still pass through Harness routing');
77
+ check(/selected topology is not advisory/i.test(harnessSkill), 'skill contract makes selected topology mandatory');
78
+ check(/"Simple", "routine".*cannot justify omission/i.test(harnessSkill), 'skill contract rejects confidence/routine omission shortcuts');
79
+ check(/explicit escape with uncovered scope \+ evidence/i.test(harnessSkill), 'skill contract defines evidence-backed escape');
80
+ check(/Complete only after applicable workflow obligations and objective verification resolve/i.test(harnessSkill), 'skill contract gates completion on workflow resolution');
81
+ check(/mandatory applicable workflow; flexible reasoning\/implementation/i.test(harnessSkill), 'skill entry states core policy');
82
+
83
+ const pluginHarnessSkill = read('plugins/harness-everything/skills/harness-everything/SKILL.md');
84
+ check(pluginHarnessSkill === harnessSkill, 'canonical/plugin Harness SKILL.md copies remain identical');
85
+ check(read('plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js') === read('harness-everything/scripts/kernel-router.js'), 'canonical/plugin kernel-router copies remain identical');
86
+ check(read('plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js') === read('harness-everything/scripts/kernel-router-core.js'), 'canonical/plugin kernel-router core copies remain identical');
87
+ check(read('plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md') === read('harness-everything/references/triage-and-tiers.md'), 'canonical/plugin triage references remain identical');
88
+
89
+ const worktreeSkill = read('using-git-worktrees/SKILL.md');
90
+ check(/Major workflow mode/i.test(worktreeSkill), 'worktree skill defines mandatory major-workflow mode');
91
+ check(/never fall back to the primary working tree/i.test(worktreeSkill), 'worktree skill blocks unsafe in-place fallback for major work');
92
+ check(/Creation\/entry failure => `BLOCKED`/i.test(worktreeSkill), 'worktree skill makes isolation failure a blocked state');
93
+ check(read('plugins/harness-everything/skills/using-git-worktrees/SKILL.md') === worktreeSkill, 'canonical/plugin worktree skill copies remain identical');
68
94
 
69
95
  const cognitiveSkill = read('install-cognitive-os/SKILL.md');
70
- check(/policy, not a required peer-skill selection/i.test(cognitiveSkill), 'Cognitive OS is defined as policy rather than peer-skill dependency');
71
- check(!/Tasks already governed by a more specific domain skill/i.test(cognitiveSkill), 'domain skill selection no longer disables Cognitive OS policy');
96
+ check(/policy, not a required peer-skill selection/i.test(cognitiveSkill), 'Cognitive OS remains reasoning policy rather than peer dependency');
72
97
 
73
98
  const hooks = JSON.parse(read('hooks/hooks.json'));
74
99
  const promptHooks = hooks.hooks && hooks.hooks.UserPromptSubmit;
75
100
  const command = promptHooks && promptHooks[0] && promptHooks[0].hooks && promptHooks[0].hooks[0] && promptHooks[0].hooks[0].command;
76
- check(command === 'node "${CLAUDE_PLUGIN_ROOT}/harness-everything/scripts/kernel-router.js"', 'UserPromptSubmit anchors the Harness kernel to the Claude plugin root');
101
+ check(command === 'node "${CLAUDE_PLUGIN_ROOT}/harness-everything/scripts/kernel-router.js"', 'UserPromptSubmit anchors kernel to Claude plugin root');
102
+ const preHooks = hooks.hooks && hooks.hooks.PreToolUse || [];
103
+ const workflowHook = preHooks.find(entry => entry.id === 'harness:pre:workflow-gate');
104
+ check(Boolean(workflowHook), 'Claude PreToolUse includes workflow gate');
105
+ check(workflowHook && /Bash/.test(workflowHook.matcher) && /PowerShell/.test(workflowHook.matcher) && /Edit/.test(workflowHook.matcher) && /Write/.test(workflowHook.matcher), 'Claude workflow gate covers shell and artifact mutation');
106
+ const stopHooks = hooks.hooks && hooks.hooks.Stop || [];
107
+ check(stopHooks.some(entry => entry.id === 'harness:stop:workflow-completion-gate'), 'Claude Stop includes Fable workflow completion gate');
108
+
109
+ const openaiHooks = JSON.parse(read('plugins/harness-everything/hooks/hooks.json'));
110
+ const openaiWorkflowHook = (openaiHooks.hooks && openaiHooks.hooks.PreToolUse || []).find(entry =>
111
+ (entry.hooks || []).some(hook => String(hook.command || '').includes('workflow-gate.js'))
112
+ );
113
+ check(openaiWorkflowHook && /Bash/.test(openaiWorkflowHook.matcher) && /apply_patch/.test(openaiWorkflowHook.matcher), 'Codex/OpenAI packaged workflow gate covers Bash and apply_patch');
77
114
 
78
115
  const triageDoc = read('harness-everything/references/triage-and-tiers.md');
79
- check(triageDoc.includes('Do not enforce workflow order. Enforce workflow invariants.'), 'architecture reference records the invariant-first decision');
80
- check(triageDoc.includes('A tier is **not** a fixed pipeline'), 'tier documentation rejects rigid orchestration');
81
- check(!triageDoc.includes('MUST load `todo-driven-workflow`'), 'documentation no longer mandates TODO as universal Tier 2/3 first step');
82
- check(triageDoc.includes('```mermaid'), 'updated architecture retains executable flowchart documentation');
83
- check(triageDoc.includes('the kernel always emits a compact checkpoint'), 'reference makes checkpoint emission mandatory');
84
- check(!triageDoc.includes('When a visible checkpoint is useful'), 'reference no longer makes checkpoint visibility optional');
85
- check(triageDoc.includes('if every suggestion is skipped, state one brief reason'), 'reference records the all-skipped rationale rule');
86
- check(triageDoc.includes('Kernel emission alone is not proof that a host UI displayed the checkpoint'), 'reference preserves the #82 host-evidence boundary');
116
+ check(/Mandatory applicable workflow/i.test(triageDoc), 'triage reference documents mandatory applicable workflow');
117
+ check(/topology becomes the run's execution contract/i.test(triageDoc), 'triage reference makes topology a contract');
118
+ check(/workflow-uncovered-scope/i.test(triageDoc), 'triage reference documents narrow escape policy');
119
+ check(/A tier is \*\*not\*\* a fixed TODO\/TDD\/Fable pipeline/i.test(triageDoc), 'triage reference rejects universal tier pipeline');
120
+ check(/```mermaid/.test(triageDoc), 'triage reference retains executable flowchart documentation');
121
+ check(/cross-host live-enforcement claim/i.test(triageDoc), 'triage reference preserves host evidence boundary');
122
+
123
+ const routingDoc = read('docs/routing.md');
124
+ check(/Mandatory applicable workflow/i.test(routingDoc), 'routing docs use mandatory workflow policy');
125
+ check(/workflow-gate\.js/.test(routingDoc), 'routing docs describe PreToolUse workflow gate');
126
+ check(/workflow-stop-gate\.js/.test(routingDoc), 'routing docs describe completion gate');
127
+ check(/workflow-disposition\.js/.test(routingDoc), 'routing docs describe explicit escape mechanism');
128
+ check(!/mandatory to evaluate and advisory to execute/i.test(routingDoc), 'routing docs remove old advisory execution contract');
129
+
130
+ const architectureDoc = read('docs/architecture.md');
131
+ check(/topology becomes a lifecycle contract/i.test(architectureDoc), 'architecture makes selected topology lifecycle contract');
132
+ check(/workflow-gate\.js/.test(architectureDoc), 'architecture includes workflow bypass gate');
133
+ check(!/Mandatory evaluation, advisory execution/i.test(architectureDoc), 'architecture removes old advisory execution policy');
134
+
135
+ const philosophyDoc = read('docs/philosophy.md');
136
+ check(/Constrain Lifecycle, Not Reasoning/i.test(philosophyDoc), 'philosophy separates lifecycle constraint from reasoning freedom');
137
+ check(/Applicable workflow is mandatory/i.test(philosophyDoc), 'philosophy states applicable workflow requirement');
138
+ check(!/Mandatory Evaluation, Advisory Execution/i.test(philosophyDoc), 'philosophy removes old advisory execution policy');
139
+
140
+ const meshDoc = read('docs/mechanism-first-skill-mesh.md');
141
+ check(/mandatory applicable workflow \+ local skill autonomy/i.test(meshDoc), 'skill mesh documents mandatory outer workflow and local skill autonomy');
142
+ check(/selected topology is mandatory for the run/i.test(meshDoc), 'skill mesh distinguishes selected topology from skill suggestions');
143
+
144
+ const capabilitiesDoc = read('docs/platform-capabilities.md');
145
+ check(capabilitiesDoc.includes('repository/agent contract'), 'platform docs distinguish contract from host enforcement evidence');
146
+ check(capabilitiesDoc.includes('does not upgrade `platform-compatibility.json` live-host status values'), 'routing change does not inflate compatibility status');
147
+
148
+ const advisory = read('scripts/lib/advisory-text.js');
149
+ check(/For EVERY suggested skill/i.test(advisory), 'generated advisory instructions require per-suggestion applicability evaluation');
150
+ check(/selected workflow topology is mandatory once applicable/i.test(advisory), 'advisory surfaces carry mandatory workflow semantics');
151
+ check(/No universal skill pipeline/i.test(advisory), 'advisory surfaces reject universal skill pipeline');
152
+ check(/workflow genuinely cannot cover part of the task/i.test(advisory), 'advisory surfaces constrain workflow escape');
153
+ check(read('plugins/harness-everything/scripts/lib/advisory-text.js') === advisory, 'OpenAI plugin advisory mirror matches canonical source');
154
+
155
+ const agents = read('AGENTS.md');
156
+ check(/Selected workflow is mandatory; reasoning inside it stays flexible/i.test(agents), 'repository agent contract matches mandatory workflow policy');
157
+ check(!/Router suggestions are mandatory to evaluate, advisory to execute/i.test(agents), 'repository agent contract removes old advisory execution rule');
87
158
 
88
159
  console.log(`\n${failed === 0 ? 'PASS' : 'FAIL'}: invariant routing contract (${failed} failure${failed === 1 ? '' : 's'})`);
89
160
  process.exit(failed === 0 ? 0 : 1);