harness-everything 0.8.0 → 0.9.0

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 (102) 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 -35
  5. package/CHANGELOG.md +51 -0
  6. package/README.md +2 -2
  7. package/benchmarks/results/reviews/pr142-verification.json +95 -0
  8. package/ci/action-gate.test.js +83 -3
  9. package/ci/doc-capability-consistency.test.js +3 -0
  10. package/ci/invariant-routing.test.js +87 -74
  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 +9 -6
  15. package/ci/phase4-ensemble-memory.test.js +128 -10
  16. package/ci/router-workflow-plan.test.js +23 -0
  17. package/ci/workflow-execution-contract.test.js +133 -0
  18. package/ci/workflow-plan-consumers.test.js +18 -0
  19. package/docs/architecture.md +111 -114
  20. package/docs/mechanism-first-skill-mesh.md +92 -103
  21. package/docs/openai-plugin.md +1 -1
  22. package/docs/philosophy.md +40 -33
  23. package/docs/platform-capabilities.md +2 -2
  24. package/docs/reviews/pr-142-issue-131.md +89 -0
  25. package/docs/routing.md +61 -124
  26. package/docs/workflow-runtime.md +109 -0
  27. package/fable-mode/CONTRACT-FORMAT.md +3 -1
  28. package/fable-mode/SKILL.md +1 -1
  29. package/fable-mode/agents/fable-orchestrator.md +9 -7
  30. package/fable-mode/execution-guardrails/SKILL.md +1 -1
  31. package/fable-mode/fable-haiku/SKILL.md +1 -1
  32. package/fable-mode/fable-opus/SKILL.md +1 -1
  33. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  34. package/fable-mode/scripts/workflow-plan-consumer.js +13 -8
  35. package/harness-everything/SKILL.md +11 -10
  36. package/harness-everything/references/triage-and-tiers.md +76 -107
  37. package/harness-everything/schemas/router-task-shape.schema.json +4 -2
  38. package/harness-everything/schemas/router-workflow-plan.schema.json +3 -2
  39. package/harness-everything/scripts/kernel-router-core.js +265 -0
  40. package/harness-everything/scripts/kernel-router.js +118 -223
  41. package/harness-everything/scripts/router-contract-core.js +633 -0
  42. package/harness-everything/scripts/router-contract.js +21 -581
  43. package/harness-everything/scripts/tier-router.js +19 -1
  44. package/hooks/hooks.json +25 -4
  45. package/hooks/scripts/action-gate.js +111 -2
  46. package/hooks/scripts/contract-test.js +27 -2
  47. package/hooks/scripts/lib/workflow-isolation.js +102 -0
  48. package/hooks/scripts/lib/workflow-runtime.js +254 -0
  49. package/hooks/scripts/state-persist.js +1 -0
  50. package/hooks/scripts/subagent-scope-guard.js +20 -3
  51. package/hooks/scripts/workflow-disposition.js +104 -0
  52. package/hooks/scripts/workflow-gate.js +56 -0
  53. package/hooks/scripts/workflow-stop-gate.js +44 -0
  54. package/multi-agent-workspace/SKILL.md +2 -2
  55. package/multi-agent-workspace/scripts/index_memory.js +107 -1
  56. package/opencode-plugin/plugin.json +1 -1
  57. package/package.json +2 -2
  58. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  59. package/plugins/harness-everything/hooks/hooks.json +44 -1
  60. package/plugins/harness-everything/hooks/scripts/action-gate.js +111 -2
  61. package/plugins/harness-everything/hooks/scripts/contract-test.js +27 -2
  62. package/plugins/harness-everything/hooks/scripts/lib/workflow-isolation.js +102 -0
  63. package/plugins/harness-everything/hooks/scripts/lib/workflow-runtime.js +254 -0
  64. package/plugins/harness-everything/hooks/scripts/state-persist.js +1 -0
  65. package/plugins/harness-everything/hooks/scripts/subagent-scope-guard.js +20 -3
  66. package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +104 -0
  67. package/plugins/harness-everything/hooks/scripts/workflow-gate.js +56 -0
  68. package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +44 -0
  69. package/plugins/harness-everything/plugin.json +1 -1
  70. package/plugins/harness-everything/scripts/lib/advisory-text.js +51 -54
  71. package/plugins/harness-everything/skills/fable-mode/CONTRACT-FORMAT.md +3 -1
  72. package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
  73. package/plugins/harness-everything/skills/fable-mode/agents/fable-orchestrator.md +9 -7
  74. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +1 -1
  75. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  76. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +1 -1
  77. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  78. package/plugins/harness-everything/skills/fable-mode/scripts/workflow-plan-consumer.js +13 -8
  79. package/plugins/harness-everything/skills/harness-everything/SKILL.md +11 -10
  80. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +76 -107
  81. package/plugins/harness-everything/skills/harness-everything/schemas/router-task-shape.schema.json +4 -2
  82. package/plugins/harness-everything/skills/harness-everything/schemas/router-workflow-plan.schema.json +3 -2
  83. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +265 -0
  84. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +118 -223
  85. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +633 -0
  86. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract.js +21 -581
  87. package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +19 -1
  88. package/plugins/harness-everything/skills/multi-agent-workspace/SKILL.md +2 -2
  89. package/plugins/harness-everything/skills/multi-agent-workspace/scripts/index_memory.js +107 -1
  90. package/plugins/harness-everything/skills/self-evolve/SKILL.md +6 -6
  91. package/plugins/harness-everything/skills/self-evolve/references/memory-resolution.md +22 -33
  92. package/plugins/harness-everything/skills/self-evolve/scripts/persist-memory.js +336 -57
  93. package/plugins/harness-everything/skills/self-evolve/scripts/self-regression.js +1 -0
  94. package/plugins/harness-everything/skills/using-git-worktrees/SKILL.md +14 -16
  95. package/plugins/harness-everything/skills/using-git-worktrees/references/workflow-details.md +44 -85
  96. package/scripts/lib/advisory-text.js +51 -54
  97. package/self-evolve/SKILL.md +6 -6
  98. package/self-evolve/references/memory-resolution.md +22 -33
  99. package/self-evolve/scripts/persist-memory.js +336 -57
  100. package/self-evolve/scripts/self-regression.js +1 -0
  101. package/using-git-worktrees/SKILL.md +14 -16
  102. package/using-git-worktrees/references/workflow-details.md +44 -85
