harness-everything 0.55.2 → 0.55.4

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 (177) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/AGENTS.md +1 -1
  4. package/BENCHMARK_SOP.md +2 -2
  5. package/CHANGELOG.md +22 -0
  6. package/README.md +15 -16
  7. package/SECURITY.md +1 -1
  8. package/VERIFICATION.md +4 -8
  9. package/behavioral-evals/PAIRED-BENCHMARK.md +12 -27
  10. package/behavioral-evals/README.md +21 -65
  11. package/behavioral-evals/cases/breaker-zoom-out-after-3.yaml +26 -33
  12. package/behavioral-evals/cases/pressure-sunk-cost-retry.yaml +15 -17
  13. package/behavioral-evals/paired-benchmark.js +3 -40
  14. package/behavioral-evals/run.js +2 -3
  15. package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/legacy-off-golden.json +0 -6
  16. package/ci/invariant-routing.test.js +32 -6
  17. package/ci/lib/opencode-verification-loader.js +3 -5
  18. package/ci/mechanism-2a-rule-of-3.test.js +111 -97
  19. package/ci/mechanism-2n-opencode-plugin.test.js +68 -206
  20. package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +47 -28
  21. package/ci/mechanism-2w-platform-compatibility.test.js +1 -0
  22. package/ci/mechanism-32-paired-benchmark.test.js +1 -2
  23. package/ci/mechanism-33-issues-205-207.test.js +1 -1
  24. package/ci/mechanism-338-opencode-async.test.js +18 -49
  25. package/ci/mechanism-36-verify-timeout.test.js +3 -189
  26. package/ci/mechanism-39-opencode-verify-outcomes.test.js +56 -323
  27. package/ci/mechanism-397-opencode-observations.test.js +64 -9
  28. package/ci/mechanism-check-packet-write-set.test.js +163 -8
  29. package/ci/mechanism-codex-hook-results.test.js +9 -5
  30. package/ci/mechanism-prb-outline-review.test.js +1 -13
  31. package/ci/mechanism-system-one-router.test.js +1 -1
  32. package/ci/openai-plugin-package.test.js +30 -7
  33. package/ci/openai-plugin-runtime.test.js +64 -32
  34. package/ci/prompt-contract-regressions.test.js +1 -5
  35. package/ci/router-workflow-plan.test.js +8 -8
  36. package/ci/self-evolve-loop.test.js +51 -51
  37. package/ci/workflow-execution-contract.test.js +3 -6
  38. package/code-review/SKILL.md +1 -1
  39. package/code-review/templates/finding.template.md +17 -1
  40. package/docker-verify.sh +1 -117
  41. package/docs/architecture.md +9 -7
  42. package/docs/document-lifecycle.md +1 -1
  43. package/docs/enforcement-locks.md +12 -10
  44. package/docs/mechanism-first-skill-mesh.md +2 -2
  45. package/docs/openai-plugin.md +3 -3
  46. package/docs/philosophy.md +1 -1
  47. package/docs/platform-capabilities.md +4 -3
  48. package/docs/platform-compatibility.json +2 -2
  49. package/docs/reflection.md +1 -1
  50. package/docs/routing.md +2 -2
  51. package/docs/system-one-suggestion-gates.md +4 -4
  52. package/docs/troubleshooting.md +9 -35
  53. package/docs/workflow-runtime.md +19 -18
  54. package/docs/workflows/environment-detection.md +11 -9
  55. package/docs/workflows/fable-discipline.md +6 -5
  56. package/docs/workflows/fable-mode.md +6 -5
  57. package/docs/workflows/harness-everything.md +5 -5
  58. package/docs/workflows/improve-codebase-architecture.md +10 -8
  59. package/docs/workflows/install-cognitive-os.md +5 -5
  60. package/docs/workflows/tdd.md +9 -9
  61. package/docs/workflows/zoom-out.md +20 -30
  62. package/environment-detection/SKILL.md +2 -2
  63. package/environment-detection/references/shell-syntax-rules.md +1 -1
  64. package/eval-harness/SKILL.md +1 -1
  65. package/eval-harness/references/scoring-rubric.md +3 -3
  66. package/evals/zoom-out/eval.yaml +2 -2
  67. package/evals/zoom-out/tasks/negative-productive-iteration.yaml +15 -0
  68. package/evals/zoom-out/tasks/negative-trivial-edit.yaml +6 -6
  69. package/evals/zoom-out/tasks/positive-first-failure.yaml +15 -0
  70. package/evals/zoom-out/tasks/positive-repair-loop.yaml +1 -1
  71. package/fable-discipline/SKILL.md +3 -3
  72. package/fable-discipline/references/discipline-rules.md +1 -1
  73. package/fable-mode/SKILL.md +1 -1
  74. package/fable-mode/execution-guardrails/SKILL.md +2 -4
  75. package/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
  76. package/fable-mode/fable-haiku/SKILL.md +1 -1
  77. package/fable-mode/fable-opus/SKILL.md +2 -2
  78. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  79. package/fable-mode/references/execution-phases.md +2 -2
  80. package/harness-everything/SKILL.md +3 -3
  81. package/harness-everything/references/router-workflow-plan.md +2 -2
  82. package/harness-everything/references/skill-registry.md +2 -2
  83. package/harness-everything/references/triage-and-tiers.md +5 -5
  84. package/harness-everything/scripts/bootstrap.js +1 -26
  85. package/harness-everything/scripts/kernel-router-core.js +2 -3
  86. package/harness-everything/scripts/kernel-router.js +1 -1
  87. package/harness-everything/scripts/router-contract-core.js +1 -1
  88. package/harness-everything/scripts/routing-keywords.json +0 -2
  89. package/hooks/hooks.json +0 -33
  90. package/hooks/scripts/lib/harness-state.js +5 -6
  91. package/hooks/scripts/lib/learning-opportunity.js +3 -13
  92. package/hooks/scripts/openai-session-start.js +2 -4
  93. package/improve-codebase-architecture/SKILL.md +3 -3
  94. package/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
  95. package/install-cognitive-os/SKILL.md +3 -3
  96. package/opencode-plugin/README.md +18 -43
  97. package/opencode-plugin/index.mjs +52 -380
  98. package/opencode-plugin/plugin.json +1 -1
  99. package/package.json +1 -4
  100. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  101. package/plugins/harness-everything/hooks/hooks.json +0 -14
  102. package/plugins/harness-everything/hooks/scripts/lib/harness-state.js +5 -6
  103. package/plugins/harness-everything/hooks/scripts/lib/learning-opportunity.js +3 -13
  104. package/plugins/harness-everything/hooks/scripts/lib/workspace.js +2 -2
  105. package/plugins/harness-everything/hooks/scripts/openai-session-start.js +2 -4
  106. package/plugins/harness-everything/hooks/session-start.js +2 -4
  107. package/plugins/harness-everything/plugin.json +1 -1
  108. package/plugins/harness-everything/scripts/lib/advisory-text.js +2 -2
  109. package/plugins/harness-everything/scripts/lib/workspace.js +2 -2
  110. package/plugins/harness-everything/skills/code-review/SKILL.md +1 -1
  111. package/plugins/harness-everything/skills/code-review/templates/finding.template.md +17 -1
  112. package/plugins/harness-everything/skills/environment-detection/SKILL.md +2 -2
  113. package/plugins/harness-everything/skills/environment-detection/references/shell-syntax-rules.md +1 -1
  114. package/plugins/harness-everything/skills/eval-harness/SKILL.md +1 -1
  115. package/plugins/harness-everything/skills/eval-harness/references/scoring-rubric.md +3 -3
  116. package/plugins/harness-everything/skills/fable-discipline/SKILL.md +3 -3
  117. package/plugins/harness-everything/skills/fable-discipline/references/discipline-rules.md +1 -1
  118. package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
  119. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +2 -4
  120. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
  121. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  122. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +2 -2
  123. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  124. package/plugins/harness-everything/skills/fable-mode/references/execution-phases.md +2 -2
  125. package/plugins/harness-everything/skills/harness-everything/SKILL.md +3 -3
  126. package/plugins/harness-everything/skills/harness-everything/references/router-workflow-plan.md +2 -2
  127. package/plugins/harness-everything/skills/harness-everything/references/skill-registry.md +2 -2
  128. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +5 -5
  129. package/plugins/harness-everything/skills/harness-everything/scripts/bootstrap.js +1 -26
  130. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +2 -3
  131. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +1 -1
  132. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +1 -1
  133. package/plugins/harness-everything/skills/harness-everything/scripts/routing-keywords.json +0 -2
  134. package/plugins/harness-everything/skills/improve-codebase-architecture/SKILL.md +3 -3
  135. package/plugins/harness-everything/skills/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
  136. package/plugins/harness-everything/skills/install-cognitive-os/SKILL.md +3 -3
  137. package/plugins/harness-everything/skills/self-evolve/SKILL.md +1 -1
  138. package/plugins/harness-everything/skills/self-evolve/references/memory-resolution.md +3 -3
  139. package/plugins/harness-everything/skills/self-evolve/schemas/lesson-candidate.schema.json +4 -1
  140. package/plugins/harness-everything/skills/self-evolve/scripts/lesson-candidate.js +1 -0
  141. package/plugins/harness-everything/skills/skill-creator/SKILL.md +1 -1
  142. package/plugins/harness-everything/skills/skill-creator/references/quality-checklist.md +1 -1
  143. package/plugins/harness-everything/skills/skill-creator/references/quality-principles.md +4 -4
  144. package/plugins/harness-everything/skills/tdd/SKILL.md +2 -2
  145. package/plugins/harness-everything/skills/tdd/references/core-discipline.md +3 -5
  146. package/plugins/harness-everything/skills/todo-driven-workflow/SKILL.md +2 -2
  147. package/plugins/harness-everything/skills/zoom-out/SKILL.md +14 -26
  148. package/plugins/harness-everything/skills/zoom-out/references/circuit-breaker.md +18 -62
  149. package/references/platform-advisory-template.md +3 -9
  150. package/sbom.cdx.json +7 -7
  151. package/scripts/check-packet-write-set.js +76 -1
  152. package/scripts/lib/advisory-text.js +2 -2
  153. package/scripts/lib/workspace.js +2 -2
  154. package/self-evolve/SKILL.md +1 -1
  155. package/self-evolve/references/memory-resolution.md +3 -3
  156. package/self-evolve/schemas/lesson-candidate.schema.json +4 -1
  157. package/self-evolve/scripts/lesson-candidate.js +1 -0
  158. package/skill-creator/SKILL.md +1 -1
  159. package/skill-creator/references/quality-checklist.md +1 -1
  160. package/skill-creator/references/quality-principles.md +4 -4
  161. package/submission/openai/test-cases.json +5 -5
  162. package/tdd/SKILL.md +2 -2
  163. package/tdd/references/core-discipline.md +3 -5
  164. package/todo-driven-workflow/SKILL.md +2 -2
  165. package/zoom-out/SKILL.md +14 -26
  166. package/zoom-out/references/circuit-breaker.md +18 -62
  167. package/behavioral-evals/opencode-hardlock-live.js +0 -17
  168. package/behavioral-evals/opencode-reflection-gate-live.js +0 -342
  169. package/ci/mechanism-31-opencode-hardlock-evidence.test.js +0 -82
  170. package/evals/zoom-out/tasks/negative-first-edge-case-review.yaml +0 -16
  171. package/evals/zoom-out/tasks/positive-repeated-failure.yaml +0 -15
  172. package/hooks/scripts/reset-circuit-breaker.js +0 -30
  173. package/hooks/scripts/rule-of-3-tracker.js +0 -165
  174. package/hooks/scripts/rule-of-3.js +0 -171
  175. package/plugins/harness-everything/hooks/scripts/reset-circuit-breaker.js +0 -30
  176. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +0 -165
  177. package/plugins/harness-everything/hooks/scripts/rule-of-3.js +0 -171
