LearnNewsExamplesServices
Frontmatter
id10956
titleMigrate Memory Core summary sweeps to daemon
stateClosed
labels
enhancementairefactoringarchitecture
assigneesneo-gemini-3-1-pro
createdAtMay 8, 2026, 1:20 PM
updatedAtMay 15, 2026, 2:47 PM
githubUrlhttps://github.com/neomjs/neo/issues/10956
authorneo-gpt
commentsCount2
parentIssue10822
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 8, 2026, 5:57 PM

Migrate Memory Core summary sweeps to daemon

Closedenhancementairefactoringarchitecture
neo-gpt
neo-gpt commented on May 8, 2026, 1:20 PM

Context

This ticket was originally filed from the 2026-05-08 architecture correction thread as a hard removal ticket for NEO_MC_PRIMARY. That was over-broad.

Corrected operator framing from A2A MESSAGE:ed916cf2-a053-4985-9823-6f9416e2f7f6:

  • NEO_MC_PRIMARY is still valid today for local multi-harness MCP duplication: Claude Code worktrees, Antigravity, Codex Desktop, and per-workspace language servers can each spawn local Memory Core server instances that share .neo-ai-data/.
  • The remote multi-user Memory Core path is different: one remote Memory Core endpoint serves multiple authenticated agents through request-scoped identity/session context via RequestContextService and Mcp-Session-Id.
  • After summarization lifecycle work moves into a singleton daemon, NEO_MC_PRIMARY becomes obsolete because daemon-singleton-per-host handles the local multi-process race.

So the corrected goal is not "strip NEO_MC_PRIMARY immediately." The corrected goal is to migrate Piece B+C summarization lifecycle work into bridge-daemon.mjs or a sibling singleton daemon, then remove NEO_MC_PRIMARY as a downstream cleanup once the daemon owns the single-writer responsibility.

Duplicate / Adjacency Sweep

No focused daemon-migration ticket for Piece B+C summarization was found.

Adjacent/stale sources:

  • #10813 — source ticket for summary restoration; its Piece C mechanism already says to extend bridge-daemon.mjs or a sibling daemon.
  • PR #10954 — in-process Piece C implementation; should be reshaped or superseded toward daemon substrate.
  • #10948 / PR #10955 — invalid primary/secondary deployment fixture; closed/dropped correctly.
  • #10822 — adjacent config substrate cleanup epic.
  • #10186 — broader MCP concurrency / single-writer audit.

The Problem

The swarm mixed two separate concurrency problems:

  1. Remote multi-user Memory Core: one remote MC endpoint, multiple authenticated agents, request-scoped identity/session context. This does not need primary/secondary MC containers.
  2. Local multi-harness Memory Core duplication: multiple local MCP server processes can exist on one host and share .neo-ai-data/. This still needs a single-writer guard until lifecycle work is daemonized.

NEO_MC_PRIMARY is an acceptable interim local-process guard, but it should not remain the long-term product model. It is also easy for future agents to misread as a remote primary/secondary topology. The durable fix is daemon ownership of summarization lifecycle work.

The Architectural Reality

Current correct remote substrate:

  • RequestContextService owns request-scoped identity/session propagation.
  • Mcp-Session-Id is the transport-layer session binding for shared deployments.
  • Memory and summary services read RequestContextService for tenant-aware metadata and filters.

Current local interim substrate:

  • NEO_MC_PRIMARY gates summarization startup/queue/poller paths to avoid multiple local MCP server processes racing against shared local data.
  • This is still relevant before daemonization.

Target substrate:

  • A singleton daemon (bridge-daemon.mjs or a sibling summarization daemon) owns Piece B+C summarization triggers.
  • Once that daemon is authoritative, active Memory Core server instances no longer need NEO_MC_PRIMARY for summarization lifecycle writes.

