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:
- Move:
git mv ai/mcp/server/memory-core/services/* ai/services/memory-core/
- Update SDK imports: Edit
ai/services.mjs to point at new locations; preserve Memory_* prefixes verbatim.
- 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.
- 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).
- Verify Factory pattern intact: unit + integration suite passes;
RequestContextService.run wraps dispatch unchanged.
- Capture LOC delta in PR body per M6 epic AC7.
Acceptance Criteria
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")
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 intoai/services.mjsvia that path. Per M6 design (v13-path.md§4 + D4), services flatten into the SDK structure;Server.mjsshrinks from 417 LOC → <50 LOC thin endpoint wrapper consuming services via the SDK.The Architectural Reality
MC service inventory (approximate):
Current
ai/services.mjsimports useMemory_*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:
Sequence:
git mv ai/mcp/server/memory-core/services/* ai/services/memory-core/ai/services.mjsto point at new locations; preserveMemory_*prefixes verbatim.ai/mcp/server/memory-core/Server.mjsto import services viaai/services.mjsrather than directly; remove local-services-singleton wiring.Server.mjs<50 LOC. (Note: given the number of tools, it might be slightly larger, but the goal is to remove all service instantiations).RequestContextService.runwraps dispatch unchanged.Acceptance Criteria
ai/mcp/server/memory-core/services/toai/services/memory-core/ai/services.mjsimports updated;Memory_*namespace prefixes preserved verbatim (no consumer-facing API change)ai/mcp/server/memory-core/Server.mjsshrunk to <50 LOC (or as close to tool-registration-only as possible)Out of Scope
Avoided Traps / Gold Standards Rejected
Memory_*namespace prefixes during migration. Cascading breaking change for SDK consumers.ai/services/*.mjs(no per-domain subdir). Risks namespace collisions across servers. Per-domain subdir resolves this without re-renaming.feedback_substrate_scope_restraint.Related
learn/agentos/v13-path.md§4 M6 + D4Origin Session ID: 57502eb2-7f7b-4b9b-a849-49f016b08c95 Retrieval Hint:
query_raw_memories(query="MC memory-core SDK migration M6 v13 flatter service structure")