@@ -1,150 +1,154 @@
1
1
  # Harness Architecture
2
2
 
3
- This document describes the internal architecture, lifecycle, and integration boundaries of the Harness behavior layer. The current cross-platform claim boundary is centralized in [platform-capabilities.md](platform-capabilities.md); host sections here must remain consistent with it.
4
-
5
- ---
3
+ This document describes Harness runtime architecture and integration boundaries. Current host capability/evidence claims are centralized in [platform-capabilities.md](platform-capabilities.md); package wiring is not live-host proof.
6
4
 
7
5
  ## Architectural Overview
8
6
 
9
- Harness is a **system supervisor**, not a universal workflow engine. Skills remain independently useful, while runtime mechanisms establish a small cross-cutting contract around software work.
7
+ Harness is a **behavior and workflow supervisor**, not one universal fixed workflow. The router chooses the smallest sufficient execution topology; once selected, that topology becomes a lifecycle contract. The model retains freedom over reasoning, tools, and implementation technique inside the contract.
10
8
 
11
- The architecture follows a mechanism-first skill mesh with a **minimal kernel**:
9
+ The minimal kernel establishes:
12
10
 
13
- - classify scope before mutation,
14
- - when the router suggests skills, require the agent to read/evaluate each suggested `SKILL.md` before omission,
15
- - require evidence before completion claims,
16
- - stop repeated same-signature micro-retries and re-plan,
17
- - leave domain-skill execution, ordering, planning style, and delegation to the agent after evaluation.
11
+ - scope/tier before mutation,
12
+ - a selected workflow topology when task evidence supports one,
13
+ - applicability evaluation for every suggested skill before omission,
14
+ - objective evidence before completion,
15
+ - bounded re-plan/recovery after repeated failure,
16
+ - explicit blocked/degraded/escape state instead of silent workflow deletion.
18
17
 
19
- > **Do not enforce workflow order. Enforce workflow invariants.**
18
+ > **Mandatory applicable workflow; flexible reasoning/implementation inside it.**
20
19
  >
21
- > **Mandatory evaluation, advisory execution:** a suggested skill must be read/evaluated before skip, but need not be executed when its flow does not apply.
20
+ > A suggested skill can be `not-applicable` after evaluating its real flow. A selected topology cannot be replaced with a direct path merely because the model is confident. Escape is only for genuinely uncovered workflow scope and requires evidence.
22
21
 
23
- This is intentionally different from the older design where Tier 2 implied a fixed TDD/checklist pipeline and Tier 3 implied a mandatory Fable/multi-agent pipeline. It is also stronger than a pure recommendation system where the model can ignore suggestions from their names alone.
22
+ This avoids both extremes: the old universal Tier-2/Tier-3 pipeline and a purely advisory system where the model can rationalize away verification, staging, documentation, or other applicable obligations.
24
23
 
25
24
  ```mermaid
26
25
  flowchart TD
27
- subgraph User_Session [User Session]
28
- U([User Request]) --> Boot[bootstrap.js: Session Start / restore]
29
- end
30
-
31
- subgraph Kernel [Harness Kernel]
32
- Boot --> Preflight[Environment / integration discovery]
33
- Preflight --> KR[kernel-router.js]
34
- KR --> TR[tier-router.js<br/>classifier + guide discovery]
35
- TR --> Inv[Inject invariants]
36
- Inv --> Sug{Suggested skills?}
37
- Sug -- Yes --> Eval[Read each suggested SKILL.md<br/>evaluate flow + applicability]
38
- Sug -- No --> Choice[Agent chooses useful tactics]
39
- Eval --> Choice
40
- end
41
-
42
- subgraph Execution [Agent-Controlled Execution]
43
- Choice --> Tools[Tool calls / edits / tests]
44
- Tools --> Evidence{Evidence supports completion?}
45
- Evidence -- Yes --> Done[Evidence-backed completion]
46
- Evidence -- No --> Retry[Diagnose / iterate]
47
- end
48
-
49
- subgraph Defense [Runtime Boundaries]
50
- Retry --> CB{Same-signature failure x3?}
51
- CB -- No --> Tools
52
- CB -- Yes --> ZO[zoom-out / fresh diagnosis]
53
- ZO --> Tools
54
- end
55
-
56
- subgraph Learning [Optional Learning / State]
57
- Done --> Record[Record / self-evolve when useful]
58
- end
59
-
60
- style Kernel fill:#eceff1,stroke:#37474f,stroke-width:2px,color:#000000
61
- style Defense fill:#fff9c4,stroke:#fbc02d,stroke-width:2px,color:#000000
62
- style Learning fill:#e3f2fd,stroke:#1e88e5,stroke-width:2px,color:#000000
26
+ U([User Request]) --> B[Session bootstrap / environment]
27
+ B --> K[kernel-router.js]
28
+ K --> T[tier-router.js<br/>classification + task shape]
29
+ T --> P[Structured workflow plan]
30
+ P --> A{Strategy selected?}
31
+ A -- No / deferred --> D[Preserve invariants<br/>choose smallest justified workflow]
32
+ A -- Yes --> C[ACTIVE workflow contract]
33
+ C --> S{Suggested skills?}
34
+ S -- Yes --> E[Read SKILL.md<br/>resolve applicability]
35
+ S -- No --> X[Execute topology]
36
+ E --> X
37
+ X --> V{Required stage/check resolved?}
38
+ V -- Yes --> Done[Evidence-backed completion]
39
+ V -- No --> R[Diagnose / bounded re-plan]
40
+ R --> X
41
+ R -- topology cannot cover scope --> Esc[Evidence-backed escape<br/>uncovered scope only]
63
42
  ```
64
43
 
65
44
  ### Router responsibilities
66
45
 
