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
@@ -0,0 +1,109 @@
1
+ # Selected workflow runtime
2
+
3
+ The selected applicable topology is mandatory. This contract governs lifecycle
4
+ obligations; agents still choose tools, reasoning, and implementation inside it.
5
+ Skill suggestions require individual applicability evaluation, not one universal
6
+ skill sequence. Git mutation isolation and durable multi-agent workspace state
7
+ are separate concerns.
8
+
9
+ ## State and entry
10
+
11
+ `UserPromptSubmit` records `workflow-run.json` in the bound workspace's global
12
+ Harness session state. It includes a unique `workflowId`, complete plan, prompt
13
+ hash (no prompt text), revision count, and scoped exceptions. Unresolved work
14
+ survives follow-up/status prompts; a weaker route cannot erase it. A stronger
15
+ route blocks mutation until an explicit replan. A new task after `satisfied`
16
+ gets a new identity. Invalid recorded state fails closed with a diagnostic.
17
+
18
+ ```text
19
+ pending -> running -> satisfied
20
+ | (only after required evidence)
21
+ -> blocked -> start/replan (within budget)
22
+ ```
23
+
24
+ `blocked` is a reportable incomplete outcome, never successful completion.
25
+ `deferred` means no topology has been selected. Legacy `active`/`escaped` records
26
+ remain subject to isolation and cannot supply a correlated run implicitly.
27
+
28
+ For Fable, write a stage array in the exact `workflow-stages.json` path displayed
29
+ by the router. This one file is allowed as runtime bootstrap data before entry;
30
+ the exception does not authorize changing workflow state or source artifacts.
31
+ Use the [stage schema](../fable-mode/CONTRACT-FORMAT.md); each stage needs an
32
+ objective `checkCommand` and `passCondition`. If the plan requires independent
33
+ verification, declare a read-only `fable-verifier` stage depending on every
34
+ other stage. Then run the displayed controller with the host session id:
35
+
36
+ ```text
37
+ node "<hooks>/workflow-disposition.js" start --session-id "<session>"
38
+ ```
39
+
40
+ The controller prepares the existing Fable consumer's run at the **bound** state
41
+ root, even when tool execution has moved to a linked worktree. The run records
42
+ both `workflowId` and `sessionId`; matching only strategy or creation time is
43
+ insufficient. `start` creates contracts, not agents. Fable retains ownership of
44
+ worker dispatch, dependency/write-set scheduling, and synthesis.
45
+
46
+ ## Isolation boundary
47
+
48
+ Before Tier 3 or Fable source/artifact mutation, the gate verifies a registered
49
+ linked Git worktree with the same common Git directory as the bound repository.
50
+ It checks the tool's execution directory and actual Edit/Write/apply_patch paths,
51
+ including move destinations, relative traversal, and symlink/junction resolution.
52
+ Unknown direct targets, Git metadata, and nested repositories are rejected.
53
+ Read-only discovery and a literal `git worktree add` transition remain available
54
+ before entry. Prefer an already-ignored path or sibling path for setup; never
55
+ edit the primary tree's ignore file just to establish mandatory isolation.
56
+
57
+ Shell recognition is conservative: redirects, substitutions, chained commands,
58
+ and side-effect options are not accepted as read-only. Mutation-capable shell
59
+ execution requires an isolated working-directory field, with explicit outside
60
+ paths and directory changes rejected. **This is not a filesystem sandbox**:
61
+ arbitrary scripts, aliases/configuration, indirect variable paths, and races can
62
+ have effects a hook cannot infer. OS/host sandboxing is needed to contain them.
63
+ Agent-writable state is also not tamper-proof. These mechanisms prevent tested
64
+ bypasses; they do not establish durable containment against a malicious agent.
65
+
66
+ ## Escape, replan, and completion
67
+
68
+ Escape names one stage in the correlated run and records the uncovered scope,
69
+ evidence, and `workflow-uncovered-scope` or `host-capability-unavailable` reason:
70
+
71
+ ```text
72
+ node "<hooks>/workflow-disposition.js" escape --session-id "<session>" --stage-id "<stage>" --reason-code workflow-uncovered-scope --scope "<uncovered scope>" --evidence "<evidence>"
73
+ node "<hooks>/workflow-disposition.js" block --session-id "<session>" --evidence "<blocker>"
74
+ ```
75
+
76
+ An escape never resolves the whole run, waives isolation, or removes independent
77
+ verification. Covered stages remain mandatory. Unavailable required verification
78
+ means blocked. The controller permits the initial run plus the plan's
79
+ `maxRevisionRounds` replans; exhaustion stays blocked. Previous run evidence is
80
+ retained, but cannot satisfy a replacement run.
81
+
82
+ `contract-test.js` records exact check commands, observed worker/session identity,
83
+ numeric exit code, and run/plan/stage evidence. A failed check can recover on a
84
+ later observed pass. A dependent check cannot pass before its prerequisites.
85
+ Stop enumerates the manifest's expected stages, so deleting a contract does not
86
+ make the run complete. A `pass` label without matching exit-zero evidence fails.
87
+ The independent verifier must have a distinct observed identity and evidence
88
+ after the latest mutation/check. This proves attribution, not reasoning quality.
89
+
90
+ Unresolved Stop exits 2. If the host marks a Stop retry, the contract becomes
91
+ `blocked` with diagnostics instead of looping indefinitely or recording success.
92
+ Direct/iterative routes use observed edit/verification milestones; iteration
93
+ counting and semantic check quality remain executor obligations, not proven by
94
+ these gates. Broad verification-command recognition is a heuristic.
95
+
96
+ ## Host evidence
97
+
98
+ Claude's manifest carries the shell/direct-mutation and Stop hooks. The local
99
+ OpenAI package carries the same runtime for its declared `Bash|apply_patch`
100
+ surface. Package tests exercise both layouts. Missing worker/exit metadata keeps
101
+ Fable completion unresolved; it must be reported as degraded/blocked, not passed.
102
+ Manual CLI routing without a session cannot persist lifecycle state.
103
+
104
+ OpenCode and instruction-only/public Skills-only surfaces do not gain these
105
+ runtime gates from this change. An absent/disabled hook or deleted state cannot
106
+ be detected as an active contract by that same hook. No host compatibility status
107
+ is upgraded: see [platform capabilities](platform-capabilities.md). Live hook
108
+ loading, enforced host transitions, and behavioral improvement need separately
109
+ retained host traces and paired evaluations.
@@ -59,7 +59,9 @@ Rules:
59
59
 
