Skip to content

doctor: detect Claude Code plugin-hooks load state (refs #212)#214

Merged
rohitg00 merged 1 commit intomainfrom
fix/212-doctor-plugin-hooks
Apr 29, 2026
Merged

doctor: detect Claude Code plugin-hooks load state (refs #212)#214
rohitg00 merged 1 commit intomainfrom
fix/212-doctor-plugin-hooks

Conversation

@rohitg00
Copy link
Copy Markdown
Owner

@rohitg00 rohitg00 commented Apr 29, 2026

Summary

  • agentmemory doctor gains a check that verifies whether Claude Code actually loaded the plugin's hooks
  • Scans ~/.claude/debug/latest for the Loaded hooks from standard location for plugin agentmemory log line
  • Surfaces the silent failure mode reported in hooks not running in claude. #212: plugin enabled, hooks.json present, but hooks never fire

Why

#212 reports plugin hooks not auto-registering after /plugin install. Bug does not reproduce on macOS + CC 2.1.120 + agentmemory 0.9.3 (verified via debug log + injected probe), but when it does happen the user gets no signal — hooks silently do nothing. This adds a diagnostic so doctor can flag the failure mode and point at a remediation (reinstall + restart, CC version floor).

Check states

State UI Meaning
loaded ✓ + manifest path CC picked up hooks/hooks.json
not-loaded ✗ + reinstall hint debug log exists but no agentmemory hook-load line
no-debug-log ✗ + run-with-debug hint ~/.claude/debug exists, no .txt log yet
no-cc-dir (skipped) no ~/.claude/debug — user likely doesn't use Claude Code

Test plan

  • Build clean (npm run build)
  • Pre-existing test failures (mcp-standalone, fs-watcher) unchanged
  • Smoke-tested checkClaudeCodeHooks() against current ~/.claude/debug/latest — returns loaded with manifest path
  • Run agentmemory doctor end-to-end with server up (manual)

Summary by CodeRabbit

  • New Features
    • The doctor command now includes enhanced verification for Claude Code plugin registration, checking local debug logs to report loading status and provide remediation guidance when issues are detected.

Adds a check to `agentmemory doctor` that scans the latest Claude Code
debug log (~/.claude/debug/latest) for the
`Loaded hooks from standard location for plugin agentmemory` line.

When the plugin manifest is enabled but the hooks never auto-register,
users see no error -- the plugin silently does nothing. Doctor now
surfaces this with a remediation hint (reinstall + restart, require
CC >= 2.1.x).

States:
- loaded:        ✓  shows manifest path resolved by CC
- not-loaded:    ✗  hints reinstall + restart
- no-debug-log:  ✗  hints to run claude --debug once
- no-cc-dir:     skipped (user may not use Claude Code)

Refs #212.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentmemory Ready Ready Preview, Comment Apr 29, 2026 11:04am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The doctor command now performs local verification of Claude Code plugin hook registration by inspecting ~/.claude/debug, locating the latest debug log, reading it, and classifying the plugin loading state to provide targeted diagnostic feedback.

Changes

Cohort / File(s) Summary
Doctor Command Enhancement
src/cli.ts
Added logic to inspect ~/.claude/debug for the latest debug log, classify plugin hook registration status (loaded/not-loaded/missing-log), and append diagnostic check results with remediation hints or manifest paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The doctor's nose now twitches with delight,
Peering into debug logs, searching for the light,
Plugin hooks are measured, classified with care,
Diagnostic wisdom shared with all to spare!
Verification hops along, precise and true,
Better health checks await the code review! 🔍

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding detection of Claude Code plugin-hooks load state to the doctor command, with a reference to the related issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/212-doctor-plugin-hooks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@rohitg00 rohitg00 merged commit 2dfe128 into main Apr 29, 2026
4 of 5 checks passed
@rohitg00 rohitg00 deleted the fix/212-doctor-plugin-hooks branch April 29, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant