@hmharness/cognitive 0.23.0 → 0.23.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.
@@ -72,6 +72,24 @@ export interface Arc3MetricsReport {
72
72
  * recovery metrics over recorded ARC-AGI-3 plays (trajectories + episodic
73
73
  * summaries). Honest on empty: null, never zeros-that-lie. */
74
74
  export declare function arc3Metrics(home: string, limit?: number): Promise<Arc3MetricsReport | null>;
75
+ export interface CalibrationRow {
76
+ actionType: string;
77
+ predictions: number;
78
+ meanError: number;
79
+ /** 1 - meanError: how trustworthy the model's instinct on this action is */
80
+ reliability: number;
81
+ }
82
+ export interface CalibrationReport {
83
+ totalSteps: number;
84
+ predictedSteps: number;
85
+ overallMeanError: number | null;
86
+ overallReliability: number | null;
87
+ rows: CalibrationRow[];
88
+ }
89
+ /** The crown-jewel metric made first-class: per-action prediction calibration
90
+ * over the whole trajectory store — the dimension where the harness's value
91
+ * is PROVEN (+0.4166 transfer); this surfaces it for the CLI and panel. */
92
+ export declare function calibrationReport(home: string, topN?: number): Promise<CalibrationReport>;
75
93
  /** Compact world-model digest for the SYSTEM PROMPT. The model sees which
76
94
  * tool types history trusts, which keep failing, and what the diagnosis
77
95
  * layer currently suggests — perception feeding action, capped hard so it
package/dist/analysis.js CHANGED
@@ -171,6 +171,49 @@ export async function arc3Metrics(home, limit = 100) {
171
171
  perPlay,
172
172
  };
173
173
  }
174
+ /** The crown-jewel metric made first-class: per-action prediction calibration
175
+ * over the whole trajectory store — the dimension where the harness's value
176
+ * is PROVEN (+0.4166 transfer); this surfaces it for the CLI and panel. */
177
+ export async function calibrationReport(home, topN = 12) {
178
+ const trajectories = await loadTrajectories(home, 500);
179
+ const byType = new Map();
180
+ let total = 0;
181
+ let predicted = 0;
182
+ let errSum = 0;
183
+ for (const traj of trajectories) {
184
+ for (const s of traj.steps) {
185
+ total++;
186
+ if (!s.prediction)
187
+ continue;
188
+ predicted++;
189
+ const actual = s.outcome === 'success' ? 1 : 0;
190
+ const err = Math.abs(s.prediction.confidence - actual);
191
+ errSum += err;
192
+ const t = s.action.type;
193
+ const agg = byType.get(t) ?? { n: 0, err: 0 };
194
+ agg.n++;
195
+ agg.err += err;
196
+ byType.set(t, agg);
197
+ }
198
+ }
199
+ const rows = [...byType.entries()]
200
+ .map(([actionType, v]) => ({
201
+ actionType,
202
+ predictions: v.n,
203
+ meanError: Number((v.err / v.n).toFixed(3)),
204
+ reliability: Number((1 - v.err / v.n).toFixed(3)),
205
+ }))
206
+ .sort((a, b) => b.predictions - a.predictions)
207
+ .slice(0, topN);
208
+ const overallMeanError = predicted ? Number((errSum / predicted).toFixed(3)) : null;
209
+ return {
210
+ totalSteps: total,
211
+ predictedSteps: predicted,
212
+ overallMeanError,
213
+ overallReliability: overallMeanError === null ? null : Number((1 - overallMeanError).toFixed(3)),
214
+ rows,
215
+ };
216
+ }
174
217
  /* ---- context advisor (blueprint M3: the planner consumes the world model) ---- */
175
218
  /** Compact world-model digest for the SYSTEM PROMPT. The model sees which
176
219
  * tool types history trusts, which keep failing, and what the diagnosis
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cognitive",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "description": "hmharness Cognitive OS core: Environment protocol, World Model, Goal system, Exploration, RLM runtime, five-layer memory, Skill Compiler, Continual Learning control plane, Evolution 2.0 governance, Multi-Agent topology, Transfer lab and GeneralBench schema. Cognitive strategy layer per the HMH Cognitive OS blueprint (2026-09).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,6 +26,6 @@
26
26
  "node": ">=22"
27
27
  },
28
28
  "dependencies": {
29
- "@hmharness/kernel": "0.23.0"
29
+ "@hmharness/kernel": "0.23.2"
30
30
  }
31
31
  }