60
60
  ## Workflow-plan consumer
61
61
 
62
- Before dispatch, write the router contract and stage array to files and run:
62
+ For a session with an active mandatory workflow, write the stage array to the router-displayed `workflow-stages.json` path and invoke its `workflow-disposition.js start --session-id <id>` command. This binds the run to the active `workflowId` and bound workspace even after entering a linked worktree. Every required stage needs an objective check, and an independent plan needs a read-only `fable-verifier` stage depending on all other stages. Stage results need observed worker identities and numeric exit codes; missing metadata is blocked/degraded, not success.
63
+
64
+ For standalone use without an active session contract, write the router contract and stage array to files and run:
63
65
 
64
66
  ```bash
65
67
  node fable-mode/scripts/workflow-plan-consumer.js \
@@ -4,7 +4,7 @@ description: "Stage large, multi-source or multi-session tasks through a written
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.4.0
7
+ version: 0.9.0
8
8
  ---
9
9
 
10
10
  # Fable Mode (v3)
@@ -53,9 +53,10 @@ overlap reject dispatch instead of becoming a verbal warning.
53
53
 
54
54
  The stage map remains a living orchestration document only inside those
55
55
  constraints. When new information invalidates it, re-plan and create revised
56
- stage contracts before dispatching new work. Replan budget: at most two full
57
- replans per run; a third means the task is ambiguous at the requirements level —
58
- return the ambiguity to the caller instead of burning stages. Scope rule:
56
+ stage contracts before dispatching new work. Replan budget comes from `workflowPlan.limits.maxReplans` and is accounted by
57
+ the runtime controller. Re-enter through `workflow-disposition.js start`; a
58
+ third full replan under the default budget is machine-blocked as
59
+ `replan-budget-exhausted` instead of being only an orchestration reminder. Scope rule:
59
60
  deliver the task as specified; new scope discovered mid-run is surfaced as a
60
61
  recommendation at delivery, not silently built.
61
62
 
@@ -75,10 +76,11 @@ spawn workers.
75
76
 
76
77
  For `fable-parallel`, spawn only stages in the same validated execution batch;
77
78
  never invent an additional parallel edge. A stage depending on another stage is
78
- not in the same ready batch. Cap concurrent workers at four — this remains
79
- Fable's single source of truth for the numeric worker cap. For other Fable
80
- strategies, serialize the returned batches unless a later validated plan says
81
- otherwise.
79
+ not in the same ready batch. Never exceed `workflowPlan.limits.maxWorkers`. The router plan is the numeric
80
+ source of truth; `workflow-plan-consumer.js` chunks ready sets to that cap and
81
+ runtime worker leases enforce it when the host exposes stable worker IDs. For
82
+ other Fable strategies, serialize the returned batches unless a later validated
83
+ plan says otherwise.
82
84
 
83
85
  **3. Verify with a check that can fail — external artifacts only.** Each stage
84
86
  defines a pass condition an external artifact satisfies: a test that runs, a file
@@ -7,7 +7,7 @@ description: >-
7
7
  license: Apache-2.0
8
8
  metadata:
9
9
  author: Miya Daniel
10
- version: 0.4.0
10
+ version: 0.9.0
11
11
  ---
12
12
 
13
13
  # Execution Guardrails
@@ -4,7 +4,7 @@ description: "Run staged fable work on Haiku for bulk mechanical tasks with expl
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.4.0
7
+ version: 0.9.0
8
8
  ---
9
9
 
10
10
  # Fable Mode — Haiku
@@ -4,7 +4,7 @@ description: "Run staged fable orchestration on Opus for cross-stage synthesis,
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.4.0
7
+ version: 0.9.0
8
8
  ---
9
9
 
10
10
  # Fable Mode — Opus
@@ -4,7 +4,7 @@ description: "Run staged fable work on Sonnet for non-trivial implementation, re
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.4.0
7
+ version: 0.9.0
8
8
  ---
9
9
 
10
10
  # Fable Mode — Sonnet
@@ -155,20 +155,23 @@ function validateParallelBatch(stages) {
155
155
  }
156
156
  }
157
157
 
158
- function dependencyBatches(stages, validateWrites) {
158
+ function dependencyBatches(stages, validateWrites, maxBatchSize = Infinity) {
159
159
  const byId = new Map(stages.map(stage => [stage.stageId, stage]));
160
160
  const remaining = new Set(byId.keys());
161
161
  const completed = new Set();
162
162
  const batches = [];
163
+ const boundedSize = Number.isInteger(maxBatchSize) && maxBatchSize > 0 ? maxBatchSize : Infinity;
163
164
 
164
165
  while (remaining.size > 0) {
165
166
  const ready = [...remaining]
166
167
  .filter(stageId => byId.get(stageId).dependsOn.every(dep => completed.has(dep)))
167
168
  .sort();
168
169
  if (ready.length === 0) throw new Error('unresolved or cyclic dependency graph');
169
- const batch = ready.map(stageId => byId.get(stageId));
170
- if (validateWrites) validateParallelBatch(batch);
171
- batches.push(batch.map(stage => stage.stageId));
170
+ const readyStages = ready.map(stageId => byId.get(stageId));
171
+ if (validateWrites) validateParallelBatch(readyStages);
172
+ for (let offset = 0; offset < readyStages.length; offset += boundedSize) {
173
+ batches.push(readyStages.slice(offset, offset + boundedSize).map(stage => stage.stageId));
174
+ }
172
175
  for (const stageId of ready) {
173
176
  remaining.delete(stageId);
174
177
  completed.add(stageId);
@@ -177,8 +180,8 @@ function dependencyBatches(stages, validateWrites) {
177
180
  return batches;
178
181
  }
179
182
 
180
- function topologicalBatches(stages) {
181
- return dependencyBatches(stages, true);
183
+ function topologicalBatches(stages, maxWorkers) {
184
+ return dependencyBatches(stages, true, maxWorkers);
182
185
  }
183
186
 
184
187
  function sequentialBatches(stages) {
@@ -209,7 +212,7 @@ function atomicWriteJson(filePath, value) {
209
212
  fs.renameSync(tempPath, filePath);
210
213
  }
211
214
 
212
- function prepareRun({ routerContract, stages, workspaceRoot, runId, sessionId = null }) {
215
+ function prepareRun({ routerContract, stages, workspaceRoot, runId, sessionId = null, workflowId = null }) {
213
216
  const plan = validateRouterPlan(routerContract);
214
217
  const normalizedStages = validateStageGraph(stages || []);
215
218
  if (normalizedStages.length === 0) throw new Error('at least one stage contract is required');
@@ -222,7 +225,7 @@ function prepareRun({ routerContract, stages, workspaceRoot, runId, sessionId =
222
225
  if (fs.existsSync(runRoot)) throw new Error(`runId already exists in this workspace: ${resolvedRunId}`);
223
226
 
224
227
  const batches = plan.strategy === 'fable-parallel'
225
- ? topologicalBatches(normalizedStages)
228
+ ? topologicalBatches(normalizedStages, plan.limits && plan.limits.maxWorkers)
226
229
  : sequentialBatches(normalizedStages);
227
230
 
228
231
  const createdAt = new Date().toISOString();
@@ -237,6 +240,7 @@ function prepareRun({ routerContract, stages, workspaceRoot, runId, sessionId =
237
240
  planId,
238
241
  runId: resolvedRunId,
239
242
  sessionId: sessionId || null,
243
+ workflowId,
240
244
  workspaceRoot: root,
241
245
  ...stage,
242
246
  workerId: null,
@@ -252,6 +256,7 @@ function prepareRun({ routerContract, stages, workspaceRoot, runId, sessionId =
252
256
  planId,
253
257
  runId: resolvedRunId,
254
258
  sessionId: sessionId || null,
259
+ workflowId,
255
260
  workspaceRoot: root,
256
261
  workspaceKey: getWorkspaceKey(root),
257
262
  strategy: plan.strategy,
@@ -4,7 +4,7 @@ description: "Route software/project work through the Harness kernel: classify T
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.8.0
7
+ version: 0.9.0
8
8
  ---
9
9
 
10
10
  # Harness Everything
@@ -12,26 +12,27 @@ metadata:
12
12
  Kernel routing entry.
13
13
 
14
14
  ## USE FOR:
15
- - Software/project triage, re-routing, and suggested-skill evaluation.
15
+ - Software/project triage, routing, re-routing, and workflow selection.
16
16
  - Work that names or matches another skill.
17
17
 
18
18
  ## DO NOT USE FOR:
19
19
  - General Q&A or non-software writing.
20
20
 
21
21
  ## Invariants
22
- 1. **Route before execution** — establish scope/tier.
22
+ 1. **Route before execution** — establish scope/tier and the smallest applicable workflow.
23
23
  2. **Verify before claim** — require objective evidence.
24
24
  3. **Re-plan on repetition** — after 3 same-signature failures, use `zoom-out`.
25
- 4. **Evaluate before skip** — read each suggested skill's complete `SKILL.md`.
26
-
27
- Tier guidance is not a fixed pipeline.
25
+ 4. **Evaluate before omission** — read each suggested skill's `SKILL.md` before deciding applicability.
26
+ 5. **Resolve selected workflow** — model confidence is not an escape condition.
28
27
 
29
28
  ## Workflow
30
29
  1. Reuse kernel output, or run `node "<this-skill-dir>/scripts/kernel-router.js" "<prompt summary>"`.
31
- 2. Make the **Harness Routing Checkpoint** user-visible.
32
- 3. For every suggestion, read its `SKILL.md`; evaluate `USE FOR`, `DO NOT USE FOR`, workflow/basic flow, and hard rules. Name, description, router summary, or "routine/common task" alone cannot justify skip. Read extra material only when explicitly required for applicability.
33
- 4. Execution is advisory after evaluation. Unreadable suggestions are `unresolved/unavailable`. Using one suggestion does not waive evaluation of others. If all are skipped, give one brief flow-grounded reason.
30
+ 2. Surface the **Harness Routing Checkpoint**.
31
+ 3. Read each suggested `SKILL.md`; evaluate `USE FOR`, `DO NOT USE FOR`, workflow/basic flow, and hard rules. "Simple", "routine", names, or summaries alone cannot justify omission.
32
+ 4. Execute the selected workflow topology to resolution. Suggested skills are conditional on applicability; the selected topology is not advisory.
33
+ 5. If the workflow genuinely cannot represent part of the task, use the explicit escape with uncovered scope + evidence. Covered obligations remain mandatory.
34
+ 6. Complete only after applicable workflow obligations and objective verification resolve.
34
35
 
35
- **Rule:** mandatory evaluation, advisory execution; no fixed workflow order.
36
+ **Rule:** mandatory applicable workflow; flexible reasoning/implementation inside it; evidence-backed escape only for uncovered scope.
36
37
 
37
38
  Deep dive: <this-skill-dir>/references/triage-and-tiers.md
@@ -1,8 +1,8 @@
1
1
  # Task Triage & Tier Details
2
2
 
3
- Harness uses tiers to estimate scope and surface useful capabilities. A tier is **not** a fixed pipeline. The runtime enforces a small set of cross-cutting invariants plus mandatory evaluation of router-suggested skills; execution choice, ordering, and delegation remain with the agent after that evaluation.
3
+ Harness uses tiers to estimate scope and select the smallest sufficient execution topology. A tier is **not** a fixed TODO/TDD/Fable pipeline. Once the router selects an applicable topology, however, that topology becomes the run's execution contract.
4
4
 
5
- > Architecture rule: **Do not enforce workflow order. Enforce workflow invariants and evaluate suggestions before skipping them.**
5
+ > Architecture rule: **Mandatory applicable workflow; flexible reasoning/implementation inside it; evidence-backed escape only for workflow-uncovered scope.**
6
6
 
7
7
  ## 0. When Harness Routing Applies
8
8
 
@@ -10,52 +10,51 @@ Harness uses tiers to estimate scope and surface useful capabilities. A tier is
10
10
  flowchart TD
11
11
  U([User Prompt]) --> S{Software / project work?}
12
12
  S -- No --> B[Bypass Harness<br/>Answer naturally]
13
- S -- Yes --> K[Harness Kernel<br/>classify scope + inject invariants]
14
- K --> T{Tier recommendation}
15
- T --> G{Suggested skills?}
16
- G -- Yes --> R[Read each suggested SKILL.md<br/>evaluate basic flow + applicability]
17
- G -- No --> C[Agent chooses smallest useful tactic]
18
- R --> C
19
- C --> E[Execute with agent-selected tactics]
20
- E --> V{Objective evidence supports completion?}
21
- V -- No --> D[Diagnose / iterate]
22
- D --> F{Same-signature failure x3?}
23
- F -- No --> E
24
- F -- Yes --> Z[Zoom out / re-plan]
25
- Z --> E
13
+ S -- Yes --> K[Harness Kernel<br/>classify + select topology]
14
+ K --> W{Workflow selected?}
15
+ W -- No / deferred --> D[Preserve invariants<br/>choose smallest justified workflow]
16
+ W -- Yes --> A[ACTIVE workflow contract]
17
+ A --> G{Suggested skills?}
18
+ G -- Yes --> R[Read each suggested SKILL.md<br/>resolve applicability]
19
+ G -- No --> E[Execute selected workflow]
20
+ R --> E
21
+ E --> V{Required checks / stages resolved?}
26
22
  V -- Yes --> O([Claim completion])
23
+ V -- No --> P[Diagnose / re-plan]
24
+ P --> X{Workflow covers next step?}
25
+ X -- Yes --> E
26
+ X -- No --> C[Record evidence-backed escape<br/>for uncovered scope only]
27
27
  ```