67
- `kernel-router.js` is the public runtime entry point. It delegates heuristic classification and dynamic guide/skill discovery to `tier-router.js`, then converts the result into the Harness contract:
46
+ `kernel-router.js` is the public runtime entry. It consumes the structured classifier contract and exposes:
68
47
 
69
- - recommended Tier + rationale,
70
- - baseline required invariants,
71
- - a conditional `evaluate-suggestions-before-skip` invariant whenever suggestions exist,
72
- - skill suggestions under a **mandatory evaluation / advisory execution** contract.
48
+ - tier + rationale,
49
+ - selected/deferred execution strategy,
50
+ - required invariants,
51
+ - suggested skills that require applicability evaluation,
52
+ - the visible routing checkpoint,
53
+ - a workflow execution contract.
73
54
 
74
- For each suggested skill, the agent must read the complete `SKILL.md` entry and evaluate `USE FOR`, `DO NOT USE FOR`, workflow/basic flow, and hard rules before omission. A skill name, description, router summary, tier label, or “routine task” judgement is not enough to justify skipping. If the entry explicitly requires another document to determine applicability, that required material joins the evaluation; optional deep-dive references do not automatically become mandatory.
55
+ The router does not tell the model *how* to solve each stage. It decides what lifecycle shape is required. `direct-single`, `iterative-single`, `fable-staged`, `fable-parallel`, and `fable-multi-agent-workspace` remain deliberately small, non-overlapping topology choices.
75
56
 
76
- The kernel deliberately suppresses the old fixed `BASE EXECUTION LOOP` wording so that a host selecting `tdd`, `security-review`, `repo-docs`, or another peer skill cannot accidentally replace or bypass the cross-cutting Harness contract. Using one suggested skill also does not waive evaluation of the other omitted suggestions.
57
+ ### Skill applicability vs. topology execution
77
58
 
78
- `harness-everything` remains the public/manual skill entry point for routing, debugging, and re-routing. `install-cognitive-os` remains the explanatory/manual entry point for the Discover → Think → Try → Summarize → Record policy. Automatic correctness must not depend on either one winning host peer-skill selection first.
59
+ Router suggestions remain useful domain/workflow knowledge, not a universal sequence. Before omission, the agent reads the complete `SKILL.md` entry and evaluates `USE FOR`, `DO NOT USE FOR`, workflow/basic flow, and hard rules. Name/description/router-summary or “routine task” is insufficient evidence.
79
60
 
80
- ---
61
+ The selected topology is stronger. Once selected, it must be entered and resolved unless the runtime records a permitted workflow escape with uncovered scope + evidence. Covered obligations survive the escape.
81
62
 
82
- ## Integration Touchpoints
63
+ ### Runtime workflow state
83
64
 
84
- Harness aligns to each host's real capabilities. Enforcement strength is platform-specific; shared skill text does not prove mechanism parity.
65
+ On host paths that can persist it, `kernel-router.js` records session-scoped `workflow-run.json` with the selected strategy and lifecycle state. Prompt text is not persisted; only a content hash is retained for correlation.
85
66
 
86
- ### Self-healing and placement
67
+ For selected Fable topologies on Claude:
87
68
 
88
- `harness-everything/scripts/self-heal.js` audits supported integration touchpoints and can re-run the idempotent installer to repair missing pieces. If a user intentionally removed an integration, respect that choice.
69
+ - `workflow-gate.js` checks supported shell/direct mutation, actual direct/patch targets, and registered Git worktree isolation before major-workflow mutation; Fable also requires a run bound to the workflow/session identity;
70
+ - Fable owns stage contracts, `dependsOn`/`writeSet`, validated execution batches, objective per-stage checks, synthesis, cold verification, and bounded re-plans;
71
+ - `workflow-stop-gate.js` rejects completion while correlated stage contracts remain unresolved;
72
+ - `workflow-disposition.js` starts/replans within budget, records blockers, and permits only declared-stage evidence-backed escape (`workflow-uncovered-scope` or `host-capability-unavailable`). Covered obligations, isolation, and independent verification survive escape. See [runtime transitions and limitations](workflow-runtime.md).
89
73
 
90
- A platform's native files stay where that platform expects them. Harness-owned runtime state converges under the platform's `harness-everything/` state directory, while skills remain in each platform's native skill location. `manifest.json` records installed artifacts so uninstall can remove only Harness-owned files.
74
+ Other topologies use their own applicable mechanisms: loop budgets, regular verification stop-gates, action gates, and task-specific skills. Mechanism coverage is not assumed identical across hosts.
91
75
 
92
- ### Runtime state vs. skill content
76
+ ## Integration Touchpoints
93
77
 
94
- Runtime state includes hook metadata, circuit-breaker counters, handoff/verification timestamps, and WAL-style session state. Skill content is separate and independently discoverable. This separation lets a domain skill remain useful even when a host does not support Harness runtime hooks.
78
+ Harness aligns to each host's actual lifecycle/tool APIs. Shared skill text defines a contract; only supported host mechanisms can mechanically block or observe particular transitions.
95
79
 
96
- ---
80
+ ### Runtime state vs. skill content
97
81
 
98
- ## Host Adapters
82
+ Runtime state includes hook metadata, workflow lifecycle, circuit-breaker counters, handoff/verification evidence, and WAL-style session state. Skill content is independently discoverable and remains useful on instruction-only surfaces.
99
83
 
100
- ### 1. Claude Code — hook-enforced
84
+ ### Claude Code — hook-enforced mechanisms
101
85
 
102
86
  The installer configures native lifecycle hooks and project skills.
103
87
 
104
- - `SessionStart`: `bootstrap.js` restores prior state and audits integrations.
105
- - `UserPromptSubmit`: `kernel-router.js` establishes routing + invariants before peer/domain skill execution and tells the agent that every suggested skill must be evaluated before omission.
106
- - `PreToolUse`: circuit breaker, boundary/depth/context guards, and subagent scope guards can block supported tool calls.
107
- - `PostToolUse`: records outcomes/state and tracks repeated failures.
108
- - `Stop`: `stop-gate.js` prevents an edit batch from being claimed complete without successful verification evidence.
88
+ - `SessionStart`: bootstrap/restoration.
89
+ - `UserPromptSubmit`: kernel routing + active workflow contract.
90
+ - `PreToolUse`: workflow bypass gate, action gate, rule-of-3, boundary/depth/context guards, subagent scope guard.
91
+ - `PostToolUse`: outcomes, state, repeated-failure evidence, stage checks.
92
+ - `Stop`: action-gate audit, selected-Fable completion gate, and ordinary verify-before-claim stop gate.
93
+
94
+ These hooks make some lifecycle obligations mechanically enforceable. They still do not prove a real session loaded/fired them; live evidence remains separate.
109
95
 
