---
id: 12550
title: 'B3 cluster A: eliminate memory-core + MCP/runtime AiConfig defensive reads (#12461)'
state: CLOSED
labels:
  - enhancement
  - ai
assignees:
  - neo-opus-ada
createdAt: '2026-06-04T21:36:02Z'
updatedAt: '2026-06-07T17:18:56Z'
githubUrl: 'https://github.com/neomjs/neo/issues/12550'
author: neo-opus-ada
commentsCount: 0
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-06-05T01:52:59Z'
---
# B3 cluster A: eliminate memory-core + MCP/runtime AiConfig defensive reads (#12461)

## Context

**Cluster A** of the consolidated #12461 B3 cleanup — the 2-cluster reshape that replaces the per-leaf fragmentation (per @tobiu's ticket-proliferation friction: closures up, creation capped at 2 cluster tickets). Authority: **ADR 0019**. ONE ticket + ONE PR. Cluster B (KB/vector/graph/daemon) = @neo-gpt; review/close/resolve = @neo-claude-opus. Owner: @neo-opus-ada.

## Scope — V-B-A'd B3 reads on `origin/dev` (source-grep ledger)

**Clean — read the resolved leaf directly (confirm each leaf's template default in the PR):**
- `ai/services/memory-core/TextEmbeddingService.mjs:245` — `aiConfig.ollama || {}`
- `ai/services/memory-core/managers/CollectionProxy.mjs:23` — `aiConfig.engine || 'hybrid'`; `:100` — `aiConfig.engines?.chroma || {}`
- `ai/services/memory-core/SessionService.mjs:326` — `aiConfig.summarizationBatchLimit || 2000`
- `ai/services/memory-core/SummaryService.mjs:221` — `aiConfig.summarizationBatchLimit || 2000`
- `ai/mcp/server/shared/services/TransportService.mjs:262` — `aiConfig.mcpHttpPort || 3000` — **validation nuance**: may need the `resolveMcpHttpPort` range-check (cf. #12420), not a bare strip. (Auth read at :57 already done by #12547.)

**Validate-first (may NOT be B3 — exclude with rationale if confirmed legit):**
- `ai/mcp/server/BaseServer.mjs:238/469` — `this.aiConfig?.load` / `this.aiConfig?.transport` read the **instance property** `this.aiConfig`, not the global SSOT — likely a legit init-time guard, not a B3 SSOT defense.
- `ai/mcp/server/shared/Logger.mjs:30` — `aiConfig?.data ?? aiConfig ?? {}` — intentional dual-shape (Provider vs raw) adapter; likely keep.

**Deferred behind #12532 (memorySharing overlap — do NOT sweep until #12532 lands/supersedes):**
- `ai/services/memory-core/SummaryService.mjs:207/380` — `aiConfig?.memorySharing?.defaultPolicy || 'legacy'`
- `ai/services/memory-core/MemoryService.mjs` — entire file deferred.

**Excluded (display-only log fallbacks / resolution, not behavior B3 — assess, don't reflexively strip):**
- `SessionService.mjs:256/592` — `|| '<unset>'` / `|| 'unset'` (log strings); model-name resolution at `:579-580`.

## Acceptance Criteria
- [ ] The "clean" B3 reads read resolved leaves directly; each leaf's template default confirmed present (no hidden-default `||` introduced).
- [ ] BaseServer + Logger reads validated; excluded with rationale if not B3 offenders.
- [ ] `SummaryService.memorySharing` + `MemoryService` NOT touched (deferred behind #12532).
- [ ] `mcpHttpPort` handled validation-aware (resolver or confirmed bare-safe).
- [ ] Relevant memory-core/MCP unit specs green; `ai:lint-config-template-ssot` OK.

## Contract Ledger
Not required — pure internal refactoring under the existing ADR-0019 contract (trigger-exclusion: refactor with no observable-public-shape change). The source-grep ledger above is the surface inventory.

## Related
Epic #12461 / #12456. Authority: ADR 0019 (#12457). Deferral dependency: #12532 (memorySharing). Validation ref: #12420 (resolveMcpHttpPort).

## Timeline

- 2026-06-04T21:36:04Z @neo-opus-ada added the `enhancement` label
- 2026-06-04T21:36:04Z @neo-opus-ada added the `ai` label
- 2026-06-04T21:38:00Z @neo-opus-ada assigned to @neo-opus-ada
- 2026-06-04T22:54:11Z @neo-opus-ada cross-referenced by PR #12553
- 2026-06-04T22:55:56Z @neo-claude-opus cross-referenced by PR #12551
- 2026-06-04T23:37:06Z @neo-claude-opus cross-referenced by #12456
- 2026-06-04T23:43:47Z @neo-opus-ada cross-referenced by #12461
- 2026-06-05T01:52:59Z @tobiu closed this issue
- 2026-06-05T01:52:59Z @tobiu referenced in commit `2b8277c` - "fix(ai): remove memory-core + MCP/runtime B3 AiConfig defensive reads (#12550) (#12553)

Co-authored-by: tobiu <tobiasuhlig78@gmail.com>"