28
28
 
29
29
  ### Bypass Rules
30
30
 
31
31
  - **Pure chat, translation, general web search, non-software writing:** bypass Harness routing.
32
- - **Software engineering / codebase / project work:** establish the Harness Kernel contract before mutating work, even when the prompt already names a domain skill such as `tdd`, `security-review`, or `repo-docs`.
32
+ - **Software engineering / codebase / project work:** establish the Harness Kernel contract before mutation, even when the prompt already names a domain skill.
33
33
 
34
- A host may auto-select a peer/domain skill. That selection must not be treated as proof that Harness routing already happened.
34
+ Host skill selection is not proof that Harness routing already happened.
35
35
 
36
- ## 1. The Minimal Harness Kernel
36
+ ## 1. Minimal Kernel Contract
37
37
 
38
- The kernel exists to keep strong models free while protecting the few behaviors that should not disappear under autonomous skill selection.
38
+ The kernel protects lifecycle obligations without micromanaging model reasoning.
39
39
 
40
40
  ### Mandatory invariants
41
41
 
42
- 1. **Route before execution** — establish task scope/tier before mutating software work.
43
- 2. **Verify before claim** — completion claims require objective evidence appropriate to the change.
42
+ 1. **Route before execution** — establish task scope/tier and the smallest justified topology.
43
+ 2. **Verify before claim** — completion requires objective evidence appropriate to the change.
44
44
  3. **Re-plan on repetition** — after three same-signature failures, stop micro-retrying and use a fresh diagnosis / `zoom-out`.
