/** * Graph metrics for the cortex memory graph. * * Fiedler value: algebraic connectivity of the Laplacian. * - High → well-integrated knowledge graph * - Low → disconnected clusters (compartmentalised knowledge) * * PE saturation: trend analysis over prediction-error values for recent * identity-related observations. Used to decide whether adversarial * rumination should be triggered. */ import type { CortexStore } from '../core/store.js'; /** * Compute the Fiedler value (algebraic connectivity) of the memory graph. * * The Fiedler value is the second-smallest eigenvalue of the graph Laplacian. * It is zero for disconnected graphs and increases with connectivity. * * Algorithm (two-pass power iteration, O(n·iter)): * Pass 1 — power-iterate L to find lambda_max (largest eigenvalue), keeping * v orthogonal to the constant eigenvector (eigenvalue 0). * Pass 2 — power-iterate the shifted matrix (lambda_max·I − L) with the same * deflation. The dominant eigenvalue mu_max of the shifted matrix * satisfies: Fiedler = lambda_max − mu_max. * * This avoids matrix inversion (no shifted-inverse iteration needed) and is * exact enough for memory graphs up to ~5 000 nodes. */ export declare function computeFiedlerValue(store: CortexStore): Promise; export interface PESaturationResult { /** Mean prediction error over the most recent 14-day window. */ mean_pe: number; /** Trend relative to the prior 14-day window. */ trend: 'rising' | 'stable' | 'declining'; /** * True when the recent mean PE has fallen below 0.10 — signal that * adversarial rumination should be triggered to prevent stagnation. */ saturated: boolean; recommendation: string; } /** * Detect PE saturation in identity-related observations. * * Queries the 'observations' collection for entries in the last 28 days * that have a non-null prediction_error. Computes the mean PE for the most * recent 14-day window vs the prior 14-day window and classifies the trend. * * A "saturated" state (mean_pe < 0.10) means the system is no longer * surprised by identity-type inputs — a sign that adversarial or * counterfactual prompting should be introduced to break out of the plateau. */ export declare function detectPESaturation(store: CortexStore): Promise; //# sourceMappingURL=graph-metrics.d.ts.map