Skip to content

doctor.sh reports a false FAIL on a healthy install: CLAUDE_PROJECT_DIR is unset in the Bash tool #207

Closed

Description

@PedroHenriqueNS

Summary

On a healthy install where capture is working, /remember:doctor reports:

-- Paths --
FAIL Path resolution failed: FATAL: Cannot resolve project root. CLAUDE_PROJECT_DIR is not set and plugin is not in a local .claude/remember/ layout (PIPELINE_DIR=/Users/…/plugins/cache/claude-plugins-official/remember/0.8.9).

VERDICT: problem — paths did not resolve, capture cannot run (see above)

commands/doctor.md instructs the model to relay this verbatim and to not second-guess the verdict, so the user is told capture cannot run when in fact it is running normally. In my case memory files, the capture-alive marker and a recent last-save.json were all present and correct.

Reproduction

  1. Install the plugin from the marketplace (so PIPELINE_DIR is the versioned cache path, not a local .claude/remember/ layout).
  2. Let a session run long enough for PostToolUse to save at least once.
  3. Run /remember:doctor.

Running the same script with the variable set produces the correct report:

$ CLAUDE_PROJECT_DIR=/path/to/project bash scripts/doctor.sh
…
VERDICT: capture is working — last save 2026-07-27 18:13:59

Cause

commands/doctor.md runs bash "${CLAUDE_PLUGIN_ROOT}/scripts/doctor.sh" through the Bash tool. Claude Code exports CLAUDE_PROJECT_DIR to hooks, but it is not present in the Bash tool's process environment — confirmed by echo "[$CLAUDE_PROJECT_DIR]", which prints empty there.

resolve-paths.sh then hits its third branch and fatals rather than guess. That refusal is correct for the hooks — a wrong guess writes memory into the wrong project — but doctor.sh is a read-only report, and its own ENVIRONMENT header already documents a default that is never implemented:

#   CLAUDE_PROJECT_DIR   Project root (default: .)

PIPELINE_DIR is unaffected: resolve-paths.sh falls back to walking up from the script's own location, and that fallback works (the failing message prints the correct PIPELINE_DIR). Only CLAUDE_PROJECT_DIR needs the default.

This is the same class of failure the doctor was built to end (#144, #200): a silent no-op that sends the user off to fix something that is not broken. Here the report itself is the false signal.

Suggested fix

One line in doctor.sh, before resolve-paths.sh is sourced — scoped to the diagnostic so resolve-paths.sh keeps its strict no-guessing behaviour for the hooks:

# ── 2. Resolved paths ───────────────────────────────────────────────────────
echo "-- Paths --"

# Claude Code exports CLAUDE_PROJECT_DIR to its *hooks*, not to a plain shell —
# and the /remember:doctor slash command runs this through the Bash tool, where
# it is unset. resolve-paths.sh then fatals rather than guess, which is correct
# for the hooks (a wrong guess writes memory into the wrong project) but turns
# this read-only report into a false FAIL on a healthy install. Default to cwd,
# which is what this file's own ENVIRONMENT header already documents.
: "${CLAUDE_PROJECT_DIR:=$PWD}"
export CLAUDE_PROJECT_DIR

_RESOLVE_ERR_FILE="${TMPDIR:-/tmp}/remember-doctor-resolve-$$"

Worst case for a diagnostic run from an unrelated directory is a report about the directory the user is standing in, which is what default: . promises.

Verified locally against 0.8.9: with this applied, a bare bash scripts/doctor.sh reports VERDICT: capture is working and the full path/tool/storage/capture sections render correctly.

Happy to open a PR if useful.

Environment

  • Plugin version 0.8.9 (marketplace install, claude-plugins-official)
  • macOS (Darwin 25.5.0), bash
  • Python 3.14.6, jq 1.8.2
  • Storage mode: legacy (in-project .remember/)
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions