Skip to content

Add baseline /doctor memory diagnostics #4179

@qqqys

Description

@qqqys

Parent

Part of #3000.

Goal

Add the first, low-risk memory diagnostic entry point: /doctor memory should emit a compact baseline report that users can paste into OOM / long-session memory reports before attempting heavier heap snapshots.

Scope

  • Add /doctor memory command wiring.
  • Report Node/V8 process memory fields:
    • rss
    • heapTotal
    • heapUsed
    • external
    • arrayBuffers
  • Report V8 heap statistics / heap-space summary when available.
  • Report active handle/request counts when available.
  • Report platform metadata useful for triage: Node version, platform, arch, pid, uptime.
  • Keep output human-readable and safe to paste in GitHub issues.

Non-goals for this first step

  • No heap snapshot generation yet.
  • No filesystem export yet.
  • No memory timeline/ring buffer yet.
  • No UI history/tool-result offload changes yet.

Follow-up slices

  1. /doctor memory --export to write diagnostics.json.
  2. /doctor memory --heap / hidden /heapdump, writing diagnostics first and heap snapshot second.
  3. Memory pressure sampling/timeline.
  4. UI history and large tool-result retention limits.

Acceptance criteria

  • /doctor memory works in the interactive CLI.
  • Unit tests cover the command processor path and assert key sections/fields are present.
  • The command does not require optional native dependencies and degrades gracefully if V8/handle internals are unavailable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions