Files
claude-mem/docs/reports/2026-01-05--issue-543-slash-command-unavailable.md
Alex Newman f38b5b85bc fix: resolve issues #543, #544, #545, #557 (#558)
* docs: add investigation reports for 5 open GitHub issues

Comprehensive analysis of issues #543, #544, #545, #555, and #557:

- #557: settings.json not generated, module loader error (node/bun mismatch)
- #555: Windows hooks not executing, hasIpc always false
- #545: formatTool crashes on non-JSON tool_input strings
- #544: mem-search skill hint shown incorrectly to Claude Code users
- #543: /claude-mem slash command unavailable despite installation

Each report includes root cause analysis, affected files, and proposed fixes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(logger): handle non-JSON tool_input in formatTool (#545)

Wrap JSON.parse in try-catch to handle raw string inputs (e.g., Bash
commands) that aren't valid JSON. Falls back to using the string as-is.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(context): update mem-search hint to reference MCP tools (#544)

Update hint messages to reference MCP tools (search, get_observations)
instead of the deprecated "mem-search skill" terminology.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(settings): auto-create settings.json on first load (#557, #543)

When settings.json doesn't exist, create it with defaults instead of
returning in-memory defaults. Creates parent directory if needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(hooks): use bun runtime for hooks except smart-install (#557)

Change hook commands from node to bun since hooks use bun:sqlite.
Keep smart-install.js on node since it bootstraps bun installation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: rebuild plugin scripts

* docs: clarify that build artifacts must be committed

* fix(docs): update build artifacts directory reference in CLAUDE.md

* test: add test coverage for PR #558 fixes

- Fix 2 failing tests: update "mem-search skill" → "MCP tools" expectations
- Add 56 tests for formatTool() JSON.parse crash fix (Issue #545)
- Add 27 tests for settings.json auto-creation (Issue #543)

Test coverage includes:
- formatTool: JSON parsing, raw strings, objects, null/undefined, all tool types
- Settings: file creation, directory creation, schema migration, edge cases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(tests): clean up flaky tests and fix circular dependency

Phase 1 of test quality improvements:

- Delete 6 harmful/worthless test files that used problematic mock.module()
  patterns or tested implementation details rather than behavior:
  - context-builder.test.ts (tested internal implementation)
  - export-types.test.ts (fragile mock patterns)
  - smart-install.test.ts (shell script testing antipattern)
  - session_id_refactor.test.ts (outdated, tested refactoring itself)
  - validate_sql_update.test.ts (one-time migration validation)
  - observation-broadcaster.test.ts (excessive mocking)

- Fix circular dependency between logger.ts and SettingsDefaultsManager.ts
  by using late binding pattern - logger now lazily loads settings

- Refactor mock.module() to spyOn() in several test files for more
  maintainable and less brittle tests:
  - observation-compiler.test.ts
  - gemini_agent.test.ts
  - error-handler.test.ts
  - server.test.ts
  - response-processor.test.ts

All 649 tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(tests): phase 2 - reduce mock-heavy tests and improve focus

- Remove mock-heavy query tests from observation-compiler.test.ts, keep real buildTimeline tests
- Convert session_id_usage_validation.test.ts from 477 to 178 lines of focused smoke tests
- Remove tests for language built-ins from worker-spawn.test.ts (JSON.parse, array indexing)
- Rename logger-coverage.test.ts to logger-usage-standards.test.ts for clarity

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(tests): phase 3 - add JSDoc mock justification to test files

Document mock usage rationale in 5 test files to improve maintainability:
- error-handler.test.ts: Express req/res mocks, logger spies (~11%)
- fallback-error-handler.test.ts: Zero mocks, pure function tests
- session-cleanup-helper.test.ts: Session fixtures, worker mocks (~19%)
- hook-constants.test.ts: process.platform mock for Windows tests (~12%)
- session_store.test.ts: Zero mocks, real SQLite :memory: database

Part of ongoing effort to document mock justifications per TESTING.md guidelines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(integration): phase 5 - add 72 tests for critical coverage gaps

Add comprehensive test coverage for previously untested areas:

- tests/integration/hook-execution-e2e.test.ts (10 tests)
  Tests lifecycle hooks execution flow and context propagation

- tests/integration/worker-api-endpoints.test.ts (19 tests)
  Tests all worker service HTTP endpoints without heavy mocking

- tests/integration/chroma-vector-sync.test.ts (16 tests)
  Tests vector embedding synchronization with ChromaDB

- tests/utils/tag-stripping.test.ts (27 tests)
  Tests privacy tag stripping utilities for both <private> and
  <meta-observation> tags

All tests use real implementations where feasible, following the
project's testing philosophy of preferring integration-style tests
over unit tests with extensive mocking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* context update

* docs: add comment linking DEFAULT_DATA_DIR locations

Added NOTE comment in logger.ts pointing to the canonical DEFAULT_DATA_DIR
in SettingsDefaultsManager.ts. This addresses PR reviewer feedback about
the fragility of having the default defined in two places to avoid
circular dependencies.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:45:09 -05:00

9.1 KiB

Issue #543 Analysis: /claude-mem Slash Command Not Available Despite Installation

Date: 2026-01-05 Version Analyzed: 8.5.9 Status: Expected Behavior - No such command exists Related Issues: #557 (if it exists), Windows initialization issues

Issue Summary

A user reports that the /claude-mem diagnostics command returns "Unknown slash command: claude-mem" after installing claude-mem v8.5.9 on Windows.

Reported Environment

  • Claude-mem version: 8.5.9
  • Claude Code version: 2.0.76
  • Node.js version: v22.21.0
  • Bun version: 1.3.5
  • OS: Windows 10.0.26200.7462 (x64)

Reported Plugin Status

  • Worker Running: No
  • Database Exists: Yes (4.00 KB - minimal/empty database)
  • Settings Exist: No

Root Cause Analysis

Finding 1: No /claude-mem Slash Command Exists

Critical Discovery: The /claude-mem diagnostics command does not exist in claude-mem. After extensive codebase analysis:

  1. No slash command registration found: The plugin/commands/ directory is empty. Claude-mem does not register any slash commands.

  2. Skills, not commands: Claude-mem uses Claude Code's skill system, not the command system. Skills are defined in plugin/skills/:

    • mem-search/ - Memory search functionality
    • troubleshoot/ - Troubleshooting functionality
    • search/ - Search operations
    • claude-mem-settings/ - Settings management
  3. Empty skill directories: All skill directories currently contain only empty subdirectories (operations/, principles/) with no SKILL.md files present in the built plugin. This suggests either:

    • Skills are dynamically loaded from the worker service
    • A build issue where skill files are not being bundled
    • Skills were removed or relocated in a recent refactor

Finding 2: How Troubleshooting Actually Works

According to the documentation (docs/public/troubleshooting.mdx):

"Describe any issues you're experiencing to Claude, and the troubleshoot skill will automatically activate to provide diagnosis and fixes."

The troubleshoot skill is designed to be invoked naturally - users describe their problem to Claude, and the skill auto-invokes. There is no /claude-mem diagnostics command.

Finding 3: Settings.json Creation Flow

The settings.json file is not created during installation. It is created:

  1. On first worker API call: The ensureSettingsFile() method in SettingsRoutes.ts (lines 400-413) creates the file with defaults when the settings API is first accessed.

  2. Worker must be running: Since settings creation is triggered by API calls, the worker service must be running for settings to be created.

  3. Lazy initialization pattern: This is intentional - settings are created on-demand with sensible defaults rather than during installation.

Finding 4: Worker Service Not Running

The user reports "Worker Running: No". This is the core issue because:

  1. Worker auto-start on SessionStart: The hooks.json shows the worker starts via:

    {
      "type": "command",
      "command": "bun \"${CLAUDE_PLUGIN_ROOT}/scripts/worker-service.cjs\" start",
      "timeout": 60
    }
    
  2. Smart-install runs first: Before worker start, smart-install.js runs to ensure Bun and uv are installed.

  3. Windows-specific issues: The user is on Windows, which has known issues:

    • PowerShell escaping problems in cleanupOrphanedProcesses() (Issue #517)
    • PATH issues with freshly installed Bun
    • Process spawning differences

Finding 5: Database Size Indicates No Data

The database is 4.00 KB, which is essentially an empty schema:

  • No observations recorded
  • No sessions created
  • Hooks may not have executed successfully

Initialization Flow Analysis

Installation
    |
    v
First Session Start
    |
    +---> smart-install.js (ensure Bun + uv)
    |         |
    |         +---> May fail silently on Windows (PATH issues)
    |
    +---> worker-service.cjs start
    |         |
    |         +---> Likely failing (worker not running)
    |
    +---> context-hook.js (requires worker)
    |         |
    |         +---> Fails or returns empty (no worker)
    |
    +---> user-message-hook.js
              |
              +---> No context injected

Why Skills Directories Are Empty

After investigation, the skill directories in plugin/skills/ are scaffolding structures but appear to have no SKILL.md files in the built plugin. The actual skill functionality may be:

  1. Served via HTTP API: The Server.ts shows an /api/instructions endpoint that loads SKILL.md sections on-demand from ../skills/mem-search/
  2. Built differently: The skills may be bundled into the worker service rather than standalone files
  3. Documentation discrepancy: The README and docs reference skills that may work differently than traditional Claude Code skill files

Proposed Diagnosis

The user's issue is not that /claude-mem diagnostics doesn't work - that command never existed. The actual issues are:

  1. Misunderstanding of troubleshoot functionality: The user expects a slash command but should describe issues naturally to Claude.

  2. Worker service failed to start: Root cause for:

    • No settings.json created
    • Empty database (no observations)
    • No context injection working
  3. Possible Windows initialization failures:

    • Bun may not be in PATH after smart-install
    • PowerShell execution policy issues
    • Worker spawn failures

Step 1: Verify Bun Installation

bun --version

If not found, manually install:

powershell -c "irm bun.sh/install.ps1 | iex"

Then restart terminal.

Step 2: Manually Start Worker

cd ~/.claude/plugins/marketplaces/thedotmack
bun plugin/scripts/worker-service.cjs start

Step 3: Verify Worker Health

curl http://localhost:37777/health

Step 4: Create Settings Manually (if needed)

curl http://localhost:37777/api/settings

This will create ~/.claude-mem/settings.json with defaults.

Step 5: For Diagnostics - Natural Language

Instead of /claude-mem diagnostics, describe the issue to Claude:

"I'm having issues with claude-mem. Can you help troubleshoot?"

The troubleshoot skill should auto-invoke if the worker is running.

Proposed Code Improvements

1. Add Diagnostic Slash Command

Create a /claude-mem command for diagnostics. File: plugin/commands/claude-mem.json:

{
  "name": "claude-mem",
  "description": "Claude-mem diagnostics and status",
  "handler": "scripts/diagnostic-command.js"
}

2. Eager Settings Creation

Modify smart-install.js to create settings.json during installation:

const settingsPath = join(homedir(), '.claude-mem', 'settings.json');
if (!existsSync(settingsPath)) {
  mkdirSync(join(homedir(), '.claude-mem'), { recursive: true });
  writeFileSync(settingsPath, JSON.stringify(getDefaults(), null, 2));
  console.log('Created settings.json with defaults');
}

3. Better Windows Error Reporting

Add explicit error messages when worker fails to start on Windows:

if (process.platform === 'win32' && !workerStarted) {
  console.error('Worker failed to start on Windows.');
  console.error('Please run manually: bun plugin/scripts/worker-service.cjs start');
  console.error('And check: https://docs.claude-mem.ai/troubleshooting');
}

4. Health Check Command

Add a simple health check that works without the worker:

// plugin/scripts/health-check.js
const http = require('http');
http.get('http://localhost:37777/health', (res) => {
  if (res.statusCode === 200) console.log('Worker: RUNNING');
  else console.log('Worker: NOT RESPONDING');
}).on('error', () => console.log('Worker: NOT RUNNING'));

Relationship to Issue #557

If Issue #557 relates to initialization issues, this analysis confirms:

  • Settings.json creation is lazy (requires worker)
  • Worker auto-start can fail silently on Windows
  • Users may have incomplete installations without clear error messages

Files Examined

  • /plugin/.claude-plugin/plugin.json - Plugin manifest (no commands)
  • /plugin/hooks/hooks.json - Hook definitions
  • /plugin/scripts/smart-install.js - Installation script
  • /plugin/scripts/worker-service.cjs - Worker service
  • /src/services/worker/http/routes/SettingsRoutes.ts - Settings creation
  • /src/shared/SettingsDefaultsManager.ts - Default values
  • /src/shared/paths.ts - Path definitions
  • /docs/public/troubleshooting.mdx - User documentation
  • /docs/public/usage/getting-started.mdx - User guide

Conclusion

The reported issue is a user expectation mismatch combined with a Windows initialization failure:

  1. /claude-mem diagnostics does not exist - users should use natural language to invoke the troubleshoot skill
  2. The worker service failed to start, causing cascading issues (no settings, no context)
  3. Documentation could be clearer about available commands vs skills
  4. Windows-specific initialization issues are a known pattern

The fix should include both user documentation improvements and potentially adding a /claude-mem diagnostic command for discoverability.