harness-everything 0.55.3 → 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 (170) 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 +13 -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 +26 -5
  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 +6 -7
  28. package/ci/mechanism-codex-hook-results.test.js +9 -5
  29. package/ci/mechanism-prb-outline-review.test.js +1 -13
  30. package/ci/mechanism-system-one-router.test.js +1 -1
  31. package/ci/openai-plugin-package.test.js +30 -7
  32. package/ci/openai-plugin-runtime.test.js +64 -32
  33. package/ci/prompt-contract-regressions.test.js +1 -5
  34. package/ci/self-evolve-loop.test.js +51 -51
  35. package/ci/workflow-execution-contract.test.js +3 -6
  36. package/docker-verify.sh +1 -117
  37. package/docs/architecture.md +9 -7
  38. package/docs/document-lifecycle.md +1 -1
  39. package/docs/enforcement-locks.md +12 -10
  40. package/docs/mechanism-first-skill-mesh.md +2 -2
  41. package/docs/openai-plugin.md +3 -3
  42. package/docs/philosophy.md +1 -1
  43. package/docs/platform-capabilities.md +2 -2
  44. package/docs/platform-compatibility.json +2 -2
  45. package/docs/reflection.md +1 -1
  46. package/docs/routing.md +2 -2
  47. package/docs/system-one-suggestion-gates.md +4 -4
  48. package/docs/troubleshooting.md +9 -35
  49. package/docs/workflow-runtime.md +19 -18
  50. package/docs/workflows/environment-detection.md +11 -9
  51. package/docs/workflows/fable-discipline.md +6 -5
  52. package/docs/workflows/fable-mode.md +6 -5
  53. package/docs/workflows/harness-everything.md +5 -5
  54. package/docs/workflows/improve-codebase-architecture.md +10 -8
  55. package/docs/workflows/install-cognitive-os.md +5 -5
  56. package/docs/workflows/tdd.md +9 -9
  57. package/docs/workflows/zoom-out.md +20 -30
  58. package/environment-detection/SKILL.md +2 -2
  59. package/environment-detection/references/shell-syntax-rules.md +1 -1
  60. package/eval-harness/SKILL.md +1 -1
  61. package/eval-harness/references/scoring-rubric.md +3 -3
  62. package/evals/zoom-out/eval.yaml +2 -2
  63. package/evals/zoom-out/tasks/negative-productive-iteration.yaml +15 -0
  64. package/evals/zoom-out/tasks/negative-trivial-edit.yaml +6 -6
  65. package/evals/zoom-out/tasks/positive-first-failure.yaml +15 -0
  66. package/evals/zoom-out/tasks/positive-repair-loop.yaml +1 -1
  67. package/fable-discipline/SKILL.md +3 -3
  68. package/fable-discipline/references/discipline-rules.md +1 -1
  69. package/fable-mode/SKILL.md +1 -1
  70. package/fable-mode/execution-guardrails/SKILL.md +2 -4
  71. package/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
  72. package/fable-mode/fable-haiku/SKILL.md +1 -1
  73. package/fable-mode/fable-opus/SKILL.md +2 -2
  74. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  75. package/fable-mode/references/execution-phases.md +2 -2
  76. package/harness-everything/SKILL.md +3 -3
  77. package/harness-everything/references/router-workflow-plan.md +2 -2
  78. package/harness-everything/references/skill-registry.md +2 -2
  79. package/harness-everything/references/triage-and-tiers.md +5 -5
  80. package/harness-everything/scripts/bootstrap.js +1 -26
  81. package/harness-everything/scripts/kernel-router-core.js +2 -3
  82. package/harness-everything/scripts/kernel-router.js +1 -1
  83. package/harness-everything/scripts/router-contract-core.js +1 -1
  84. package/harness-everything/scripts/routing-keywords.json +0 -2
  85. package/hooks/hooks.json +0 -33
  86. package/hooks/scripts/lib/harness-state.js +5 -6
  87. package/hooks/scripts/lib/learning-opportunity.js +3 -13
  88. package/hooks/scripts/openai-session-start.js +2 -4
  89. package/improve-codebase-architecture/SKILL.md +3 -3
  90. package/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
  91. package/install-cognitive-os/SKILL.md +3 -3
  92. package/opencode-plugin/README.md +12 -43
  93. package/opencode-plugin/index.mjs +21 -368
  94. package/opencode-plugin/plugin.json +1 -1
  95. package/package.json +1 -4
  96. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  97. package/plugins/harness-everything/hooks/hooks.json +0 -14
  98. package/plugins/harness-everything/hooks/scripts/lib/harness-state.js +5 -6
  99. package/plugins/harness-everything/hooks/scripts/lib/learning-opportunity.js +3 -13
  100. package/plugins/harness-everything/hooks/scripts/lib/workspace.js +2 -2
  101. package/plugins/harness-everything/hooks/scripts/openai-session-start.js +2 -4
  102. package/plugins/harness-everything/hooks/session-start.js +2 -4
  103. package/plugins/harness-everything/plugin.json +1 -1
  104. package/plugins/harness-everything/scripts/lib/advisory-text.js +2 -2
  105. package/plugins/harness-everything/scripts/lib/workspace.js +2 -2
  106. package/plugins/harness-everything/skills/environment-detection/SKILL.md +2 -2
  107. package/plugins/harness-everything/skills/environment-detection/references/shell-syntax-rules.md +1 -1
  108. package/plugins/harness-everything/skills/eval-harness/SKILL.md +1 -1
  109. package/plugins/harness-everything/skills/eval-harness/references/scoring-rubric.md +3 -3
  110. package/plugins/harness-everything/skills/fable-discipline/SKILL.md +3 -3
  111. package/plugins/harness-everything/skills/fable-discipline/references/discipline-rules.md +1 -1
  112. package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
  113. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +2 -4
  114. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
  115. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  116. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +2 -2
  117. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  118. package/plugins/harness-everything/skills/fable-mode/references/execution-phases.md +2 -2
  119. package/plugins/harness-everything/skills/harness-everything/SKILL.md +3 -3
  120. package/plugins/harness-everything/skills/harness-everything/references/router-workflow-plan.md +2 -2
  121. package/plugins/harness-everything/skills/harness-everything/references/skill-registry.md +2 -2
  122. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +5 -5
  123. package/plugins/harness-everything/skills/harness-everything/scripts/bootstrap.js +1 -26
  124. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +2 -3
  125. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +1 -1
  126. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +1 -1
  127. package/plugins/harness-everything/skills/harness-everything/scripts/routing-keywords.json +0 -2
  128. package/plugins/harness-everything/skills/improve-codebase-architecture/SKILL.md +3 -3
  129. package/plugins/harness-everything/skills/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
  130. package/plugins/harness-everything/skills/install-cognitive-os/SKILL.md +3 -3
  131. package/plugins/harness-everything/skills/self-evolve/SKILL.md +1 -1
  132. package/plugins/harness-everything/skills/self-evolve/references/memory-resolution.md +3 -3
  133. package/plugins/harness-everything/skills/self-evolve/schemas/lesson-candidate.schema.json +4 -1
  134. package/plugins/harness-everything/skills/self-evolve/scripts/lesson-candidate.js +1 -0
  135. package/plugins/harness-everything/skills/skill-creator/SKILL.md +1 -1
  136. package/plugins/harness-everything/skills/skill-creator/references/quality-checklist.md +1 -1
  137. package/plugins/harness-everything/skills/skill-creator/references/quality-principles.md +4 -4
  138. package/plugins/harness-everything/skills/tdd/SKILL.md +2 -2
  139. package/plugins/harness-everything/skills/tdd/references/core-discipline.md +3 -5
  140. package/plugins/harness-everything/skills/todo-driven-workflow/SKILL.md +2 -2
  141. package/plugins/harness-everything/skills/zoom-out/SKILL.md +14 -26
  142. package/plugins/harness-everything/skills/zoom-out/references/circuit-breaker.md +18 -62
  143. package/references/platform-advisory-template.md +3 -9
  144. package/sbom.cdx.json +7 -7
  145. package/scripts/lib/advisory-text.js +2 -2
  146. package/scripts/lib/workspace.js +2 -2
  147. package/self-evolve/SKILL.md +1 -1
  148. package/self-evolve/references/memory-resolution.md +3 -3
  149. package/self-evolve/schemas/lesson-candidate.schema.json +4 -1
  150. package/self-evolve/scripts/lesson-candidate.js +1 -0
  151. package/skill-creator/SKILL.md +1 -1
  152. package/skill-creator/references/quality-checklist.md +1 -1
  153. package/skill-creator/references/quality-principles.md +4 -4
  154. package/submission/openai/test-cases.json +5 -5
  155. package/tdd/SKILL.md +2 -2
  156. package/tdd/references/core-discipline.md +3 -5
  157. package/todo-driven-workflow/SKILL.md +2 -2
  158. package/zoom-out/SKILL.md +14 -26
  159. package/zoom-out/references/circuit-breaker.md +18 -62
  160. package/behavioral-evals/opencode-hardlock-live.js +0 -17
  161. package/behavioral-evals/opencode-reflection-gate-live.js +0 -342
  162. package/ci/mechanism-31-opencode-hardlock-evidence.test.js +0 -82
  163. package/evals/zoom-out/tasks/negative-first-edge-case-review.yaml +0 -16
  164. package/evals/zoom-out/tasks/positive-repeated-failure.yaml +0 -15
  165. package/hooks/scripts/reset-circuit-breaker.js +0 -30
  166. package/hooks/scripts/rule-of-3-tracker.js +0 -165
  167. package/hooks/scripts/rule-of-3.js +0 -171
  168. package/plugins/harness-everything/hooks/scripts/reset-circuit-breaker.js +0 -30
  169. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +0 -165
  170. package/plugins/harness-everything/hooks/scripts/rule-of-3.js +0 -171
