LearnNewsExamplesServices
Frontmatter
id11224
titleMigrate memory-core services to flatter SDK structure (M6 MC)
stateClosed
labels
enhancementaiarchitecture
assigneesneo-gemini-3-1-pro
createdAtMay 11, 2026, 6:56 PM
updatedAtMay 12, 2026, 4:08 AM
githubUrlhttps://github.com/neomjs/neo/issues/11224
authorneo-gemini-3-1-pro
commentsCount0
parentIssue10982
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 12, 2026, 4:00 AM

Migrate memory-core services to flatter SDK structure (M6 MC)

Closedenhancementaiarchitecture
neo-gemini-3-1-pro
neo-gemini-3-1-pro commented on May 11, 2026, 6:56 PM

Migrate memory-core services to flatter SDK structure (M6 MC)

Context

Second Tier-1 sub-ticket of M6 epic #10982. Memory Core server: 417 LOC Server.mjs, ~14 services + lifecycle/ subdirectories. This is the largest substantive M6 lift. It follows the pattern established in the M6 KB sub-ticket (#10983).

The Problem

Memory Core services live under ai/mcp/server/memory-core/services/ and are imported into ai/services.mjs via that path. Per M6 design (v13-path.md §4 + D4), services flatten into the SDK structure; Server.mjs shrinks from 417 LOC → <50 LOC thin endpoint wrapper consuming services via the SDK.

The Architectural Reality

MC service inventory (approximate):

ai/mcp/server/memory-core/services/
├── EdgeGraphService.mjs
├── GraphService.mjs
├── MemoryService.mjs
├── PermissionService.mjs
├── SessionService.mjs
├── SummarizationService.mjs
├── TaskService.mjs
├── ... (and lifecycle subdirs)

Current ai/services.mjs imports use Memory_* namespace prefixes. Preserving these post-migration is non-negotiable for SDK consumer compatibility. Server.mjs (417 LOC) currently handles tool registration and service singleton wiring. Migration removes service singleton wiring (shifts to SDK) and leaves only tool registration + BaseServer extension boilerplate.

The Fix

Proposed SDK layout:

ai/services/memory-core/
├── EdgeGraphService.mjs
├── GraphService.mjs
├── MemoryService.mjs
├── ... (other services + lifecycle subdirs)

Sequence:

  1. Move: git mv ai/mcp/server/memory-core/services/* ai/services/memory-core/
  2. Update SDK imports: Edit ai/services.mjs to point at new locations; preserve Memory_* prefixes verbatim.
  3. Update Server.mjs: Edit ai/mcp/server/memory-core/Server.mjs to import services via ai/services.mjs rather than directly; remove local-services-singleton wiring.
  4. Shrink target: Server.mjs <50 LOC. (Note: given the number of tools, it might be slightly larger, but the goal is to remove all service instantiations).
  5. Verify Factory pattern intact: unit + integration suite passes; RequestContextService.run wraps dispatch unchanged.
  6. Capture LOC delta in PR body per M6 epic AC7.

Acceptance Criteria

  • AC1: All MC services + lifecycle subdirectories relocated from ai/mcp/server/memory-core/services/ to ai/services/memory-core/
  • AC2: ai/services.mjs imports updated; Memory_* namespace prefixes preserved verbatim (no consumer-facing API change)
  • AC3: ai/mcp/server/memory-core/Server.mjs shrunk to <50 LOC (or as close to tool-registration-only as possible)
  • AC4: Cross-family review approval per swarm PR review routing (one peer review minimum)
  • AC5: Unit row + integration row green on PR
  • AC6: LOC delta captured in PR body (target: >30% LOC moved from MCP server tree → SDK tree per M6 epic AC7)

Out of Scope

  • Service-internal refactors (separate tickets if needed)
  • Adding new MC tools or service surfaces
  • BaseServer-extension regressions (out of scope; M2 substrate is stable)
  • Other server migrations (separate sub-tickets per M6 epic)

Avoided Traps / Gold Standards Rejected

  • Rejected: rename Memory_* namespace prefixes during migration. Cascading breaking change for SDK consumers.
  • Rejected: flatten ALL way to ai/services/*.mjs (no per-domain subdir). Risks namespace collisions across servers. Per-domain subdir resolves this without re-renaming.
  • Rejected: Bundle with other servers. The MC migration is the largest lift and must be isolated per feedback_substrate_scope_restraint.

Related

  • Parent: #10982 (M6 epic — SDK migration per-server)
  • Strategic anchor: learn/agentos/v13-path.md §4 M6 + D4
  • Pattern PR: #10983 (M6 KB migration)
  • Sibling sub-tickets (forthcoming): GH-WF, NL SDK migrations

Origin Session ID: 57502eb2-7f7b-4b9b-a849-49f016b08c95 Retrieval Hint: query_raw_memories(query="MC memory-core SDK migration M6 v13 flatter service structure")

tobiu referenced in commit 2aa16b2 - "feat(mc): enforce Zod-validated SDK perimeter (#11224) (#11228) on May 12, 2026, 4:00 AM
tobiu closed this issue on May 12, 2026, 4:00 AM