fix(knowledge): resolve the plugin data dir explicitly instead of trusting the Bash env - #6004
Merged
Merged
Conversation
…itly
The Bash tool's environment does not carry CLAUDE_PLUGIN_DATA, and the
codex plugin's SessionStart hook appends its own data dir under that
name to CLAUDE_ENV_FILE, so every Bash call saw codex's directory.
video-digest's setup-deps.mjs then installed the extraction deps there,
and run.mjs resolved @melodic/* from it.
run.mjs and setup-deps.mjs (video-digest and course-digest) now take a
leading --data-dir. Every documented command passes it as
"${CLAUDE_PLUGIN_DATA}", substituted at skill load, or "<plugin-data>"
in the spoke files. Without the flag, an inherited value is accepted
only when its last segment names this plugin, per the
on-demand-dependencies convention. setup-deps.mjs stops before writing
when nothing resolves, and run.mjs hands its child only the resolved
value. The pre-computed checks read the substituted path from argv, and
the recovery command names the launcher by absolute path with the
resolved --data-dir.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A flag-less run.mjs call with another plugin's CLAUDE_PLUGIN_DATA must leave that directory untouched; the child falls back to the auth-store home default instead. The test fails when the launcher's strip of the inherited value is removed. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # plugins/knowledge/.claude-plugin/plugin.json # plugins/knowledge/CHANGELOG.md
This was referenced Oct 3, 2026
# Conflicts: # plugins/knowledge/.claude-plugin/plugin.json # plugins/knowledge/CHANGELOG.md Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
The machine-path lint rejects /home and C:/Users prefixes. The assertions only depend on the last path segment, so the fixtures use /var/fixture and C:/fixture. Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
5 tasks
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.
No related issue: partially addresses #5982 (resolves E1, Q2; E2, E3, I1, I2, I3, Q1, S2 remain open)
Summary
/knowledge:video-digestinstalled its extraction dependencies into another plugin's data directory. The Bash tool's environment never carries a plugin'sCLAUDE_PLUGIN_DATA(plugins reference, fetched 2026-10-02). The codex plugin's SessionStart hook (scripts/session-lifecycle-hook.mjs:80, codex 1.0.6) appendsexport CLAUDE_PLUGIN_DATA=<codex data dir>toCLAUDE_ENV_FILE, so every Bash call saw codex's directory.setup-deps.mjswrotenode_modules/and a stamp there, andrun.mjsresolved@melodic/*from it. course-digest shares the same data directory and had the same defect.Fix
run.mjsandsetup-deps.mjsin video-digest and course-digest take a leading--data-dir. Every documented command passes it as"${CLAUDE_PLUGIN_DATA}", which is substituted when the skill loads, or as"<plugin-data>"in the spoke files and the watch checklist template.setup-deps.mjsexits before writing anything when no directory resolves.run.mjsstrips the inherited value and hands its child only the resolved one.--data-dir. It used to emit a literal${CLAUDE_PLUGIN_ROOT}, which expands to nothing in Bash.Verification
All commands ran on Windows (Git Bash) after merging origin/main:
bash plugins/knowledge/skills/video-digest/scripts/run-tests.sh build: exit 0.bash plugins/knowledge/skills/video-digest/scripts/run-tests.sh test: exit 0, 559 passed.bash plugins/knowledge/skills/course-digest/scripts/run-tests.sh build: exit 0.bash plugins/knowledge/skills/course-digest/scripts/run-tests.sh test: exit 1, 129 passed and 27 failed. All 27 failures are incli-entry.test.jsandcli-browser-artifacts.test.js, which this PR does not touch, and they predate it. Those tests build paths withnew URL(import.meta.url).pathname, which yieldsC:\C:\...on Windows and fails module resolution. All 13 new course-digest tests pass.setup-deps.mjswith a foreignCLAUDE_PLUGIN_DATA(codex-openai-codex) and no flag exits 1 and writes nothing there.run.mjs --data-diroverrides a foreign inherited value.run.mjscall leaves the foreign directory empty. With the strip removed, this test fails.installedfor a populated sandbox directory andMISSINGfor an empty one.scripts/check-changed-skills.sh origin/mainscripts/check-changelog-parity.sh --check,--check-order,--check-bump origin/mainscripts/check-spoke-plugin-root.sh --checkscripts/check-test-tmp-cleanup.sh --checkscripts/check-purged-em-dashes.shRelated
How this PR maps to the findings in #5982:
--data-dironsetup-deps.mjsandrun.mjs.run.mjspasses it to the child asCLAUDE_PLUGIN_DATA, soresolve-hook.mjsresolves from it. Every SKILL.md invocation passes"${CLAUDE_PLUGIN_DATA}". Option 2 too: the preflight probe reads the substituted path. course-digest is fixed the same way${user_config.*}unsubstituted in spokes!preflight refused, no fallbackallowed-toolsentry and no fallback linesetup-deps.mjsnow fails loudly, but the Bootstrap gate's STOP list is unchanged--data-diraccepts any directory, which relocates the install. There is no Prerequisites line on when to use it, and no.work/rung.work/and config-dir rungs are not implemented🤖 Generated with Claude Code