@hmharness/cli 0.14.18 → 0.14.20

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 (2) hide show
  1. package/dist/main.js +39 -13
  2. package/package.json +4 -4
package/dist/main.js CHANGED
@@ -1012,12 +1012,13 @@ flags:
1012
1012
  // route should be a different model family than the actor)
1013
1013
  await initHome();
1014
1014
  const home = homeDir();
1015
+ const rehuman = process.argv.includes('--rehuman');
1015
1016
  const limit = Math.max(1, Math.min(50, Number(rest[0] ?? 5) || 5));
1016
1017
  const cfgJ = await loadConfig();
1017
1018
  const provider = resolveProvider(cfgJ, 'judge');
1018
- stdout.write('judge model: ' + provider.model + ' @ ' + provider.baseUrl + ' · next ' + limit + ' unlabeled session(s), degraded first\n');
1019
+ stdout.write('judge model: ' + provider.model + ' @ ' + provider.baseUrl + ' · next ' + limit + (rehuman ? ' session(s) INCLUDING blind human-labeled ones' : ' unlabeled session(s)') + ', degraded first\n');
1019
1020
  const EJ = await import('@hmharness/evolution');
1020
- const r = await EJ.runJudgeBatch({ home, limit, provider, log: (l) => stdout.write(DIM(l + '\n')) });
1021
+ const r = await EJ.runJudgeBatch({ home, limit, provider, includeHumanLabeled: rehuman, log: (l) => stdout.write(DIM(l + '\n')) });
1021
1022
  const by = {};
1022
1023
  for (const sc of r.scores)
1023
1024
  by[sc] = (by[sc] || 0) + 1;
@@ -1047,13 +1048,17 @@ flags:
1047
1048
  const labels = (await readJsonl(join(home, 'evolution', 'reward-human-labels.jsonl')));
1048
1049
  const insights = (await readJsonl(join(home, 'insights', 'insights.jsonl')));
