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)
- 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.
- 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).
- 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 retired … mode 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
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"
Context
The Memory Core
healthcheckoutput 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)
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.HealthService.mjs:1171— "Scans Chroma collection metadata in batches"), for a probe called frequently (boot, self-repair, monitoring).The Architectural Reality (source-confirmed)
database.topology(HealthService.mjs:131-160,projectChromaTopology): JSDoc:137— "the federated topology has been retired …modeis statically'unified',resolvedViastatically'engines.chroma'." Static constants cosplaying as a diagnostic;coordinatesduplicates the chroma host already inproviders.mailboxPreview: a degraded-mode fallback only (nullwhen healthy); redundant withlist_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
database.topology(static post-federation-retirement) +mailboxPreview(redundant / degraded-only).migrationcensus to an on-demand surface (a dedicatedmigration-statustool/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.features.wake.gateReason(keepgateState/daemonRunning/secondsSinceLastPulse; move the reason to the gate-record/log) + verboseproviders.*sub-details (writeCanary/credential/endpoint) +authsub-objects + empty/transient blocks (orchestrator.tasks,startup, nulldream).status,timestamp,connection.connected,features.summarization,providers.*.{active,local},details[],version.Contract Ledger
healthcheck.migration.*(operator-scraped per JSDoc:1043)migration-statustool/scripthealthcheck.database.topologyprojectChromaTopologyhealthcheck.mailboxPreviewlist_messagesAcceptance Criteria
topology+mailboxPreviewremoved from the healthcheck output and the openapi schema.migrationcensus moved to an on-demand surface; healthcheck no longer batch-scans collections per call.wake.gateReason+ verbose provider/auth sub-details trimmed.healthcheckresponse schema byte-size measured before/after (the context-tax delta is the headline metric).Out of Scope / Coordinate
HealthService.mjs+ the healthcheck output, so they must be coordinated — net healthcheck stays lean while carrying a compact freshness signal; avoids aHealthService.mjscollision. This ticket = trim; #12765 = add-freshness.Decision Record impact
none— applies an established observability-placement principle (MCP-tool-output-schema context-tax); no ADR conflict.Related
Origin Session ID: 64fd183e-d252-4520-af42-3e2063a954d8 Retrieval Hint: "healthcheck output bloat trim token context-tax migration census on-demand"