110
- The prompt hook is intentionally lightweight: it does **not** prescribe TODO/TDD/Fable order. It injects the routing rails and the read-before-skip requirement, then lets the model orchestrate execution after evaluation. Kernel emission by itself is not proof that the host/model actually read each skill; that requires retained live behavioral evidence.
96
+ ### OpenCode — plugin enforcement, scoped live verification
111
97
 
112
- ### 2. OpenCode — plugin enforcement, scoped live verification
98
+ 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**. Hard-lock is an **interactive observation** with **no retained blocked-tool trace**; reflection was **operator-seeded** and then agent-rewritten. Global scope, npm-package installation, and other OpenCode versions remain unverified.
113
99
 
114
- `opencode-plugin/` maps supported enforcement behavior to OpenCode's real plugin API with deterministic mechanism coverage. Partial live-host evidence supports project-scope `.js` loading and edit/verification state on OpenCode 1.18.31 (macOS): [retained evidence](../benchmarks/results/live-host/opencode-2026-09-16/README.md). The final snapshot is post-reset (`hardLock: false`, `count: 1`), not a full enforcement history. Hard lock is only an interactive observation with no retained blocked-tool trace. Reflection was operator-seeded, then agent-rewritten; state-file deletion is an agent-controlled reset, not durable hard enforcement. This does not establish behavioral effectiveness. `.mjs` auto-discovery is broken on this host version (issue #127). Global scope, npm-package installation, and other host versions remain unverified.
100
+ This evidence does not establish the new mandatory-workflow lifecycle on OpenCode. That requires its own adapter/evidence before parity is claimed.
115
101
 
116
- ### 3. Cursor — skills plus advisory rules
102
+ ### Cursor — skills plus advisory rules
117
103
 
118
- The current installer uses `.cursor/skills/` plus `.cursorrules`. Cursor’s documented skill and plugin surfaces are separate from Harness runtime hooks; routing/verification/retry boundaries and read-before-skip remain instruction-governed unless a compatible mechanism is independently verified.
104
+ Cursor receives project skills and advisory rules. The semantic workflow contract can be stated, but unsupported lifecycle transitions are not mechanically enforced.
119
105
 
120
- ### 4. GitHub Copilot agent surfaces — skills plus advisory instructions
106
+ ### GitHub Copilot agent surfaces — skills plus advisory instructions
121
107
 
122
- The current installer uses `.github/skills/` plus `.github/copilot-instructions.md`. GitHub’s Agent Skills paths are documented, but no Harness-specific plugin or live session is verified here. The generated instructions include read-before-skip, but repository text alone is not live compliance evidence.
108
+ Copilot receives Agent Skills/repository instructions. No Harness-specific live hook-enforcement claim is made from repository text alone.
123
109
 
124
- ### 5. Codex — local OpenAI plugin plus advisory installer path
110
+ ### Codex / local OpenAI plugin
125
111
 
126
- Codex has two distinct Harness integration surfaces and documentation must keep them separate:
112
+ Codex has multiple distinct Harness surfaces:
127
113
 
128
- - The general `--codex` installer path writes Codex-facing skills/instructions such as `AGENTS.md`; where the host only consumes those instructions, that path is advisory. The generated `AGENTS.md` tells the agent to evaluate every router-suggested skill entry before omission.
129
- - The packaged local OpenAI plugin under `plugins/harness-everything/` includes `.codex-plugin/plugin.json`, all 26 canonical skills, and lifecycle hooks for `SessionStart`, `UserPromptSubmit`, supported local `PreToolUse` / `PostToolUse`, `SubagentStart` / `SubagentStop`, and `Stop`. Those hooks inject the compact session policy, run the invariant-first kernel, track supported edits and verification, and surface subagent scope changes.
114
+ - The general `--codex` installer writes repo-scoped `.agents/skills/` plus `AGENTS.md`; when consumed only as instructions, workflow enforcement is advisory/instruction-governed.
115
+ - The **Codex / local OpenAI plugin** under `plugins/harness-everything/` packages canonical skills plus session/prompt/supported-tool/subagent/stop hooks. The package includes workflow-gate adapters, but this is mechanism/package evidence until a live Codex session proves loading/firing.
116
+ - The public OpenAI **Skills-only** artifact excludes local `.codex-plugin` lifecycle hooks; it carries reusable workflow knowledge, not local hard gates.
130
117
 
131
- The local plugin therefore has **mechanism-tested local enforcement** for the packaged event/tool mappings. This is package evidence, not a live-host claim; the host's hook review/trust flow and a fresh session are still required. Do not infer broader Claude parity for events or tools that are not listed in the package, and do not infer that mechanism-tested prompt injection proves the model complied with read-before-skip.
118
+ Do not infer Claude parity from package similarity.
132
119
 
133
- The public OpenAI **Skills-only** submission is narrower again: it ships reusable skills and referenced assets, not the local `.codex-plugin` lifecycle hooks. Public reviewer/listing claims must describe skill/workflow behavior rather than local hook enforcement. See [openai-plugin.md](openai-plugin.md).
120
+ ### Continue.dev — rules documented, standalone discovery uncertain
134
121
 
135
- ### 6. Continue.dev — rules documented, skill discovery unknown
122
+ Continue uses native rule files; standalone skill discovery remains separately bounded by the capability matrix.
136
123
 
137
- The installer writes `.continue/rules/harness.md` with the platform's native rules format and retains `.continue/skills/` as an adapter candidate. The reviewed official Continue documentation does not establish standalone `SKILL.md` discovery, so no skill-loading or hard-gate parity is claimed.
124
+ ### Hermes Agent — trusted skills plus advisory context
138
125
 