45
- 4. **Evaluate before skip** — when the router suggests a skill, read that skill's complete `SKILL.md` entry/basic flow before omitting it.
45
+ 4. **Evaluate before omission** — when the router suggests a skill, read its complete `SKILL.md` entry/basic flow before deciding applicability.
46
+ 5. **Resolve selected workflow** — once a topology is selected, execute it to a resolved state; "simple", "routine", "already clear", or model confidence are not escape conditions.
46
47
 
47
- The fourth invariant is conditional: it applies when the router emits one or more suggestions. It makes **evaluation mandatory, not execution**.
48
+ The model remains free to choose tools, implementation technique, decomposition details, and reasoning inside the workflow.
48
49
 
49
50
  ### What is intentionally *not* mandatory
50
51
 
51
- - Executing `todo-driven-workflow` for every Tier 2/3 task after its applicability has been evaluated.
52
- - Running TDD where the `tdd` flow has been read and executable behavioral tests do not add value.
53
- - Entering Fable/multi-agent mode merely because the task is Tier 3 after those suggested flows have been evaluated.
54
- - Following a universal `TODO → TDD → verification-loop` or `Fable → subagent → verification-loop` sequence.
55
- - Loading `install-cognitive-os` as a peer skill before every other skill.
56
- - Reading every optional deep-dive/reference linked by a suggested skill. Only material the skill entry explicitly requires to decide applicability joins the mandatory evaluation set.
52
+ - One universal `TODO → TDD → verification-loop` sequence for every Tier 2/3 task.
53
+ - Multi-agent execution merely because a task is Tier 3.
54
+ - Every router-suggested skill when its evaluated flow is objectively not applicable.
55
+ - Every optional deep-dive/reference linked from a skill.
57
56
 
