harness-everything 0.55.3 → 0.56.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 (179) 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 +26 -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/468-dispatch/runner.js +144 -0
  16. package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/legacy-off-golden.json +0 -6
  17. package/ci/invariant-routing.test.js +26 -5
  18. package/ci/lib/opencode-verification-loader.js +3 -5
  19. package/ci/mechanism-2a-rule-of-3.test.js +111 -97
  20. package/ci/mechanism-2n-opencode-plugin.test.js +68 -206
  21. package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +47 -28
  22. package/ci/mechanism-2w-platform-compatibility.test.js +1 -0
  23. package/ci/mechanism-32-paired-benchmark.test.js +1 -2
  24. package/ci/mechanism-33-issues-205-207.test.js +1 -1
  25. package/ci/mechanism-338-opencode-async.test.js +18 -49
  26. package/ci/mechanism-36-verify-timeout.test.js +3 -189
  27. package/ci/mechanism-39-opencode-verify-outcomes.test.js +56 -323
  28. package/ci/mechanism-397-opencode-observations.test.js +6 -7
  29. package/ci/mechanism-468-dispatch-cli.test.js +546 -0
  30. package/ci/mechanism-codex-hook-results.test.js +9 -5
  31. package/ci/mechanism-error-handling-map.test.js +14 -12
  32. package/ci/mechanism-prb-outline-review.test.js +1 -13
  33. package/ci/mechanism-system-one-router.test.js +1 -1
  34. package/ci/openai-plugin-package.test.js +30 -7
  35. package/ci/openai-plugin-runtime.test.js +64 -32
  36. package/ci/prompt-contract-regressions.test.js +1 -5
  37. package/ci/self-evolve-loop.test.js +51 -51
  38. package/ci/workflow-execution-contract.test.js +3 -6
  39. package/docker-verify.sh +1 -117
  40. package/docs/architecture.md +9 -7
  41. package/docs/document-lifecycle.md +1 -1
  42. package/docs/enforcement-locks.md +12 -10
  43. package/docs/error-handling/README.md +3 -3
  44. package/docs/error-handling/actions/c8-action-map.md +41 -0
  45. package/docs/error-handling/details/c8-dispatch-cli.md +75 -0
  46. package/docs/error-handling/nodes.yaml +5 -0
  47. package/docs/error-handling/registry.md +4 -1
  48. package/docs/mechanism-first-skill-mesh.md +2 -2
  49. package/docs/openai-plugin.md +3 -3
  50. package/docs/philosophy.md +1 -1
  51. package/docs/platform-capabilities.md +2 -2
  52. package/docs/platform-compatibility.json +2 -2
  53. package/docs/reflection.md +1 -1
  54. package/docs/routing.md +2 -2
  55. package/docs/system-one-suggestion-gates.md +4 -4
  56. package/docs/troubleshooting.md +9 -35
  57. package/docs/workflow-runtime.md +19 -18
  58. package/docs/workflows/environment-detection.md +11 -9
  59. package/docs/workflows/fable-discipline.md +6 -5
  60. package/docs/workflows/fable-mode.md +6 -5
  61. package/docs/workflows/harness-everything.md +5 -5
  62. package/docs/workflows/improve-codebase-architecture.md +10 -8
  63. package/docs/workflows/install-cognitive-os.md +5 -5
  64. package/docs/workflows/tdd.md +9 -9
  65. package/docs/workflows/zoom-out.md +20 -30
  66. package/environment-detection/SKILL.md +2 -2
  67. package/environment-detection/references/shell-syntax-rules.md +1 -1
  68. package/eval-harness/SKILL.md +1 -1
  69. package/eval-harness/references/scoring-rubric.md +3 -3
  70. package/evals/zoom-out/eval.yaml +2 -2
  71. package/evals/zoom-out/tasks/negative-productive-iteration.yaml +15 -0
  72. package/evals/zoom-out/tasks/negative-trivial-edit.yaml +6 -6
  73. package/evals/zoom-out/tasks/positive-first-failure.yaml +15 -0
  74. package/evals/zoom-out/tasks/positive-repair-loop.yaml +1 -1
  75. package/fable-discipline/SKILL.md +3 -3
  76. package/fable-discipline/references/discipline-rules.md +1 -1
  77. package/fable-mode/SKILL.md +1 -1
  78. package/fable-mode/execution-guardrails/SKILL.md +2 -4
  79. package/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
  80. package/fable-mode/fable-haiku/SKILL.md +1 -1
  81. package/fable-mode/fable-opus/SKILL.md +2 -2
  82. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  83. package/fable-mode/references/execution-phases.md +2 -2
  84. package/harness-everything/SKILL.md +3 -3
  85. package/harness-everything/references/router-workflow-plan.md +2 -2
  86. package/harness-everything/references/skill-registry.md +2 -2
  87. package/harness-everything/references/triage-and-tiers.md +5 -5
  88. package/harness-everything/scripts/bootstrap.js +1 -26
  89. package/harness-everything/scripts/kernel-router-core.js +2 -3
  90. package/harness-everything/scripts/kernel-router.js +1 -1
  91. package/harness-everything/scripts/router-contract-core.js +1 -1
  92. package/harness-everything/scripts/routing-keywords.json +0 -2
  93. package/hooks/hooks.json +0 -33
  94. package/hooks/scripts/lib/harness-state.js +5 -6
  95. package/hooks/scripts/lib/learning-opportunity.js +3 -13
  96. package/hooks/scripts/openai-session-start.js +2 -4
  97. package/improve-codebase-architecture/SKILL.md +3 -3
  98. package/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
  99. package/install-cognitive-os/SKILL.md +3 -3
  100. package/opencode-plugin/README.md +12 -43
  101. package/opencode-plugin/index.mjs +21 -368
  102. package/opencode-plugin/plugin.json +1 -1
  103. package/package.json +2 -4
  104. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  105. package/plugins/harness-everything/hooks/hooks.json +0 -14
  106. package/plugins/harness-everything/hooks/scripts/lib/harness-state.js +5 -6
  107. package/plugins/harness-everything/hooks/scripts/lib/learning-opportunity.js +3 -13
  108. package/plugins/harness-everything/hooks/scripts/lib/workspace.js +2 -2
  109. package/plugins/harness-everything/hooks/scripts/openai-session-start.js +2 -4
  110. package/plugins/harness-everything/hooks/session-start.js +2 -4
  111. package/plugins/harness-everything/plugin.json +1 -1
  112. package/plugins/harness-everything/scripts/lib/advisory-text.js +2 -2
  113. package/plugins/harness-everything/scripts/lib/workspace.js +2 -2
  114. package/plugins/harness-everything/skills/environment-detection/SKILL.md +2 -2
  115. package/plugins/harness-everything/skills/environment-detection/references/shell-syntax-rules.md +1 -1
  116. package/plugins/harness-everything/skills/eval-harness/SKILL.md +1 -1
  117. package/plugins/harness-everything/skills/eval-harness/references/scoring-rubric.md +3 -3
  118. package/plugins/harness-everything/skills/fable-discipline/SKILL.md +3 -3
  119. package/plugins/harness-everything/skills/fable-discipline/references/discipline-rules.md +1 -1
  120. package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
  121. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +2 -4
  122. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
  123. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  124. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +2 -2
  125. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  126. package/plugins/harness-everything/skills/fable-mode/references/execution-phases.md +2 -2
  127. package/plugins/harness-everything/skills/harness-everything/SKILL.md +3 -3
  128. package/plugins/harness-everything/skills/harness-everything/references/router-workflow-plan.md +2 -2
  129. package/plugins/harness-everything/skills/harness-everything/references/skill-registry.md +2 -2
  130. package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +5 -5
  131. package/plugins/harness-everything/skills/harness-everything/scripts/bootstrap.js +1 -26
  132. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +2 -3
  133. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +1 -1
  134. package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +1 -1
  135. package/plugins/harness-everything/skills/harness-everything/scripts/routing-keywords.json +0 -2
  136. package/plugins/harness-everything/skills/improve-codebase-architecture/SKILL.md +3 -3
  137. package/plugins/harness-everything/skills/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
  138. package/plugins/harness-everything/skills/install-cognitive-os/SKILL.md +3 -3
  139. package/plugins/harness-everything/skills/self-evolve/SKILL.md +1 -1
  140. package/plugins/harness-everything/skills/self-evolve/references/memory-resolution.md +3 -3
  141. package/plugins/harness-everything/skills/self-evolve/schemas/lesson-candidate.schema.json +4 -1
  142. package/plugins/harness-everything/skills/self-evolve/scripts/lesson-candidate.js +1 -0
  143. package/plugins/harness-everything/skills/skill-creator/SKILL.md +1 -1
  144. package/plugins/harness-everything/skills/skill-creator/references/quality-checklist.md +1 -1
  145. package/plugins/harness-everything/skills/skill-creator/references/quality-principles.md +4 -4
  146. package/plugins/harness-everything/skills/tdd/SKILL.md +2 -2
  147. package/plugins/harness-everything/skills/tdd/references/core-discipline.md +3 -5
  148. package/plugins/harness-everything/skills/todo-driven-workflow/SKILL.md +2 -2
  149. package/plugins/harness-everything/skills/zoom-out/SKILL.md +14 -26
  150. package/plugins/harness-everything/skills/zoom-out/references/circuit-breaker.md +18 -62
  151. package/references/platform-advisory-template.md +3 -9
  152. package/sbom.cdx.json +7 -7
  153. package/scripts/dispatch.js +340 -0
  154. package/scripts/lib/advisory-text.js +2 -2
  155. package/scripts/lib/workspace.js +2 -2
  156. package/self-evolve/SKILL.md +1 -1
  157. package/self-evolve/references/memory-resolution.md +3 -3
  158. package/self-evolve/schemas/lesson-candidate.schema.json +4 -1
  159. package/self-evolve/scripts/lesson-candidate.js +1 -0
  160. package/skill-creator/SKILL.md +1 -1
  161. package/skill-creator/references/quality-checklist.md +1 -1
  162. package/skill-creator/references/quality-principles.md +4 -4
  163. package/submission/openai/test-cases.json +5 -5
  164. package/tdd/SKILL.md +2 -2
  165. package/tdd/references/core-discipline.md +3 -5
  166. package/todo-driven-workflow/SKILL.md +2 -2
  167. package/zoom-out/SKILL.md +14 -26
  168. package/zoom-out/references/circuit-breaker.md +18 -62
  169. package/behavioral-evals/opencode-hardlock-live.js +0 -17
  170. package/behavioral-evals/opencode-reflection-gate-live.js +0 -342
  171. package/ci/mechanism-31-opencode-hardlock-evidence.test.js +0 -82
  172. package/evals/zoom-out/tasks/negative-first-edge-case-review.yaml +0 -16
  173. package/evals/zoom-out/tasks/positive-repeated-failure.yaml +0 -15
  174. package/hooks/scripts/reset-circuit-breaker.js +0 -30
  175. package/hooks/scripts/rule-of-3-tracker.js +0 -165
  176. package/hooks/scripts/rule-of-3.js +0 -171
  177. package/plugins/harness-everything/hooks/scripts/reset-circuit-breaker.js +0 -30
  178. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +0 -165
  179. package/plugins/harness-everything/hooks/scripts/rule-of-3.js +0 -171