139
- ### 7. Hermes Agent — trusted skills plus advisory context
126
+ Hermes uses trusted project/global skill surfaces plus advisory context. Trust/loading and lifecycle enforcement remain host-specific.
140
127
 
141
- The installer writes `.hermes.md` for explicit project coverage and can install trusted project skills under `.agents/skills/` plus global skills under `~/.hermes/skills/`. Project skill loading remains subject to Hermes trust; no hard-gate parity is claimed.
128
+ ## Fable Execution Architecture
142
129
 
143
- ---
130
+ Fable is the execution owner for selected `fable-*` topologies.
131
+
132
+ ```mermaid
133
+ flowchart TD
134
+ P[Selected Fable plan] --> M[Stage map<br/>dependsOn + writeSet]
135
+ M --> B{Validated batch?}
136
+ B -- No --> Block[Blocked / re-plan]
137
+ B -- Yes --> W[Named workers]
138
+ W --> C[Objective stage checks]
139
+ C --> S[Synthesis barrier]
140
+ S --> V{Verification pass?}
141
+ V -- Yes --> D[Delivery evidence]
142
+ V -- No --> R{Re-plan budget remains?}
143
+ R -- Yes --> M
144
+ R -- No --> Block
145
+ ```
146
+
147
+ The orchestrator controls lifecycle and completion; workers do not create peer-to-peer meshes or widen their own write scope. The model remains creative inside each bounded stage, while stage existence/checks/termination are contract state.
144
148
 
145
149
  ## Cognitive OS and Skill Mesh
146
150
 
147
- The Cognitive OS is a policy layer, not a parent skill that every domain skill must call.
151
+ The Cognitive OS remains a reasoning policy:
148
152
 
149
153
  ```mermaid
150
154
  flowchart LR
@@ -157,32 +161,25 @@ flowchart LR
157
161
  Z --> T
158
162
  ```
159
163
 
160
- A domain skill may have its own lifecycle — for example RED/GREEN/REFACTOR inside `tdd` — without being forced into a global sequence. The shared obligations are the baseline kernel invariants plus read-before-skip when router suggestions exist.
161
-
162
- This separation solves the peer-skill routing problem: a strong host may correctly decide that a task primarily needs `tdd` or `security-review`; that choice is allowed. What it cannot silently erase is the routing/evidence/retry contract or dismiss other suggestions without evaluating their actual skill flows.
163
-
164
- ---
165
-
166
- ## Security Model & Data Locality
167
-
168
- Harness runs with a local-first, zero-trust model:
164
+ A domain skill may define RED/GREEN/REFACTOR or another local lifecycle. The selected Harness topology supplies the outer execution contract; domain skills supply tactics/stages when applicable.
169
165
 
170
- 1. **No Harness telemetry:** runtime scripts do not upload project code or state as a Harness service.
171
- 2. **Credential protection:** scripts do not require storing user secrets; interactive credentials remain human-controlled.
172
- 3. **Small hook surface:** hook scripts are local Node.js programs and should stay fast and auditable.
173
- 4. **Explicit enforcement labels:** unsupported/advisory behavior must not be documented as hard enforcement.
174
- 5. **Deterministic regression:** mechanism and routing behavior is tested with executable CI gates rather than inferred from documentation.
166
+ ## Security and Data Locality
175
167
 
176
- ---
168
+ 1. **No Harness telemetry service:** project code/state is not uploaded by Harness runtime scripts.
169
+ 2. **Credential protection:** credentials remain human/host controlled.
170
+ 3. **Small mechanism surface:** hooks should remain fast and auditable.
171
+ 4. **Explicit enforcement labels:** instruction, mechanism, and live evidence are distinct.
172
+ 5. **Deterministic regression:** workflow/routing/hook contracts are executable CI gates.
173
+ 6. **No silent widening:** workflow escape cannot widen authorization, permissions, or external side effects.
177
174
 
178
175
  ## Validation Boundary
179
176
 
180
- Static configuration is not enough to claim that a host behaves correctly. Validation is layered:
177
+ Validation is layered:
181
178
 