58
- `install-cognitive-os` remains the human-readable/manual entry point for the cognitive policy. Supported runtime integrations should establish the kernel invariants without depending on that skill being selected first.
57
+ A suggested skill may resolve as `use`, `not-applicable`, or `unresolved/unavailable`. `not-applicable` needs a flow-grounded reason; a metadata-only or confidence-only judgement is insufficient. The selected **topology** is different: it is mandatory after selection unless an explicit workflow escape records genuinely uncovered scope plus evidence.
59
58
 
60
59
  ## 2. Routing Mechanism
61
60
 
@@ -63,100 +62,67 @@ Use the public kernel entry point:
63
62
 
64
63
  ```bash
65
64
  node "<this-skill-dir>/scripts/kernel-router.js" "<brief prompt summary>"
65
+ # or
66
+ npx github:dyphn1/Harness-everything next "<brief prompt summary>"
66
67
  ```
67
68
 
68
- or:
69
+ `kernel-router.js` delegates classification/guide discovery to `tier-router.js` and emits:
69
70
 
70
- ```bash
71
- npx github:dyphn1/Harness-everything next "<brief prompt summary>"
72
- ```
71
+ - recommended tier + rationale,
72
+ - structured workflow plan,
73
+ - compact **Harness Routing Checkpoint**,
74
+ - required invariants,
75
+ - suggested skills whose applicability must be evaluated,
76
+ - **Workflow Execution Contract** for the selected topology.
73
77
 