1049
1050
  if (sub === 'fit') {
1050
- if (labels.length < 10) {
1051
- stdout.write('need >=10 human labels to fit (have ' + labels.length + ')\n');
1051
+ const judgeLabelsFit = (await readJsonl(join(home, 'evolution', 'judge-labels.jsonl')));
1052
+ // judge-first: blind human stars are noise (2026-09-21), the judge
1053
+ // grades carry the real preference signal the model should learn
1054
+ const fitLabels = [...judgeLabelsFit, ...labels.filter((l) => !judgeLabelsFit.some((j) => j.session === l.session))];
1055
+ if (fitLabels.length < 10) {
1056
+ stdout.write('need >=10 labels to fit (have ' + fitLabels.length + ')\n');
1052
1057
  return;
1053
1058
  }
1054
- const m = E.fitRewardModel(labels, insights);
1059
+ const m = E.fitRewardModel(fitLabels, insights);
1055
1060
  await E.saveRewardModel(home, m);
1056
- stdout.write('reward model fitted on ' + m.nSamples + ' joined labels\n');
1061
+ stdout.write('reward model fitted on ' + m.nSamples + ' joined labels (judge-first)\n');
1057
1062
  stdout.write(' weights[outcome, failRate, turns, tools, bias] = ' + m.w.map((v) => v.toFixed(3)).join(', ') + '\n');
1058
1063
  stdout.write(' train RMSE ' + m.trainRmse + (m.holdoutRmse !== undefined ? ' · holdout RMSE ' + m.holdoutRmse : ' · (no holdout yet)') + '\n');
1059
1064
  stdout.write(' saved: ' + join(home, 'evolution', 'reward-model.json') + '\n');
@@ -1105,12 +1110,13 @@ flags:
1105
1110
  };
1106
1111
  const judgeLabels = (await readJsonl(join(home, 'evolution', 'judge-labels.jsonl')));
1107
1112
  const sources = new Map();
1108
- for (const l of judgeLabels)
1109
- if (!sources.has(l.session))
1110
- sources.set(l.session, 'judge');
1113
+ // 2026-09-21 user call: the human stars were blind guesses - the judge
1114
+ // label WINS on double-labeled sessions; human labels remain history
1111
1115
  for (const l of labels)
1112
- sources.set(l.session, 'human'); // human wins on double-labeled
1113
- const merged = [...labels, ...judgeLabels.filter((j) => !labels.some((l) => l.session === j.session))];
1116
+ sources.set(l.session, 'human');
1117
+ for (const j of judgeLabels)
1118
+ sources.set(j.session, 'judge');
1119
+ const merged = [...judgeLabels, ...labels.filter((l) => !judgeLabels.some((j) => j.session === l.session))];
1114
1120
  const sessions = [...new Set(merged.map((l) => l.session))];
1115
1121
  const tasks = new Map();
1116
1122
  const answers = new Map();
@@ -1121,11 +1127,31 @@ flags:
1121
1127
  const pairs = E.exportDpoPairs(merged, insights, (x2) => tasks.get(x2) ?? '', (x2) => answers.get(x2) ?? '', { sources });
1122
1128
  const out = join(home, 'evolution', 'dpo-pairs.jsonl');
1123
1129
  const { writeFile: wf } = await import('node:fs/promises');
1124
- await wf(out, pairs.map((p) => JSON.stringify(p)).join('\n') + (pairs.length ? '\n' : ''), 'utf8');
1130
+ // dataset form (J1): deterministic 80/20 split annotated per row,
1131
+ // leakage audit, and a versioned manifest beside the pairs file
1132
+ const split = E.splitDpoPairs(pairs);
1133
+ const audit = E.auditDpoPairs(split.train, split.eval);
1134
+ const rows = pairs.map((p) => JSON.stringify({ ...p, split: split.eval.includes(p) ? 'eval' : 'train' }));
1135
+ await wf(out, rows.join('\n') + (rows.length ? '\n' : ''), 'utf8');
1125
1136
  const bySrc = {};
1126
1137
  for (const p of pairs)
1127
1138
  bySrc[p.source ?? 'unmarked'] = (bySrc[p.source ?? 'unmarked'] || 0) + 1;
1128
- stdout.write('DPO pairs: ' + pairs.length + ' ' + JSON.stringify(bySrc) + ' -> ' + out + '\n');
1139
+ const manifest = {
1140
+ version: 'dpo-' + new Date().toISOString().slice(0, 10).replaceAll('-', '') + '-' + new Date().toISOString().slice(11, 16).replace(':', ''),
1141
+ pairsTotal: pairs.length,
1142
+ bySource: bySrc,
1143
+ train: split.train.length,
1144
+ eval: split.eval.length,
1145
+ audit,
1146
+ exportedAt: new Date().toISOString(),
1147
+ };
1148
+ const mf = join(home, 'evolution', 'dpo-manifest.json');
1149
+ await wf(mf, JSON.stringify(manifest, null, 2) + '\n', 'utf8');
1150
+ stdout.write('DPO pairs: ' + pairs.length + ' ' + JSON.stringify(bySrc) + ' (train ' + split.train.length + ' / eval ' + split.eval.length + ') -> ' + out + '\n');
1151
+ stdout.write('audit: ' + JSON.stringify(audit) + '\n');
1152
+ if (audit.emptyPrompt || audit.emptyAnswer || audit.duplicatePairs || audit.evalPromptsLeakedIntoTrain)
1153
+ stdout.write(YELLOW('⚠ audit not clean - fix the flagged rows before training') + '\n');
1154
+ stdout.write('manifest: ' + mf + '\n');
1129
1155
  return;
1130
1156
  }
1131
1157
  stdout.write('usage: hmh reward fit | report | export-dpo\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.14.18",
3
+ "version": "0.14.20",
4
4
  "description": "hmharness command line: one-shot tasks, an interactive REPL, a fullscreen TUI, the web frontend, and direct tool invocation.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -45,11 +45,11 @@
45
45
  "dependencies": {
46
46
  "@hmharness/kernel": "0.9.2",
47
47
  "@hmharness/observability": "0.7.0",
48
- "@hmharness/evolution": "0.14.12",
49
- "@hmharness/domain-harmony": "0.13.5",
48
+ "@hmharness/evolution": "0.14.14",
49
+ "@hmharness/domain-harmony": "0.13.6",
50
50
  "@hmharness/domain-ops": "0.8.1",
51
51
  "@hmharness/agent": "0.14.11",
52
52
  "@hmharness/evaluation": "0.8.0",
53
- "@hmharness/web": "0.9.1"
53
+ "@hmharness/web": "0.9.2"
54
54
  }
55
55
  }