LearnNewsExamplesServices
Frontmatter
id10582
titlelogger symmetry: extend always-on file sink to Memory Core and Neural Link MCP servers
stateClosed
labels
enhancementaiarchitecture
assigneesneo-opus-4-7
createdAtMay 1, 2026, 3:55 PM
updatedAtMay 1, 2026, 4:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/10582
authorneo-opus-4-7
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 1, 2026, 4:30 PM

logger symmetry: extend always-on file sink to Memory Core and Neural Link MCP servers

Closedenhancementaiarchitecture
neo-opus-4-7
neo-opus-4-7 commented on May 1, 2026, 3:55 PM

Context

#10580 landed the always-on file sink pattern for the Knowledge Base MCP server's logger. The same observability gap exists for the Memory Core and Neural Link MCP servers — their logger.mjs files are silent unless aiConfig.debug === true (Memory Core) or partially silent (Neural Link gates debug but not info/warn/error to file). Long-running operations (Memory Core summarization, Neural Link inspection chains) leave no tail-able diagnostic trail today.

The Avoided Traps section of #10576 explicitly deferred this symmetry as a follow-up. This ticket implements it.

Proposed Fix

Apply the same dual-sink pattern from #10580 to both servers:

Memory Core (ai/mcp/server/memory-core/logger.mjs): identical shape to pre-#10580 KB — debug-flag-gated stderr only. Refactor to:

  1. Always-on file sink at ${aiConfig.logPath}/mc-server-YYYY-MM-DD.log
  2. Stderr sink stays debug-flag-gated (preserves existing behavior, avoids stdio transport corruption)
  3. Lazy log-dir resolution per-write (same ${logDir}::${today} cache key as #10580)
  4. Error/circular-ref safe stringification (same stringifyArg helper)

Neural Link (ai/mcp/server/neural-link/logger.mjs): already has ISO-timestamp prefix + always-on stderr for non-debug levels. Add:

  1. Always-on file sink at ${aiConfig.logPath}/nl-server-YYYY-MM-DD.log
  2. Preserve existing stderr semantics (debug || level !== 'debug')
  3. Replace naked JSON.stringify(args) with the Error/circular-safe stringifyArg (same defect as KB pre-#10580 — Error.stack/message lost)
  4. Lazy log-dir resolution

Both servers' config.template.mjs: add logPath default mirroring KB's:

logPath: path.resolve(neoRootDir, '.neo-ai-data/logs')

Acceptance Criteria

  1. Memory Core's logger.log/info/warn/error/debug writes to mc-server-YYYY-MM-DD.log regardless of aiConfig.debug
  2. Neural Link's logger.log/info/warn/error/debug writes to nl-server-YYYY-MM-DD.log regardless of aiConfig.debug; existing stderr-on-non-debug semantics preserved
  3. Both config.template.mjs files have logPath defaulting to ${neoRootDir}/.neo-ai-data/logs/
  4. Both loggers' stringifyArg helper preserves Error name/message/stack and falls back gracefully on circular references (no {} for Error, no throw for circular)
  5. Per-server unit tests covering AC1, AC2, AC4 (Error preservation + circular-ref guard)
  6. Both daily files share the same aiConfig.logPath directory by default — single tail -f .neo-ai-data/logs/*-server-$(date +%Y-%m-%d).log works across all 3 MCP servers

Avoided Traps

  • NOT a logger framework refactor. Each MCP server keeps its own logger.mjs per the existing architectural pattern. No shared base class, no DI container. Symmetric pattern, distinct files.
  • NOT structured-log format. Current human-readable timestamp + level + message stays. No JSON-Lines, no log levels routing. Out of scope.
  • NOT a log-rotation library. Daily rotation via filename is the entire rotation strategy. Disk-bloat protection is per-deployment retention policy, out of scope here.
  • NOT touching aiConfig.logPath resolution semantics. Same default + same fallback pattern as #10580. Single source of truth across all 3 MCP server log files.

Origin

  • Empirical surface: 2026-05-01 KB resync incident → #10576/#10580 closed Shape A for KB only
  • Ticket: follow-up explicitly committed to in #10576 Avoided Traps + PR #10580 Test Plan
  • Origin Session ID: 7a2c3c2a-d0f1-462a-8489-69b031221040
tobiu closed this issue on May 1, 2026, 4:30 PM
tobiu referenced in commit 4bdd785 - "feat(mcp): export neoRootDir on Memory Core + Neural Link defaultConfig (#10584) (#10585) on May 1, 2026, 5:01 PM