@hmharness/cognitive 0.23.4 → 0.23.5

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.
@@ -90,6 +90,25 @@ export interface CalibrationReport {
90
90
  * over the whole trajectory store — the dimension where the harness's value
91
91
  * is PROVEN (+0.4166 transfer); this surfaces it for the CLI and panel. */
92
92
  export declare function calibrationReport(home: string, topN?: number): Promise<CalibrationReport>;
93
+ export interface TrendBucket {
94
+ /** bucket label (ISO date of its first trajectory) */
95
+ at: string;
96
+ predictions: number;
97
+ meanError: number;
98
+ reliability: number;
99
+ }
100
+ export interface CalibrationTrend {
101
+ buckets: TrendBucket[];
102
+ /** first→last reliability change: positive = the harness IS learning to
103
+ * predict better — the measurable self-evolution evidence */
104
+ reliabilityDelta: number | null;
105
+ verdict: 'improving' | 'flat' | 'degrading' | 'insufficient';
106
+ }
107
+ /** The learning curve of the cognitive OS: calibration reliability over
108
+ * chronological time buckets. If reliability rises, the harness's world
109
+ * model is genuinely improving from its own experience — self-evolution
110
+ * made measurable on the dimension where the harness's value is proven. */
111
+ export declare function calibrationTrend(home: string, bucketCount?: number): Promise<CalibrationTrend>;
93
112
  /** Compact world-model digest for the SYSTEM PROMPT. The model sees which
94
113
  * tool types history trusts, which keep failing, and what the diagnosis
95
114
  * layer currently suggests — perception feeding action, capped hard so it
package/dist/analysis.js CHANGED
@@ -214,6 +214,38 @@ export async function calibrationReport(home, topN = 12) {
214
214
  rows,
215
215
  };
216
216
  }
217
+ /** The learning curve of the cognitive OS: calibration reliability over
218
+ * chronological time buckets. If reliability rises, the harness's world
219
+ * model is genuinely improving from its own experience — self-evolution
220
+ * made measurable on the dimension where the harness's value is proven. */
221
+ export async function calibrationTrend(home, bucketCount = 5) {
222
+ const trajectories = await loadTrajectories(home, 500);
223
+ const predicted = trajectories
224
+ .flatMap((t) => t.steps.filter((s) => s.prediction).map((s) => ({ at: t.startedAt, err: Math.abs(s.prediction.confidence - (s.outcome === 'success' ? 1 : 0)) })))
225
+ .sort((a, b) => a.at.localeCompare(b.at));
226
+ if (predicted.length < bucketCount * 2) {
227
+ return { buckets: [], reliabilityDelta: null, verdict: 'insufficient' };
228
+ }
229
+ const size = Math.floor(predicted.length / bucketCount);
230
+ const buckets = [];
231
+ for (let i = 0; i < bucketCount; i++) {
232
+ const slice = predicted.slice(i * size, i === bucketCount - 1 ? undefined : (i + 1) * size);
233
+ if (!slice.length)
234
+ continue;
235
+ const meanError = slice.reduce((s, x) => s + x.err, 0) / slice.length;
236
+ buckets.push({
237
+ at: slice[0].at,
238
+ predictions: slice.length,
239
+ meanError: Number(meanError.toFixed(3)),
240
+ reliability: Number((1 - meanError).toFixed(3)),
241
+ });
242
+ }
243
+ const first = buckets[0]?.reliability;
244
+ const last = buckets[buckets.length - 1]?.reliability;
245
+ const reliabilityDelta = first !== undefined && last !== undefined ? Number((last - first).toFixed(3)) : null;
246
+ const verdict = reliabilityDelta === null ? 'insufficient' : reliabilityDelta > 0.05 ? 'improving' : reliabilityDelta < -0.05 ? 'degrading' : 'flat';
247
+ return { buckets, reliabilityDelta, verdict };
248
+ }
217
249
  /* ---- context advisor (blueprint M3: the planner consumes the world model) ---- */
218
250
  /** Compact world-model digest for the SYSTEM PROMPT. The model sees which
219
251
  * 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.4",
3
+ "version": "0.23.5",
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.4"
29
+ "@hmharness/kernel": "0.23.5"
30
30
  }
31
31
  }