fix(hooks): load SKILL.md from plugin layout#501
Open
chrisvaillancourt wants to merge 1 commit into
Open
Conversation
46ef514 to
87a3b9f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
skills/caveman/SKILL.mdfrom the current pluginsrc/hookslayout before falling back to the legacy flat hook layout.src/hooksinstalls so standalone hooks under$CLAUDE_CONFIG_DIR/hookscannot accidentally read unrelated~/skillscontent.Root Cause
The Claude Code plugin manifest runs
${CLAUDE_PLUGIN_ROOT}/src/hooks/caveman-activate.js, so__dirnameis<plugin_root>/src/hooks. The hook still looked for../skills/caveman/SKILL.md, which resolves to<plugin_root>/src/skills/caveman/SKILL.md. That file does not exist, so the hook silently served the hardcoded fallback instead of the source-of-truth skill body.That fallback is missing the intensity table and wenyan instructions, so plugin installs did not get the full behavior documented in
skills/caveman/SKILL.md.Validation
uv run python -m unittest tests.test_hooksnode src/hooks/caveman-activate.js | rg '## Intensity|Current level:'git diff --checkuv run python -m unittest tests.test_compress_safetynode tests/test_symlink_flag.jsAdditional documented checks were run and failed for existing baseline issues unrelated to this change:
npm testfails in OpenCode installer tests (caveman-compress.mdmissing / temp OpenCode files absent / JSONC parse expectation). This same failure was observed on clean upstreammainbefore this branch.node tests/test_caveman_init.jsfails count-based assertions around current init targets/OpenClaw handling. This same failure was observed on clean upstreammain.Review Notes
Additional review found two hardening gaps in the first draft: the ungated
../../skillsprobe could escape standalone hook installs into~/skills, and the plugin-layout test usedcwd=plugin_root. This version gates the plugin probe tosrc/hooks, runs the regression from an unrelated cwd with a sentinel cwd skill, and adds a standalone-home sentinel test.Overlap
Several open PRs touch
src/hooks/caveman-activate.js, including #483, #448, #411, #407, #401, and #377. This PR keeps the scope to the SKILL.md path lookup and its regression test so it can be rebased independently. Older dirty PRs such as #285 and #269 touch the pre-srchook path and may need the same path logic if revived.Fixes #467