74
- `kernel-router.js` delegates classification and guide discovery to `tier-router.js`, removes legacy fixed-pipeline instructions, and emits:
78
+ If `UserPromptSubmit` already ran the kernel this turn, reuse that output. Do not infer a silent Tier 1/direct path from missing or degraded routing.
75
79
 
76
- - the recommended tier and rationale,
77
- - a compact **Harness Routing Checkpoint**,
78
- - the **required Harness invariants**,
79
- - suggested skills under a **mandatory evaluation / advisory execution** contract,
80
- - the policy that the agent may choose the smallest useful skill/tool set after evaluating suggestions.
80
+ ### Suggestion applicability contract
81
81
 
82
- If a host's `UserPromptSubmit` integration already ran the kernel this turn, reuse that output rather than running it twice. The checkpoint must still become user-visible for software/project work: use the host's visible hook rendering when it has one, otherwise include the checkpoint in the first progress/update message.
82
+ For every router-suggested skill:
83
83
 
84
- The tier classifier is heuristic. Treat its result as the default route, not an oracle. A clear task reading or explicit user instruction may override it; record the reason when doing so.
84
+ 1. Read the complete `SKILL.md` entry.
85
+ 2. Evaluate `USE FOR`, `DO NOT USE FOR`, workflow/basic flow, and hard rules.
86
+ 3. Read extra material only when the entry explicitly requires it to decide applicability.
87
+ 4. Resolve the suggestion as `use`, `not-applicable`, or `unresolved/unavailable`.
85
88
 
86
- ### Suggestion evaluation contract
89
+ A name, description, router summary, tier label, or generic "routine/common task" judgement is not enough to mark a suggestion not applicable. Using one suggestion does not resolve the others automatically.
87
90
 
88
- For every router-suggested skill:
91
+ ### Workflow escape contract
92
+
93
+ Escape is an exception path, not an alternative default. Use it only when the selected topology genuinely cannot represent part of the task. The permitted reason codes are:
89
94
 
90
- 1. Resolve and read the complete `SKILL.md` entry.
91
- 2. Evaluate `USE FOR`, `DO NOT USE FOR`, its workflow/basic flow, and any hard rules in the entry against the current task.
92
- 3. If the entry explicitly requires another document to determine applicability, read that required material too. Ordinary deep-dive/reference links remain optional unless the entry makes them decision-critical.
93
- 4. Only then choose `use`, `skip`, or `unresolved/unavailable`.
95
+ - `workflow-uncovered-scope` — the selected topology cannot represent a bounded part of the task;
96
+ - `host-capability-unavailable` — the host lacks a capability required to execute the selected topology.
94
97
 
95
- A skill must not be skipped from only its name, frontmatter description, router summary, or a generic judgement such as “routine/common task.” Using one suggested skill does not waive evaluation of the other suggestions before they are skipped. A suggestion that cannot be resolved/read is not a valid skip; mark it `unresolved/unavailable`.
98
+ Every escape must name a declared stage in the correlated run and record the reason code, uncovered scope, and evidence explaining the coverage/capability gap. The entire workflow never becomes escaped; isolation and independent verification cannot be waived. Covered workflow obligations remain mandatory. Host capability loss must be visible as degradation/blocked/escape evidence, never silently converted into optional execution.
96
99
 
97
100
  ## 3. Tier Guidance
98
101
 
99
102
  ### Tier 1 — Trivial
100
103
 
101
- Typical shape:
102
- - typo/small documentation correction,
103
- - simple local code edit,
104
- - narrow explanation,
105
- - straightforward Git operation.
104
+ Typical shape: typo/small docs correction, narrow local edit, bounded explanation, straightforward Git operation.
106
105
 
