harness-everything 0.18.1 → 0.19.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 (72) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/AGENTS.md +3 -2
  4. package/CHANGELOG.md +8 -0
  5. package/README.md +21 -14
  6. package/bin/cli.js +16 -0
  7. package/ci/invariant-routing.test.js +42 -19
  8. package/ci/mechanism-2af-worktree-isolation.test.js +3 -3
  9. package/ci/mechanism-2ag-router-worktree-contract.test.js +1 -0
  10. package/ci/mechanism-2an-workflow-obligations.test.js +1 -0
  11. package/ci/mechanism-2ao-plugin-sync.test.js +163 -0
  12. package/ci/mechanism-33-issues-205-207.test.js +2 -2
  13. package/ci/openai-plugin-package.test.js +6 -6
  14. package/ci/router-workflow-plan.test.js +12 -9
  15. package/ci/workflow-execution-contract.test.js +2 -2
  16. package/docs/architecture.md +15 -15
  17. package/docs/enforcement-locks.md +17 -15
  18. package/docs/philosophy.md +43 -8
  19. package/docs/platform-capabilities.md +22 -2
  20. package/docs/platform-compatibility.json +4 -4
  21. package/docs/routing.md +23 -16
  22. package/docs/troubleshooting.md +8 -0
  23. package/docs/workflow-runtime.md +20 -19
  24. package/environment-detection/SKILL.md +3 -1
  25. package/evals/harness-everything/tasks/positive-tier1.yaml +1 -1
  26. package/evals/harness-everything/tasks/positive-tier2.yaml +1 -1
  27. package/evals/harness-everything/tasks/positive-tier3.yaml +1 -1
  28. package/evals/using-git-worktrees/tasks/positive-trigger.yaml +1 -1
  29. package/find-skills/SKILL.md +20 -29
  30. package/git-commit/SKILL.md +4 -4
  31. package/harness-everything/SKILL.md +16 -17
  32. package/harness-everything/references/triage-and-tiers.md +17 -16
  33. package/harness-everything/scripts/kernel-router-core.js +26 -24
  34. package/harness-everything/scripts/kernel-router.js +8 -8
  35. package/harness-everything/scripts/router-contract-core.js +7 -7
  36. package/harness-everything/scripts/router-contract.js +1 -1
  37. package/hooks/scripts/atomic-commit-check.js +1 -1
  38. package/hooks/scripts/boundary-guard.js +2 -2
  39. package/hooks/scripts/depth-guard.js +5 -6
  40. package/hooks/scripts/subagent-scope-guard.js +2 -2
  41. package/hooks/scripts/workflow-gate.js +1 -1
  42. package/install-cognitive-os/SKILL.md +3 -3
  43. package/opencode-plugin/plugin.json +1 -1
  44. package/package.json +4 -2
  45. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  46. package/plugins/harness-everything/hooks/scripts/atomic-commit-check.js +1 -1
  47. package/plugins/harness-everything/hooks/scripts/boundary-guard.js +2 -2
  48. package/plugins/harness-everything/hooks/scripts/depth-guard.js +5 -6
  49. package/plugins/harness-everything/hooks/scripts/subagent-scope-guard.js +2 -2
  50. package/plugins/harness-everything/hooks/scripts/workflow-gate.js +1 -1
  51. package/plugins/harness-everything/plugin.json +1 -1
  52. package/plugins/harness-everything/scripts/lib/advisory-text.js +19 -17
  53. package/plugins/harness-everything/skills/environment-detection/SKILL.md +3 -1
  54. package/plugins/harness-everything/skills/find-skills/SKILL.md +20 -29
  55. package/plugins/harness-everything/skills/git-commit/SKILL.md +4 -4
  56. package/plugins/harness-everything/skills/harness-everything/SKILL.md +16 -17
  57. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +17 -16
  58. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +26 -24
  59. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +8 -8
  60. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +7 -7
  61. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract.js +1 -1
  62. package/plugins/harness-everything/skills/install-cognitive-os/SKILL.md +3 -3
  63. package/plugins/harness-everything/skills/rewrite-commits/SKILL.md +2 -2
  64. package/plugins/harness-everything/skills/to-tickets/SKILL.md +2 -2
  65. package/plugins/harness-everything/skills/using-git-worktrees/SKILL.md +6 -6
  66. package/rewrite-commits/SKILL.md +2 -2
  67. package/scripts/lib/advisory-text.js +19 -17
  68. package/scripts/plugin-sync.js +465 -0
  69. package/scripts/plugin-sync.ps1 +5 -0
  70. package/scripts/plugin-sync.sh +5 -0
  71. package/to-tickets/SKILL.md +2 -2
  72. package/using-git-worktrees/SKILL.md +6 -6
@@ -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.18.1",
13
+ "version": "0.19.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.18.1",
4
+ "version": "0.19.1",
5
5
  "author": {
6
6
  "name": "Miya Daniel"
7
7
  },