@@ -0,0 +1,340 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('node:child_process');
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+
8
+ const REPORT_WRITER = path.join(__dirname, 'report-writer.js');
9
+ const USAGE = 'Usage: dispatch --runner <codex|opencode> --model <id> --packet <path> --worktree <path> --scratch <absolute-path> --report <path> [--dry-run] [--json] [--help]';
10
+ const VALUE_OPTIONS = new Set(['--runner', '--model', '--packet', '--worktree', '--scratch', '--report']);
11
+ let evidencePaths = {};
12
+
13
+ class DispatchFailure extends Error {
14
+ constructor(exitCode, code, phase, message) {
15
+ super(message);
16
+ this.exitCode = exitCode;
17
+ this.code = code;
18
+ this.phase = phase;
19
+ }
20
+ }
21
+
22
+ function fail(exitCode, code, phase, message) {
23
+ throw new DispatchFailure(exitCode, code, phase, message);
24
+ }
25
+
26
+ function parseArgs(argv) {
27
+ const options = {};
28
+ for (let index = 0; index < argv.length; index += 1) {
29
+ const flag = argv[index];
30
+ if (flag === '--json' || flag === '--dry-run' || flag === '--help') {
31
+ if (options[flag]) fail(10, 'INVALID_INPUT', 'input', `duplicate option: ${flag}`);
32
+ options[flag] = true;
33
+ } else if (VALUE_OPTIONS.has(flag)) {
34
+ if (options[flag] !== undefined) fail(10, 'INVALID_INPUT', 'input', `duplicate option: ${flag}`);
35
+ const value = argv[index + 1];
36
+ if (!value || value.startsWith('--')) fail(10, 'INVALID_INPUT', 'input', `missing value for ${flag}`);
37
+ options[flag] = value;
38
+ index += 1;
39
+ } else {
40
+ fail(10, 'INVALID_INPUT', 'input', `unknown option: ${flag}`);
41
+ }
42
+ }
43
+ return options;
44
+ }
45
+
46
+ function realPath(file) {
47
+ try { return fs.realpathSync.native(file); } catch { return null; }
48
+ }
49
+
50
+ function hasGitMetadata(directory) {
51
+ try {
52
+ return fs.statSync(path.join(directory, 'HEAD')).isFile()
53
+ && fs.statSync(path.join(directory, 'objects')).isDirectory()
54
+ && fs.statSync(path.join(directory, 'refs')).isDirectory()
55
+ && fs.statSync(path.join(directory, 'config')).isFile();
56
+ } catch { return false; }
57
+ }
58
+
59
+ function isGitRoot(directory) {
60
+ const marker = path.join(directory, '.git');
61
+ try {
62
+ const stat = fs.statSync(marker);
63
+ if (stat.isDirectory()) return hasGitMetadata(marker);
64
+ if (stat.isFile()) {
65
+ const match = /^gitdir:\s*(.+)\s*$/i.exec(fs.readFileSync(marker, 'utf8'));
66
+ if (!match) return false;
67
+ const gitdir = path.resolve(directory, match[1]);
68
+ const commonFile = path.join(gitdir, 'commondir');
69
+ const commonDir = fs.existsSync(commonFile) ? path.resolve(gitdir, fs.readFileSync(commonFile, 'utf8').trim()) : gitdir;
70
+ return hasGitMetadata(commonDir);
71
+ }
72
+ } catch {}
73
+ return hasGitMetadata(directory);
74
+ }
75
+
76
+ function canonicalFuturePath(file) {
77
+ let ancestor = path.resolve(file);
78
+ const suffix = [];
79
+ while (!fs.existsSync(ancestor)) {
80
+ const parent = path.dirname(ancestor);
81
+ if (parent === ancestor) break;
82
+ suffix.unshift(path.basename(ancestor));
83
+ ancestor = parent;
84
+ }
85
+ const canonicalAncestor = realPath(ancestor);
86
+ return canonicalAncestor ? path.resolve(canonicalAncestor, ...suffix) : path.resolve(file);
87
+ }
88
+
89
+ function gitAncestor(directory) {
90
+ let current = directory;
91
+ while (true) {
92
+ if (isGitRoot(current)) return current;
93
+ const parent = path.dirname(current);
94
+ if (parent === current) return null;
95
+ current = parent;
96
+ }
97
+ }
98
+
99
+ function validateScratch(value) {
100
+ if (!path.isAbsolute(value)) fail(11, 'UNSAFE_SCRATCH', 'validation', 'scratch must be an absolute path outside every Git repository or worktree');
101
+ const scratch = canonicalFuturePath(value);
102
+ if (fs.existsSync(value) && !fs.statSync(value).isDirectory()) {
103
+ fail(11, 'UNSAFE_SCRATCH', 'validation', 'scratch must be a directory outside every Git repository or worktree');
104
+ }
105
+ const repository = gitAncestor(scratch);
106
+ if (repository) fail(11, 'UNSAFE_SCRATCH', 'validation', `scratch is inside a Git repository or worktree: ${repository}`);
107
+ return path.resolve(value);
108
+ }
109
+
110
+ function pathFrom(base, value) {
111
+ return path.resolve(base, value);
112
+ }
113
+
114
+ function validateInput(options) {
115
+ const runner = options['--runner'];
116
+ const model = options['--model'];
117
+ if (!['codex', 'opencode'].includes(runner)) fail(10, 'INVALID_INPUT', 'input', '--runner must be codex or opencode');
118
+ if (!model || !model.trim()) fail(10, 'INVALID_INPUT', 'input', '--model must be a nonempty id');
119
+ for (const flag of ['--packet', '--worktree', '--scratch', '--report']) {
120
+ if (!options[flag]) fail(10, 'INVALID_INPUT', 'input', `missing required option: ${flag}`);
121
+ }
122
+
123
+ const requestedWorktree = path.resolve(options['--worktree']);
124
+ const worktree = realPath(requestedWorktree);
125
+ if (!worktree || !fs.statSync(worktree).isDirectory() || !isGitRoot(worktree)) {
126
+ fail(10, 'INVALID_INPUT', 'input', '--worktree must name an existing Git repository or worktree root');
127
+ }
128
+ const packet = pathFrom(worktree, options['--packet']);
129
+ if (!fs.existsSync(packet) || !fs.statSync(packet).isFile()) fail(10, 'INVALID_INPUT', 'input', '--packet must name an existing file');
130
+ const report = pathFrom(worktree, options['--report']);
131
+ if (!fs.existsSync(path.dirname(report)) || !fs.statSync(path.dirname(report)).isDirectory()) {
132
+ fail(10, 'INVALID_INPUT', 'input', '--report parent directory must already exist');
133
+ }
134
+ if (fs.existsSync(report)) fail(10, 'INVALID_INPUT', 'input', '--report already exists; choose a fresh report path');
135
+ const scratch = validateScratch(options['--scratch']);
136
+ return { runner, model: model.trim(), packet, worktree, scratch, report };
137
+ }
138
+
139
+ function response(options, outcome, evidence = evidencePaths, input) {
140
+ const message = String(outcome.message || '').slice(0, 1000);
141
+ const result = {
142
+ ok: outcome.exitCode === 0,
143
+ code: outcome.code,
144
+ phase: outcome.phase,
145
+ message,
146
+ };
147
+ const runner = input?.runner ?? options['--runner'];
148
+ const model = input?.model ?? options['--model'];
149
+ if (runner === 'codex' || runner === 'opencode') result.runner = runner;
150
+ if (model) result.model = model;
151
+ if (outcome.argv) result.argv = outcome.argv;
152
+ if (outcome.cwd) result.cwd = outcome.cwd;
153
+ const paths = Object.fromEntries(Object.entries(evidence).filter(([, value]) => value && fs.existsSync(value)));
154
+ if (Object.keys(paths).length) result.evidence = paths;
155
+ if (options['--json']) process.stdout.write(`${JSON.stringify(result)}\n`);
156
+ else if (outcome.exitCode === 0) process.stdout.write(`${message}\n`);
157
+ else process.stderr.write(`dispatch: ${message}\n`);
158
+ process.exitCode = outcome.exitCode;
159
+ }
160
+
161
+ function childTimeout(timeout) {
162
+ // Keep fixture timeout cases bounded while production retains its fixed limits.
163
+ const testTimeout = Number(process.env.DISPATCH_TEST_TIMEOUT_MS);
164
+ return process.env.NODE_ENV === 'test' && Number.isSafeInteger(testTimeout) && testTimeout > 0
165
+ ? Math.min(timeout, testTimeout)
166
+ : timeout;
167
+ }
168
+
169
+ function runChild(command, args, worktree, scratch, logPath, timeout, appendLog = false) {
170
+ const result = spawnSync(command, args, {
171
+ cwd: worktree,
172
+ env: { ...process.env, TMPDIR: scratch },
173
+ encoding: 'utf8',
174
+ stdio: ['ignore', 'pipe', 'pipe'],
175
+ timeout: childTimeout(timeout),
176
+ maxBuffer: 16 * 1024 * 1024,
177
+ });
178
+ const stdout = result.stdout || '';
179
+ const stderr = result.stderr || '';
180
+ const log = `${stdout}${stderr ? `${stdout ? '\n' : ''}[stderr]\n${stderr}` : ''}`;
181
+ if (appendLog) fs.appendFileSync(logPath, log);
182
+ else fs.writeFileSync(logPath, log);
183
+ return { ...result, stdout, stderr };
184
+ }
185
+
186
+ function runnerArgs(input, prompt, outputPath) {
187
+ if (input.runner === 'codex') {
188
+ return ['exec', '-m', input.model, '-s', 'workspace-write', '-C', input.worktree, '-o', outputPath, prompt];
189
+ }
190
+ return ['run', '--auto', '-m', input.model, prompt];
191
+ }
192
+
193
+ const READINESS_DIAGNOSTICS = {
194
+ codex: [
195
+ { line: 'ERROR: Provider request failed with HTTP 429: {"status":429,"title":"Too Many Requests"}', code: 'RUNNER_RATE_LIMITED', message: 'Reduce concurrency on the affected key or retry later.' },
196
+ { line: 'ERROR: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go', code: 'RUNNER_QUOTA', message: 'Select an authorized runner or model with available quota.' },
197
+ ],
198
+ opencode: [
199
+ { line: 'Error: Provider request failed with HTTP 429: {"status":429,"title":"Too Many Requests"}', code: 'RUNNER_RATE_LIMITED', message: 'Reduce concurrency on the affected key or retry later.' },
200
+ { line: 'Error: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go', code: 'RUNNER_QUOTA', message: 'Select an authorized runner or model with available quota.' },
201
+ ],
202
+ };
203
+
204
+ function readinessDiagnostic(runner, stderr) {
205
+ const output = stderr.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '');
206
+ const lines = output.split(/\r?\n/);
207
+ const matches = READINESS_DIAGNOSTICS[runner].filter(diagnostic => lines.includes(diagnostic.line));
208
+ return matches.length === 1 ? matches[0] : null;
209
+ }
210
+
211
+ function readiness(input, paths) {
212
+ const outputPath = input.runner === 'codex' ? paths.readinessOutput : null;
213
+ const prompt = 'Reply exactly with READY.';
214
+ const result = runChild(input.runner, runnerArgs(input, prompt, outputPath), input.worktree, input.scratch, paths.readinessLog, 120000);
215
+ if (result.status !== 0) {
216
+ const diagnostic = Number.isInteger(result.status) && result.status !== 0 && !result.signal && !result.error
217
+ ? readinessDiagnostic(input.runner, result.stderr)
218
+ : null;
219
+ if (diagnostic) fail(13, diagnostic.code, 'readiness', diagnostic.message);
220
+ fail(12, 'NOT_READY', 'readiness', 'Readiness failed. Keep the available child evidence.');
221
+ }
222
+ const answer = input.runner === 'codex'
223
+ ? (fs.existsSync(outputPath) ? fs.readFileSync(outputPath, 'utf8').trim() : '')
224
+ : result.stdout.trim();
225
+ if (answer !== 'READY') fail(12, 'NOT_READY', 'readiness', 'Readiness failed. Keep the available child evidence.');
226
+ }
227
+
228
+ function reportedStatus(raw) {
229
+ const lines = raw.split(/\r?\n/);
230
+ if (lines.at(-1) === '') lines.pop();
231
+ if (lines.at(-1)?.startsWith('<!-- harness-label ')) lines.pop();
232
+ const line = lines.at(-1) || '';
233
+ if (line === 'STATUS: DONE') return { status: 'DONE' };
234
+ const blocked = /^STATUS: BLOCKED: (.+)$/.exec(line);
235
+ if (blocked && blocked[1].trim()) return { status: 'BLOCKED', reason: blocked[1].trim() };
236
+ fail(16, 'REPORT_INVALID', 'report', 'Codex output must end with STATUS: DONE or STATUS: BLOCKED: <reason>');
237
+ }
238
+
239
+ function reportWriter(input, paths, command, args) {
240
+ const result = runChild(process.execPath, [REPORT_WRITER, ...args], input.worktree, input.scratch, paths.writerLog, 120000, true);
241
+ if (result.status !== 0) fail(16, 'REPORT_INVALID', 'report', result.stderr.trim() || `${command} rejected the report`);
242
+ return result;
243
+ }
244
+
245
+ function executionPrompt(input) {
246
+ return input.runner === 'codex'
247
+ ? `Execute the packet at ${input.packet} and return the complete report body.`
248
+ : `Execute the packet at ${input.packet} and write the complete report to ${input.report}.`;
249
+ }
250
+
251
+ function execute(input, options) {
252
+ fs.mkdirSync(input.scratch, { recursive: true });
253
+ const runId = `${process.pid}-${Date.now()}`;
254
+ const paths = {
255
+ readinessOutput: path.join(input.scratch, `${runId}.readiness.txt`),
256
+ readinessLog: path.join(input.scratch, `${runId}.readiness.log`),
257
+ rawOutput: path.join(input.scratch, `${runId}.raw.txt`),
258
+ runLog: path.join(input.scratch, `${runId}.run.log`),
259
+ writerLog: path.join(input.scratch, `${runId}.report-writer.log`),
260
+ };
261
+ evidencePaths = {
262
+ readinessOutput: input.runner === 'codex' ? paths.readinessOutput : null,
263
+ readinessLog: paths.readinessLog,
264
+ rawOutput: input.runner === 'codex' ? paths.rawOutput : null,
265
+ runLog: paths.runLog,
266
+ reportWriterLog: paths.writerLog,
267
+ report: input.report,
268
+ };
269
+
270
+ readiness(input, paths);
271
+ if (fs.existsSync(input.report)) fail(16, 'REPORT_INVALID', 'report', 'report path was populated before execution; refusing stale delivery');
272
+ const prompt = executionPrompt(input);
273
+ const outputPath = input.runner === 'codex' ? paths.rawOutput : null;
274
+ const run = runChild(input.runner, runnerArgs(input, prompt, outputPath), input.worktree, input.scratch, paths.runLog, 2700000);
275
+ if (run.status !== 0) {
276
+ const timedOut = run.error?.code === 'ETIMEDOUT';
277
+ fail(15, timedOut ? 'RUN_TIMEOUT' : 'RUN_FAILED', 'execution', timedOut ? 'runner execution timed out' : `runner execution failed${run.error ? `: ${run.error.message}` : ''}`);
278
+ }
279
+
280
+ if (input.runner === 'codex') {
281
+ if (!fs.existsSync(paths.rawOutput) || fs.existsSync(input.report)) fail(16, 'REPORT_INVALID', 'report', 'fresh Codex output or report path is missing');
282
+ const status = reportedStatus(fs.readFileSync(paths.rawOutput, 'utf8'));
283
+ const writeArgs = ['write', '--from-codex-output', paths.rawOutput, '--output', input.report, '--status', status.status];
284
+ if (status.reason) writeArgs.push('--reason', status.reason);
285
+ reportWriter(input, paths, 'write', writeArgs);
286
+ } else if (!fs.existsSync(input.report)) {
287
+ fail(16, 'REPORT_INVALID', 'report', 'runner did not create a fresh report');
288
+ }
289
+
290
+ const checked = reportWriter(input, paths, 'check', ['check', '--file', input.report]);
291
+ if (/valid \(STATUS: BLOCKED: (.+)\)/.test(checked.stdout)) {
292
+ const reason = /valid \(STATUS: BLOCKED: (.+)\)/.exec(checked.stdout)[1];
293
+ fail(17, 'WORKER_BLOCKED', 'report', `worker delivered a valid BLOCKED report: ${reason}`);
294
+ }
295
+ response(options, {
296
+ exitCode: 0,
297
+ code: 'DONE',
298
+ phase: 'report',
299
+ message: `Dispatch completed and the report is valid: ${input.report}`,
300
+ }, evidencePaths, input);
301
+ }
302
+
303
+ function main() {
304
+ const argv = process.argv.slice(2);
305
+ const jsonRequested = argv.includes('--json');
306
+ let options = { '--json': jsonRequested };
307
+ let input;
308
+ evidencePaths = {};
309
+ try {
310
+ if (argv.includes('--help')) {
311
+ if (argv.some(arg => !['--help', '--json'].includes(arg))) fail(10, 'INVALID_INPUT', 'input', 'help cannot be combined with dispatch options');
312
+ options = { '--json': jsonRequested };
313
+ response(options, { exitCode: 0, code: 'HELP', phase: 'help', message: USAGE });
314
+ return;
315
+ }
316
+ options = parseArgs(argv);
317
+ input = validateInput(options);
318
+ if (options['--dry-run']) {
319
+ const outputPath = input.runner === 'codex' ? path.join(input.scratch, '<run-id>.raw.txt') : null;
320
+ response(options, {
321
+ exitCode: 0,
322
+ code: 'DRY_RUN_OK',
323
+ phase: 'dry-run',
324
+ message: `Validated ${input.runner} model ${input.model} for packet ${input.packet} in ${input.worktree}; scratch ${input.scratch}; report ${input.report}`,
325
+ argv: [input.runner, ...runnerArgs(input, executionPrompt(input), outputPath)],
326
+ cwd: input.worktree,
327
+ }, evidencePaths, input);
328
+ return;
329
+ }
330
+ execute(input, options);
331
+ } catch (cause) {
332
+ if (cause instanceof DispatchFailure) {
333
+ response(options, cause, evidencePaths, input);
334
+ return;
335
+ }
336
+ response(options, new DispatchFailure(1, 'INTERNAL_ERROR', 'application', cause.message || 'unexpected dispatch error'), evidencePaths, input);
337
+ }
338
+ }
339
+
340
+ main();
@@ -29,7 +29,7 @@ const advisoryInstructions = [
29
29
  ``,
30
30
  `## 🤖 COGNITIVE COMPLIANCE`,
31
31
  `- **No universal skill pipeline**: do not force every task through TODO/TDD/Fable.`,
32
- `- **Rule of 3**: after 3 same-signature failures, stop micro-retrying and use a fresh diagnosis / zoom-out. This reflection boundary may block mutation until completed.`,
32
+ `- Agent-initiated zoom-out may start at a meaningful signal; productive iterations may continue while they yield new evidence or narrow the cause.`,
33
33
  `- **Permission boundaries are separate**: explicit host/user approval for destructive or external actions remains authoritative.`,
34
34
  `- **Contract strength**: MUST = required semantic obligation; SHOULD = default with evidence-based exception; MAY = optional optimization. Reminder-only mechanics never downgrade MUST.`,
35
35
  `- **Verification is evidence, not a cage**: MUST verify before completion claims; host hooks may remind rather than persistently block.`,
@@ -153,7 +153,7 @@ function buildCodexGlobalContent() {
153
153
  `- Do not impose a universal TODO/TDD/Fable sequence; use the smallest useful topology plus applicable skills.`,
154
154
  `- MUST verify before declaring done; a reminder-only host mechanism does not make verification optional.`,
155
155
  `- Tier-3/Fable broad mutation MUST resolve isolation: verified linked worktree or explicit degraded fallback.`,
156
- `- After 3 same-signature failures, MUST stop retrying and use a fresh diagnosis / zoom-out.`,
156
+ `- Agent-initiated zoom-out may start at a meaningful signal; productive iterations may continue while they yield new evidence or narrow the cause.`,
157
157
  `- Targeted edits SHOULD be preferred; before committing, MUST inspect the staged diff and SHOULD split unrelated concerns.`,
158
158
  ``
159
159
  ].join('\n');
@@ -202,8 +202,8 @@ function getWorkspaceRoot(context) {
202
202
  return root;
203
203
  }
204
204
 
205
- // Single global root for ALL Harness runtime state (session counters,
206
- // circuit-breaker trips, audit logs, handoff timestamps, ...). Never
205
+ // Single global root for ALL Harness runtime state (session state, audit
206
+ // logs, handoff timestamps, ...). Never
207
207
  // cwd-derived, so a script invoked from a fixture dir, worktree, submodule,
208
208
  // or any other nested non-git directory can never scatter files there
209
209
  // (issue #42). `$HARNESS_STATE_HOME` matches the env var the opencode
@@ -4,7 +4,7 @@ description: "Extract root causes from resolved problems and persist them as def
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.47.1
7
+ version: 0.55.4
8
8
  ---
9
9
 
10
10
  # Self-evolve
@@ -4,11 +4,11 @@ Details moved from SKILL.md. Read when you need the full decision matrix or the
4
4
 
5
5
  ## Responsibility Boundary
6
6
 
7
- Harness may observe only its own structured runtime events. Rule-of-3 recovery and verifier fail→pass transitions can create privacy-minimal lesson candidates automatically; raw prompts, commands, tool output, source text, and global host transcripts are not copied into those candidates. The agent or Human Partner still supplies the generalized rule before evaluation. `self-evolve` MUST NOT scan global transcript stores, persist raw transcripts, or act as a transcript daemon.
7
+ Harness may observe only its own structured runtime events. Agent-initiated reassessment is not triggered by a retry counter; supported structured events such as verifier fail→pass may create privacy-minimal lesson candidates automatically. Raw prompts, commands, tool output, source text, and global host transcripts are not copied into those candidates. The agent or Human Partner still supplies the generalized rule before evaluation. `self-evolve` MUST NOT scan global transcript stores, persist raw transcripts, or act as a transcript daemon.
8
8
 
9
9
  ## Triggers
10
10
 
11
- - **Post-Circuit Breaker**: Following successful recovery after a `zoom-out` reflection.
11
+ - **After Reassessment**: When an agent-chosen `zoom-out` yields a reusable insight.
12
12
  - **Major Breakthrough**: Upon completing complex tasks that revealed non-obvious framework limits or architectural edge cases.
13
13
  - **Explicit Request**: When the user asks to "remember this lesson" or "save this to memory".
14
14
 
@@ -58,7 +58,7 @@ observed -> proposed -> screened -> evaluated
58
58
  -> inconclusive
59
59
  ```
60
60
 
61
- - `rule-of-3-recovery` is intentionally non-replayable from one linear trace and remains `inconclusive` until paired/later recurrence evidence exists.
61
+ - Legacy `rule-of-3-recovery` candidates are historical, remain `inconclusive`, and do not act as an active trigger.
62
62
  - `verifier-fail-pass` can pass deterministic grounding checks because the retained contract records an objective fail→pass transition, but this still does not prove future behavioral improvement.
63
63
  - Identical runtime evidence is idempotent and maps to one candidate ID.
64
64
  - Runtime hooks can create candidates but cannot call the durable memory writer directly.
@@ -47,7 +47,10 @@
47
47
  "type": "object",
48
48
  "required": ["type", "reasonCodes", "sourceEventIds", "evidenceClass"],
49
49
  "properties": {
50
- "type": { "enum": ["rule-of-3-recovery", "verifier-fail-pass"] },
50
+ "type": {
51
+ "enum": ["rule-of-3-recovery", "verifier-fail-pass"],
52
+ "description": "rule-of-3-recovery is retained only for historical candidates; the runtime no longer produces it."
53
+ },
51
54
  "reasonCodes": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
52
55
  "sourceEventIds": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
53
56
  "evidenceClass": { "enum": ["runtime-recovery", "objective-transition"] }
@@ -104,6 +104,7 @@ function replayability(candidate) {
104
104
  method: 'deterministic-transition-check',
105
105
  };
106
106
  }
107
+ // Keep pre-retirement candidates readable; the runtime no longer produces this trigger.
107
108
  if (candidate.trigger?.type === 'rule-of-3-recovery') {
108
109
  return {
109
110
  replayable: false,
@@ -4,7 +4,7 @@ description: Author, audit, and refactor SKILL.md files against one quality bar
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.30.4
7
+ version: 0.55.4
8
8
  ---
9
9
 
10
10
  # Skill Creator
@@ -11,7 +11,7 @@ A skill isn't done until every line here is true. This is deliberately a flat ch
11
11
  - [ ] **Every `MUST`/`MUST NOT`/`PROHIBITED` has a real gate behind it**, or is rewritten as a positive statement of the target behavior. A prohibition with no gate and no "why" sentence next to it is a smell, not a strength.
12
12
  - [ ] **No no-op lines** — for each imperative sentence, ask whether it changes behavior versus what the model already does by default. ("Be thorough" reads as a no-op; a concrete completion criterion or a stronger leading word doesn't.)
13
13
  - [ ] **Body fits the information hierarchy** — steps for ordered action, flat reference for rules, detail past what every branch needs pushed to `guides/`/`references/` with a "when to open this" pointer.
14
- - [ ] **Reuses existing leading words** (`Tier 1/2/3`, `circuit breaker`/`zoom out`, `Rule of 3`, `Red/Green/Refactor`, `Discover > Think > Try > Summarize > Record`) instead of naming a new concept for something this repo already has a word for.
14
+ - [ ] **Reuses existing leading words** (`Tier 1/2/3`, `zoom out`, `Red/Green/Refactor`, `Discover > Think > Try > Summarize > Record`) instead of naming a new concept for something this repo already has a word for.
15
15
  - [ ] **Completion criteria are checkable** — tied to an exit code, a file's existence, a grep result, or explicit human confirmation, not "when it feels done."
16
16
  - [ ] **Description reads as a human-facing sentence**, not just a trigger-phrase list — `scripts/installer.js`'s interactive picker prints it next to a checkbox for a person deciding whether to install this skill; that's its real first reader in this architecture (audit report §2.1).
17
17
 
@@ -45,18 +45,18 @@ A leading word is a compact, already-understood concept the model can think *wit
45
45
  | Leading word | What it compresses |
46
46
  |---|---|
47
47
  | `Tier 1 / 2 / 3` | Task-complexity routing and the whole action-strategy that follows from each |
48
- | `circuit breaker` / `zoom out` | The entire reflect-before-retry protocol in `zoom-out/SKILL.md` |
49
- | `Rule of 3` | "three failed attempts on the same signature ⇒ stop and reflect" |
48
+ | `zoom out` | Agent-initiated reassessment when evidence changes the diagnosis or the next action is unclear |
49
+ | productive iteration | Continuing is valid while attempts yield useful evidence and justify the next step |
50
50
  | `Red / Green / Refactor` | The TDD cycle and which actions are legal in each phase |
51
51
  | `Discover > Think > Try > Summarize > Record` | The base cognitive loop every tier and skill runs inside |
52
52
 
53
- When a new skill needs to say "stop and reflect on repeated failure," write `trigger zoom-out`, not a fresh paragraph re-explaining the reflection protocol. That's the whole payoff of a leading word: one anchored phrase instead of a restated idea.
53
+ When a new skill refers to a fresh diagnosis, use `zoom-out` for agent-initiated reassessment; do not add a count-based stop or required artifact.
54
54
 
55
55
  ## Negation
56
56
 
57
57
  A prohibition drags the forbidden behavior into the model's attention rather than out of it — "don't think of an elephant" makes the elephant the only thing present. This repo uses `MUST NOT`/`PROHIBITED` heavily and by design (`skill-style` mandates it), so the actual lever available isn't "stop using negation" — it's **reserve it for gates that are real**, and pair the rest with the positive target:
58
58
 
59
- - **Does this well**: `zoom-out/SKILL.md`'s "ABSOLUTELY PROHIBITED from proposing any new code modification" is immediately followed by *why* ("that sentence is the tunnel talking") and by what to do instead (Phase 2's read-only fact-checking). The prohibition isn't left to stand alone.
59
+ - **Does this well**: `zoom-out/SKILL.md` names the evidence that can make a fresh diagnosis useful and gives a concrete next-step process. It leaves the choice with the agent instead of imposing a count-based stop.
60
60
  - **Could do better**: `environment-detection/SKILL.md`'s "Red Flags & Common Errors" section restates, as a list of ❌ prohibitions, rules the same file already gave positively one section earlier (which shell uses which syntax). The information isn't wrong, it's just said twice in two moods.
61
61
 
62
62
  If you're about to write `MUST NOT X`, check: is there a script or state mutation that actually enforces this, or human cost if violated (data loss, a broken build, a security gap)? If yes, keep the imperative — that's this repo's real strength, don't soften it. If no, try stating what *good* looks like instead and see if the `MUST NOT` was even carrying information.
@@ -24,11 +24,11 @@
24
24
  "fixture_data": "Provide a short self-contained feature request in the prompt or a text file. No repository history, authentication, or external service is required."
25
25
  },
26
26
  {
27
- "id": "repeat-failure-replan",
28
- "user_prompt": "The same build command has failed three times with the same error. Stop repeating it, summarize what is known, and propose the next diagnostic plan before trying anything else.",
29
- "expected_behavior": "Apply the repeated-failure invariant: do not immediately repeat the same failing action, zoom out, identify the stable failure signature, and produce a different diagnostic plan.",
30
- "expected_result_shape": "A short failure summary, the repeated signature, hypotheses ranked by evidence, and a changed next-step plan rather than another blind retry.",
31
- "fixture_data": "No files or accounts are required. The prompt itself supplies the three same-signature failures for review of recovery behavior."
27
+ "id": "first-failure-reassessment",
28
+ "user_prompt": "The first test failure contradicts my assumption about how callers use this object, and the impact boundary is unclear. You may reassess now using the acceptance clause, observed evidence, and a revised check, then continue. Do not write a report unless it helps.",
29
+ "expected_behavior": "Treat reassessment as an agent choice available at the first meaningful signal. Ground it in the acceptance clause, observed evidence, and a useful next check; continue if the next action is justified. No failure count, mandatory report, or reset ritual applies.",
30
+ "expected_result_shape": "A concise diagnosis that separates observations from assumptions and names a justified next check; a written artifact is optional and objective verification remains necessary before completion.",
31
+ "fixture_data": "No files or accounts are required. The prompt supplies a first failure that exposes an unknown caller-impact boundary."
32
32
  },
33
33
  {
34
34
  "id": "minimal-doc-fix",
package/tdd/SKILL.md CHANGED
@@ -4,7 +4,7 @@ description: "Drive Standard Tasks (Tier 2) with Test-Driven Development (RED/GR
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.47.5
7
+ version: 0.55.4
8
8
  ---
9
9
 
10
10
  # Test-Driven Development
@@ -35,4 +35,4 @@ Load `<this-skill-dir>/references/core-discipline.md` and the quality model, the
35
35
 
36
36
  Deep dive: <this-skill-dir>/references/core-discipline.md
37
37
 
38
- After three failed GREEN attempts, invoke `zoom-out` before another edit.
38
+ When a GREEN attempt reveals a wrong assumption, an unclear impact boundary, or no useful next check, the agent may invoke `zoom-out` to reassess. Continue when each iteration adds evidence and justifies the next step; no failure count requires a pause.
@@ -14,7 +14,7 @@ flowchart TD
14
14
 
15
15
  Green --> CheckPass{Re-run Test Runner}
16
16
  CheckPass -- Tests Pass --> Refactor[3. REFACTOR: Clean Code & Verify Alignments]
17
- CheckPass -- Tests Fail (> 3 Retries) --> ZoomOut[Trigger zoom-out Circuit Breaker]
17
+ CheckPass -- New evidence changes diagnosis --> ZoomOut[Optionally reassess with zoom-out]
18
18
 
19
19
  Refactor --> VerifyFinal[Re-run Tests & Mark Todo Complete]
20
20
  VerifyFinal --> Done[TDD Cycle Complete]
@@ -45,7 +45,5 @@ In the REFACTOR phase, you MUST verify that the implemented code actually aligns
45
45
  - Checks: Is the naming clear? Is there duplicated code? Can performance be improved? Does it comply with the project's Clean Code standards?
46
46
  - **Validation**: After every modification, re-run the tests to ensure refactoring hasn't broken the original functionality.
47
47
 
48
- ## Circuit Breaker Defense
49
- If during a TDD cycle you get stuck in the **GREEN phase**, and 3 consecutive implementation attempts fail to pass the test:
50
- - **Trigger Condition Met**: You might have hit the reasoning ceiling, or the initial test logic (RED) was written incorrectly.
51
- - **Mandatory Action**: Stop guessing blindly. Immediately abort the TDD process and call the `zoom-out` skill: fact-check the assumption behind each failing attempt — including whether the RED test itself encodes the wrong expectation — and resume on a fresh diagnosis. Bring the human in only if the reflection surfaces a genuine decision (e.g., the test contradicts the requirement).
48
+ ## Voluntary Reassessment
49
+ During any TDD phase, an agent may choose `zoom-out` when a result contradicts an assumption, exposes an unknown boundary, or leaves the next check unclear. Review the test, evidence, and attempted changes before selecting a next step. Continue when each iteration yields useful evidence and the next action remains justified; no count or report is required.
@@ -4,7 +4,7 @@ description: "Enforce a deliberate step-by-step execution loop for complex multi
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.4.0
7
+ version: 0.55.4
8
8
  ---
9
9
 
10
10
  # Todo-Driven Workflow
@@ -34,7 +34,7 @@ Single-task milestones prevent context drift in Tier 2/3 work.
34
34
  2. [Record] Initialize the native host tracker before edits; if unavailable, create a Markdown checklist.
35
35
  3. Start exactly one milestone, execute only its scope, and run its named check.
36
36
  4. Mark it complete only after evidence passes; then start the next milestone.
37
- 5. Record blockers in the checklist and escalate after the applicable circuit-breaker threshold.
37
+ 5. Record blockers and surface genuine user decisions when the next step depends on them; choose `zoom-out` when new evidence warrants reassessment.
38
38
 
39
39
  Native TODO tools take priority. Markdown is portable fallback; this skill
40
40
  does not depend on a repository CLI state machine.
package/zoom-out/SKILL.md CHANGED
@@ -1,43 +1,31 @@
1
1
  ---
2
2
  name: zoom-out
3
- description: "Reflect-first circuit breaker - after 3 failures, stop edits, rebuild the full picture with read-only tools, write a fact-check report, then resume or escalate. USE FOR: \"you are stuck in a loop\", \"the same error keeps failing\", \"rethink your assumptions\". DO NOT USE FOR: \"routine single-failure debugging\", \"greenfield planning without failures\"."
3
+ description: "Agent-initiated reassessment when evidence contradicts assumptions, exposes an unknown boundary, or a path stops producing useful information. Use for voluntary diagnosis of stalled or changing work. DO NOT USE FOR: routine debugging when the next check is clear, or greenfield planning."
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.47.5
7
+ version: 0.55.4
8
8
  ---
9
9
 
10
- # Zoom Out (Circuit Breaker)
10
+ # Zoom Out
11
11
 
12
- Stop repeated failures, rebuild the facts, and choose a safe next step.
12
+ Choose a fresh diagnosis when evidence changes your understanding, an important boundary is unknown, or the next action is unclear. You may do this after the first failure or later. Continue while attempts yield useful evidence and the next step is justified.
13
13
 
14
- ## Skill Contract
14
+ ## Reassess
15
15
 
16
- | Component | Specification |
17
- | :--- | :--- |
18
- | **Trigger / Input** | Three same-signature failures, a repair loop, or an explicit loop/rethink request. |
19
- | **Expected Output** | Fact-checked report ending in `RESUME` or `ESCALATE`. |
20
- | **State Mutations** | Writes the session `zoom-out-report.md`; reset may clear breaker state. |
21
- | **Enforcement Gate** | `<skills-repo-root>/hooks/scripts/rule-of-3.js` plus a valid report; a later three-failure cycle requests another reflection. |
16
+ 1. Restate the goal and acceptance criteria.
17
+ 2. Review observed evidence, assumptions, and attempts; separate facts from guesses.
18
+ 3. Trace callers and consumers when a shared decision or impact boundary is unclear.
19
+ 4. Choose the next smallest check or correction. Continue, revise, or surface a genuine user decision.
22
20
 
23
- ## Circuit Breaker Flow
24
-
25
- 1. After three same-signature failures, stop edits and do not ask the user yet.
26
- 2. Use read-only tools to restate the goal and check files, configuration, and logs.
27
- 3. Fill `<this-skill-dir>/templates/zoom-out-report.template.md` and end with `RESUME` or `ESCALATE`.
28
- 4. Resume only on an untried path; escalate genuine user decisions with options. Repair loop: inventory sites first.
29
- 5. If three more matching failures occur, run another zoom-out cycle. `npm run harness:reset` is only an optional manual state clear; record the insight with `self-evolve`.
21
+ This is agent-chosen guidance: no failure count or threshold requires a stop, report, or reset ritual. A written note is optional.
30
22
 
31
23
  ## USE FOR:
32
- - "you are stuck in a loop"
33
- - "the same error keeps failing"
34
- - "every round finds a new edge case"
35
- - "rethink your assumptions"
24
+ - Evidence contradicts a core assumption or exposes an unknown impact boundary.
25
+ - The current approach stops producing useful information, or you request a fresh diagnosis.
36
26
 
37
27
  ## DO NOT USE FOR:
38
- - Routine single-failure debugging — fix it directly
39
- - Greenfield planning without failures (`fable-mode`)
40
-
41
- Never retry the same approach after the third failure, even under pressure.
28
+ - Routine debugging when the next check is clear.
29
+ - Greenfield planning (`fable-mode`).
42
30
 
43
31
  Deep dive: `<this-skill-dir>/references/circuit-breaker.md`