107
- Default behavior:
108
- - prefer direct execution,
109
- - avoid large plans and unnecessary delegation,
110
- - when the router emits no suggestions, proceed with the bounded direct path,
111
- - when it does emit a focused suggestion, evaluate that skill entry before omitting it,
112
- - still verify any completion claim with evidence appropriate to the change.
106
+ Default topology is normally `direct-single`. Keep the lifecycle minimal, but still satisfy applicable scope/safety/verification obligations.
113
107
 
114
108
  ### Tier 2 — Standard
115
109
 
116
- Typical shape:
117
- - a specific feature or bug fix,
118
- - multi-file coordination,
119
- - behavioral changes needing tests,
120
- - focused benchmark/review work.
110
+ Typical shape: specific feature/bug fix, multi-file coordination, behavioral change, focused benchmark/review.
121
111
 
122
- Common **suggestions**, not a pipeline:
112
+ The router normally selects `iterative-single`: bounded reason/act work plus objective verification. It may surface `tdd`, `verification-loop`, `security-review`, `using-git-worktrees`, or other focused skills. Those suggestions are applicability decisions, not a universal sequence.
123
113
 
124
- | Need observed in the task | Useful skill |
125
- |---|---|
126
- | Several verifiable steps need explicit tracking | `todo-driven-workflow` |
127
- | Behavior can be specified by executable tests | `tdd` |
128
- | Delivery needs systematic build/lint/test/diff evidence | `verification-loop` |
129
- | Auth/input/secrets/network boundaries are touched | `security-review` |
130
- | Isolated workspace would reduce risk | `using-git-worktrees` |
131
- | Quantitative scoring/benchmarking is requested | `eval-harness` |
132
-
133
- Every emitted suggestion is mandatory to **evaluate** by reading its skill entry/basic flow. After that, the model decides which skills are useful and in what order; it may execute none, one, or several while preserving the kernel invariants. Adopting one suggestion does not permit the others to be skipped without evaluation. If every suggestion is skipped after evaluation, the visible checkpoint/progress update must include one brief reason grounded in the evaluated flow mismatch.
114
+ When an evaluated skill is applicable, follow its workflow rather than reading it and then discarding it because the implementation seems obvious.
134
115
 
135
116
  ### Tier 3 — Macro
136
117
 
137
- Typical shape:
138
- - repository-wide or architectural changes,
139
- - large ambiguous requirements,
140
- - broad documentation/system design,
141
- - work where deliberate delegation may reduce risk or improve coverage.
142
-
143
- Common **suggestions**, not a pipeline:
118
+ Typical shape: repository-wide/architectural work, large ambiguous requirements, cross-source synthesis, or bounded delegation.
144
119
 
145
- | Need observed in the task | Useful skill |
146
- |---|---|
147
- | Deliberate macro planning / model-mode selection | `fable-mode`, `fable-discipline` |
148
- | Bounded parallel delegation genuinely helps | `multi-agent-workspace` |
149
- | Project-level docs need creation/update | `repo-docs` |
150
- | Important decisions need challenge before implementation | `grill-with-docs` |
151
- | Settled intent needs a spec | `to-spec` |
152
- | Settled work needs tracer-bullet issues | `to-tickets` |
120
+ The router may select `fable-staged`, `fable-parallel`, or `fable-multi-agent-workspace`. A selected Fable topology is not advisory: enter its stage-contract lifecycle, honor dependency/write-set constraints, run objective checks, synthesize, cold-verify where required, and use bounded re-planning on failure.
153
121
 
154
- Tier 3 does **not** automatically require multi-agent execution. It does require evaluation of the suggested entries before omission. A strong model may still complete macro work directly when, after reading those flows, direct execution is the safer/smaller choice. The same evaluated all-skipped rationale rule applies.
122
+ Tier 3 does **not** automatically mean multi-agent; the router still chooses the smallest sufficient topology.
155
123
 
156
124
  ## 4. Cognitive OS Relationship
157
125
 
158
- The cognitive loop remains useful:
159
-
160
126
  ```mermaid
161
127
  flowchart LR
162
128
  D[Discover] --> T[Think]
@@ -168,39 +134,42 @@ flowchart LR
168
134
  Z --> T
169
135
  ```
170
136
 
171
- But this diagram describes a reasoning policy, not a peer-skill dependency graph. Domain skills may implement their own local phases and gates. They do not need to invoke `install-cognitive-os` first as long as the Harness invariants remain satisfied.
137
+ This describes a reasoning policy. The workflow contract governs lifecycle obligations; domain skills may define their own local phases inside it.
172
138
 
173
139
  ## 5. Host Integration and Enforcement Strength
174
140
 
175
141
  | Host mode | Expected behavior |
