Skip to content

feat(cli): add mem doctor and first-run guidance that names the documented deploy/compose path #112

Description

@waterbro-8
schemaVersion: requirement-record.v1
revision: R3
status: ready
priority: P2
productOwner: "@PeterGuy326"
technicalOwner: "@waterbro-8"
userOutcome: "A first-time user who is missing a prerequisite is told which one, by the CLI, and is pointed at the documented container path instead of at a bare-metal install they cannot complete."
requirements:
  - REQ-001
  - REQ-002
  - REQ-003
acceptanceCriteria:
  - AC-001
  - AC-002
  - AC-003
parent: "https://github.com/bytefolk/mem/issues/109"
dependencies:
  - "https://github.com/bytefolk/mem/issues/109 at R2"
supersedes:
  - "#109 R1 REQ-003 / AC-003"
lastDecisionAt: "2026-09-04T06:30:41Z"

Context and why this is a separate issue

Split out of #109 by technical-owner adjudication on 2026-08-30: #109 is a documentation repositioning (README/onboarding lead with deploy/compose), while its REQ-003 asked for a CLI surface that does not exist in this repository at all. Verified at main @ 419a420: the strings doctor and first-run appear nowhere in the tree — no command, no messaging, no flag. Shipping it is net-new Go code with its own output contract and tests, which cannot share a reviewable PR with a README rewrite, and which kept #109 mislabelled type:feature for a docs problem.

#109's own open decision asked whether doctor-level container-path detection belongs there or in a shared doctor surface. Answer: the shared surface, which is this issue.

Requirements

  • REQ-001: A read-only mem doctor command reporting, per check and with --format json per SPEC.md:579: server reachability for the configured URL, credential presence, selected workspace, and CLI/server version skew. Exit codes follow SPEC.md:582 (0 ok · 2 not_found · 3 auth · 4 plan/quota · 5 provider/timeout).
  • REQ-002: First-run guidance on the existing fail-closed paths. Every command that currently returns newCliError(3, "not logged in", "run mem auth login first") (e.g. server/cmd/mem/cmds_file.go:45) must, when no credential exists at all, additionally name the documented deployment path from docs(onboarding): make deploy/compose the primary onboarding path #109 — so the hint matches the path the docs now recommend.
  • REQ-003: Diagnosis only. Zero writes, zero auto-remediation, zero dependency installation. An auto-installer would re-create the exact bare-metal burden (brew install postgresql@17 pgvector, server/.env authoring, MinIO, Ollama) that made the container path the recommended entry in the first place (docs/RUN_LOCAL.md:24, scripts/dev_up.sh:31,117,208).

Acceptance criteria

  • AC-001: Fixture per finding class — unreachable server, no credential, no workspace selected, version skew — each producing its named check result, its code, and a hint that names the documented path; asserted at the HTTP-contract level following the cmds_ingest_test.go stub pattern.
  • AC-002: mem doctor performs no write request of any kind — a stub transport fails the test on any non-read call — and never prints a secret, token value, or DSN.
  • AC-003: mem doctor --format json output validates against a checked-in schema or golden file, so ops tooling can consume it without parsing prose.

Non-goals and forbidden shortcuts

  • Not an environment-certification matrix: it does not validate Go/Python/protoc versions, install anything, or manage Docker/compose (no start, stop, or compose up from the CLI).
  • No detection of host container runtimes in v1 — "is the stack container-hosted?" is unverifiable from inside a container and must not be guessed into a reported fact.
  • No TTY wizard; text output is a fixed ordered list of findings.
  • No removal or weakening of docs(onboarding): make deploy/compose the primary onboarding path #109's docs deliverables; this issue consumes them.

Lifecycle, status, priority, blockers, and open decisions

  • status=ready (R3); priority P2 — deliberately below docs(onboarding): make deploy/compose the primary onboarding path #109 (P1): the docs fix ships without waiting for this, and nothing here gates it.
  • technicalOwner @waterbro-8; independent reviewer: a CODEOWNERS owner (not the author).
  • Dependency: docs(onboarding): make deploy/compose the primary onboarding path #109 at R2 must land first, so this issue names a path that exists in the docs rather than inventing one.
  • Open decisions: (1) command name and shape (mem doctor vs mem doctor env vs a mem auth status --doctor mode) — tech adjudication at kickoff; (2) whether memd logs an equivalent readiness line at startup so a compose operator sees the same facts without an exec; (3) whether the check set is a registry that mem-mcp and the web setup screen can reuse.

Evidence plan

  • E2 available now: source-level — the absence of any doctor/first-run surface at main @ 419a420, and the not logged in hint sites that REQ-002 must extend.
  • E3/E4 at delivery: deterministic fixtures per finding class plus one real run against a stopped and a healthy stack.

Decisions

  • R2 owner decision (requirement-decision:v1, decidedAt 2026-09-01T02:54:08Z, approver @PeterGuy326): see #112#issuecomment-5488211237. Approved scope: fixed four checks, fixed ordered text + versioned JSON v1, read-only GET probes only, fail-closed secret handling. This record is append-only; the comment is canonical and this body mirrors it.
  • Resolved by R3 (requirement-decision:v1, decidedAt 2026-09-04T06:30:41Z, approver @PeterGuy326): see #112#issuecomment-5536659086. The doctor's exit-code contract is the SPEC.md §7.1 mapping (0 ok · 2 not_found · 3 auth · 4 plan/quota · 5 provider/timeout); R2's "returns exit code 0 while reporting findings" sentence is replaced. All other R2 scope and security criteria stand.

Revision history


需要 maintainer 打标(本账号无 label 写权限):建议 type:feature、area:cli、priority:p2、evidence:e2-source、status:needs-triage。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCommand-line interfaceevidence:e2-sourceSource or log evidence identifies the likely causepriority:p2Useful backlog work outside the immediate critical pathtype:featureA new user-facing capability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions