@hmharness/cognitive 0.23.4 → 0.23.6

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,30 @@ 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
+ *
112
+ * Mixed-distribution guard (2026-10-02 lesson): exploration phases probe
113
+ * unfamiliar actions ON PURPOSE, so their predictions are bad by design —
114
+ * bucketing them with task-phase predictions reads "task mix changed", not
115
+ * "learning changed". envFilter restricts to ONE environment's curve. */
116
+ export declare function calibrationTrend(home: string, bucketCount?: number, envFilter?: string): Promise<CalibrationTrend>;
93
117
  /** Compact world-model digest for the SYSTEM PROMPT. The model sees which
94
118
  * tool types history trusts, which keep failing, and what the diagnosis
95
119
  * layer currently suggests — perception feeding action, capped hard so it
package/dist/analysis.js CHANGED
@@ -214,6 +214,44 @@ 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
+ *
222
+ * Mixed-distribution guard (2026-10-02 lesson): exploration phases probe
223
+ * unfamiliar actions ON PURPOSE, so their predictions are bad by design —
224
+ * bucketing them with task-phase predictions reads "task mix changed", not
225
+ * "learning changed". envFilter restricts to ONE environment's curve. */
226
+ export async function calibrationTrend(home, bucketCount = 5, envFilter) {
227
+ const trajectories = await loadTrajectories(home, 500);
228
+ const predicted = trajectories
229
+ .filter((t) => (envFilter ? t.environment.id === envFilter : true))
230
+ .flatMap((t) => t.steps.filter((s) => s.prediction).map((s) => ({ at: t.startedAt, err: Math.abs(s.prediction.confidence - (s.outcome === 'success' ? 1 : 0)) })))
231
+ .sort((a, b) => a.at.localeCompare(b.at));
232
+ if (predicted.length < bucketCount * 2) {
233
+ return { buckets: [], reliabilityDelta: null, verdict: 'insufficient' };
234
+ }
235
+ const size = Math.floor(predicted.length / bucketCount);
236
+ const buckets = [];
237
+ for (let i = 0; i < bucketCount; i++) {
238
+ const slice = predicted.slice(i * size, i === bucketCount - 1 ? undefined : (i + 1) * size);
239
+ if (!slice.length)
240
+ continue;
241
+ const meanError = slice.reduce((s, x) => s + x.err, 0) / slice.length;
242
+ buckets.push({
243
+ at: slice[0].at,
244
+ predictions: slice.length,
245
+ meanError: Number(meanError.toFixed(3)),
246
+ reliability: Number((1 - meanError).toFixed(3)),
247
+ });
248
+ }
249
+ const first = buckets[0]?.reliability;
250
+ const last = buckets[buckets.length - 1]?.reliability;
251
+ const reliabilityDelta = first !== undefined && last !== undefined ? Number((last - first).toFixed(3)) : null;
252
+ const verdict = reliabilityDelta === null ? 'insufficient' : reliabilityDelta > 0.05 ? 'improving' : reliabilityDelta < -0.05 ? 'degrading' : 'flat';
253
+ return { buckets, reliabilityDelta, verdict };
254
+ }
217
255
  /* ---- context advisor (blueprint M3: the planner consumes the world model) ---- */
218
256
  /** Compact world-model digest for the SYSTEM PROMPT. The model sees which
219
257
  * 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.6",
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.6"
30
30
  }
31
31
  }