The Fix

  1. Decide whether Piece B+C belongs in bridge-daemon.mjs or a sibling daemon.
  2. Move sunset-handover polling and periodic safety-net summarization sweep into that singleton daemon substrate.
  3. Keep existing SummarizationJobs lease semantics if they still protect actual concurrent work execution.
  4. Update docs so remote deployment is described as one endpoint with request-scoped context, while local duplicate MCP instances are described as a pre-daemonization concern.
  5. After daemon ownership is in place, remove NEO_MC_PRIMARY / aiConfig.isPrimary from active Memory Core summarization paths and docs.
  6. Reconcile #10813 and PR #10954 against the daemon substrate.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Piece B sunset handover trigger #10813, corrected 2026-05-08 operator framing Singleton daemon detects sunset handover events and triggers summary work If daemon unavailable, manual summarize_sessions remains recovery path MemoryCore.md, SharedDeployment.md Unit or integration test proves daemon trigger invokes summarization once
Piece C periodic safety-net sweep #10813 AC3 Singleton daemon runs periodic drift-detection sweep Cadence can be disabled in dev via explicit config DeploymentCookbook.md env/operator section Test proves cadence/disabled behavior and health observability
NEO_MC_PRIMARY / aiConfig.isPrimary Local multi-harness interim guard Retained until daemonization; removed after daemon owns single-writer lifecycle duties If any residual diagnostic use remains, mark it non-product-path explicitly Remove from product-path docs after daemonization `rg "NEO_MC_PRIMARY
Remote Memory Core deployment docs RequestContextService + Mcp-Session-Id model One remote endpoint serves multiple agents with request-scoped context None; primary/secondary remote topology is stale SharedDeployment.md, auth/tooling docs Docs and tests no longer imply mc-primary / mc-secondary remote topology

Acceptance Criteria

  • Decision recorded: extend bridge-daemon.mjs vs create sibling summarization daemon.
  • Piece B sunset-handover polling is daemon-owned or explicitly routed through daemon ownership.
  • Piece C periodic summarization sweep is daemon-owned, configurable, and observable.
  • Remote deployment docs describe one Memory Core endpoint with request-scoped identity/session context, not primary/secondary MC containers.
  • Local multi-harness duplicate MCP process risk remains documented only as a pre-daemonization concern.
  • NEO_MC_PRIMARY remains only where still needed before daemonization, then is removed in the daemonization PR or a directly-linked follow-up.
  • #10813 is reconciled so its Contract Ledger/ACs point at daemon substrate rather than in-process primary/secondary wording.
  • PR #10954 is closed/superseded or reshaped to match the daemon substrate.
  • #10945 remains with only valid children; #10948 stays closed invalid.

Out of Scope

  • Reopening #10948 or reviving mc-primary / mc-secondary deployment tests.
  • Removing SummarizationJobs lease semantics without proving they are redundant.
  • Changing OIDC/proxy identity behavior.
  • Closing #10186 globally.

Avoided Traps / Gold Standards Rejected

  • Rejected: immediate NEO_MC_PRIMARY removal. It still protects local multi-harness duplicate MCP processes until daemonization.
  • Rejected: remote primary/secondary Memory Core topology. Remote multi-user MC is one endpoint with request-scoped context.
  • Gold standard: daemon-owned lifecycle work. Summarization triggers belong in a singleton daemon substrate, not every MCP server process.
  • Gold standard: sequence the cleanup. First daemonize Piece B+C; then strip the now-obsolete process-role gate.

Related

  • #10813 — source summary-restoration ticket; needs reconciliation.
  • PR #10954 — in-process Piece C implementation; reshape/supersede incoming.
  • #10948 / PR #10955 — invalid primary/secondary deployment test path.
  • #10945 — deployment-pipeline integration coverage epic.
  • #10822 — config substrate cleanup epic.
  • #10186 — broader MCP concurrency / single-writer audit.
  • A2A: MESSAGE:ed916cf2-a053-4985-9823-6f9416e2f7f6.

Origin Session ID: c02fbf4e-870c-44c0-ba7e-e9ffacce094b

Retrieval Hint: query_raw_memories(query="NEO_MC_PRIMARY local MCP server instances daemon summarization bridge-daemon RequestContextService remote Memory Core")

tobiu referenced in commit 058cd5b - "feat(memory-core): migrate summary sweeps to daemon (#10956) (#10967) on May 8, 2026, 5:57 PM
tobiu closed this issue on May 8, 2026, 5:57 PM