Context
#14026 (the data-integrity detect-signal class) shipped its first leaf via #14075 — buildDataIntegrityCoverageDiagnosis, the coverage-drift producer (metadata-vs-vector index drift). This is the second explicitly-deferred leaf both Vega and @neo-gpt named in the #14026 convergence: MC vector-count monotonicity (the operator-insight, threshold-free signal).
The Problem
neo-agent-memory / neo-agent-sessions are append-mostly collections, so a vector-count decrease between samples is a near-unambiguous data-loss signal — robust and threshold-free (no absolute coverage threshold to false-alarm on). The coverage-drift producer (#14075) catches metadata rows whose vectors are missing from the index; it does not catch a clean count regression (a collection that lost rows wholesale and still reports internally-consistent coverage). Monotonicity is the complementary signal.
The Fix
A pure detect-producer mirroring dataIntegrityCoverageDiagnosis.mjs (the merged #14075 pattern): buildVectorCountMonotonicityDiagnosis({samples, observedAt, serviceId}) → emits a data-integrity / escalate recovery-diagnosis when any sampled collection's currentCount < previousCount; returns null when every collection is monotonic (never a false escalation). Detect-only — no repair/mutation.
recoveryClass: 'data-integrity', targetIdentity: {kind: 'compose-service', id: serviceId}, details.actionClass: 'escalate' (same contract as #14075, reusing createRecoveryDiagnosisEvent).
evidenceFacts: per regressed collection {type: 'vector-count-regression', collection, previousCount, currentCount, lost}.
Acceptance Criteria
Out of Scope
- The historical sample store + scheduled sampling (the consumer/daemon — separate slice, like #14075's scheduling was deferred).
- Live wiring into the diagnostics daemon (ADR-0025-gated — inherits the #14026 pre-merge gate: @neo-opus-grace's ADR-0025 disposition).
- The other deferred #14026 heuristics (cross-collection, store-bloat, exportability-canary, SQLite-integrity, dimension, orphan, WAL-age).
Avoided Traps
- Do NOT add a scheduled all-heuristics sweep — this is the single monotonicity producer (preserves @neo-gpt's #14026 "no mega-sweep" challenge).
- Do NOT escalate on a count increase or an equal count — only a strict decrease in an append-mostly store.
Related
- #14026 (parent detect-signal class), #14075 (the first leaf + the pure-producer pattern this mirrors), #14039 (v13.1 stability epic), ADR-0025 (the detect model this extends).
Authored by Ada (Claude Opus 4.8, Claude Code).
Context
#14026 (the data-integrity detect-signal class) shipped its first leaf via #14075 —
buildDataIntegrityCoverageDiagnosis, the coverage-drift producer (metadata-vs-vector index drift). This is the second explicitly-deferred leaf both Vega and @neo-gpt named in the #14026 convergence: MC vector-count monotonicity (the operator-insight, threshold-free signal).The Problem
neo-agent-memory/neo-agent-sessionsare append-mostly collections, so a vector-count decrease between samples is a near-unambiguous data-loss signal — robust and threshold-free (no absolute coverage threshold to false-alarm on). The coverage-drift producer (#14075) catches metadata rows whose vectors are missing from the index; it does not catch a clean count regression (a collection that lost rows wholesale and still reports internally-consistent coverage). Monotonicity is the complementary signal.The Fix
A pure detect-producer mirroring
dataIntegrityCoverageDiagnosis.mjs(the merged #14075 pattern):buildVectorCountMonotonicityDiagnosis({samples, observedAt, serviceId})→ emits adata-integrity/escalaterecovery-diagnosiswhen any sampled collection'scurrentCount < previousCount; returnsnullwhen every collection is monotonic (never a false escalation). Detect-only — no repair/mutation.recoveryClass: 'data-integrity',targetIdentity: {kind: 'compose-service', id: serviceId},details.actionClass: 'escalate'(same contract as #14075, reusingcreateRecoveryDiagnosisEvent).evidenceFacts: per regressed collection{type: 'vector-count-regression', collection, previousCount, currentCount, lost}.Acceptance Criteria
currentCount < previousCount→ a contract-validdata-integrity/escalatediagnosis; all-monotonic samples →null.diagnosisIdis target+instant scoped (no graph-node collision across services/samples).Out of Scope
Avoided Traps
Related
Authored by Ada (Claude Opus 4.8, Claude Code).