package/AGENTS.md CHANGED
@@ -40,9 +40,10 @@ The retained [OpenCode evidence](benchmarks/results/live-host/opencode-2026-09-1
40
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
41
  8. **CHANGELOG.md keeps pending human-authored notes under `[Unreleased]`.** Semantic-release owns stable headings/tags/release notes.
42
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 planning guidance; reasoning and execution stay flexible.** Before omitting a suggested skill, read/evaluate its complete `SKILL.md` flow. Do not turn routing into a universal TODO/TDD/Fable sequence. Missing workflow evidence should produce a reminder, not a persistent Harness lock.
43
+ 10. **Selected workflow is a semantic contract; tactics remain flexible.** Suggested skills MUST be read/evaluated before omission; applicable skill core contracts MUST be followed, while not-applicable requires a flow-grounded reason. Selected-topology required obligations MUST resolve. Missing host evidence may produce reminders, not a persistent Harness lock.
44
44
  11. **User-visible Harness Status is mandatory for non-trivial work.** Render one readable Markdown block headed `### 🚦 Harness Status`, with bullet-aligned bold `Current`, `Read / Evidence`, `Next`, plus optional `Risk / Blocked`; use nested evidence bullets when useful. Emit it before substantive execution, after major phases, on direction changes, during long work at meaningful boundaries, and before final completion. The routing checkpoint is internal source state, not a second user-facing block. This semantic MUST does not create a hard lock.
45
- 12. **Prefer Git worktree isolation for major mutation.** Read-only discovery may stay in the bound repository. Tier 3 / Fable source and artifact changes should use a verified linked worktree when practical; failure to create one is a prominent risk reminder, not a Harness-owned deadlock. See [workflow-runtime.md](docs/workflow-runtime.md).
45
+ 12. **Tier-3/Fable isolation disposition is mandatory before broad mutation.** Use/reuse a verified linked Git worktree, or record an explicit degraded fallback when isolation is unavailable or the user explicitly chooses to stay in place. Ordinary isolation SHOULD be used when it materially reduces collision/risk. Failure to isolate is a visible semantic gap, not a Harness-owned deadlock. See [workflow-runtime.md](docs/workflow-runtime.md).
46
+ 13. **Use contract strength deliberately.** MUST = required semantic obligation; SHOULD = expected default with an evidence-based exception; MAY = optional optimization. Do not use recommend/prefer/advisory/guidance to weaken a MUST. See [philosophy.md](docs/philosophy.md#contract-strength-must--should--may).
46
47
 
47
48
  ## Verification Before You Claim Done
48
49
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.19.1](https://github.com/dyphn1/Harness-everything/compare/v0.19.0...v0.19.1) (2026-09-21)
6
+
7
+ ## [0.19.0](https://github.com/dyphn1/Harness-everything/compare/v0.18.1...v0.19.0) (2026-09-21)
8
+
9
+ ### Features
10
+
11
+ * **distribution:** add cross-platform plugin install/update command ([0566bf3](https://github.com/dyphn1/Harness-everything/commit/0566bf347feab785af829e0f257fa22899f5c259))
12
+
5
13
  ## [0.18.1](https://github.com/dyphn1/Harness-everything/compare/v0.18.0...v0.18.1) (2026-09-21)
6
14
 
7
15
  ### Bug Fixes
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 establishes routing context, observes verification evidence, and emits lightweight reminders. It does not hard-stop work on iteration/revision/replan/worker counts. The one cognitive hard boundary is Rule of 3: three matching failures pause mutation for a zoom-out reflection. 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.
22
+ Harness deliberately follows a **minimal rails, maximum freedom** design: semantic obligations are explicit, while runtime observation remains lightweight and mostly fail-open. It does not hard-stop work on iteration/revision/replan/worker counts. The one cognitive hard boundary is Rule of 3: three matching failures pause mutation for a zoom-out reflection. Router suggestions are conditional by applicability, not optional by default: the agent MUST read/evaluate each suggested skill; if applicable, its core contract MUST be followed, and if not applicable a flow-grounded reason MUST be retained. Implementation tactics remain flexible inside those obligations.
23
23
 
24
24
  ### Comparison: Prompt vs. Skill vs. Harness
25
25
 
@@ -48,7 +48,7 @@ The exact "Harness" behavior depends on the installation surface. Claude Code ha
48
48
 
49
49
  Harness integrates directly into your workspace. There is no heavy daemon, no paid external APIs, and zero configuration required.
50
50
 
51
- **Runtime:** Harness supports **Node.js 22+**. Node.js **24** is the primary/recommended development and CI runtime (`.nvmrc`). The generated current-state runtime/workflow summary is [docs/repository-contract.md](docs/repository-contract.md).
51
+ **Runtime:** Harness supports **Node.js 22+**. Node.js **24** is the primary development and CI runtime (`.nvmrc`). The generated current-state runtime/workflow summary is [docs/repository-contract.md](docs/repository-contract.md).
52
52
 
53
53
  ```bash
54
54
  # Option A: Claude Code plugin (marketplace manifest included)
@@ -58,6 +58,11 @@ Harness integrates directly into your workspace. There is no heavy daemon, no pa
58
58
  # Option B: install Harness hooks/skills/advisory integrations into your workspace
59
59
  npx github:dyphn1/Harness-everything install
60
60
 
61
+ # Option C: install or update the native Claude Code/Codex plugin
62
+ # npx github:dyphn1/Harness-everything plugin-sync
63
+ # ./scripts/plugin-sync.sh # POSIX shells / Git Bash
64
+ # powershell -File scripts/plugin-sync.ps1 # Windows PowerShell
65
+
61
66
  # OpenAI/Codex local plugin packaging is repository-owned under:
62
67
  # .agents/plugins/marketplace.json
63
68
  # plugins/harness-everything/.codex-plugin/plugin.json
@@ -68,7 +73,7 @@ npx github:dyphn1/Harness-everything install
68
73
  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
74
  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
75
  3. **Verification boundary:** Completion claims require objective evidence; whether that boundary is mechanically invoked or explicitly called depends on the host surface.
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.
76
+ 4. **Mandatory applicable workflow:** MUST evaluate each suggested skill's complete `SKILL.md`; applicable core contracts MUST be followed, while not-applicable needs a flow-grounded reason. Selected-topology required obligations MUST resolve with objective evidence. Reasoning and implementation remain flexible; escape applies only to declared uncovered scope with evidence. Tier-3/Fable broad mutation MUST resolve isolation: verified linked worktree or explicit degraded fallback. See the [workflow runtime contract](docs/workflow-runtime.md). Harness does not impose one universal TODO/TDD/Fable sequence.
72
77
  5. **Unified user-visible status:** For non-trivial software/project work, the agent MUST render one scannable Markdown `### 🚦 Harness Status` block with bold bullet labels for `Current`, `Read / Evidence`, `Next`, plus optional `Risk / Blocked`; multiple evidence items may use nested bullets. Use it at major phase/direction boundaries and before final completion. The routing checkpoint remains internal source state. This is a communication contract, not a hard runtime lock.
73
78
 
74
79
  ### What Gets Installed (and How to Remove It)
@@ -90,6 +95,8 @@ For `--global`, the installer uses each host's supported user-level skill locati
90
95
 
91
96
  The repository also ships a separate local OpenAI/Codex plugin package under `plugins/harness-everything/` with marketplace metadata in `.agents/plugins/marketplace.json`. That package is not the same thing as the `--codex` advisory installer path. The public OpenAI Skills-only upload is narrower again; see [docs/openai-plugin.md](docs/openai-plugin.md).
92
97
 
98
+ The native `plugin-sync` command detects the installed host CLIs and applies the state-specific operation: an absent plugin is installed, while an already-installed plugin is explicitly updated (Claude Code) or its configured marketplace is upgraded (Codex). If a host cannot report plugin state, the command fails closed without installing or updating blindly.
99
+
93
100
  The installer records its state directories in `.git/info/exclude` — a local-only git ignore file — so Harness state never lands in a commit and your working tree (including `.gitignore`) is never modified. Everything owned by the general installer is removed with the built-in uninstaller:
94
101
 
95
102
  ```bash
@@ -120,7 +127,7 @@ flowchart TD
120
127
  ```mermaid
121
128
  flowchart TD
122
129
  U([User Request]) --> K[Harness Kernel<br/>classify scope + establish invariants]
123
- K --> T{Tier recommendation}
130
+ K --> T{Tier classification}
124
131
  T --> S{Suggested skills?}
125
132
  S -->|Yes| R[Read each suggested SKILL.md<br/>evaluate flow + applicability]
126
133
  S -->|No| A[Agent chooses smallest useful tactic / skill set]
@@ -140,7 +147,7 @@ flowchart TD
140
147
  style Gate fill:#ffcdd2,stroke:#c62828,stroke-width:1px,color:#000000
141
148
  ```
142
149
 
143
- 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.
150
+ The Tier changes task shape and the set of **suggested skills**, not a universal required order. Tier 2 may suggest `tdd`, `todo-driven-workflow`, or `verification-loop`; Tier 3 may select Fable or multi-agent topologies. Every suggestion is **MUST-evaluate**: if its real flow is applicable, the core contract becomes **MUST-follow**; otherwise retain a flow-grounded not-applicable reason. Tactics inside the resulting contract remain model-controlled.
144
151
 
145
152
  ---
146
153
 
@@ -148,7 +155,7 @@ The Tier changes the **recommendations**, not the required order. Tier 2 may sug
148
155
 
149
156
  Harness operates through six core cognitive concepts:
150
157
 
151
- 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.
158
+ 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, injects baseline MUST invariants, and adds `evaluate-suggestions-before-skip` whenever domain skills are suggested. Suggestions MUST be evaluated from their real `SKILL.md` flow; an applicable skill's core contract MUST be followed, while not-applicable needs evidence. Selected-topology obligations are also semantic MUSTs, but the runtime generally observes/reminds rather than hard-blocking. This preserves agent autonomy over tactics without allowing confidence to erase the lifecycle. 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.
152
159
  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` hook (`stop-gate.js`) emits a non-blocking reminder when edits were never followed by successful verification on hosts where that hook is installed.
153
160
  3. **Memory (`state-persist.js`):** Session transaction logging for stateful hook/plugin integrations. Static skills/instructions alone do not create WAL state.
154
161
  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.
@@ -165,10 +172,10 @@ The authoritative current matrix is [docs/platform-capabilities.md](docs/platfor
165
172
 
166
173
  | AI Agent Tool / Surface | Integration Method | Local Target Location | Enforcement claim |
167
174
  |---|---|---|---|
168
- | **Claude Code** | Native lifecycle hooks (`PreToolUse`, `PostToolUse`, `SessionStart`, `UserPromptSubmit`, `Stop`) | `.claude/settings.json`, `.claude/skills/`, `.claude/agents/` | Workflow/productivity guidance is reminder-oriented; Rule-of-3 reflection and explicit permission boundaries may block |
175
+ | **Claude Code** | Native lifecycle hooks (`PreToolUse`, `PostToolUse`, `SessionStart`, `UserPromptSubmit`, `Stop`) | `.claude/settings.json`, `.claude/skills/`, `.claude/agents/` | Semantic workflow contracts are reminder-observed; Rule-of-3 reflection and explicit permission boundaries may block |
169
176
  | **OpenCode** | Native plugin module ([`opencode-plugin/index.mjs`](opencode-plugin/index.mjs), install as `harness-enforcement.js`) | `.opencode/plugins/` | **Partial live-host evidence** — project-scope `.js` loading and edit/verification state on OpenCode 1.18.31 (macOS); current workflow/verification behavior is reminder-oriented, with only the third-failure reflection boundary blocking edits |
170
- | **Codex — general installer path** | Skills + `AGENTS.md` guidance | `AGENTS.md` + repo-scoped `.agents/skills/` | **Advisory/instruction-oriented** where the host only consumes instructions |
171
- | **Codex / local OpenAI plugin** | `.codex-plugin` package with session, prompt, supported-tool, subagent, and stop hooks plus 26 canonical skills | `.agents/plugins/marketplace.json` → `plugins/harness-everything/` | **Mechanism-tested local guidance plus explicit permission/Rule-of-3 boundaries** for the packaged mappings; live host loading remains unverified |
177
+ | **Codex — general installer path** | Skills + `AGENTS.md` instructions | `AGENTS.md` + repo-scoped `.agents/skills/` | **Instruction/advisory delivery only**; semantic MUST/SHOULD/MAY still applies, without a hard-enforcement claim |
178
+ | **Codex / local OpenAI plugin** | `.codex-plugin` package with session, prompt, supported-tool, subagent, and stop hooks plus 26 canonical skills | `.agents/plugins/marketplace.json` → `plugins/harness-everything/` | **Mechanism-tested local contract observation plus explicit permission/Rule-of-3 boundaries** for the packaged mappings; live host loading remains unverified |
172
179
  | **Public OpenAI Skills-only plugin** | Public Skills-only bundle | Generated submission ZIP from `plugins/harness-everything/skills/` | **Skill/workflow behavior only**; no local `.codex-plugin` lifecycle hooks in the public artifact |
173
180
  | **Cursor** | Native Project Rules + project skills | `.cursorrules` + `.cursor/skills/` | Advisory only |
174
181
  | **GitHub Copilot agent surfaces** | Agent Skills + repository custom instructions | `.github/copilot-instructions.md` + `.github/skills/` | Agent Skills path is documented; no live Harness session or plugin install is verified |
@@ -239,9 +246,9 @@ This repo uses a flat layout (waza/agentskills.io convention). The table below m
239
246
  | `skill-creator` | **Meta** | Create new skills from patterns |
240
247
  | `skill-style` | **Meta** | Skill authoring style guide |
241
248
  | `tdd` | **Skill (Tier 2)** | Test-driven development when executable behavior benefits from it |
242
- | `to-spec` | **Advisory (Tier 2/3)** | Publish specs from settled conversations |
243
- | `to-tickets` | **Advisory (Tier 2/3)** | Decompose settled specs into tracked tickets |
244
- | `todo-driven-workflow` | **Advisory Foundation** | Progress tracking when explicit multi-step state helps |
249
+ | `to-spec` | **Optional (MAY, Tier 2/3)** | Publish specs from settled conversations |
250
+ | `to-tickets` | **Optional (MAY, Tier 2/3)** | Decompose settled specs into tracked tickets |
251
+ | `todo-driven-workflow` | **Optional Foundation (MAY)** | Progress tracking when explicit multi-step state helps |
245
252
  | `using-git-worktrees` | **Skill (Tier 2)** | Git worktree concurrency patterns |
246
253
  | `verification-loop` | **Skill (Tier 2)** | Select systematic verification evidence; kernel still requires evidence before completion |
247
254
  | `verify-before-claim` | **Always-on discipline** | Fact-audit before asserting claims |
@@ -256,7 +263,7 @@ For a deep dive into individual modules and the underlying philosophy, explore o
256
263
 
257
264
  * [Harness Philosophy](docs/philosophy.md): The core behavior-first, intervention-only design.
258
265
  * [Harness Architecture](docs/architecture.md): Lifecycle hooks, security model, and data locality.
259
- * [Guidance and Safety Boundary Diagnostic Flows](docs/enforcement-locks.md): Distinguish reminders from the two intentional blocking boundaries and understand recovery.
266
+ * [Semantic Contracts and Safety Boundary Diagnostic Flows](docs/enforcement-locks.md): Distinguish MUST/SHOULD/MAY obligations from reminder mechanics and the two intentional blocking boundaries.
260
267
  * [Platform Capability Matrix](docs/platform-capabilities.md): Canonical current enforcement/install/evidence boundary per surface.
261
268
  * [Repository Runtime & Workflow Contract](docs/repository-contract.md): Generated Node/action/workflow/gate state used by consistency CI.
262
269
  * [OpenAI / ChatGPT Plugin Packaging](docs/openai-plugin.md): Local Codex/OpenAI plugin packaging plus public Skills-only submission boundary.
@@ -266,7 +273,7 @@ For a deep dive into individual modules and the underlying philosophy, explore o
266
273
 
267
274
  Fable model selection is documented in [fable-mode/references/model-matrix.md](fable-mode/references/model-matrix.md); the explicit entrypoints are `fable-haiku`, `fable-sonnet`, and `fable-opus`.
268
275
 
269
- Maintainers should follow [RELEASING.md](RELEASING.md) for tag-driven npm releases and record observations in [docs/release-evidence.md](docs/release-evidence.md). Issue #20 is closed (2026-09-10); its coordination history lives in git.
276
+ Maintainers **MUST** follow [RELEASING.md](RELEASING.md) for tag-driven npm releases and record observations in [docs/release-evidence.md](docs/release-evidence.md). Issue #20 is closed (2026-09-10); its coordination history lives in git.
270
277
 
271
278
  ---
272
279
 
package/bin/cli.js CHANGED
@@ -40,6 +40,9 @@ switch (command) {
40
40
  case 'codex-hooks':
41
41
  runCodexHooksCompat(args.slice(1));
42
42
  break;
43
+ case 'plugin-sync':
44
+ runPluginSync(args.slice(1));
45
+ break;
43
46
  default:
44
47
  console.error(`[Error] Unknown command: "${command}"`);
45
48
  showHelp();
@@ -104,6 +107,9 @@ Commands:
104
107
  that fail to mount enabled plugin-bundled hooks.
105
108
  Usage: harness codex-hooks <install|status|uninstall>
106
109
  Does not trust hooks or modify Codex config.toml.
110
+ plugin-sync Install or update the native Harness plugin on Claude Code
111
+ and Codex. Existing installations always take the update
112
+ path. Supports --host, --dry-run, and --json.
107
113
  verify Run the pre-delivery verification gate (lint/test from the
108
114
  nearest package.json). Exits non-zero if checks fail. This is
109
115
  the explicit stand-in for a hard stop gate on platforms where
@@ -179,3 +185,13 @@ function runCodexHooksCompat(compatArgs) {
179
185
  const result = spawnSync('node', [script, ...compatArgs], { stdio: 'inherit' });
180
186
  process.exit(result.status === null ? 1 : result.status);
181
187
  }
188
+
189
+ function runPluginSync(pluginArgs) {
190
+ const script = path.resolve(__dirname, '..', 'scripts', 'plugin-sync.js');
191
+ if (!fs.existsSync(script)) {
192
+ console.error('[Error] Native plugin synchronization script not found.');
193
+ process.exit(1);
194
+ }
195
+ const result = spawnSync('node', [script, ...pluginArgs], { stdio: 'inherit' });
196
+ process.exit(result.status === null ? 1 : result.status);
197
+ }
@@ -4,18 +4,18 @@ const fs=require('fs'),path=require('path'),{spawnSync}=require('child_process')
4
4
  const ROOT=path.resolve(__dirname,'..');let failed=0;
5
5
  function check(c,m){if(c)console.log(' PASS '+m);else{console.error(' FAIL '+m);failed++;}}
6
6
  function read(p){return fs.readFileSync(path.join(ROOT,p),'utf8');}
7
- console.log('=== Guidance-First Routing Contract ===');
7
+ console.log('=== Semantic Contract-Strength Routing Contract ===');
8
8
  const kernel=path.join(ROOT,'harness-everything/scripts/kernel-router.js');
9
9
  const tier2=spawnSync(process.execPath,[kernel,'add a login endpoint with tests and update the implementation'],{cwd:ROOT,encoding:'utf8'});
10
10
  check(tier2.status===0,'kernel router exits successfully');
11
11
  check(/RECOMMENDED TIER:\s*Tier 2/i.test(tier2.stdout),'classifier result is preserved');
12
- check(tier2.stdout.includes('"strategy":"iterative-single"'),'Tier 2 selects iterative-single guidance');
12
+ check(tier2.stdout.includes('"strategy":"iterative-single"'),'Tier 2 selects iterative-single workflow');
13
13
  check(tier2.stdout.includes('loop-awareness:'),'iterative work exposes loop-awareness instead of a hard budget');
14
- check(tier2.stdout.includes('SELECTED WORKFLOW IS GUIDANCE'),'suggested workflow is explicitly guidance');
15
- check(tier2.stdout.includes('ORCHESTRATION POLICY: Selected topology is planning guidance'),'orchestration policy is guidance-first');
16
- check(tier2.stdout.includes('WORKFLOW GUIDANCE (ADVISORY WHEN SELECTED)'),'kernel emits advisory workflow guidance');
17
- check(tier2.stdout.includes('missing isolation is a strong reminder, not a Harness lock'),'worktree guidance is non-blocking');
18
- check(!tier2.stdout.includes('WORKFLOW EXECUTION CONTRACT (MANDATORY'),'old mandatory execution contract is absent');
14
+ check(tier2.stdout.includes('WORKFLOW SKILLS (APPLICABILITY MUST BE RESOLVED)'),'skill applicability is explicitly mandatory');
15
+ check(tier2.stdout.includes('ORCHESTRATION POLICY: Selected-topology required obligations and applicable skill core contracts are semantic MUSTs'),'orchestration policy preserves semantic MUST obligations');
16
+ check(tier2.stdout.includes('WORKFLOW SEMANTIC CONTRACT (NON-BLOCKING OBSERVATION)'),'kernel separates semantic contract from non-blocking observation');
17
+ check(tier2.stdout.includes('Tier 3 / Fable broad mutation MUST resolve isolation'),'worktree isolation disposition is a semantic MUST');
18
+ check(!tier2.stdout.includes('SELECTED WORKFLOW IS GUIDANCE'),'old planning-guidance label is absent');
19
19
  check(!tier2.stdout.includes('unavailable isolation means BLOCKED'),'old worktree hard-block wording is absent');
20
20
  check(tier2.stdout.includes('evaluate-suggestions-before-skip'),'skill suggestions still require evaluation before omission');
21
21
  check(tier2.stdout.includes('visible-status-updates'),'workflow plan carries mandatory user-visible status invariant');
@@ -31,46 +31,69 @@ check(tier2.stdout.includes('semantic communication MUST, not a hard execution l
31
31
  const tier3=spawnSync(process.execPath,[kernel,'audit the entire repository architecture and coordinate multiple modules'],{cwd:ROOT,encoding:'utf8'});
32
32
  check(tier3.status===0,'Tier 3 routing exits successfully');
33
33
  check(/RECOMMENDED TIER:\s*Tier 3/i.test(tier3.stdout),'macro task remains Tier 3');
34
- check(tier3.stdout.includes('using-git-worktrees'),'Tier 3 still recommends worktree guidance');
35
- check(tier3.stdout.includes('WORKFLOW GUIDANCE (ADVISORY WHEN SELECTED)'),'Tier 3 workflow remains advisory');
34
+ check(tier3.stdout.includes('using-git-worktrees'),'Tier 3 still routes the worktree skill');
35
+ check(tier3.stdout.includes('Tier 3 / Fable broad mutation MUST resolve isolation'),'Tier 3 requires an isolation disposition without a hard lock');
36
36
 
37
37
  const hs=read('harness-everything/SKILL.md');
38
- check(/workflow state and numeric limits guide; they do not hard-stop execution/i.test(hs),'Harness skill states non-blocking workflow contract');
38
+ check(/required obligations are MUST; tactics MAY adapt/i.test(hs),'Harness skill separates required obligations from adaptable tactics');
39
39
  check(/only Rule-of-3 reflection and explicit user\/host permission boundaries may block/i.test(hs),'Harness skill names the only intentional blocking boundaries');
40
- check(/Surface status.*MUST render.*Harness Status/i.test(hs)&&/bold bullets/i.test(hs)&&/Read \/ Evidence/i.test(hs),'Harness skill requires the readable unified user-visible status');
40
+ check(/Surface status \(MUST\).*Harness Status/i.test(hs)&&/Read \/ Evidence/i.test(hs),'Harness skill requires the readable unified user-visible status');
41
41
  check(read('plugins/harness-everything/skills/harness-everything/SKILL.md')===hs,'Harness skill mirror matches');
42
42
 
43
43
  const wt=read('using-git-worktrees/SKILL.md');
44
- check(/safer in a linked worktree/i.test(wt),'worktree skill strongly recommends isolation');
44
+ check(/Tier 3 \/ Fable \(MUST resolve\)/i.test(wt)&&/explicit degraded fallback/i.test(wt),'worktree skill requires isolation disposition but permits degraded fallback');
45
45
  check(!/Creation\/entry failure => `BLOCKED`/i.test(wt),'worktree creation failure is not a cognitive blocked state');
46
46
  check(read('plugins/harness-everything/skills/using-git-worktrees/SKILL.md')===wt,'worktree skill mirror matches');
47
47
 
48
48
  const triage=read('harness-everything/references/triage-and-tiers.md');
49
- check(/Guidance-first workflow/i.test(triage),'triage reference uses guidance-first policy');
49
+ check(/Contract-first lifecycle/i.test(triage),'triage reference uses contract-first policy');
50
50
  check(/User-visible status contract/i.test(triage)&&/Harness Status/i.test(triage)&&/MUST/i.test(triage),'triage defines the mandatory unified status contract');
51
51
  check(read('plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md')===triage,'triage mirror matches');
52
52
 
53
- for(const p of ['docs/routing.md','docs/architecture.md','docs/philosophy.md','docs/mechanism-first-skill-mesh.md']){
54
- const t=read(p); check(/guidance/i.test(t),'current doc '+p+' describes guidance');
53
+ for(const p of ['docs/routing.md','docs/architecture.md','docs/philosophy.md']){
54
+ const t=read(p); check(/MUST/i.test(t)&&/MAY/i.test(t),'current doc '+p+' preserves explicit semantic strength');
55
55
  }
56
56
  for(const p of ['docs/routing.md','docs/architecture.md','docs/workflow-runtime.md']){
57
57
  const t=read(p); check(/Harness Status/i.test(t)&&/MUST/i.test(t),'current doc '+p+' defines mandatory user-visible status');
58
58
  }
59
+ const philosophy=read('docs/philosophy.md');
60
+ check(/Contract Strength: MUST \/ SHOULD \/ MAY/i.test(philosophy),'philosophy defines canonical MUST/SHOULD/MAY strength');
61
+ for(const phrase of [
62
+ 'Route before software/project execution',
63
+ 'Read/evaluate every suggested skill before omission',
64
+ 'Resolve selected-topology invariants/stages/checks/synthesis/verification',
65
+ 'Discover relevant environment/host facts',
66
+ 'Resolve Tier-3/Fable isolation before broad mutation',
67
+ 'Numeric iteration/revision/replan/worker values',
68
+ 'Durable memory writes'
69
+ ]){
70
+ check(philosophy.includes(phrase),'contract-strength audit classifies '+phrase);
71
+ }
72
+ check(!/Applicable workflow is guidance:/i.test(philosophy),'old ambiguous philosophy wording is removed');
73
+
59
74
  const advisory=read('scripts/lib/advisory-text.js');
60
- check(/selected workflow topology.*planning guidance/i.test(advisory),'installer advisory text keeps workflow non-blocking');
75
+ check(/Selected-topology required obligations are MUSTs/i.test(advisory)&&/numeric.*MAY guide planning/i.test(advisory),'instruction-only installer preserves MUST/MAY semantics');
61
76
  check(/USER-VISIBLE STATUS \(MUST\)/i.test(advisory)&&/### 🚦 Harness Status/i.test(advisory)&&/\*\*Read \/ Evidence:\*\*/i.test(advisory),'instruction-only installers carry the readable mandatory status contract');
62
77
  check(/Rule of 3/i.test(advisory)&&/Permission boundaries are separate/i.test(advisory),'installer text preserves Rule-of-3 and permission boundaries');
63
78
  check(read('plugins/harness-everything/scripts/lib/advisory-text.js')===advisory,'OpenAI advisory mirror matches');
64
79
 
65
80
  const agents=read('AGENTS.md');
66
- check(/Selected workflow is planning guidance/i.test(agents),'repository agent contract is guidance-first');
81
+ check(/Selected workflow is a semantic contract/i.test(agents),'repository agent contract is contract-first');
67
82
  check(/User-visible Harness Status is mandatory/i.test(agents)&&/### 🚦 Harness Status/i.test(agents)&&/nested evidence bullets/i.test(agents),'repository agent contract requires readable unified user-visible status');
68
- check(/Prefer Git worktree isolation/i.test(agents),'repository worktree rule is a recommendation');
83
+ check(/Tier-3\/Fable isolation disposition is mandatory/i.test(agents)&&/degraded fallback/i.test(agents),'repository worktree rule requires disposition without hard lock');
84
+
85
+ const envSkill=read('environment-detection/SKILL.md');
86
+ check(/semantic \*\*MUST\*\*/i.test(envSkill)&&/environment-sensitive/i.test(envSkill),'environment discovery is a conditional semantic MUST');
87
+ check(read('plugins/harness-everything/skills/environment-detection/SKILL.md')===envSkill,'environment skill mirror matches');
88
+
89
+ const commitSkill=read('git-commit/SKILL.md');
90
+ check(/MUST.*git diff --cached/i.test(commitSkill)&&/SHOULD.*split/i.test(commitSkill),'commit skill separates staged-diff MUST from split SHOULD');
91
+ check(read('plugins/harness-everything/skills/git-commit/SKILL.md')===commitSkill,'git-commit skill mirror matches');
69
92
 
70
93
  const hooks=JSON.parse(read('hooks/hooks.json'));
71
94
  check((hooks.hooks.PreToolUse||[]).some(e=>e.id==='harness:pre:workflow-gate'),'Claude packages workflow reminder hook');
72
95
  check((hooks.hooks.PreToolUse||[]).some(e=>e.id==='harness:pre:rule-of-3'),'Claude preserves Rule-of-3 boundary');
73
96
  check((hooks.hooks.PreToolUse||[]).some(e=>e.id==='harness:pre:action-gate'),'Claude preserves action permission gate');
74
97
 
75
- console.log('\n'+(failed===0?'PASS':'FAIL')+': guidance-first routing contract ('+failed+' failures)');
98
+ console.log('\n'+(failed===0?'PASS':'FAIL')+': semantic contract-strength routing contract ('+failed+' failures)');
76
99
  process.exit(failed===0?0:1);
@@ -16,10 +16,10 @@ try{
16
16
  fs.writeFileSync(path.join(dir,'workflow-run.json'),JSON.stringify({schemaVersion:1,sessionId:'worktree-guidance',tier:'tier3',strategy:'iterative-single',state:'active'}));
17
17
  const primary=runGate('Write',repo,{file_path:path.join(repo,'src.js'),content:'x'});
18
18
  check(primary.status===0,'Tier-3 primary-tree mutation is not hard-blocked',primary.stderr);
19
- check(/worktree/i.test(primary.stderr),'Tier-3 primary-tree mutation emits worktree guidance',primary.stderr);
19
+ check(/semantic MUST/i.test(primary.stderr)&&/worktree/i.test(primary.stderr),'Tier-3 primary-tree mutation emits mandatory isolation disposition without blocking',primary.stderr);
20
20
  const mutator=runGate('Bash',repo,{command:'git status --short && rm -rf src'});
21
21
  check(mutator.status===0,'mutation-shaped shell command remains available',mutator.stderr);
22
- check(/worktree/i.test(mutator.stderr),'mutation-shaped shell command receives worktree guidance',mutator.stderr);
22
+ check(/semantic MUST/i.test(mutator.stderr)&&/worktree/i.test(mutator.stderr),'mutation-shaped shell command receives the same isolation contract',mutator.stderr);
23
23
  const readOnly=runGate('Bash',repo,{command:'git status --short'});
24
24
  check(readOnly.status===0,'read-only discovery remains available');
25
25
  const create=git(repo,['worktree','add',linked,'-b','guidance-test']);check(create.status===0,'linked worktree fixture creates',create.stderr);
@@ -37,4 +37,4 @@ try{
37
37
  check(corrupt.status===0,'corrupt workflow state fails open',corrupt.stderr);
38
38
  }finally{fs.rmSync(temp,{recursive:true,force:true});}
39
39
  if(failed)process.exit(1);
40
- console.log('PASS: worktree isolation is guidance, not a cognitive lock');
40
+ console.log('PASS: worktree isolation is a semantic MUST disposition, not a cognitive lock');
@@ -18,6 +18,7 @@ assert.strictEqual(tier3.strategy, 'fable-staged');
18
18
  assert.ok(tier3.requiredInvariants.includes('isolated-worktree-before-mutation'), 'Tier 3 plan must carry mutation isolation invariant');
19
19
  assert.ok(tier3.suggestedSkills.includes('using-git-worktrees'), 'Tier 3 plan must surface the worktree workflow');
20
20
  assert.strictEqual(tier3.workspace.required, false, 'Git worktree isolation must remain distinct from durable multi-agent workspace state');
21
+ assert.strictEqual(tier3.mutationIsolation.onUnavailable, 'degraded', 'unavailable isolation records an explicit degraded fallback instead of a cognitive hard block');
21
22
 
22
23
  const tier2 = router.buildRouterContract({
23
24
  routingStatus: 'ok',
@@ -47,6 +47,7 @@ let workflow = readJson(workflowFile);
47
47
  let obligations = readJson(obligationFile);
48
48
  check(workflow.tier === 'tier2' && workflow.strategy === 'iterative-single', 'Tier 2 receives a preliminary iterative-single route');
49
49
  check(workflow.state === 'pending', 'selected Tier 2 workflow begins pending');
50
+ check(workflow.guidance?.mode === 'semantic-contract', 'persisted workflow records semantic-contract mode rather than advisory-workflow');
50
51
  check(obligations.phase === 'planning', 'Tier 2 immediately materializes a planning contract');
51
52
  check(obligations.obligations.map(item => item.id).join(',') === 'decompose,compose', 'planning starts with decompose then compose');
52
53
  check(obligations.requirements.length === 0, 'requirements begin empty instead of being invented by the router');
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const {
7
+ findMarketplace,
8
+ findPlugin,
9
+ parseJsonOutput,
10
+ sync
11
+ } = require('../scripts/plugin-sync');
12
+
13
+ const ROOT = path.resolve(__dirname, '..');
14
+
15
+ function fakeHost({ claudeInstalled = false, codexInstalled = false, claudeMarketplace = true, codexMarketplace = true, unknownClaudePluginState = false } = {}) {
16
+ const calls = [];
17
+ const state = {
18
+ claudeInstalled,
19
+ codexInstalled,
20
+ claudeMarketplace,
21
+ codexMarketplace
22
+ };
23
+ const runner = (command, args) => {
24
+ calls.push({ command, args: [...args] });
25
+ const joined = args.join(' ');
26
+
27
+ if (command === 'claude') {
28
+ if (joined.includes('marketplace list --json')) {
29
+ return { status: 0, stdout: JSON.stringify({ marketplaces: state.claudeMarketplace ? [{ name: 'harness-everything' }] : [] }), stderr: '' };
30
+ }
31
+ if (joined === 'plugin marketplace list') {
32
+ return { status: 0, stdout: state.claudeMarketplace ? 'harness-everything\n' : '', stderr: '' };
33
+ }
34
+ if (joined.startsWith('plugin marketplace add')) {
35
+ state.claudeMarketplace = true;
36
+ return { status: 0, stdout: '', stderr: '' };
37
+ }
38
+ if (joined.startsWith('plugin marketplace update')) return { status: 0, stdout: '', stderr: '' };
39
+ if (joined.includes('plugin list --json')) {
40
+ if (unknownClaudePluginState) return { status: 1, stdout: '', stderr: 'unsupported --json' };
41
+ return { status: 0, stdout: JSON.stringify({ plugins: state.claudeInstalled ? [{ id: 'harness-everything@harness-everything' }] : [] }), stderr: '' };
42
+ }
43
+ if (joined === 'plugin list') {
44
+ if (unknownClaudePluginState) return { status: 1, stdout: '', stderr: 'unsupported list' };
45
+ return { status: 0, stdout: state.claudeInstalled ? 'harness-everything@harness-everything\n' : '', stderr: '' };
46
+ }
47
+ if (joined.startsWith('plugin install') || joined.startsWith('plugin update')) {
48
+ state.claudeInstalled = true;
49
+ return { status: 0, stdout: '{}', stderr: '' };
50
+ }
51
+ }
52
+
53
+ if (command === 'codex') {
54
+ if (joined.includes('marketplace list --json')) {
55
+ return { status: 0, stdout: JSON.stringify({ marketplaces: state.codexMarketplace ? [{ name: 'harness-everything' }] : [] }), stderr: '' };
56
+ }
57
+ if (joined === 'plugin marketplace list') {
58
+ return { status: 0, stdout: state.codexMarketplace ? 'harness-everything\n' : '', stderr: '' };
59
+ }
60
+ if (joined.startsWith('plugin marketplace add')) {
61
+ state.codexMarketplace = true;
62
+ return { status: 0, stdout: '{}', stderr: '' };
63
+ }
64
+ if (joined.startsWith('plugin marketplace upgrade')) return { status: 0, stdout: '{}', stderr: '' };
65
+ if (joined.includes('plugin list --marketplace harness-everything --json') || joined === 'plugin list --json') {
66
+ return { status: 0, stdout: JSON.stringify({ plugins: state.codexInstalled ? [{ name: 'harness-everything', marketplace: 'harness-everything' }] : [] }), stderr: '' };
67
+ }
68
+ if (joined === 'plugin list --marketplace harness-everything' || joined === 'plugin list') {
69
+ return { status: 0, stdout: state.codexInstalled ? 'harness-everything@harness-everything\n' : '', stderr: '' };
70
+ }
71
+ if (joined.startsWith('plugin add')) {
72
+ state.codexInstalled = true;
73
+ return { status: 0, stdout: '{}', stderr: '' };
74
+ }
75
+ }
76
+
77
+ return { status: 0, stdout: '', stderr: '' };
78
+ };
79
+
80
+ return {
81
+ calls,
82
+ runner,
83
+ commandAvailable: () => true
84
+ };
85
+ }
86
+
87
+ function callsFor(calls, command, prefix) {
88
+ return calls.filter(call => call.command === command && call.args.join(' ').startsWith(prefix));
89
+ }
90
+
91
+ function runHost(host, fake) {
92
+ return sync({ host, repository: 'dyphn1/Harness-everything', ref: 'main' }, {
93
+ ...fake,
94
+ log: () => {},
95
+ warn: () => {}
96
+ });
97
+ }
98
+
99
+ assert.strictEqual(parseJsonOutput('status\n{"ok":true}\n').ok, true);
100
+ assert.strictEqual(findMarketplace({ marketplaces: [{ name: 'harness-everything' }] }, 'harness-everything'), true);
101
+ assert.strictEqual(findPlugin({ plugins: [{ id: 'harness-everything@harness-everything' }] }, 'harness-everything', 'harness-everything'), true);
102
+
103
+ {
104
+ const fake = fakeHost({ claudeInstalled: false });
105
+ const result = runHost('claude', fake);
106
+ assert.strictEqual(result.failed, 0);
107
+ assert.strictEqual(result.results[0].action, 'install');
108
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin install').length, 1, 'absent Claude plugin must install');
109
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin update').length, 0, 'absent Claude plugin must not update');
110
+ }
111
+
112
+ {
113
+ const fake = fakeHost({ claudeInstalled: true });
114
+ const result = runHost('claude', fake);
115
+ assert.strictEqual(result.failed, 0);
116
+ assert.strictEqual(result.results[0].action, 'update');
117
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin update').length, 1, 'installed Claude plugin must update');
118
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin install').length, 0, 'installed Claude plugin must not reinstall');
119
+ }
120
+
121
+ {
122
+ const fake = fakeHost({ codexInstalled: false });
123
+ const result = runHost('codex', fake);
124
+ assert.strictEqual(result.failed, 0);
125
+ assert.strictEqual(result.results[0].action, 'install');
126
+ assert.strictEqual(callsFor(fake.calls, 'codex', 'plugin add').length, 1, 'absent Codex plugin must install');
127
+ }
128
+
129
+ {
130
+ const fake = fakeHost({ codexInstalled: true });
131
+ const result = runHost('codex', fake);
132
+ assert.strictEqual(result.failed, 0);
133
+ assert.strictEqual(result.results[0].action, 'update');
134
+ assert.strictEqual(callsFor(fake.calls, 'codex', 'plugin marketplace upgrade').length, 1, 'installed Codex plugin must upgrade its marketplace');
135
+ assert.strictEqual(callsFor(fake.calls, 'codex', 'plugin add').length, 0, 'installed Codex plugin must not be re-added');
136
+ }
137
+
138
+ {
139
+ const fake = fakeHost({ unknownClaudePluginState: true });
140
+ const result = runHost('claude', fake);
141
+ assert.strictEqual(result.failed, 1, 'unknown installed state must fail closed');
142
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin install').length, 0, 'unknown state must not install');
143
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin update').length, 0, 'unknown state must not update blindly');
144
+ assert.strictEqual(callsFor(fake.calls, 'claude', 'plugin marketplace update').length, 0, 'unknown state must not refresh the marketplace blindly');
145
+ }
146
+
147
+ {
148
+ const result = sync({ host: 'all' }, { commandAvailable: () => false, log: () => {}, warn: () => {} });
149
+ assert.strictEqual(result.skipped, 2);
150
+ assert.strictEqual(result.failed, 0);
151
+ }
152
+
153
+ for (const wrapper of ['scripts/plugin-sync.sh', 'scripts/plugin-sync.ps1']) {
154
+ const text = fs.readFileSync(path.join(ROOT, wrapper), 'utf8');
155
+ assert.match(text, /plugin-sync\.js/);
156
+ assert.doesNotMatch(text, /\.codex\/plugins\/cache|config\.toml/);
157
+ }
158
+
159
+ const cli = fs.readFileSync(path.join(ROOT, 'bin', 'cli.js'), 'utf8');
160
+ assert.match(cli, /case 'plugin-sync'/);
161
+ assert.match(cli, /Existing installations always take the update/);
162
+
163
+ console.log('Native plugin sync verified: absent plugins install, installed plugins update, and unknown state fails closed.');
@@ -28,8 +28,8 @@ check((dockerVerify.match(/\$STATE_DIR\//g) || []).length >= 10,
28
28
  '#205 docker verifier routes all state checks through STATE_DIR');
29
29
 
30
30
  const architecture = fs.readFileSync(path.join(ROOT, 'docs/architecture.md'), 'utf8');
31
- check(architecture.includes('advisory loop-awareness reminders'),
32
- '#206 architecture names loop-awareness as advisory');
31
+ check(architecture.includes('MAY-level loop-awareness planning hints'),
32
+ '#206 architecture keeps loop-awareness numeric guidance explicitly non-mandatory');
33
33
  check(!/\bloop budgets\b/.test(architecture),
34
34
  '#206 architecture does not describe retired loop budgets as enforcement');
35
35
 
@@ -162,7 +162,7 @@ assert.ok(hooks.hooks.Stop?.length, 'Stop hook missing');
162
162
  const hookText = JSON.stringify(hooks);
163
163
  assert.match(hookText, /PLUGIN_ROOT/, 'plugin hooks must resolve from PLUGIN_ROOT');
164
164
  assert.match(hookText, /commandWindows/, 'plugin hooks need a Windows command override');
165
- assert.match(hookText, /workflow-gate\.js/, 'plugin hooks must package workflow guidance');
165
+ assert.match(hookText, /workflow-gate\.js/, 'plugin hooks must package workflow contract observation');
166
166
  assert.match(hookText, /workflow-stop-gate\.js/, 'plugin hooks must package workflow completion reminders');
167
167
 
168
168
  const session = spawnSync(process.execPath, [path.join(PLUGIN, 'hooks', 'session-start.js')], { encoding: 'utf8' });
@@ -190,14 +190,14 @@ assert.strictEqual(second.status, 0, second.stderr);
190
190
  assert.strictEqual(first.stdout, second.stdout, 'identical routing input must produce identical output');
191
191
  assert.match(first.stdout, /RECOMMENDED TIER:\s*Tier 2/i);
192
192
  assert.match(first.stdout, /REQUIRED HARNESS INVARIANTS/);
193
- assert.match(first.stdout, /WORKFLOW SKILLS \(EVALUATE APPLICABILITY .*SELECTED WORKFLOW IS GUIDANCE\)/);
193
+ assert.match(first.stdout, /WORKFLOW SKILLS \(APPLICABILITY MUST BE RESOLVED\)/);
194
194
  assert.match(first.stdout, /evaluate-suggestions-before-skip/);
195
195
  assert.match(first.stdout, /read its complete SKILL\.md entry/);
196
196
  assert.doesNotMatch(first.stdout, /BASE EXECUTION LOOP/);
197
- assert.match(first.stdout, /ORCHESTRATION POLICY: Selected topology is planning guidance/);
198
- assert.match(first.stdout, /WORKFLOW GUIDANCE \(ADVISORY WHEN SELECTED\)/);
197
+ assert.match(first.stdout, /ORCHESTRATION POLICY: Selected-topology required obligations and applicable skill core contracts are semantic MUSTs/);
198
+ assert.match(first.stdout, /WORKFLOW SEMANTIC CONTRACT \(NON-BLOCKING OBSERVATION\)/);
199
199
  assert.match(first.stdout, /Selected workflow: iterative-single/);
200
- assert.match(first.stdout, /Before claiming completion, review unresolved workflow evidence and objective verification/);
200
+ assert.match(first.stdout, /Before claiming completion, MUST resolve required workflow evidence and objective verification/);
201
201
  assert.doesNotMatch(first.stdout, /budget-exhausted|reset-budget/);
202
202
 
203
203
  const trivial = route('Update one README typo');
@@ -213,4 +213,4 @@ assert.match(unmatched.stdout, /RECOMMENDED TIER:\s*Unclassified/i);
213
213
  assert.match(unmatched.stdout, /"tier":"unclassified"/i);
214
214
  assert.doesNotMatch(unmatched.stdout, /RECOMMENDED TIER:\s*Tier 1/i);
215
215
 
216
- console.log(`OpenAI plugin package verified: ${skillNames.length} skills, publication metadata, hooks, marketplace, deterministic guidance-first routing.`);
216
+ console.log(`OpenAI plugin package verified: ${skillNames.length} skills, publication metadata, hooks, marketplace, deterministic semantic-contract routing.`);