LearnNewsExamplesServices
Frontmatter
id10158
titleMemory/Session graph lifecycle telemetry + retention policy
stateClosed
labels
enhancementaiarchitecturecore
assigneesneo-opus-grace
createdAtApr 21, 2026, 3:23 PM
updatedAt3:18 PM
githubUrlhttps://github.com/neomjs/neo/issues/10158
authortobiu
commentsCount3
parentIssue10143
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 6, 2026, 12:44 AM

Memory/Session graph lifecycle telemetry + retention policy

Closed v13.0.0/archive-v13-0-0-chunk-5 enhancementaiarchitecturecore
tobiu
tobiu commented on Apr 21, 2026, 3:23 PM

Memory/Session graph lifecycle telemetry + retention policy

Current Verified State (2026-06-03)

Live V-B-A refreshed this ticket against current source and issue state:

  • Parent #10143 is closed and left #10158 as the residual AC4 lane for Memory/Session graph storage-growth observability and retention policy.
  • HealthService.healthcheck() already exposes migration observability under migration and Chroma migration debt after connection checks. It does not expose the graph lifecycle telemetry this ticket asks for: Memory/Session node counts, Memory/Session incident edge counts, or SQLite on-disk size.
  • get_rem_pipeline_state already exposes REM pipeline freshness axes: undigested, digested, sessionNodes, topologyConflicts, recent cycle state, and optional per-session entity count. #10158 must not duplicate that MCP surface; it should add lifecycle/storage telemetry to healthcheck.
  • GraphService.getOrphanedNodes() explicitly protects MEMORY and SESSION labels from orphan pruning regardless of edge state.
  • GraphMaintenanceService.runGarbageCollection() deletes only nodes returned by GraphService.getOrphanedNodes() and then best-effort purges matching graph vectors. Therefore Memory/Session retention semantics must not be changed casually by broadening apoptosis.
  • learn/agentos/DreamPipeline.md still describes vector apoptosis as deleting orphaned graph nodes. The retention policy doc must preserve the current distinction: Memory/Session nodes are durable provenance anchors, not ordinary orphan candidates.
  • No open duplicate/successor was found in the live issue search for this exact Memory/Session graph lifecycle telemetry scope.

Problem

Memory and Session nodes are now first-class graph citizens. We have REM freshness observability and migration-debt observability, but not graph lifecycle/storage telemetry for these provenance anchors.

Without a cheap operator-facing payload and explicit retention policy, future agents can only discover graph growth after a storage or query-performance incident. Conversely, adding archival/default-query hiding before telemetry would be premature and risks breaking provenance, mailbox, and memory-recovery paths that depend on durable MEMORY / SESSION anchors.

Accepted Scope

  1. Add cheap Memory Core healthcheck telemetry for Memory/Session graph lifecycle state.
  2. Document the retention policy for Memory/Session graph nodes.
  3. Record an initial baseline from the first post-implementation healthcheck/run evidence.

Contract Ledger

Surface Contract
Healthcheck payload Extend HealthService.healthcheck() with a top-level graphLifecycle block. Required keys: available, memoryNodes, sessionNodes, memoryIncidentEdges, sessionIncidentEdges, sqliteBytes, sqliteWalBytes, sqliteShmBytes, measuredAt, and optional error. Counts are deployment-wide unless a future tenant-scoped ticket adds per-user slicing.
Count semantics memoryNodes / sessionNodes count rows in SQLite Nodes where json_extract(data, '$.label') is MEMORY / SESSION. Incident-edge counts count SQLite Edges whose source or target is a node with the corresponding label.
SQLite size semantics Use the configured SQLite graph storage path (GraphService.db.storage.dbPath) when available. sqliteBytes is the main database file size; sqliteWalBytes and sqliteShmBytes report sibling -wal / -shm file sizes when present, otherwise 0. If the graph DB is not mounted, return available: false with zero counts rather than throwing.
REM surface boundary Do not add this to get_rem_pipeline_state. That MCP tool remains REM freshness/yield telemetry. #10158 adds lifecycle/storage telemetry to healthcheck.
Retention policy doc Add learn/agentos/MemorySessionGraphLifecycle.md (or an adjacent accepted Agent OS guide path if implementation finds a better sibling). It must state that MEMORY and SESSION remain protected from GraphService.getOrphanedNodes() / vector apoptosis by default, explain why they are durable provenance anchors, and define the evidence required before any future archival mechanism is introduced.
Baseline evidence The PR body must include one captured healthcheck.graphLifecycle payload or unit-equivalent evidence and record the baseline in the retention policy doc.
Archival mechanism Out of scope for this ticket. Do not add archivedAt, default-query exclusion, or an archival sweep here. If telemetry later proves retention pressure, create a follow-up ticket with a separate Contract Ledger for marker names, reversible semantics, include-archived query behavior, and tenant/user visibility.
Hard deletion Out of scope. Hard deletion of Memory/Session graph nodes remains forbidden unless a future ticket proves safety against memory recovery, mailbox threading, provenance, and agent identity edge creation.

Acceptance Criteria

  • HealthService.healthcheck() includes graphLifecycle with the payload keys and fallback semantics above.
  • Tests cover the available path, unavailable graph DB fallback, incident-edge counting, and SQLite main/WAL/SHM size reporting.
  • learn/agentos/MemorySessionGraphLifecycle.md documents Memory/Session retention policy and explicitly preserves the current getOrphanedNodes() protection.
  • The PR body records baseline evidence from the new payload.
  • The implementation does not change get_rem_pipeline_state, default graph query visibility, or graph apoptosis pruning behavior.

Out of Scope

  • Automatic pruning or archival sweeps.
  • Default-query exclusion for archived Memory/Session nodes.
  • Hard deletion of Memory/Session nodes.
  • Chroma-side storage telemetry beyond the SQLite graph lifecycle sizes listed above.
  • Cross-tenant retention slicing.

Related

  • Parent: #10143
  • Siblings: #10151, #10152, #10153
  • Retention-sensitive source surfaces: GraphService.getOrphanedNodes(), GraphMaintenanceService.runGarbageCollection(), HealthService.healthcheck(), get_rem_pipeline_state, learn/agentos/DreamPipeline.md

Origin Session ID: 71dc3cd8-d39d-48e1-ac62-e240ca67d1a5

tobiu added the enhancement label on Apr 21, 2026, 3:23 PM
tobiu added the ai label on Apr 21, 2026, 3:23 PM
tobiu added the architecture label on Apr 21, 2026, 3:23 PM
tobiu added the core label on Apr 21, 2026, 3:23 PM
tobiu cross-referenced by #10143 on Apr 21, 2026, 3:23 PM
tobiu added parent issue #10143 on Apr 21, 2026, 3:23 PM
tobiu marked this issue as being blocked by #10151 on Apr 21, 2026, 3:23 PM
tobiu cross-referenced by PR #10161 on Apr 21, 2026, 4:36 PM
tobiu cross-referenced by #9999 on Apr 21, 2026, 7:03 PM
tobiu cross-referenced by PR #10165 on Apr 21, 2026, 8:59 PM
tobiu cross-referenced by PR #10171 on Apr 22, 2026, 12:47 AM
tobiu closed this issue on Jun 6, 2026, 12:44 AM
tobiu referenced in commit 99e7438 - "feat(memory-core): on-demand graph lifecycle census method + script, off the healthcheck hot path (#10158) (#12602) on Jun 6, 2026, 12:44 AM