182
- - syntax/reference/manifest checks prove package integrity,
183
- - `ci/invariant-routing.test.js` proves the kernel, read-before-skip, and documentation contracts,
184
- - `ci/doc-capability-consistency.test.js` prevents current platform capability claims from drifting apart,
185
- - mechanism tests prove supported hook/plugin behavior,
186
- - live host sessions are required before promoting a source/mechanism-tested adapter to live host enforcement or claiming that agents actually followed the evaluation contract.
179
+ - syntax/reference/package checks prove package integrity;
180
+ - routing tests prove plan and workflow-contract semantics;
181
+ - mechanism tests prove supported hook/plugin behavior;
182
+ - live-host evidence proves a specific host actually loaded/fired the mechanism;
183
+ - paired behavioral evaluation (#71) is required before claiming the new lifecycle improves outcomes.
187
184
 
188
- The architecture and its Mermaid diagrams are part of that contract. Runtime changes that alter orchestration must update these documents in the same change.
185
+ The architecture diagrams are part of the contract. A runtime orchestration change must update these docs and tests in the same change.
@@ -1,170 +1,159 @@
1
1
  # Mechanism-First Skill Mesh
2
2
 
3
- Harness is not intended to be a rigid workflow engine. Its skills should remain independently useful, while still coordinating through lightweight mechanisms that help the model and the software engineer work together with less drift, fewer loops, and better evidence.
3
+ Harness coordinates independently useful skills through a small workflow runtime. It does **not** make every skill part of one universal DAG, but it also does not leave selected execution topology to model discretion.
4
4
 
5
- The preferred shape is a **mechanism-first skill mesh**: skills are autonomous to execute, coordination is explicit, and enforcement happens at narrow decision points through scripts, hooks, exit codes, and compact return values. Router-suggested skills are **mandatory to evaluate before omission, but advisory to execute after evaluation**. Platform-specific enforcement claims follow [platform-capabilities.md](platform-capabilities.md).
5
+ The preferred shape is:
6
6
 
7
- ---
7
+ > **mandatory applicable workflow + local skill autonomy + narrow runtime mechanisms**
8
+
9
+ Platform-specific enforcement claims remain bounded by [platform-capabilities.md](platform-capabilities.md).
8
10
 
9
11
  ## Design Intent
10
12
 
11
- Harness exists to improve engineering collaboration, not to replace model judgment with a fixed state machine.
13
+ Each skill remains understandable/executable on its own, while the kernel provides an outer lifecycle contract.
12
14
 
13
- Each skill should be able to answer four questions on its own:
15
+ A skill should answer:
14
16
 
15
- 1. **When should I activate?** The trigger should be clear without requiring another skill to interpret it.
16
- 2. **What do I protect?** The skill should describe the failure mode it prevents or the engineering habit it reinforces.
17
- 3. **What mechanism do I expose?** When possible, the skill should provide a script, command, checklist primitive, verifier, or return-value contract that makes its guidance concrete.
18
- 4. **What should I hand to nearby skills?** The skill may recommend a next skill, but it should not require a global handoff template to remain useful.
17
+ 1. **When should I activate?** Clear `USE FOR` / `DO NOT USE FOR` applicability.
18
+ 2. **What do I protect?** The failure mode or engineering discipline it addresses.
19
+ 3. **What workflow/mechanism do I expose?** A local flow, verifier, script, gate, or stable result when useful.
20
+ 4. **What evidence means I am done?** A check, artifact, or explicit blocked state.
19
21
 
20
- This keeps the system composable: `tdd` can run alone, `verification-loop` can run alone, `todo-driven-workflow` can run alone, and `harness-everything` can route among them when the task benefits from orchestration. The router may not execute every suggestion, but it may not discard suggestions without first reading/evaluating their actual `SKILL.md` flows.
22
+ The router may surface several skills. Those suggestions must be evaluated from their actual `SKILL.md` flows before omission. They are **not** automatically all executed. Separately, the router selects one smallest sufficient outer topology. **The selected topology is mandatory for the run.**
21
23
 
22
- ---
24
+ ## Why Not One Global Skill Sequence?
23
25
 
24
- ## Why Not a Single Handoff Block?
26
+ A universal TODO/TDD/Fable sequence would:
25
27
 
26
- A universal handoff block makes workflow state easy to parse, but it also has costs:
28
+ - add prompt/runtime overhead to small tasks;
29
+ - confuse domain skills with orchestration topology;
30
+ - suppress useful model judgment inside stages;
31
+ - fail poorly on hosts that cannot enforce the same lifecycle APIs.
27
32
 
28
- - It encourages every platform and model to speak in the same rigid shape, even when a natural response would be clearer.
29
- - It can turn skills into a centralized workflow runner instead of a federation of local engineering disciplines.
30
- - It can make the model optimize for satisfying the template rather than making the best next engineering move.
31
- - It adds prompt weight on platforms where the mechanism cannot actually enforce the block.
33
+ So Harness separates **topology** from **capabilities/domain skills**:
32
34
 
33
- Harness should avoid mandatory global handoff text. Local skills may still use concise reports when they need them, but the mesh should not depend on one universal response format. The routing checkpoint is a compact state/evaluation surface, not a global handoff protocol.
35
+ ```text
36
+ tier / task shape
37
+ +
38
+ selected execution topology
39
+ +
40
+ applicable skills/capabilities
41
+ +
42
+ required invariants/gates
43
+ ```
34
44
 
35
- ---
45
+ The topology is the lifecycle contract. Skills are resolved for applicability within/around that contract.
36
46
 
37
47
  ## Mechanisms Over Prose
38
48
 
39
- LLMs are highly sensitive to tool results, command outputs, exit codes, and short structured decisions. Harness should prefer those signals over long textual handoffs.
49
+ Prefer short structured state, tool results, exit codes, and objective evidence over stronger prompt wording.
40
50
 
41
- Good mechanism outputs are:
42
-
43
- - **Short:** the result should be easy for the model to keep in active attention.
44
- - **Actionable:** the output should name the next constraint, gate, or recommended skill.
45
- - **Non-authoritarian about execution:** the mechanism may require an evaluation step without forcing a universal workflow sequence.
46
- - **Portable:** hook-capable platforms can run the mechanism automatically; hook-less platforms can call the same script explicitly.
47
-
48
- Example shape:
51
+ Example:
49
52
 
50
53
  ```text
51
54
  HARNESS_DECISION
52
55
  tier: 2
53
- required: route-before-execution, verify-before-claim, re-plan-after-repeat-failure, evaluate-suggestions-before-skip
54
- suggest: todo-driven-workflow, verification-loop
55
- suggestion_policy: mandatory-evaluation/advisory-execution
56
- reason: user requested code changes
56
+ strategy: iterative-single
57
+ workflow_state: active
58
+ required: route-before-execution, objective-verification, loop-budget
59
+ suggest: tdd, verification-loop
60
+ suggestion_policy: evaluate-applicability
61
+ escape_policy: workflow-uncovered-scope-only
57
62
  ```
58
63
 
59
- This is not a handoff block. It is a compact mechanical signal. The model remains free to decide how to present the work, explain trade-offs, and collaborate with the engineer after it has evaluated the suggested skill flows.
60
-
61
- ---
64
+ This says what must happen without prescribing private reasoning or exact implementation tactics.
62
65
 
63
- ## Skill Autonomy Contract
66
+ Good mechanisms are:
64
67
 
65
- Every skill in the mesh should remain useful when loaded directly.
68
+ - **short** enough to remain salient;
69
+ - **actionable** with an explicit next state;
70
+ - **failable** when a requirement is unmet;
71
+ - **bounded** by host capability/evidence;
72
+ - **non-prescriptive about HOW** unless a safety/contract requirement needs it.
66
73
 
67
- Recommended contract:
74
+ ## Skill Autonomy Contract
68
75
 
69
- - **Independent trigger:** the skill description should identify the problem or situation that activates it.
70
- - **Local workflow:** the skill should contain enough guidance to execute without reading the whole Harness ecosystem.
71
- - **Mechanism hook:** if a script can make the skill more reliable, expose it as an optional or required command.
72
- - **Neighbor links:** when another skill is commonly needed, recommend it by name and explain why.
73
- - **Exit discipline:** if the skill reaches a blocking state, it should say what evidence is missing or what human decision is needed.
76
+ Every skill should retain:
74
77
 
75
- The local workflow is why read-before-skip can work: the agent can inspect a suggested skill's complete entry and basic flow to judge applicability without loading the whole ecosystem. Optional deep references remain optional unless that entry explicitly makes one necessary to determine applicability.
78
+ - an independent trigger;
79
+ - a local workflow;
80
+ - objective/failable checks where possible;
81
+ - explicit neighbor links rather than hidden dependencies;
82
+ - blocked/exit discipline.
76
83
 
77
- ---
84
+ Read-before-omission exists so the agent can inspect this local contract without loading the entire ecosystem. If the skill flow applies, follow it; reading a skill is not permission to discard an applicable discipline because the model believes it already knows the answer.
78
85
 
79
86
  ## Coordination Patterns
80
87
 
81
- Harness should coordinate skills through small, composable patterns.
82
-
83
88
  ### Router Decision
84
89
 
85
- `harness-everything/scripts/kernel-router.js` is the public invariant-first runtime entry point. It delegates classification and guide discovery to `tier-router.js`, then returns the recommended tier, rationale, required invariants, and skill suggestions. Suggestions use a **mandatory evaluation / advisory execution** contract: before omission, read the complete suggested `SKILL.md` entry and evaluate `USE FOR`, `DO NOT USE FOR`, workflow/basic flow, and hard rules. It intentionally does not emit a mandatory global execution pipeline.
90
+ `harness-everything/scripts/kernel-router.js` emits tier, strategy, invariants, skill suggestions, and an execution contract.
86
91
 
87
- A name, frontmatter description, router summary, tier label, or “routine task” judgement is not enough to skip a suggestion. Using one suggestion does not waive read-before-skip for the others. If a suggestion cannot be resolved/read, preserve `unresolved/unavailable` rather than silently converting it into “not applicable.”
92
+ - Suggested skills: read and resolve applicability (`use`, `not-applicable`, `unresolved/unavailable`).
93
+ - Selected topology: execute to resolution (`active` → verified/satisfied, blocked, or explicit evidence-backed escape).
88
94
 
89
- ### Checklist State
95
+ Names/descriptions/router summaries or “routine task” judgements cannot resolve applicability by themselves.
90
96
 
91
- `todo-driven-workflow` may own explicit task decomposition state when that helps a Tier 2 or Tier 3 task. It is not a universal prerequisite. When the router suggests it, however, the agent must evaluate its actual skill flow before deciding that native host TODO tracking, a Markdown checklist, or no explicit checklist is the better choice.
97
+ ### Fable Stage Contracts
98
+
99
+ For `fable-*` strategies, Fable owns stage lifecycle: `dependsOn`, `writeSet`, validated batches, objective checks, synthesis, cold verification, and bounded re-planning. The parent cannot replace a selected Fable topology with direct editing on hook-capable paths that package the workflow gate.
92
100
 
93
101
  ### Verification Gate
94
102
 
95
- `verification-loop` and `verify-gate.js` provide reusable verification mechanisms. Hosts with a compatible stop/completion hook can invoke verification mechanically; instruction-only hosts can call the same verifier explicitly before final delivery. If `verification-loop` is router-suggested, read/evaluate its flow before omission even though the kernel already carries a verify-before-claim invariant.
103
+ `verification-loop`, `verify-gate.js`, ordinary stop-gates, and Fable stage evidence provide objective completion signals. Verification is not an optional courtesy when selected/applicable workflow state requires it.
96
104
 
97
105
  ### Recovery Gate
98
106
 
99
- `rule-of-3` and `zoom-out` coordinate through failure signatures and recovery instructions where the host exposes the required lifecycle/tool hooks. On hosts without those hooks, `zoom-out` remains usable as an explicit recovery discipline, but the automatic failure counter must not be implied.
107
+ Rule-of-3 stops repeated same-signature micro-retries and requires a new diagnosis. Fable verification failures return to bounded re-planning; budget exhaustion becomes blocked instead of endless iteration.
100
108
 
101
- ### Skill Suggestion
109
+ ### Action Gate
102
110
 
103
- `self-evolve` and generated skills feed the router through manifest metadata. Once the router surfaces a likely skill, the suggestion becomes an evaluation obligation: inspect its real entry/basic flow before deciding whether it applies. This does **not** make execution mandatory and does not create a fixed pipeline.
111
+ Irreversible/external side effects are orthogonal to topology and require their pre-action gate where supported. Workflow escape never widens permissions or bypasses action approval.
104
112
 
105
- ---
113
+ ### Self-Evolve
106
114
 
107
- ## Platform Strategy
115
+ Learning should consume verified lifecycle evidence (escape, re-plan, recovery, recurrence), not operate as a side door around the active workflow.
108
116
 
109
- Harness should use the strongest mechanism each installation surface actually provides.
117
+ ## Platform Strategy
110
118
 
111
- | Platform class | Preferred coordination style | Enforcement level |
119
+ | Platform class | Workflow contract | Mechanical enforcement |
112
120
  | --- | --- | --- |
113
- | Hook/plugin-capable surfaces | Hooks/plugins run routers, guards, trackers, or completion gates automatically; prompt routing can inject the read-before-skip contract | Mechanical injection/blocking is possible for packaged mechanisms; actual model compliance with skill evaluation still needs live behavioral evidence |
114
- | CLI/tool-capable but hook-less surfaces | The model explicitly calls Harness scripts at decision points and reads/evaluates suggested skills | Mechanism-guided/instruction-governed, not automatically enforced |
115
- | Prompt-only surfaces | Advisory instructions include command snippets and read-before-skip decision rules | Self-regulated by the model |
121
+ | Hook/plugin-capable | Same selected-workflow contract | Supported transitions can be blocked/observed by packaged mechanisms |
122
+ | CLI/tool-capable without lifecycle hooks | Same contract stated/called explicitly | Instruction/mechanism guided; no automatic blocking claim |
123
+ | Prompt-only | Same semantic obligations | Self-regulated only |
116
124
 
117
- One host may expose more than one surface. Codex is the important example: the general `--codex` installer path is instruction/advisory oriented, while the **local OpenAI plugin** packages session, prompt, supported-tool, subagent, and stop hooks for mechanism-tested runtime enforcement. The public OpenAI **Skills-only** submission does not include those local lifecycle hooks.
125
+ Contract semantics and enforcement evidence are separate. Claude currently packages the broadest Harness lifecycle surface. The local OpenAI/Codex plugin packages supported adapters but requires live-host evidence before parity claims. The public OpenAI Skills-only artifact carries skill/workflow knowledge without local lifecycle hooks. OpenCode has its own plugin path and evidence boundaries.
118
126
 
119
- OpenCode is plugin-capable and has partial live-host evidence for project-scope loading/state effects, but the read-before-skip behavioral contract still requires separate retained evidence before being called live-enforced. Claude Code has the broadest currently verified Harness lifecycle-hook surface.
127
+ ## Hook-Less Paths
120
128
 
121
- ---
129
+ Two explicit commands provide high-signal state without pretending hooks exist:
122
130
 
123
- ## Guidance for Instruction-Only / Hook-Less Paths
124
-
125
- Do not recreate hooks with a rigid universal handoff template. Instead, make mechanisms easy to call and make the evaluation requirement explicit.
126
-
127
- Implemented today, both wired into `bin/cli.js` and referenced by name in the advisory text each platform's installer writes (`scripts/lib/advisory-text.js`):
128
-
129
- - `npx github:dyphn1/Harness-everything next "<prompt>"`: runs the Harness routing path and prints the recommended tier, invariant contract, and matching knowledge/skill suggestions. Every suggested skill must then be read/evaluated before omission.
130
- - `npx github:dyphn1/Harness-everything verify`: wraps `verify-gate.js`, running the target project's own lint/test scripts and exiting non-zero on failure. This is the explicit hook-less verification path; it is not equivalent to claiming that a host automatically runs a `Stop` hook.
131
-
132
- Both resolve their target scripts relative to the CLI's own package install, not the caller's cwd, so they work the same way regardless of which platform-specific directory (`.codex/skills/`, `.cursor/skills/`, `.github/skills/`, ...) a copy of the `harness-everything` skill also happens to be sitting in — a fixed relative path like `harness-everything/scripts/tier-router.js` would silently point at nothing depending on which platform installed it.
133
-
134
- Not yet implemented — still aspirational, do not reference these as if they exist until they're built:
135
-
136
- - `harness recover`: summarize repeated failure signatures and recommend `zoom-out` when needed. Hook-less paths do not collect failure signatures the way the Claude Code `PostToolUse` mechanism does, so there is no reliable state to summarize yet.
137
- - `harness skills`: list installed, generated, and matching skills for the current workspace.
138
-
139
- These commands let instruction-only Codex installs, Cursor, Copilot, Continue, and Hermes receive high-signal mechanical feedback without forcing them into a single scripted conversation shape.
131
+ ```bash
132
+ npx github:dyphn1/Harness-everything next "<prompt>"
133
+ npx github:dyphn1/Harness-everything verify
134
+ ```
140
135
 
141
- ---
136
+ `next` emits the routing/workflow contract. `verify` runs the explicit verification path. Instruction-only hosts must treat these requirements as real even though the host cannot mechanically prevent skipping them.
142
137
 
143
138
  ## Anti-Goals
144
139
 
145
140
  Harness should not become:
146
141
 
147
- - A centralized DAG runner where every skill depends on one global workflow file.
148
- - A mandatory response-template system that suppresses useful model variation.
149
- - A command-only framework where skills cannot be understood by reading `SKILL.md`.
150
- - A hidden daemon that performs broad actions without visible evidence.
151
- - A platform-specific product that only works well when Claude Code hooks are available.
152
- - A recommendation system whose suggestions are routinely ignored without inspecting the workflows they represent.
153
-
154
- The mesh should remain local, legible, and cooperative.
155
-
156
- ---
142
+ - one global DAG containing every skill;
143
+ - a mandatory response-template system;
144
+ - a command-only framework whose skills are unreadable without runtime code;
145
+ - a hidden daemon with broad authority;
146
+ - a system that claims cross-host hard enforcement from package text;
147
+ - a recommendation system where selected workflows can be rationalized away.
157
148
 
158
149
  ## Practical Authoring Rules
159
150
 
160
- When adding or revising a skill:
161
-
162
- 1. Keep the skill independently executable.
163
- 2. Put enough applicability and basic-flow information in `SKILL.md` for read-before-skip evaluation; do not hide the decision-critical contract only in optional deep references.
164
- 3. Add a script only when a mechanism can make the behavior more reliable than prose.
165
- 4. Keep script output compact and stable enough for models to react to.
166
- 5. Prefer gates at natural decision points: before editing, after repeated failure, before final delivery, and before persistence.
167
- 6. Let the model choose wording and presentation unless the skill truly needs a specific artifact format.
168
- 7. Document neighboring skills as recommendations, not hidden execution dependencies, unless the dependency is required for safety. Router-surfaced recommendations still inherit mandatory evaluation before omission.
151
+ 1. Keep skills independently understandable/executable.
152
+ 2. Put applicability/basic flow in `SKILL.md`; deep detail belongs in references.
153
+ 3. Add mechanisms when they make behavior more reliable than prose.
154
+ 4. Make checks failable and evidence-based.
155
+ 5. Put gates at real transition boundaries: before mutation/side effects, after repeated failure, before completion, before persistence.
156
+ 6. Let the model choose HOW inside the contract.
157
+ 7. Treat workflow escape as a measured coverage gap, not convenience.
169
158
 
170
- The result should feel like an engineering co-pilot with good reflexes: autonomous where creativity matters, constrained where repeated mistakes are expensive, and explicit whenever evidence or applicability evaluation is needed.
159
+ The result should feel like a capable engineer operating inside explicit lifecycle obligations rather than either a scripted automaton or an unconstrained model that can skip its own process.