@@ -61,54 +61,61 @@ const { buildReport } = require(path.join(ROOT, 'telemetry/scripts/report.js'));
61
61
  console.log('=== #141 Self-Evolve Closed Loop Phase 1-4 Mechanism ===');
62
62
 
63
63
  try {
64
- const tracker = path.join(ROOT, 'hooks/scripts/rule-of-3-tracker.js');
65
64
  const ruleSession = 'lesson-rule-session';
66
65
  const ruleSessionDir = getSessionDir(workspace, ruleSession);
67
- fs.writeFileSync(path.join(ruleSessionDir, 'rule-of-3-state.json'), JSON.stringify({
68
- count: 0,
69
- lastHash: '0123456789abcdef0123456789abcdef',
70
- category: 'test',
71
- threshold: 3,
72
- zoomOutResolved: true,
73
- zoomOutCycles: 1,
74
- lastFailureAt: 1700000000000,
66
+ const legacyCandidateId = `lesson-${'a'.repeat(24)}`;
67
+ const candidateDir = path.join(ruleSessionDir, 'learning-candidates');
68
+ const timestamp = new Date().toISOString();
69
+ fs.mkdirSync(candidateDir, { recursive: true });
70
+ fs.writeFileSync(path.join(candidateDir, `${legacyCandidateId}.json`), JSON.stringify({
71
+ schemaVersion: 1,
72
+ candidateId: legacyCandidateId,
73
+ contentHash: null,
74
+ state: 'proposed',
75
+ trigger: {
76
+ type: 'rule-of-3-recovery',
77
+ reasonCodes: ['repeated-failure', 'zoom-out-completed', 'verified-subsequent-success'],
78
+ sourceEventIds: ['legacy-trip', 'legacy-success'],
79
+ evidenceClass: 'runtime-recovery',
80
+ },
81
+ provenance: { sessionId: ruleSession, workflowId: null, runId: null, strategy: null },
82
+ evidence: { failureSignature: 'legacy-signature', failureCategory: 'test', zoomOutCycles: 1, recovered: true },
83
+ generalizedRule: null,
84
+ scope: { task: null, requirement: null, role: null },
85
+ screening: null,
86
+ evaluation: null,
87
+ persistence: null,
88
+ outcome: null,
89
+ history: [],
90
+ createdAt: timestamp,
91
+ updatedAt: timestamp,
75
92
  }, null, 2));
76
-
77
- const recovered = run(tracker, {
78
- hook_event_name: 'PostToolUse',
79
- tool_name: 'Bash',
80
- tool_use_id: 'recovery-tool-1',
81
- session_id: ruleSession,
82
- cwd: workspace,
83
- tool_input: { command: 'node secret-command-should-not-be-retained.js' },
84
- tool_response: { exitCode: 0, stdout: 'SECRET_OUTPUT_SHOULD_NOT_BE_RETAINED' },
85
- });
86
- check(recovered.status === 0, 'Rule-of-3 recovery tracker stays non-blocking', recovered.stderr);
87
-
88
- const ruleCandidates = listCandidates({ workspace, sessionId: ruleSession });
89
- check(ruleCandidates.length === 1, 'zoom-out followed by confirmed success emits one lesson candidate');
90
- const ruleCandidate = ruleCandidates[0];
91
- check(ruleCandidate.state === 'proposed' && ruleCandidate.trigger.type === 'rule-of-3-recovery', 'runtime recovery enters observed -> proposed lifecycle');
92
- const serializedRule = JSON.stringify(ruleCandidate);
93
- check(!serializedRule.includes('secret-command-should-not-be-retained') && !serializedRule.includes('SECRET_OUTPUT_SHOULD_NOT_BE_RETAINED'), 'runtime candidate excludes raw command/output contents');
94
- check(!fs.existsSync(path.join(workspace, 'memories', 'repo')), 'automatic opportunity detection never mutates durable memory');
95
-
96
- const ruleEvaluation = evaluateCandidate({
93
+ const legacyCandidate = loadCandidate({ workspace, sessionId: ruleSession, candidateId: legacyCandidateId }).candidate;
94
+ check(legacyCandidate.trigger.type === 'rule-of-3-recovery', 'historical recovery candidate remains readable');
95
+ const legacyEvaluation = evaluateCandidate({
97
96
  workspace,
98
97
  sessionId: ruleSession,
99
- candidateId: ruleCandidate.candidateId,
98
+ candidateId: legacyCandidateId,
100
99
  rule: 'Always verify recovery.test.js after changing retry strategy',
101
100
  scopeTask: 'retry recovery',
102
101
  scopeRole: 'coordinator',
103
102
  }).candidate;
104
- check(ruleEvaluation.state === 'inconclusive', 'Rule-of-3 linear recovery is not misrepresented as counterfactual replay');
105
- check(ruleEvaluation.evaluation.replayable === false && ruleEvaluation.evaluation.improvementClaim === false, 'non-replayable candidate requires paired/later evidence and makes no improvement claim');
103
+ check(legacyEvaluation.state === 'inconclusive', 'historical linear recovery remains non-replayable');
104
+ check(legacyEvaluation.evaluation.replayable === false && legacyEvaluation.evaluation.improvementClaim === false,
105
+ 'historical recovery cannot claim counterfactual replay or improvement');
106
106
  expectThrow(() => promoteCandidate({
107
107
  workspace,
108
108
  sessionId: ruleSession,
109
- candidateId: ruleCandidate.candidateId,
109
+ candidateId: legacyCandidateId,
110
110
  authorization: 'forged',
111
- }), /only accepted/, 'inconclusive runtime lesson cannot be promoted');
111
+ }), /only accepted/, 'inconclusive historical lesson cannot be promoted');
112
+ check(!fs.existsSync(path.join(workspace, 'memories', 'repo')), 'historical candidate evaluation never mutates durable memory');
113
+
114
+ expectThrow(() => createLearningOpportunity({ session_id: ruleSession, cwd: workspace }, {
115
+ triggerType: 'rule-of-3-recovery',
116
+ sourceEventIds: ['legacy-trip', 'legacy-success'],
117
+ evidence: { failureSignature: 'legacy-signature', recovered: true },
118
+ }), /unsupported learning trigger/, 'retired recovery trigger cannot create new opportunities');
112
119
 
113
120
  const stagedContract = buildRouterContract({
114
121
  routingStatus: 'ok',
@@ -262,16 +269,6 @@ try {
262
269
  }).candidate;
263
270
  check(validatedState.state === 'validated', 'later outcome evidence can advance a retrieved lesson to validated');
264
271
 
265
- const duplicate = createLearningOpportunity({
266
- session_id: ruleSession,
267
- cwd: workspace,
268
- }, {
269
- triggerType: ruleCandidate.trigger.type,
270
- sourceEventIds: ruleCandidate.trigger.sourceEventIds,
271
- evidence: ruleCandidate.evidence,
272
- });
273
- check(duplicate.created === false, 'same runtime evidence is idempotent and cannot duplicate a lesson candidate');
274
-
275
272
  const rejectedSeed = createLearningOpportunity({
276
273
  session_id: 'lesson-rejected-session',
277
274
  cwd: workspace,
@@ -296,10 +293,10 @@ try {
296
293
  check(rejected.state === 'rejected', 'secret/injection screening rejects unsafe lesson before any promotion');
297
294
  check(!fs.readFileSync(path.join(workspace, 'memories', 'repo', 'RULES.md'), 'utf8').includes('Ignore previous instructions'), 'rejected lesson never mutates durable memory');
298
295
 
299
- const sourceHook = fs.readFileSync(path.join(ROOT, 'hooks/scripts/rule-of-3-tracker.js'), 'utf8');
300
296
  const verifierHook = fs.readFileSync(path.join(ROOT, 'hooks/scripts/contract-test.js'), 'utf8');
301
- check(sourceHook.includes('createLearningOpportunity') && verifierHook.includes('createLearningOpportunity'), 'negative-control anchors require both runtime emitters');
302
- check(!sourceHook.includes('persistMemory(') && !verifierHook.includes('persistMemory('), 'runtime recovery hooks cannot directly persist memory');
297
+ check(!fs.existsSync(path.join(ROOT, 'hooks/scripts/rule-of-3-tracker.js')) && verifierHook.includes('createLearningOpportunity'),
298
+ 'retired recovery tracker is absent while the verifier fail-pass producer remains');
299
+ check(!verifierHook.includes('persistMemory('), 'verifier hook cannot directly persist memory');
303
300
 
304
301
  const telemetryEvents = telemetry.readEvents(telemetry.telemetryFile(workspace, { cwd: workspace }));
305
302
  const telemetryReport = buildReport(telemetryEvents);
@@ -311,7 +308,7 @@ try {
311
308
  ]) {
312
309
  check(lessonEvents.has(expected), 'self-evolve lifecycle emits telemetry event: ' + expected);
313
310
  }
314
- check(telemetryReport.selfEvolve.funnel.opportunities >= 3 &&
311
+ check(telemetryReport.selfEvolve.funnel.opportunities >= 2 &&
315
312
  telemetryReport.selfEvolve.funnel.accepted >= 1 &&
316
313
  telemetryReport.selfEvolve.funnel.inconclusive >= 1 &&
317
314
  telemetryReport.selfEvolve.funnel.rejected >= 1 &&
@@ -326,11 +323,14 @@ try {
326
323
  'lesson telemetry excludes generalized rules, evidence refs, and raw runtime output');
327
324
 
328
325
  const lessonSchema = JSON.parse(fs.readFileSync(path.join(ROOT, 'self-evolve/schemas/lesson-candidate.schema.json'), 'utf8'));
329
- check(lessonSchema.properties?.state?.enum?.includes('inconclusive') && lessonSchema.properties?.trigger?.properties?.type?.enum?.includes('verifier-fail-pass'), 'versioned lesson schema covers lifecycle and trigger vocabulary');
326
+ check(lessonSchema.properties?.state?.enum?.includes('inconclusive') &&
327
+ lessonSchema.properties?.trigger?.properties?.type?.enum?.includes('verifier-fail-pass') &&
328
+ lessonSchema.properties?.trigger?.properties?.type?.enum?.includes('rule-of-3-recovery') &&
329
+ lessonSchema.properties?.trigger?.properties?.type?.description?.includes('historical candidates'),
330
+ 'versioned lesson schema retains historical triggers while supporting verifier fail-pass');
330
331
 
331
332
  for (const [canonical, mirror] of [
332
333
  ['hooks/scripts/lib/learning-opportunity.js', 'plugins/harness-everything/hooks/scripts/lib/learning-opportunity.js'],
333
- ['hooks/scripts/rule-of-3-tracker.js', 'plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js'],
334
334
  ['hooks/scripts/contract-test.js', 'plugins/harness-everything/hooks/scripts/contract-test.js'],
335
335
  ['self-evolve/scripts/lesson-candidate.js', 'plugins/harness-everything/skills/self-evolve/scripts/lesson-candidate.js'],
336
336
  ['multi-agent-workspace/scripts/index_memory.js', 'plugins/harness-everything/skills/multi-agent-workspace/scripts/index_memory.js'],
@@ -7,7 +7,7 @@ let failed=0;
7
7
  function check(c,m){if(c)console.log(' PASS '+m);else{console.error(' FAIL '+m);failed++;}}
8
8
  function runNode(args){return spawnSync(process.execPath,args,{cwd:ROOT,encoding:'utf8'});}
9
9
  console.log('=== Workflow Guidance Contract ===');
10
- for(const rel of ['harness-everything/scripts/kernel-router.js','hooks/scripts/workflow-gate.js','hooks/scripts/workflow-stop-gate.js','hooks/scripts/workflow-disposition.js','hooks/scripts/state-persist.js','hooks/scripts/rule-of-3.js','hooks/scripts/rule-of-3-tracker.js'])check(runNode(['--check',path.join(ROOT,rel)]).status===0,rel+' parses as valid JavaScript');
10
+ for(const rel of ['harness-everything/scripts/kernel-router.js','hooks/scripts/workflow-gate.js','hooks/scripts/workflow-stop-gate.js','hooks/scripts/workflow-disposition.js','hooks/scripts/state-persist.js'])check(runNode(['--check',path.join(ROOT,rel)]).status===0,rel+' parses as valid JavaScript');
11
11
  const ctx={workflow:{workflowPlan:{limits:{maxIterations:8,maxRevisionRounds:2,maxReplans:2,maxWorkers:4}}}};
12
12
  for(const type of ['iteration','revision','replan','worker-acquire'])check(runtime.recordBudgetEvent(ctx,type,{evidence:'fixture'}).advisory===true,type+' remains a MAY planning hint rather than blocking');
13
13
  check(runtime.mutationProbeReservations(ctx)===0,'mutation probes reserve no capacity');
@@ -20,15 +20,12 @@ check(!rs.includes('budget-exhausted'),'runtime contains no budget-exhausted tra
20
20
  const gs=fs.readFileSync(path.join(ROOT,'hooks/scripts/workflow-gate.js'),'utf8');
21
21
  check(!gs.includes('registerMutationProbe')&&!gs.includes('recordBudgetEvent'),'workflow gate has no probe/budget enforcement');
22
22
  check(gs.includes('[Workflow Reminder]'),'workflow gate emits reminders');
23
- const r3=fs.readFileSync(path.join(ROOT,'hooks/scripts/rule-of-3.js'),'utf8');
24
- check(r3.includes('state.count >= 3'),'Rule of 3 uses fixed third-failure boundary');
25
- check(!r3.includes('blockForHumanDecision'),'Rule of 3 has no second-stage permanent hard lock');
26
- const tr=fs.readFileSync(path.join(ROOT,'hooks/scripts/rule-of-3-tracker.js'),'utf8');
27
- check(!tr.includes('threshold = 2')&&!tr.includes('threshold = 4'),'Rule of 3 has no category-specific thresholds');
28
23
  const oc=fs.readFileSync(path.join(ROOT,'opencode-plugin/index.mjs'),'utf8');
29
24
  check(!oc.includes('action: "hard_lock"'),'OpenCode has no permanent hard-lock action');
30
25
  const hk=JSON.parse(fs.readFileSync(path.join(ROOT,'hooks/hooks.json'),'utf8'));
31
26
  check(!hk.hooks.PermissionDenied,'obsolete mutation-probe PermissionDenied hook is removed');
27
+ check(!JSON.stringify(hk.hooks).match(/rule-of-3(?:-tracker)?\.js|reset-circuit-breaker\.js/), 'Claude hook registrations contain no retired breaker entry point');
28
+ for(const rel of ['hooks/scripts/rule-of-3.js','hooks/scripts/rule-of-3-tracker.js','hooks/scripts/reset-circuit-breaker.js'])check(!fs.existsSync(path.join(ROOT,rel)),rel+' is retired');
32
29
 
33
30
  const freshnessRoot=fs.mkdtempSync(path.join(os.tmpdir(),'harness-fable-freshness-'));
34
31
  try{
@@ -4,7 +4,7 @@ description: "Independently review a PR, diff or finished implementation for cor
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.47.5
7
+ version: 0.55.3
8
8
  ---
9
9
 
10
10
  # Code Review
@@ -9,9 +9,25 @@
9
9
  - Prior rounds (findings per decision class, for re-review):
10
10
  - Changed files and relevant callers/consumers:
11
11
  - CI state and commands observed:
12
- - Counterexample categories covered:
13
12
  - Risks not examined / evidence limits:
14
13
 
14
+ ### Counterexample categories covered
15
+
16
+ Derive the families from the scope anchor and the implementation's supported syntax. Include equivalent spellings or transformations and unknown syntax that could affect the scoped decision. Keep unverified families visible as `UNCHECKED`.
17
+
18
+ | family | representative / equivalent spelling | expected | actual per implementation | evidence tier or UNCHECKED |
19
+ | --- | --- | --- | --- | --- |
20
+ | <family from scope> | <representative inputs> | <expected decision> | <observed or source-traced decision, or blank> | <tier and evidence reference, or UNCHECKED> |
21
+
22
+ <!--
23
+ Illustrative example for a scope that treats inputs as literal strings (fictional contract and implementation):
24
+
25
+ | family | representative / equivalent spelling | expected | actual per implementation | evidence tier or UNCHECKED |
26
+ | --- | --- | --- | --- | --- |
27
+ | Repeated literal | `abc` compared with `abc` | Equal | Equal via the example implementation's `left === right` | source-traced (illustrative expression) |
28
+ | Unknown escape syntax | `\a` compared with `a` | Distinct literals | | UNCHECKED |
29
+ -->
30
+
15
31
  ## Findings
16
32
 
17
33
  ### [P1/P2/P3] <Short, specific title>
package/docker-verify.sh CHANGED
@@ -25,123 +25,7 @@ npm test
25
25
  # 3. Mechanism Checks (from VERIFICATION.md Section 2)
26
26
  echo -e "\n[Step 3] Running Mechanism Checks..."
27
27
 
28
- # 3a. Rule of 3 Circuit Breaker actually blocks
29
- # Runtime state is resolved once through the same workspace-keyed helper used by
30
- # the hooks. Invocations with no session_id use the fixed default session.
31
28
  STATE_DIR=$(node -e "process.stdout.write(require('./hooks/scripts/lib/harness-state').getSessionDir(null, 'default'))")
32
- echo -e "\n---> Running 3a: Rule of 3 Circuit Breaker"
33
- rm -f "$STATE_DIR/zoom-out-report.md"
34
- echo '{"count":3,"lastHash":"verify-test","zoomOutResolved":false}' > "$STATE_DIR/rule-of-3-state.json"
35
-
36
- # We expect this to exit with 2 and print CRITICAL trigger message
37
- set +e
38
- node hooks/scripts/rule-of-3.js 2>rule-of-3-err.log
39
- EXIT_CODE=$?
40
- set -e
41
-
42
- echo "Exit code: $EXIT_CODE"
43
- if [ "$EXIT_CODE" -ne 2 ]; then
44
- echo "❌ FAIL: Rule of 3 did not exit with code 2 (got $EXIT_CODE)"
45
- exit 1
46
- fi
47
-
48
- if ! grep -q "RULE OF 3 CIRCUIT BREAKER TRIGGERED" rule-of-3-err.log; then
49
- echo "❌ FAIL: Rule of 3 error output did not contain trigger message"
50
- cat rule-of-3-err.log
51
- exit 1
52
- fi
53
- echo "✅ PASS: Rule of 3 blocked successfully with exit code 2 and correct message."
54
-
55
- # Reset Rule of 3
56
- echo "Resetting circuit breaker..."
57
- npm run harness:reset
58
- set +e
59
- node hooks/scripts/rule-of-3.js
60
- EXIT_CODE=$?
61
- set -e
62
- if [ "$EXIT_CODE" -ne 0 ]; then
63
- echo "❌ FAIL: Rule of 3 reset check failed (expected 0, got $EXIT_CODE)"
64
- exit 1
65
- fi
66
- echo "✅ PASS: Rule of 3 reset check passed."
67
-
68
- # 3a-bis. Zoom-out reflection report releases the breaker (self-recovery path)
69
- echo -e "\n---> Running 3a-bis: Zoom-out report releases the breaker"
70
- echo '{"count":3,"lastHash":"verify-test","zoomOutResolved":false,"lastFailureAt":0,"zoomOutCycles":0}' > "$STATE_DIR/rule-of-3-state.json"
71
- printf '## Goal\nx\n## Failed Attempts\nx\n## Verified Facts\nx\n## Diagnosis\nx\n## Decision\nRESUME: new approach\n' > "$STATE_DIR/zoom-out-report.md"
72
-
73
- set +e
74
- node hooks/scripts/rule-of-3.js
75
- EXIT_CODE=$?
76
- set -e
77
- if [ "$EXIT_CODE" -ne 0 ]; then
78
- echo "❌ FAIL: Valid reflection report did not release the breaker (expected 0, got $EXIT_CODE)"
79
- exit 1
80
- fi
81
- if ! node -e "const s=require(process.argv[1]); process.exit(s.count===0 && s.zoomOutResolved===true && s.zoomOutCycles===1 ? 0 : 1)" "$STATE_DIR/rule-of-3-state.json"; then
82
- echo "❌ FAIL: Breaker state not updated after report release"
83
- cat "$STATE_DIR/rule-of-3-state.json"
84
- exit 1
85
- fi
86
- echo "✅ PASS: Valid reflection report released the breaker (self-recovery)."
87
-
88
- # 3a-ter. Re-trip: three more failures on the same signature after a released
89
- # cycle ask for ANOTHER zoom-out. #190 retired the second-stage escalation, so
90
- # the contract is exit 2 plus the reflection-required message the hook actually
91
- # prints - never a permanent lock (ci/mechanism-2a-rule-of-3.test.js:58-64).
92
- echo -e "\n---> Running 3a-ter: Re-trip requests another zoom-out"
93
- # Seed through the hooks' own resolver in the already resolved workspace-keyed
94
- # state root.
95
- RETRIP_AT=$(node -e "process.stdout.write(String(Date.now()))")
96
- node -e "require('fs').writeFileSync(process.argv[1], JSON.stringify({count:3,lastHash:'verify-test',zoomOutResolved:false,lastFailureAt:Number(process.argv[2]),zoomOutCycles:1}))" "$STATE_DIR/rule-of-3-state.json" "$RETRIP_AT"
97
- set +e
98
- node hooks/scripts/rule-of-3.js 2>rule-of-3-err.log
99
- EXIT_CODE=$?
100
- set -e
101
- if [ "$EXIT_CODE" -ne 2 ]; then
102
- echo "❌ FAIL: Re-trip did not request another zoom-out (expected 2, got $EXIT_CODE)"
103
- cat rule-of-3-err.log
104
- exit 1
105
- fi
106
- if ! grep -q "RULE OF 3 CIRCUIT BREAKER TRIGGERED" rule-of-3-err.log; then
107
- echo "❌ FAIL: Re-trip output did not contain the circuit-breaker trigger message"
108
- cat rule-of-3-err.log
109
- exit 1
110
- fi
111
- if ! grep -q "ACTION REQUIRED (reflect first)" rule-of-3-err.log; then
112
- echo "❌ FAIL: Re-trip output did not demand reflection"
113
- cat rule-of-3-err.log
114
- exit 1
115
- fi
116
- # Negative guard: the retired escalation wording must never come back (#190).
117
- if grep -qi "hard lock" rule-of-3-err.log; then # this must never match
118
- echo "❌ FAIL: Re-trip printed the retired hard-lock escalation, which no longer exists"
119
- cat rule-of-3-err.log
120
- exit 1
121
- fi
122
- echo "✅ PASS: Re-trip asked for another zoom-out, with no retired escalation wording."
123
-
124
- # A fresh report, written after the re-trip failure, releases the breaker again.
125
- printf '## Goal\nx\n## Failed Attempts\nx\n## Verified Facts\nx\n## Diagnosis\nx\n## Decision\nRESUME: second untried approach\n' > "$STATE_DIR/zoom-out-report.md"
126
- set +e
127
- node hooks/scripts/rule-of-3.js
128
- EXIT_CODE=$?
129
- set -e
130
- if [ "$EXIT_CODE" -ne 0 ]; then
131
- echo "❌ FAIL: Fresh reflection report did not release the re-tripped breaker (expected 0, got $EXIT_CODE)"
132
- exit 1
133
- fi
134
- if ! node -e "const s=JSON.parse(require('fs').readFileSync(process.argv[1],'utf8')); process.exit(s.count===0 && s.zoomOutResolved===true && s.zoomOutCycles===2 ? 0 : 1)" "$STATE_DIR/rule-of-3-state.json"; then
135
- echo "❌ FAIL: Breaker state not updated after the second report release"
136
- cat "$STATE_DIR/rule-of-3-state.json"
137
- exit 1
138
- fi
139
- echo "✅ PASS: A fresh report released the re-tripped breaker (advisory re-trip, not an escalation)."
140
-
141
- # harness:reset stays an optional manual clear, not a required escalation step.
142
- npm run harness:reset
143
-
144
-
145
29
  # 3b. Boundary Guard blocks oversized read
146
30
  echo -e "\n---> Running 3b: Boundary Guard Oversized Read"
147
31
  node -e "require('fs').writeFileSync('.verify-big.tmp','x'.repeat(600*1024))"
@@ -294,7 +178,7 @@ rm -f .verify-dirty.tmp "$STATE_DIR/handoff-state.json" "$STATE_DIR/stop-gate-st
294
178
  echo "✅ PASS: Stop gate bounced once, then respected the batch and loop guards."
295
179
 
296
180
  # Clean up temporary test output logs
297
- rm -f rule-of-3-err.log boundary-guard-err.log scope-guard-err.log stop-gate-err.log
181
+ rm -f boundary-guard-err.log scope-guard-err.log stop-gate-err.log
298
182
 
299
183
  echo -e "\n================================================="
300
184
  echo " 🎉 ALL HARNESS MECHANISM CHECKS PASSED SUCCESSFULLY!"
@@ -17,7 +17,7 @@ The minimal kernel establishes:
17
17
  - a selected workflow topology as a semantic execution contract when task evidence supports one,
18
18
  - ordered requirement decomposition and step-scoped knowledge bindings,
19
19
  - objective evidence before completion,
20
- - bounded re-plan/recovery after repeated failure,
20
+ - agent-initiated reassessment when evidence warrants it, while productive work can continue,
21
21
  - explicit warnings/degraded/escape evidence instead of silent workflow deletion;
22
22
  - one mandatory user-visible Harness Status protocol for non-trivial work, independent of execution topology.
23
23
 
@@ -122,7 +122,7 @@ Harness aligns to each host's actual lifecycle/tool APIs. Shared skill text defi
122
122
 
123
123
  ### Runtime state vs. skill content
124
124
 
125
- 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.
125
+ Runtime state includes hook metadata, workflow lifecycle, handoff/verification evidence, and WAL-style session state. Skill content is independently discoverable and remains useful on instruction-only surfaces.
126
126
 
127
127
  ### Claude Code — hook observation plus explicit safety boundaries
128
128
 
@@ -130,15 +130,15 @@ The installer configures native lifecycle hooks and project skills.
130
130
 
131
131
  - `SessionStart`: bootstrap/restoration.
132
132
  - `UserPromptSubmit`: kernel routing + semantic workflow contract.
133
- - `PreToolUse`: workflow/boundary/depth/scope reminders (all advisory, fail-open), plus the separate `action-gate.js` permission boundary and the Rule-of-3 same-signature-failure boundary.
134
- - `PostToolUse`: outcomes, state, repeated-failure evidence, stage checks.
133
+ - `PreToolUse`: workflow/boundary/depth/scope reminders (all advisory, fail-open), plus the separate `action-gate.js` permission boundary.
134
+ - `PostToolUse`: outcomes, state, stage checks.
135
135
  - `Stop`: action-gate audit plus non-blocking workflow/verification reminders.
136
136
 
137
- Cognitive workflow contracts (boundary/depth/scope/commit/workflow guards) are made observable, not hard-enforced — [#190](https://github.com/dyphn1/Harness-everything/issues/190) downgraded their `exit(2)` blocking to reminders. `action-gate.js` and the Rule-of-3 zoom-out boundary are the two mechanisms that still hard-block on this hook path; #190 explicitly scoped both out of that downgrade as user/host permission and dangerous-action safety boundaries.
137
+ Cognitive workflow contracts (boundary/depth/scope/commit/workflow guards) are made observable, not hard-enforced — [#190](https://github.com/dyphn1/Harness-everything/issues/190) downgraded their `exit(2)` blocking to reminders. `action-gate.js` remains the explicit user/host permission and dangerous-action safety boundary. The former Rule-of-3 counter and forced zoom-out path are retired under [#394](https://github.com/dyphn1/Harness-everything/issues/394).
138
138
 
139
139
  ### OpenCode — plugin enforcement, scoped live verification
140
140
 
141
- 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.
141
+ 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**. The old hard-lock was an **interactive observation** with **no retained blocked-tool trace**; reflection was **operator-seeded** and then agent-rewritten. The former third-failure reflection and hard-lock paths are retired under [#394](https://github.com/dyphn1/Harness-everything/issues/394); the snapshot does not establish current host behavior. Global scope, npm-package installation, and other OpenCode versions remain unverified.
142
142
 
143
143
  This evidence predates #190 and does not establish behavioral effectiveness of the current contract-first lifecycle.
144
144
 
@@ -200,7 +200,9 @@ flowchart LR
200
200
  Y --> S[Summarize]
201
201
  S --> R[Record]
202
202
  S -- insufficient evidence --> T
203
- Y -- same failure x3 --> Z[Zoom Out]
203
+ Y --> A{Would reassessment improve the next step?}
204
+ A -->|yes; agent chooses| Z[Agent-initiated Zoom Out]
205
+ A -->|no; next check is justified| Y
204
206
  Z --> T
205
207
  ```
206
208
 
@@ -58,7 +58,7 @@ default-OFF gate, and F4 (#358) adds limited positive credit for `doc-lint` and
58
58
  - **Minimum trusted producer (3b deliverable):** Phase 3b ships the pilot-local adapter that derives the VCS baseline and candidate identity, active task scope, parsed config bytes (`configDigest` bound rather than presence-checked), PRD root, execution/verification provenance and independent reviewer identity from host state (see *Phase 3b minimum trust boundary* below). `checkDocObligations()` only proves agreement with caller-supplied values; without this producer, a 3b PASS would promote caller-attested claims. Any input the producer cannot establish stays `unknown`/`unavailable` and MUST NOT pass. Phase 3c broadens adversarial H3 validation and adds paired architectural evaluation; it does not supply the minimum producer.
59
59
  - **Pilot topology and unsupported paths:** the pilot is limited to non-Fable typed-step workflows (`stepBindingsEnabled === true`, set when typed steps exist and the strategy is not `fable-*`). Fable stage-contract paths (`fable-staged`, `fable-parallel`, `fable-multi-agent-workspace`) and workflows without the typed-step contract are explicitly **not integrated / unavailable** for doc-MUST reconciliation: a `stage-binding` disposition is never doc verification, and no fallback may mark a doc MUST satisfied. Unsupported paths report that state rather than silently passing.
60
60
  - **Negative acceptance case:** for a doc-governed typed plan whose applicable MUST is failing or unknown, no boundary may report PASS: `step --disposition pass` on the verification step, `obligation --obligation-id execute|verify --disposition pass --evidence 'done'`, and final completion must all fail closed, report the unsatisfied obligation ids, and leave aggregate `verify` pending. A loaded skill plus free-text evidence is not verification. A RED fixture covers ordered `doc-change → review → verification` with reviewer/command evidence missing first and valid later: the authored `doc-change` step advances, aggregate/final PASS stays blocked until the later evidence satisfies the MUST, and neither a premature PASS nor a deadlock occurs.
61
- - **Compatibility:** preserve existing non-document step bindings, authorization/Rule-of-3 semantics, old persisted plans and no new Stop/tool lock. Source and installed plugin copies must behave consistently.
61
+ - **Compatibility:** preserve existing non-document step bindings, authorization and safety boundaries, old persisted plans and no new Stop/tool lock. The former Rule-of-3 counter and forced-reflection path are retired under [#394](https://github.com/dyphn1/Harness-everything/issues/394). Source and installed plugin copies must behave consistently.
62
62
  - **Pre-integration work:** the baseline-bound tombstone/rename-pair evidence required by #335 shipped in #342; the remaining pre-integration work is the reconciliation contract above. #331 / draft PR #333 is a parallel host-config safety correction; neither requires the broad #320 migration.
63
63
 
64
64
  ### Phase 3c — architecture promotion gate for #320 (planned, not shipped)
@@ -16,20 +16,22 @@ Harness deliberately separates **semantic obligation strength** from **mechanica
16
16
  | Subagent declared scope / unexpected writes | **MUST** respect and reconcile | Report ambiguous/out-of-scope changes | No |
17
17
  | Commit scope | Staged diff review **MUST**; split unrelated concerns **SHOULD** | Atomic-commit reminder | No |
18
18
  | Fable stage/check/synthesis/verifier | **MUST** when selected | Record pass/fail/ambiguity/dependency evidence and remind | No |
19
- | Rule of 3 | Third matching failure **MUST** trigger zoom-out | Pause mutation until reflection | **Yes — intentional cognitive boundary** |
19
+ | Zoom-out reassessment | **MAY** reassess at the first meaningful signal or later; productive iteration may continue when attempts add evidence or narrow the cause | Agent-directed guidance | No |
20
20
  | Action/permission gate | Approval **MUST** precede governed side effects | Host/user authorization | **Yes — trust boundary** |
21
21
 
22
- ## Rule of 3
22
+ ## Voluntary reassessment
23
23
 
24
- ```text
25
- same signature #1 -> record
26
- same signature #2 -> record
27
- same signature #3 -> pause mutation and require zoom-out
28
- reflection accepted -> count resets
29
- later #1/#2/#3 -> another zoom-out
24
+ ```mermaid
25
+ flowchart TD
26
+ Signal["First meaningful signal or later"] --> Decide{"Would reassessment improve the next step?"}
27
+ Decide -->|Yes| Review["Revisit goal, assumptions, and evidence"]
28
+ Decide -->|No| Continue["Continue with a justified next check"]
29
+ Review --> Continue
30
30
  ```
31
31
 
32
- There are no category-specific 2/4 thresholds and no second-stage permanent hard lock.
32
+ An agent may reassess at the first meaningful signal or later. A run may
33
+ continue when attempts add evidence, narrow the cause, and justify the next
34
+ check. Neither a failure count nor review history forces a pause.
33
35
 
34
36
  ## Workflow reminders
35
37
 
@@ -50,6 +52,6 @@ The design test is simple:
50
52
  When a Harness message appears:
51
53
 
52
54
  1. If it is a **Reminder**, use the evidence to improve the next action, but there is no Harness reset needed.
53
- 2. If it is the **Rule of 3** third-failure boundary, complete the requested zoom-out report.
55
+ 2. If evidence suggests a fresh diagnosis would improve the next step, an agent may choose zoom-out; productive iteration may continue when attempts add evidence or narrow the cause.
54
56
  3. If it is an **action/permission** decision, follow the host/user approval flow.
55
57
  4. Do not edit Harness state files merely to recover from a numeric workflow limit; those limits are no longer enforced.
@@ -105,7 +105,7 @@ For `fable-*` strategies, Fable owns stage lifecycle: `dependsOn`, `writeSet`, v
105
105
 
106
106
  ### Recovery Gate
107
107
 
108
- 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.
108
+ Zoom-out is agent-initiated: an agent may reassess when evidence contradicts an assumption or reveals an unknown impact boundary, including on the first failure. Productive attempts may continue when they add evidence or narrow the cause. Fable verification failures return to bounded re-planning; budget exhaustion becomes blocked instead of endless iteration.
109
109
 
110
110
  ### Action Gate
111
111
 
@@ -153,7 +153,7 @@ Harness should not become:
153
153
  2. Put applicability/basic flow in `SKILL.md`; deep detail belongs in references.
154
154
  3. Add mechanisms when they make behavior more reliable than prose.
155
155
  4. Make checks failable and evidence-based.
156
- 5. Put gates at real transition boundaries: before mutation/side effects, after repeated failure, before completion, before persistence.
156
+ 5. Put checks at real transition boundaries: before mutation/side effects, when evidence warrants reassessment, before completion, before persistence.
157
157
  6. Let the model choose HOW inside the contract.
158
158
  7. Treat workflow escape as a measured coverage gap, not convenience.
159
159
 
@@ -17,9 +17,9 @@ flowchart TD
17
17
  Q --> V{Objective evidence?}
18
18
  V -->|yes| D[Evidence-backed completion]
19
19
  V -->|no| R[Diagnose and retry]
20
- R --> F{Same-signature failure x3?}
21
- F -->|no| E
22
- F -->|yes| Z[Zoom out / re-plan]
20
+ R --> F{Would reassessment improve the next step?}
21
+ F -->|no; next check is justified| E
22
+ F -->|yes; agent chooses| Z[Agent-initiated Zoom out]
23
23
  Z --> E
24
24
 
25
25
  S[SessionStart hook] --> C[Cognitive OS policy]
@@ -78,7 +78,7 @@ Relevant environment discovery is a conditional **MUST**: establish OS, shell, p
78
78
 
79
79
  ### 2. Guardrails — Lifecycle Boundaries
80
80
 
81
- Circuit breakers, action gates, workflow gates, scope guards, and completion gates protect specific transitions. They **SHOULD** remain narrow and evidence-driven. On integration surfaces that expose the required lifecycle/tool hooks, Harness can mechanically block supported violations; elsewhere the same contract is instruction-governed and must not be mislabeled hard enforcement.
81
+ Action gates, scope guards, and completion checks protect specific transitions. They **SHOULD** remain narrow and evidence-driven. Explicit user/host permission and safety boundaries can block supported operations; workflow and recovery guidance remains agent-directed. The former Rule-of-3 counter and forced-reflection path are retired under [#394](https://github.com/dyphn1/Harness-everything/issues/394).
82
82
 
83
83
  ### 3. Context Preservation — Progressive Disclosure
84
84
 
@@ -44,7 +44,7 @@ The workflow plan controller rejects present non-array required/optional binding
44
44
 
45
45
  The repository routing contract uses **step-scoped workflow selection**. Normalized keyword/domain signals help compose ordered requirements but never select or load document paths. Each step/stage declares its required and optional skill/reference bindings; only active bindings are disclosed, and required bindings resolve before the step/stage passes. Unknown or unavailable required bindings stay visible and unresolved; missing evidence produces reminders rather than a persistent workflow lock.
46
46
 
47
- This is a **repository/agent contract**, not an automatic upgrade to any platform row below. A hook can prove that the contract was injected and record an agent's binding disposition; neither proves that a live host actually loaded or followed the referenced content. Instruction-only surfaces can carry the same rule without mechanically enforcing it. Promoting behavior to live-host compliance requires retained host/session evidence under the #82 compatibility program. Claude and local OpenAI packages carry workflow entry/completion **reminders** plus separate Rule-of-3/permission boundaries, but this package/mechanism change does not upgrade `platform-compatibility.json` live-host status values. See [workflow runtime](workflow-runtime.md) for scope, worktree isolation, and failure behavior. OpenCode and instruction-only/public Skills-only surfaces do not acquire equivalent runtime gating. Shell inspection is not a filesystem sandbox; absent hooks, agent-writable state, and indirect script effects remain limits.
47
+ This is a **repository/agent contract**, not an automatic upgrade to any platform row below. A hook can prove that the contract was injected and record an agent's binding disposition; neither proves that a live host actually loaded or followed the referenced content. Instruction-only surfaces can carry the same rule without mechanically enforcing it. Promoting behavior to live-host compliance requires retained host/session evidence under the #82 compatibility program. Claude and local OpenAI packages carry workflow entry/completion **reminders** plus independent permission boundaries, but this package/mechanism change does not upgrade `platform-compatibility.json` live-host status values. See [workflow runtime](workflow-runtime.md) for scope, worktree isolation, and failure behavior. OpenCode and instruction-only/public Skills-only surfaces do not acquire equivalent runtime gating. Shell inspection is not a filesystem sandbox; absent hooks, agent-writable state, and indirect script effects remain limits.
48
48
 
49
49
  ### Action-gate mechanism vs. host semantic boundary
50
50
 
@@ -201,13 +201,14 @@ sessions whose directories matched setup; it establishes field availability,
201
201
  not mismatch handling or V2 hook behavior ([trace notes](../benchmarks/results/live-host/opencode-2026-11-15-workspace/README.md)). The adapter itself has deterministic mechanism
202
202
  coverage (`ci/mechanism-2n-opencode-plugin.test.js`, V1 shapes;
203
203
  `ci/mechanism-2p-opencode-v2-entrypoint.test.js`, V2 lifecycle shapes;
204
- `ci/mechanism-397-opencode-observations.test.js`, router injection, turn capture,
204
+ `ci/mechanism-397-opencode-observations.test.js`, router injection, fail-open
205
+ router diagnostics on launch or runtime failure, turn capture,
205
206
  malformed-label export counts and opt-out). The injection/capture path has
206
207
  mechanism evidence only; no live-host hook-fire or mismatch-handling artifact
207
208
  exists. Retained
208
209
  evidence supports project-scope `.js` loading and edit/verification state on
209
210
  OpenCode 1.18.31 (macOS): [live-host evidence](../benchmarks/results/live-host/opencode-2026-09-16/README.md). The
210
- retained snapshot predates #190 and remains historical evidence only. Current OpenCode removes the permanent post-reflection hard lock; only the third-failure reflection boundary pauses edits. Reflection was operator-seeded, then agent-rewritten, so do not promote this into a behavioral-effectiveness claim. `.mjs` auto-discovery is broken on this host version (issue #127). npm-package installation and behavioral V2-hook fire remain unverified.
211
+ retained snapshot predates #190 and remains historical evidence only. The forced Rule-of-3 reflection gate has since been retired; current package and mechanism checks cover that retirement, but no post-retirement live-host run is preserved. The old reflection was operator-seeded, then agent-rewritten, so it proves no behavioral effect. `.mjs` auto-discovery is broken on this host version (issue #127). npm-package installation and behavioral V2-hook fire remain unverified.
211
212
 
212
213
  The plugin verification runner uses asynchronous child processes with a shared
213
214
  sequence budget and bounded streamed diagnostics. Deterministic mechanism
@@ -174,13 +174,13 @@
174
174
  "standaloneSkills": {"status": "Supported", "paths": {"project": [".opencode/skills", ".agents/skills", ".claude/skills"], "global": ["~/.config/opencode/skills", "~/.agents/skills", "~/.claude/skills"]}},
175
175
  "pluginSupport": {"status": "Partial", "paths": {"project": [".opencode/plugins"], "global": ["~/.config/opencode/plugins"]}, "notes": "Live verified scoped: project-scope install of the plugin copied under a .js filename loads on OpenCode 1.18.31 (macOS) and edit/verification state effects are retained (benchmarks/results/live-host/opencode-2026-09-16/README.md). The host discovery silently ignores .mjs install names (issue #127). Global scope and npm-package installation remain mechanism-only."},
176
176
  "bundledSkills": {"status": "Partial", "notes": "Harness provides a standalone enforcement module; it is not an OpenCode bundled-skill package."},
177
- "hooksLifecycle": {"status": "Partial", "notes": "Live-host evidence covers project-scope .js loading and edit/verification state (edit tracking, forced verification, breaker failure recording) on OpenCode 1.18.31 (macOS); hard lock is only an interactive observation with no retained blocked-tool trace and the final snapshot is post-reset (benchmarks/results/live-host/opencode-2026-09-16/README.md). Global scope, npm-package installation, and other host versions remain mechanism-tested."},
177
+ "hooksLifecycle": {"status": "Partial", "notes": "Historical live-host evidence covers project-scope .js loading and edit/verification state (including then-active breaker failure recording) on OpenCode 1.18.31 (macOS). That snapshot predates the Rule-of-3 retirement; current retirement coverage is package/mechanism evidence only, with no post-retirement live-host trace. Hard lock was only an interactive observation with no retained blocked-tool trace and the final snapshot is post-reset (benchmarks/results/live-host/opencode-2026-09-16/README.md). Global scope, npm-package installation, and other host versions remain mechanism-tested."},
178
178
  "projectScope": {"status": "Partial", "paths": {"skills": [".opencode/skills", ".agents/skills"], "plugins": [".opencode/plugins"]}, "notes": "Plugin loading at project scope and edit/verification state are live-verified via the retained host session artifact; standalone skill discovery remains path-contract verified."},
179
179
  "globalScope": {"status": "Mechanism verified", "paths": {"skills": ["~/.config/opencode/skills", "~/.agents/skills"], "plugins": ["~/.config/opencode/plugins"]}},
180
180
  "installUninstallSymmetry": {"status": "Unknown", "notes": "The adapter is manually copied; Harness does not own an OpenCode install/uninstall flow."},
181
181
  "assetsReferences": {"status": "Mechanism verified", "notes": "The adapter is self-contained and skill references are separately checked."},
182
182
  "updateSync": {"status": "Unknown", "notes": "No live OpenCode refresh or npm plugin update is preserved."},
183
- "liveHostVerification": {"status": "Partial", "evidence": "benchmarks/results/live-host/opencode-2026-09-16/README.md", "notes": "Retained evidence supports project-scope .js plugin loading and edit/verification state on OpenCode 1.18.31 (macOS), not durable hard enforcement: final snapshot is post-reset (hardLock: false), hard lock only an interactive observation with no retained blocked-tool trace, reflection operator-seeded, agent-controlled state deletion resets the breaker. Global scope, npm-package installation, and other host versions remain unverified."}
183
+ "liveHostVerification": {"status": "Partial", "evidence": "benchmarks/results/live-host/opencode-2026-09-16/README.md", "notes": "Retained historical evidence supports project-scope .js plugin loading and edit/verification state on OpenCode 1.18.31 (macOS), not durable hard enforcement: final snapshot is post-reset (hardLock: false), hard lock only an interactive observation with no retained blocked-tool trace, reflection was operator-seeded, and agent-controlled state deletion reset the former breaker. The snapshot predates the Rule-of-3 retirement and does not establish current post-retirement behavior; current coverage is package/mechanism evidence only, with no retained live-host trace. Global scope, npm-package installation, and other host versions remain unverified."}
184
184
  }
185
185
  },
186
186
  {
@@ -21,7 +21,7 @@ On a surface that packages those mechanisms:
21
21
  * **Handoff checkpoint:** a session checkpoint can record pending/failed state for later recovery.
22
22
  * **Session-start recovery:** a compatible session-start hook can surface that checkpoint back to the agent.
23
23
 
24
- This is a runtime integration feature, not a property of every Harness skill installation. The **Codex / local OpenAI plugin** packages the session/prompt hooks plus the supported-tool `state-persist.js` / circuit-breaker / `PostToolUse` runtime and stop/subagent adapters. That is mechanism-tested package coverage, not proof that a live host loaded every hook. The public OpenAI **Skills-only** artifact has no local `.codex-plugin` lifecycle hooks at all.
24
+ This is a runtime integration feature, not a property of every Harness skill installation. The **Codex / local OpenAI plugin** packages the session/prompt hooks plus the supported-tool `state-persist.js` / `PostToolUse` runtime and stop/subagent adapters. The former Rule-of-3 tracker, forced reflection, and reset path are retired under [#394](https://github.com/dyphn1/Harness-everything/issues/394). Package-level mechanism coverage does not prove that a live host loaded every hook. The public OpenAI **Skills-only** artifact has no local `.codex-plugin` lifecycle hooks at all.
25
25
 
26
26
  ---
27
27
 
package/docs/routing.md CHANGED
@@ -16,7 +16,7 @@ For software/project work, Harness establishes routing context and lightweight r
16
16
 
17
17
  1. **Route before execution** — establish scope/tier and the smallest justified topology.
18
18
  2. **Verify before claim** — completion requires objective evidence appropriate to the change.
19
- 3. **Re-plan after repeated failure** — after three same-signature failures, stop micro-retrying and use a fresh diagnosis / `zoom-out`.
19
+ 3. **Loop awareness** — reconsider assumptions or re-plan when evidence shows stagnation; numeric iteration values MAY guide but never hard-stop.
20
20
  4. **Bind knowledge by step** — compose ordered requirement steps and declare their required/optional skill or reference bindings before execution.
21
21
  5. **Resolve selected workflow** — satisfy the selected topology's required obligations before completion; tactics MAY adapt, but required lifecycle evidence cannot be silently skipped.
22
22
  6. **Surface status** — non-trivial work MUST keep the user informed through the single Harness Status format at required phase boundaries.
@@ -184,7 +184,7 @@ Keep semantic strength separate from runtime mechanics:
184
184
  - **mechanism:** which transitions a packaged hook/plugin can block, observe, or remind about;
185
185
  - **live evidence:** whether a real host actually loaded/fired that mechanism.
186
186
 
187
- A semantic MUST does not require a hard lock. Outside Rule-of-3 reflection and explicit permission/safety boundaries, lifecycle hooks stay fail-open/reminder-oriented.
187
+ A semantic MUST does not require a hard lock. Outside explicit permission/safety boundaries, lifecycle hooks stay fail-open/reminder-oriented.
188
188
 
189
189
  Instruction-only integrations receive the same semantic contract through instructions, but must not be labeled hard-enforced. Kernel emission alone does not prove model compliance. #82 owns host-specific retained evidence.
190
190
 
@@ -29,8 +29,8 @@ change follows this document (docs → RED → GREEN) in its own commit.
29
29
  not exact accuracy.
30
30
  3. **Deterministic controls stay outside learned scoring.** Tier structural
31
31
  floor, explicit workflow requests, action/security approval, scope and
32
- memory ownership and the Rule of 3 are unchanged. Abstention always falls
33
- back to the lexical path.
32
+ memory ownership are unchanged. Abstention always falls back to the
33
+ lexical path.
34
34
 
35
35
  ## Readout per stage
36
36
 
@@ -126,8 +126,8 @@ on `actionable` prompts.
126
126
  conversation context. Agent-written dispatch packets and worker instructions
127
127
  are ordinary prompts; their audience does not make them invalid. The small
128
128
  model judges the prompt text itself, without trying to recover missing
129
- context. Deterministic controls (action gates, scope and memory ownership,
130
- the Rule of 3) apply unchanged. The noise-gate experiment (#265)
129
+ context. Deterministic controls (action gates, scope and memory ownership)
130
+ apply unchanged. The noise-gate experiment (#265)
131
131
  showed that tier labels given to such prompts from session context were
132
132
  what kept a text-only model unsure.
133
133