176
142
  |---|---|
177
- | Lifecycle hook available | Run the Harness Kernel on prompt submission so routing context exists before domain-skill execution. Surface the emitted checkpoint through a host-visible hook surface when supported; otherwise the agent carries it into the first visible progress/update. Suggested-skill execution stays agent-controlled, but each suggested skill must be evaluated before omission. Hard gates may enforce supported invariants at tool/stop boundaries. |
178
- | Advisory instructions only | Tell the agent to run/reuse `harness next` before software mutation, surface the checkpoint, read/evaluate each suggested skill before skipping it, and run `harness verify` before completion. The behavior is instruction-governed, not a hard host gate. |
179
- | Manual use | Invoke `harness-everything` or `install-cognitive-os` explicitly to inspect/re-establish and surface the contract; suggested skills still follow read-before-skip. |
143
+ | Lifecycle hooks available | Kernel creates the selected workflow contract. Supported PreToolUse/Stop gates may mechanically prevent known bypasses. |
144
+ | Advisory instructions only | Agent is instructed to establish and resolve the same contract, but the host cannot be described as mechanically enforcing it. |
145
+ | Manual use | Invoke `harness-everything` / `harness next`, then execute the selected topology explicitly. |
146
+
147
+ On Claude and the local OpenAI package, supported mutation hooks require Fable entry and Tier 3/Fable Git worktree isolation. Follow-up prompts preserve unresolved state. The router displays a session `workflow-stages.json` path and `workflow-disposition.js start` command; declare stages there before entry. Stop checks expected stage contracts plus correlated exit-zero/worker evidence. A retry records `blocked`, never false success. Direct/patch paths and explicit shell targets are checked, but arbitrary scripts are not sandboxed. Other selected topologies still rely on their applicable mechanisms (for example objective verification/stop gates) and shared contract text.
180
148
 
181
- Never describe an advisory integration as hard enforcement. Platform-specific adapters may differ while preserving functional intent. Kernel emission alone is not proof that a host UI displayed the checkpoint or that the host compelled the model to read a suggested skill; #82 live evidence owns those claims.
149
+ Never turn mechanism/package evidence into a cross-host live-enforcement claim. #82 owns host-specific retained evidence.
182
150
 
183
151
  ## 6. Routing Checkpoint
184
152
 
185
- For software/project work, the kernel always emits a compact checkpoint and the execution surface must make it user-visible before or with the first progress update:
153
+ For software/project work, surface this state before or with the first progress update:
186
154
 
187
155
  ```markdown
188
156
  ## 🚦 Harness Routing Checkpoint
189
157
  - Tier: Tier X — <reason>
190
158
  - Strategy: <selected/deferred strategy>
191
- - Required invariants: route-before-execution; verify-before-claim; re-plan-after-3-same-failures; evaluate-suggestions-before-skip (when suggestions exist)
192
- - Suggested skills: <deduplicated suggestions, or none>
193
- - Suggestion evaluation: <required before skip | no suggestions>
194
- - Suggestion disposition: <using one or more | skipped all after evaluation — brief reason | unresolved/unavailable>
159
+ - Workflow state: <pending | running | satisfied | deferred | blocked>
160
+ - Required invariants: <router invariants>
161
+ - Suggested skills: <deduplicated suggestions or none>
162
+ - Suggestion applicability: <use | not-applicable + reason | unresolved/unavailable>
163
+ - Escape: <none | reason + uncovered scope + evidence>
195
164
  ```
196
165
 
197
- The checkpoint reports state; it does not prescribe a universal workflow. Suggested skills are **mandatory to evaluate and advisory to execute**. A non-empty suggestion set cannot disappear silently or be rejected from summaries alone. When every suggestion is skipped after evaluation, state one brief reason grounded in the evaluated flows. When at least one is used, no prose explanation is required for each other omission, but read-before-skip still applies to every omitted suggestion.
166
+ The checkpoint is state, not a universal response template. The key distinction is: **skill suggestions are evaluated for applicability; a selected workflow topology is executed to resolution.**
198
167
 
199
168
  ## 7. Self-Healing and Dynamic Skills
200
169
 
201
- Existing self-heal, generated-skill discovery, knowledge-guide matching, and fact-audit behavior remain part of the classifier/runtime. They may recommend resources; recommendations trigger mandatory applicability evaluation, not automatic execution or mandatory pipeline stages.
170
+ Self-heal, generated-skill discovery, knowledge-guide matching, and fact-audit behavior remain part of the runtime. Dynamic recommendations still require applicability evaluation.
202
171
 
203
- If bootstrap reports missing integration touchpoints, use the existing self-heal command:
172
+ If bootstrap reports missing integration touchpoints:
204
173
 
205
174
  ```bash
206
175
  node "<this-skill-dir>/scripts/self-heal.js"