@@ -1,171 +0,0 @@
1
- #!/usr/bin/env node
2
- // Rule of 3 circuit breaker (PreToolUse: Bash|PowerShell|Edit|Write|apply_patch).
3
- //
4
- // Tripping the breaker forces REFLECTION, not surrender. The most common
5
- // agent failure mode is drilling deeper on one unverified assumption, so the
6
- // breaker locks mutating tools and demands a zoom-out fact-check first
7
- // (read-only tools stay available). A valid reflection report - written to
8
- // the session's zoom-out-report.md (path given in the block message below) -
9
- // releases the breaker again. A later set of three matching failures triggers
10
- // another zoom-out; there is no persistent second-stage hard lock.
11
- //
12
- // State is scoped per Claude Code session_id (see lib/harness-state.js) so
13
- // two sessions open on the same repo never share a trip count. The common
14
- // case - nobody's breaker tripped anywhere - never has to read stdin to find
15
- // that out; only once some session IS tripped do we pay to read the payload
16
- // and check whether it's this one.
17
- const fs = require('fs');
18
- const path = require('path');
19
- const { getWorkspaceRoot, getSessionDir, listSessionDirs } = require('./lib/harness-state');
20
-
21
- const REQUIRED_SECTIONS = [
22
- '## Goal',
23
- '## Failed Attempts',
24
- '## Verified Facts',
25
- '## Diagnosis',
26
- '## Decision'
27
- ];
28
-
29
- function readState(stateFile) {
30
- if (!fs.existsSync(stateFile)) return null;
31
- try { return JSON.parse(fs.readFileSync(stateFile, 'utf8')); } catch (err) { return null; }
32
- }
33
-
34
- function isTripped(state) {
35
- return Boolean(state && !state.zoomOutResolved && state.count >= 3);
36
- }
37
-
38
- function anySessionTripped(root) {
39
- return listSessionDirs(root).some(dir => isTripped(readState(path.join(dir, 'rule-of-3-state.json'))));
40
- }
41
-
42
- // The one mutation allowed while tripped: writing the reflection report.
43
- const ALLOWED_WRITE_TOOLS = new Set([
44
- 'Write', 'Edit', 'create_file', 'replace_string_in_file',
45
- 'insert_edit_into_file', 'write_file', 'edit_file', 'apply_patch'
46
- ]);
47
-
48
- function isReportWrite(payload, reportFile) {
49
- if (!payload) return false;
50
- const toolName = payload.tool_name || payload.toolName;
51
- if (!ALLOWED_WRITE_TOOLS.has(toolName)) return false;
52
- const input = payload.tool_input || payload.toolInput || payload.input || {};
53
- const target = input.file_path || input.filePath || input.path || input.file;
54
- if (target && path.resolve(target).toLowerCase() === path.resolve(reportFile).toLowerCase()) return true;
55
- if (toolName !== 'apply_patch') return false;
56
-
57
- const patch = input.patch || input.command || input.content || '';
58
- const base = payload.cwd || process.cwd();
59
- const files = [...String(patch).matchAll(/^\*\*\* (?:Update|Add|Delete) File:\s*(.+?)\s*$/gm)]
60
- .map(match => match[1]);
61
- const reportPath = path.resolve(reportFile).toLowerCase();
62
- return files.length > 0 && files.every(file => path.resolve(base, file).toLowerCase() === reportPath);
63
- }
64
-
65
- // A report only counts if it was written AFTER the failure that tripped the
66
- // breaker (a stale report from an earlier loop can't unlock a new one), has
67
- // every required section, and actually committed to a RESUME/ESCALATE call.
68
- function reportIsValid(state, reportFile) {
69
- if (!fs.existsSync(reportFile)) return false;
70
- if (fs.statSync(reportFile).mtimeMs < (state.lastFailureAt || 0)) return false;
71
- const text = fs.readFileSync(reportFile, 'utf8');
72
- if (!REQUIRED_SECTIONS.every(h => text.includes(h))) return false;
73
- return /\b(RESUME|ESCALATE)\b/.test(text);
74
- }
75
-
76
- function blockForReflection(state, reportFile) {
77
- console.error(`[CRITICAL] RULE OF 3 CIRCUIT BREAKER TRIGGERED!`);
78
- console.error(`The same failure signature has now occurred 3 times.`);
79
- console.error(`Error Signature: ${state.lastHash}`);
80
- console.error(`\nMutating tools (Bash/PowerShell/Edit/Write/apply_patch) are locked - not because you`);
81
- console.error(`must wait for a human, but because you must stop drilling and rebuild the`);
82
- console.error(`full picture first. Do NOT ask the Human Partner yet.`);
83
- console.error(`\nACTION REQUIRED (reflect first):`);
84
- console.error(`1. CEASE FIRE. No new fix attempts, no variations of the last one.`);
85
- console.error(`2. Load the 'zoom-out' skill and follow its Reflect & Fact-Check protocol.`);
86
- console.error(`3. Using READ-ONLY tools (Read/Grep/Glob - still available), re-verify the`);
87
- console.error(` assumption behind each failed attempt against the actual code/logs/docs.`);
88
- console.error(`4. Write your findings to '${reportFile}' (the ONLY write`);
89
- console.error(` allowed right now) with sections: ## Goal, ## Failed Attempts,`);
90
- console.error(` ## Verified Facts, ## Diagnosis, ## Decision (ending RESUME: or ESCALATE:).`);
91
- console.error(`\nA valid report releases this breaker automatically. Escalate to the Human`);
92
- console.error(`Partner ONLY if your Decision concludes a genuinely human call is needed`);
93
- console.error(`(requirement conflict, architecture trade-off, destructive action, missing`);
94
- console.error(`access) - and then present options with a recommendation, not apologies.`);
95
- // For PreToolUse, only exit code 2 actually blocks the tool call.
96
- // Exit 1 is a non-blocking error and Claude Code proceeds anyway.
97
- process.exit(2);
98
- }
99
-
100
- function main(payload) {
101
- try {
102
- const root = getWorkspaceRoot(payload);
103
- const sessionDir = getSessionDir(root, payload && (payload.session_id || payload.sessionId));
104
- const stateFile = path.join(sessionDir, 'rule-of-3-state.json');
105
- const reportFile = path.join(sessionDir, 'zoom-out-report.md');
106
-
107
- const state = readState(stateFile);
108
- if (!isTripped(state)) {
109
- process.exit(0);
110
- }
111
-
112
- if (isReportWrite(payload, reportFile)) {
113
- process.exit(0);
114
- }
115
-
116
- if (reportIsValid(state, reportFile)) {
117
- state.count = 0;
118
- state.zoomOutResolved = true;
119
- state.zoomOutCycles = (state.zoomOutCycles || 0) + 1;
120
- fs.writeFileSync(stateFile, JSON.stringify(state, null, 2), 'utf8');
121
- console.log(
122
- `[Rule of 3] Zoom-out report accepted - breaker released. Follow your ` +
123
- `report's Decision: RESUME means one fresh run at the NEW diagnosis; ` +
124
- `ESCALATE means present the decision request and WAIT for the Human ` +
125
- `Partner before mutating anything. A later set of three matching failures will trigger another zoom-out.`
126
- );
127
- process.exit(0);
128
- }
129
-
130
- blockForReflection(state, reportFile);
131
- } catch (err) {
132
- // Fail open if state tracking breaks
133
- process.exit(0);
134
- }
135
- }
136
-
137
- // Read the payload before the fast path. The session registry may point at a
138
- // different workspace than process.cwd() after an agent changes directory;
139
- // checking the cwd first would skip an active breaker in the bound session.
140
- function runForPayload(payload) {
141
- let tripped = false;
142
- try {
143
- tripped = anySessionTripped(getWorkspaceRoot(payload));
144
- } catch (err) {
145
- tripped = false; // fail open
146
- }
147
- if (!tripped) process.exit(0);
148
- main(payload);
149
- }
150
-
151
- if (process.stdin.isTTY) {
152
- // Manual run in a terminal - no payload is coming.
153
- runForPayload(null);
154
- } else {
155
- let raw = '';
156
- let finished = false;
157
- const finish = () => {
158
- if (finished) return;
159
- finished = true;
160
- let payload = null;
161
- try { payload = JSON.parse(raw); } catch (err) { /* no payload */ }
162
- runForPayload(payload);
163
- };
164
- // Claude Code closes stdin right after writing the payload; the timer is a
165
- // safety net so an odd caller that never closes stdin can't hang the hook.
166
- const timer = setTimeout(finish, 300);
167
- process.stdin.setEncoding('utf8');
168
- process.stdin.on('data', chunk => { raw += chunk; });
169
- process.stdin.on('end', () => { clearTimeout(timer); finish(); });
170
- process.stdin.on('error', () => { clearTimeout(timer); finish(); });
171
- }