LearnNewsExamplesServices
Frontmatter
id12438
titleAudit importable Memory Core path fallbacks against AiConfig
stateClosed
labels
bugairefactoringarchitecture
assigneesneo-gpt
createdAtJun 3, 2026, 3:40 PM
updatedAtJun 7, 2026, 7:18 PM
githubUrlhttps://github.com/neomjs/neo/issues/12438
authorneo-gpt
commentsCount2
parentIssue12456
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 5, 2026, 3:58 PM

Audit importable Memory Core path fallbacks against AiConfig

Closed v13.0.0/archive-v13-0-0-chunk-15 bugairefactoringarchitecture
neo-gpt
neo-gpt commented on Jun 3, 2026, 3:40 PM

Context

This ticket is the deliverable importable-consumer slice of the broader ADR 0019 A1 cleanup under Epic #12456. The original audit-wide wording was too broad for one PR and duplicated parent-epic scope; after V-B-A against current source and the closed #12464 micro-split correction, this issue is scoped to the load-bearing Memory Core graph / wake path consumers that can read existing config leaves directly.

Authority: ADR 0019 — AiConfig and child providers are the reactive Provider SSOT. Importable consumers read resolved leaves at the use site; genuine non-entrypoint helpers remain out of this ticket and use ADR 0019 §5.5 pure-defaults / bootstrap-injection treatment.

Problem

Three active importable consumers still re-derived config-owned path defaults:

  • ai/daemons/bridge/daemon.mjs used process.env.NEO_AI_DB_PATH || '.neo-ai-data/sqlite/memory-core-graph.sqlite' and process.env.NEO_AI_DAEMON_DIR || '.neo-ai-data/wake-daemon'.
  • ai/services/memory-core/HealthService.mjs used process.env.NEO_HEARTBEAT_ALIVE_PATH || <repo>/.neo-ai-data/wake-daemon/heartbeat.alive even though the Tier-1 leaf owns that env.
  • ai/scripts/diagnostics/analyzeNlTelemetry.mjs used process.env.NEO_MEMORY_DB_PATH || aiConfig.storagePaths.graph, duplicating the Memory Core graph leaf env resolution.

These local fallback chains drift from the owning config leaves and make test-mode resolution harder to reason about. The #12464 one-line variant was rejected as negative ROI; this ticket is the clustered form that removes the same pattern across daemon, service, and diagnostic consumers with focused tests.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback / Edge Case Docs Evidence
Bridge daemon graph DB path ADR 0019; ai/mcp/server/memory-core/config.template.mjs#storagePaths.graph Read memoryCoreConfig.storagePaths.graph at module setup. Unit subprocesses running with UNIT_TEST_MODE=true provide NEO_MEMORY_DB_PATH_TEST; production env remains NEO_MEMORY_DB_PATH through the leaf. PR body lists the stale alias removal. Bridge daemon unit file validates delivery against a physical test DB.
Bridge daemon data dir ADR 0019; ai/mcp/server/memory-core/config.template.mjs#wakeDaemon.dataDir Read memoryCoreConfig.wakeDaemon.dataDir. Existing NEO_AI_DAEMON_DIR env remains leaf-owned. PR body lists the retained env leaf. Bridge daemon unit file validates PID/log/state isolation.
HealthService heartbeat liveness path ADR 0019; ai/config.template.mjs#wakeDaemonHeartbeatAlivePath; SwarmHeartbeatService.heartbeatAlivePath() precedent Read aiConfig.wakeDaemonHeartbeatAlivePath and export the helper for a focused invariant. Tests apply NEO_HEARTBEAT_ALIVE_PATH through AiConfig.setEnvOverride(); no live per-read env fallback. JSDoc names producer/consumer shared path contract. HealthService unit file validates helper + wake features block.
Diagnostic NL telemetry DB path ADR 0019; ai/mcp/server/memory-core/config.template.mjs#storagePaths.graph Read aiConfig.storagePaths.graph; remove direct process.env.NEO_MEMORY_DB_PATH fallback. Under UNIT_TEST_MODE=true, tests use NEO_MEMORY_DB_PATH_TEST; production env remains NEO_MEMORY_DB_PATH through the leaf. Inline comment names leaf-owned env. Diagnostic unit file validates subprocess behavior + source invariant.

Acceptance Criteria

  • bridge/daemon.mjs no longer references NEO_AI_DB_PATH or hardcoded Memory Core graph DB fallback literals.
  • bridge/daemon.mjs reads the wake-daemon data directory from the Memory Core config leaf, preserving NEO_AI_DAEMON_DIR as a leaf-owned env override.
  • HealthService.heartbeatAlivePath() reads the resolved Tier-1 heartbeat leaf and matches the existing SwarmHeartbeatService producer precedent.
  • analyzeNlTelemetry.mjs reads aiConfig.storagePaths.graph directly; no duplicate process.env.NEO_MEMORY_DB_PATH ||/?? fallback remains.
  • Focused unit coverage proves bridge daemon subprocess delivery, HealthService wake features behavior, and the diagnostic source invariant.
  • PR body documents residual A1 surfaces that remain out of this importable-consumer slice.

Out of Scope

  • Genuine non-entrypoint / pure-defaults surfaces such as TaskDefinitions.mjs and its orchestrator consumers.
  • Broader data-root redesign / NEO_AI_DATA_ROOT resurrection (#12417 is still needs-re-triage).
  • B3 defensive-read cleanup (#12461 and its cluster PRs).
  • Lifecycle-script local state files that do not yet have owning config leaves.
  • Public docs, Docker, examples, and historical resources/content/** records.

Related

  • Parent epic: #12456
  • Authority: ADR 0019 (#12457 / PR #12458)
  • Correction anchor: #12464 / PR #12468 closed as negative-ROI micro-split
  • Related stale broad root: #12417 (needs-re-triage)

Origin Session ID: 1a18ef10-3f42-42ce-833a-9451be0eec6d

Handoff Retrieval Hint: AiConfig A1 Memory Core graph wake path bridge HealthService analyzeNlTelemetry

tobiu referenced in commit 0d66876 - "refactor(ai): read Memory Core path leaves directly (#12438) (#12562)" on Jun 5, 2026, 3:58 PM
tobiu closed this issue on Jun 5, 2026, 3:58 PM