harness-everything 0.55.0 → 0.55.2

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.
@@ -10,7 +10,7 @@
10
10
  "name": "harness-everything",
11
11
  "source": "./",
12
12
  "description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
13
- "version": "0.55.0",
13
+ "version": "0.55.2",
14
14
  "author": {
15
15
  "name": "Miya Daniel"
16
16
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harness-everything",
3
3
  "description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
4
- "version": "0.55.0",
4
+ "version": "0.55.2",
5
5
  "author": {
6
6
  "name": "Miya Daniel"
7
7
  },
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.55.2](https://github.com/dyphn1/Harness-everything/compare/v0.55.1...v0.55.2) (2026-11-20)
6
+
7
+ ### Bug Fixes
8
+
9
+ * align second-stage evaluation and report contracts ([#491](https://github.com/dyphn1/Harness-everything/issues/491)) ([aae6403](https://github.com/dyphn1/Harness-everything/commit/aae6403aaabd3588b2ff6e4343f07659f1d40be2))
10
+
11
+ ## [0.55.1](https://github.com/dyphn1/Harness-everything/compare/v0.55.0...v0.55.1) (2026-11-20)
12
+
13
+ ### Bug Fixes
14
+
15
+ * align first-stage report and verification contracts ([d6de493](https://github.com/dyphn1/Harness-everything/commit/d6de4938ddce7cd6139627ab567fbade526de6b7))
16
+
5
17
  ## [0.55.0](https://github.com/dyphn1/Harness-everything/compare/v0.54.1...v0.55.0) (2026-11-20)
6
18
 
7
19
  ### Features
@@ -18,14 +18,30 @@ const codexHooksCompat = require('../scripts/codex-hooks-compat');
18
18
  // A fake host runner does not mock the compatibility installer's filesystem
19
19
  // writes. Fail closed if any case forgets to pass its explicit temporary home.
20
20
  const realInstall = codexHooksCompat.install;
21
+ function isInsideTempRoot(root, target, pathApi = path) {
22
+ const relative = pathApi.relative(root, target);
23
+ const outside = relative === '..' || relative.startsWith('..' + pathApi.sep) || pathApi.isAbsolute(relative);
24
+ return relative !== '' && !outside;
25
+ }
26
+
21
27
  codexHooksCompat.install = options => {
22
28
  assert(options && options.codexHome, 'tests must supply an explicit temporary Codex home');
23
- const relative = path.relative(os.tmpdir(), path.resolve(options.codexHome));
24
- assert(relative && !relative.startsWith('..') && !path.isAbsolute(relative),
29
+ assert(isInsideTempRoot(os.tmpdir(), path.resolve(options.codexHome)),
25
30
  'test Codex home must be inside the temporary directory');
26
31
  return realInstall(options);
27
32
  };
28
33
 
34
+ for (const [target, inside] of [
35
+ ['D:\\repo', false],
36
+ ['D:\\repo\\..cache', true],
37
+ ['D:\\repo\\child', true],
38
+ ['D:\\other', false],
39
+ ['D:\\', false],
40
+ ['C:\\temp', false],
41
+ ]) {
42
+ assert.strictEqual(isInsideTempRoot('D:\\repo', target, path.win32), inside, target);
43
+ }
44
+
29
45
 
30
46
  function fakeHost({ claudeInstalled = false, codexInstalled = false, codexPluginSourcePath = path.join(ROOT, 'plugins', 'harness-everything'), codexPluginSourceType = 'local', codexAvailableOnly = false, claudeMarketplace = true, codexMarketplace = true, unknownClaudePluginState = false, unknownClaudeYesFlag = false, unknownClaudeJsonFlag = false, clapCodexJsonFlag = false, missingCodexPluginCommand = false, codexHooksError = null } = {}) {
31
47
  const calls = [];
@@ -56,11 +56,21 @@ function assertScopeGating({ ci, release, governance }) {
56
56
  assert.ok(classifier, 'the ci-change-scope job exists');
57
57
  assert.ok(selfRegression, 'the self-regression job exists');
58
58
 
59
- // Only self-regression may be gated by the classifier. Other jobs, their
60
- // steps and later added ungated jobs are deliberately left unpinned.
59
+ // Every dependency chain that could inherit the docs-only skip has a first
60
+ // job that needs the classifier or self-regression.
61
+ const scopeJobs = [CHANGE_SCOPE_JOB, 'self-regression'];
62
+ // Match needs.job and needs['job'] references while skipping quoted strings.
63
+ const needsReference = /'(?:[^']|'')*'|(?<![\w.-])needs\s*(?:\.\s*([\w-]+)|\[\s*'([\w-]+)'\s*\])/gi;
61
64
  for (const [jobId, job] of Object.entries(jobs)) {
62
- if (jobId === CHANGE_SCOPE_JOB || jobId === 'self-regression') continue;
63
- assert.ok(!Object.hasOwn(job, 'if'), `${jobId} must not be gated`);
65
+ if (scopeJobs.includes(jobId)) continue;
66
+ const needs = Array.isArray(job.needs) ? job.needs : [job.needs];
67
+ for (const scopeJob of scopeJobs) {
68
+ assert.ok(!needs.includes(scopeJob), `${jobId} must not depend on ${scopeJob}`);
69
+ }
70
+ for (const [, dotJob, bracketJob] of String(job.if ?? '').matchAll(needsReference)) {
71
+ const dependency = dotJob ?? bracketJob;
72
+ assert.ok(!scopeJobs.includes(dependency?.toLowerCase()), `${jobId} must not reference scope-gated jobs in its condition`);
73
+ }
64
74
  }
65
75
 
66
76
  // The classifier runs only on pull requests and wires its scope output.
@@ -244,13 +254,17 @@ test('real Git merge-base diff includes earlier code, deletions, both rename end
244
254
  }
245
255
  });
246
256
 
247
- test('the workflow gates only self-regression and fails open on every uncertain dependency/output state', () => {
257
+ function readScopeWorkflows() {
248
258
  const readWorkflow = file => yaml.load(fs.readFileSync(path.join(ROOT, file), 'utf8'));
249
- assertScopeGating({
259
+ return {
250
260
  ci: readWorkflow('.github/workflows/ci.yml'),
251
261
  release: readWorkflow('.github/workflows/release.yml'),
252
262
  governance: readWorkflow('.github/workflows/doc-governance.yml'),
253
- });
263
+ };
264
+ }
265
+
266
+ test('the workflow gates only self-regression and fails open on every uncertain dependency/output state', () => {
267
+ assertScopeGating(readScopeWorkflows());
254
268
 
255
269
  const gateCases = [
256
270
  ['successful docs-only classifier', false, 'success', 'docs-only', false],
@@ -272,6 +286,53 @@ test('the workflow gates only self-regression and fails open on every uncertain
272
286
  assert.equal(classifyChangeSet('push', 'a'.repeat(40), 'b'.repeat(40), { runGit: unusedGitForWorkflow }), 'full');
273
287
  });
274
288
 
289
+ test('the oracle accepts jobs with independent conditions and dependencies', () => {
290
+ const workflows = readScopeWorkflows();
291
+ const jobs = workflows.ci.jobs;
292
+ jobs['pilot-offline-evidence'].if = "${{ github.event_name == 'push' }}";
293
+ jobs['extra-check'] = {
294
+ 'runs-on': 'ubuntu-latest',
295
+ steps: [{ run: 'echo check' }],
296
+ };
297
+ assertScopeGating(workflows);
298
+
299
+ jobs['extra-check'].needs = 'pilot-offline-evidence';
300
+ jobs['extra-check'].if = "${{ github.head_ref == 'docs-only' && contains(github.event.pull_request.body, 'needs.ci-change-scope') }}";
301
+ assertScopeGating(workflows);
302
+ });
303
+
304
+ test('the oracle rejects additional jobs wired to scope gating', () => {
305
+ for (const [job, expected] of [
306
+ [{ needs: CHANGE_SCOPE_JOB }, /must not depend on ci-change-scope/],
307
+ [{ needs: ['self-regression'] }, /must not depend on self-regression/],
308
+ [{ if: "needs.ci-change-scope.outputs.scope != 'docs-only'" }, /must not reference scope-gated jobs/],
309
+ [{ if: "needs[ 'ci-change-scope' ].outputs.scope != 'docs-only'" }, /must not reference scope-gated jobs/],
310
+ ]) {
311
+ const workflows = readScopeWorkflows();
312
+ workflows.ci.jobs['extra-check'] = job;
313
+ workflows.ci.jobs['downstream-check'] = { needs: 'extra-check' };
314
+ assert.throws(() => assertScopeGating(workflows), expected);
315
+ }
316
+ });
317
+
318
+ test('the oracle retains the existing scope-gating invariants', () => {
319
+ for (const [mutate, expected] of [
320
+ [({ ci }) => { delete ci.jobs['self-regression'].needs; }, /deep-equal/],
321
+ [({ ci }) => { ci.jobs['self-regression'].if = "${{ needs.ci-change-scope.outputs.scope != 'docs-only' }}"; }, /fallback predicate/],
322
+ [({ ci }) => { ci.jobs[CHANGE_SCOPE_JOB].outputs.scope = '${{ steps.wrong.outputs.scope }}'; }, /steps\.scope\.outputs\.scope/],
323
+ [({ ci }) => { ci.jobs[CHANGE_SCOPE_JOB].steps.find(step => step.id === 'scope').env.PR_BASE_SHA = ''; }, /base\.sha/],
324
+ [({ ci }) => { ci.jobs['self-regression'].strategy.matrix.os.pop(); }, /macos-latest/],
325
+ [({ ci }) => { ci.on.push['paths-ignore'] = ['docs/**']; }, /no workflow-level paths-ignore filter/],
326
+ [({ release }) => { release.jobs.gate.uses = './.github/workflows/other.yml'; }, /\.\/\.github\/workflows\/ci\.yml/],
327
+ [({ release }) => { release.jobs.gate.needs = CHANGE_SCOPE_JOB; }, /release\.yml job gate must not depend on the classifier/],
328
+ [({ governance }) => { Object.values(governance.jobs)[0].if = SELF_REGRESSION_IF; }, /doc-governance\.yml job .* must not be gated/],
329
+ ]) {
330
+ const workflows = readScopeWorkflows();
331
+ mutate(workflows);
332
+ assert.throws(() => assertScopeGating(workflows), expected);
333
+ }
334
+ });
335
+
275
336
  function unusedGitForWorkflow() {
276
337
  throw new Error('the release caller is a push/dispatch, so no PR diff may authorize a skip');
277
338
  }
@@ -14,11 +14,21 @@ const FIXED_DATE = '2000-01-01T00:00:00Z';
14
14
 
15
15
  function isOutside(root, target, pathApi = path) {
16
16
  const relative = pathApi.relative(root, target);
17
- return relative.startsWith('..') || pathApi.isAbsolute(relative);
17
+ return relative === '..' || relative.startsWith('..' + pathApi.sep) || pathApi.isAbsolute(relative);
18
18
  }
19
19
 
20
- assert.equal(isOutside('D:\\repo', 'C:\\tmp\\fixture', path.win32), true, 'cross-drive fixtures are outside');
21
- assert.equal(isOutside('D:\\repo', path.win32.join('D:\\repo', 'fixture'), path.win32), false, 'same-drive children are inside');
20
+ test('temporary fixture containment respects Windows path segments and drives', () => {
21
+ for (const [target, outside] of [
22
+ ['D:\\repo', false],
23
+ ['D:\\repo\\..cache', false],
24
+ ['D:\\repo\\child', false],
25
+ ['D:\\other', true],
26
+ ['D:\\', true],
27
+ ['C:\\temp', true],
28
+ ]) {
29
+ assert.equal(isOutside('D:\\repo', target, path.win32), outside, target);
30
+ }
31
+ });
22
32
 
23
33
  function gitEnv(tempRoot) {
24
34
  const env = { ...process.env };
@@ -9,6 +9,10 @@ const { test } = require('node:test');
9
9
 
10
10
  const ROOT = path.resolve(__dirname, '..');
11
11
  const CLI = path.join(ROOT, 'scripts', 'report-writer.js');
12
+ // Existing Codex acceptance example in ci/mechanism-397-host-acceptance.test.js.
13
+ const CODEX_LABEL = { v: 1, validity: 'actionable', tier: 'tier2', intents: ['fix'], workflow: 'iterative-single', skills: [] };
14
+ const labelLine = value => `<!-- harness-label ${JSON.stringify(value)} -->`;
15
+ const VALID_LABEL = labelLine(CODEX_LABEL);
12
16
 
13
17
  function tempDir(t) {
14
18
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-report-writer-'));
@@ -122,7 +126,7 @@ test('strips only one valid terminal host label and reports the extraction', t =
122
126
  const dir = tempDir(t);
123
127
  const raw = path.join(dir, 'raw.txt');
124
128
  const output = path.join(dir, 'report.md');
125
- const rawBytes = Buffer.from('Summary\nSTATUS: DONE\n<!-- harness-label {"v":1,"validity":"actionable"} -->\n');
129
+ const rawBytes = Buffer.from(`Summary\nSTATUS: DONE\n${VALID_LABEL}\n`);
126
130
  fs.writeFileSync(raw, rawBytes);
127
131
  const result = run(writeArgs(output, 'DONE', ['--from-codex-output', raw]));
128
132
  assertOk(result);
@@ -152,7 +156,7 @@ test('assembles BLOCKED from a raw body, blank line, and one EOF host label', t
152
156
  const dir = tempDir(t);
153
157
  const raw = path.join(dir, 'raw.txt');
154
158
  const output = path.join(dir, 'report.md');
155
- const rawBytes = Buffer.from('Summary\n\nEvidence\n\n<!-- harness-label {"v":1,"validity":"actionable","tier":"tier2","intents":["test"],"workflow":"iterative-single","skills":[]} -->');
159
+ const rawBytes = Buffer.from(`Summary\n\nEvidence\n\n${labelLine({ ...CODEX_LABEL, intents: ['fix', 'lookup'], contextDependent: false })}`);
156
160
  const body = rawBytes.subarray(0, rawBytes.lastIndexOf(Buffer.from('<!-- harness-label')));
157
161
  fs.writeFileSync(raw, rawBytes);
158
162
 
@@ -208,6 +212,37 @@ test('rejects missing, blank, multiline, or unused outcome reasons without chang
208
212
  }
209
213
  });
210
214
 
215
+ test('464 rejects unrecognized terminal label schemas before touching report or raw evidence', t => {
216
+ const dir = tempDir(t);
217
+ const raw = path.join(dir, 'raw.txt');
218
+ const output = path.join(dir, 'report.md');
219
+ const before = Buffer.from('Keep this report\nSTATUS: DONE\n');
220
+ fs.writeFileSync(output, before);
221
+ const invalid = [
222
+ {},
223
+ { note: 'unrelated' },
224
+ { v: 1 },
225
+ { validity: 'actionable' },
226
+ { ...CODEX_LABEL, v: 2 },
227
+ { ...CODEX_LABEL, validity: 'unknown' },
228
+ { ...CODEX_LABEL, tier: 'tier9' },
229
+ { ...CODEX_LABEL, workflow: 'unknown' },
230
+ { ...CODEX_LABEL, intents: 'fix' },
231
+ { ...CODEX_LABEL, skills: [42] },
232
+ [],
233
+ ];
234
+ for (const [label, reason] of [
235
+ ...invalid.map(value => [labelLine(value), /recognized.*harness-label/]),
236
+ ['<!-- harness-label {bad json} -->', /valid JSON/],
237
+ ]) {
238
+ const rawBytes = Buffer.from(`Summary\nSTATUS: DONE\n${label}\n`);
239
+ fs.writeFileSync(raw, rawBytes);
240
+ assertRejected(run(writeArgs(output, 'DONE', ['--from-codex-output', raw])), reason);
241
+ assert.deepEqual(fs.readFileSync(raw), rawBytes);
242
+ assert.deepEqual(fs.readFileSync(output), before);
243
+ }
244
+ });
245
+
211
246
  test('rejects mismatched, malformed, duplicate, or trailing Codex controls and preserves both files', t => {
212
247
  const dir = tempDir(t);
213
248
  const raw = path.join(dir, 'raw.txt');
@@ -222,13 +257,12 @@ test('rejects mismatched, malformed, duplicate, or trailing Codex controls and p
222
257
  ['Summary\nSTATUS: DONE\nSTATUS: DONE\n', 'DONE'],
223
258
  ['Summary\nSTATUS: DONE\n\n', 'DONE'],
224
259
  ['Summary\nSTATUS: DONE\ntext after status\n', 'DONE'],
225
- ['Summary\nSTATUS: DONE\n\n<!-- harness-label {"v":1} -->', 'DONE'],
226
- ['Summary\nSTATUS: DONE\ntext\n<!-- harness-label {"v":1} -->', 'DONE'],
227
- ['Summary\nSTATUS: DONE\n<!-- harness-label {bad json} -->\n', 'DONE'],
228
- ['Summary\nSTATUS: DONE\n<!-- harness-label [] -->\n', 'DONE'],
229
- ['Summary\nSTATUS: DONE\n<!-- harness-label {"v":1} -->\n<!-- harness-label {"v":1} -->\n', 'DONE'],
230
- ['Summary\nSTATUS: DONE\n<!-- harness-label {"v":1} -->\ntrailing text', 'DONE'],
231
- ['Summary <!-- harness-label {"v":1} -->\nSTATUS: DONE\n', 'DONE'],
260
+ [`Summary\nSTATUS: DONE\n\n${VALID_LABEL}`, 'DONE'],
261
+ [`Summary\nSTATUS: DONE\ntext\n${VALID_LABEL}`, 'DONE'],
262
+ [`Summary\nSTATUS: DONE\n${VALID_LABEL}\n${VALID_LABEL}\n`, 'DONE'],
263
+ [`Summary\nSTATUS: DONE\n${VALID_LABEL}\ntrailing text`, 'DONE'],
264
+ [`Summary ${VALID_LABEL}\nSTATUS: DONE\n`, 'DONE'],
265
+ ['Summary\nSTATUS: DONE\n<!-- unrelated metadata -->\n', 'DONE'],
232
266
  ];
233
267
  for (const [contents, status, ...extra] of invalidRaw) {
234
268
  const rawBytes = Buffer.from(contents);
@@ -14,7 +14,6 @@ function fixture(t, { stage = 'validity', options = ['invalid'], referenceOnly =
14
14
  const versionDir = path.join(dir, 'version');
15
15
  fs.mkdirSync(versionDir);
16
16
  const history = path.join(dir, 'history.jsonl');
17
- const out = path.join(dir, 'out');
18
17
  const writeVersion = version => {
19
18
  const catalogs = { validity: ['invalid'], intent: ['fix'], tier: ['tier1'] };
20
19
  catalogs[stage] = options;
@@ -36,15 +35,19 @@ function fixture(t, { stage = 'validity', options = ['invalid'], referenceOnly =
36
35
  fs.writeFileSync(path.join(versionDir, 'manifest.json'), JSON.stringify(manifest));
37
36
  return manifest;
38
37
  };
39
- function run({ version = 'v1', val, holdout, mutateManifest, expectFailure = false } = {}) {
38
+ function run({ version = 'v1', val, otherVal = {}, holdout, mutateManifest,
39
+ expectFailure = false, out = path.join(dir, 'out') } = {}) {
40
40
  const manifest = writeVersion(version);
41
41
  if (mutateManifest) {
42
42
  mutateManifest(manifest);
43
43
  fs.writeFileSync(path.join(versionDir, 'manifest.json'), JSON.stringify(manifest));
44
44
  }
45
- const valFile = path.join(dir, `${version}-val.jsonl`);
46
- fs.writeFileSync(valFile, val.map(row => JSON.stringify(row)).join('\n') + '\n');
47
- const args = [cli, '--version', version, '--version-dir', versionDir, '--val-scores', `${stage}=${valFile}`, '--history', history, '--out', out];
45
+ const args = [cli, '--version', version, '--version-dir', versionDir, '--history', history, '--out', out];
46
+ for (const [name, rows] of Object.entries({ [stage]: val, ...otherVal })) {
47
+ const file = path.join(dir, `${version}-${name}-val.jsonl`);
48
+ fs.writeFileSync(file, rows.map(row => JSON.stringify(row)).join('\n') + '\n');
49
+ args.push('--val-scores', `${name}=${file}`);
50
+ }
48
51
  if (holdout) {
49
52
  const holdoutFile = path.join(dir, `${version}-holdout.jsonl`);
50
53
  fs.writeFileSync(holdoutFile, holdout.map(row => JSON.stringify(row)).join('\n') + '\n');
@@ -52,7 +55,9 @@ function fixture(t, { stage = 'validity', options = ['invalid'], referenceOnly =
52
55
  }
53
56
  const child = spawnSync(process.execPath, args, { cwd: root, encoding: 'utf8', env: { ...process.env, HARNESS_SYSTEM_ONE_HOME: dir } });
54
57
  if (expectFailure) {
55
- assert.notEqual(child.status, 0, child.stdout);
58
+ assert.notEqual(child.status, 0, JSON.stringify({ stdout: child.stdout,
59
+ compared: fs.existsSync(path.join(out, 'trend.json'))
60
+ ? JSON.parse(fs.readFileSync(path.join(out, 'trend.json'), 'utf8')).compared : null }));
56
61
  return child;
57
62
  }
58
63
  assert.equal(child.status, 0, child.stderr || child.stdout);
@@ -122,6 +127,42 @@ test('one successful run appends exactly one history line', t => {
122
127
  assert.deepEqual(JSON.parse(lines[1]), second.curves);
123
128
  });
124
129
 
130
+ test('458 rejects a recorded version in a fresh cycle before writing artifacts', t => {
131
+ const f = fixture(t);
132
+ const original = path.join(f.dir, 'original-cycle');
133
+ const fresh = path.join(f.dir, 'fresh-cycle');
134
+ fs.mkdirSync(fresh);
135
+ const scores = {
136
+ val: validityRows([['invalid', 0.8], ['actionable', 0.2]]),
137
+ otherVal: {
138
+ intent: [{ id: 'i0', gold: ['fix'], scores: { fix: 0.8 } }],
139
+ tier: [{ id: 't0', gold: 'tier1', scores: { tier1: 0.8 } }],
140
+ },
141
+ };
142
+ f.run({ version: 'v0', ...scores, out: original });
143
+ assert.deepEqual(f.run({ version: 'v1', ...scores, out: original }).trend.compared, ['v0', 'v1']);
144
+ const saved = ['curves.json', 'trend.json'].map(name => fs.readFileSync(path.join(original, name)));
145
+ const history = fs.readFileSync(f.history);
146
+
147
+ const refusal = f.run({ version: 'v1', ...scores, out: fresh, expectFailure: true });
148
+ assert.equal(refusal.status, 1, refusal.stderr);
149
+ assert.match(refusal.stderr, /version already recorded/);
150
+ assert.deepEqual(fs.readdirSync(fresh), []);
151
+
152
+ const resumed = spawnSync(process.execPath, [cli, '--version', 'v1', '--version-dir', path.join(f.dir, 'version'),
153
+ '--history', f.history, '--out', original, '--resume-curves', path.join(original, 'curves.json')],
154
+ { cwd: root, encoding: 'utf8', env: { ...process.env, HARNESS_SYSTEM_ONE_HOME: f.dir } });
155
+ assert.equal(resumed.status, 0, resumed.stderr);
156
+ assert.deepEqual(JSON.parse(resumed.stdout), { resumed: true, version: 'v1' });
157
+ assert.deepEqual(fs.readFileSync(f.history), history);
158
+ assert.deepEqual(['curves.json', 'trend.json'].map(name => fs.readFileSync(path.join(original, name))), saved);
159
+
160
+ assert.deepEqual(f.run({ version: 'v2', ...scores, out: fresh }).trend.compared, ['v0', 'v1', 'v2']);
161
+ const after = fs.readFileSync(f.history);
162
+ assert.deepEqual(after.subarray(0, history.length), history);
163
+ assert.deepEqual(after.toString().trimEnd().split('\n').map(line => JSON.parse(line).version), ['v0', 'v1', 'v2']);
164
+ });
165
+
125
166
  test('446 H2: empty, LF, and CRLF histories append readable rows without rewriting prior bytes', t => {
126
167
  const f = fixture(t);
127
168
  const first = f.run({ version: 'v0', val: validityRows([['invalid', 0.8], ['actionable', 0.2]]) });
@@ -7,7 +7,8 @@ const path = require('node:path');
7
7
  const { createHash } = require('node:crypto');
8
8
  const { spawnSync } = require('node:child_process');
9
9
  const install = require('../harness-everything/scripts/system-one/install');
10
- const { PINNED_CUA_S1_REVISION } = require('../harness-everything/scripts/system-one/provider');
10
+ const { PINNED_CUA_S1_REVISION, readActive } = require('../harness-everything/scripts/system-one/provider');
11
+ const { validateVersionManifest } = require('../harness-everything/scripts/system-one/manifest');
11
12
  const script = path.join(__dirname, '../harness-everything/scripts/system-one/install.js');
12
13
  const sha = buf => createHash('sha256').update(buf).digest('hex');
13
14
  const stages = ['validity', 'intent', 'tier'];
@@ -17,17 +18,17 @@ function tempDir(prefix) {
17
18
  return fs.realpathSync.native(dir);
18
19
  }
19
20
 
20
- function makeRepo(root, version = 'v1') {
21
+ function makeRepo(root, version = 'v1', weightsExtension = '.weights') {
21
22
  const checkpoint = path.join(root, 'models', 'cua-s1', version);
22
23
  fs.mkdirSync(checkpoint, { recursive: true });
23
24
  const manifest = { schemaVersion: 1, version, createdAt: '2026-11-14T00:00:00.000Z', stages: {}, evaluation: 'evaluation.json' };
24
25
  for (const stage of stages) {
25
26
  const weights = Buffer.from(`${stage}-weights`);
26
27
  const config = Buffer.from(JSON.stringify({ stage, format: 'fixture' }));
27
- fs.writeFileSync(path.join(checkpoint, `${stage}.weights`), weights);
28
+ fs.writeFileSync(path.join(checkpoint, `${stage}${weightsExtension}`), weights);
28
29
  fs.writeFileSync(path.join(checkpoint, `${stage}.json`), config);
29
30
  manifest.stages[stage] = {
30
- weights: `${stage}.weights`, config: `${stage}.json`, sha256: sha(weights),
31
+ weights: `${stage}${weightsExtension}`, config: `${stage}.json`, sha256: sha(weights),
31
32
  options: [`${stage}-a`, `${stage}-b`], thresholds: { [`${stage}-a`]: 0.5, [`${stage}-b`]: 0.6 },
32
33
  };
33
34
  }
@@ -103,6 +104,41 @@ test('install accepts referenceOnly only when its option threshold is one', () =
103
104
  } finally { remove(root, home); }
104
105
  });
105
106
 
107
+ test('447 rejects nested live stage paths at install while flat stages and nested evaluation still work', t => {
108
+ const root = tempDir('harness-s1-repo-');
109
+ const home = tempDir('harness-s1-home-');
110
+ t.after(() => remove(root, home));
111
+ const source = makeRepo(root, 'v1', '.safetensors');
112
+ const manifestFile = path.join(source, 'manifest.json');
113
+ const manifest = JSON.parse(fs.readFileSync(manifestFile, 'utf8'));
114
+ const artifacts = path.join(source, 'artifacts');
115
+ fs.mkdirSync(artifacts);
116
+ fs.renameSync(path.join(source, manifest.evaluation), path.join(artifacts, manifest.evaluation));
117
+ manifest.evaluation = 'artifacts/evaluation.json';
118
+
119
+ for (const field of ['weights', 'config']) {
120
+ const name = manifest.stages.intent[field];
121
+ fs.copyFileSync(path.join(source, name), path.join(artifacts, name));
122
+ const nested = structuredClone(manifest);
123
+ nested.stages.intent[field] = `artifacts/${name}`;
124
+ fs.writeFileSync(manifestFile, JSON.stringify(nested));
125
+ assert.throws(() => validateVersionManifest(nested), /intent weights and config must be flat filenames/);
126
+ assert.throws(() => install.installVersion(root, 'v1', home), /intent weights and config must be flat filenames/);
127
+ assert.equal(fs.existsSync(path.join(home, 'versions')), false);
128
+ assert.equal(fs.existsSync(path.join(home, 'active.json')), false);
129
+ }
130
+
131
+ fs.writeFileSync(manifestFile, JSON.stringify(manifest));
132
+ assert.equal(validateVersionManifest(manifest), manifest);
133
+ const installed = install.installVersion(root, 'v1', home);
134
+ install.activate('v1', home);
135
+ const active = readActive({ HARNESS_SYSTEM_ONE_HOME: home });
136
+ assert.equal(active?.version, 'v1');
137
+ assert.equal(active.stages.intent.weightsPath, path.join(installed.dir, manifest.stages.intent.weights));
138
+ assert.equal(active.stages.intent.configPath, path.join(installed.dir, manifest.stages.intent.config));
139
+ assert.equal(fs.readFileSync(path.join(installed.dir, manifest.evaluation), 'utf8'), '{"samples":2}');
140
+ });
141
+
106
142
  test('S1-I03 activation and rollback round-trip through the previous pointer', () => {
107
143
  const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
108
144
  try {
@@ -1,6 +1,6 @@
1
1
  # Error Handling — three-view overview
2
2
 
3
- > **Canonical map** for [#437](https://github.com/dyphn1/Harness-everything/issues/437) (concept and decisions) and [#402](https://github.com/dyphn1/Harness-everything/issues/402) (implementation). Moved from `discussion/437-*` on 2026-11-18; concept decisions still change only through #437. Action identities live in [nodes.yaml](./nodes.yaml); its `links` must match View 1. Level 2/3 documents marked *proposed* describe designs, not shipped behaviour, unless they name the shipped script.
3
+ > **Canonical map** for [#437](https://github.com/dyphn1/Harness-everything/issues/437) (concept and decisions) and [#402](https://github.com/dyphn1/Harness-everything/issues/402) (implementation). Moved from `discussion/437-*` on 2026-11-18; concept decisions still change only through #437. Action identities live in [nodes.yaml](./nodes.yaml); its `links` must match View 1. Levels 1 and 2 describe the proposed workflow. The Level 3 [E-0002 W1 report writer](./details/e0002-report-writer.md) shipped in [#462](https://github.com/dyphn1/Harness-everything/pull/462).
4
4
 
5
5
  An Overview contains **three distinct views**. Their responsibilities must not be merged into a single linear picture:
6
6
 
@@ -18,7 +18,7 @@ An Overview contains **three distinct views**. Their responsibilities must not b
18
18
  - **P2-2 · Registry mapping:** use [the lightweight document/relationship registry](./registry.md) to relate Layer → Document → relevant detail while keeping the existing [Action identities](./nodes.yaml). Registry references are for **lookup/lazy loading**, not a second set of workflow arrows or Action IDs.
19
19
  - **P2-3 · Action handoff:** do **not** impose mandatory input/output schemas on general Actions or behavior blocks. An Action guides what to do and keeps legitimate Agent discretion; concrete Script/CLI/API boundaries document inputs, outputs and return codes only when required (see the E-0002 [Level 3 report writer contract](./details/e0002-report-writer.md)).
20
20
 
21
- This is a **discussion-only** mapping. No evidence yet establishes View/Level confusion; no new global validation gate, loader, governance process or runtime Script exists. Measure Error Handling effectiveness only after the full mechanism including Hook/Skill delivery is integrated.
21
+ This mapping records design decisions. Measure Error Handling effectiveness after the full mechanism, including Hook/Skill delivery, is integrated.
22
22
 
23
23
  ## Level 2 — magnified behavior blocks (E-0002 example)
24
24
 
@@ -26,16 +26,16 @@ This is a **discussion-only** mapping. No evidence yet establishes View/Level co
26
26
 
27
27
  The E-0002 example expands two blocks: **ASSESS (A Capture, B Triage, C Identify)** and **RESPOND (D Decide, E Treat, F Deliver, G Accept)**. It retains Level 1's branching authority, including the distinction **unidentified → Hold** versus **identified/non-blocking → Defer**. Script/CLI return codes let Agent handle unmet constraints **inside the relevant block**; no extra Level 1 control loop is introduced. The Level 1 Action sequence and recurrence boundary remain authoritative.
28
28
 
29
- **Action priority:** tell Agent what to do, not just how to document the last mistake. Here a proposed scoped writer/checker would take truthful content/status, consume `codex exec -o` **as script-mediated raw input**, write/check the final report, and return actionable failure codes. A failed treatment result still reaches the **Deliver and Accept** outcome for the current occurrence. Delivering a reusable command now and exposing it through Hook/Skill in a future relevant task are **different time contexts**, not contradictory Action ordering.
29
+ For a required E-0002 report, use the shipped W1 writer/checker (`npm run report -- write` and `npm run report -- check`). Supply the report content and status, then check the finished file. For `codex exec -o`, supply the raw output through `--from-codex-output`. A failed treatment result still reaches **Deliver and Accept** for the current occurrence.
30
30
 
31
31
  ## Level 3 — optional procedure, CLI/Script contract and evidence
32
32
 
33
33
  Read only the details required for the current Action/block:
34
34
  - [Capture evidence and artifact provenance](./details/e0002-capture-evidence.md): raw report vs final turn, source and unknowns.
35
- - [Treat report writer and `-o` script contract](./details/e0002-report-writer.md): candidate commands, deterministic validation, return codes, negative cases and host-boundary handling.
35
+ - [Treat report writer and `-o` script contract](./details/e0002-report-writer.md): runnable commands, validation, return codes, negative cases and host-boundary handling.
36
36
  - [Existing E-0002 ledger](../../.agents/harness-everything/errors/E-0002-report-missing-terminal-status.md) and [ROUTE-001](../adr/ROUTE-001-error-lesson-delivery.md): existing evidence and delivery background, not duplicated as another store.
37
37
 
38
- **Status:** this is a discussion draft. Level 1 activity / Action identity / Error Ledger / live Hooks are **unchanged**; the proposed CLI has **not** been implemented. A structural PASS from a script is not a substantive task PASS. The integrated Error Handling + Hook system must exist before measuring recurrence and total cost.
38
+ W1 runs locally through `scripts/report-writer.js`. Hook/Skill disclosure ([#394](https://github.com/dyphn1/Harness-everything/issues/394)) and future node/registry expansion remain proposals. A successful CLI check confirms report structure. Use task evidence to assess the underlying result.
39
39
 
40
40
  ## Decision — Error occurrence and recurrence boundary
41
41
 
@@ -1,12 +1,12 @@
1
1
  # E-0002 Treat — Level 3 report-writer contract and test cases
2
2
 
3
- > **Proposed design / Level 3 supporting contract, NOT an implemented CLI.** Companion to the [E-0002 Level 2 Action Map](../actions/e0002-action-map.md) and [Level 1](../README.md) in [#437](https://github.com/dyphn1/Harness-everything/issues/437) and the Error Handling subtree [#402](https://github.com/dyphn1/Harness-everything/issues/402). This specifies **what the agent should do next time** and **which mechanical operation should prevent a repeat**. The proposed commands below do not exist yet; this document does not change production hooks, report rules or ledger state.
3
+ > **Shipped W1 CLI.** [#462](https://github.com/dyphn1/Harness-everything/pull/462) added `scripts/report-writer.js`, exposed through `npm run report`. This is the Level 3 contract for the report operation in the proposed [Level 2 Action Map](../actions/e0002-action-map.md) and [Level 1 workflow](../README.md). Hook/Skill disclosure and future node/registry expansion remain proposals.
4
4
 
5
5
  ## Problem to prevent
6
6
 
7
7
  **E-0002** (`report-protocol`) recurs when a report lacks its required **raw, column-zero, terminal** `STATUS: DONE` or `STATUS: BLOCKED: <reason>` line, or when a harness-label appears after it. Some failures happen in `codex exec -o` outputs where the report is also the final turn text. Previous instructions and reminders were not enough: the next agent can make the same mistake again.
8
8
 
9
- **Treatment direction (proposal):** stop using free-form report editing for the terminal protocol. The **agent supplies report content and an evidence-grounded status**, while one **scoped CLI/script writes and verifies the final report file**. Preserve free-form content authoring; restrict only the structured output operation. Do not add a global document governor, second Error Ledger, automatic report generation for unrelated tasks, or a count-driven lock.
9
+ The agent supplies the report body and an evidence-grounded status. The writer assembles and verifies the final report, including the terminal STATUS line.
10
10
 
11
11
  **Action ownership:** A Capture records facts; B Triage and C Identify establish the case; D Decide chooses treatment. **E Treat defines/applies the mechanical report-writing method**; F Deliver gives the agent a concise instruction and the available CLI; G Accept checks its result. This is an **E-0002-specific Action detail**, not a second Level 1 flow or a claim that all classes have the same treatment.
12
12
 
@@ -32,46 +32,52 @@ flowchart TD
32
32
  F --> G["G · Accept against applicable contract<br/>and separate task evidence"]
33
33
  ```
34
34
 
35
- The E-0002 report script is **proposed, not deployed**. The Agent determines outcome; a mechanical script owns report assembly, validation and useful errors. The response block may choose a fitting operation without creating a new Level 1 branch. A failed script result does **not** bypass F/G or count as a successful report; unresolved evidence is delivered and the occurrence remains open.
35
+ A nonzero exit leaves the report operation unresolved. Deliver the evidence through F/G and keep the occurrence open until the applicable acceptance conditions are met.
36
36
 
37
- ## Agent-facing procedure — proposed operational contract
37
+ ## Agent-facing procedure
38
38
 
39
39
  For a step **explicitly required to produce a report**:
40
40
 
41
41
  1. **Perform the work and collect evidence.** The agent must decide the true task/packet status based on observed results. `DONE` is not inferred by the CLI from a successful invocation; `BLOCKED` requires an actual reason. A completed RED experiment is not automatically product GREEN.
42
- 2. **Prepare only the free-form body** in a staging file. Do not add a terminal STATUS line or a harness-label to that body. If the host's `-o` captures the turn's final text, treat it as **script input / raw staging output**, not the finished report.
43
- 3. **Call the report writer** with the body path, final output path, and explicit status; the writer adds exactly one terminal STATUS line and writes the complete report atomically.
42
+ 2. **Choose the input mode.** Use `--body-file` for a staged body, `--context` for inline text, or `--from-codex-output` for the raw file captured by `codex exec -o`. Keep STATUS lines and harness-label comments out of ordinary body inputs.
43
+ 3. **Call the report writer** with the chosen input, final output path, and explicit status. The writer publishes the report atomically with one terminal STATUS line.
44
44
  4. **Check the written file**, not merely the CLI stdout, and retain the result as evidence. Do not append to the finalized report; to revise, change the body and call the writer again.
45
- 5. **Return the report reference and verified result** to the caller. A separate final turn keeps its own applicable host label contract. For any shared raw `-o` output, the **script** must apply an explicit host-aware extraction contract before writing the final report; return nonzero with raw evidence if it cannot do so. Do not silently strip arbitrary metadata or declare a contract exception deployed.
45
+ 5. **Return the report reference and verified result** to the caller. Keep the raw `-o` file as evidence. A separate final turn follows its applicable host label contract.
46
46
 
47
- ### Proposed command interface — design examples, NOT currently executable
47
+ ### Runnable command examples
48
+
49
+ Run these from the repository root. The output directory must already exist. The body file and raw Codex output are inputs from the report-writing task.
48
50
 
49
51
  ```bash
50
52
  # Positive result: content is provided by the agent; STATUS is written by the tool
51
- harness report write --body-file work/report-body.md --output reports/review.md --status DONE
52
- harness report check --file reports/review.md
53
+ npm run report -- write --body-file work/report-body.md --output reports/review.md --status DONE
54
+ npm run report -- check --file reports/review.md
53
55
 
54
56
  # Blocked result: same writer; explicit failure reason is required
55
- harness report write --body-file work/report-body.md --output reports/review.md --status BLOCKED --reason "required verification unavailable"
56
- harness report check --file reports/review.md
57
+ npm run report -- write --context "Verification could not run." --output reports/review.md --status BLOCKED --reason "required verification unavailable"
58
+ npm run report -- check --file reports/review.md
59
+
60
+ # Raw Codex output uses a separate input and final report path
61
+ npm run report -- write --from-codex-output work/codex-raw.md --output reports/review.md --status DONE
62
+ npm run report -- check --file reports/review.md
57
63
  ```
58
64
 
59
- These are **candidate CLI verbs**, not a mandate to create a global `harness` binary. A small repository-local Node.js script with equivalent `write` / `check` operations is sufficient for the first vertical slice. The agent-facing instruction should reference the **actual installed command and version**, not copy these placeholders as if working already.
65
+ The same subcommands and flags work with `node scripts/report-writer.js`.
60
66
 
61
67
  ### Minimal writer and checker contract
62
68
 
63
69
  | Responsibility | Expected behavior |
64
70
  | --- | --- |
65
- | `write` input | Existing body file, designated report output path, explicit `DONE` / `BLOCKED`, mandatory non-empty reason for `BLOCKED` |
71
+ | `write` input | Exactly one of `--body-file`, `--context`, or `--from-codex-output`, plus `--output` and explicit `--status`. A blocked result requires a nonempty `--reason` or `--error`. |
66
72
  | `write` output | Preserve body content, add a single newline-separated terminal control line at **column zero**, write atomically, fail without corrupting the previous target |
67
73
  | Structural validation | On the finished output, check exactly one terminal protocol line, nothing after it (including hidden label), and read-back matches what was written |
68
74
  | Containing structured fields | Reject conflicting column-zero terminal STATUS lines and harness-label metadata in the submitted body; make the conflict explicit rather than silently discarding unknown content |
69
75
  | Artifact roles | `codex exec -o` writes raw output as **script input**; the script converts and verifies the designated final report according to a host-aware contract. If ambiguous, return nonzero; no hidden manual rewrite |
70
- | Failure outcome | Nonzero exit + actionable diagnostics; Agent may revise within Treat or deliver outstanding evidence via F/G; no automatic `DONE`, preserve prior target and raw source |
76
+ | Failure outcome | Nonzero exit with diagnostics. Validation failures before publication preserve the prior report and raw input. A read-back failure after publication requires coordinator disposition. |
71
77
  | Scope | Operate on explicitly designated report output only; do not rewrite unrelated files, judge semantic success, touch the Ledger, or automatically change permissions |
72
78
  | Revision | Re-run `write` using the edited body + true status; never mutate the terminal report with ordinary append commands |
73
79
 
74
- **Design constraint:** `-o` must be handled as script-mediated output. Parsing host metadata is a deterministic responsibility of the proposed script under a defined contract. If the script cannot distinguish required protocol from host-owned label safely, **return nonzero** with the original raw output and let the Agent handle that result; do not imply an unimplemented exception has shipped.
80
+ In `--from-codex-output` mode, the writer can remove one terminal comment that conforms to the [Observations v1 harness-label contract](../../system-one-observations.md#label-line). If the raw input already includes a STATUS line, it must match the requested status and be terminal or immediately precede the label. Invalid input returns nonzero and preserves the raw file.
75
81
 
76
82
  ## Interaction with other Actions and existing facilities
77
83
 
@@ -87,11 +93,11 @@ flowchart LR
87
93
  The future Hook/Skill reference is **not** a G feedback/recurrence edge, nor does F make future tasks part of this same Error Occurrence. A new recurrence starts as a **new Capture**; a correction after nonzero exit remains within the current local Action block when permitted.
88
94
 
89
95
  - **#359:** existing E-0002 Ledger remains class/history authority; do not create a second database.
90
- - **#394 / ROUTE-001:** Hook provides the **available command only when relevant**; it does not enforce task success or select the disposition. A retired lesson reminder does not remove still-needed operational instructions.
91
- - **#437:** scoped CLI/script is a proposed deterministic validator, **not** a mandatory global document controller. Validation failures are returned for Agent handling, not converted to hidden branching rules.
96
+ - **#394 / ROUTE-001:** the proposed Hook/Skill disclosure would surface the available command when relevant. A retired lesson reminder does not remove still-needed operational instructions.
97
+ - **#437:** the scoped writer returns validation failures for the agent to handle in the applicable Action.
92
98
  - **Decide/Accept:** when a machine-checkable condition or approval is not met, the script returns nonzero with the unmet requirement. The Agent can revise appropriately or preserve unresolved status. Owner authorization cannot be fabricated by a script, and a zero script exit code never proves substantive task correctness.
93
99
 
94
- ## Proposed acceptance before implementation
100
+ ## Acceptance cases
95
101
 
96
102
  | Test case | Expected observable result |
97
103
  | --- | --- |
@@ -106,11 +112,3 @@ The future Hook/Skill reference is **not** a G feedback/recurrence edge, nor doe
106
112
  | Writer produces compliant format but underlying result is wrong | Structural PASS only; review/behavior acceptance stays separate |
107
113
 
108
114
  **What to measure:** E-0002 recurrence in later **real report-writing tasks**, whether the agent actually invoked the designated writer, structural violations after invocation, and elapsed/tool/review cost relative to hand-writing. Do not declare E-0002 rooted out merely because a diagram or a one-off check exists.
109
-
110
- ## Owner discussion items
111
-
112
- 1. Should the first implementation be a small Node.js `report write/check` script under the existing repository, rather than a new global CLI? **Recommended: yes.**
113
- 2. For `codex exec -o`, route raw output to a **script**, and let the script generate/check the final report. No manual coordinator rewrite or output-contract exception is assumed.
114
- 3. Define the **script's host-aware input/output and extraction contract** for shared `-o` artifacts; ambiguous input returns nonzero, not guessed normalization.
115
-
116
- This design leaves A Capture focused on facts and E Treat on the executable operation: the next agent receives a repeatable action, **validated return codes**, and a way to handle a failed condition, not merely an explanation of the last mistake.
@@ -41,7 +41,7 @@ The [Action identity registry](./nodes.yaml) is the only proposed source for the
41
41
  | `EH-overview` | `EH-activity-source` | Same Level 1 representation | Open when UML source/notation is needed; not a new Level |
42
42
  | `EH-overview` | `E0002-actions` | Context-specific expansion: **E-0002** | Open when handling this Error Class/context, rather than loading all Action Maps |
43
43
  | `E0002-actions` | `E0002-capture` | Detail supporting Capture / evidence | Read when raw evidence/provenance is required |
44
- | `E0002-actions` | `E0002-writer` | Detail supporting Treat / Report CLI | Read when producing or validating a report through the proposed script |
44
+ | `E0002-actions` | `E0002-writer` | Detail supporting Treat / Report CLI | Read when producing or validating a report through the shipped W1 script |
45
45
  | `E0002-actions` | `E0002-ledger` | Existing class evidence / history | Read for Identify/history relevance; do not copy or reclassify the ledger |
46
46
 
47
47
  **Maintenance contract (lightweight):** when a document moves, update its **Table A path**; Table B continues to refer to the same local key. When a new Level 2 behavior block or Level 3 reference is added, add only the relevant row and reference. Removing an obsolete procedure removes its registry relationship without rewriting Level 1. **Do not re-encode Mermaid/PlantUML execution arrows as registry edges**: the source diagrams own flow semantics, while the tables own *navigation/lookup*.
@@ -4,7 +4,7 @@ description: "Route software/project work through Harness: classify tier/topolog
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.55.0
7
+ version: 0.55.2
8
8
  ---
9
9
 
10
10
  # Harness Everything
@@ -38,6 +38,7 @@ function validateVersionManifest(manifest, expectedVersion) {
38
38
  || Object.values(stage.thresholds).some(value => typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1)) {
39
39
  fail(`malformed ${name} stage`);
40
40
  }
41
+ if (stage.weights.includes('/') || stage.config.includes('/')) fail(`${name} weights and config must be flat filenames`);
41
42
  if (Object.hasOwn(stage, 'referenceOnly')
42
43
  && (!Array.isArray(stage.referenceOnly) || new Set(stage.referenceOnly).size !== stage.referenceOnly.length
43
44
  || stage.referenceOnly.some(id => !stage.options.includes(id) || stage.thresholds[id] !== 1))) {
@@ -692,7 +692,7 @@ function handle(payload, env = process.env) {
692
692
  }
693
693
 
694
694
  module.exports = {
695
- INTENTS, TIERS, STRATEGIES, RETENTION_MS, PREVIOUS_BYTES, enabled, storeRoot, redact, parseLabelLine, stripLabels, tailBytes, sha, normalizeSystemOne, classifyCommand, labelTier, contradictions,
695
+ INTENTS, TIERS, STRATEGIES, RETENTION_MS, PREVIOUS_BYTES, enabled, storeRoot, redact, validLabel, parseLabelLine, stripLabels, tailBytes, sha, normalizeSystemOne, classifyCommand, labelTier, contradictions,
696
696
  normalizeTerms, transcriptMessage, recordTool, emptyBehavior, mergeBehavior, toolFailed, handle, readJson, appendRecord, appendRecordDetailed, observationTurnMatch, findObservationTurnMatch, markSessionBackfillBehaviorUnobserved,
697
697
  expired, recordText, sweep,
698
698
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harness-enforcement",
3
3
  "description": "Repository inventory for the opencode enforcement plugin and its standalone helper",
4
- "version": "0.55.0",
4
+ "version": "0.55.2",
5
5
  "runtime": "index.mjs",
6
6
  "hooks": {
7
7
  "verify": "hooks/verify.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-everything",
3
- "version": "0.55.0",
3
+ "version": "0.55.2",
4
4
  "description": "Harness OS: An Orchestrated Agent Operating System for AI-driven Development",
5
5
  "main": "harness-everything/scripts/bootstrap.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-everything",
3
- "version": "0.55.0",
3
+ "version": "0.55.2",
4
4
  "description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
5
5
  "author": {
6
6
  "name": "Miya Daniel",
@@ -692,7 +692,7 @@ function handle(payload, env = process.env) {
692
692
  }
693
693
 
694
694
  module.exports = {
695
- INTENTS, TIERS, STRATEGIES, RETENTION_MS, PREVIOUS_BYTES, enabled, storeRoot, redact, parseLabelLine, stripLabels, tailBytes, sha, normalizeSystemOne, classifyCommand, labelTier, contradictions,
695
+ INTENTS, TIERS, STRATEGIES, RETENTION_MS, PREVIOUS_BYTES, enabled, storeRoot, redact, validLabel, parseLabelLine, stripLabels, tailBytes, sha, normalizeSystemOne, classifyCommand, labelTier, contradictions,
696
696
  normalizeTerms, transcriptMessage, recordTool, emptyBehavior, mergeBehavior, toolFailed, handle, readJson, appendRecord, appendRecordDetailed, observationTurnMatch, findObservationTurnMatch, markSessionBackfillBehaviorUnobserved,
697
697
  expired, recordText, sweep,
698
698
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "harness-everything",
4
- "version": "0.55.0",
4
+ "version": "0.55.2",
5
5
  "description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
6
6
  "author": {
7
7
  "name": "Miya Daniel",
@@ -4,7 +4,7 @@ description: "Route software/project work through Harness: classify tier/topolog
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 0.55.0
7
+ version: 0.55.2
8
8
  ---
9
9
 
10
10
  # Harness Everything
@@ -38,6 +38,7 @@ function validateVersionManifest(manifest, expectedVersion) {
38
38
  || Object.values(stage.thresholds).some(value => typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1)) {
39
39
  fail(`malformed ${name} stage`);
40
40
  }
41
+ if (stage.weights.includes('/') || stage.config.includes('/')) fail(`${name} weights and config must be flat filenames`);
41
42
  if (Object.hasOwn(stage, 'referenceOnly')
42
43
  && (!Array.isArray(stage.referenceOnly) || new Set(stage.referenceOnly).size !== stage.referenceOnly.length
43
44
  || stage.referenceOnly.some(id => !stage.options.includes(id) || stage.thresholds[id] !== 1))) {
package/sbom.cdx.json CHANGED
@@ -2,23 +2,23 @@
2
2
  "$schema": "https://cyclonedx.org/schema/bom-1.7.schema.json",
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.7",
5
- "serialNumber": "urn:uuid:88917d13-bddd-5e04-939a-2a15464c6baa",
5
+ "serialNumber": "urn:uuid:36aef0a1-619e-58c5-a9d5-71ee3930e0c7",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-11-20T03:38:35.301Z",
8
+ "timestamp": "2026-11-20T12:08:56.300Z",
9
9
  "tools": [
10
10
  {
11
11
  "vendor": "Harness Everything",
12
12
  "name": "generate-sbom.js",
13
- "version": "0.55.0"
13
+ "version": "0.55.2"
14
14
  }
15
15
  ],
16
16
  "component": {
17
17
  "type": "application",
18
- "bom-ref": "pkg:npm/harness-everything@0.55.0",
18
+ "bom-ref": "pkg:npm/harness-everything@0.55.2",
19
19
  "name": "harness-everything",
20
- "version": "0.55.0",
21
- "purl": "pkg:npm/harness-everything@0.55.0"
20
+ "version": "0.55.2",
21
+ "purl": "pkg:npm/harness-everything@0.55.2"
22
22
  }
23
23
  },
24
24
  "components": [
@@ -2033,7 +2033,7 @@
2033
2033
  ]
2034
2034
  },
2035
2035
  {
2036
- "ref": "pkg:npm/harness-everything@0.55.0",
2036
+ "ref": "pkg:npm/harness-everything@0.55.2",
2037
2037
  "dependsOn": [
2038
2038
  "pkg:npm/%40commitlint/cli@19.8.1",
2039
2039
  "pkg:npm/%40commitlint/config-conventional@19.8.1",
@@ -4,6 +4,7 @@
4
4
  const crypto = require('node:crypto');
5
5
  const fs = require('node:fs');
6
6
  const path = require('node:path');
7
+ const { validLabel } = require('../hooks/scripts/lib/observations');
7
8
 
8
9
  const USAGE = 'usage: report-writer write --output <path> --status <DONE|BLOCKED|0|nonzero-int> (--body-file <path>|--context <text>|--from-codex-output <path>) [--reason <text>|--error <text>...] | report-writer check --file <path>';
9
10
  const WRITE_OPTIONS = new Set(['--output', '--status', '--reason', '--error', '--body-file', '--context', '--from-codex-output']);
@@ -109,7 +110,7 @@ function parseHostLabel(line) {
109
110
  } catch {
110
111
  error('terminal host label must contain valid JSON');
111
112
  }
112
- if (!value || typeof value !== 'object' || Array.isArray(value)) error('terminal host label JSON must be an object');
113
+ if (!validLabel(value)) error('terminal host label must use the recognized harness-label schema');
113
114
  }
114
115
 
115
116
  function extractCodexBody(raw, expectedStatus) {
@@ -10,6 +10,7 @@ const { assertPrivateHistoryFile, appendPrivateHistory } = require('./system-one
10
10
  const STAGE_SET = new Set(STAGES);
11
11
  const EPSILON = 1e-12;
12
12
  const LOG_EPSILON = Number.EPSILON;
13
+ const VERSION_ALREADY_RECORDED = 'version already recorded; resume with the original cycle artifacts or use a new version';
13
14
  const fail = () => { throw new TypeError('invalid-system-one-curves-input'); };
14
15
  const isObject = value => value !== null && typeof value === 'object' && !Array.isArray(value);
15
16
  const isText = value => typeof value === 'string' && value.trim().length > 0;
@@ -442,15 +443,15 @@ function run(argv) {
442
443
  }
443
444
  if (Object.keys(holdoutFiles).length && Object.keys(holdoutFiles).length !== Object.keys(valFiles).length) fail();
444
445
  const history = readHistory(args.history);
446
+ if (history.some(row => row.version === args.version)) throw new TypeError(VERSION_ALREADY_RECORDED);
445
447
  const floor = assessFloor(Object.keys(holdoutMetrics).length ? holdoutMetrics : null, history);
446
448
  const curves = { schemaVersion: 1, version: args.version, createdAt: new Date().toISOString(), stages, floor };
447
- const existing = assertVersionReusable(history, curves);
448
449
  validateBaselineReferences(curves, history);
449
450
  const trend = decideTrend(curves, history, floor);
450
451
  fs.mkdirSync(args.out, { recursive: true });
451
452
  fs.writeFileSync(path.join(args.out, 'curves.json'), `${JSON.stringify(curves, null, 2)}\n`);
452
453
  fs.writeFileSync(path.join(args.out, 'trend.json'), `${JSON.stringify(trend, null, 2)}\n`);
453
- if (!existing) appendHistoryRow(args.history, history, curves);
454
+ appendHistoryRow(args.history, history, curves);
454
455
  const summary = Object.fromEntries(Object.entries(stages).map(([stage, value]) => [stage, {
455
456
  rows: readJsonl(valFiles[stage]).length,
456
457
  logLoss: value.logLoss,
@@ -463,8 +464,10 @@ function run(argv) {
463
464
  }
464
465
 
465
466
  if (require.main === module) {
466
- try { run(process.argv.slice(2)); } catch (_) {
467
- console.error('system-one-curves: invalid arguments, manifest, history, or score input');
467
+ try { run(process.argv.slice(2)); } catch (error) {
468
+ const message = error?.message === VERSION_ALREADY_RECORDED ? VERSION_ALREADY_RECORDED
469
+ : 'invalid arguments, manifest, history, or score input';
470
+ console.error(`system-one-curves: ${message}`);
468
471
  process.exitCode = 1;
469
472
  }
470
473
  }