LearnNewsExamplesServices
Frontmatter
id12768
titleTrim the Memory Core healthcheck to a lean liveness probe (token cost)
stateClosed
labels
enhancementaiarchitectureperformanceneeds-re-triagemodel-experience
assigneesneo-opus-grace
createdAtJun 8, 2026, 4:16 PM
updatedAtJun 14, 2026, 2:03 PM
githubUrlhttps://github.com/neomjs/neo/issues/12768
authorneo-opus-grace
commentsCount4
parentIssuenull
subIssues
13069 MC healthcheck: drop static database.topology + redundant mailboxPreview (context-tax slice of #12768)
13074 Relocate MC healthcheck migration-census to an on-demand surface (compute slice of #12768)
subIssuesCompleted2
subIssuesTotal2
blockedBy[]
blocking[]
closedAtJun 14, 2026, 2:03 PM

Trim the Memory Core healthcheck to a lean liveness probe (token cost)

Closed v13.1.0/archive-v13-1-0-chunk-1 enhancementaiarchitectureperformanceneeds-re-triagemodel-experience
neo-opus-grace
neo-opus-grace commented on Jun 8, 2026, 4:16 PM

Context

The Memory Core healthcheck output has accreted observability that doesn't belong in a hot-path liveness/readiness probe. Surfaced during the 2026-06-08 cost-safety / MC-degradation session (@tobiu: "analyse the tool for bloat … topology: unified, we no longer have an alternative, pointless … remove last messages"). The cost is token-shaped on three axes, so trimming is a direct, swarm-wide token saver.

The Problem (three costs)

  1. Per-agent context-tax — the healthcheck OUTPUT SCHEMA (ai/mcp/server/memory-core/openapi.yaml) loads into every agent's context at MCP tool-enumeration (ToolService). Every documented field is permanent per-agent context cost across the whole swarm.
  2. Hot-path compute — the migration census batch-scans ~17.9k Chroma collection records on every healthcheck (HealthService.mjs:1171 — "Scans Chroma collection metadata in batches"), for a probe called frequently (boot, self-repair, monitoring).
  3. Per-call output — the large JSON returned each call.

The Architectural Reality (source-confirmed)

  • database.topology (HealthService.mjs:131-160, projectChromaTopology): JSDoc :137"the federated topology has been retiredmode is statically 'unified', resolvedVia statically 'engines.chroma'." Static constants cosplaying as a diagnostic; coordinates duplicates the chroma host already in providers.
  • mailboxPreview: a degraded-mode fallback only (null when healthy); redundant with list_messages.
  • migration (:626-679 + :1042-1171): operator-scraped census (perUserId, migrationDebt, untaggedCount, visibility) recomputed via batch-scan every call.
  • features.wake.gateReason: a multi-sentence incident string shipped in every payload.

The Fix

  • REMOVE database.topology (static post-federation-retirement) + mailboxPreview (redundant / degraded-only).
  • MOVE the migration census to an on-demand surface (a dedicated migration-status tool/script behind a service method) — per the established "expensive / operator-periodic observability → on-demand, never a healthcheck field" pattern. Healthcheck stops batch-scanning collections per call.
  • TRIM features.wake.gateReason (keep gateState / daemonRunning / secondsSinceLastPulse; move the reason to the gate-record/log) + verbose providers.* sub-details (writeCanary / credential / endpoint) + auth sub-objects + empty/transient blocks (orchestrator.tasks, startup, null dream).
  • KEEP the lean core: status, timestamp, connection.connected, features.summarization, providers.*.{active,local}, details[], version.

Contract Ledger

Surface Source of authority Proposed Fallback / migration Consumer
healthcheck.migration.* (operator-scraped per JSDoc :1043) HealthService census move off healthcheck new on-demand migration-status tool/script operators (periodic)
healthcheck.database.topology projectChromaTopology remove n/a (static constant) none real
healthcheck.mailboxPreview degraded fallback remove list_messages agents

Acceptance Criteria

  • topology + mailboxPreview removed from the healthcheck output and the openapi schema.
  • migration census moved to an on-demand surface; healthcheck no longer batch-scans collections per call.
  • wake.gateReason + verbose provider/auth sub-details trimmed.
  • openapi healthcheck response schema byte-size measured before/after (the context-tax delta is the headline metric).
  • HealthService unit specs updated for the trimmed shape; the on-demand migration surface gets its own spec.

Out of Scope / Coordinate

  • #12765 (@neo-gpt — "Expose MCP runtime source/schema drift in healthcheck") moves the opposite direction (it adds freshness/drift fields). Both touch HealthService.mjs + the healthcheck output, so they must be coordinated — net healthcheck stays lean while carrying a compact freshness signal; avoids a HealthService.mjs collision. This ticket = trim; #12765 = add-freshness.
  • KB / github-workflow healthchecks not changed here (MC first; same pattern can follow).

Decision Record impact

none — applies an established observability-placement principle (MCP-tool-output-schema context-tax); no ADR conflict.

Related

  • #12765 (coordinate — same tool, opposite direction), #12767 (config drift), #12740 (cost-safety epic — token/cost-reduction aligned).

Origin Session ID: 64fd183e-d252-4520-af42-3e2063a954d8 Retrieval Hint: "healthcheck output bloat trim token context-tax migration census on-demand"

tobiu referenced in commit 685eab4 - "feat(ai): share MCP runtime freshness helper (#12776) (#12778) on Jun 9, 2026, 7:08 PM
tobiu referenced in commit 2a12f1d - "refactor(memory-core): drop static database.topology + redundant mailboxPreview from healthcheck (#13069) (#13071) on Jun 13, 2026, 3:45 PM
tobiu referenced in commit 3a12797 - "refactor(memory-core): relocate healthcheck migration-census to an on-demand surface (#13074) (#13075) on Jun 13, 2026, 4:20 PM
tobiu referenced in commit c26b7ee - "refactor(memory-core): trim residual verbose fields from the healthcheck (#13210) on Jun 14, 2026, 2:03 PM
tobiu closed this issue on Jun 14, 2026, 2:03 PM