LearnNewsExamplesServices
Frontmatter
id9798
titleNative Memory Core Graph Topology Export
stateClosed
labels
enhancementaiarchitecture
assigneestobiu
createdAtApr 8, 2026, 11:36 PM
updatedAtApr 8, 2026, 11:40 PM
githubUrlhttps://github.com/neomjs/neo/issues/9798
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 8, 2026, 11:36 PM

Native Memory Core Graph Topology Export

Closedenhancementaiarchitecture
tobiu
tobiu commented on Apr 8, 2026, 11:36 PM

The Problem

While standardizing the memory-core snapshot strategy, we realized that only the episodic memories and summaries vector collections were captured. The Native Edge Graph topology (storing runtime relationships, Nodes, and Edges) inside SQLite remained isolated and was omitted from the unified .neo-ai-data/backups/ export directory. Without serializing the graph alongside the vectors, downstream swarm clusters could suffer from "context amnesia" upon loading cold backups.

The Architectural Reality

The native Knowledge Graph leverages specific tables (Nodes, Edges) isolated inside SQLite.mjs, which differs structurally from traditional LanceDB/Chroma schemas. File modifications involve:

  • ai/mcp/server/memory-core/services/DatabaseService.mjs: Augmented to explicitly query the GraphService.db.storage.db and synchronously pipe data to graph-backup-[timestamp].jsonl.
  • Stream termination logic was fortified explicitly wrapping writeStream.end(resolve) in Promises to ensure that fast-exiting lifecycle scripts (exportDatabase.mjs) don't prematurely kill the pipe buffer before reaching the disk.

Avoided Anti-Patterns & False 'Gold Standards'

  1. Purity of Context Collections: We intentionally avoided routing the graph through StorageRouter.mjs. While they share a database, the vector collections and the edge graph are structurally different. Building a generic router catch-all compromises the deterministic querying capabilities native directly to the Graph schema.
  2. Synchronous Buffer Ejection: Previously, process.exit(0) truncated Node.js streams silently. Implementing deterministic await new Promise(...) checkpoints bypasses brittle event-emitter architectures while guaranteeing payload delivery regardless of execution environment speed.
tobiu added the enhancement label on Apr 8, 2026, 11:36 PM
tobiu added the ai label on Apr 8, 2026, 11:36 PM
tobiu added the architecture label on Apr 8, 2026, 11:36 PM
tobiu assigned to @tobiu on Apr 8, 2026, 11:36 PM
tobiu referenced in commit 7ac271b - "feat: Native Memory Core Graph Topology Export (#9798)" on Apr 8, 2026, 11:36 PM
tobiu
tobiu Apr 8, 2026, 11:36 PM

Input from Gemini 3.1 Pro (Antigravity):

✦ The Native Graph topology export has been successfully implemented and validated. Modifying DatabaseService.mjs allows the #exportGraph process to extract explicit Nodes and Edges schemas to .jsonl. Furthermore, wait promises were injected into the write streams to synchronously await file buffer draining prior to Node loop exit, successfully preventing .jsonl payload truncation.

Changes have been pushed to the remote repository.

tobiu closed this issue on Apr 8, 2026, 11:36 PM