/** * Team knowledge health dashboard — compute risk/coverage metrics for the memory store. */ import type { MemoryStore } from "./db/store.js"; import type { MemoryEntry, MemoryKind, MemoryStatus } from "./types.js"; export interface PathRisk { path: string; memories: number; stale: number; guardrails: number; failedApproaches: number; riskScore: number; } export interface RepeatedMistakeTrend { /** path or area where mistakes repeat */ area: string; /** number of FAILED_APPROACH memories in this area */ count: number; /** dates of the failed approaches (ISO) */ dates: string[]; /** trend direction: increasing, stable, or decreasing */ trend: "increasing" | "stable" | "decreasing"; } export interface AlertThresholds { /** max stale memories before alert */ maxStale?: number; /** max pending proposals before alert */ maxPending?: number; /** max risk score before alert (0-100) */ maxRiskScore?: number; /** max repeated mistakes in a single area before alert */ maxRepeatedMistakes?: number; } export interface HealthReport { summary: { total: number; byStatus: Record; byKind: Partial>; pinned: number; unverified: number; stale: number; refuted: number; failedApproaches: number; pendingProposals: number; coveragePaths: number; riskScore: number; }; topRisks: PathRisk[]; oldestStale: MemoryEntry[]; repeatedMistakeTrends: RepeatedMistakeTrend[]; alerts: string[]; suggestions: string[]; } export declare function computeHealth(store: MemoryStore, thresholds?: AlertThresholds): HealthReport;